Skip to content

Commit

Permalink
feat: remove ndef callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
DeimosHall committed Aug 8, 2023
1 parent 5de7eb7 commit d27531a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 116 deletions.
114 changes: 0 additions & 114 deletions src/Electroniccats_PN7150.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1621,120 +1621,6 @@ void Electroniccats_PN7150::WriteNdef(RfIntf_t RfIntf) {
}
}

void Electroniccats_PN7150::NdefPull_Cb(unsigned char *pNdefMessage, unsigned short NdefMessageSize) {
unsigned char *pNdefRecord = pNdefMessage;
NdefRecord_t NdefRecord;
unsigned char save;

if (pNdefMessage == NULL) {
Serial.println("--- Provisioned buffer size too small or NDEF message empty");
return;
}

while (pNdefRecord != NULL) {
Serial.println("--- NDEF record received:");

NdefRecord = DetectNdefRecordType(pNdefRecord);

switch (NdefRecord.recordType) {
case MEDIA_VCARD: {
save = NdefRecord.recordPayload[NdefRecord.recordPayloadSize];
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = '\0';
Serial.print("vCard:");
// Serial.println(NdefRecord.recordPayload);
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = save;
} break;

case WELL_KNOWN_SIMPLE_TEXT: {
save = NdefRecord.recordPayload[NdefRecord.recordPayloadSize];
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = '\0';
Serial.print("Text record:");
// Serial.println(&NdefRecord.recordPayload[NdefRecord.recordPayload[0]+1]);
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = save;
} break;

case WELL_KNOWN_SIMPLE_URI: {
save = NdefRecord.recordPayload[NdefRecord.recordPayloadSize];
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = '\0';
Serial.print("URI record: ");
// Serial.println(ndef_helper_UriHead(NdefRecord.recordPayload[0]), &NdefRecord.recordPayload[1]);
NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = save;
} break;

case MEDIA_HANDOVER_WIFI: {
unsigned char index = 0, i;

Serial.println("--- Received WIFI credentials:");
if ((NdefRecord.recordPayload[index] == 0x10) && (NdefRecord.recordPayload[index + 1] == 0x0e))
index += 4;
while (index < NdefRecord.recordPayloadSize) {
if (NdefRecord.recordPayload[index] == 0x10) {
if (NdefRecord.recordPayload[index + 1] == 0x45) {
Serial.print("- SSID = ");
for (i = 0; i < NdefRecord.recordPayload[index + 3]; i++)
Serial.print(NdefRecord.recordPayload[index + 4 + i]);
Serial.println("");
} else if (NdefRecord.recordPayload[index + 1] == 0x03) {
Serial.print("- Authenticate Type = ");
Serial.println(ndef_helper_WifiAuth(NdefRecord.recordPayload[index + 5]));
} else if (NdefRecord.recordPayload[index + 1] == 0x0f) {
Serial.print("- Encryption Type = ");
Serial.println(ndef_helper_WifiEnc(NdefRecord.recordPayload[index + 5]));
} else if (NdefRecord.recordPayload[index + 1] == 0x27) {
Serial.print("- Network key = ");
for (i = 0; i < NdefRecord.recordPayload[index + 3]; i++)
Serial.print("#");
Serial.println("");
}
index += 4 + NdefRecord.recordPayload[index + 3];
} else
continue;
}
} break;

case WELL_KNOWN_HANDOVER_SELECT:
Serial.print("Handover select version ");
Serial.print(NdefRecord.recordPayload[0] >> 4);
Serial.println(NdefRecord.recordPayload[0] & 0xF);
break;

case WELL_KNOWN_HANDOVER_REQUEST:
Serial.print("Handover request version ");
Serial.print(NdefRecord.recordPayload[0] >> 4);
Serial.println(NdefRecord.recordPayload[0] & 0xF);
break;

case MEDIA_HANDOVER_BT:
Serial.print("BT Handover payload = ");
// Serial.print(NdefRecord.recordPayload);
// Serial.println(NdefRecord.recordPayloadSize);
break;

case MEDIA_HANDOVER_BLE:
Serial.print("BLE Handover payload = ");
// Serial.print(NdefRecord.recordPayload);
// Serial.println(NdefRecord.recordPayloadSize);
break;

case MEDIA_HANDOVER_BLE_SECURE:
Serial.print(" BLE secure Handover payload = ");
// Serial.println(NdefRecord.recordPayload, NdefRecord.recordPayloadSize);
break;

default:
Serial.println("Unsupported NDEF record, cannot parse");
break;
}
pNdefRecord = GetNextRecord(pNdefRecord);
}

Serial.println("");
}

void Electroniccats_PN7150::NdefPush_Cb(unsigned char *pNdefRecord, unsigned short NdefRecordSize) {
Serial.println("--- NDEF Record sent");
}

bool Electroniccats_PN7150::nciFactoryTestPrbs(NxpNci_TechType_t type, NxpNci_Bitrate_t bitrate) {
uint8_t NCIPrbs_1stGen[] = {0x2F, 0x30, 0x04, 0x00, 0x00, 0x01, 0x01};
uint8_t NCIPrbs_2ndGen[] = {0x2F, 0x30, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01};
Expand Down
2 changes: 0 additions & 2 deletions src/Electroniccats_PN7150.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ class Electroniccats_PN7150 {
bool ReaderReActivate(RfIntf_t *pRfIntf); // Deprecated, use readerReActivate() instead
bool readerActivateNext(RfIntf_t *pRfIntf);
bool ReaderActivateNext(RfIntf_t *pRfIntf); // Deprecated, use readerActivateNext() instead
void NdefPull_Cb(unsigned char *pNdefMessage, unsigned short NdefMessageSize);
void NdefPush_Cb(unsigned char *pNdefRecord, unsigned short NdefRecordSize);
bool nciFactoryTestPrbs(NxpNci_TechType_t type, NxpNci_Bitrate_t bitrate);
bool NxpNci_FactoryTest_Prbs(NxpNci_TechType_t type, NxpNci_Bitrate_t bitrate); // Deprecated, use nciFactoryTestPrbs() instead
bool NxpNci_FactoryTest_RfOn(void);
Expand Down

0 comments on commit d27531a

Please sign in to comment.