Skip to content

Commit 59b145b

Browse files
author
Juha Heiskanen
committed
Fixed Ifdown / UP sequence and and discovery state set own hop to 0xff.
Change-Id: I42c1e9db1f404c3e41bbcdacf1998045ea5756ff
1 parent 9103d68 commit 59b145b

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static int8_t ws_fhss_initialize(protocol_interface_info_entry_t *cur)
421421
{
422422
fhss_api_t *fhss_api = ns_sw_mac_get_fhss_api(cur->mac_api);
423423

424-
if (!fhss_api) {
424+
if (!fhss_api || (fhss_api && cur->ws_info->fhss_owner)) {
425425
// When FHSS doesn't exist yet, create one
426426
fhss_ws_configuration_t fhss_configuration;
427427
memset(&fhss_configuration, 0, sizeof(fhss_ws_configuration_t));
@@ -438,12 +438,25 @@ static int8_t ws_fhss_initialize(protocol_interface_info_entry_t *cur)
438438
fhss_configuration.fhss_bc_dwell_interval = cur->ws_info->fhss_bc_dwell_interval;
439439
fhss_configuration.fhss_broadcast_interval = cur->ws_info->fhss_bc_interval;
440440

441-
fhss_api = ns_fhss_ws_create(&fhss_configuration, cur->ws_info->fhss_timer_ptr);
442441
if (!fhss_api) {
443-
tr_error("fhss create failed");
444-
return -1;
442+
fhss_api = ns_fhss_ws_create(&fhss_configuration, cur->ws_info->fhss_timer_ptr);
443+
if (!fhss_api) {
444+
tr_error("fhss create failed");
445+
return -1;
446+
}
447+
ns_sw_mac_fhss_register(cur->mac_api, fhss_api);
448+
cur->ws_info->fhss_owner = true;
449+
} else {
450+
//Configuration set
451+
ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration);
452+
453+
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
454+
ns_fhss_ws_set_hop_count(cur->ws_info->fhss_api, 0);
455+
} else {
456+
//Clear OWN HOP
457+
ns_fhss_ws_set_hop_count(cur->ws_info->fhss_api, 0xff);
458+
}
445459
}
446-
ns_sw_mac_fhss_register(cur->mac_api, fhss_api);
447460
} else {
448461
// Read defaults from the configuration to help FHSS testing
449462
const fhss_ws_configuration_t *fhss_configuration = ns_fhss_ws_configuration_get(fhss_api);
@@ -524,6 +537,7 @@ static int8_t ws_fhss_discovery_configure(protocol_interface_info_entry_t *cur)
524537
fhss_configuration.unicast_fixed_channel = tmp_uc_fixed_channel;
525538
fhss_configuration.broadcast_fixed_channel = tmp_bc_fixed_channel;
526539
ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration);
540+
ns_fhss_ws_set_hop_count(cur->ws_info->fhss_api, 0xff);
527541
ws_bootstrap_llc_hopping_update(cur, &fhss_configuration);
528542

529543
return 0;

source/6LoWPAN/ws/ws_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ typedef struct ws_info_s {
8787
bool trickle_pa_running: 1;
8888
bool trickle_pcs_running: 1;
8989
bool trickle_pc_running: 1;
90+
bool fhss_owner: 1;
9091
// default fhss parameters for this device
9192
uint8_t fhss_uc_dwell_interval;
9293
uint8_t fhss_bc_dwell_interval;

0 commit comments

Comments
 (0)