Skip to content

chore: refactor device id handling #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/NotecardConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,13 @@ bool NotecardConnectionHandler::updateUidCache (void)
result = false;
} else {
_notecard_uid = JGetString(rsp, "device");
_device_id = JGetString(rsp, "sn");
_device_id = (_device_id.length() ? _device_id : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
Debug.print(DBG_DEBUG, F("NotecardConnectionHandler::%s updated cache with Notecard UID: <%s> and Arduino Device ID: <%s>"), __FUNCTION__, _notecard_uid.c_str(), _device_id.c_str());
char device_id[] = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
if (NoteGetEnv("_arduino_device_id", device_id, device_id, sizeof(device_id))) {
_device_id = device_id;
} else {
Debug.print(DBG_DEBUG, F("NotecardConnectionHandler::%s Arduino Device ID not cached on Notecard, using default value: <%s>"), __FUNCTION__, _device_id.c_str());
}
Debug.print(DBG_DEBUG, F("NotecardConnectionHandler::%s updated local cache with Notecard UID: <%s> and Arduino Device ID: <%s>"), __FUNCTION__, _notecard_uid.c_str(), _device_id.c_str());
result = true;
}
JDelete(rsp);
Expand Down
2 changes: 1 addition & 1 deletion src/NotecardConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
******************************************************************************/

#define NOTECARD_CONNECTION_HANDLER_VERSION_MAJOR 1
#define NOTECARD_CONNECTION_HANDLER_VERSION_MINOR 0
#define NOTECARD_CONNECTION_HANDLER_VERSION_MINOR 1
#define NOTECARD_CONNECTION_HANDLER_VERSION_PATCH 1

#define NOTECARD_CONNECTION_HANDLER_VERSION NOTE_C_STRINGIZE(NOTECARD_CONNECTION_HANDLER_VERSION_MAJOR) "." NOTE_C_STRINGIZE(NOTECARD_CONNECTION_HANDLER_VERSION_MINOR) "." NOTE_C_STRINGIZE(NOTECARD_CONNECTION_HANDLER_VERSION_PATCH)
Expand Down