Skip to content

Commit b06b58a

Browse files
author
Jarkko Paso
committed
FHSS: Implemented setting hop count API
1 parent d73d210 commit b06b58a

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

nanostack/fhss_ws_extension.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ extern int ns_fhss_ws_remove_parent(const fhss_api_t *fhss_api, const uint8_t eu
9898
*/
9999
extern int ns_fhss_set_neighbor_info_fp(const fhss_api_t *fhss_api, fhss_get_neighbor_info *get_neighbor_info);
100100

101+
/**
102+
* @brief Set node hop count. Hop count is used to specify TX/RX slot. When hop count is set to 0xFF, TX/RX slots are ignored.
103+
* @param fhss_api FHSS instance.
104+
* @param hop_count Hop count to be set.
105+
* @return 0 on success, -1 on fail.
106+
*/
107+
extern int ns_fhss_ws_set_hop_count(const fhss_api_t *fhss_api, const uint8_t hop_count);
101108

102109
#ifdef __cplusplus
103110
}

source/Service_Libs/fhss/fhss_configuration_interface.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,12 @@ int ns_fhss_ws_configuration_set(const fhss_api_t *fhss_api, const fhss_ws_confi
129129
}
130130
return fhss_ws_configuration_set(fhss_structure, fhss_configuration);
131131
}
132+
133+
int ns_fhss_ws_set_hop_count(const fhss_api_t *fhss_api, const uint8_t hop_count)
134+
{
135+
fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api);
136+
if (!fhss_structure || !fhss_structure->ws) {
137+
return -1;
138+
}
139+
return fhss_ws_set_hop_count(fhss_structure, hop_count);
140+
}

source/Service_Libs/fhss/fhss_ws.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati
7676

7777
fhss_struct->ws->fhss_configuration = *fhss_configuration;
7878
fhss_struct->number_of_channels = channel_count;
79+
fhss_struct->own_hop = 0xff;
7980
ns_list_init(&fhss_struct->fhss_failed_tx_list);
8081
return fhss_struct;
8182
}
@@ -582,3 +583,9 @@ int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_co
582583
fhss_structure->number_of_channels = channel_count;
583584
return 0;
584585
}
586+
587+
int fhss_ws_set_hop_count(fhss_structure_t *fhss_structure, const uint8_t hop_count)
588+
{
589+
fhss_structure->own_hop = hop_count;
590+
return 0;
591+
}

source/Service_Libs/fhss/fhss_ws.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ int fhss_ws_set_callbacks(fhss_structure_t *fhss_structure);
3939
int fhss_ws_set_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info);
4040
int fhss_ws_remove_parent(fhss_structure_t *fhss_structure, const uint8_t eui64[8]);
4141
int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_configuration_t *fhss_configuration);
42+
int fhss_ws_set_hop_count(fhss_structure_t *fhss_structure, const uint8_t hop_count);
4243

4344
#endif /*FHSS_WS_H_*/

test/nanostack/unittest/stub/fhss_ws_stub.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ int fhss_ws_configuration_set(fhss_structure_t *fhss_structure, const fhss_ws_co
5252
{
5353
return 0;
5454
}
55+
56+
int fhss_ws_set_hop_count(fhss_structure_t *fhss_structure, const uint8_t hop_count)
57+
{
58+
return 0;
59+
}

0 commit comments

Comments
 (0)