Good day
I am attempting to use lwm2m to post temperature sensor data. At the moment I'm trying to to initialize object with ID 3300 (generic sensor)but it is not appearing on the Leshan Demo Server.
My process of initialization is as follows:
// Initialize Object //****************** typedef struct float32_value { int32_t val1; int32_t val2; } float32_value_t; static struct float32_value sensor_value = { 1, 0 }; static void *read_cb(uint16_t obj_inst_id, uint16_t res_id, uint16_t res_inst_id, size_t *data_len) { /* Only object instance 0 is currently used */ if (obj_inst_id != 0) { *data_len = 0; return NULL; } /* Demo: change the sensor value */ ++sensor_value.val2; /* Return sensor value for the LwM2M library */ lwm2m_engine_set_float("3300/0/5700", &sensor_value); *data_len = sizeof(sensor_value); return &sensor_value; } int init_resource(void) { lwm2m_engine_create_obj_inst("3300/0"); lwm2m_engine_register_read_callback("3300/0/5700", read_cb); return 0; }
The errors i'm getting are as follows:
[00:00:37.295,471] <err> net_lwm2m_registry: unable to find obj: 3300
[00:00:37.295,501] <err> net_lwm2m_registry: obj instance 3300/0 not found
I am aware that something must be added to the prj file to allow the use of the generic sensor(id:3300). I might not be seeing something obvious or the documentation might be outdated in https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/networking/lwm2m_client_utils.html#example-callback
Please assist if you can.
Thank you !