On/Off switch object implementation for LwM2M client using Wakaama. More...
On/Off switch object implementation for LwM2M client using Wakaama.
This implements the LwM2M IPSO on/off switch object (ID 3342) as specified in the LwM2M registry.
This IPSO object should be used with an On/Off switch to report the state of the switch.
To use this object add USEMODULE += wakaama_objects_on_off_switch to the application Makefile.
For an XML description of the object see https://raw.githubusercontent.com/OpenMobileAlliance/lwm2m-registry/prod/3342.xml
| Name | ID | Mandatory | Type | Range | Units | Implemented | 
|---|---|---|---|---|---|---|
| Digital Input State | 5500 | Yes | Boolean | - | - | Yes | 
| Digital Input Counter | 5501 | No | Integer | - | - | Yes | 
| On time | 5852 | No | Integer | - | s | Yes | 
| Off Time | 5854 | No | Integer | - | s | Yes | 
| Application Type | 5750 | No | String | - | - | Yes | 
Topics | |
| LwM2M On/Off switch object compile configurations | |
Files | |
| file | on_off_switch.h | 
Data Structures | |
| struct | lwm2m_obj_on_off_switch_args | 
| Arguments for the creation of an on/off switch object instance.  More... | |
Macros | |
| #define | LWM2M_ON_OFF_SWITCH_OBJECT_ID 3342 | 
| On/Off switch object ID.   | |
Typedefs | |
| typedef struct lwm2m_obj_on_off_switch_args | lwm2m_obj_on_off_switch_args_t | 
| Arguments for the creation of an on/off switch object instance.  | |
Functions | |
| lwm2m_object_t * | lwm2m_object_on_off_switch_init (lwm2m_client_data_t *client_data) | 
| Initialize the on/off switch object.   | |
| int | lwm2m_object_on_off_switch_instance_create (const lwm2m_obj_on_off_switch_args_t *args, int32_t instance_id) | 
Create a new on/off switch instance and add it to the object list.   | |
| int | lwm2m_object_on_off_switch_update_status (uint16_t instance_id, bool status) | 
| Update the status of a on/off switch instance.   | |
| int | lwm2m_object_on_off_switch_update_app_type (uint16_t instance_id, const char *app_type, size_t len) | 
| Update the application type of a on/off switch instance.   | |
On/Off switch object resource's IDs. | |
| #define | LWM2M_ON_OFF_SWITCH_DIGITAL_INPUT_STATE_ID 5500 | 
| Digital input state esource ID.   | |
| #define | LWM2M_ON_OFF_SWITCH_DIGITAL_INPUT_COUNTER_ID 5501 | 
| Digital Input Counter resource ID.   | |
| #define | LWM2M_ON_OFF_SWITCH_ON_TIME_ID 5852 | 
| On Time resource ID.   | |
| #define | LWM2M_ON_OFF_SWITCH_OFF_TIME_ID 5854 | 
| Off Time resource ID.   | |
| #define | LWM2M_ON_OFF_SWITCH_APP_TYPE_ID 5750 | 
| Application type resource ID.   | |
| #define LWM2M_ON_OFF_SWITCH_APP_TYPE_ID 5750 | 
Application type resource ID.
Definition at line 137 of file on_off_switch.h.
| #define LWM2M_ON_OFF_SWITCH_DIGITAL_INPUT_COUNTER_ID 5501 | 
Digital Input Counter resource ID.
Definition at line 125 of file on_off_switch.h.
| #define LWM2M_ON_OFF_SWITCH_DIGITAL_INPUT_STATE_ID 5500 | 
Digital input state esource ID.
Definition at line 121 of file on_off_switch.h.
| #define LWM2M_ON_OFF_SWITCH_OBJECT_ID 3342 | 
On/Off switch object ID.
Definition at line 112 of file on_off_switch.h.
| #define LWM2M_ON_OFF_SWITCH_OFF_TIME_ID 5854 | 
Off Time resource ID.
Definition at line 133 of file on_off_switch.h.
| #define LWM2M_ON_OFF_SWITCH_ON_TIME_ID 5852 | 
On Time resource ID.
Definition at line 129 of file on_off_switch.h.
| lwm2m_object_t * lwm2m_object_on_off_switch_init | ( | lwm2m_client_data_t * | client_data | ) | 
Initialize the on/off switch object.
| [in] | client_data | LwM2M client data. | 
| int lwm2m_object_on_off_switch_instance_create | ( | const lwm2m_obj_on_off_switch_args_t * | args, | 
| int32_t | instance_id ) | 
Create a new on/off switch instance and add it to the object list. 
| [in] | args | Initialize structure with the parameter for the instance. Must not be NULL. | 
| [in] | instance_id | ID for the new instance. It must be between 0 and (UINT16_MAX - 1), if -1 the next available ID will be used. | 
instance_id is given | int lwm2m_object_on_off_switch_update_app_type | ( | uint16_t | instance_id, | 
| const char * | app_type, | ||
| size_t | len ) | 
Update the application type of a on/off switch instance.
| [in] | instance_id | ID of the instance to update. | 
| [in] | app_type | String representing new application type. Must be NULL terminated, must not be NULL. | 
| [in] | len | Length of the app_type string. | 
| int lwm2m_object_on_off_switch_update_status | ( | uint16_t | instance_id, | 
| bool | status ) | 
Update the status of a on/off switch instance.
| [in] | instance_id | ID of the instance to update. | 
| [in] | status | New status of the switch. |