|
1 | 1 | # API Reference |
2 | | -The `TheThingsMessage` class provides structs for sensor and application data you can encode and decode as bytes. |
| 2 | +The `TheThingsMessage` class provides structs for device and application data you can encode and decode as bytes. |
3 | 3 |
|
4 | 4 | ## Class: TheThingsMessage |
5 | 5 |
|
6 | 6 | ```c |
7 | 7 | #include <TheThingsMessage.h> |
8 | 8 | ``` |
9 | 9 |
|
10 | | -## Type: sensordata_t |
| 10 | +## Type: devicedata_t |
11 | 11 |
|
12 | | -Create a struct of this type using `api_SensorData_init_default` as defaults. |
| 12 | +Create a struct of this type using `api_DeviceData_init_default` as defaults. |
13 | 13 |
|
14 | 14 | ```c |
15 | | -sensordata_t data = api_SensorData_init_default; |
| 15 | +devicedata_t data = api_DeviceData_init_default; |
16 | 16 | ``` |
17 | 17 |
|
18 | 18 | Then in your `setup()` function select what fields of the struct should be included when encoding it as bytes: |
@@ -41,14 +41,14 @@ You can also add other analog readings. |
41 | 41 |
|
42 | 42 | > **TODO:** Document how this works and include in example. |
43 | 43 |
|
44 | | -## Method: encodeSensorData |
| 44 | +## Method: encodeDeviceData |
45 | 45 | Encode the message you want to send. |
46 | 46 |
|
47 | 47 | ```c |
48 | | -static void encodeSensorData(sensordata_t *data, byte **buffer, size_t *size); |
| 48 | +static void encodeDeviceData(devicedata_t *data, byte **buffer, size_t *size); |
49 | 49 | ``` |
50 | 50 |
|
51 | | -- `sensordata_t *data`: Structure containing all the message we can send. |
| 51 | +- `devicedata_t *data`: Structure containing typical fields that devices send. |
52 | 52 | - `byte **buffer`: Bytes to send. |
53 | 53 | - `size_t *size`: The number of bytes to send. |
54 | 54 |
|
|
57 | 57 | ```c |
58 | 58 | byte *buffer; |
59 | 59 | size_t size; |
60 | | -TheThingsMessage::encodeSensorData(&data, &buffer, &size); |
| 60 | +TheThingsMessage::encodeDeviceData(&data, &buffer, &size); |
61 | 61 | ``` |
62 | 62 |
|
63 | 63 | ## Method: decodeAppData |
|
0 commit comments