Skip to content

Commit c72dfdb

Browse files
authored
Merge pull request #129 from zfields/nch-clean
chore: Remove vestigial database template from NCH
2 parents 9cc75b6 + d6a727a commit c72dfdb

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

Diff for: src/NotecardConnectionHandler.cpp

-37
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@
3131
#define NOTEFILE_BASE_NAME "arduino_iot_cloud"
3232

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

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

@@ -423,41 +421,6 @@ NetworkConnectionState NotecardConnectionHandler::update_handleInit()
423421
}
424422
#endif
425423

426-
// Set database template to support LoRa/Satellite Notecard
427-
if (NetworkConnectionState::INIT == result) {
428-
if (J *req = _notecard.newRequest("note.template")) {
429-
JAddStringToObject(req, "file", NOTEFILE_SECURE_DATABASE);
430-
JAddStringToObject(req, "format", "compact"); // Support LoRa/Satellite Notecards
431-
JAddIntToObject(req, "port", NOTEFILE_DATABASE_LORA_PORT); // Support LoRa/Satellite Notecards
432-
if (J *body = JAddObjectToObject(req, "body")) {
433-
JAddStringToObject(body, "text", TSTRINGV);
434-
JAddNumberToObject(body, "value", TFLOAT64);
435-
JAddBoolToObject(body, "flag", TBOOL);
436-
if (J *rsp = _notecard.requestAndResponse(req)) {
437-
// Check the response for errors
438-
if (NoteResponseError(rsp)) {
439-
const char *err = JGetString(rsp, "err");
440-
Debug.print(DBG_ERROR, F("%s"), err);
441-
result = NetworkConnectionState::ERROR;
442-
} else {
443-
result = NetworkConnectionState::INIT;
444-
}
445-
JDelete(rsp);
446-
} else {
447-
Debug.print(DBG_ERROR, F("Failed to receive response from Notecard."));
448-
result = NetworkConnectionState::ERROR; // Assume the worst
449-
}
450-
} else {
451-
Debug.print(DBG_ERROR, "Failed to allocate request: note.template:body");
452-
JFree(req);
453-
result = NetworkConnectionState::ERROR; // Assume the worst
454-
}
455-
} else {
456-
Debug.print(DBG_ERROR, "Failed to allocate request: note.template");
457-
result = NetworkConnectionState::ERROR; // Assume the worst
458-
}
459-
}
460-
461424
// Set inbound template to support LoRa/Satellite Notecard
462425
if (NetworkConnectionState::INIT == result) {
463426
if (J *req = _notecard.newRequest("note.template")) {

Diff for: src/NotecardConnectionHandler.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#define NOTECARD_CONNECTION_HANDLER_VERSION_MAJOR 1
3131
#define NOTECARD_CONNECTION_HANDLER_VERSION_MINOR 0
32-
#define NOTECARD_CONNECTION_HANDLER_VERSION_PATCH 0
32+
#define NOTECARD_CONNECTION_HANDLER_VERSION_PATCH 1
3333

3434
#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)
3535

@@ -261,6 +261,7 @@ class NotecardConnectionHandler final : public ConnectionHandler
261261
* @param interval_min[in] The inbound polling interval (in minutes)
262262
*
263263
* @note Set the interval to 0 to disable inbound polling.
264+
* @note Must be set prior to initializing the connection to the Notecard.
264265
*/
265266
inline void setNotehubPollingInterval (int32_t interval_min) {
266267
_inbound_polling_interval_min = (interval_min ? interval_min : -1);

0 commit comments

Comments
 (0)