samples: net: lwm2m: bootstrap support changes:

When LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP is enabled:
- Mark the first server as a bootstrap server
- Create second server and security instances (used by bootstrap
  server)

This allows bootstrap support to be tested out of the box with
the following:
- setup Leshan bss-server-demo (bootstrap server) on port 5783
- setup Leshan server-demo (lwm2m server) on port 5683
- add an entry into the bootstrap server:
  LWM2M Server=coap://[2001:db8::2]:5683
- build the sample like so:
  west build -t run -b qemu_x86 \
    -s zephyr/samples/net/lwm2m_client/ -- \
    -DCONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP=y \
    -DCONFIG_LWM2M_PEER_PORT=5783

Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
Michael Scott 2019-08-17 10:08:40 -07:00 committed by Ioannis Glaropoulos
commit 7492555f88

View file

@ -282,6 +282,17 @@ static int lwm2m_setup(void)
(void *)client_psk, sizeof(client_psk));
#endif /* CONFIG_LWM2M_DTLS_SUPPORT */
#if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP)
/* Mark 1st instance of security object as a bootstrap server */
lwm2m_engine_set_u8("0/0/1", 1);
/* Create 2nd instance of server and security objects needed for
* bootstrap process
*/
lwm2m_engine_create_obj_inst("0/1");
lwm2m_engine_create_obj_inst("1/1");
#endif
/* setup SERVER object */
/* setup DEVICE object */