Adds new feature to write and read location tags
Location tags can be written via the website. If a location tag is read after reading a spool tag, the location of the spool will be updated in spoolman to the location from the tag.
This commit is contained in:
18
src/nfc.cpp
18
src/nfc.cpp
@@ -218,11 +218,25 @@ bool decodeNdefAndReturnJson(const byte* encodedMessage) {
|
||||
// Sende die aktualisierten AMS-Daten an alle WebSocket-Clients
|
||||
Serial.println("JSON-Dokument erfolgreich verarbeitet");
|
||||
Serial.println(doc.as<String>());
|
||||
if (doc["sm_id"] != "")
|
||||
if (doc.containsKey("sm_id") && doc["sm_id"] != "")
|
||||
{
|
||||
Serial.println("SPOOL-ID gefunden: " + doc["sm_id"].as<String>());
|
||||
spoolId = doc["sm_id"].as<String>();
|
||||
}
|
||||
}
|
||||
else if(doc.containsKey("location") && doc["location"] != "")
|
||||
{
|
||||
Serial.println("Location Tag found!");
|
||||
String location = doc["location"].as<String>();
|
||||
if(spoolId != ""){
|
||||
updateSpoolLocation(spoolId, location);
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("Location update tag scanned without scanning spool before!");
|
||||
oledShowMessage("No spool scanned before!");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("Keine SPOOL-ID gefunden.");
|
||||
|
Reference in New Issue
Block a user