Temperature Sensor object implementation for LwM2M client using Wakaama.  
More...
Temperature Sensor object implementation for LwM2M client using Wakaama. 
- Warning
 - This feature is experimental!
 This implements the LwM2M Temperature Sensor object (ID 3303) as specified in the LwM2M registry. This IPSO object should be used with a temperature sensor to report a temperature measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range that can be measured by the temperature sensor. An example measurement unit is degrees Celsius. 
The sensor value can be updated by the application using the lwm2m_object_temperature_update_value function, or polled when required if a callback is registered upon object instantiation via lwm2m_obj_temperature_args_t::read_cb.
To use this object add USEMODULE += wakaama_objects_temperature to the application Makefile.
Resources
For an XML description of the object see https://raw.githubusercontent.com/OpenMobileAlliance/lwm2m-registry/prod/version_history/3303-1_0.xml
This object is based on the IPSO Sensor base object, therefore it shares the same resources.
Usage
- Initialize the LwM2M object with an initialized client pointer.
 
lwm2m_object_t * lwm2m_object_temperature_init(lwm2m_client_data_t *client_data)
Initialize the Temperature Sensor object handle.
 
 
- Create a new instance of the object with a given configuration (lwm2m_obj_temperature_args_t). Here, you can decide the way of updating the sensor values: polling or pushing. In this case, we register a callback function that is called whenever the sensor value is read.
 
int _read_cb(void *arg, int16_t *value)
{
    (void)arg;
 
    
    *value = 100;
 
    return 0;
}
 
    .max_range_value = 80.0,
    .units = "C",
    .units_len = sizeof("C") - 1,
    .instance_id = 0,
    .read_cb = _read_cb,
    .read_cb_arg = NULL
};
 
 
if (res < 0) {
    puts("Could not create temperature object instance");
}
int32_t lwm2m_object_temperature_instance_create(const lwm2m_obj_temperature_args_t *args)
Create a new Temperature Sensor instance.
 
Arguments for the creation of an object based on the IPSO Sensor Base object instance.
 
int16_t min_range_value
Minimum value that can be measured by the sensor.
 
 
- You can now update the sensor values using the lwm2m_object_temperature_update_value function.
 
uint16_t instance_id = (uint16_t)res;
void lwm2m_object_temperature_update_value(const lwm2m_client_data_t *client_data, uint16_t instance_id, int16_t value)
Update the value of the temperature sensor and trigger a notification to the observing servers,...
 
  
◆ lwm2m_object_temperature_init()
Initialize the Temperature Sensor object handle. 
- Parameters
 - 
  
    | [in] | client_data | Pointer to the LwM2M client data. | 
  
   
- Returns
 - Pointer to the global handle of the Temperature Sensor object. 
 
 
 
◆ lwm2m_object_temperature_instance_create()
Create a new Temperature Sensor instance. 
- Parameters
 - 
  
    | [in] | args | Initialize structure with the parameter for the instance. Must not be NULL. | 
  
   
- Returns
 - > 0 value representing the instance ID if the instance was created successfully. 
 
- 
<0 otherwise 
 
 
 
◆ lwm2m_object_temperature_update_value()
      
        
          | void lwm2m_object_temperature_update_value  | 
          ( | 
          const lwm2m_client_data_t *  | 
          client_data,  | 
        
        
           | 
           | 
          uint16_t  | 
          instance_id,  | 
        
        
           | 
           | 
          int16_t  | 
          value  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Update the value of the temperature sensor and trigger a notification to the observing servers, if any. 
- Parameters
 - 
  
    | [in] | client_data | Pointer to the LwM2M client.  | 
    | [in] | instance_id | ID of the instance to update.  | 
    | [in] | value | New value for the sensor.  |