Skip to content

Commit

Permalink
Added addProperty method
Browse files Browse the repository at this point in the history
  • Loading branch information
karlsoderby committed Sep 27, 2023
1 parent 9f3cd5a commit 0bc469f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
43 changes: 42 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Updates the internal timezone information.

#### Parameters

### `addCallback(ArduinoIoTCloudEvent const event, OnCloudEventCallback callback)`
### `addCallback()`

Adds a callback function for IoT Cloud events.

Expand Down Expand Up @@ -329,6 +329,26 @@ None
#### Returns
Nothing.

### `addProperty()` (TCP)

#### Description

Adds a variable/property with a set of parameters.

#### Syntax
```
ArduinoCloud.addProperty(cloudVariable, tag, permission, policy, callbackFunction)
```

#### Parameters
- `cloudVariable` - name of the variable/property.
- `permission` - can either be `READ` / `WRITE` or `READWRITE`
- `policy` - `ON_CHANGE` (whenever variable data changes) or `<seconds> * SECONDS`. `<seconds>` is specified in the Thing configuration.
- `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.

#### Returns
Nothing.

### `setBoardId()`

#### Description
Expand Down Expand Up @@ -464,6 +484,27 @@ None.
#### Returns
Nothing.

### `addProperty()` (LPWAN)

#### Description

Adds a variable/property with a set of parameters.

#### Syntax
```
ArduinoCloud.addProperty(cloudVariable, tag, permission, policy, callbackFunction)
```

#### Parameters
- `cloudVariable` - name of the variable/property.
- `permission` - can either be `READ` / `WRITE` or `READWRITE`
- `tag` - matches the cloud and local variables with a number. E.g. adding a second variable will have the tag `2`.
- `policy` - `ON_CHANGE` (whenever variable data changes) or `<seconds> * SECONDS`. `<seconds>` is specified in the Thing configuration.
- `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.

#### Returns
Nothing.

## `isRetryEnabled()`

#### Description
Expand Down
13 changes: 13 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ The ArduinoIoTCloud library is the central element of the firmware enabling cert
- To get started, check out the [official documentation](https://docs.arduino.cc/arduino-cloud/)
- For source code, check out the [GitHub repository](https://github.com/arduino-libraries/ArduinoIoTCloud)

## thingProperties.h

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.

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.

Methods such as `addProperty()` and `setThingId()` are implemented here, so there's no need for manually entering anything.

We recommend that **you do not edit this file** as it is automatically updating whenever you make changes in the Arduino IoT Cloud.

### Offline Editing

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.

## TCP / LPWAN

Expand Down

0 comments on commit 0bc469f

Please sign in to comment.