You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library allows to connect to the Arduino IoT Cloud service. It provides a ConnectionManager to handle connection/disconnection, property-change updates and events callbacks.
4
-
The supported boards are MKRGSM, MKR1000 (WiFi101) and MKR 1010 (WiFiNINA).
3
+
This library facilitates interactions between boards featuring a cryptography co-processor and the Arduino IoT Cloud service. It includes a ConnectionManager to handle connection/disconnection/reconnection flows and provides means to interface local sketch variables with cloud based Thing properties, enabling synchronization and on-change callbacks.
4
+
Currently supported boards: MKR1000 (WiFi101) and MKR 1010 (WiFiNINA). Support for MKRGSM is nearing completion and more cryptography enabled boards are following.
5
5
6
6
## Arduino IoT Cloud
7
7
8
-
[Arduino IoT Cloud](https://create.arduino.cc/iot/things) is a service which allows connecting the cloud to the world around you. [Here](https://www.arduino.cc/en/IoT/HomePage)is an introduction.
9
-
Now the platform is in public beta, feedback is welcome.
8
+
[Arduino IoT Cloud](https://create.arduino.cc/iot) is a service which facilitates connections between cloud-based applications and the world around you. More information [is available here](https://www.arduino.cc/en/IoT/HomePage)and a detailed tutorial can be found on [Arduino Project Hub](https://create.arduino.cc/projecthub/133030/iot-cloud-getting-started-c93255).
9
+
The platform is currently in public beta, we appreciate any feedback provided.
10
10
11
11
12
12
### Arduino IoT Cloud Components
13
13
14
-
-**Devices**: Physical objects like a hardware board (e.g. MKR WiFi 1010). This is the hardware which runs the software, reads sensors, controls actuators and communicates with the Arduino IoT Cloud.
14
+
-**Devices**: Physical objects built around a board (e.g. MKR WiFi 1010). This is the hardware which runs the sketch, reads sensors, controls actuators and communicates with the Arduino IoT Cloud.
15
15
16
-
-**Things**: Logical representation of a connected object. They represent the inherent properties of the object, with as little reference to the actual hardware used to implement them. Each thing is represented by a collection of properties (e.g., temperature, light).
16
+
-**Things**: Logical representation of a connected object. They embody inherent properties of the object, with as little reference to the actual hardware or code used to implement them. Each Thing is represented by a collection of _Properties_ (e.g., temperature, light, pressure...).
17
17
18
-
-**Properties**: Qualities defining the characteristics of a system. A property can be something like a read-only (RO) setting to indicate the Arduino IoT Cloud can read the data, but cannot change the value of the property. A property might be designed as read andwrite (RW) if the Arduino IoT Cloud can also remotely change the property’s value and send an event notification to the device.
18
+
-**Properties**: Qualities defining the characteristics of a system. A _Property_ can be defined as *read-only* (RO) to indicate that Arduino IoT Cloud can read the data, but cannot change the value of such _Property_. On the other end it may be designated to be *read-and-write* (RW), allowing Arduino IoT Cloud to remotely change the property’s value and trigger an event notification on the device to be handled via code.
19
19
20
-
-**Events**: When something happens the Arduino IoT Cloud is aware of it thanks to application messages. For example, it might be informed by a face-recognition application that someone is at a door, or it has received a request from another app that a light be turned on.
20
+
-**Events**: When a physical event is triggered on the _Device_, Arduino IoT Cloud is made aware of it thanks to application messages. It might, for example, be notified that a proximity sensor detected someone or something outside a door.
21
21
22
-
-**Software**: It's quickly autogenerated automatically by the Arduino IoT Cloud when setting up a new thing: in this way, almost everything that you need is done and ready. The connection to the cloud is handled by this library. You have only to implement the callbacks linked to the properties.
22
+
-**Software**: An Arduino Create sketch is automatically generated by Arduino IoT Cloud when setting up a new thing: this simplifies starting efforts. Because he connection to the cloud is handled by the library, The user can focus on implementing the last bits of code required to handle the change of variables linked to properties.
23
+
The introductory tutorial linked above explains this in an easy and comprehensive way.
23
24
24
25
## ArduinoIoTCloud library
25
26
26
-
The library is divided into various classes:
27
-
-`ConnectionManager` which is responsable for the connection to the Internet through `WiFiConnectionManager` or `GSMConnectionManager`. The selection is done using the type of board used.
27
+
The library is made of multiple classes:
28
+
-`ArduinoIoTCloud` is the main class. It's responsible for the connection to the MQTT Broker and to Arduino IoT Cloud.
29
+
This library has multiple `begin(...)` methods allowing you to take more control of its behavior when it comes to network *Client* or to use a `ConnectionManager`
28
30
29
-
-`ArduinoIoTCloud` it's the leading class. It's responsible for the connection to the MQTT Broker and to the Arduino IoT Cloud.
31
+
-`ConnectionManager` is an abstract Class defining methods to be implemented in derived classes, such as `WiFiConnectionManager`, `GSMConnectionManager` and so on. The right `ConnectionManager` is chosen on a board basis during compilation.
32
+
33
+
-`WiFiConnectionManager` handles connection, network time retrieval, disconnection, and reconnection to Internet for WiFi equipped boards (*MKR1000*, *MKR WIFI 1010* and upcoming implementations.
34
+
35
+
-`GSMConnectionManager`. handles connection, network time retrieval, disconnection, and reconnection to Internet for GSM equipped boards (*MKR GSM 1400*)
36
+
37
+
38
+
-`CloudSerial` is similar to [Serial](https://www.arduino.cc/reference/en/language/functions/communication/serial/), but used in combination with the cloud, allowing the user to send and receive custom messages using Arduino IoT Cloud as a channel.
30
39
31
-
-`CloudSerial` it's similar to [Serial](https://www.arduino.cc/reference/en/language/functions/communication/serial/), but used in combination with the cloud.
32
40
33
41
### ConnectionManager
34
42
35
-
*Connection Manager* is capable of knowing which board is being used through some `ifdef`.
43
+
*Connection Manager* is configured via a series of compiler directives, including the correct implementation of the class based on which board is selected.
36
44
37
-
- Instantiate the class with `ConnectionManager *ArduinoIoTPreferredConnection = new WiFiConnectionManager(SECRET_SSID, SECRET_PASS);` if you are using a WiFi board
45
+
### How to use it
46
+
- Instantiate the class with `ConnectionManager *ArduinoIoTPreferredConnection = new WiFiConnectionManager(SECRET_SSID, SECRET_PASS);` if you are using a WiFi board, otherwise replace *WiFi* with *GSM* or any future implementation.
38
47
39
-
-`check()`function does all the job. It uses a finite state machine and it's responsible for the connection and reconnection to the Internet. The function is non blocking thanks to *millis*
48
+
-the `check()`method does all the work. It uses a finite state machine and is responsible for connection and reconnection to a network. The method is designed to be non-blocking by using time (milliseconds) to perform its tasks.
40
49
41
-
-`getTime()`function actually return the time from a NTP server. It's used for the connection to the cloud
50
+
-`getTime()`returns different implementations of the `getTIme()` method based on the board used. Time is retrieved from an NTP server and is required for the SSL connection to the cloud.
42
51
43
-
-`&getClient()` returns the client
52
+
-`&getClient()` returns a reference an instance of the `Client` class used to connect to the network.
44
53
45
-
-`getStatus()` returns the network connection status
54
+
-`getStatus()` returns the network connection status. The different states are defined in an `enum`
46
55
47
-
-`debugMessage(char *_msg, uint8_t _debugLevel)`function used to print debug messages on the serial
56
+
-`debugMessage(char *_msg, uint8_t _debugLevel, bool _timestamp = true, bool _newline = true)`is the method used to print debug messages on the physical serial. This helps providing troubleshooting information should anything go wrong.
48
57
49
-
- The `setDebugMessageLevel(uint8_t _debugLevel)`function is used to set a debug level. Every debug message comes with a level which goes from 0 to 4. Higher level means higher verbosity. Debug messages with level higher than `_debugLevel` will not been showed.
58
+
- The `setDebugMessageLevel(uint8_t _debugLevel)`method is used to set a level of granularity in information output. Every debug message comes with a level which goes from 0 to 4. A higher level means more verbosity. Debug messages with level higher than `_debugLevel` will not been showed. The lowest level has a higher importance and is usually used for errors, which are always printed.
50
59
51
60
### ArduinoIoTCloud
52
61
53
-
- The `begin(ConnectionManager *connection = ArduinoIoTPreferredConnection, String brokerAddress = "mqtts-sa.iot.arduino.cc")`function is used to initialize the connection to the Arduino IoT Cloud through MQTT
62
+
- The `begin(ConnectionManager *connection = ArduinoIoTPreferredConnection, String brokerAddress = "mqtts-sa.iot.arduino.cc")`method is used to initialize the connection to the Arduino IoT Cloud through MQTT
54
63
55
-
- The `connect()`function is used to connect to the MQTT broker
64
+
- The `connect()`method is used to connect to the MQTT broker
56
65
57
66
-`disconnect()` stops the MQTT Client
58
67
59
-
- The `update()`function is called periodically in the loop of `.ino` file. It checks the connnection with the MQTT broker, retrieve data from the Cloud and pushes back data using function`writeProperties(const byte data[], int length)`.
68
+
- The `update()`method is called periodically in the loop of `.ino` file. It checks the connnection with the MQTT broker, retrieve data from the Cloud and pushes back data using method`writeProperties(const byte data[], int length)`.
60
69
61
70
-`connected()` simply returns the current status of the MQTT connection.
62
71
@@ -66,4 +75,4 @@ The library is divided into various classes:
66
75
67
76
-`getThingId()` returns the *THING_ID*
68
77
69
-
-`connectionCheck()`function is like `check()` from *ConnectionManager*. Uses a finite state machine and it's responsible for the connection to Arduino IoT Cloud. It also uses *debugMessage* from *ConnectionManager* to print debug messages.
78
+
-`connectionCheck()`method is like `check()` from *ConnectionManager*. Uses a finite state machine and it's responsible for the connection to Arduino IoT Cloud. It also uses *debugMessage* from *ConnectionManager* to print debug messages.
0 commit comments