ipso-objects: updated IPSO objects sensor/controllers to latest LWM2M API.

Added macros to setup IPSO sensor and control template data structs.
This commit is contained in:
Niclas Finne 2017-10-26 23:22:44 +02:00
parent ebb329de5c
commit 082f4b920c
10 changed files with 150 additions and 396 deletions

View File

@ -94,7 +94,7 @@ read_bar_value(const ipso_sensor_t *s, int32_t *value)
}
/* LED control */
static lwm2m_status_t
leds_set_val(uint8_t value)
leds_set_val(ipso_control_t *control, uint8_t value)
{
if(value > 0) {
leds_on(LEDS_YELLOW);
@ -104,56 +104,37 @@ leds_set_val(uint8_t value)
return LWM2M_STATUS_OK;
}
/*---------------------------------------------------------------------------*/
static ipso_sensor_value_t temp_value;
static ipso_sensor_value_t hum_value;
static ipso_sensor_value_t lux_value;
static ipso_sensor_value_t bar_value;
static ipso_control_t led_control = {
.reg_object.object_id = 3311,
.reg_object.instance_id = 0,
.set_value = leds_set_val
};
IPSO_CONTROL(led_control, 3311, 0, leds_set_val);
static const ipso_sensor_t temp_sensor = {
.object_id = 3303,
.sensor_value = &temp_value,
.max_range = 100000, /* 100 cel milli celcius */
.min_range = -10000, /* -10 cel milli celcius */
.get_value_in_millis = read_temp_value,
.unit = "Cel",
.update_interval = 30
};
IPSO_SENSOR(temp_sensor, 3303, read_temp_value,
.max_range = 100000, /* 100 cel milli celcius */
.min_range = -10000, /* -10 cel milli celcius */
.unit = "Cel",
.update_interval = 30
);
static const ipso_sensor_t hum_sensor = {
.object_id = 3304,
.sensor_value = &hum_value,
.max_range = 100000, /* 100 % RH */
.min_range = 0,
.get_value_in_millis = read_hum_value,
.unit = "% RH",
.update_interval = 30
};
static const ipso_sensor_t lux_sensor = {
.object_id = 3301,
.sensor_value = &lux_value,
.max_range = 100000,
.min_range = -10000,
.get_value_in_millis = read_lux_value,
.unit = "LUX",
.update_interval = 30
};
static const ipso_sensor_t bar_sensor = {
.object_id = 3315,
.sensor_value = &bar_value,
.max_range = 100000, /* 100 cel milli celcius */
.min_range = -10000, /* -10 cel milli celcius */
.get_value_in_millis = read_bar_value,
.unit = "hPa",
.update_interval = 30
};
IPSO_SENSOR(hum_sensor, 3304, read_hum_value,
.max_range = 100000, /* 100 % RH */
.min_range = 0,
.unit = "% RH",
.update_interval = 30
);
#endif
IPSO_SENSOR(lux_sensor, 3301, read_lux_value,
.max_range = 100000,
.min_range = -10000,
.unit = "LUX",
.update_interval = 30
);
IPSO_SENSOR(bar_sensor, 3315, read_bar_value,
.max_range = 100000, /* 100 cel milli celcius */
.min_range = -10000, /* -10 cel milli celcius */
.unit = "hPa",
.update_interval = 30
);
#endif /* BOARD_SENSORTAG */
PROCESS(example_ipso_objects, "IPSO object example");
AUTOSTART_PROCESSES(&example_ipso_objects);

View File

@ -35,51 +35,44 @@
/**
* \file
* Implementation of OMA LWM2M / IPSO Generic Sensor
* Implementation of OMA LWM2M / IPSO Generic Control
* \author
* Joakim Eriksson <joakime@sics.se>
* Niclas Finne <nfi@sics.se>
*/
#include <stdint.h>
#include "lwm2m-object.h"
#include "lwm2m-engine.h"
#include "coap-engine.h"
#include "ipso-sensor-template.h"
#include "ipso-control-template.h"
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
static lwm2m_status_t set_value(uint8_t value);
static lwm2m_status_t set_light_value(uint8_t value);
static lwm2m_status_t set_value(ipso_control_t *control, uint8_t value);
static lwm2m_status_t set_light_value(ipso_control_t *control, uint8_t value);
static ipso_control_t test_control = {
.reg_object.object_id = 3306,
.reg_object.instance_id = 0,
.set_value = set_value,
};
/* Name, Object ID, Instance ID, set_value callback */
IPSO_CONTROL(test_control, 3306, 0, set_value);
IPSO_CONTROL(light_control, 3311, 0, set_light_value);
static ipso_control_t test_control2 = {
.reg_object.object_id = 3311,
.reg_object.instance_id = 0,
.set_value = set_light_value,
};
/*---------------------------------------------------------------------------*/
static lwm2m_status_t
set_value(uint8_t value)
set_value(ipso_control_t *control, uint8_t value)
{
/* do something with the value! */
printf("Value set to: %u before: %u\n", value,
ipso_control_get_value(&test_control));
ipso_control_get_value(control));
return LWM2M_STATUS_OK;
}
/*---------------------------------------------------------------------------*/
static lwm2m_status_t
set_light_value(uint8_t value)
set_light_value(ipso_control_t *control, uint8_t value)
{
/* do something with the value! */
printf("Light value set to: %u before: %u\n", value,
ipso_control_get_value(&test_control2));
ipso_control_get_value(control));
return LWM2M_STATUS_OK;
}
/*---------------------------------------------------------------------------*/
@ -87,7 +80,7 @@ void
ipso_control_test_init(void)
{
ipso_control_add(&test_control);
ipso_control_add(&test_control2);
ipso_control_add(&light_control);
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -41,73 +41,59 @@
* Niclas Finne <nfi@sics.se>
*/
#include <stdint.h>
#include "lwm2m-object.h"
#include "lwm2m-engine.h"
#include "coap-engine.h"
#include "ipso-sensor-template.h"
#include <stdint.h>
#include <string.h>
uint32_t temp = 19000;
uint32_t hum = 30000;
static uint32_t temp = 19000;
static uint32_t hum = 30000;
ipso_sensor_value_t temp_value;
ipso_sensor_value_t temp_value2;
ipso_sensor_value_t hum_value;
static lwm2m_status_t get_temp_value(const ipso_sensor_t *sensor, int32_t *value);
static lwm2m_status_t get_hum_value(const ipso_sensor_t *sensor, int32_t *value);
lwm2m_status_t get_temp_value(const ipso_sensor_t *sensor, int32_t *value);
lwm2m_status_t get_hum_value(const ipso_sensor_t *sensor, int32_t *value);
IPSO_SENSOR(temp_sensor, 3303, get_temp_value,
.max_range = 120000, /* milli celcius */
.min_range = -30000, /* milli celcius */
.unit = "Cel",
.update_interval = 10
);
static const ipso_sensor_t temp_sensor = {
.object_id = 3303,
.sensor_value = &temp_value,
.max_range = 120000, /* milli celcius */
.min_range = -30000, /* milli celcius */
.get_value_in_millis = get_temp_value,
.unit = "Cel",
.update_interval = 10
};
static const ipso_sensor_t temp_sensor2 = {
.object_id = 3303,
.sensor_value = &temp_value2,
.max_range = 120000, /* milli celcius */
.min_range = -30000, /* milli celcius */
.get_value_in_millis = get_temp_value,
.unit = "Cel",
.update_interval = 10
};
IPSO_SENSOR(temp_sensor2, 3303, get_temp_value,
.max_range = 120000, /* milli celcius */
.min_range = -30000, /* milli celcius */
.unit = "Cel",
.update_interval = 10
);
/*---------------------------------------------------------------------------*/
static const ipso_sensor_t hum_sensor = {
.object_id = 3304,
.instance_id = 12,
.sensor_value = &hum_value,
.max_range = 100000, /* milli */
.min_range = 0, /* milli */
.get_value_in_millis = get_hum_value,
.unit = "%",
.update_interval = 10
};
IPSO_SENSOR(hum_sensor, 3304, get_hum_value,
.instance_id = 12,
.max_range = 100000, /* milli */
.min_range = 0, /* milli */
.unit = "%",
.update_interval = 10
);
/*---------------------------------------------------------------------------*/
lwm2m_status_t
static lwm2m_status_t
get_temp_value(const ipso_sensor_t *sensor, int32_t *value)
{
*value = temp++;
return LWM2M_STATUS_OK;
}
/*---------------------------------------------------------------------------*/
lwm2m_status_t
static lwm2m_status_t
get_hum_value(const ipso_sensor_t *sensor, int32_t *value)
{
*value = temp++;
*value = hum++;
return LWM2M_STATUS_OK;
}
/*---------------------------------------------------------------------------*/
void
ipso_sensor_temp_init(void)
{

View File

@ -47,7 +47,14 @@
#include "coap-timer.h"
#include <inttypes.h>
#include <string.h>
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
#define IPSO_ONOFF 5850
#define IPSO_DIMMER 5851
@ -88,7 +95,7 @@ ipso_control_set_value(ipso_control_t *control, uint8_t value)
if(value == 0) {
if(was_on) {
/* Turn off */
status = control->set_value(0);
status = control->set_value(control, 0);
if(status == LWM2M_STATUS_OK) {
control->value &= 0x7f;
control->on_time +=
@ -103,7 +110,7 @@ ipso_control_set_value(ipso_control_t *control, uint8_t value)
value |= 0x80;
if(value != control->value) {
status = control->set_value(value & 0x7f);
status = control->set_value(control, value & 0x7f);
if(status == LWM2M_STATUS_OK) {
control->value = value;
if(! was_on) {
@ -137,7 +144,7 @@ lwm2m_callback(lwm2m_object_instance_t *object, lwm2m_context_t *ctx)
if(ipso_control_is_on(control)) {
v += (coap_timer_uptime() - control->last_on_time) / 1000;
}
printf("ON-TIME: %"PRId32" (last on: %"PRIu32"\n", v, control->on_time);
PRINTF("ON-TIME: %"PRId32" (last on: %"PRIu32"\n", v, control->on_time);
break;
default:
return LWM2M_STATUS_ERROR;

View File

@ -51,7 +51,8 @@ typedef struct ipso_control ipso_control_t;
#define IPSO_CONTROL_USE_DIMMER 0x01
typedef lwm2m_status_t (*ipso_control_set_value_t)(uint8_t v);
typedef lwm2m_status_t (*ipso_control_set_value_t)(ipso_control_t *control,
uint8_t v);
/* Values of the IPSO control object */
struct ipso_control {
@ -63,6 +64,12 @@ struct ipso_control {
ipso_control_set_value_t set_value;
};
#define IPSO_CONTROL(name, oid, iid, setv) \
static ipso_control_t name = { \
.reg_object.object_id = oid, \
.reg_object.instance_id = iid, \
.set_value = setv \
}
int ipso_control_add(ipso_control_t *control);
int ipso_control_remove(ipso_control_t *control);

View File

@ -44,6 +44,7 @@
#include "lwm2m-object.h"
#include "lwm2m-engine.h"
#include "ipso-control-template.h"
#include "dev/leds.h"
#include <stdint.h>
@ -61,141 +62,32 @@
#define LEDS_CONTROL_NUMBER 1
#endif
#if 0
struct led_state {
unsigned long last_on_time;
uint32_t total_on_time;
uint8_t is_on;
typedef struct led_state {
ipso_control_t control;
uint8_t led_value;
};
} led_state_t;
static struct led_state states[LEDS_CONTROL_NUMBER];
static lwm2m_instance_t leds_control_instances[LEDS_CONTROL_NUMBER];
static led_state_t leds_controls[LEDS_CONTROL_NUMBER];
/*---------------------------------------------------------------------------*/
static int
read_state(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outsize)
static lwm2m_status_t
set_value(ipso_control_t *control, uint8_t value)
{
uint8_t idx = ctx->object_instance_index;
if(idx >= LEDS_CONTROL_NUMBER) {
return 0;
}
return lwm2m_object_write_boolean(ctx, outbuf, outsize,
states[idx].is_on ? 1 : 0);
}
/*---------------------------------------------------------------------------*/
static int
write_state(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t insize,
uint8_t *outbuf, size_t outsize)
{
int value;
size_t len;
led_state_t *state;
uint8_t idx = ctx->object_instance_index;
if(idx >= LEDS_CONTROL_NUMBER) {
return 0;
}
state = (led_state_t *)control;
len = lwm2m_object_read_boolean(ctx, inbuf, insize, &value);
if(len > 0) {
if(value) {
if(!states[idx].is_on) {
states[idx].is_on = 1;
states[idx].last_on_time = clock_seconds();
#if PLATFORM_HAS_LEDS
leds_on(states[idx].led_value);
#endif /* PLATFORM_HAS_LEDS */
}
} else if(states[idx].is_on) {
states[idx].total_on_time += clock_seconds() - states[idx].last_on_time;
states[idx].is_on = 0;
#if PLATFORM_HAS_LEDS
leds_off(states[idx].led_value);
#endif /* PLATFORM_HAS_LEDS */
}
if(value) {
leds_on(state->led_value);
} else {
PRINTF("IPSO leds control - ignored illegal write to on/off\n");
leds_off(state->led_value);
}
return len;
}
/*---------------------------------------------------------------------------*/
static char *
get_color(int value) {
switch(value) {
case LEDS_GREEN:
return "Green";
case LEDS_RED:
return "Red";
case LEDS_BLUE:
return "Blue";
}
return "None";
}
#endif /* PLATFORM_HAS_LEDS */
static int
read_color(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outsize)
{
char *value;
uint8_t idx = ctx->object_instance_index;
if(idx >= LEDS_CONTROL_NUMBER) {
return 0;
}
value = get_color(states[idx].led_value);
return lwm2m_object_write_string(ctx, outbuf, outsize,
value, strlen(value));
return LWM2M_STATUS_OK;
}
/*---------------------------------------------------------------------------*/
static int
read_on_time(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outsize)
{
unsigned long now;
uint8_t idx = ctx->object_instance_index;
if(idx >= LEDS_CONTROL_NUMBER) {
return 0;
}
if(states[idx].is_on) {
/* Update the on time */
now = clock_seconds();
states[idx].total_on_time += now - states[idx].last_on_time;
states[idx].last_on_time = now;
}
return lwm2m_object_write_int(ctx, outbuf, outsize,
(int32_t)states[idx].total_on_time);
}
/*---------------------------------------------------------------------------*/
static int
write_on_time(lwm2m_context_t *ctx,
const uint8_t *inbuf, size_t insize,
uint8_t *outbuf, size_t outsize)
{
int32_t value;
size_t len;
uint8_t idx = ctx->object_instance_index;
if(idx >= LEDS_CONTROL_NUMBER) {
return 0;
}
len = lwm2m_object_read_int(ctx, inbuf, insize, &value);
if(len > 0 && value == 0) {
PRINTF("IPSO leds control - reset On Time\n");
states[idx].total_on_time = 0;
if(states[idx].is_on) {
states[idx].last_on_time = clock_seconds();
}
} else {
PRINTF("IPSO leds control - ignored illegal write to On Time\n");
}
return len;
}
/*---------------------------------------------------------------------------*/
LWM2M_RESOURCES(leds_control_resources,
LWM2M_RESOURCE_CALLBACK(5850, { read_state, write_state, NULL }),
LWM2M_RESOURCE_CALLBACK(5706, { read_color, NULL, NULL }),
LWM2M_RESOURCE_CALLBACK(5852, { read_on_time, write_on_time, NULL })
);
LWM2M_OBJECT(leds_control, 3311, leds_control_instances);
/*---------------------------------------------------------------------------*/
static int
bit_no(int bit)
{
int i;
@ -212,26 +104,25 @@ bit_no(int bit)
}
return 0;
}
/*---------------------------------------------------------------------------*/
void
ipso_leds_control_init(void)
{
lwm2m_instance_t template = LWM2M_INSTANCE(0, leds_control_resources);
ipso_control_t *c;
int i;
/* Initialize the instances */
for(i = 0; i < LEDS_CONTROL_NUMBER; i++) {
leds_control_instances[i] = template;
leds_control_instances[i].id = i;
states[i].led_value = bit_no(i);
c = &leds_controls[i].control;
c->reg_object.object_id = 3311;
c->reg_object.instance_id = i;
c->set_value = set_value;
leds_controls[i].led_value = bit_no(i);
ipso_control_add(c);
}
/* register this device and its handlers - the handlers automatically
sends in the object to handle */
lwm2m_engine_register_object(&leds_control);
PRINTF("IPSO leds control initialized with %u instances\n",
LEDS_CONTROL_NUMBER);
}
/*---------------------------------------------------------------------------*/
#endif /* 0 */
/** @} */

View File

@ -45,139 +45,29 @@
#include "ipso-objects.h"
#include "lwm2m-object.h"
#include "lwm2m-engine.h"
#include "ipso-control-template.h"
#if 0
#ifdef IPSO_LIGHT_CONTROL
extern const struct ipso_objects_actuator IPSO_LIGHT_CONTROL;
#endif /* IPSO_LIGHT_CONTROL */
/*---------------------------------------------------------------------------*/
static unsigned long last_on_time;
static uint32_t total_on_time;
static int dim_level = 0;
static uint8_t is_on = 0;
/*---------------------------------------------------------------------------*/
static int
read_state(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outsize)
{
return lwm2m_object_write_boolean(ctx, outbuf, outsize, is_on ? 1 : 0);
}
/*---------------------------------------------------------------------------*/
static int
write_state(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t insize,
uint8_t *outbuf, size_t outsize)
{
int value;
size_t len;
len = lwm2m_object_read_boolean(ctx, inbuf, insize, &value);
if(len > 0) {
if(value) {
if(!is_on) {
is_on = 1;
last_on_time = clock_seconds();
}
} else {
if(is_on) {
total_on_time += clock_seconds() - last_on_time;
is_on = 0;
}
}
static lwm2m_status_t set_value(ipso_control_t *control, uint8_t value);
IPSO_CONTROL(light_control, 3311, 0, set_value);
/*---------------------------------------------------------------------------*/
static lwm2m_status_t
set_value(ipso_control_t *control, uint8_t value)
{
#ifdef IPSO_LIGHT_CONTROL
if(IPSO_LIGHT_CONTROL.set_on) {
IPSO_LIGHT_CONTROL.set_on(value);
} else if(IPSO_LIGHT_CONTROL.set_dim_level) {
dim_level = value ? 100 : 0;
IPSO_LIGHT_CONTROL.set_dim_level(dim_level);
}
if(IPSO_LIGHT_CONTROL.set_dim_level) {
IPSO_LIGHT_CONTROL.set_dim_level(value);
} else if(IPSO_LIGHT_CONTROL.set_on) {
IPSO_LIGHT_CONTROL.set_on(value);
}
#endif /* IPSO_LIGHT_CONTROL */
}
return len;
return LWM2M_STATUS_OK;
}
/*---------------------------------------------------------------------------*/
static int
read_dim(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outsize)
{
return lwm2m_object_write_int(ctx, outbuf, outsize, dim_level);
}
/*---------------------------------------------------------------------------*/
static int
write_dim(lwm2m_context_t *ctx, const uint8_t *inbuf, size_t insize,
uint8_t *outbuf, size_t outsize)
{
int32_t value;
size_t len;
len = lwm2m_object_read_int(ctx, inbuf, insize, &value);
if(len > 0) {
if(value < 0) {
value = 0;
} else if(value > 100) {
value = 100;
}
dim_level = value;
if(value > 0) {
if(!is_on) {
is_on = 1;
last_on_time = clock_seconds();
}
} else {
if(is_on) {
total_on_time += clock_seconds() - last_on_time;
is_on = 0;
}
}
#ifdef IPSO_LIGHT_CONTROL
if(IPSO_LIGHT_CONTROL.set_dim_level) {
IPSO_LIGHT_CONTROL.set_dim_level(dim_level);
} else if(IPSO_LIGHT_CONTROL.set_on) {
IPSO_LIGHT_CONTROL.set_on(is_on);
}
#endif /* IPSO_LIGHT_CONTROL */
}
return len;
}
/*---------------------------------------------------------------------------*/
static int
read_on_time(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outsize)
{
unsigned long now;
if(is_on) {
/* Update the on time */
now = clock_seconds();
total_on_time += now - last_on_time;
last_on_time = now;
}
return lwm2m_object_write_int(ctx, outbuf, outsize, (int32_t)total_on_time);
}
/*---------------------------------------------------------------------------*/
static int
write_on_time(lwm2m_context_t *ctx,
const uint8_t *inbuf, size_t insize,
uint8_t *outbuf, size_t outsize)
{
int32_t value;
size_t len;
len = lwm2m_object_read_int(ctx, inbuf, insize, &value);
if(len > 0 && value == 0) {
total_on_time = 0;
if(is_on) {
last_on_time = clock_seconds();
}
}
return len;
}
/*---------------------------------------------------------------------------*/
LWM2M_RESOURCES(light_control_resources,
LWM2M_RESOURCE_CALLBACK(5850, { read_state, write_state, NULL }),
LWM2M_RESOURCE_CALLBACK(5851, { read_dim, write_dim, NULL }),
LWM2M_RESOURCE_CALLBACK(5852, { read_on_time, write_on_time, NULL }),
);
LWM2M_INSTANCES(light_control_instances,
LWM2M_INSTANCE(0, light_control_resources));
LWM2M_OBJECT(light_control, 3311, light_control_instances);
/*---------------------------------------------------------------------------*/
void
ipso_light_control_init(void)
{
@ -185,20 +75,15 @@ ipso_light_control_init(void)
if(IPSO_LIGHT_CONTROL.init) {
IPSO_LIGHT_CONTROL.init();
}
if(IPSO_LIGHT_CONTROL.is_on) {
is_on = IPSO_LIGHT_CONTROL.is_on();
}
if(IPSO_LIGHT_CONTROL.get_dim_level) {
dim_level = IPSO_LIGHT_CONTROL.get_dim_level();
if(dim_level > 0 && IPSO_LIGHT_CONTROL.is_on == NULL) {
is_on = 1;
}
ipso_control_set_value(&light_control,
IPSO_LIGHT_CONTROL.get_dim_level());
} else if(IPSO_LIGHT_CONTROL.is_on) {
ipso_control_set_on(&light_control, IPSO_LIGHT_CONTROL.is_on());
}
#endif /* IPSO_LIGHT_CONTROL */
last_on_time = clock_seconds();
lwm2m_engine_register_object(&light_control);
ipso_control_add(&light_control);
}
/*---------------------------------------------------------------------------*/
#endif /* 0 */
/** @} */

View File

@ -56,11 +56,11 @@ ipso_objects_init(void)
ipso_button_init();
#endif
/* #ifdef IPSO_LIGHT_CONTROL */
/* ipso_light_control_init(); */
/* #elif PLATFORM_HAS_LEDS */
/* ipso_leds_control_init(); */
/* #endif */
#ifdef IPSO_LIGHT_CONTROL
ipso_light_control_init();
#elif PLATFORM_HAS_LEDS
ipso_leds_control_init();
#endif
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -76,6 +76,14 @@ struct ipso_sensor {
ipso_sensor_value_t *sensor_value;
};
#define IPSO_SENSOR(name, oid, get_value, ...) \
static ipso_sensor_value_t name##_value; \
static const ipso_sensor_t name = { \
.object_id = oid, \
.sensor_value = &name##_value, \
.get_value_in_millis = get_value, \
__VA_ARGS__ \
}
int ipso_sensor_add(const ipso_sensor_t *sensor);
int ipso_sensor_remove(const ipso_sensor_t *sensor);

View File

@ -59,22 +59,18 @@ extern const struct ipso_objects_sensor IPSO_TEMPERATURE;
#define IPSO_TEMPERATURE_MAX 80000
#endif
lwm2m_status_t get_temp_value(const ipso_sensor_t *sensor, int32_t *value);
static lwm2m_status_t get_temp_value(const ipso_sensor_t *sensor,
int32_t *value);
static ipso_sensor_value_t temp_value;
static const ipso_sensor_t temp_sensor = {
.object_id = 3303,
.sensor_value = &temp_value,
.max_range = IPSO_TEMPERATURE_MAX, /* milli celcius */
.min_range = IPSO_TEMPERATURE_MIN, /* milli celcius */
.get_value_in_millis = get_temp_value,
.unit = "Cel",
.update_interval = 10
};
IPSO_SENSOR(temp_sensor, 3303, get_temp_value,
.max_range = IPSO_TEMPERATURE_MAX, /* milli celcius */
.min_range = IPSO_TEMPERATURE_MIN, /* milli celcius */
.unit = "Cel",
.update_interval = 10
);
/*---------------------------------------------------------------------------*/
lwm2m_status_t
static lwm2m_status_t
get_temp_value(const ipso_sensor_t *s, int32_t *value)
{
#ifdef IPSO_TEMPERATURE