|
IOT-ESP32
|
Manage interactions with physical devices. More...
Data Structures | |
| struct | device_presence_t |
| Device presence information. More... | |
| struct | device_t |
| Representation of a device. More... | |
| struct | devices_t |
| Handles for all devices definitions. More... | |
Typedefs | |
| typedef uint8_t(* | device_presence_cb_t) (device_presence_t) |
| Callback when device presence changes. More... | |
| typedef void(* | device_update_cb_t) (device_data_t, uint8_t) |
| Callback to provide result of update. More... | |
Enumerations | |
| enum | action_t |
| Possible GATT characteristic value types. More... | |
Functions | |
| device_t * | create_device (device_id_t) |
| Define a new device. More... | |
| void | delete_device (device_t *) |
| Clear the device record for the given device ptr. More... | |
| sensor_t * | device_add_sensor (device_t *, sensor_type_t) |
| Add a sensor to an existing device. More... | |
| void | device_enable_ble_bas () |
| set the BLE service to use on devices to BAS More... | |
| void | device_enable_ble_presence () |
| attach the device presence handlers to BLE updates More... | |
| void | device_init () |
| Allocate devices per iot-config.h and start management task. More... | |
| void | device_load_static_list (sensor_type_t sensor_type=SENSOR_NONE) |
| Load the definition of static device id's. More... | |
| void | device_payload_free (device_data_t *) |
| Free heap memory allocation associated with a device payload. More... | |
| sensor_data_entry_t | device_payload_get_entry (device_data_t *, uint8_t) |
| Return a handle to a payload sensor entry by index. More... | |
| device_data_t * | device_payload_init (const char *, uint8_t) |
| Allocate a new device payload from heap. More... | |
| void | device_process_payload (device_data_t *) |
| Schedule a device payload for async delivery. More... | |
| uint8_t | device_send_update (const char *, sensor_type_t, uint16_t) |
| Craft an update on behalf of a device and queue for delivery. More... | |
| device_t * | get_device (device_id_t) |
| Get a pointer to a sigle device by the device_id. More... | |
| devices_t | get_devices () |
| Get list of pointer references to all of the devices. More... | |
| void | set_device_presence_cb (device_presence_cb_t) |
| Set a callback from presence updates. More... | |
| void | set_device_update_cb (device_update_cb_t) |
| Set the callback handler from device updates. More... | |
Manage interactions with physical devices.
| device_update_cb_t |
Callback to provide result of update.
| device_data | contains scope list with status results |
| errs | a counter of number of errors encounterd in process |
| device_presence_cb_t |
Callback when device presence changes.
| device_presence |
| enum action_t |
Possible GATT characteristic value types.
| void set_device_update_cb | ( | device_update_cb_t | ) |
Set the callback handler from device updates.
Since updates are async in another task, provide a callback with a result
| handler | device_update_cb_t |
| void set_device_presence_cb | ( | device_presence_cb_t | ) |
Set a callback from presence updates.
Provide a callback for notification on any presence status update
| handler | device_presence_cb_t |
| device_t * get_device | ( | device_id_t | ) |
Get a pointer to a sigle device by the device_id.
| device_t * create_device | ( | device_id_t | ) |
Define a new device.
Update the first device slot which is not currently in use this device_id and return the pointer to the record. Returns null if no slots available.
| void delete_device | ( | device_t * | ) |
Clear the device record for the given device ptr.
| device* | device ptr |
| void device_load_static_list | ( | sensor_type_t | sensor_type = SENSOR_NONE | ) |
Load the definition of static device id's.
Configures devices with id's from STATIC_DEVICE_LIST. These are also added to the BLE whitelist, so ble_init() must be called first. If no sensor type is provided, the device will have none configured.
| sensor_type | a default sensor_type to configure, if desired |
| device_data_t * device_payload_init | ( | const char * | , |
| uint8_t | |||
| ) |
Allocate a new device payload from heap.
| device_id | the device_id for the payload |
| num_entries | number of sensor entries to allocate |
| sensor_data_entry_t device_payload_get_entry | ( | device_data_t * | , |
| uint8_t | |||
| ) |
Return a handle to a payload sensor entry by index.
Retruns a handle for use with the sensor_payload_entry_*() calls
| payload | a device payload |
| idx | the requested sensor data index we plan to update |
| void device_payload_free | ( | device_data_t * | ) |
Free heap memory allocation associated with a device payload.
| payload |
| void device_process_payload | ( | device_data_t * | ) |
Schedule a device payload for async delivery.
Destination(s) will be assigned based on sensor rules which assign destination scopes to the payload prior to placing it in a queue to attempt to ensure they are all satisfied.
| payload |
| sensor_t * device_add_sensor | ( | device_t * | , |
| sensor_type_t | |||
| ) |
Add a sensor to an existing device.
Will add the specified type to the first unused slot for the device. Returns a null ptr if there are no available slots.
| device | |
| sensor_type |
| void device_enable_ble_presence | ( | ) |
attach the device presence handlers to BLE updates
Cause BLE connect/disconnect to schedule presence events with SmartThings handler
| uint8_t device_send_update | ( | const char * | , |
| sensor_type_t | , | ||
| uint16_t | |||
| ) |
Craft an update on behalf of a device and queue for delivery.
| device_id | |
| type | sensor_type_t |
| state | value |
| void device_enable_ble_bas | ( | ) |
set the BLE service to use on devices to BAS
Configure a subscription to devices BLE BAS service with network handler
| void device_init | ( | ) |
Allocate devices per iot-config.h and start management task.