Skip to content

chore: Remove vestigial database template from NCH #129

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
Nov 4, 2024
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
37 changes: 0 additions & 37 deletions src/NotecardConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
#define NOTEFILE_BASE_NAME "arduino_iot_cloud"

// Notecard LoRa requires us to choose an arbitrary port between 1-99
#define NOTEFILE_DATABASE_LORA_PORT 1
#define NOTEFILE_INBOUND_LORA_PORT 2
#define NOTEFILE_OUTBOUND_LORA_PORT 3

// Note that we use "s" versions of the Notefile extensions to ensure that
// traffic always happens on a secure transport
#define NOTEFILE_SECURE_DATABASE NOTEFILE_BASE_NAME ".dbs"
#define NOTEFILE_SECURE_INBOUND NOTEFILE_BASE_NAME ".qis"
#define NOTEFILE_SECURE_OUTBOUND NOTEFILE_BASE_NAME ".qos"

Expand Down Expand Up @@ -423,41 +421,6 @@ NetworkConnectionState NotecardConnectionHandler::update_handleInit()
}
#endif

// Set database template to support LoRa/Satellite Notecard
if (NetworkConnectionState::INIT == result) {
if (J *req = _notecard.newRequest("note.template")) {
JAddStringToObject(req, "file", NOTEFILE_SECURE_DATABASE);
JAddStringToObject(req, "format", "compact"); // Support LoRa/Satellite Notecards
JAddIntToObject(req, "port", NOTEFILE_DATABASE_LORA_PORT); // Support LoRa/Satellite Notecards
if (J *body = JAddObjectToObject(req, "body")) {
JAddStringToObject(body, "text", TSTRINGV);
JAddNumberToObject(body, "value", TFLOAT64);
JAddBoolToObject(body, "flag", TBOOL);
if (J *rsp = _notecard.requestAndResponse(req)) {
// Check the response for errors
if (NoteResponseError(rsp)) {
const char *err = JGetString(rsp, "err");
Debug.print(DBG_ERROR, F("%s"), err);
result = NetworkConnectionState::ERROR;
} else {
result = NetworkConnectionState::INIT;
}
JDelete(rsp);
} else {
Debug.print(DBG_ERROR, F("Failed to receive response from Notecard."));
result = NetworkConnectionState::ERROR; // Assume the worst
}
} else {
Debug.print(DBG_ERROR, "Failed to allocate request: note.template:body");
JFree(req);
result = NetworkConnectionState::ERROR; // Assume the worst
}
} else {
Debug.print(DBG_ERROR, "Failed to allocate request: note.template");
result = NetworkConnectionState::ERROR; // Assume the worst
}
}

// Set inbound template to support LoRa/Satellite Notecard
if (NetworkConnectionState::INIT == result) {
if (J *req = _notecard.newRequest("note.template")) {
Expand Down
3 changes: 2 additions & 1 deletion src/NotecardConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define NOTECARD_CONNECTION_HANDLER_VERSION_MAJOR 1
#define NOTECARD_CONNECTION_HANDLER_VERSION_MINOR 0
#define NOTECARD_CONNECTION_HANDLER_VERSION_PATCH 0
#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 Expand Up @@ -261,6 +261,7 @@ class NotecardConnectionHandler final : public ConnectionHandler
* @param interval_min[in] The inbound polling interval (in minutes)
*
* @note Set the interval to 0 to disable inbound polling.
* @note Must be set prior to initializing the connection to the Notecard.
*/
inline void setNotehubPollingInterval (int32_t interval_min) {
_inbound_polling_interval_min = (interval_min ? interval_min : -1);
Expand Down