From e24f79945f17eae13d808076531fb70194305d89 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 9 Oct 2024 07:33:49 +0200 Subject: [PATCH] SE050: add API to read serial number raw bytes --- cores/arduino/api | 2 +- extras/tinyusb | 2 +- extras/uno-r4-wifi-usb-bridge | 2 +- libraries/SE05X/src/SE05X.cpp | 13 +++++++++++++ libraries/SE05X/src/SE05X.h | 1 + 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cores/arduino/api b/cores/arduino/api index d615d884..14b03135 120000 --- a/cores/arduino/api +++ b/cores/arduino/api @@ -1 +1 @@ -../../../ArduinoCore-API/api/ \ No newline at end of file +/home/pennam/Arduino/API/api/ \ No newline at end of file diff --git a/extras/tinyusb b/extras/tinyusb index c796dcfe..7bf59230 160000 --- a/extras/tinyusb +++ b/extras/tinyusb @@ -1 +1 @@ -Subproject commit c796dcfe0bee337547437632dc16829038ef0f3d +Subproject commit 7bf5923052e5861f54c9cb0581e328f8be26a0a9 diff --git a/extras/uno-r4-wifi-usb-bridge b/extras/uno-r4-wifi-usb-bridge index a634856e..8fc4869f 160000 --- a/extras/uno-r4-wifi-usb-bridge +++ b/extras/uno-r4-wifi-usb-bridge @@ -1 +1 @@ -Subproject commit a634856e5467022bc7587e7c8a856811255ea890 +Subproject commit 8fc4869ff51d3dfbee7d90cd7bd4a1b1a4011c95 diff --git a/libraries/SE05X/src/SE05X.cpp b/libraries/SE05X/src/SE05X.cpp index 43801665..d4530f93 100644 --- a/libraries/SE05X/src/SE05X.cpp +++ b/libraries/SE05X/src/SE05X.cpp @@ -108,6 +108,19 @@ void SE05XClass::end() Se05x_API_SessionClose(&_se05x_session); } +int SE05XClass::serialNumber(byte sn[], size_t length) +{ + size_t uidLen; + const int kSE05x_AppletResID_UNIQUE_ID = 0x7FFF0206, + + status = Se05x_API_ReadObject(&_se05x_session, kSE05x_AppletResID_UNIQUE_ID, 0, length, sn, &uidLen); + if (status != SM_OK || length != uidLen) { + SMLOG_E("Error in Se05x_API_ReadObject \n"); + return 0; + } + return 1; +} + String SE05XClass::serialNumber() { String result = (char*)NULL; diff --git a/libraries/SE05X/src/SE05X.h b/libraries/SE05X/src/SE05X.h index 0ed95a60..781c09a1 100644 --- a/libraries/SE05X/src/SE05X.h +++ b/libraries/SE05X/src/SE05X.h @@ -42,6 +42,7 @@ class SE05XClass int begin(); void end(); + int serialNumber(byte sn[], size_t length); #if defined (ARDUINO) String serialNumber(); #endif