From 6ba8068c62c9639d6f091352a4de0aea4101ac94 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 30 Sep 2016 15:53:46 +0300 Subject: [PATCH] Allow mesh-api to configure routing. --- features/net/FEATURE_NANOSTACK/mbed-mesh-api/README.md | 4 ++-- features/net/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json | 1 + .../net/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/net/FEATURE_NANOSTACK/mbed-mesh-api/README.md b/features/net/FEATURE_NANOSTACK/mbed-mesh-api/README.md index 71e3201319..920231b694 100644 --- a/features/net/FEATURE_NANOSTACK/mbed-mesh-api/README.md +++ b/features/net/FEATURE_NANOSTACK/mbed-mesh-api/README.md @@ -10,7 +10,7 @@ Currently, 6LoWPAN-ND (neighbour discovery) and Thread bootstrap modes are suppo ## Module Configuration -This module supports static configuration via **mbed configuration system** by using the `mbed_app.json` file. The application needs to create the configuration file if it wants to use other than default settings. +This module supports static configuration via **mbed configuration system** by using the `mbed_app.json` file. The application needs to create the configuration file if it wants to use other than default settings. An example of the configuration file: @@ -58,7 +58,7 @@ An example of the configuration file: | 6lowpan-nd-psk-key-id | number | PSK key id when PSK is enabled | | 6lowpan-nd-psk-key | byte array [16] | Pre shared network key | | 6lowpan-nd-sec-level | number [1-7] | Network security level. Use default `5` | - +| 6lowpan-nd-device-type | "NET_6LOWPAN_ROUTER" or "NET_6LOWPAN_HOST" | Device mode. Router is routing packets from other device, creating a mesh network. | ## Usage notes diff --git a/features/net/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json b/features/net/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json index 299807ae0f..4d21643598 100644 --- a/features/net/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json +++ b/features/net/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json @@ -9,6 +9,7 @@ "6lowpan-nd-psk-key-id": 1, "6lowpan-nd-psk-key": "{0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf}", "6lowpan-nd-sec-level": 5, + "6lowpan-nd-device-type": "NET_6LOWPAN_ROUTER", "thread-pskd": "\"Secret password\"", "thread-config-channel-mask": "0x7fff800", "thread-config-channel-page": 0, diff --git a/features/net/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c b/features/net/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c index 044de84be2..3b74fe02bb 100644 --- a/features/net/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c +++ b/features/net/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c @@ -370,8 +370,7 @@ int8_t nd_tasklet_connect(mesh_interface_cb callback, int8_t nwk_interface_id) tasklet_data_ptr->network_interface_id = nwk_interface_id; tasklet_data_ptr->tasklet_state = TASKLET_STATE_INITIALIZED; - //TODO: Fetch these values from device config api - tasklet_data_ptr->mode = NET_6LOWPAN_ROUTER; + tasklet_data_ptr->mode = MBED_CONF_MBED_MESH_API_6LOWPAN_ND_DEVICE_TYPE; tasklet_data_ptr->sec_mode = NET_SEC_MODE_NO_LINK_SECURITY; //tasklet_data_ptr->psk_sec_info.key_id = 0;