File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,22 @@ int ws_management_node_init(
115
115
char * network_name_ptr ,
116
116
fhss_timer_t * fhss_timer_ptr );
117
117
118
+ /**
119
+ * Change the network name
120
+ *
121
+ * Change the network name dynamically at a runtime.
122
+ * If stack is running the network discovery is restarted.
123
+ *
124
+ * \param interface_id Network interface ID.
125
+ * \param network_name_ptr Nul terminated Network name limited to 32 characters.
126
+ *
127
+ * \return 0, Init OK.
128
+ * \return <0 Init fail.
129
+ */
130
+ int ws_management_network_name_set (
131
+ int8_t interface_id ,
132
+ char * network_name_ptr );
133
+
118
134
/**
119
135
* Configure regulatory domain of Wi-SUN stack.
120
136
*
Original file line number Diff line number Diff line change @@ -56,6 +56,32 @@ int ws_management_node_init(
56
56
return 0 ;
57
57
}
58
58
59
+ int ws_management_network_name_set (
60
+ int8_t interface_id ,
61
+ char * network_name_ptr )
62
+ {
63
+ protocol_interface_info_entry_t * cur ;
64
+ cur = protocol_stack_interface_info_get_by_id (interface_id );
65
+ if (!cur || !ws_info (cur )) {
66
+ return -1 ;
67
+ }
68
+ if (!network_name_ptr || strlen (network_name_ptr ) == 0 || strlen (network_name_ptr ) > 32 ) {
69
+ return -2 ;
70
+ }
71
+ if (strcmp (cur -> ws_info -> network_name , network_name_ptr ) == 0 ) {
72
+ // Network name is the same no further actions required.
73
+ return 0 ;
74
+ }
75
+ memset (cur -> ws_info -> network_name , 0 , 33 );
76
+ strncpy (cur -> ws_info -> network_name , network_name_ptr , 32 );
77
+ // if settings change reset_restart for the settings needed
78
+ if (cur -> lowpan_info & INTERFACE_NWK_ACTIVE ) {
79
+ // bootstrap active need to restart
80
+ ws_bootstrap_restart (interface_id );
81
+ }
82
+
83
+ return 0 ;
84
+ }
59
85
int ws_management_regulatory_domain_set (
60
86
int8_t interface_id ,
61
87
uint8_t regulatory_domain ,
You can’t perform that action at this time.
0 commit comments