Skip to content

Commit 0bc469f

Browse files
committed
Added addProperty method
1 parent 9f3cd5a commit 0bc469f

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

docs/api.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Updates the internal timezone information.
222222

223223
#### Parameters
224224

225-
### `addCallback(ArduinoIoTCloudEvent const event, OnCloudEventCallback callback)`
225+
### `addCallback()`
226226

227227
Adds a callback function for IoT Cloud events.
228228

@@ -329,6 +329,26 @@ None
329329
#### Returns
330330
Nothing.
331331

332+
### `addProperty()` (TCP)
333+
334+
#### Description
335+
336+
Adds a variable/property with a set of parameters.
337+
338+
#### Syntax
339+
```
340+
ArduinoCloud.addProperty(cloudVariable, tag, permission, policy, callbackFunction)
341+
```
342+
343+
#### Parameters
344+
- `cloudVariable` - name of the variable/property.
345+
- `permission` - can either be `READ` / `WRITE` or `READWRITE`
346+
- `policy` - `ON_CHANGE` (whenever variable data changes) or `<seconds> * SECONDS`. `<seconds>` is specified in the Thing configuration.
347+
- `callBackFunction` - by default, a callback function is added to a variable with **WRITE** permissions. A variable called `test` will automatically be added as `onTestChange` which also is added to your sketch.
348+
349+
#### Returns
350+
Nothing.
351+
332352
### `setBoardId()`
333353

334354
#### Description
@@ -464,6 +484,27 @@ None.
464484
#### Returns
465485
Nothing.
466486

487+
### `addProperty()` (LPWAN)
488+
489+
#### Description
490+
491+
Adds a variable/property with a set of parameters.
492+
493+
#### Syntax
494+
```
495+
ArduinoCloud.addProperty(cloudVariable, tag, permission, policy, callbackFunction)
496+
```
497+
498+
#### Parameters
499+
- `cloudVariable` - name of the variable/property.
500+
- `permission` - can either be `READ` / `WRITE` or `READWRITE`
501+
- `tag` - matches the cloud and local variables with a number. E.g. adding a second variable will have the tag `2`.
502+
- `policy` - `ON_CHANGE` (whenever variable data changes) or `<seconds> * SECONDS`. `<seconds>` is specified in the Thing configuration.
503+
- `callBackFunction` - by default, a callback function is added to a variable with **WRITE** permissions. A variable called `test` will automatically be added as `onTestChange` which also is added to your sketch.
504+
505+
#### Returns
506+
Nothing.
507+
467508
## `isRetryEnabled()`
468509

469510
#### Description

docs/readme.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ The ArduinoIoTCloud library is the central element of the firmware enabling cert
55
- To get started, check out the [official documentation](https://docs.arduino.cc/arduino-cloud/)
66
- For source code, check out the [GitHub repository](https://github.com/arduino-libraries/ArduinoIoTCloud)
77

8+
## thingProperties.h
9+
10+
When you are create and configure a Thing in the [Arduino IoT Cloud interface](https://create.arduino.cc/iot/), the `thingProperties.h` file is generated automatically.
11+
12+
This file adds all the variable/properties along with its specifications (e.g. update policy, read/write permissions), and the type of connection handler depending on what device you have attached.
13+
14+
Methods such as `addProperty()` and `setThingId()` are implemented here, so there's no need for manually entering anything.
15+
16+
We recommend that **you do not edit this file** as it is automatically updating whenever you make changes in the Arduino IoT Cloud.
17+
18+
### Offline Editing
19+
20+
If you have set up your sketch in an offline environment, make sure that whatever changes you make are reflected in this file, as it will be updated in the online environment.
821

922
## TCP / LPWAN
1023

0 commit comments

Comments
 (0)