net: lwm2m: add missing application type to IPSO Light Control
Per IPSO Light Control definition from the OMA LwM2M registry: http://www.openmobilealliance.org/tech/profiles/lwm2m/3311.xml There is an optional "Application Type" string resource (5750) in the Light Control object. This was missed in the initial implementation. NOTE: sample will assign reference if needed. Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
parent
a33a6f7754
commit
9534bbd991
2 changed files with 8 additions and 1 deletions
|
@ -46,6 +46,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||||
#define CLIENT_DEVICE_TYPE "OMA-LWM2M Client"
|
#define CLIENT_DEVICE_TYPE "OMA-LWM2M Client"
|
||||||
#define CLIENT_HW_VER "1.0.1"
|
#define CLIENT_HW_VER "1.0.1"
|
||||||
|
|
||||||
|
#define LIGHT_NAME "Test light"
|
||||||
#define TIMER_NAME "Test timer"
|
#define TIMER_NAME "Test timer"
|
||||||
|
|
||||||
#define ENDPOINT_LEN 32
|
#define ENDPOINT_LEN 32
|
||||||
|
@ -337,6 +338,9 @@ static int lwm2m_setup(void)
|
||||||
lwm2m_engine_create_obj_inst("3311/0");
|
lwm2m_engine_create_obj_inst("3311/0");
|
||||||
lwm2m_engine_register_post_write_callback("3311/0/5850",
|
lwm2m_engine_register_post_write_callback("3311/0/5850",
|
||||||
led_on_off_cb);
|
led_on_off_cb);
|
||||||
|
lwm2m_engine_set_res_data("3311/0/5750",
|
||||||
|
LIGHT_NAME, sizeof(LIGHT_NAME),
|
||||||
|
LWM2M_RES_DATA_FLAG_RO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IPSO: Timer object */
|
/* IPSO: Timer object */
|
||||||
|
|
|
@ -31,8 +31,9 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||||
#define LIGHT_POWER_FACTOR_ID 5820
|
#define LIGHT_POWER_FACTOR_ID 5820
|
||||||
#define LIGHT_COLOUR_ID 5706
|
#define LIGHT_COLOUR_ID 5706
|
||||||
#define LIGHT_SENSOR_UNITS_ID 5701
|
#define LIGHT_SENSOR_UNITS_ID 5701
|
||||||
|
#define LIGHT_APPLICATION_TYPE_ID 5750
|
||||||
|
|
||||||
#define LIGHT_MAX_ID 7
|
#define LIGHT_MAX_ID 8
|
||||||
|
|
||||||
#define MAX_INSTANCE_COUNT CONFIG_LWM2M_IPSO_LIGHT_CONTROL_INSTANCE_COUNT
|
#define MAX_INSTANCE_COUNT CONFIG_LWM2M_IPSO_LIGHT_CONTROL_INSTANCE_COUNT
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ static struct lwm2m_engine_obj_field fields[] = {
|
||||||
OBJ_FIELD_DATA(LIGHT_POWER_FACTOR_ID, R_OPT, FLOAT32),
|
OBJ_FIELD_DATA(LIGHT_POWER_FACTOR_ID, R_OPT, FLOAT32),
|
||||||
OBJ_FIELD_DATA(LIGHT_COLOUR_ID, RW_OPT, STRING),
|
OBJ_FIELD_DATA(LIGHT_COLOUR_ID, RW_OPT, STRING),
|
||||||
OBJ_FIELD_DATA(LIGHT_SENSOR_UNITS_ID, R_OPT, STRING),
|
OBJ_FIELD_DATA(LIGHT_SENSOR_UNITS_ID, R_OPT, STRING),
|
||||||
|
OBJ_FIELD_DATA(LIGHT_APPLICATION_TYPE_ID, RW_OPT, STRING),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct lwm2m_engine_obj_inst inst[MAX_INSTANCE_COUNT];
|
static struct lwm2m_engine_obj_inst inst[MAX_INSTANCE_COUNT];
|
||||||
|
@ -166,6 +168,7 @@ static struct lwm2m_engine_obj_inst *light_control_create(u16_t obj_inst_id)
|
||||||
colour[avail], LIGHT_STRING_LONG);
|
colour[avail], LIGHT_STRING_LONG);
|
||||||
INIT_OBJ_RES_DATA(res[avail], i, LIGHT_SENSOR_UNITS_ID,
|
INIT_OBJ_RES_DATA(res[avail], i, LIGHT_SENSOR_UNITS_ID,
|
||||||
units[avail], LIGHT_STRING_SHORT);
|
units[avail], LIGHT_STRING_SHORT);
|
||||||
|
INIT_OBJ_RES_DUMMY(res[avail], i, LIGHT_APPLICATION_TYPE_ID);
|
||||||
|
|
||||||
inst[avail].resources = res[avail];
|
inst[avail].resources = res[avail];
|
||||||
inst[avail].resource_count = i;
|
inst[avail].resource_count = i;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue