Skip to content

Commit 9b283cb

Browse files
author
Juha Heiskanen
committed
Fixed FHSS configuration API
Disabled unicast and broadcast random fixed channel selection support. Change-Id: I08c5750ddb0a29bb8faa7425ef9df18a80341abf
1 parent 76089cb commit 9b283cb

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

nanostack/ws_management_api.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,10 @@ int ws_management_fhss_timing_configure(
246246
* Change the default configuration for Wi-SUN FHSS operation.
247247
* if application defined is used the behaviour is undefined
248248
*
249+
*
249250
* \param interface_id Network interface ID.
250251
* \param channel_function Unicast channel function.
251-
* \param fixed_channel Used channel when channel function is fixed channel. If 0xFFFF, randomly chosen channel is used.
252+
* \param fixed_channel Used channel when channel function is fixed channel.
252253
* \param dwell_interval Used dwell interval when channel function is TR51 or DH1.
253254
*
254255
* \return 0, Init OK.
@@ -266,9 +267,10 @@ int ws_management_fhss_unicast_channel_function_configure(
266267
* Change the default configuration for Wi-SUN FHSS operation.
267268
* if application defined is used the behaviour is undefined
268269
*
270+
*
269271
* \param interface_id Network interface ID.
270272
* \param channel_function Broadcast channel function.
271-
* \param fixed_channel Used channel when channel function is fixed channel. If 0xFFFF, randomly chosen channel is used.
273+
* \param fixed_channel Used channel when channel function is fixed channel.
272274
* \param dwell_interval Broadcast channel dwell interval.
273275
* \param broadcast_interval Broadcast interval.
274276
*

source/6LoWPAN/ws/ws_management_api.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,20 @@ int ws_management_fhss_unicast_channel_function_configure(
241241
channel_function != WS_TR51CF) {
242242
return -2;
243243
}
244+
245+
if (channel_function == WS_FIXED_CHANNEL && fixed_channel == 0xffff) {
246+
fixed_channel = 0;
247+
tr_warn("Fixed channel not configured. Set to 0");
248+
}
249+
250+
244251
cur->ws_info->fhss_uc_channel_function = channel_function;
245-
cur->ws_info->fhss_uc_fixed_channel = fixed_channel;
252+
if (cur->ws_info->fhss_uc_channel_function == WS_FIXED_CHANNEL) {
253+
cur->ws_info->fhss_uc_fixed_channel = fixed_channel;
254+
} else {
255+
cur->ws_info->fhss_uc_fixed_channel = 0xffff;
256+
}
257+
246258
cur->ws_info->fhss_uc_dwell_interval = dwell_interval;
247259

248260
// if settings change reset_restart for the settings needed
@@ -273,8 +285,19 @@ int ws_management_fhss_broadcast_channel_function_configure(
273285
channel_function != WS_TR51CF) {
274286
return -2;
275287
}
288+
289+
if (channel_function == WS_FIXED_CHANNEL && fixed_channel == 0xffff) {
290+
fixed_channel = 0;
291+
tr_warn("Fixed channel not configured. Set to 0");
292+
}
293+
276294
cur->ws_info->fhss_bc_channel_function = channel_function;
277-
cur->ws_info->fhss_bc_fixed_channel = fixed_channel;
295+
if (cur->ws_info->fhss_bc_channel_function == WS_FIXED_CHANNEL) {
296+
cur->ws_info->fhss_bc_fixed_channel = fixed_channel;
297+
} else {
298+
cur->ws_info->fhss_bc_fixed_channel = 0xffff;
299+
}
300+
278301
cur->ws_info->fhss_bc_dwell_interval = dwell_interval;
279302
cur->ws_info->fhss_bc_interval = broadcast_interval;
280303

test/nanostack/unittest/6LoWPAN/ws_management_api/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ TEST_SRC_FILES = \
1111
ws_management_api_test.cpp \
1212
test_ws_management_api.c \
1313
../../stub/protocol_core_stub.c \
14+
../../stub/mbed_trace_stub.c \
1415
../../stub/ws_common_stub.c \
1516
../../stub/ws_bootstrap_stub.c \
1617

0 commit comments

Comments
 (0)