Skip to content

Commit a8e89dc

Browse files
committed
feat: ArduinoIoTCloudNotecard
1 parent ae0194d commit a8e89dc

21 files changed

+832
-50
lines changed

Diff for: examples/ArduinoIoTCloud-Advanced/ArduinoIoTCloud-Advanced.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This sketch demonstrates how to use more complex cloud data types such as a colour or coordinates.
33
44
IMPORTANT:
5-
This sketch works with WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
5+
This sketch works with Notecard, WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
66
On a LoRa board, if it is configured as a class A device (default and preferred option),
77
values from Cloud dashboard are received only after a value is sent to Cloud.
88

Diff for: examples/ArduinoIoTCloud-Advanced/thingProperties.h

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <Arduino_ConnectionHandler.h>
33
#include "arduino_secrets.h"
44

5-
#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
5+
#if !(defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
66
defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
77
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
88
#endif
@@ -11,6 +11,14 @@
1111
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1212
#endif
1313

14+
#if defined(USE_NOTECARD)
15+
/* The Notecard can provide connectivity to almost any board via ESLOV (I2C)
16+
* or UART. An empty string (or the default value provided below) will not
17+
* override the Notecard's existing configuration.
18+
* Learn more at: https://dev.blues.io */
19+
#define NOTECARD_PRODUCT_UID "com.domain.you:product"
20+
#endif
21+
1422
void onSwitchButtonChange();
1523
void onColorChange();
1624

@@ -23,7 +31,7 @@ void initProperties() {
2331
ArduinoCloud.setBoardId(BOARD_ID);
2432
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY);
2533
#endif
26-
#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)
34+
#if defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)
2735
ArduinoCloud.addProperty(switchButton, Permission::Write).onUpdate(onSwitchButtonChange);
2836
ArduinoCloud.addProperty(location, Permission::Read).publishOnChange(0.0f);
2937
ArduinoCloud.addProperty(color, Permission::ReadWrite).onUpdate(onColorChange);
@@ -34,7 +42,9 @@ void initProperties() {
3442
#endif
3543
}
3644

37-
#if defined(BOARD_HAS_WIFI)
45+
#if defined(USE_NOTECARD)
46+
NotecardConnectionHandler ArduinoIoTPreferredConnection(NOTECARD_PRODUCT_UID);
47+
#elif defined(BOARD_HAS_WIFI)
3848
WiFiConnectionHandler ArduinoIoTPreferredConnection(SECRET_WIFI_SSID, SECRET_WIFI_PASS);
3949
#elif defined(BOARD_HAS_GSM)
4050
GSMConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);

Diff for: examples/ArduinoIoTCloud-Basic/ArduinoIoTCloud-Basic.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* When you flip the switch in the Cloud dashboard the onboard LED lights gets turned ON or OFF.
77
88
IMPORTANT:
9-
This sketch works with WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
9+
This sketch works with Notecard, WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
1010
On a LoRa board, if it is configured as a class A device (default and preferred option),
1111
values from Cloud dashboard are received only after a value is sent to Cloud.
1212

Diff for: examples/ArduinoIoTCloud-Basic/thingProperties.h

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <Arduino_ConnectionHandler.h>
33
#include "arduino_secrets.h"
44

5-
#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
5+
#if !(defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
66
defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
77
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
88
#endif
@@ -11,6 +11,14 @@
1111
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1212
#endif
1313

14+
#if defined(USE_NOTECARD)
15+
/* The Notecard can provide connectivity to almost any board via ESLOV (I2C)
16+
* or UART. An empty string (or the default value provided below) will not
17+
* override the Notecard's existing configuration.
18+
* Learn more at: https://dev.blues.io */
19+
#define NOTECARD_PRODUCT_UID "com.domain.you:product"
20+
#endif
21+
1422
void onLedChange();
1523

1624
bool led;
@@ -26,14 +34,16 @@ void initProperties() {
2634
ArduinoCloud.addProperty(led, Permission::Write).onUpdate(onLedChange);
2735
ArduinoCloud.addProperty(potentiometer, Permission::Read).publishOnChange(10);
2836
ArduinoCloud.addProperty(seconds, Permission::Read).publishOnChange(1);
29-
#elif defined(BOARD_HAS_LORA)
37+
#elif defined(USE_NOTECARD) || defined(BOARD_HAS_LORA)
3038
ArduinoCloud.addProperty(led, 1, Permission::ReadWrite).onUpdate(onLedChange);
3139
ArduinoCloud.addProperty(potentiometer, 2, Permission::Read).publishOnChange(10);
3240
ArduinoCloud.addProperty(seconds, 3, Permission::Read).publishEvery(5 * MINUTES);
3341
#endif
3442
}
3543

36-
#if defined(BOARD_HAS_ETHERNET)
44+
#if defined(USE_NOTECARD)
45+
NotecardConnectionHandler ArduinoIoTPreferredConnection(NOTECARD_PRODUCT_UID);
46+
#elif defined(BOARD_HAS_ETHERNET)
3747
/* DHCP mode */
3848
//EthernetConnectionHandler ArduinoIoTPreferredConnection;
3949
/* Manual mode. It will fallback in DHCP mode if SECRET_OPTIONAL_IP is invalid or equal to "0.0.0.0" */

Diff for: examples/ArduinoIoTCloud-Callbacks/ArduinoIoTCloud-Callbacks.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
One function per event can be assigned.
1919
2020
IMPORTANT:
21-
This sketch works with WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
21+
This sketch works with Notecard, WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
2222
On a LoRa board, if it is configured as a class A device (default and preferred option),
2323
values from Cloud dashboard are received only after a value is sent to Cloud.
2424

Diff for: examples/ArduinoIoTCloud-Callbacks/thingProperties.h

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <Arduino_ConnectionHandler.h>
33
#include "arduino_secrets.h"
44

5-
#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
5+
#if !(defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
66
defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
77
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
88
#endif
@@ -11,14 +11,24 @@
1111
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1212
#endif
1313

14+
#if defined(USE_NOTECARD)
15+
/* The Notecard can provide connectivity to almost any board via ESLOV (I2C)
16+
* or UART. An empty string (or the default value provided below) will not
17+
* override the Notecard's existing configuration.
18+
* Learn more at: https://dev.blues.io */
19+
#define NOTECARD_PRODUCT_UID "com.domain.you:product"
20+
#endif
21+
1422
void initProperties() {
1523
#if defined(BOARD_HAS_SECRET_KEY)
1624
ArduinoCloud.setBoardId(BOARD_ID);
1725
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY);
1826
#endif
1927
}
2028

21-
#if defined(BOARD_HAS_WIFI)
29+
#if defined(USE_NOTECARD)
30+
NotecardConnectionHandler ArduinoIoTPreferredConnection(NOTECARD_PRODUCT_UID);
31+
#elif defined(BOARD_HAS_WIFI)
2232
WiFiConnectionHandler ArduinoIoTPreferredConnection(SECRET_WIFI_SSID, SECRET_WIFI_PASS);
2333
#elif defined(BOARD_HAS_GSM)
2434
GSMConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);

Diff for: examples/ArduinoIoTCloud-Schedule/ArduinoIoTCloud-Schedule.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This sketch demonstrates how to use the cloud schedule variable type.
33
44
IMPORTANT:
5-
This sketch works with WiFi, GSM, NB and Ethernet enabled boards supported by Arduino IoT Cloud.
5+
This sketch works with Notecard, WiFi, GSM, NB and Ethernet enabled boards supported by Arduino IoT Cloud.
66
77
*/
88

Diff for: examples/ArduinoIoTCloud-Schedule/thingProperties.h

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <Arduino_ConnectionHandler.h>
33
#include "arduino_secrets.h"
44

5-
#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
5+
#if !(defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
66
defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
77
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
88
#endif
@@ -11,6 +11,14 @@
1111
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1212
#endif
1313

14+
#if defined(USE_NOTECARD)
15+
/* The Notecard can provide connectivity to almost any board via ESLOV (I2C)
16+
* or UART. An empty string (or the default value provided below) will not
17+
* override the Notecard's existing configuration.
18+
* Learn more at: https://dev.blues.io */
19+
#define NOTECARD_PRODUCT_UID "com.domain.you:product"
20+
#endif
21+
1422
void onSwitchButtonChange();
1523

1624
bool switchButton;
@@ -27,7 +35,7 @@ void initProperties() {
2735
ArduinoCloud.setBoardId(BOARD_ID);
2836
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY);
2937
#endif
30-
#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)
38+
#if defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)
3139
ArduinoCloud.addProperty(switchButton, Permission::Write);
3240
ArduinoCloud.addProperty(oneShot, Permission::ReadWrite);
3341
ArduinoCloud.addProperty(minute, Permission::ReadWrite);
@@ -41,7 +49,9 @@ void initProperties() {
4149
#endif
4250
}
4351

44-
#if defined(BOARD_HAS_WIFI)
52+
#if defined(USE_NOTECARD)
53+
NotecardConnectionHandler ArduinoIoTPreferredConnection(NOTECARD_PRODUCT_UID);
54+
#elif defined(BOARD_HAS_WIFI)
4555
WiFiConnectionHandler ArduinoIoTPreferredConnection(SECRET_WIFI_SSID, SECRET_WIFI_PASS);
4656
#elif defined(BOARD_HAS_GSM)
4757
GSMConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);

Diff for: examples/utility/ArduinoIoTCloud_Travis_CI/ArduinoIoTCloud_Travis_CI.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Arduino IoT Cloud API.
55
66
IMPORTANT:
7-
This sketch works with WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
7+
This sketch works with Notecard, WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
88
On a LoRa board, if it is configured as a class A device (default and preferred option),
99
values from Cloud dashboard are received only after a value is sent to Cloud.
1010

Diff for: examples/utility/ArduinoIoTCloud_Travis_CI/thingProperties.h

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <Arduino_ConnectionHandler.h>
33
#include "arduino_secrets.h"
44

5-
#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
5+
#if !(defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
66
defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
77
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
88
#endif
@@ -19,6 +19,14 @@
1919
#define THING_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
2020
#endif
2121

22+
#if defined(USE_NOTECARD)
23+
/* The Notecard can provide connectivity to almost any board via ESLOV (I2C)
24+
* or UART. An empty string (or the default value provided below) will not
25+
* override the Notecard's existing configuration.
26+
* Learn more at: https://dev.blues.io */
27+
#define NOTECARD_PRODUCT_UID "com.domain.you:product"
28+
#endif
29+
2230
/******************************************************************************
2331
GLOBAL CONSTANTS
2432
******************************************************************************/
@@ -54,7 +62,9 @@ String str_property_6;
5462
String str_property_7;
5563
String str_property_8;
5664

57-
#if defined(BOARD_HAS_WIFI)
65+
#if defined(USE_NOTECARD)
66+
NotecardConnectionHandler ArduinoIoTPreferredConnection(NOTECARD_PRODUCT_UID);
67+
#elif defined(BOARD_HAS_WIFI)
5868
WiFiConnectionHandler ArduinoIoTPreferredConnection(SECRET_WIFI_SSID, SECRET_WIFI_PASS);
5969
#elif defined(BOARD_HAS_GSM)
6070
GSMConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
@@ -83,7 +93,7 @@ void onStringPropertyChange();
8393
/******************************************************************************
8494
FUNCTIONS
8595
******************************************************************************/
86-
#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined (BOARD_HAS_NB) || defined (BOARD_HAS_CATM1_NBIOT)
96+
#if defined(USE_NOTECARD) || defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined (BOARD_HAS_NB) || defined (BOARD_HAS_CATM1_NBIOT)
8797
void initProperties() {
8898
#if defined(BOARD_HAS_SECRET_KEY)
8999
ArduinoCloud.setBoardId(BOARD_ID);

Diff for: library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ sentence=This library allows connecting to the Arduino IoT Cloud service.
66
paragraph=It provides a ConnectionManager to handle connection/disconnection, property-change updates and events callbacks. The supported boards are MKR GSM, MKR1000 and WiFi101.
77
category=Communication
88
url=https://github.com/arduino-libraries/ArduinoIoTCloud
9-
architectures=mbed,samd,esp8266,mbed_nano,mbed_portenta,mbed_nicla,esp32,mbed_opta,mbed_giga,renesas_portenta,renesas_uno,mbed_edge
9+
architectures=mbed,samd,esp8266,mbed_nano,mbed_portenta,mbed_nicla,esp32,mbed_opta,mbed_giga,renesas_portenta,renesas_uno,mbed_edge,stm32
1010
includes=ArduinoIoTCloud.h
1111
depends=Arduino_ConnectionHandler,Arduino_DebugUtils,Arduino_SecureElement,ArduinoMqttClient,ArduinoECCX08,RTCZero,Adafruit SleepyDog Library,ArduinoHttpClient

Diff for: src/AIoTC_Config.h

+10-6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
* AUTOMATICALLY CONFIGURED DEFINES
5353
******************************************************************************/
5454

55+
#if !defined(USE_NOTECARD)
56+
5557
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT)
5658
#define OTA_STORAGE_SNU (1)
5759
#else
@@ -114,11 +116,6 @@
114116
#define HAS_TCP
115117
#endif
116118

117-
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_OPTA) || defined(ARDUINO_GIGA)
118-
#define BEAR_SSL_CLIENT_IBUF_SIZE (16384 + 325) // Allows download from storage API
119-
#define BOARD_STM32H7
120-
#endif
121-
122119
#if defined(ARDUINO_NANO_RP2040_CONNECT)
123120
#define BEAR_SSL_CLIENT_IBUF_SIZE (16384 + 325) // Allows download from storage API
124121
#endif
@@ -138,6 +135,13 @@
138135
#define BOARD_HAS_SECURE_ELEMENT
139136
#endif
140137

138+
#endif // USE_NOTECARD
139+
140+
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_OPTA) || defined(ARDUINO_GIGA)
141+
#define BEAR_SSL_CLIENT_IBUF_SIZE (16384 + 325) // Allows download from storage API
142+
#define BOARD_STM32H7
143+
#endif
144+
141145
/******************************************************************************
142146
* CONSTANTS
143147
******************************************************************************/
@@ -146,7 +150,7 @@
146150
#define AIOT_CONFIG_LPWAN_UPDATE_RETRY_DELAY_ms (10000UL)
147151
#endif
148152

149-
#if defined(HAS_TCP)
153+
#if defined(USE_NOTECARD) || defined(HAS_TCP)
150154
#define AIOT_CONFIG_RECONNECTION_RETRY_DELAY_ms (1000UL)
151155
#define AIOT_CONFIG_MAX_RECONNECTION_RETRY_DELAY_ms (32000UL)
152156

Diff for: src/ArduinoIoTCloud.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ class ArduinoIoTCloudClass
161161
OnCloudEventCallback _cloud_event_callback[3];
162162
};
163163

164-
#ifdef HAS_TCP
164+
#if defined(USE_NOTECARD)
165+
#include "ArduinoIoTCloudNotecard.h"
166+
#elif defined(HAS_TCP)
165167
#include "ArduinoIoTCloudTCP.h"
166168
#elif defined(HAS_LORA)
167169
#include "ArduinoIoTCloudLPWAN.h"

Diff for: src/ArduinoIoTCloudDevice.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <AIoTC_Config.h>
1616

17-
#ifdef HAS_TCP
17+
#if defined(USE_NOTECARD) || defined(HAS_TCP)
1818

1919
#include "ArduinoIoTCloudDevice.h"
2020
#include "interfaces/CloudProcess.h"
@@ -146,4 +146,4 @@ ArduinoCloudDevice::State ArduinoCloudDevice::handleDisconnected() {
146146
return State::Disconnected;
147147
}
148148

149-
#endif /* HAS_TCP */
149+
#endif /* USE_NOTECARD || HAS_TCP */

0 commit comments

Comments
 (0)