소스 검색

Correct error response for Q/W

Eric Betts 11 달 전
부모
커밋
ec5ff5d0d8
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      virtual_portal.c

+ 7 - 4
virtual_portal.c

@@ -114,6 +114,7 @@ int virtual_portal_reset(VirtualPortal* virtual_portal, uint8_t* message, uint8_
     FURI_LOG_D(TAG, "process %c", message[0]);
 
     virtual_portal->active = false;
+    //virtual_portal->sequence_number = 0;
     for(int i = 0; i < POF_TOKEN_LIMIT; i++) {
         if(virtual_portal->tokens[i]->loaded) {
             virtual_portal->tokens[i]->change = true;
@@ -278,8 +279,9 @@ int virtual_portal_query(VirtualPortal* virtual_portal, uint8_t* message, uint8_
     PoFToken* pof_token = virtual_portal->tokens[arrayIndex];
     if(!pof_token->loaded) {
         response[0] = 'Q';
-        response[1] = 0x01;
-        return 2;
+        response[1] = 0x00 | arrayIndex;
+        response[2] = blockNum;
+        return 3;
     }
     NfcDevice* nfc_device = pof_token->nfc_device;
     const MfClassicData* data = nfc_device_get_data(nfc_device, NfcProtocolMfClassic);
@@ -306,8 +308,9 @@ int virtual_portal_write(VirtualPortal* virtual_portal, uint8_t* message, uint8_
     PoFToken* pof_token = virtual_portal->tokens[arrayIndex];
     if(!pof_token->loaded) {
         response[0] = 'W';
-        response[1] = 0x01;
-        return 2;
+        response[1] = 0x00 | arrayIndex;
+        response[2] = blockNum;
+        return 3;
     }
 
     NfcDevice* nfc_device = pof_token->nfc_device;