net: lwm2m: remove data storage for IPSO Timer application type

We are pre-allocating a storage variable for the application type
resource in the IPSO Timer object.  This is an optional resource
which won't always be set by samples.

Let's leave out the pre-allocated variable and let the sample set
this reference if needed (it's optional).

Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
Michael Scott 2019-07-29 10:01:00 -07:00 committed by Jukka Rissanen
commit a33a6f7754
2 changed files with 5 additions and 6 deletions

View file

@ -46,6 +46,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#define CLIENT_DEVICE_TYPE "OMA-LWM2M Client"
#define CLIENT_HW_VER "1.0.1"
#define TIMER_NAME "Test timer"
#define ENDPOINT_LEN 32
#ifndef DT_ALIAS_LED0_GPIOS_CONTROLLER
@ -341,7 +343,8 @@ static int lwm2m_setup(void)
lwm2m_engine_create_obj_inst("3340/0");
lwm2m_engine_register_post_write_callback("3340/0/5543",
timer_digital_state_cb);
lwm2m_engine_set_string("3340/0/5750", "Test timer");
lwm2m_engine_set_res_data("3340/0/5750", TIMER_NAME, sizeof(TIMER_NAME),
LWM2M_RES_DATA_FLAG_RO);
return 0;
}

View file

@ -38,8 +38,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#define MAX_INSTANCE_COUNT CONFIG_LWM2M_IPSO_TIMER_INSTANCE_COUNT
#define TIMER_STRING_LONG 64
enum ipso_timer_mode {
TIMER_MODE_OFF = 0,
TIMER_MODE_ONE_SHOT,
@ -61,7 +59,6 @@ struct ipso_timer_data {
struct k_delayed_work timer_work;
char app_type[TIMER_STRING_LONG];
u16_t obj_inst_id;
u8_t timer_mode;
bool enabled;
@ -355,8 +352,7 @@ static struct lwm2m_engine_obj_inst *timer_create(u16_t obj_inst_id)
INIT_OBJ_RES_DATA(res[avail], i, TIMER_MODE_ID,
&timer_data[avail].timer_mode,
sizeof(timer_data[avail].timer_mode));
INIT_OBJ_RES_DATA(res[avail], i, TIMER_APPLICATION_TYPE_ID,
&timer_data[avail].app_type, TIMER_STRING_LONG);
INIT_OBJ_RES_DUMMY(res[avail], i, TIMER_APPLICATION_TYPE_ID);
inst[avail].resources = res[avail];
inst[avail].resource_count = i;