diff --git a/chameleonultragui/lib/bridge/chameleon.dart b/chameleonultragui/lib/bridge/chameleon.dart index 1597e6a2..88af9cf1 100644 --- a/chameleonultragui/lib/bridge/chameleon.dart +++ b/chameleonultragui/lib/bridge/chameleon.dart @@ -618,24 +618,27 @@ class ChameleonCommunicator { } Future>>>> - getMf1DetectionResult(int index) async { - // Get results from index - var resp = (await sendCmd(ChameleonCommand.mf1GetDetectionResult, - data: Uint8List(4) - ..buffer.asByteData().setInt16(0, index, Endian.big)))! - .data; + getMf1DetectionResult(int count) async { List resultList = []; - int pos = 0; - while (pos < resp.length) { - resultList.add(DetectionResult( - block: resp[0 + pos], - type: 0x60 + (resp[1 + pos] & 0x01), - isNested: (resp[1 + pos] >> 1 & 0x01) == 0x01, - uid: bytesToU32(resp.sublist(2 + pos, 6 + pos)), - nt: bytesToU32(resp.sublist(6 + pos, 10 + pos)), - nr: bytesToU32(resp.sublist(10 + pos, 14 + pos)), - ar: bytesToU32(resp.sublist(14 + pos, 18 + pos)))); - pos += 18; + while (resultList.length < count) { + // Get results from index + var resp = (await sendCmd(ChameleonCommand.mf1GetDetectionResult, + data: Uint8List(4) + ..buffer.asByteData().setInt32(0, resultList.length, Endian.big)))! + .data; + + int pos = 0; + while (pos < resp.length) { + resultList.add(DetectionResult( + block: resp[0 + pos], + type: 0x60 + (resp[1 + pos] & 0x01), + isNested: (resp[1 + pos] >> 1 & 0x01) == 0x01, + uid: bytesToU32(resp.sublist(2 + pos, 6 + pos)), + nt: bytesToU32(resp.sublist(6 + pos, 10 + pos)), + nr: bytesToU32(resp.sublist(10 + pos, 14 + pos)), + ar: bytesToU32(resp.sublist(14 + pos, 18 + pos)))); + pos += 18; + } } // Classify diff --git a/chameleonultragui/lib/gui/page/mfkey32.dart b/chameleonultragui/lib/gui/page/mfkey32.dart index cc1bcd26..75ba15fe 100644 --- a/chameleonultragui/lib/gui/page/mfkey32.dart +++ b/chameleonultragui/lib/gui/page/mfkey32.dart @@ -63,7 +63,8 @@ class Mfkey32PageState extends State { Future handleMfkeyCalculation() async { var appState = context.read(); - var detections = await appState.communicator!.getMf1DetectionResult(0); + var count = await appState.communicator!.getMf1DetectionCount(); + var detections = await appState.communicator!.getMf1DetectionResult(count); for (var item in detections.entries) { var uid = item.key; for (var item in item.value.entries) {