Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit ffd8517

Browse files
added a new thread management function (ARMmbed#1519)
to allow configuration of additional TLVs.
1 parent 80af9cb commit ffd8517

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

nanostack/thread_management_if.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,9 @@ typedef struct link_configuration {
7777
uint8_t extented_pan_id[8]; /**< Extended pan id*/
7878
uint8_t channel_mask[8]; /**< channel page and mask only supported is page 0*/
7979
uint8_t channel_page;/**< channel page supported pages 0*/
80-
char *PSKc_ptr; /**< Commissioning credentials. TODO! think if we need the actual credentials*/
81-
uint8_t PSKc_len; /**< Length of PSKc */
8280
uint16_t key_rotation; /**< Key rotation time in hours*/
8381
uint32_t key_sequence; /**< Key sequence counter */
8482
uint16_t panId; /**< network id*/
85-
uint8_t Protocol_id; /**< current protocol id*/
8683
uint8_t version; /**< current protocol version*/
8784
uint16_t rfChannel; /**< current rf channel*/
8885
uint8_t securityPolicy; /**< Commission Security Policy*/
@@ -200,6 +197,22 @@ link_configuration_s *thread_management_configuration_get(int8_t interface_id);
200197
*/
201198
int thread_management_link_configuration_store(int8_t interface_id, link_configuration_s *link_config);
202199

200+
/** Configure extra TLVs in nanostack .
201+
*
202+
* Storing is asynchronous operation and this method makes a request to store link
203+
* configuration settings. Operation will be completed in the background.
204+
* Once settings has been stored the Thread network will be restarted with new
205+
* configuration settings.
206+
*
207+
* /param interface Id of network interface. -1 if interface_id is not available.
208+
* /param additional_ptr Pointer to the extra TLV that is to be configured in nanostack
209+
* /param additional_len Length of the additional TLV
210+
*
211+
* /return 0 if store request is successful.
212+
* /return < 0 if request is failed.
213+
*/
214+
int thread_management_link_configuration_add(int8_t interface_id, uint8_t *additional_ptr, uint8_t additional_len);
215+
203216
/** Delete Thread network link configuration settings.
204217
*
205218
* Deletion is asynchronous operation and this method makes a request to delete link

source/6LoWPAN/Thread/thread_management_if.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,36 @@ int thread_management_link_configuration_store(int8_t interface_id, link_configu
10691069
#endif
10701070
}
10711071

1072+
int thread_management_link_configuration_add(int8_t interface_id, uint8_t *additional_ptr, uint8_t additional_len)
1073+
{
1074+
#ifdef HAVE_THREAD
1075+
if (interface_id < 0) {
1076+
return -1;
1077+
}
1078+
1079+
int ret = thread_joiner_application_update_configuration(interface_id, additional_ptr, additional_len, true);
1080+
if (ret != 0) {
1081+
return ret;
1082+
}
1083+
1084+
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
1085+
if (!cur || !cur->thread_info) {
1086+
return -2;
1087+
}
1088+
if ((cur->lowpan_info & INTERFACE_NWK_ACTIVE) != 0) {
1089+
// take new settings into use after restart
1090+
thread_bootstrap_reset_restart(interface_id);
1091+
}
1092+
1093+
return ret;
1094+
#else
1095+
(void) interface_id;
1096+
(void) additional_ptr;
1097+
(void) additional_len;
1098+
return -1;
1099+
#endif
1100+
}
1101+
10721102
int thread_management_link_configuration_delete(int8_t interface_id)
10731103
{
10741104
#ifdef HAVE_THREAD

0 commit comments

Comments
 (0)