@@ -75,6 +75,13 @@ typedef struct {
7575 uint8_t regulatory_domain ;
7676 uint8_t rd_operating_class ;
7777 uint8_t rd_operating_mode ;
78+ uint8_t uc_channel_function ;
79+ uint8_t bc_channel_function ;
80+ uint8_t uc_dwell_interval ;
81+ uint32_t bc_interval ;
82+ uint8_t bc_dwell_interval ;
83+ uint16_t uc_fixed_channel ;
84+ uint16_t bc_fixed_channel ;
7885} wisun_network_settings_t ;
7986
8087typedef struct {
@@ -90,12 +97,25 @@ typedef struct {
9097 bool remove_trusted_certificates : 1 ;
9198} wisun_certificates_t ;
9299
93- #define WS_NA 0xff // Not applicable value
100+ #define WS_NA 0xff // Not applicable value
101+ #define WS_DEFAULT 0x00 // Use default value
94102
95103/* Tasklet data */
96104static wisun_tasklet_data_str_t * wisun_tasklet_data_ptr = NULL ;
97105static wisun_certificates_t * wisun_certificates_ptr = NULL ;
98- static wisun_network_settings_t wisun_settings_str = {NULL , MBED_CONF_MBED_MESH_API_WISUN_REGULATORY_DOMAIN , MBED_CONF_MBED_MESH_API_WISUN_OPERATING_CLASS , MBED_CONF_MBED_MESH_API_WISUN_OPERATING_MODE };
106+ static wisun_network_settings_t wisun_settings_str = {
107+ .network_name = NULL ,
108+ .regulatory_domain = MBED_CONF_MBED_MESH_API_WISUN_REGULATORY_DOMAIN ,
109+ .rd_operating_class = MBED_CONF_MBED_MESH_API_WISUN_OPERATING_CLASS ,
110+ .rd_operating_mode = MBED_CONF_MBED_MESH_API_WISUN_OPERATING_MODE ,
111+ .uc_channel_function = MBED_CONF_MBED_MESH_API_WISUN_UC_CHANNEL_FUNCTION ,
112+ .bc_channel_function = MBED_CONF_MBED_MESH_API_WISUN_BC_CHANNEL_FUNCTION ,
113+ .uc_dwell_interval = MBED_CONF_MBED_MESH_API_WISUN_UC_DWELL_INTERVAL ,
114+ .bc_interval = MBED_CONF_MBED_MESH_API_WISUN_BC_INTERVAL ,
115+ .bc_dwell_interval = MBED_CONF_MBED_MESH_API_WISUN_BC_DWELL_INTERVAL ,
116+ .uc_fixed_channel = MBED_CONF_MBED_MESH_API_WISUN_UC_FIXED_CHANNEL ,
117+ .bc_fixed_channel = MBED_CONF_MBED_MESH_API_WISUN_BC_FIXED_CHANNEL
118+ };
99119static mac_api_t * mac_api = NULL ;
100120
101121extern fhss_timer_t fhss_functions ;
@@ -254,6 +274,47 @@ static void wisun_tasklet_configure_and_connect_to_network(void)
254274 return ;
255275 }
256276
277+ if (wisun_settings_str .uc_channel_function != WS_NA ) {
278+ status = ws_management_fhss_unicast_channel_function_configure (wisun_tasklet_data_ptr -> network_interface_id ,
279+ wisun_settings_str .uc_channel_function ,
280+ wisun_settings_str .uc_fixed_channel ,
281+ wisun_settings_str .uc_dwell_interval );
282+
283+ if (status < 0 ) {
284+ tr_error ("Failed to set unicast channel function configuration" );
285+ return ;
286+ }
287+ }
288+
289+ if (wisun_settings_str .bc_channel_function != WS_NA ||
290+ wisun_settings_str .bc_dwell_interval != WS_DEFAULT ||
291+ wisun_settings_str .bc_interval != WS_DEFAULT ) {
292+ status = ws_management_fhss_broadcast_channel_function_configure (wisun_tasklet_data_ptr -> network_interface_id ,
293+ wisun_settings_str .bc_channel_function ,
294+ wisun_settings_str .bc_fixed_channel ,
295+ wisun_settings_str .bc_dwell_interval ,
296+ wisun_settings_str .bc_interval );
297+
298+ if (status < 0 ) {
299+ tr_error ("Failed to set broadcast channel function configuration" );
300+ return ;
301+ }
302+ }
303+
304+ if (wisun_settings_str .uc_dwell_interval != WS_DEFAULT ||
305+ wisun_settings_str .bc_dwell_interval != WS_DEFAULT ||
306+ wisun_settings_str .bc_interval != WS_DEFAULT ) {
307+ status = ws_management_fhss_timing_configure (wisun_tasklet_data_ptr -> network_interface_id ,
308+ wisun_settings_str .uc_dwell_interval ,
309+ wisun_settings_str .bc_interval ,
310+ wisun_settings_str .bc_dwell_interval );
311+
312+ if (status < 0 ) {
313+ tr_error ("Failed to set fhss configuration" );
314+ return ;
315+ }
316+ }
317+
257318 if (wisun_settings_str .regulatory_domain != WS_NA ||
258319 wisun_settings_str .rd_operating_class != WS_NA ||
259320 wisun_settings_str .rd_operating_mode != WS_NA ) {
0 commit comments