Skip to content

Commit 9a741af

Browse files
committed
- reworked first part
1 parent 64f3874 commit 9a741af

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

README.md

+34-25
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,71 @@
11
# ArduinoIoTCloud
22

3-
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.
55

66
## Arduino IoT Cloud
77

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.
1010

1111

1212
### Arduino IoT Cloud Components
1313

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.
1515

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...).
1717

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 and write (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.
1919

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.
2121

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.
2324

2425
## ArduinoIoTCloud library
2526

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`
2830

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.
3039

31-
- `CloudSerial` it's similar to [Serial](https://www.arduino.cc/reference/en/language/functions/communication/serial/), but used in combination with the cloud.
3240

3341
### ConnectionManager
3442

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.
3644

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.
3847

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.
4049

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.
4251

43-
- `&getClient()` returns the client
52+
- `&getClient()` returns a reference an instance of the `Client` class used to connect to the network.
4453

45-
- ` getStatus()` returns the network connection status
54+
- `getStatus()` returns the network connection status. The different states are defined in an `enum`
4655

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.
4857

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.
5059

5160
### ArduinoIoTCloud
5261

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
5463

55-
- The `connect()` function is used to connect to the MQTT broker
64+
- The `connect()` method is used to connect to the MQTT broker
5665

5766
- `disconnect()` stops the MQTT Client
5867

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)`.
6069

6170
- `connected()` simply returns the current status of the MQTT connection.
6271

@@ -66,4 +75,4 @@ The library is divided into various classes:
6675

6776
- `getThingId()` returns the *THING_ID*
6877

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

Comments
 (0)