Skip to content

Commit 0b06a06

Browse files
icatorzenashif
authored andcommitted
net: lwm2m: Supported Protocol to pull firmware update must be optional
The supported protocol must be delivered to the firmware update object as optional, then configured in the application. This information is device/server dependent so does not can be fixed in library. Signed-off-by: Jair Jack <[email protected]>
1 parent 2af787f commit 0b06a06

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

samples/net/lwm2m_client/src/lwm2m-client.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ static uint32_t led_state;
7878

7979
static struct lwm2m_ctx client;
8080

81+
#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT)
82+
/* Array with supported PULL firmware update protocols */
83+
static uint8_t supported_protocol[1];
84+
#endif
85+
8186
#if defined(CONFIG_LWM2M_DTLS_SUPPORT)
8287
#define TLS_TAG 1
8388

@@ -369,6 +374,10 @@ static int lwm2m_setup(void)
369374
lwm2m_firmware_set_write_cb(firmware_block_received_cb);
370375
#endif
371376
#if defined(CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT)
377+
lwm2m_engine_create_res_inst("5/0/8/0");
378+
lwm2m_engine_set_res_data("5/0/8/0", &supported_protocol[0],
379+
sizeof(supported_protocol[0]), 0);
380+
372381
lwm2m_firmware_set_update_cb(firmware_update_cb);
373382
#endif
374383

subsys/net/lib/lwm2m/lwm2m_obj_firmware.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
4949
/* resource state variables */
5050
static uint8_t update_state;
5151
static uint8_t update_result;
52-
static uint8_t supported_protocol;
5352
static uint8_t delivery_method;
5453
static char package_uri[PACKAGE_URI_LEN];
5554

@@ -335,8 +334,8 @@ static struct lwm2m_engine_obj_inst *firmware_create(uint16_t obj_inst_id)
335334
&update_result, sizeof(update_result));
336335
INIT_OBJ_RES_OPTDATA(FIRMWARE_PACKAGE_NAME_ID, res, i, res_inst, j);
337336
INIT_OBJ_RES_OPTDATA(FIRMWARE_PACKAGE_VERSION_ID, res, i, res_inst, j);
338-
INIT_OBJ_RES_DATA(FIRMWARE_UPDATE_PROTO_SUPPORT_ID, res, i, res_inst, j,
339-
&supported_protocol, sizeof(supported_protocol));
337+
INIT_OBJ_RES_MULTI_OPTDATA(FIRMWARE_UPDATE_PROTO_SUPPORT_ID, res, i,
338+
res_inst, j, 1, false);
340339
INIT_OBJ_RES_DATA(FIRMWARE_UPDATE_DELIV_METHOD_ID, res, i, res_inst, j,
341340
&delivery_method, sizeof(delivery_method));
342341

0 commit comments

Comments
 (0)