Compare commits

..

6 Commits

Author SHA1 Message Date
d897817020 docs: update changelog and header for version v1.5.12-beta4
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m13s
2025-08-29 09:06:44 +02:00
686eb22232 docs: update platformio.ini for beta version v1.5.12-beta4 2025-08-29 09:06:44 +02:00
a2816da654 feat: enhance NDEF decoding to validate structure and extract JSON payload 2025-08-29 09:06:37 +02:00
cc8f1cfd7b docs: update changelog and header for version v1.5.12-beta3
All checks were successful
Release Workflow / detect-provider (push) Successful in 2s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m13s
2025-08-29 08:54:59 +02:00
d195f76d5e docs: update platformio.ini for beta version v1.5.12-beta3 2025-08-29 08:54:59 +02:00
6bed3b086c feat: add logging for decoded JSON data in NFC processing 2025-08-29 08:54:53 +02:00
3 changed files with 69 additions and 6 deletions

View File

@@ -1,5 +1,21 @@
# Changelog
## [1.5.12-beta4] - 2025-08-29
### Added
- enhance NDEF decoding to validate structure and extract JSON payload
### Changed
- update platformio.ini for beta version v1.5.12-beta4
## [1.5.12-beta3] - 2025-08-29
### Added
- add logging for decoded JSON data in NFC processing
### Changed
- update platformio.ini for beta version v1.5.12-beta3
## [1.5.12-beta2] - 2025-08-29
### Changed
- update platformio.ini for beta version v1.5.12-beta2

View File

@@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.5.12-beta2"
version = "1.5.12-beta4"
to_old_version = "1.5.0"
##

View File

@@ -206,16 +206,63 @@ uint8_t ntag2xx_WriteNDEF(const char *payload) {
bool decodeNdefAndReturnJson(const byte* encodedMessage, String uidString) {
oledShowProgressBar(1, octoEnabled?5:4, "Reading", "Decoding data");
byte typeLength = encodedMessage[3];
byte payloadLength = encodedMessage[4];
// Check for NDEF TLV (Type-Length-Value) structure
if (encodedMessage[0] != 0x03) {
Serial.println("Not a valid NDEF message (missing TLV tag 0x03)");
return false;
}
// Get the total NDEF message length from TLV
byte ndefMessageLength = encodedMessage[1];
// Skip TLV header (2 bytes) to get to NDEF record
const byte* ndefRecord = &encodedMessage[2];
// Parse NDEF record header
byte recordHeader = ndefRecord[0];
byte typeLength = ndefRecord[1];
// Determine payload length (can be 1 or 4 bytes depending on SR flag)
uint32_t payloadLength = 0;
byte payloadLengthBytes = 1;
// Check if Short Record (SR) flag is set
if (recordHeader & 0x10) { // SR flag
payloadLength = ndefRecord[2];
payloadLengthBytes = 1;
} else {
// Long record format (4 bytes for payload length)
payloadLength = (ndefRecord[2] << 24) | (ndefRecord[3] << 16) |
(ndefRecord[4] << 8) | ndefRecord[5];
payloadLengthBytes = 4;
}
Serial.print("NDEF Record Header: 0x");
Serial.println(recordHeader, HEX);
Serial.print("Type Length: ");
Serial.println(typeLength);
Serial.print("Payload Length: ");
Serial.println(payloadLength);
// Calculate offset to payload
byte payloadOffset = 2 + payloadLengthBytes + typeLength;
// Verify we have enough data
if (payloadOffset + payloadLength > ndefMessageLength + 2) {
Serial.println("Invalid NDEF structure - payload extends beyond message");
return false;
}
nfcJsonData = "";
for (int i = 2; i < payloadLength+2; i++)
{
nfcJsonData += (char)encodedMessage[3 + typeLength + i];
// Extract JSON payload
for (uint32_t i = 0; i < payloadLength; i++) {
nfcJsonData += (char)ndefRecord[payloadOffset + i];
}
Serial.println("Decoded JSON Data:");
Serial.println(nfcJsonData);
// JSON-Dokument verarbeiten
JsonDocument doc;
DeserializationError error = deserializeJson(doc, nfcJsonData);