From fae713e4d10f1bad448d2e664970276d21156968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=20Lepp=C3=A4nen?= Date: Fri, 28 Oct 2016 09:51:00 +0300 Subject: [PATCH] Added support for 6lowpan PAN ID filter to mbed mesh api configuration --- .../nanostack/FEATURE_NANOSTACK/mbed-mesh-api/README.md | 1 + .../nanostack/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json | 1 + .../mbed-mesh-api/source/include/static_config.h | 6 ++++++ .../FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/README.md b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/README.md index 920231b694..207a6beacf 100644 --- a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/README.md +++ b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/README.md @@ -54,6 +54,7 @@ An example of the configuration file: | 6lowpan-nd-channel-mask | number [0-0x07fff800] | Channel mask, bit-mask of channels to use | | 6lowpan-nd-channel-page | number [0, 2] | 0 for 2,4 GHz and 2 for sub-GHz radios | | 6lowpan-nd-channel | number [0-27] | RF channel to use when `channel_mask` is not defined | +| 6lowpan-nd-panid-filter | number [0-0xffff] | Beacon PAN ID filter, 0xffff means no filtering | | 6lowpan-nd-security-mode | "NONE" or "PSK" | To use either no security, or Pre shared network key | | 6lowpan-nd-psk-key-id | number | PSK key id when PSK is enabled | | 6lowpan-nd-psk-key | byte array [16] | Pre shared network key | diff --git a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json index 4d21643598..0b32c7c767 100644 --- a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json +++ b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/mbed_lib.json @@ -5,6 +5,7 @@ "6lowpan-nd-channel-mask": "(1<<12)", "6lowpan-nd-channel-page": 0, "6lowpan-nd-channel": 12, + "6lowpan-nd-panid-filter": "0xffff", "6lowpan-nd-security-mode": "NONE", "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}", diff --git a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/include/static_config.h b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/include/static_config.h index cd2ff27149..d4fcf9557a 100644 --- a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/include/static_config.h +++ b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/include/static_config.h @@ -100,6 +100,12 @@ extern "C" { #define MBED_MESH_API_6LOWPAN_ND_SEC_LEVEL 5 #endif +#if defined MBED_CONF_MBED_MESH_API_6LOWPAN_ND_PANID_FILTER +#define MBED_MESH_API_6LOWPAN_ND_PANID_FILTER MBED_CONF_MBED_MESH_API_6LOWPAN_ND_PANID_FILTER +#else +#define MBED_MESH_API_6LOWPAN_ND_PANID_FILTER 0xffff +#endif + /* Thread configuration */ // PSKd, must be longer than 6 #ifdef YOTTA_CFG_MBED_MESH_API_THREAD_PSKD diff --git a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c index 3b74fe02bb..136c067cce 100644 --- a/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c +++ b/features/nanostack/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c @@ -263,6 +263,10 @@ void nd_tasklet_configure_and_connect_to_network(void) arm_nwk_6lowpan_link_nwk_id_filter_for_nwk_scan( tasklet_data_ptr->network_interface_id, NULL); + arm_nwk_6lowpan_link_panid_filter_for_nwk_scan( + tasklet_data_ptr->network_interface_id, + MBED_MESH_API_6LOWPAN_ND_PANID_FILTER); + status = arm_nwk_interface_up(tasklet_data_ptr->network_interface_id); if (status >= 0) { tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_STARTED;