Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
net_thread_test.h
00001 /* 00002 * Copyright (c) 2014-2015 ARM Limited. All rights reserved. 00003 * 00004 * SPDX-License-Identifier: LicenseRef-PBL 00005 * 00006 * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * https://www.mbed.com/licenses/PBL-1.0 00010 * 00011 * See the License for the specific language governing permissions and limitations under the License. 00012 * 00013 */ 00014 /** 00015 * \file net_thread_test.h 00016 * \brief Thread Library Test API. 00017 * 00018 * \warning NOTICE! This is test API must not be used externally. 00019 * 00020 * \warning This file is not part of the version number control and can change any time. 00021 * 00022 */ 00023 00024 #ifndef NET_THREAD_TEST_H_ 00025 #define NET_THREAD_TEST_H_ 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 #include "ns_types.h" 00032 00033 00034 /** 00035 * \brief Add a static neighbour 00036 * 00037 * Test API: Add a neighbour. Adds, or updates, a non-expiring neighbour to the 00038 * Thread Link Set, and updates the Route Set accordingly. Basically equivalent 00039 * to receiving an MLE advertisement with a Route TLV, except it doesn't expire. 00040 * 00041 * See draft-kelsey-thread-routing-00 for more info on data format. 00042 * 00043 * \param interface_id Interface to modify 00044 * \param neighbour_addr Neighbour short address (must be a router address) 00045 * \param link_margin_db Notional link margin for reception from this neighbour. 00046 * \param id_sequence Sequence number for id_mask 00047 * \param id_mask Bit mask of router IDs 00048 * \param route_data One octet per set bit in id_mask 00049 * 00050 * \return 0 Success 00051 * \return <0 Failure 00052 */ 00053 int_fast8_t arm_nwk_6lowpan_thread_test_add_neighbour( 00054 int8_t interface_id, 00055 uint16_t neighbour_short_addr, 00056 uint_fast8_t link_margin_db, 00057 uint8_t id_sequence, 00058 const uint8_t *id_mask, 00059 const uint8_t *route_data); 00060 00061 /** 00062 * \brief API to set reed advertisement interval 00063 * \param interface_id Interface to modify 00064 * \param advertisement_interval Interval between advertisements to be set 00065 * \param jitter_interval Maximum value of random jitter interval to be added to advertisement_interval 00066 * \return 0 Success 00067 * \return < 0 Other errors 00068 */ 00069 int8_t thread_reed_set_advertisement_interval(int8_t interface_id, uint16_t advertisement_interval, uint16_t jitter_interval); 00070 00071 /** 00072 * \brief Remove a static neighbour 00073 * 00074 * Test API: Remove a neighbour. Remove a neighbour from the Thread Link Set 00075 * (whether added through arm_nwk_6lowpan_thread_test_add_neighbour, or 00076 * automatically through MLE). 00077 * 00078 * \param interface_id Interface to modify 00079 * \param neighbour_addr Neighbour short address (must be a router address) 00080 * 00081 * \return 0 Success 00082 * \return -1 Not an existing neighbour 00083 * \return <-1 Other errors 00084 */ 00085 int_fast8_t arm_nwk_6lowpan_thread_test_remove_neighbour( 00086 int8_t interface_id, 00087 uint16_t neighbour_short_addr); 00088 00089 /** 00090 * \brief Print routing database 00091 * 00092 * Test API: Dump the routing data base (Router ID Set, Link Set and Route 00093 * Set) to the debug channel. 00094 * 00095 * \param interface_id Interface to interrogate 00096 */ 00097 void arm_nwk_6lowpan_thread_test_print_routing_database(int8_t interface_id); 00098 00099 00100 /** 00101 * \brief Thread Leader max router ID limit set 00102 * 00103 * This function should use just for test purpose Thread define this by default to 32 00104 * 00105 * \param interface_id Network Interface 00106 * \param maxRouterLimit Min Accepted value is 1 and max 32 00107 * 00108 * return 0, Set OK 00109 * return <0 Set Fail 00110 */ 00111 int thread_test_max_accepted_router_id_limit_set( 00112 int8_t interface_id, 00113 uint8_t maxRouterLimit); 00114 00115 /** 00116 * \brief Set Thread network ID timeout 00117 * 00118 * \param interface_id Interface to modify 00119 * \param network_id_timeout network timeout as seconds 00120 * 00121 * \return 0 Success 00122 * \return -1 Invalid interface id 00123 * \return -2 Thread not active 00124 * \return -3 invalid timeout value 00125 */ 00126 int8_t thread_routing_set_network_id_timeout(int8_t interface_id, uint16_t network_id_timeout); 00127 00128 /** 00129 * \brief Get Thread network ID timeout 00130 * 00131 * \param interface_id Interface to modify 00132 * \param network_id_timeout pointer, where current network id timeout will be saved as seconds 00133 * 00134 * \return 0 Success 00135 * \return -1 Invalid interface id 00136 * \return -2 Thread not active 00137 * \return -3 invalid pointer 00138 */ 00139 int8_t thread_routing_get_network_id_timeout(int8_t interface_id, uint16_t *network_id_timeout); 00140 00141 /** 00142 * \brief Print Thread network data 00143 * 00144 * \param interface_id Network Interface 00145 * 00146 * \return 0, OK 00147 * \return <0 Not OK 00148 */ 00149 00150 int thread_test_print_network_data(int8_t interface_id); 00151 00152 /** 00153 * \brief Thread Leader Context ID reuse timeout set 00154 * 00155 * This function should be used to change default 48 hours to shorter one 00156 * 00157 * \param interface_id Network Interface 00158 * \param timeout Min Accepted value is 60 seconds and max 48 hours (48*3600) 00159 * 00160 * \return 0, Set OK 00161 * \return <0 Set Fail 00162 */ 00163 int thread_test_set_context_id_reuse_timeout( 00164 int8_t interface_id, 00165 uint32_t timeout); 00166 00167 /** 00168 * \brief Leader of Thread network can kick Router out from Network. 00169 * 00170 * \param interface_id Network Interface 00171 * \param routerId Routter id of router that is kicked 00172 * 00173 * \return 0, Remove OK 00174 * \return <0 Remove fail 00175 */ 00176 int thread_test_remove_router_by_id(int8_t interface_id, uint8_t routerId); 00177 /** 00178 * \brief Start router upgrade process. 00179 * 00180 * \param interface_id Network Interface 00181 * 00182 * \return 0, upgrade started 00183 * \return <0 fail 00184 */ 00185 int thread_test_router_upgrade(int8_t interface_id); 00186 /** 00187 * \brief Start router downgrade process. 00188 * 00189 * \param interface_id Network Interface 00190 * 00191 * \return 0, downgrade started 00192 * \return <0 fail 00193 */ 00194 int thread_test_router_downgrade(int8_t interface_id); 00195 00196 /** 00197 * \brief Set Thread Security Material. Terms are defined in Thread security specification 00198 * 00199 * \param interface_id Network Interface 00200 * \param enableSecurity Boolean for enable security or disable 00201 * \param thrMasterKey Master Key material which will be used for generating new key 00202 * \param thrKeySequenceCounter Periodic counter used to generate new MAC and MLE keys 00203 * \param thrKeyRotation Update period (in seconds) for thrKeySequenceCounter 00204 * 00205 * \return 0, ADD OK 00206 * \return <0 Add Not OK 00207 */ 00208 int thread_test_security_material_set(int8_t interface_id, bool enableSecurity, uint8_t *thrMasterKey, uint32_t thrKeySequenceCounter, uint32_t thrKeyRotation); 00209 00210 /** 00211 * \brief Set Thread version number. 00212 * 00213 * \param interface_id Network Interface 00214 * \param version "1 == Thread version 1.0" or "2 == Thread version 1.1" 00215 * 00216 * \return 0, OK 00217 * \return <0 Error 00218 */ 00219 int thread_test_version_set(int8_t interface_id, uint8_t version); 00220 /** 00221 * \brief Set Thread router selection jitter. 00222 * 00223 * \param interface_id Network Interface 00224 * \param value must be over 1 default is 120 00225 * 00226 * \return 0, OK 00227 * \return <0 Error 00228 */ 00229 int thread_test_router_selection_jitter_set(int8_t interface_id, uint32_t jitter); 00230 00231 /** 00232 * \brief Increment Thread key sequence counter 00233 * 00234 * \param interface_id Network Interface 00235 * 00236 * \return 0, OK 00237 * \return <0 Error 00238 */ 00239 int thread_test_increment_key_sequence_counter(int8_t interface_id); 00240 00241 /** 00242 * \brief Set new Thread key sequence counter 00243 * 00244 * Call define new key and next key same time 00245 * 00246 * \param interface_id Network Interface 00247 * \param thrKeySequenceCounter this need to be bigger than current sequence 00248 * 00249 * \return 0, OK 00250 * \return <0 Error 00251 */ 00252 int thread_test_key_sequence_counter_update(int8_t interface_id, uint32_t thrKeySequenceCounter); 00253 00254 /** 00255 * \brief Thread router select threshold values set 00256 * 00257 * \param interface_id Network Interface 00258 * \param upgradeThreshold Set REED up grade to router threshold 00259 * \param downgradeThreshold Set Router down grade to REED threshold 00260 * 00261 * \return 0, Set OK 00262 * \return <0 Set Fail 00263 */ 00264 int thread_test_router_select_threshold_values_set( 00265 int8_t interface_id, 00266 uint8_t upgradeThreshold, 00267 uint8_t downgradeThreshold); 00268 00269 /** 00270 * \brief Send PAN ID query message to destination 00271 * 00272 * \param interface_id Network Interface 00273 * 00274 * \return 0, Set OK 00275 * \return <0 Set Fail 00276 */ 00277 int thread_test_panid_query_send(int8_t interface_id, uint8_t *address_ptr, uint16_t session_id, uint16_t panid, uint8_t channel_page, uint8_t *mask_ptr); 00278 00279 /** 00280 * \brief Send energy scan message to destination 00281 * 00282 * \param interface_id Network Interface 00283 * 00284 * \return 0, Set OK 00285 * \return <0 Set Fail 00286 */ 00287 int thread_test_energy_scan_send(int8_t interface_id, uint8_t *address_ptr, uint16_t session_id, uint8_t channel_page, uint8_t *mask_ptr, uint16_t period, uint8_t count, uint16_t duration); 00288 00289 /** 00290 * \brief Send announcement message 00291 * 00292 * \param interface_id Network Interface 00293 * \param channel high uint16 is the channel page, lower part is the channel number on that page 00294 * 00295 * \return 0, Set OK 00296 * \return <0 Set Fail 00297 */ 00298 int thread_test_announce_ntf_send(int8_t interface_id, uint8_t *address_ptr, uint32_t channel, uint16_t panid, uint64_t timestamp); 00299 00300 /** 00301 * \brief Send energy scan message to destination 00302 * 00303 * \param interface_id Network Interface 00304 * 00305 * \return 0, Set OK 00306 * \return <0 Set Fail 00307 */ 00308 int thread_test_announce_begin_send(int8_t interface_id, uint8_t *address_ptr, uint16_t session_id, uint8_t channel_page, uint8_t *mask_ptr, uint16_t period, uint8_t count); 00309 00310 /** 00311 * \brief Get partition info 00312 * 00313 * \param interface_id Network Interface 00314 * \param partition_id Current partition id can be NULL if not needed. 00315 * \param weighting Current weighting can be NULL if not needed. 00316 * \param data_version Current data version can be NULL if not needed. 00317 * \param stable_data_version Current stable data version can be NULL if not needed. 00318 * \param leader_id Current leader id can be NULL if not needed. 00319 * 00320 * \return 0, Set OK 00321 * \return <0 Set Fail 00322 */ 00323 int thread_test_partition_info_get(int8_t interface_id, uint32_t *partition_id, uint8_t *weighting, uint8_t *data_version, uint8_t *stable_data_version, uint8_t *leader_id); 00324 00325 /** 00326 * \brief Set next partition ID when we next time partition. This is used to control specific behaviour in tests. 00327 * 00328 * \param interface_id Network Interface 00329 * 00330 * \return 0, Set OK 00331 * \return <0 Set Fail 00332 */ 00333 int thread_test_partition_info_set(int8_t interface_id, uint32_t partition_id); 00334 00335 /** 00336 * \brief Get child count 00337 * 00338 * \param interface_id Network Interface 00339 * 00340 * \return 0, Set OK 00341 * \return <0 Set Fail 00342 */ 00343 int8_t thread_test_child_count_get(int8_t interface_id); 00344 00345 /** 00346 * \brief Get child information 00347 * 00348 * get information for index child. if found returns 0 with correct information. 00349 * 00350 * \param interface_id Network Interface 00351 * 00352 * \return 0, OK 00353 * \return <0 Fail no child with this index found 00354 */ 00355 int8_t thread_test_child_info_get(int8_t interface_id, uint8_t index, uint16_t *short_addr, bool *sleepy, uint8_t *mac64, uint8_t *margin); 00356 00357 /** 00358 * \brief Get neighbour information 00359 * 00360 * \param interface_id Network Interface 00361 * 00362 * \return 0, Set OK 00363 * \return <0 Set Fail 00364 */ 00365 int8_t thread_test_neighbour_info_get(int8_t interface_id, uint8_t index, uint16_t *short_addr, uint8_t *mac64, uint8_t *margin); 00366 00367 typedef int (response_cb)(int8_t interface_id, uint8_t *response_ptr, uint16_t response_len); 00368 00369 /** 00370 * \brief Send diagnostic command 00371 * 00372 * \param interface_id Network Interface 00373 * \param address_ptr Address to which the command is sent 00374 * \param uri_ptr Uri for the command 00375 * \param request_length The length of the request 00376 * \param request_ptr Pointer to the beginning of the request contents 00377 * \param resp_cb Pointer to callback function that is called after the reply for the command is obtained 00378 * \return 0, Command send OK 00379 * \return <0 Command send Fail 00380 */ 00381 int thread_test_diagnostic_command_send(int8_t interface_id, uint8_t *address_ptr,const char *uri_ptr, uint8_t request_length, uint8_t *request_ptr, response_cb *resp_cb); 00382 00383 00384 /** 00385 * \brief Set initial SLAAC iid. 00386 * 00387 * \param interface_id Network Interface 00388 * \param iid Interface identifier pointer must be 8 bytes long buffer. can be NULL to disable. 00389 * \return 0, Command OK 00390 * \return <0 Command Fail 00391 */ 00392 int8_t thread_test_initial_slaac_iid_set(int8_t interface_id, uint8_t *iid); 00393 00394 #ifdef __cplusplus 00395 } 00396 #endif 00397 00398 #endif /* NET_THREAD_TEST_H_ */
Generated on Tue Jul 12 2022 12:28:45 by
1.7.2
