
Nanostack Border Router is a generic mbed border router implementation that provides the 6LoWPAN ND or Thread border router initialization logic.
Revision 12:04fcf9df91e2, committed 2017-05-29
- Comitter:
- mbed_official
- Date:
- Mon May 29 13:00:17 2017 +0100
- Parent:
- 11:487bed03bd4b
- Child:
- 13:993808eb2e9c
- Commit message:
- Thread BR commissioning support (#35)
* Thread BR commissioning support
Allow application to bypass Thread static configuration to allow
Border Router commissioning. Flag THREAD_USE_STATIC_LINK_CONFIG
controls usage of static link configuration settings.
.
Commit copied from https://github.com/ARMmbed/nanostack-border-router
Changed in this revision
--- a/configs/Thread_Atmel_RF.json Fri May 26 11:30:21 2017 +0100 +++ b/configs/Thread_Atmel_RF.json Mon May 29 13:00:17 2017 +0100 @@ -37,6 +37,7 @@ "pskd": "\"abcdefghijklmno\"", "pskc": "{0xc8, 0xa6, 0x2e, 0xae, 0xf3, 0x68, 0xf3, 0x46, 0xa9, 0x9e, 0x57, 0x85, 0x98, 0x9d, 0x1c, 0xd0}", "thread-master-key": "{0x10, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}", + "thread-use-static-link-config": true, "LED": "NC", "SERIAL_TX": "NC", "SERIAL_RX": "NC",
--- a/configs/Thread_SLIP_Atmel_RF.json Fri May 26 11:30:21 2017 +0100 +++ b/configs/Thread_SLIP_Atmel_RF.json Mon May 29 13:00:17 2017 +0100 @@ -39,6 +39,7 @@ "pskd": "\"abcdefghijklmno\"", "pskc": "{0xc8, 0xa6, 0x2e, 0xae, 0xf3, 0x68, 0xf3, 0x46, 0xa9, 0x9e, 0x57, 0x85, 0x98, 0x9d, 0x1c, 0xd0}", "thread-master-key": "{0x10, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}", + "thread-use-static-link-config": true, "LED": "NC", "SERIAL_TX": "NC", "SERIAL_RX": "NC",
--- a/source/borderrouter_thread_tasklet.c Fri May 26 11:30:21 2017 +0100 +++ b/source/borderrouter_thread_tasklet.c Mon May 29 13:00:17 2017 +0100 @@ -56,9 +56,6 @@ uint8_t next_hop[16]; } route_info_t; -/* Border router channel list */ -static channel_list_s channel_list; - /* Backhaul prefix */ static uint8_t backhaul_prefix[16] = {0}; @@ -71,7 +68,7 @@ /* Function forward declarations */ -static void thread_link_configuration_get(link_configuration_s *link_configuration); +static link_configuration_s* thread_link_configuration_get(link_configuration_s *link_configuration); static void network_interface_event_handler(arm_event_s *event); static void mesh_network_up(void); static void eth_network_data_init(void); @@ -134,6 +131,7 @@ int32_t val; device_configuration_s device_config; link_configuration_s link_setup; + link_configuration_s *link_setup_ptr; int8_t thread_if_id = thread_br_conn_handler_thread_interface_id_get(); tr_info("thread_interface_up"); @@ -148,9 +146,8 @@ memset(device_config.PSKd_ptr, 0, len + 1); memcpy(device_config.PSKd_ptr, param, len); - thread_link_configuration_get(&link_setup); - - val = thread_management_node_init(thread_if_id, &channel_list, &device_config, &link_setup); + link_setup_ptr = thread_link_configuration_get(&link_setup); + val = thread_management_node_init(thread_if_id, NULL, &device_config, link_setup_ptr); if (val) { tr_error("Thread init error with code: %is\r\n", (int)val); @@ -171,8 +168,13 @@ return 0; } -static void thread_link_configuration_get(link_configuration_s *link_configuration) +static link_configuration_s* thread_link_configuration_get(link_configuration_s *link_configuration) { +#if (false == MBED_CONF_APP_THREAD_USE_STATIC_LINK_CONFIG) + // NOT using static link configuration values, return NULL + return NULL; +#endif + memset(link_configuration, 0, sizeof(link_configuration_s)); MBED_ASSERT(strlen(MBED_CONF_APP_NETWORK_NAME) > 0 && strlen(MBED_CONF_APP_NETWORK_NAME) < 17); @@ -206,6 +208,8 @@ link_configuration->key_rotation = 3600; link_configuration->key_sequence = 0; + + return link_configuration; } // ethernet interface