1 /* 2 * Copyright (c) 2016, The OpenThread Authors. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 3. Neither the name of the copyright holder nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 /** 29 * @file 30 * This file contains definitions of spinel. 31 */ 32 33 #ifndef SPINEL_HEADER_INCLUDED 34 #define SPINEL_HEADER_INCLUDED 1 35 36 /* 37 * Spinel is a host-controller protocol designed to enable 38 * inter-operation over simple serial connections between general purpose 39 * device operating systems (OS) host and network co-processors (NCP) for 40 * the purpose of controlling and managing the NCP. 41 * 42 * --------------------------------------------------------------------------- 43 * 44 * Frame Format 45 * 46 * A frame is defined simply as the concatenation of 47 * 48 * - A header byte 49 * - A command (up to three bytes) 50 * - An optional command payload 51 * 52 * +---------+--------+-----+-------------+ 53 * | Octets: | 1 | 1-3 | n | 54 * +---------+--------+-----+-------------+ 55 * | Fields: | HEADER | CMD | CMD_PAYLOAD | 56 * +---------+--------+-----+-------------+ 57 * 58 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 59 * 60 * Header Format 61 * 62 * The header byte is broken down as follows: 63 * 64 * 0 1 2 3 4 5 6 7 65 * +---+---+---+---+---+---+---+---+ 66 * | FLG | IID | TID | 67 * +---+---+---+---+---+---+---+---+ 68 * 69 * 70 * The flag field of the header byte ("FLG") is always set to the value 71 * two (or "10" in binary). Any frame received with these bits set to 72 * any other value else MUST NOT be considered a Spinel frame. 73 * 74 * This convention allows Spinel to be line compatible with BTLE HCI. 75 * By defining the first two bit in this way we can disambiguate between 76 * Spinel frames and HCI frames (which always start with either "0x01" 77 * or "0x04") without any additional framing overhead. 78 * 79 * The Interface Identifier (IID) is a number between 0 and 3, which 80 * is associated by the OS with a specific NCP. This allows the protocol 81 * to support up to 4 NCPs under same connection. 82 * 83 * The least significant bits of the header represent the Transaction 84 * Identifier (TID). The TID is used for correlating responses to the 85 * commands which generated them. 86 * 87 * When a command is sent from the host, any reply to that command sent 88 * by the NCP will use the same value for the TID. When the host 89 * receives a frame that matches the TID of the command it sent, it can 90 * easily recognize that frame as the actual response to that command. 91 * 92 * The TID value of zero (0) is used for commands to which a correlated 93 * response is not expected or needed, such as for unsolicited update 94 * commands sent to the host from the NCP. 95 * 96 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 97 * 98 * The command identifier is a 21-bit unsigned integer encoded in up to 99 * three bytes using the packed unsigned integer format described below. 100 * Depending on the semantics of the command in question, a payload MAY 101 * be included in the frame. The exact composition and length of the 102 * payload is defined by the command identifier. 103 * 104 * --------------------------------------------------------------------------- 105 * 106 * Data Packing 107 * 108 * Data serialization for properties is performed using a light-weight 109 * data packing format which was loosely inspired by D-Bus. The format 110 * of a serialization is defined by a specially formatted string. 111 * 112 * This packing format is used for notational convenience. While this 113 * string-based data-type format has been designed so that the strings 114 * may be directly used by a structured data parser, such a thing is not 115 * required to implement Spinel. 116 * 117 * Goals: 118 * 119 * - Be lightweight and favor direct representation of values. 120 * - Use an easily readable and memorable format string. 121 * - Support lists and structures. 122 * - Allow properties to be appended to structures while maintaining 123 * backward compatibility. 124 * 125 * Each primitive data-type has an ASCII character associated with it. 126 * Structures can be represented as strings of these characters. For 127 * example: 128 * 129 * - "C": A single unsigned byte. 130 * - "C6U": A single unsigned byte, followed by a 128-bit IPv6 address, 131 * followed by a zero-terminated UTF8 string. 132 * - "A(6)": An array of concatenated IPv6 addresses 133 * 134 * In each case, the data is represented exactly as described. For 135 * example, an array of 10 IPv6 address is stored as 160 bytes. 136 * 137 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 138 * 139 * Primitive Types 140 * 141 * +----------+----------------------+---------------------------------+ 142 * | Char | Name | Description | 143 * +----------+----------------------+---------------------------------+ 144 * | "." | DATATYPE_VOID | Empty data type. Used | 145 * | | | internally. | 146 * | "b" | DATATYPE_BOOL | Boolean value. Encoded in | 147 * | | | 8-bits as either 0x00 or 0x01. | 148 * | | | All other values are illegal. | 149 * | "C" | DATATYPE_UINT8 | Unsigned 8-bit integer. | 150 * | "c" | DATATYPE_INT8 | Signed 8-bit integer. | 151 * | "S" | DATATYPE_UINT16 | Unsigned 16-bit integer. | 152 * | "s" | DATATYPE_INT16 | Signed 16-bit integer. | 153 * | "L" | DATATYPE_UINT32 | Unsigned 32-bit integer. | 154 * | "l" | DATATYPE_INT32 | Signed 32-bit integer. | 155 * | "i" | DATATYPE_UINT_PACKED | Packed Unsigned Integer. See | 156 * | | | description below | 157 * | "6" | DATATYPE_IPv6ADDR | IPv6 Address. (Big-endian) | 158 * | "E" | DATATYPE_EUI64 | EUI-64 Address. (Big-endian) | 159 * | "e" | DATATYPE_EUI48 | EUI-48 Address. (Big-endian) | 160 * | "D" | DATATYPE_DATA | Arbitrary data. See related | 161 * | | | section below for details. | 162 * | "d" | DATATYPE_DATA_WLEN | Arbitrary data with prepended | 163 * | | | length. See below for details | 164 * | "U" | DATATYPE_UTF8 | Zero-terminated UTF8-encoded | 165 * | | | string. | 166 * | "t(...)" | DATATYPE_STRUCT | Structured datatype with | 167 * | | | prepended length. | 168 * | "A(...)" | DATATYPE_ARRAY | Array of datatypes. Compound | 169 * | | | type. | 170 * +----------+----------------------+---------------------------------+ 171 * 172 * All multi-byte values are little-endian unless explicitly stated 173 * otherwise. 174 * 175 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176 * 177 * Packed Unsigned Integer 178 * 179 * For certain types of integers, such command or property identifiers, 180 * usually have a value on the wire that is less than 127. However, in 181 * order to not preclude the use of values larger than 255, we would 182 * need to add an extra byte. Doing this would add an extra byte to the 183 * majority of instances, which can add up in terms of bandwidth. 184 * 185 * The packed unsigned integer format is based on the unsigned integer 186 * format in EXI, except that we limit the maximum value to the 187 * largest value that can be encoded into three bytes (2,097,151). 188 * 189 * For all values less than 127, the packed form of the number is simply 190 * a single byte which directly represents the number. For values 191 * larger than 127, the following process is used to encode the value: 192 * 193 * 1. The unsigned integer is broken up into _n_ 7-bit chunks and 194 * placed into _n_ octets, leaving the most significant bit of each 195 * octet unused. 196 * 2. Order the octets from least-significant to most-significant. 197 * (Little-endian) 198 * 3. Clear the most significant bit of the most significant octet. 199 * Set the least significant bit on all other octets. 200 * 201 * Where `n` is the smallest number of 7-bit chunks you can use to 202 * represent the given value. 203 * 204 * Take the value 1337, for example: 205 * 206 * 1337 => 0x0539 207 * => [39 0A] 208 * => [B9 0A] 209 * 210 * To decode the value, you collect the 7-bit chunks until you find an 211 * octet with the most significant bit clear. 212 * 213 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 214 * 215 * Data Blobs 216 * 217 * There are two types for data blobs: "d" and "D". 218 * 219 * - "d" has the length of the data (in bytes) prepended to the data 220 * (with the length encoded as type "S"). The size of the length 221 * field is not included in the length. 222 * - "D" does not have a prepended length: the length of the data is 223 * implied by the bytes remaining to be parsed. It is an error for 224 * "D" to not be the last type in a type in a type signature. 225 * 226 * This dichotomy allows for more efficient encoding by eliminating 227 * redundancy. If the rest of the buffer is a data blob, encoding the 228 * length would be redundant because we already know how many bytes are 229 * in the rest of the buffer. 230 * 231 * In some cases we use "d" even if it is the last field in a type 232 * signature. We do this to allow for us to be able to append 233 * additional fields to the type signature if necessary in the future. 234 * This is usually the case with embedded structs, like in the scan 235 * results. 236 * 237 * For example, let's say we have a buffer that is encoded with the 238 * datatype signature of "CLLD". In this case, it is pretty easy to 239 * tell where the start and end of the data blob is: the start is 9 240 * bytes from the start of the buffer, and its length is the length of 241 * the buffer minus 9. (9 is the number of bytes taken up by a byte and 242 * two longs) 243 * 244 * The datatype signature "CLLDU" is illegal because we can't determine 245 * where the last field (a zero-terminated UTF8 string) starts. But the 246 * datatype "CLLdU" is legal, because the parser can determine the 247 * exact length of the data blob-- allowing it to know where the start 248 * of the next field would be. 249 * 250 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 251 * 252 * Structured Data 253 * 254 * The structure data type ("t(...)") is a way of bundling together 255 * several fields into a single structure. It can be thought of as a 256 * "d" type except that instead of being opaque, the fields in the 257 * content are known. This is useful for things like scan results where 258 * you have substructures which are defined by different layers. 259 * 260 * For example, consider the type signature "Lt(ES)t(6C)". In this 261 * hypothetical case, the first struct is defined by the MAC layer, and 262 * the second struct is defined by the PHY layer. Because of the use of 263 * structures, we know exactly what part comes from that layer. 264 * Additionally, we can add fields to each structure without introducing 265 * backward compatability problems: Data encoded as "Lt(ESU)t(6C)" 266 * (Notice the extra "U") will decode just fine as "Lt(ES)t(6C)". 267 * Additionally, if we don't care about the MAC layer and only care 268 * about the network layer, we could parse as "Lt()t(6C)". 269 * 270 * Note that data encoded as "Lt(ES)t(6C)" will also parse as "Ldd", 271 * with the structures from both layers now being opaque data blobs. 272 * 273 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 274 * 275 * Arrays 276 * 277 * An array is simply a concatenated set of _n_ data encodings. For 278 * example, the type "A(6)" is simply a list of IPv6 addresses---one 279 * after the other. The type "A(6E)" likewise a concatenation of IPv6- 280 * address/EUI-64 pairs. 281 * 282 * If an array contains many fields, the fields will often be surrounded 283 * by a structure ("t(...)"). This effectively prepends each item in 284 * the array with its length. This is useful for improving parsing 285 * performance or to allow additional fields to be added in the future 286 * in a backward compatible way. If there is a high certainty that 287 * additional fields will never be added, the struct may be omitted 288 * (saving two bytes per item). 289 * 290 * This specification does not define a way to embed an array as a field 291 * alongside other fields. 292 * 293 * --------------------------------------------------------------------------- 294 * 295 * Spinel definition guideline: 296 * 297 * New NCP firmware should work with an older host driver, i.e., NCP 298 * implementation should remain backward compatible. 299 * 300 * - Existing fields in the format of an already implemented spinel 301 * property or command cannot change. 302 * 303 * - New fields may be appended at the end of the format (or the end of 304 * a struct) as long as the NCP implementation treats the new fields as 305 * optional (i.e., a driver not aware of and therefore not using the 306 * new fields should continue to function as before). 307 * 308 * --------------------------------------------------------------------------- 309 */ 310 311 #ifdef SPINEL_PLATFORM_HEADER 312 #include SPINEL_PLATFORM_HEADER 313 #else // ifdef SPINEL_PLATFORM_HEADER 314 #include <stdarg.h> 315 #include <stdbool.h> 316 #include <stdint.h> 317 #endif // else SPINEL_PLATFORM_HEADER 318 319 // ---------------------------------------------------------------------------- 320 321 #ifndef DOXYGEN_SHOULD_SKIP_THIS 322 323 #if defined(__GNUC__) 324 #define SPINEL_API_EXTERN extern __attribute__((visibility("default"))) 325 #define SPINEL_API_NONNULL_ALL __attribute__((nonnull)) 326 #define SPINEL_API_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 327 #endif // ifdef __GNUC__ 328 329 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS 330 331 #ifndef SPINEL_API_EXTERN 332 #define SPINEL_API_EXTERN extern 333 #endif 334 335 #ifndef SPINEL_API_NONNULL_ALL 336 #define SPINEL_API_NONNULL_ALL 337 #endif 338 339 #ifndef SPINEL_API_WARN_UNUSED_RESULT 340 #define SPINEL_API_WARN_UNUSED_RESULT 341 #endif 342 343 // ---------------------------------------------------------------------------- 344 345 #define SPINEL_PROTOCOL_VERSION_THREAD_MAJOR 4 346 #define SPINEL_PROTOCOL_VERSION_THREAD_MINOR 3 347 348 /** 349 * @def SPINEL_FRAME_MAX_SIZE 350 * 351 * The maximum size of SPINEL frame. 352 * 353 */ 354 #define SPINEL_FRAME_MAX_SIZE 1300 355 356 /** 357 * @def SPINEL_FRAME_MAX_COMMAND_HEADER_SIZE 358 * 359 * The maximum size of SPINEL command header. 360 * 361 */ 362 #define SPINEL_FRAME_MAX_COMMAND_HEADER_SIZE 4 363 364 /** 365 * @def SPINEL_FRAME_MAX_PAYLOAD_SIZE 366 * 367 * The maximum size of SPINEL command payload. 368 * 369 */ 370 #define SPINEL_FRAME_MAX_COMMAND_PAYLOAD_SIZE (SPINEL_FRAME_MAX_SIZE - SPINEL_FRAME_MAX_COMMAND_HEADER_SIZE) 371 372 /** 373 * @def SPINEL_ENCRYPTER_EXTRA_DATA_SIZE 374 * 375 * The size of extra data to be allocated for spinel frame buffer, 376 * needed by Spinel Encrypter. 377 * 378 */ 379 #define SPINEL_ENCRYPTER_EXTRA_DATA_SIZE 0 380 381 /** 382 * @def SPINEL_FRAME_BUFFER_SIZE 383 * 384 * The size of buffer large enough to fit one whole spinel frame with extra data 385 * needed by Spinel Encrypter. 386 * 387 */ 388 #define SPINEL_FRAME_BUFFER_SIZE (SPINEL_FRAME_MAX_SIZE + SPINEL_ENCRYPTER_EXTRA_DATA_SIZE) 389 390 /// Macro for generating bit masks using bit index from the spec 391 #define SPINEL_BIT_MASK(bit_index, field_bit_count) ((1 << ((field_bit_count)-1)) >> (bit_index)) 392 393 // ---------------------------------------------------------------------------- 394 395 #if defined(__cplusplus) 396 extern "C" { 397 #endif 398 399 enum 400 { 401 SPINEL_STATUS_OK = 0, ///< Operation has completed successfully. 402 SPINEL_STATUS_FAILURE = 1, ///< Operation has failed for some undefined reason. 403 SPINEL_STATUS_UNIMPLEMENTED = 2, ///< Given operation has not been implemented. 404 SPINEL_STATUS_INVALID_ARGUMENT = 3, ///< An argument to the operation is invalid. 405 SPINEL_STATUS_INVALID_STATE = 4, ///< This operation is invalid for the current device state. 406 SPINEL_STATUS_INVALID_COMMAND = 5, ///< This command is not recognized. 407 SPINEL_STATUS_INVALID_INTERFACE = 6, ///< This interface is not supported. 408 SPINEL_STATUS_INTERNAL_ERROR = 7, ///< An internal runtime error has occurred. 409 SPINEL_STATUS_SECURITY_ERROR = 8, ///< A security/authentication error has occurred. 410 SPINEL_STATUS_PARSE_ERROR = 9, ///< A error has occurred while parsing the command. 411 SPINEL_STATUS_IN_PROGRESS = 10, ///< This operation is in progress. 412 SPINEL_STATUS_NOMEM = 11, ///< Operation prevented due to memory pressure. 413 SPINEL_STATUS_BUSY = 12, ///< The device is currently performing a mutually exclusive operation 414 SPINEL_STATUS_PROP_NOT_FOUND = 13, ///< The given property is not recognized. 415 SPINEL_STATUS_DROPPED = 14, ///< A/The packet was dropped. 416 SPINEL_STATUS_EMPTY = 15, ///< The result of the operation is empty. 417 SPINEL_STATUS_CMD_TOO_BIG = 16, ///< The command was too large to fit in the internal buffer. 418 SPINEL_STATUS_NO_ACK = 17, ///< The packet was not acknowledged. 419 SPINEL_STATUS_CCA_FAILURE = 18, ///< The packet was not sent due to a CCA failure. 420 SPINEL_STATUS_ALREADY = 19, ///< The operation is already in progress. 421 SPINEL_STATUS_ITEM_NOT_FOUND = 20, ///< The given item could not be found. 422 SPINEL_STATUS_INVALID_COMMAND_FOR_PROP = 21, ///< The given command cannot be performed on this property. 423 424 SPINEL_STATUS_JOIN__BEGIN = 104, 425 426 /// Generic failure to associate with other peers. 427 /** 428 * This status error should not be used by implementors if 429 * enough information is available to determine that one of the 430 * later join failure status codes would be more accurate. 431 * 432 * \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING 433 * \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING 434 */ 435 SPINEL_STATUS_JOIN_FAILURE = SPINEL_STATUS_JOIN__BEGIN + 0, 436 437 /// The node found other peers but was unable to decode their packets. 438 /** 439 * Typically this error code indicates that the network 440 * key has been set incorrectly. 441 * 442 * \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING 443 * \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING 444 */ 445 SPINEL_STATUS_JOIN_SECURITY = SPINEL_STATUS_JOIN__BEGIN + 1, 446 447 /// The node was unable to find any other peers on the network. 448 /** 449 * \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING 450 * \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING 451 */ 452 SPINEL_STATUS_JOIN_NO_PEERS = SPINEL_STATUS_JOIN__BEGIN + 2, 453 454 /// The only potential peer nodes found are incompatible. 455 /** 456 * \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING 457 */ 458 SPINEL_STATUS_JOIN_INCOMPATIBLE = SPINEL_STATUS_JOIN__BEGIN + 3, 459 460 /// No response in expecting time. 461 /** 462 * \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING 463 */ 464 SPINEL_STATUS_JOIN_RSP_TIMEOUT = SPINEL_STATUS_JOIN__BEGIN + 4, 465 466 /// The node succeeds in commissioning and get the network credentials. 467 /** 468 * \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING 469 */ 470 SPINEL_STATUS_JOIN_SUCCESS = SPINEL_STATUS_JOIN__BEGIN + 5, 471 472 SPINEL_STATUS_JOIN__END = 112, 473 474 SPINEL_STATUS_RESET__BEGIN = 112, 475 SPINEL_STATUS_RESET_POWER_ON = SPINEL_STATUS_RESET__BEGIN + 0, 476 SPINEL_STATUS_RESET_EXTERNAL = SPINEL_STATUS_RESET__BEGIN + 1, 477 SPINEL_STATUS_RESET_SOFTWARE = SPINEL_STATUS_RESET__BEGIN + 2, 478 SPINEL_STATUS_RESET_FAULT = SPINEL_STATUS_RESET__BEGIN + 3, 479 SPINEL_STATUS_RESET_CRASH = SPINEL_STATUS_RESET__BEGIN + 4, 480 SPINEL_STATUS_RESET_ASSERT = SPINEL_STATUS_RESET__BEGIN + 5, 481 SPINEL_STATUS_RESET_OTHER = SPINEL_STATUS_RESET__BEGIN + 6, 482 SPINEL_STATUS_RESET_UNKNOWN = SPINEL_STATUS_RESET__BEGIN + 7, 483 SPINEL_STATUS_RESET_WATCHDOG = SPINEL_STATUS_RESET__BEGIN + 8, 484 SPINEL_STATUS_RESET__END = 128, 485 486 SPINEL_STATUS_VENDOR__BEGIN = 15360, 487 SPINEL_STATUS_VENDOR__END = 16384, 488 489 SPINEL_STATUS_STACK_NATIVE__BEGIN = 16384, 490 SPINEL_STATUS_STACK_NATIVE__END = 81920, 491 492 SPINEL_STATUS_EXPERIMENTAL__BEGIN = 2000000, 493 SPINEL_STATUS_EXPERIMENTAL__END = 2097152, 494 }; 495 496 typedef uint32_t spinel_status_t; 497 498 typedef enum 499 { 500 SPINEL_NET_ROLE_DETACHED = 0, 501 SPINEL_NET_ROLE_CHILD = 1, 502 SPINEL_NET_ROLE_ROUTER = 2, 503 SPINEL_NET_ROLE_LEADER = 3, 504 } spinel_net_role_t; 505 506 typedef enum 507 { 508 SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED = 0, 509 SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY = 1, 510 SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY = 2, 511 SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL = 3, 512 } spinel_ipv6_icmp_ping_offload_mode_t; 513 514 typedef enum 515 { 516 SPINEL_SCAN_STATE_IDLE = 0, 517 SPINEL_SCAN_STATE_BEACON = 1, 518 SPINEL_SCAN_STATE_ENERGY = 2, 519 SPINEL_SCAN_STATE_DISCOVER = 3, 520 } spinel_scan_state_t; 521 522 typedef enum 523 { 524 SPINEL_MCU_POWER_STATE_ON = 0, 525 SPINEL_MCU_POWER_STATE_LOW_POWER = 1, 526 SPINEL_MCU_POWER_STATE_OFF = 2, 527 } spinel_mcu_power_state_t; 528 529 // The `spinel_power_state_t` enumeration and `POWER_STATE` 530 // property are deprecated. Please use `MCU_POWER_STATE` 531 // instead. 532 typedef enum 533 { 534 SPINEL_POWER_STATE_OFFLINE = 0, 535 SPINEL_POWER_STATE_DEEP_SLEEP = 1, 536 SPINEL_POWER_STATE_STANDBY = 2, 537 SPINEL_POWER_STATE_LOW_POWER = 3, 538 SPINEL_POWER_STATE_ONLINE = 4, 539 } spinel_power_state_t; 540 541 typedef enum 542 { 543 SPINEL_HOST_POWER_STATE_OFFLINE = 0, 544 SPINEL_HOST_POWER_STATE_DEEP_SLEEP = 1, 545 SPINEL_HOST_POWER_STATE_RESERVED = 2, 546 SPINEL_HOST_POWER_STATE_LOW_POWER = 3, 547 SPINEL_HOST_POWER_STATE_ONLINE = 4, 548 } spinel_host_power_state_t; 549 550 typedef enum 551 { 552 SPINEL_MESHCOP_JOINER_STATE_IDLE = 0, 553 SPINEL_MESHCOP_JOINER_STATE_DISCOVER = 1, 554 SPINEL_MESHCOP_JOINER_STATE_CONNECTING = 2, 555 SPINEL_MESHCOP_JOINER_STATE_CONNECTED = 3, 556 SPINEL_MESHCOP_JOINER_STATE_ENTRUST = 4, 557 SPINEL_MESHCOP_JOINER_STATE_JOINED = 5, 558 } spinel_meshcop_joiner_state_t; 559 560 enum 561 { 562 SPINEL_NET_FLAG_ON_MESH = (1 << 0), 563 SPINEL_NET_FLAG_DEFAULT_ROUTE = (1 << 1), 564 SPINEL_NET_FLAG_CONFIGURE = (1 << 2), 565 SPINEL_NET_FLAG_DHCP = (1 << 3), 566 SPINEL_NET_FLAG_SLAAC = (1 << 4), 567 SPINEL_NET_FLAG_PREFERRED = (1 << 5), 568 569 SPINEL_NET_FLAG_PREFERENCE_OFFSET = 6, 570 SPINEL_NET_FLAG_PREFERENCE_MASK = (3 << SPINEL_NET_FLAG_PREFERENCE_OFFSET), 571 }; 572 573 enum 574 { 575 SPINEL_ROUTE_PREFERENCE_HIGH = (1 << SPINEL_NET_FLAG_PREFERENCE_OFFSET), 576 SPINEL_ROUTE_PREFERENCE_MEDIUM = (0 << SPINEL_NET_FLAG_PREFERENCE_OFFSET), 577 SPINEL_ROUTE_PREFERENCE_LOW = (3 << SPINEL_NET_FLAG_PREFERENCE_OFFSET), 578 }; 579 580 enum 581 { 582 SPINEL_THREAD_MODE_FULL_NETWORK_DATA = (1 << 0), 583 SPINEL_THREAD_MODE_FULL_THREAD_DEV = (1 << 1), 584 SPINEL_THREAD_MODE_SECURE_DATA_REQUEST = (1 << 2), 585 SPINEL_THREAD_MODE_RX_ON_WHEN_IDLE = (1 << 3), 586 }; 587 588 enum 589 { 590 SPINEL_GPIO_FLAG_DIR_INPUT = 0, 591 SPINEL_GPIO_FLAG_DIR_OUTPUT = SPINEL_BIT_MASK(0, 8), 592 SPINEL_GPIO_FLAG_PULL_UP = SPINEL_BIT_MASK(1, 8), 593 SPINEL_GPIO_FLAG_PULL_DOWN = SPINEL_BIT_MASK(2, 8), 594 SPINEL_GPIO_FLAG_OPEN_DRAIN = SPINEL_BIT_MASK(2, 8), 595 SPINEL_GPIO_FLAG_TRIGGER_NONE = 0, 596 SPINEL_GPIO_FLAG_TRIGGER_RISING = SPINEL_BIT_MASK(3, 8), 597 SPINEL_GPIO_FLAG_TRIGGER_FALLING = SPINEL_BIT_MASK(4, 8), 598 SPINEL_GPIO_FLAG_TRIGGER_ANY = SPINEL_GPIO_FLAG_TRIGGER_RISING | SPINEL_GPIO_FLAG_TRIGGER_FALLING, 599 }; 600 601 enum 602 { 603 SPINEL_PROTOCOL_TYPE_BOOTLOADER = 0, 604 SPINEL_PROTOCOL_TYPE_ZIGBEE_IP = 2, 605 SPINEL_PROTOCOL_TYPE_THREAD = 3, 606 }; 607 608 enum 609 { 610 SPINEL_MAC_PROMISCUOUS_MODE_OFF = 0, ///< Normal MAC filtering is in place. 611 SPINEL_MAC_PROMISCUOUS_MODE_NETWORK = 1, ///< All MAC packets matching network are passed up the stack. 612 SPINEL_MAC_PROMISCUOUS_MODE_FULL = 2, ///< All decoded MAC packets are passed up the stack. 613 }; 614 615 enum 616 { 617 SPINEL_NCP_LOG_LEVEL_EMERG = 0, 618 SPINEL_NCP_LOG_LEVEL_ALERT = 1, 619 SPINEL_NCP_LOG_LEVEL_CRIT = 2, 620 SPINEL_NCP_LOG_LEVEL_ERR = 3, 621 SPINEL_NCP_LOG_LEVEL_WARN = 4, 622 SPINEL_NCP_LOG_LEVEL_NOTICE = 5, 623 SPINEL_NCP_LOG_LEVEL_INFO = 6, 624 SPINEL_NCP_LOG_LEVEL_DEBUG = 7, 625 }; 626 627 enum 628 { 629 SPINEL_NCP_LOG_REGION_NONE = 0, 630 SPINEL_NCP_LOG_REGION_OT_API = 1, 631 SPINEL_NCP_LOG_REGION_OT_MLE = 2, 632 SPINEL_NCP_LOG_REGION_OT_ARP = 3, 633 SPINEL_NCP_LOG_REGION_OT_NET_DATA = 4, 634 SPINEL_NCP_LOG_REGION_OT_ICMP = 5, 635 SPINEL_NCP_LOG_REGION_OT_IP6 = 6, 636 SPINEL_NCP_LOG_REGION_OT_MAC = 7, 637 SPINEL_NCP_LOG_REGION_OT_MEM = 8, 638 SPINEL_NCP_LOG_REGION_OT_NCP = 9, 639 SPINEL_NCP_LOG_REGION_OT_MESH_COP = 10, 640 SPINEL_NCP_LOG_REGION_OT_NET_DIAG = 11, 641 SPINEL_NCP_LOG_REGION_OT_PLATFORM = 12, 642 SPINEL_NCP_LOG_REGION_OT_COAP = 13, 643 SPINEL_NCP_LOG_REGION_OT_CLI = 14, 644 SPINEL_NCP_LOG_REGION_OT_CORE = 15, 645 SPINEL_NCP_LOG_REGION_OT_UTIL = 16, 646 SPINEL_NCP_LOG_REGION_OT_BBR = 17, 647 }; 648 649 enum 650 { 651 SPINEL_MESHCOP_COMMISSIONER_STATE_DISABLED = 0, 652 SPINEL_MESHCOP_COMMISSIONER_STATE_PETITION = 1, 653 SPINEL_MESHCOP_COMMISSIONER_STATE_ACTIVE = 2, 654 }; 655 656 enum 657 { 658 SPINEL_ADDRESS_CACHE_ENTRY_STATE_CACHED = 0, // Entry is cached and in-use. 659 SPINEL_ADDRESS_CACHE_ENTRY_STATE_SNOOPED = 1, // Entry is created by snoop optimization. 660 SPINEL_ADDRESS_CACHE_ENTRY_STATE_QUERY = 2, // Entry represents an ongoing query for the EID. 661 SPINEL_ADDRESS_CACHE_ENTRY_STATE_RETRY_QUERY = 3, // Entry is in retry mode (a prior query did not a response). 662 }; 663 664 typedef struct 665 { 666 uint8_t bytes[8]; 667 } spinel_eui64_t; 668 669 typedef struct 670 { 671 uint8_t bytes[8]; 672 } spinel_net_xpanid_t; 673 674 typedef struct 675 { 676 uint8_t bytes[16]; 677 } spinel_net_pskc_t; 678 679 typedef struct 680 { 681 uint8_t bytes[6]; 682 } spinel_eui48_t; 683 684 typedef struct 685 { 686 uint8_t bytes[16]; 687 } spinel_ipv6addr_t; 688 689 typedef int spinel_ssize_t; 690 typedef unsigned int spinel_size_t; 691 typedef uint8_t spinel_tid_t; 692 693 enum 694 { 695 SPINEL_MD_FLAG_TX = 0x0001, //!< Packet was transmitted, not received. 696 SPINEL_MD_FLAG_BAD_FCS = 0x0004, //!< Packet was received with bad FCS 697 SPINEL_MD_FLAG_DUPE = 0x0008, //!< Packet seems to be a duplicate 698 SPINEL_MD_FLAG_ACKED_FP = 0x0010, //!< Packet was acknowledged with frame pending set 699 SPINEL_MD_FLAG_ACKED_SEC = 0x0020, //!< Packet was acknowledged with secure enhance ACK 700 SPINEL_MD_FLAG_RESERVED = 0xFFC2, //!< Flags reserved for future use. 701 }; 702 703 enum 704 { 705 /** 706 * No-Operation command (Host -> NCP) 707 * 708 * Encoding: Empty 709 * 710 * Induces the NCP to send a success status back to the host. This is 711 * primarily used for liveliness checks. The command payload for this 712 * command SHOULD be empty. 713 * 714 * There is no error condition for this command. 715 * 716 */ 717 SPINEL_CMD_NOOP = 0, 718 719 /** 720 * Reset NCP command (Host -> NCP) 721 * 722 * Encoding: Empty 723 * 724 * Causes the NCP to perform a software reset. Due to the nature of 725 * this command, the TID is ignored. The host should instead wait 726 * for a `CMD_PROP_VALUE_IS` command from the NCP indicating 727 * `PROP_LAST_STATUS` has been set to `STATUS_RESET_SOFTWARE`. 728 * 729 * The command payload for this command SHOULD be empty. 730 * 731 * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted 732 * instead with the value set to the generated status code for the error. 733 * 734 */ 735 SPINEL_CMD_RESET = 1, 736 737 /** 738 * Get property value command (Host -> NCP) 739 * 740 * Encoding: `i` 741 * `i` : Property Id 742 * 743 * Causes the NCP to emit a `CMD_PROP_VALUE_IS` command for the 744 * given property identifier. 745 * 746 * The payload for this command is the property identifier encoded 747 * in the packed unsigned integer format `i`. 748 * 749 * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted 750 * instead with the value set to the generated status code for the error. 751 * 752 */ 753 SPINEL_CMD_PROP_VALUE_GET = 2, 754 755 /** 756 * Set property value command (Host -> NCP) 757 * 758 * Encoding: `iD` 759 * `i` : Property Id 760 * `D` : Value (encoding depends on the property) 761 * 762 * Instructs the NCP to set the given property to the specific given 763 * value, replacing any previous value. 764 * 765 * The payload for this command is the property identifier encoded in the 766 * packed unsigned integer format, followed by the property value. The 767 * exact format of the property value is defined by the property. 768 * 769 * On success a `CMD_PROP_VALUE_IS` command is emitted either for the 770 * given property identifier with the set value, or for `PROP_LAST_STATUS` 771 * with value `LAST_STATUS_OK`. 772 * 773 * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted 774 * with the value set to the generated status code for the error. 775 * 776 */ 777 SPINEL_CMD_PROP_VALUE_SET = 3, 778 779 /** 780 * Insert value into property command (Host -> NCP) 781 * 782 * Encoding: `iD` 783 * `i` : Property Id 784 * `D` : Value (encoding depends on the property) 785 * 786 * Instructs the NCP to insert the given value into a list-oriented 787 * property without removing other items in the list. The resulting order 788 * of items in the list is defined by the individual property being 789 * operated on. 790 * 791 * The payload for this command is the property identifier encoded in the 792 * packed unsigned integer format, followed by the value to be inserted. 793 * The exact format of the value is defined by the property. 794 * 795 * If the type signature of the property consists of a single structure 796 * enclosed by an array `A(t(...))`, then the contents of value MUST 797 * contain the contents of the structure (`...`) rather than the 798 * serialization of the whole item (`t(...)`). Specifically, the length 799 * of the structure MUST NOT be prepended to value. This helps to 800 * eliminate redundant data. 801 * 802 * On success, either a `CMD_PROP_VALUE_INSERTED` command is emitted for 803 * the given property, or a `CMD_PROP_VALUE_IS` command is emitted of 804 * property `PROP_LAST_STATUS` with value `LAST_STATUS_OK`. 805 * 806 * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted 807 * with the value set to the generated status code for the error. 808 * 809 */ 810 SPINEL_CMD_PROP_VALUE_INSERT = 4, 811 812 /** 813 * Remove value from property command (Host -> NCP) 814 * 815 * Encoding: `iD` 816 * `i` : Property Id 817 * `D` : Value (encoding depends on the property) 818 819 * Instructs the NCP to remove the given value from a list-oriented property, 820 * without affecting other items in the list. The resulting order of items 821 * in the list is defined by the individual property being operated on. 822 * 823 * Note that this command operates by value, not by index! 824 * 825 * The payload for this command is the property identifier encoded in the 826 * packed unsigned integer format, followed by the value to be removed. The 827 * exact format of the value is defined by the property. 828 * 829 * If the type signature of the property consists of a single structure 830 * enclosed by an array `A(t(...))`, then the contents of value MUST contain 831 * the contents of the structure (`...`) rather than the serialization of the 832 * whole item (`t(...)`). Specifically, the length of the structure MUST NOT 833 * be prepended to `VALUE`. This helps to eliminate redundant data. 834 * 835 * On success, either a `CMD_PROP_VALUE_REMOVED` command is emitted for the 836 * given property, or a `CMD_PROP_VALUE_IS` command is emitted of property 837 * `PROP_LAST_STATUS` with value `LAST_STATUS_OK`. 838 * 839 * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted 840 * with the value set to the generated status code for the error. 841 * 842 */ 843 SPINEL_CMD_PROP_VALUE_REMOVE = 5, 844 845 /** 846 * Property value notification command (NCP -> Host) 847 * 848 * Encoding: `iD` 849 * `i` : Property Id 850 * `D` : Value (encoding depends on the property) 851 * 852 * This command can be sent by the NCP in response to a previous command 853 * from the host, or it can be sent by the NCP in an unsolicited fashion 854 * to notify the host of various state changes asynchronously. 855 * 856 * The payload for this command is the property identifier encoded in the 857 * packed unsigned integer format, followed by the current value of the 858 * given property. 859 * 860 */ 861 SPINEL_CMD_PROP_VALUE_IS = 6, 862 863 /** 864 * Property value insertion notification command (NCP -> Host) 865 * 866 * Encoding:`iD` 867 * `i` : Property Id 868 * `D` : Value (encoding depends on the property) 869 * 870 * This command can be sent by the NCP in response to the 871 * `CMD_PROP_VALUE_INSERT` command, or it can be sent by the NCP in an 872 * unsolicited fashion to notify the host of various state changes 873 * asynchronously. 874 * 875 * The payload for this command is the property identifier encoded in the 876 * packed unsigned integer format, followed by the value that was inserted 877 * into the given property. 878 * 879 * If the type signature of the property specified by property id consists 880 * of a single structure enclosed by an array (`A(t(...))`), then the 881 * contents of value MUST contain the contents of the structure (`...`) 882 * rather than the serialization of the whole item (`t(...)`). Specifically, 883 * the length of the structure MUST NOT be prepended to `VALUE`. This 884 * helps to eliminate redundant data. 885 * 886 * The resulting order of items in the list is defined by the given 887 * property. 888 * 889 */ 890 SPINEL_CMD_PROP_VALUE_INSERTED = 7, 891 892 /** 893 * Property value removal notification command (NCP -> Host) 894 * 895 * Encoding: `iD` 896 * `i` : Property Id 897 * `D` : Value (encoding depends on the property) 898 * 899 * This command can be sent by the NCP in response to the 900 * `CMD_PROP_VALUE_REMOVE` command, or it can be sent by the NCP in an 901 * unsolicited fashion to notify the host of various state changes 902 * asynchronously. 903 * 904 * Note that this command operates by value, not by index! 905 * 906 * The payload for this command is the property identifier encoded in the 907 * packed unsigned integer format described in followed by the value that 908 * was removed from the given property. 909 * 910 * If the type signature of the property specified by property id consists 911 * of a single structure enclosed by an array (`A(t(...))`), then the 912 * contents of value MUST contain the contents of the structure (`...`) 913 * rather than the serialization of the whole item (`t(...)`). Specifically, 914 * the length of the structure MUST NOT be prepended to `VALUE`. This 915 * helps to eliminate redundant data. 916 * 917 * The resulting order of items in the list is defined by the given 918 * property. 919 * 920 */ 921 SPINEL_CMD_PROP_VALUE_REMOVED = 8, 922 923 SPINEL_CMD_NET_SAVE = 9, // Deprecated 924 925 /** 926 * Clear saved network settings command (Host -> NCP) 927 * 928 * Encoding: Empty 929 * 930 * Erases all network credentials and state from non-volatile memory. 931 * 932 * This operation affects non-volatile memory only. The current network 933 * information stored in volatile memory is unaffected. 934 * 935 * The response to this command is always a `CMD_PROP_VALUE_IS` for 936 * `PROP_LAST_STATUS`, indicating the result of the operation. 937 * 938 */ 939 SPINEL_CMD_NET_CLEAR = 10, 940 941 SPINEL_CMD_NET_RECALL = 11, // Deprecated 942 943 /** 944 * Host buffer offload is an optional NCP capability that, when 945 * present, allows the NCP to store data buffers on the host processor 946 * that can be recalled at a later time. 947 * 948 * The presence of this feature can be detected by the host by 949 * checking for the presence of the `CAP_HBO` 950 * capability in `PROP_CAPS`. 951 * 952 * This feature is not currently supported on OpenThread. 953 * 954 */ 955 956 SPINEL_CMD_HBO_OFFLOAD = 12, 957 SPINEL_CMD_HBO_RECLAIM = 13, 958 SPINEL_CMD_HBO_DROP = 14, 959 SPINEL_CMD_HBO_OFFLOADED = 15, 960 SPINEL_CMD_HBO_RECLAIMED = 16, 961 SPINEL_CMD_HBO_DROPPED = 17, 962 963 /** 964 * Peek command (Host -> NCP) 965 * 966 * Encoding: `LU` 967 * `L` : The address to peek 968 * `U` : Number of bytes to read 969 * 970 * This command allows the NCP to fetch values from the RAM of the NCP 971 * for debugging purposes. Upon success, `CMD_PEEK_RET` is sent from the 972 * NCP to the host. Upon failure, `PROP_LAST_STATUS` is emitted with 973 * the appropriate error indication. 974 * 975 * The NCP MAY prevent certain regions of memory from being accessed. 976 * 977 * This command requires the capability `CAP_PEEK_POKE` to be present. 978 * 979 */ 980 SPINEL_CMD_PEEK = 18, 981 982 /** 983 * Peek return command (NCP -> Host) 984 * 985 * Encoding: `LUD` 986 * `L` : The address peeked 987 * `U` : Number of bytes read 988 * `D` : Memory content 989 * 990 * This command contains the contents of memory that was requested by 991 * a previous call to `CMD_PEEK`. 992 * 993 * This command requires the capability `CAP_PEEK_POKE` to be present. 994 * 995 */ 996 SPINEL_CMD_PEEK_RET = 19, 997 998 /** 999 * Poke command (Host -> NCP) 1000 * 1001 * Encoding: `LUD` 1002 * `L` : The address to be poked 1003 * `U` : Number of bytes to write 1004 * `D` : Content to write 1005 * 1006 * This command writes the bytes to the specified memory address 1007 * for debugging purposes. 1008 * 1009 * This command requires the capability `CAP_PEEK_POKE` to be present. 1010 * 1011 */ 1012 SPINEL_CMD_POKE = 20, 1013 1014 SPINEL_CMD_PROP_VALUE_MULTI_GET = 21, 1015 SPINEL_CMD_PROP_VALUE_MULTI_SET = 22, 1016 SPINEL_CMD_PROP_VALUES_ARE = 23, 1017 1018 SPINEL_CMD_NEST__BEGIN = 15296, 1019 SPINEL_CMD_NEST__END = 15360, 1020 1021 SPINEL_CMD_VENDOR__BEGIN = 15360, 1022 SPINEL_CMD_VENDOR__END = 16384, 1023 1024 SPINEL_CMD_EXPERIMENTAL__BEGIN = 2000000, 1025 SPINEL_CMD_EXPERIMENTAL__END = 2097152, 1026 }; 1027 1028 typedef uint32_t spinel_command_t; 1029 1030 enum 1031 { 1032 SPINEL_CAP_LOCK = 1, 1033 SPINEL_CAP_NET_SAVE = 2, 1034 SPINEL_CAP_HBO = 3, 1035 SPINEL_CAP_POWER_SAVE = 4, 1036 1037 SPINEL_CAP_COUNTERS = 5, 1038 SPINEL_CAP_JAM_DETECT = 6, 1039 1040 SPINEL_CAP_PEEK_POKE = 7, 1041 1042 SPINEL_CAP_WRITABLE_RAW_STREAM = 8, 1043 SPINEL_CAP_GPIO = 9, 1044 SPINEL_CAP_TRNG = 10, 1045 SPINEL_CAP_CMD_MULTI = 11, 1046 SPINEL_CAP_UNSOL_UPDATE_FILTER = 12, 1047 SPINEL_CAP_MCU_POWER_STATE = 13, 1048 SPINEL_CAP_PCAP = 14, 1049 1050 SPINEL_CAP_802_15_4__BEGIN = 16, 1051 SPINEL_CAP_802_15_4_2003 = (SPINEL_CAP_802_15_4__BEGIN + 0), 1052 SPINEL_CAP_802_15_4_2006 = (SPINEL_CAP_802_15_4__BEGIN + 1), 1053 SPINEL_CAP_802_15_4_2011 = (SPINEL_CAP_802_15_4__BEGIN + 2), 1054 SPINEL_CAP_802_15_4_PIB = (SPINEL_CAP_802_15_4__BEGIN + 5), 1055 SPINEL_CAP_802_15_4_2450MHZ_OQPSK = (SPINEL_CAP_802_15_4__BEGIN + 8), 1056 SPINEL_CAP_802_15_4_915MHZ_OQPSK = (SPINEL_CAP_802_15_4__BEGIN + 9), 1057 SPINEL_CAP_802_15_4_868MHZ_OQPSK = (SPINEL_CAP_802_15_4__BEGIN + 10), 1058 SPINEL_CAP_802_15_4_915MHZ_BPSK = (SPINEL_CAP_802_15_4__BEGIN + 11), 1059 SPINEL_CAP_802_15_4_868MHZ_BPSK = (SPINEL_CAP_802_15_4__BEGIN + 12), 1060 SPINEL_CAP_802_15_4_915MHZ_ASK = (SPINEL_CAP_802_15_4__BEGIN + 13), 1061 SPINEL_CAP_802_15_4_868MHZ_ASK = (SPINEL_CAP_802_15_4__BEGIN + 14), 1062 SPINEL_CAP_802_15_4__END = 32, 1063 1064 SPINEL_CAP_CONFIG__BEGIN = 32, 1065 SPINEL_CAP_CONFIG_FTD = (SPINEL_CAP_CONFIG__BEGIN + 0), 1066 SPINEL_CAP_CONFIG_MTD = (SPINEL_CAP_CONFIG__BEGIN + 1), 1067 SPINEL_CAP_CONFIG_RADIO = (SPINEL_CAP_CONFIG__BEGIN + 2), 1068 SPINEL_CAP_CONFIG__END = 40, 1069 1070 SPINEL_CAP_ROLE__BEGIN = 48, 1071 SPINEL_CAP_ROLE_ROUTER = (SPINEL_CAP_ROLE__BEGIN + 0), 1072 SPINEL_CAP_ROLE_SLEEPY = (SPINEL_CAP_ROLE__BEGIN + 1), 1073 SPINEL_CAP_ROLE__END = 52, 1074 1075 SPINEL_CAP_NET__BEGIN = 52, 1076 SPINEL_CAP_NET_THREAD_1_0 = (SPINEL_CAP_NET__BEGIN + 0), 1077 SPINEL_CAP_NET_THREAD_1_1 = (SPINEL_CAP_NET__BEGIN + 1), 1078 SPINEL_CAP_NET__END = 64, 1079 1080 SPINEL_CAP_OPENTHREAD__BEGIN = 512, 1081 SPINEL_CAP_MAC_WHITELIST = (SPINEL_CAP_OPENTHREAD__BEGIN + 0), 1082 SPINEL_CAP_MAC_RAW = (SPINEL_CAP_OPENTHREAD__BEGIN + 1), 1083 SPINEL_CAP_OOB_STEERING_DATA = (SPINEL_CAP_OPENTHREAD__BEGIN + 2), 1084 SPINEL_CAP_CHANNEL_MONITOR = (SPINEL_CAP_OPENTHREAD__BEGIN + 3), 1085 SPINEL_CAP_ERROR_RATE_TRACKING = (SPINEL_CAP_OPENTHREAD__BEGIN + 4), 1086 SPINEL_CAP_CHANNEL_MANAGER = (SPINEL_CAP_OPENTHREAD__BEGIN + 5), 1087 SPINEL_CAP_OPENTHREAD_LOG_METADATA = (SPINEL_CAP_OPENTHREAD__BEGIN + 6), 1088 SPINEL_CAP_TIME_SYNC = (SPINEL_CAP_OPENTHREAD__BEGIN + 7), 1089 SPINEL_CAP_CHILD_SUPERVISION = (SPINEL_CAP_OPENTHREAD__BEGIN + 8), 1090 SPINEL_CAP_POSIX = (SPINEL_CAP_OPENTHREAD__BEGIN + 9), 1091 SPINEL_CAP_SLAAC = (SPINEL_CAP_OPENTHREAD__BEGIN + 10), 1092 SPINEL_CAP_RADIO_COEX = (SPINEL_CAP_OPENTHREAD__BEGIN + 11), 1093 SPINEL_CAP_MAC_RETRY_HISTOGRAM = (SPINEL_CAP_OPENTHREAD__BEGIN + 12), 1094 SPINEL_CAP_OPENTHREAD__END = 640, 1095 1096 SPINEL_CAP_THREAD__BEGIN = 1024, 1097 SPINEL_CAP_THREAD_COMMISSIONER = (SPINEL_CAP_THREAD__BEGIN + 0), 1098 SPINEL_CAP_THREAD_TMF_PROXY = (SPINEL_CAP_THREAD__BEGIN + 1), 1099 SPINEL_CAP_THREAD_UDP_FORWARD = (SPINEL_CAP_THREAD__BEGIN + 2), 1100 SPINEL_CAP_THREAD_JOINER = (SPINEL_CAP_THREAD__BEGIN + 3), 1101 SPINEL_CAP_THREAD_BORDER_ROUTER = (SPINEL_CAP_THREAD__BEGIN + 4), 1102 SPINEL_CAP_THREAD_SERVICE = (SPINEL_CAP_THREAD__BEGIN + 5), 1103 SPINEL_CAP_THREAD__END = 1152, 1104 1105 SPINEL_CAP_NEST__BEGIN = 15296, 1106 SPINEL_CAP_NEST_LEGACY_INTERFACE = (SPINEL_CAP_NEST__BEGIN + 0), 1107 SPINEL_CAP_NEST_LEGACY_NET_WAKE = (SPINEL_CAP_NEST__BEGIN + 1), 1108 SPINEL_CAP_NEST_TRANSMIT_HOOK = (SPINEL_CAP_NEST__BEGIN + 2), 1109 SPINEL_CAP_NEST__END = 15360, 1110 1111 SPINEL_CAP_VENDOR__BEGIN = 15360, 1112 SPINEL_CAP_VENDOR__END = 16384, 1113 1114 SPINEL_CAP_EXPERIMENTAL__BEGIN = 2000000, 1115 SPINEL_CAP_EXPERIMENTAL__END = 2097152, 1116 }; 1117 1118 typedef uint32_t spinel_capability_t; 1119 1120 /** 1121 * Property Keys 1122 * 1123 * The properties are broken up into several sections, each with a 1124 * reserved ranges of property identifiers: 1125 * 1126 * Name | Range (Inclusive) | Description 1127 * -------------|--------------------------------|------------------------ 1128 * Core | 0x000 - 0x01F, 0x1000 - 0x11FF | Spinel core 1129 * PHY | 0x020 - 0x02F, 0x1200 - 0x12FF | Radio PHY layer 1130 * MAC | 0x030 - 0x03F, 0x1300 - 0x13FF | MAC layer 1131 * NET | 0x040 - 0x04F, 0x1400 - 0x14FF | Network 1132 * Thread | 0x050 - 0x05F, 0x1500 - 0x15FF | Thread 1133 * IPv6 | 0x060 - 0x06F, 0x1600 - 0x16FF | IPv6 1134 * Stream | 0x070 - 0x07F, 0x1700 - 0x17FF | Stream 1135 * MeshCop | 0x080 - 0x08F, 0x1800 - 0x18FF | Thread Mesh Commissioning 1136 * OpenThread | 0x1900 - 0x19FF | OpenThread specific 1137 * Server | 0x0A0 - 0x0AF | ALOC Service Server 1138 * Interface | 0x100 - 0x1FF | Interface (e.g., UART) 1139 * PIB | 0x400 - 0x4FF | 802.15.4 PIB 1140 * Counter | 0x500 - 0x7FF | Counters (MAC, IP, etc). 1141 * RCP | 0x800 - 0x8FF | RCP specific property 1142 * Nest | 0x3BC0 - 0x3BFF | Nest (legacy) 1143 * Vendor | 0x3C00 - 0x3FFF | Vendor specific 1144 * Debug | 0x4000 - 0x43FF | Debug related 1145 * Experimental | 2,000,000 - 2,097,151 | Experimental use only 1146 * 1147 */ 1148 enum 1149 { 1150 /// Last Operation Status 1151 /** Format: `i` - Read-only 1152 * 1153 * Describes the status of the last operation. Encoded as a packed 1154 * unsigned integer (see `SPINEL_STATUS_*` for list of values). 1155 * 1156 * This property is emitted often to indicate the result status of 1157 * pretty much any Host-to-NCP operation. 1158 * 1159 * It is emitted automatically at NCP startup with a value indicating 1160 * the reset reason. It is also emitted asynchronously on an error ( 1161 * e.g., NCP running out of buffer). 1162 * 1163 */ 1164 SPINEL_PROP_LAST_STATUS = 0, 1165 1166 /// Protocol Version 1167 /** Format: `ii` - Read-only 1168 * 1169 * Describes the protocol version information. This property contains 1170 * two fields, each encoded as a packed unsigned integer: 1171 * `i`: Major Version Number 1172 * `i`: Minor Version Number 1173 * 1174 * The version number is defined by `SPINEL_PROTOCOL_VERSION_THREAD_MAJOR` 1175 * and `SPINEL_PROTOCOL_VERSION_THREAD_MINOR`. 1176 * 1177 * This specification describes major version 4, minor version 3. 1178 * 1179 */ 1180 SPINEL_PROP_PROTOCOL_VERSION = 1, 1181 1182 /// NCP Version 1183 /** Format: `U` - Read-only 1184 * 1185 * Contains a string which describes the firmware currently running on 1186 * the NCP. Encoded as a zero-terminated UTF-8 string. 1187 * 1188 */ 1189 SPINEL_PROP_NCP_VERSION = 2, 1190 1191 /// NCP Network Protocol Type 1192 /** Format: 'i' - Read-only 1193 * 1194 * This value identifies what the network protocol for this NCP. 1195 * The valid protocol type values are defined by enumeration 1196 * `SPINEL_PROTOCOL_TYPE_*`: 1197 * 1198 * `SPINEL_PROTOCOL_TYPE_BOOTLOADER` = 0 1199 * `SPINEL_PROTOCOL_TYPE_ZIGBEE_IP` = 2, 1200 * `SPINEL_PROTOCOL_TYPE_THREAD` = 3, 1201 * 1202 * OpenThread NCP supports only `SPINEL_PROTOCOL_TYPE_THREAD` 1203 * 1204 */ 1205 SPINEL_PROP_INTERFACE_TYPE = 3, 1206 1207 /// NCP Vendor ID 1208 /** Format: 'i` - Read-only 1209 * 1210 * Vendor ID. Zero for unknown. 1211 * 1212 */ 1213 SPINEL_PROP_VENDOR_ID = 4, 1214 1215 /// NCP Capability List 1216 /** Format: 'A(i)` - Read-only 1217 * 1218 * Describes the supported capabilities of this NCP. Encoded as a list of 1219 * packed unsigned integers. 1220 * 1221 * The capability values are specified by SPINEL_CAP_* enumeration. 1222 * 1223 */ 1224 SPINEL_PROP_CAPS = 5, 1225 1226 /// NCP Interface Count 1227 /** Format: 'C` - Read-only 1228 * 1229 * Provides number of interfaces. 1230 * 1231 * Currently always reads as 1. 1232 * 1233 */ 1234 SPINEL_PROP_INTERFACE_COUNT = 6, 1235 1236 SPINEL_PROP_POWER_STATE = 7, ///< PowerState [C] (deprecated, use `MCU_POWER_STATE` instead). 1237 1238 /// NCP Hardware Address 1239 /** Format: 'E` - Read-only 1240 * 1241 * The static EUI64 address of the device, used as a serial number. 1242 * 1243 */ 1244 SPINEL_PROP_HWADDR = 8, 1245 1246 SPINEL_PROP_LOCK = 9, ///< PropLock [b] (not supported) 1247 SPINEL_PROP_HBO_MEM_MAX = 10, ///< Max offload mem [S] (not supported) 1248 SPINEL_PROP_HBO_BLOCK_MAX = 11, ///< Max offload block [S] (not supported) 1249 1250 /// Host Power State 1251 /** Format: 'C` 1252 * 1253 * Describes the current power state of the host. This property is used 1254 * by the host to inform the NCP when it has changed power states. The 1255 * NCP can then use this state to determine which properties need 1256 * asynchronous updates. Enumeration `spinel_host_power_state_t` defines 1257 * the valid values (`SPINEL_HOST_POWER_STATE_*`): 1258 * 1259 * `HOST_POWER_STATE_OFFLINE`: Host is physically powered off and 1260 * cannot be woken by the NCP. All asynchronous commands are 1261 * squelched. 1262 * 1263 * `HOST_POWER_STATE_DEEP_SLEEP`: The host is in a low power state 1264 * where it can be woken by the NCP but will potentially require more 1265 * than two seconds to become fully responsive. The NCP MUST 1266 * avoid sending unnecessary property updates, such as child table 1267 * updates or non-critical messages on the debug stream. If the NCP 1268 * needs to wake the host for traffic, the NCP MUST first take 1269 * action to wake the host. Once the NCP signals to the host that it 1270 * should wake up, the NCP MUST wait for some activity from the 1271 * host (indicating that it is fully awake) before sending frames. 1272 * 1273 * `HOST_POWER_STATE_RESERVED`: This value MUST NOT be set by the host. If 1274 * received by the NCP, the NCP SHOULD consider this as a synonym 1275 * of `HOST_POWER_STATE_DEEP_SLEEP`. 1276 * 1277 * `HOST_POWER_STATE_LOW_POWER`: The host is in a low power state 1278 * where it can be immediately woken by the NCP. The NCP SHOULD 1279 * avoid sending unnecessary property updates, such as child table 1280 * updates or non-critical messages on the debug stream. 1281 * 1282 * `HOST_POWER_STATE_ONLINE`: The host is awake and responsive. No 1283 * special filtering is performed by the NCP on asynchronous updates. 1284 * 1285 * All other values are RESERVED. They MUST NOT be set by the 1286 * host. If received by the NCP, the NCP SHOULD consider the value as 1287 * a synonym of `HOST_POWER_STATE_LOW_POWER`. 1288 * 1289 * After setting this power state, any further commands from the host to 1290 * the NCP will cause `HOST_POWER_STATE` to automatically revert to 1291 * `HOST_POWER_STATE_ONLINE`. 1292 * 1293 * When the host is entering a low-power state, it should wait for the 1294 * response from the NCP acknowledging the command (with `CMD_VALUE_IS`). 1295 * Once that acknowledgment is received the host may enter the low-power 1296 * state. 1297 * 1298 * If the NCP has the `CAP_UNSOL_UPDATE_FILTER` capability, any unsolicited 1299 * property updates masked by `PROP_UNSOL_UPDATE_FILTER` should be honored 1300 * while the host indicates it is in a low-power state. After resuming to the 1301 * `HOST_POWER_STATE_ONLINE` state, the value of `PROP_UNSOL_UPDATE_FILTER` 1302 * MUST be unchanged from the value assigned prior to the host indicating 1303 * it was entering a low-power state. 1304 * 1305 */ 1306 SPINEL_PROP_HOST_POWER_STATE = 12, 1307 1308 /// NCP's MCU Power State 1309 /** Format: 'C` 1310 * Required capability: CAP_MCU_POWER_SAVE 1311 * 1312 * This property specifies the desired power state of NCP's micro-controller 1313 * (MCU) when the underlying platform's operating system enters idle mode (i.e., 1314 * all active tasks/events are processed and the MCU can potentially enter a 1315 * energy-saving power state). 1316 * 1317 * The power state primarily determines how the host should interact with the NCP 1318 * and whether the host needs an external trigger (a "poke") to NCP before it can 1319 * communicate with the NCP or not. After a reset, the MCU power state MUST be 1320 * SPINEL_MCU_POWER_STATE_ON. 1321 * 1322 * Enumeration `spinel_mcu_power_state_t` defines the valid values 1323 * (`SPINEL_MCU_POWER_STATE_*` constants): 1324 * 1325 * `SPINEL_MCU_POWER_STATE_ON`: NCP's MCU stays on and active all the time. 1326 * When the NCP's desired power state is set to this value, host can send 1327 * messages to NCP without requiring any "poke" or external triggers. MCU is 1328 * expected to stay on and active. Note that the `ON` power state only 1329 * determines the MCU's power mode and is not related to radio's state. 1330 * 1331 * `SPINEL_MCU_POWER_STATE_LOW_POWER`: NCP's MCU can enter low-power 1332 * (energy-saving) state. When the NCP's desired power state is set to 1333 * `LOW_POWER`, host is expected to "poke" the NCP (e.g., an external trigger 1334 * like an interrupt) before it can communicate with the NCP (send a message 1335 * to the NCP). The "poke" mechanism is determined by the platform code (based 1336 * on NCP's interface to the host). 1337 * While power state is set to `LOW_POWER`, NCP can still (at any time) send 1338 * messages to host. Note that receiving a message from the NCP does NOT 1339 * indicate that the NCP's power state has changed, i.e., host is expected to 1340 * continue to "poke" NCP when it wants to talk to the NCP until the power 1341 * state is explicitly changed (by setting this property to `ON`). 1342 * Note that the `LOW_POWER` power state only determines the MCU's power mode 1343 * and is not related to radio's state. 1344 * 1345 * `SPINEL_MCU_POWER_STATE_OFF`: NCP is fully powered off. 1346 * An NCP hardware reset (via a RESET pin) is required to bring the NCP back 1347 * to `SPINEL_MCU_POWER_STATE_ON`. RAM is not retained after reset. 1348 * 1349 */ 1350 SPINEL_PROP_MCU_POWER_STATE = 13, 1351 1352 SPINEL_PROP_BASE_EXT__BEGIN = 0x1000, 1353 1354 /// GPIO Configuration 1355 /** Format: `A(CCU)` 1356 * Type: Read-Only (Optionally Read-write using `CMD_PROP_VALUE_INSERT`) 1357 * 1358 * An array of structures which contain the following fields: 1359 * 1360 * * `C`: GPIO Number 1361 * * `C`: GPIO Configuration Flags 1362 * * `U`: Human-readable GPIO name 1363 * 1364 * GPIOs which do not have a corresponding entry are not supported. 1365 * 1366 * The configuration parameter contains the configuration flags for the 1367 * GPIO: 1368 * 1369 * 0 1 2 3 4 5 6 7 1370 * +---+---+---+---+---+---+---+---+ 1371 * |DIR|PUP|PDN|TRIGGER| RESERVED | 1372 * +---+---+---+---+---+---+---+---+ 1373 * |O/D| 1374 * +---+ 1375 * 1376 * * `DIR`: Pin direction. Clear (0) for input, set (1) for output. 1377 * * `PUP`: Pull-up enabled flag. 1378 * * `PDN`/`O/D`: Flag meaning depends on pin direction: 1379 * * Input: Pull-down enabled. 1380 * * Output: Output is an open-drain. 1381 * * `TRIGGER`: Enumeration describing how pin changes generate 1382 * asynchronous notification commands (TBD) from the NCP to the host. 1383 * * 0: Feature disabled for this pin 1384 * * 1: Trigger on falling edge 1385 * * 2: Trigger on rising edge 1386 * * 3: Trigger on level change 1387 * * `RESERVED`: Bits reserved for future use. Always cleared to zero 1388 * and ignored when read. 1389 * 1390 * As an optional feature, the configuration of individual pins may be 1391 * modified using the `CMD_PROP_VALUE_INSERT` command. Only the GPIO 1392 * number and flags fields MUST be present, the GPIO name (if present) 1393 * would be ignored. This command can only be used to modify the 1394 * configuration of GPIOs which are already exposed---it cannot be used 1395 * by the host to add additional GPIOs. 1396 */ 1397 SPINEL_PROP_GPIO_CONFIG = SPINEL_PROP_BASE_EXT__BEGIN + 0, 1398 1399 /// GPIO State Bitmask 1400 /** Format: `D` 1401 * Type: Read-Write 1402 * 1403 * Contains a bit field identifying the state of the GPIOs. The length of 1404 * the data associated with these properties depends on the number of 1405 * GPIOs. If you have 10 GPIOs, you'd have two bytes. GPIOs are numbered 1406 * from most significant bit to least significant bit, so 0x80 is GPIO 0, 1407 * 0x40 is GPIO 1, etc. 1408 * 1409 * For GPIOs configured as inputs: 1410 * 1411 * * `CMD_PROP_VAUE_GET`: The value of the associated bit describes the 1412 * logic level read from the pin. 1413 * * `CMD_PROP_VALUE_SET`: The value of the associated bit is ignored 1414 * for these pins. 1415 * 1416 * For GPIOs configured as outputs: 1417 * 1418 * * `CMD_PROP_VAUE_GET`: The value of the associated bit is 1419 * implementation specific. 1420 * * `CMD_PROP_VALUE_SET`: The value of the associated bit determines 1421 * the new logic level of the output. If this pin is configured as an 1422 * open-drain, setting the associated bit to 1 will cause the pin to 1423 * enter a Hi-Z state. 1424 * 1425 * For GPIOs which are not specified in `PROP_GPIO_CONFIG`: 1426 * 1427 * * `CMD_PROP_VAUE_GET`: The value of the associated bit is 1428 * implementation specific. 1429 * * `CMD_PROP_VALUE_SET`: The value of the associated bit MUST be 1430 * ignored by the NCP. 1431 * 1432 * When writing, unspecified bits are assumed to be zero. 1433 */ 1434 SPINEL_PROP_GPIO_STATE = SPINEL_PROP_BASE_EXT__BEGIN + 2, 1435 1436 /// GPIO State Set-Only Bitmask 1437 /** Format: `D` 1438 * Type: Write-Only 1439 * 1440 * Allows for the state of various output GPIOs to be set without affecting 1441 * other GPIO states. Contains a bit field identifying the output GPIOs that 1442 * should have their state set to 1. 1443 * 1444 * When writing, unspecified bits are assumed to be zero. The value of 1445 * any bits for GPIOs which are not specified in `PROP_GPIO_CONFIG` MUST 1446 * be ignored. 1447 */ 1448 SPINEL_PROP_GPIO_STATE_SET = SPINEL_PROP_BASE_EXT__BEGIN + 3, 1449 1450 /// GPIO State Clear-Only Bitmask 1451 /** Format: `D` 1452 * Type: Write-Only 1453 * 1454 * Allows for the state of various output GPIOs to be cleared without affecting 1455 * other GPIO states. Contains a bit field identifying the output GPIOs that 1456 * should have their state cleared to 0. 1457 * 1458 * When writing, unspecified bits are assumed to be zero. The value of 1459 * any bits for GPIOs which are not specified in `PROP_GPIO_CONFIG` MUST 1460 * be ignored. 1461 */ 1462 SPINEL_PROP_GPIO_STATE_CLEAR = SPINEL_PROP_BASE_EXT__BEGIN + 4, 1463 1464 /// 32-bit random number from TRNG, ready-to-use. 1465 SPINEL_PROP_TRNG_32 = SPINEL_PROP_BASE_EXT__BEGIN + 5, 1466 1467 /// 16 random bytes from TRNG, ready-to-use. 1468 SPINEL_PROP_TRNG_128 = SPINEL_PROP_BASE_EXT__BEGIN + 6, 1469 1470 /// Raw samples from TRNG entropy source representing 32 bits of entropy. 1471 SPINEL_PROP_TRNG_RAW_32 = SPINEL_PROP_BASE_EXT__BEGIN + 7, 1472 1473 /// NCP Unsolicited update filter 1474 /** Format: `A(I)` 1475 * Type: Read-Write (optional Insert-Remove) 1476 * Required capability: `CAP_UNSOL_UPDATE_FILTER` 1477 * 1478 * Contains a list of properties which are excluded from generating 1479 * unsolicited value updates. This property is empty after reset. 1480 * In other words, the host may opt-out of unsolicited property updates 1481 * for a specific property by adding that property id to this list. 1482 * Hosts SHOULD NOT add properties to this list which are not 1483 * present in `PROP_UNSOL_UPDATE_LIST`. If such properties are added, 1484 * the NCP ignores the unsupported properties. 1485 * 1486 */ 1487 SPINEL_PROP_UNSOL_UPDATE_FILTER = SPINEL_PROP_BASE_EXT__BEGIN + 8, 1488 1489 /// List of properties capable of generating unsolicited value update. 1490 /** Format: `A(I)` 1491 * Type: Read-Only 1492 * Required capability: `CAP_UNSOL_UPDATE_FILTER` 1493 * 1494 * Contains a list of properties which are capable of generating 1495 * unsolicited value updates. This list can be used when populating 1496 * `PROP_UNSOL_UPDATE_FILTER` to disable all unsolicited property 1497 * updates. 1498 * 1499 * This property is intended to effectively behave as a constant 1500 * for a given NCP firmware. 1501 */ 1502 SPINEL_PROP_UNSOL_UPDATE_LIST = SPINEL_PROP_BASE_EXT__BEGIN + 9, 1503 1504 SPINEL_PROP_BASE_EXT__END = 0x1100, 1505 1506 SPINEL_PROP_PHY__BEGIN = 0x20, 1507 SPINEL_PROP_PHY_ENABLED = SPINEL_PROP_PHY__BEGIN + 0, ///< [b] 1508 SPINEL_PROP_PHY_CHAN = SPINEL_PROP_PHY__BEGIN + 1, ///< [C] 1509 SPINEL_PROP_PHY_CHAN_SUPPORTED = SPINEL_PROP_PHY__BEGIN + 2, ///< [A(C)] 1510 SPINEL_PROP_PHY_FREQ = SPINEL_PROP_PHY__BEGIN + 3, ///< kHz [L] 1511 SPINEL_PROP_PHY_CCA_THRESHOLD = SPINEL_PROP_PHY__BEGIN + 4, ///< dBm [c] 1512 SPINEL_PROP_PHY_TX_POWER = SPINEL_PROP_PHY__BEGIN + 5, ///< [c] 1513 SPINEL_PROP_PHY_RSSI = SPINEL_PROP_PHY__BEGIN + 6, ///< dBm [c] 1514 SPINEL_PROP_PHY_RX_SENSITIVITY = SPINEL_PROP_PHY__BEGIN + 7, ///< dBm [c] 1515 SPINEL_PROP_PHY_PCAP_ENABLED = SPINEL_PROP_PHY__BEGIN + 8, ///< [b] 1516 SPINEL_PROP_PHY_CHAN_PREFERRED = SPINEL_PROP_PHY__BEGIN + 9, ///< [A(C)] 1517 SPINEL_PROP_PHY__END = 0x30, 1518 1519 SPINEL_PROP_PHY_EXT__BEGIN = 0x1200, 1520 1521 /// Signal Jamming Detection Enable 1522 /** Format: `b` 1523 * 1524 * Indicates if jamming detection is enabled or disabled. Set to true 1525 * to enable jamming detection. 1526 */ 1527 SPINEL_PROP_JAM_DETECT_ENABLE = SPINEL_PROP_PHY_EXT__BEGIN + 0, 1528 1529 /// Signal Jamming Detected Indicator 1530 /** Format: `b` (Read-Only) 1531 * 1532 * Set to true if radio jamming is detected. Set to false otherwise. 1533 * 1534 * When jamming detection is enabled, changes to the value of this 1535 * property are emitted asynchronously via `CMD_PROP_VALUE_IS`. 1536 */ 1537 SPINEL_PROP_JAM_DETECTED = SPINEL_PROP_PHY_EXT__BEGIN + 1, 1538 1539 /// Jamming detection RSSI threshold 1540 /** Format: `c` 1541 * Units: dBm 1542 * 1543 * This parameter describes the threshold RSSI level (measured in 1544 * dBm) above which the jamming detection will consider the 1545 * channel blocked. 1546 */ 1547 SPINEL_PROP_JAM_DETECT_RSSI_THRESHOLD = SPINEL_PROP_PHY_EXT__BEGIN + 2, 1548 1549 /// Jamming detection window size 1550 /** Format: `C` 1551 * Units: Seconds (1-63) 1552 * 1553 * This parameter describes the window period for signal jamming 1554 * detection. 1555 */ 1556 SPINEL_PROP_JAM_DETECT_WINDOW = SPINEL_PROP_PHY_EXT__BEGIN + 3, 1557 1558 /// Jamming detection busy period 1559 /** Format: `C` 1560 * Units: Seconds (1-63) 1561 * 1562 * This parameter describes the number of aggregate seconds within 1563 * the detection window where the RSSI must be above 1564 * `PROP_JAM_DETECT_RSSI_THRESHOLD` to trigger detection. 1565 * 1566 * The behavior of the jamming detection feature when `PROP_JAM_DETECT_BUSY` 1567 * is larger than `PROP_JAM_DETECT_WINDOW` is undefined. 1568 */ 1569 SPINEL_PROP_JAM_DETECT_BUSY = SPINEL_PROP_PHY_EXT__BEGIN + 4, 1570 1571 /// Jamming detection history bitmap (for debugging) 1572 /** Format: `X` (read-only) 1573 * 1574 * This value provides information about current state of jamming detection 1575 * module for monitoring/debugging purpose. It returns a 64-bit value where 1576 * each bit corresponds to one second interval starting with bit 0 for the 1577 * most recent interval and bit 63 for the oldest intervals (63 sec earlier). 1578 * The bit is set to 1 if the jamming detection module observed/detected 1579 * high signal level during the corresponding one second interval. 1580 * 1581 */ 1582 SPINEL_PROP_JAM_DETECT_HISTORY_BITMAP = SPINEL_PROP_PHY_EXT__BEGIN + 5, 1583 1584 /// Channel monitoring sample interval 1585 /** Format: `L` (read-only) 1586 * Units: Milliseconds 1587 * 1588 * Required capability: SPINEL_CAP_CHANNEL_MONITOR 1589 * 1590 * If channel monitoring is enabled and active, every sample interval, a 1591 * zero-duration Energy Scan is performed, collecting a single RSSI sample 1592 * per channel. The RSSI samples are compared with a pre-specified RSSI 1593 * threshold. 1594 * 1595 */ 1596 SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_INTERVAL = SPINEL_PROP_PHY_EXT__BEGIN + 6, 1597 1598 /// Channel monitoring RSSI threshold 1599 /** Format: `c` (read-only) 1600 * Units: dBm 1601 * 1602 * Required capability: SPINEL_CAP_CHANNEL_MONITOR 1603 * 1604 * This value specifies the threshold used by channel monitoring module. 1605 * Channel monitoring maintains the average rate of RSSI samples that 1606 * are above the threshold within (approximately) a pre-specified number 1607 * of samples (sample window). 1608 * 1609 */ 1610 SPINEL_PROP_CHANNEL_MONITOR_RSSI_THRESHOLD = SPINEL_PROP_PHY_EXT__BEGIN + 7, 1611 1612 /// Channel monitoring sample window 1613 /** Format: `L` (read-only) 1614 * Units: Number of samples 1615 * 1616 * Required capability: SPINEL_CAP_CHANNEL_MONITOR 1617 * 1618 * The averaging sample window length (in units of number of channel 1619 * samples) used by channel monitoring module. Channel monitoring will 1620 * sample all channels every sample interval. It maintains the average rate 1621 * of RSSI samples that are above the RSSI threshold within (approximately) 1622 * the sample window. 1623 * 1624 */ 1625 SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_WINDOW = SPINEL_PROP_PHY_EXT__BEGIN + 8, 1626 1627 /// Channel monitoring sample count 1628 /** Format: `L` (read-only) 1629 * Units: Number of samples 1630 * 1631 * Required capability: SPINEL_CAP_CHANNEL_MONITOR 1632 * 1633 * Total number of RSSI samples (per channel) taken by the channel 1634 * monitoring module since its start (since Thread network interface 1635 * was enabled). 1636 * 1637 */ 1638 SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_COUNT = SPINEL_PROP_PHY_EXT__BEGIN + 9, 1639 1640 /// Channel monitoring channel occupancy 1641 /** Format: `A(t(CU))` (read-only) 1642 * 1643 * Required capability: SPINEL_CAP_CHANNEL_MONITOR 1644 * 1645 * Data per item is: 1646 * 1647 * `C`: Channel 1648 * `U`: Channel occupancy indicator 1649 * 1650 * The channel occupancy value represents the average rate/percentage of 1651 * RSSI samples that were above RSSI threshold ("bad" RSSI samples) within 1652 * (approximately) sample window latest RSSI samples. 1653 * 1654 * Max value of `0xffff` indicates all RSSI samples were above RSSI 1655 * threshold (i.e. 100% of samples were "bad"). 1656 * 1657 */ 1658 SPINEL_PROP_CHANNEL_MONITOR_CHANNEL_OCCUPANCY = SPINEL_PROP_PHY_EXT__BEGIN + 10, 1659 1660 /// Radio caps 1661 /** Format: `i` (read-only) 1662 * 1663 * Data per item is: 1664 * 1665 * `i`: Radio Capabilities. 1666 * 1667 */ 1668 SPINEL_PROP_RADIO_CAPS = SPINEL_PROP_PHY_EXT__BEGIN + 11, 1669 1670 /// All coex metrics related counters. 1671 /** Format: t(LLLLLLLL)t(LLLLLLLLL)bL (Read-only) 1672 * 1673 * Required capability: SPINEL_CAP_RADIO_COEX 1674 * 1675 * The contents include two structures and two common variables, first structure corresponds to 1676 * all transmit related coex counters, second structure provides the receive related counters. 1677 * 1678 * The transmit structure includes: 1679 * 'L': NumTxRequest (The number of tx requests). 1680 * 'L': NumTxGrantImmediate (The number of tx requests while grant was active). 1681 * 'L': NumTxGrantWait (The number of tx requests while grant was inactive). 1682 * 'L': NumTxGrantWaitActivated (The number of tx requests while grant was inactive that were 1683 * ultimately granted). 1684 * 'L': NumTxGrantWaitTimeout (The number of tx requests while grant was inactive that timed out). 1685 * 'L': NumTxGrantDeactivatedDuringRequest (The number of tx requests that were in progress when grant was 1686 * deactivated). 1687 * 'L': NumTxDelayedGrant (The number of tx requests that were not granted within 50us). 1688 * 'L': AvgTxRequestToGrantTime (The average time in usec from tx request to grant). 1689 * 1690 * The receive structure includes: 1691 * 'L': NumRxRequest (The number of rx requests). 1692 * 'L': NumRxGrantImmediate (The number of rx requests while grant was active). 1693 * 'L': NumRxGrantWait (The number of rx requests while grant was inactive). 1694 * 'L': NumRxGrantWaitActivated (The number of rx requests while grant was inactive that were 1695 * ultimately granted). 1696 * 'L': NumRxGrantWaitTimeout (The number of rx requests while grant was inactive that timed out). 1697 * 'L': NumRxGrantDeactivatedDuringRequest (The number of rx requests that were in progress when grant was 1698 * deactivated). 1699 * 'L': NumRxDelayedGrant (The number of rx requests that were not granted within 50us). 1700 * 'L': AvgRxRequestToGrantTime (The average time in usec from rx request to grant). 1701 * 'L': NumRxGrantNone (The number of rx requests that completed without receiving grant). 1702 * 1703 * Two common variables: 1704 * 'b': Stopped (Stats collection stopped due to saturation). 1705 * 'L': NumGrantGlitch (The number of of grant glitches). 1706 */ 1707 SPINEL_PROP_RADIO_COEX_METRICS = SPINEL_PROP_PHY_EXT__BEGIN + 12, 1708 1709 /// Radio Coex Enable 1710 /** Format: `b` 1711 * 1712 * Required capability: SPINEL_CAP_RADIO_COEX 1713 * 1714 * Indicates if radio coex is enabled or disabled. Set to true to enable radio coex. 1715 */ 1716 SPINEL_PROP_RADIO_COEX_ENABLE = SPINEL_PROP_PHY_EXT__BEGIN + 13, 1717 1718 SPINEL_PROP_PHY_EXT__END = 0x1300, 1719 1720 SPINEL_PROP_MAC__BEGIN = 0x30, 1721 1722 /// MAC Scan State 1723 /** Format: `C` 1724 * 1725 * Possible values are from enumeration `spinel_scan_state_t`. 1726 * 1727 * SCAN_STATE_IDLE 1728 * SCAN_STATE_BEACON 1729 * SCAN_STATE_ENERGY 1730 * SCAN_STATE_DISCOVER 1731 * 1732 * Set to `SCAN_STATE_BEACON` to start an active scan. 1733 * Beacons will be emitted from `PROP_MAC_SCAN_BEACON`. 1734 * 1735 * Set to `SCAN_STATE_ENERGY` to start an energy scan. 1736 * Channel energy result will be reported by emissions 1737 * of `PROP_MAC_ENERGY_SCAN_RESULT` (per channel). 1738 * 1739 * Set to `SCAN_STATE_DISOVER` to start a Thread MLE discovery 1740 * scan operation. Discovery scan result will be emitted from 1741 * `PROP_MAC_SCAN_BEACON`. 1742 * 1743 * Value switches to `SCAN_STATE_IDLE` when scan is complete. 1744 * 1745 */ 1746 SPINEL_PROP_MAC_SCAN_STATE = SPINEL_PROP_MAC__BEGIN + 0, 1747 1748 /// MAC Scan Channel Mask 1749 /** Format: `A(C)` 1750 * 1751 * List of channels to scan. 1752 * 1753 */ 1754 SPINEL_PROP_MAC_SCAN_MASK = SPINEL_PROP_MAC__BEGIN + 1, 1755 1756 /// MAC Scan Channel Period 1757 /** Format: `S` 1758 * Unit: milliseconds per channel 1759 * 1760 */ 1761 SPINEL_PROP_MAC_SCAN_PERIOD = SPINEL_PROP_MAC__BEGIN + 2, 1762 1763 /// MAC Scan Beacon 1764 /** Format `Cct(ESSc)t(iCUdd)` - Asynchronous event only 1765 * 1766 * Scan beacons have two embedded structures which contain 1767 * information about the MAC layer and the NET layer. Their 1768 * format depends on the MAC and NET layer currently in use. 1769 * The format below is for an 802.15.4 MAC with Thread: 1770 * 1771 * `C`: Channel 1772 * `c`: RSSI of the beacon 1773 * `t`: MAC layer properties (802.15.4 layer) 1774 * `E`: Long address 1775 * `S`: Short address 1776 * `S`: PAN-ID 1777 * `c`: LQI 1778 * NET layer properties 1779 * `i`: Protocol Number (SPINEL_PROTOCOL_TYPE_* values) 1780 * `C`: Flags (SPINEL_BEACON_THREAD_FLAG_* values) 1781 * `U`: Network Name 1782 * `d`: XPANID 1783 * `d`: Steering data 1784 * 1785 * Extra parameters may be added to each of the structures 1786 * in the future, so care should be taken to read the length 1787 * that prepends each structure. 1788 * 1789 */ 1790 SPINEL_PROP_MAC_SCAN_BEACON = SPINEL_PROP_MAC__BEGIN + 3, 1791 1792 /// MAC Long Address 1793 /** Format: `E` 1794 * 1795 * The 802.15.4 long address of this node. 1796 * 1797 */ 1798 SPINEL_PROP_MAC_15_4_LADDR = SPINEL_PROP_MAC__BEGIN + 4, 1799 1800 /// MAC Short Address 1801 /** Format: `S` 1802 * 1803 * The 802.15.4 short address of this node. 1804 * 1805 */ 1806 SPINEL_PROP_MAC_15_4_SADDR = SPINEL_PROP_MAC__BEGIN + 5, 1807 1808 /// MAC PAN ID 1809 /** Format: `S` 1810 * 1811 * The 802.15.4 PANID this node is associated with. 1812 * 1813 */ 1814 SPINEL_PROP_MAC_15_4_PANID = SPINEL_PROP_MAC__BEGIN + 6, 1815 1816 /// MAC Stream Raw Enabled 1817 /** Format: `b` 1818 * 1819 * Set to true to enable raw MAC frames to be emitted from 1820 * `PROP_STREAM_RAW`. 1821 * 1822 */ 1823 SPINEL_PROP_MAC_RAW_STREAM_ENABLED = SPINEL_PROP_MAC__BEGIN + 7, 1824 1825 /// MAC Promiscuous Mode 1826 /** Format: `C` 1827 * 1828 * Possible values are from enumeration 1829 * `SPINEL_MAC_PROMISCUOUS_MODE_*`: 1830 * 1831 * `SPINEL_MAC_PROMISCUOUS_MODE_OFF` 1832 * Normal MAC filtering is in place. 1833 * 1834 * `SPINEL_MAC_PROMISCUOUS_MODE_NETWORK` 1835 * All MAC packets matching network are passed up 1836 * the stack. 1837 * 1838 * `SPINEL_MAC_PROMISCUOUS_MODE_FULL` 1839 * All decoded MAC packets are passed up the stack. 1840 * 1841 */ 1842 SPINEL_PROP_MAC_PROMISCUOUS_MODE = SPINEL_PROP_MAC__BEGIN + 8, 1843 1844 /// MAC Energy Scan Result 1845 /** Format: `Cc` - Asynchronous event only 1846 * 1847 * This property is emitted during energy scan operation 1848 * per scanned channel with following format: 1849 * 1850 * `C`: Channel 1851 * `c`: RSSI (in dBm) 1852 * 1853 */ 1854 SPINEL_PROP_MAC_ENERGY_SCAN_RESULT = SPINEL_PROP_MAC__BEGIN + 9, 1855 1856 /// MAC Data Poll Period 1857 /** Format: `L` 1858 * Unit: millisecond 1859 * The (user-specified) data poll (802.15.4 MAC Data Request) period 1860 * in milliseconds. Value zero means there is no user-specified 1861 * poll period, and the network stack determines the maximum period 1862 * based on the MLE Child Timeout. 1863 * 1864 * If the value is non-zero, it specifies the maximum period between 1865 * data poll transmissions. Note that the network stack may send data 1866 * request transmissions more frequently when expecting a control-message 1867 * (e.g., when waiting for an MLE Child ID Response). 1868 * 1869 */ 1870 SPINEL_PROP_MAC_DATA_POLL_PERIOD = SPINEL_PROP_MAC__BEGIN + 10, 1871 1872 SPINEL_PROP_MAC__END = 0x40, 1873 1874 SPINEL_PROP_MAC_EXT__BEGIN = 0x1300, 1875 1876 /// MAC Whitelist 1877 /** Format: `A(t(Ec))` 1878 * Required capability: `CAP_MAC_WHITELIST` 1879 * 1880 * Structure Parameters: 1881 * 1882 * `E`: EUI64 address of node 1883 * `c`: Optional RSSI-override value. The value 127 indicates 1884 * that the RSSI-override feature is not enabled for this 1885 * address. If this value is omitted when setting or 1886 * inserting, it is assumed to be 127. This parameter is 1887 * ignored when removing. 1888 */ 1889 SPINEL_PROP_MAC_WHITELIST = SPINEL_PROP_MAC_EXT__BEGIN + 0, 1890 1891 /// MAC Whitelist Enabled Flag 1892 /** Format: `b` 1893 * Required capability: `CAP_MAC_WHITELIST` 1894 * 1895 */ 1896 SPINEL_PROP_MAC_WHITELIST_ENABLED = SPINEL_PROP_MAC_EXT__BEGIN + 1, 1897 1898 /// MAC Extended Address 1899 /** Format: `E` 1900 * 1901 * Specified by Thread. Randomly-chosen, but non-volatile EUI-64. 1902 */ 1903 SPINEL_PROP_MAC_EXTENDED_ADDR = SPINEL_PROP_MAC_EXT__BEGIN + 2, 1904 1905 /// MAC Source Match Enabled Flag 1906 /** Format: `b` 1907 * Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO 1908 * 1909 * Set to true to enable radio source matching or false to disable it. 1910 * The source match functionality is used by radios when generating 1911 * ACKs. The short and extended address lists are used for setting 1912 * the Frame Pending bit in the ACKs. 1913 * 1914 */ 1915 SPINEL_PROP_MAC_SRC_MATCH_ENABLED = SPINEL_PROP_MAC_EXT__BEGIN + 3, 1916 1917 /// MAC Source Match Short Address List 1918 /** Format: `A(S)` 1919 * Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO 1920 * 1921 */ 1922 SPINEL_PROP_MAC_SRC_MATCH_SHORT_ADDRESSES = SPINEL_PROP_MAC_EXT__BEGIN + 4, 1923 1924 /// MAC Source Match Extended Address List 1925 /** Format: `A(E)` 1926 * Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO 1927 * 1928 */ 1929 SPINEL_PROP_MAC_SRC_MATCH_EXTENDED_ADDRESSES = SPINEL_PROP_MAC_EXT__BEGIN + 5, 1930 1931 /// MAC Blacklist 1932 /** Format: `A(t(E))` 1933 * Required capability: `CAP_MAC_WHITELIST` 1934 * 1935 * Structure Parameters: 1936 * 1937 * `E`: EUI64 address of node 1938 * 1939 */ 1940 SPINEL_PROP_MAC_BLACKLIST = SPINEL_PROP_MAC_EXT__BEGIN + 6, 1941 1942 /// MAC Blacklist Enabled Flag 1943 /** Format: `b` 1944 * Required capability: `CAP_MAC_WHITELIST` 1945 */ 1946 SPINEL_PROP_MAC_BLACKLIST_ENABLED = SPINEL_PROP_MAC_EXT__BEGIN + 7, 1947 1948 /// MAC Received Signal Strength Filter 1949 /** Format: `A(t(Ec))` 1950 * Required capability: `CAP_MAC_WHITELIST` 1951 * 1952 * Structure Parameters: 1953 * 1954 * * `E`: Optional EUI64 address of node. Set default RSS if not included. 1955 * * `c`: Fixed RSS. 127 means not set. 1956 */ 1957 SPINEL_PROP_MAC_FIXED_RSS = SPINEL_PROP_MAC_EXT__BEGIN + 8, 1958 1959 /// The CCA failure rate 1960 /** Format: `S` 1961 * 1962 * This property provides the current CCA (Clear Channel Assessment) failure rate. 1963 * 1964 * Maximum value `0xffff` corresponding to 100% failure rate. 1965 * 1966 */ 1967 SPINEL_PROP_MAC_CCA_FAILURE_RATE = SPINEL_PROP_MAC_EXT__BEGIN + 9, 1968 1969 /// MAC Max direct retry number 1970 /** Format: `C` 1971 * 1972 * The maximum (user-specified) number of direct frame transmission retries. 1973 * 1974 */ 1975 SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT = SPINEL_PROP_MAC_EXT__BEGIN + 10, 1976 1977 /// MAC Max indirect retry number 1978 /** Format: `C` 1979 * Required capability: `SPINEL_CAP_CONFIG_FTD` 1980 * 1981 * The maximum (user-specified) number of indirect frame transmission retries. 1982 * 1983 */ 1984 SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT = SPINEL_PROP_MAC_EXT__BEGIN + 11, 1985 1986 SPINEL_PROP_MAC_EXT__END = 0x1400, 1987 1988 SPINEL_PROP_NET__BEGIN = 0x40, 1989 1990 /// Network Is Saved (Is Commissioned) 1991 /** Format: `b` - Read only 1992 * 1993 * Returns true if there is a network state stored/saved. 1994 * 1995 */ 1996 SPINEL_PROP_NET_SAVED = SPINEL_PROP_NET__BEGIN + 0, 1997 1998 /// Network Interface Status 1999 /** Format `b` - Read-write 2000 * 2001 * Network interface up/down status. Write true to bring 2002 * interface up and false to bring interface down. 2003 * 2004 */ 2005 SPINEL_PROP_NET_IF_UP = SPINEL_PROP_NET__BEGIN + 1, 2006 2007 /// Thread Stack Operational Status 2008 /** Format `b` - Read-write 2009 * 2010 * Thread stack operational status. Write true to start 2011 * Thread stack and false to stop it. 2012 * 2013 */ 2014 SPINEL_PROP_NET_STACK_UP = SPINEL_PROP_NET__BEGIN + 2, 2015 2016 /// Thread Device Role 2017 /** Format `C` - Read-write 2018 * 2019 * Possible values are from enumeration `spinel_net_role_t` 2020 * 2021 * SPINEL_NET_ROLE_DETACHED = 0, 2022 * SPINEL_NET_ROLE_CHILD = 1, 2023 * SPINEL_NET_ROLE_ROUTER = 2, 2024 * SPINEL_NET_ROLE_LEADER = 3, 2025 * 2026 */ 2027 SPINEL_PROP_NET_ROLE = SPINEL_PROP_NET__BEGIN + 3, 2028 2029 /// Thread Network Name 2030 /** Format `U` - Read-write 2031 * 2032 */ 2033 SPINEL_PROP_NET_NETWORK_NAME = SPINEL_PROP_NET__BEGIN + 4, 2034 2035 /// Thread Network Extended PAN ID 2036 /** Format `D` - Read-write 2037 * 2038 */ 2039 SPINEL_PROP_NET_XPANID = SPINEL_PROP_NET__BEGIN + 5, 2040 2041 /// Thread Network Master Key 2042 /** Format `D` - Read-write 2043 * 2044 */ 2045 SPINEL_PROP_NET_MASTER_KEY = SPINEL_PROP_NET__BEGIN + 6, 2046 2047 /// Thread Network Key Sequence Counter 2048 /** Format `L` - Read-write 2049 * 2050 */ 2051 SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER = SPINEL_PROP_NET__BEGIN + 7, 2052 2053 /// Thread Network Partition Id 2054 /** Format `L` - Read-write 2055 * 2056 * The partition ID of the partition that this node is a 2057 * member of. 2058 * 2059 */ 2060 SPINEL_PROP_NET_PARTITION_ID = SPINEL_PROP_NET__BEGIN + 8, 2061 2062 /// Require Join Existing 2063 /** Format: `b` 2064 * Default Value: `false` 2065 * 2066 * This flag is typically used for nodes that are associating with an 2067 * existing network for the first time. If this is set to `true` before 2068 * `PROP_NET_STACK_UP` is set to `true`, the 2069 * creation of a new partition at association is prevented. If the node 2070 * cannot associate with an existing partition, `PROP_LAST_STATUS` will 2071 * emit a status that indicates why the association failed and 2072 * `PROP_NET_STACK_UP` will automatically revert to `false`. 2073 * 2074 * Once associated with an existing partition, this flag automatically 2075 * reverts to `false`. 2076 * 2077 * The behavior of this property being set to `true` when 2078 * `PROP_NET_STACK_UP` is already set to `true` is undefined. 2079 * 2080 */ 2081 SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING = SPINEL_PROP_NET__BEGIN + 9, 2082 2083 /// Thread Network Key Switch Guard Time 2084 /** Format `L` - Read-write 2085 * 2086 */ 2087 SPINEL_PROP_NET_KEY_SWITCH_GUARDTIME = SPINEL_PROP_NET__BEGIN + 10, 2088 2089 /// Thread Network PSKc 2090 /** Format `D` - Read-write 2091 * 2092 */ 2093 SPINEL_PROP_NET_PSKC = SPINEL_PROP_NET__BEGIN + 11, 2094 2095 SPINEL_PROP_NET__END = 0x50, 2096 2097 SPINEL_PROP_NET_EXT__BEGIN = 0x1400, 2098 SPINEL_PROP_NET_EXT__END = 0x1500, 2099 2100 SPINEL_PROP_THREAD__BEGIN = 0x50, 2101 2102 /// Thread Leader IPv6 Address 2103 /** Format `6` - Read only 2104 * 2105 */ 2106 SPINEL_PROP_THREAD_LEADER_ADDR = SPINEL_PROP_THREAD__BEGIN + 0, 2107 2108 /// Thread Parent Info 2109 /** Format: `ESLccCC` - Read only 2110 * 2111 * `E`: Extended address 2112 * `S`: RLOC16 2113 * `L`: Age (seconds since last heard from) 2114 * `c`: Average RSS (in dBm) 2115 * `c`: Last RSSI (in dBm) 2116 * `C`: Link Quality In 2117 * `C`: Link Quality Out 2118 * 2119 */ 2120 SPINEL_PROP_THREAD_PARENT = SPINEL_PROP_THREAD__BEGIN + 1, 2121 2122 /// Thread Child Table 2123 /** Format: [A(t(ESLLCCcCc)] - Read only 2124 * 2125 * Data per item is: 2126 * 2127 * `E`: Extended address 2128 * `S`: RLOC16 2129 * `L`: Timeout (in seconds) 2130 * `L`: Age (in seconds) 2131 * `L`: Network Data version 2132 * `C`: Link Quality In 2133 * `c`: Average RSS (in dBm) 2134 * `C`: Mode (bit-flags) 2135 * `c`: Last RSSI (in dBm) 2136 * 2137 */ 2138 SPINEL_PROP_THREAD_CHILD_TABLE = SPINEL_PROP_THREAD__BEGIN + 2, 2139 2140 /// Thread Leader Router Id 2141 /** Format `C` - Read only 2142 * 2143 * The router-id of the current leader. 2144 * 2145 */ 2146 SPINEL_PROP_THREAD_LEADER_RID = SPINEL_PROP_THREAD__BEGIN + 3, 2147 2148 /// Thread Leader Weight 2149 /** Format `C` - Read only 2150 * 2151 * The leader weight of the current leader. 2152 * 2153 */ 2154 SPINEL_PROP_THREAD_LEADER_WEIGHT = SPINEL_PROP_THREAD__BEGIN + 4, 2155 2156 /// Thread Local Leader Weight 2157 /** Format `C` - Read only 2158 * 2159 * The leader weight of this node. 2160 * 2161 */ 2162 SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT = SPINEL_PROP_THREAD__BEGIN + 5, 2163 2164 /// Thread Local Network Data 2165 /** Format `D` - Read only 2166 * 2167 */ 2168 SPINEL_PROP_THREAD_NETWORK_DATA = SPINEL_PROP_THREAD__BEGIN + 6, 2169 2170 /// Thread Local Network Data Version 2171 /** Format `C` - Read only 2172 * 2173 */ 2174 SPINEL_PROP_THREAD_NETWORK_DATA_VERSION = SPINEL_PROP_THREAD__BEGIN + 7, 2175 2176 /// Thread Local Stable Network Data 2177 /** Format `D` - Read only 2178 * 2179 */ 2180 SPINEL_PROP_THREAD_STABLE_NETWORK_DATA = SPINEL_PROP_THREAD__BEGIN + 8, 2181 2182 /// Thread Local Stable Network Data Version 2183 /** Format `C` - Read only 2184 * 2185 */ 2186 SPINEL_PROP_THREAD_STABLE_NETWORK_DATA_VERSION = SPINEL_PROP_THREAD__BEGIN + 9, 2187 2188 /// On-Mesh Prefixes 2189 /** Format: `A(t(6CbCbS))` 2190 * 2191 * Data per item is: 2192 * 2193 * `6`: IPv6 Prefix 2194 * `C`: Prefix length in bits 2195 * `b`: Stable flag 2196 * `C`: TLV flags 2197 * `b`: "Is defined locally" flag. Set if this network was locally 2198 * defined. Assumed to be true for set, insert and replace. Clear if 2199 * the on mesh network was defined by another node. 2200 * `S`: The RLOC16 of the device that registered this on-mesh prefix entry. 2201 * This value is not used and ignored when adding an on-mesh prefix. 2202 * 2203 */ 2204 SPINEL_PROP_THREAD_ON_MESH_NETS = SPINEL_PROP_THREAD__BEGIN + 10, 2205 2206 /// Off-mesh routes 2207 /** Format: [A(t(6CbCbb))] 2208 * 2209 * Data per item is: 2210 * 2211 * `6`: Route Prefix 2212 * `C`: Prefix length in bits 2213 * `b`: Stable flag 2214 * `C`: Route preference flags 2215 * `b`: "Is defined locally" flag. Set if this route info was locally 2216 * defined as part of local network data. Assumed to be true for set, 2217 * insert and replace. Clear if the route is part of partition's network 2218 * data. 2219 * `b`: "Next hop is this device" flag. Set if the next hop for the 2220 * route is this device itself (i.e., route was added by this device) 2221 * This value is ignored when adding an external route. For any added 2222 * route the next hop is this device. 2223 * `S`: The RLOC16 of the device that registered this route entry. 2224 * This value is not used and ignored when adding a route. 2225 * 2226 */ 2227 SPINEL_PROP_THREAD_OFF_MESH_ROUTES = SPINEL_PROP_THREAD__BEGIN + 11, 2228 2229 /// Thread Assisting Ports 2230 /** Format `A(S)` 2231 * 2232 * Array of port numbers. 2233 */ 2234 SPINEL_PROP_THREAD_ASSISTING_PORTS = SPINEL_PROP_THREAD__BEGIN + 12, 2235 2236 /// Thread Allow Local Network Data Change 2237 /** Format `b` - Read-write 2238 * 2239 * Set to true before changing local net data. Set to false when finished. 2240 * This allows changes to be aggregated into a single event. 2241 * 2242 */ 2243 SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE = SPINEL_PROP_THREAD__BEGIN + 13, 2244 2245 /// Thread Mode 2246 /** Format: `C` 2247 * 2248 * This property contains the value of the mode 2249 * TLV for this node. The meaning of the bits in this 2250 * bit-field are defined by section 4.5.2 of the Thread 2251 * specification. 2252 * 2253 * The values `SPINEL_THREAD_MODE_*` defines the bit-fields 2254 * 2255 */ 2256 SPINEL_PROP_THREAD_MODE = SPINEL_PROP_THREAD__BEGIN + 14, 2257 2258 SPINEL_PROP_THREAD__END = 0x60, 2259 2260 SPINEL_PROP_THREAD_EXT__BEGIN = 0x1500, 2261 2262 /// Thread Child Timeout 2263 /** Format: `L` 2264 * Unit: Seconds 2265 * 2266 * Used when operating in the Child role. 2267 */ 2268 SPINEL_PROP_THREAD_CHILD_TIMEOUT = SPINEL_PROP_THREAD_EXT__BEGIN + 0, 2269 2270 /// Thread RLOC16 2271 /** Format: `S` 2272 * 2273 */ 2274 SPINEL_PROP_THREAD_RLOC16 = SPINEL_PROP_THREAD_EXT__BEGIN + 1, 2275 2276 /// Thread Router Upgrade Threshold 2277 /** Format: `C` 2278 * 2279 */ 2280 SPINEL_PROP_THREAD_ROUTER_UPGRADE_THRESHOLD = SPINEL_PROP_THREAD_EXT__BEGIN + 2, 2281 2282 /// Thread Context Reuse Delay 2283 /** Format: `L` 2284 * 2285 */ 2286 SPINEL_PROP_THREAD_CONTEXT_REUSE_DELAY = SPINEL_PROP_THREAD_EXT__BEGIN + 3, 2287 2288 /// Thread Network ID Timeout 2289 /** Format: `C` 2290 * 2291 */ 2292 SPINEL_PROP_THREAD_NETWORK_ID_TIMEOUT = SPINEL_PROP_THREAD_EXT__BEGIN + 4, 2293 2294 /// List of active thread router ids 2295 /** Format: `A(C)` 2296 * 2297 * Note that some implementations may not support CMD_GET_VALUE 2298 * router ids, but may support CMD_REMOVE_VALUE when the node is 2299 * a leader. 2300 * 2301 */ 2302 SPINEL_PROP_THREAD_ACTIVE_ROUTER_IDS = SPINEL_PROP_THREAD_EXT__BEGIN + 5, 2303 2304 /// Forward IPv6 packets that use RLOC16 addresses to HOST. 2305 /** Format: `b` 2306 * 2307 * Allow host to directly observe all IPv6 packets received by the NCP, 2308 * including ones sent to the RLOC16 address. 2309 * 2310 * Default is false. 2311 * 2312 */ 2313 SPINEL_PROP_THREAD_RLOC16_DEBUG_PASSTHRU = SPINEL_PROP_THREAD_EXT__BEGIN + 6, 2314 2315 /// Router Role Enabled 2316 /** Format `b` 2317 * 2318 * Allows host to indicate whether or not the router role is enabled. 2319 * If current role is a router, setting this property to `false` starts 2320 * a re-attach process as an end-device. 2321 * 2322 */ 2323 SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED = SPINEL_PROP_THREAD_EXT__BEGIN + 7, 2324 2325 /// Thread Router Downgrade Threshold 2326 /** Format: `C` 2327 * 2328 */ 2329 SPINEL_PROP_THREAD_ROUTER_DOWNGRADE_THRESHOLD = SPINEL_PROP_THREAD_EXT__BEGIN + 8, 2330 2331 /// Thread Router Selection Jitter 2332 /** Format: `C` 2333 * 2334 */ 2335 SPINEL_PROP_THREAD_ROUTER_SELECTION_JITTER = SPINEL_PROP_THREAD_EXT__BEGIN + 9, 2336 2337 /// Thread Preferred Router Id 2338 /** Format: `C` - Write only 2339 * 2340 * Specifies the preferred Router Id. Upon becoming a router/leader the node 2341 * attempts to use this Router Id. If the preferred Router Id is not set or 2342 * if it can not be used, a randomly generated router id is picked. This 2343 * property can be set only when the device role is either detached or 2344 * disabled. 2345 * 2346 */ 2347 SPINEL_PROP_THREAD_PREFERRED_ROUTER_ID = SPINEL_PROP_THREAD_EXT__BEGIN + 10, 2348 2349 /// Thread Neighbor Table 2350 /** Format: `A(t(ESLCcCbLLc))` - Read only 2351 * 2352 * Data per item is: 2353 * 2354 * `E`: Extended address 2355 * `S`: RLOC16 2356 * `L`: Age (in seconds) 2357 * `C`: Link Quality In 2358 * `c`: Average RSS (in dBm) 2359 * `C`: Mode (bit-flags) 2360 * `b`: `true` if neighbor is a child, `false` otherwise. 2361 * `L`: Link Frame Counter 2362 * `L`: MLE Frame Counter 2363 * `c`: The last RSSI (in dBm) 2364 * 2365 */ 2366 SPINEL_PROP_THREAD_NEIGHBOR_TABLE = SPINEL_PROP_THREAD_EXT__BEGIN + 11, 2367 2368 /// Thread Max Child Count 2369 /** Format: `C` 2370 * 2371 * Specifies the maximum number of children currently allowed. 2372 * This parameter can only be set when Thread protocol operation 2373 * has been stopped. 2374 * 2375 */ 2376 SPINEL_PROP_THREAD_CHILD_COUNT_MAX = SPINEL_PROP_THREAD_EXT__BEGIN + 12, 2377 2378 /// Leader Network Data 2379 /** Format: `D` - Read only 2380 * 2381 */ 2382 SPINEL_PROP_THREAD_LEADER_NETWORK_DATA = SPINEL_PROP_THREAD_EXT__BEGIN + 13, 2383 2384 /// Stable Leader Network Data 2385 /** Format: `D` - Read only 2386 * 2387 */ 2388 SPINEL_PROP_THREAD_STABLE_LEADER_NETWORK_DATA = SPINEL_PROP_THREAD_EXT__BEGIN + 14, 2389 2390 /// Thread Joiner Data 2391 /** Format `A(T(ULE))` 2392 * PSKd, joiner timeout, eui64 (optional) 2393 * 2394 * This property is being deprecated by SPINEL_PROP_MESHCOP_COMMISSIONER_JOINERS. 2395 * 2396 */ 2397 SPINEL_PROP_THREAD_JOINERS = SPINEL_PROP_THREAD_EXT__BEGIN + 15, 2398 2399 /// Thread Commissioner Enable 2400 /** Format `b` 2401 * 2402 * Default value is `false`. 2403 * 2404 * This property is being deprecated by SPINEL_PROP_MESHCOP_COMMISSIONER_STATE. 2405 * 2406 */ 2407 SPINEL_PROP_THREAD_COMMISSIONER_ENABLED = SPINEL_PROP_THREAD_EXT__BEGIN + 16, 2408 2409 /// Thread TMF proxy enable 2410 /** Format `b` 2411 * Required capability: `SPINEL_CAP_THREAD_TMF_PROXY` 2412 * 2413 * This property is deprecated. 2414 * 2415 */ 2416 SPINEL_PROP_THREAD_TMF_PROXY_ENABLED = SPINEL_PROP_THREAD_EXT__BEGIN + 17, 2417 2418 /// Thread TMF proxy stream 2419 /** Format `dSS` 2420 * Required capability: `SPINEL_CAP_THREAD_TMF_PROXY` 2421 * 2422 * This property is deprecated. Please see `SPINEL_PROP_THREAD_UDP_FORWARD_STREAM`. 2423 * 2424 */ 2425 SPINEL_PROP_THREAD_TMF_PROXY_STREAM = SPINEL_PROP_THREAD_EXT__BEGIN + 18, 2426 2427 /// Thread "joiner" flag used during discovery scan operation 2428 /** Format `b` 2429 * 2430 * This property defines the Joiner Flag value in the Discovery Request TLV. 2431 * 2432 * Default value is `false`. 2433 * 2434 */ 2435 SPINEL_PROP_THREAD_DISCOVERY_SCAN_JOINER_FLAG = SPINEL_PROP_THREAD_EXT__BEGIN + 19, 2436 2437 /// Enable EUI64 filtering for discovery scan operation. 2438 /** Format `b` 2439 * 2440 * Default value is `false` 2441 * 2442 */ 2443 SPINEL_PROP_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING = SPINEL_PROP_THREAD_EXT__BEGIN + 20, 2444 2445 /// PANID used for Discovery scan operation (used for PANID filtering). 2446 /** Format: `S` 2447 * 2448 * Default value is 0xffff (Broadcast PAN) to disable PANID filtering 2449 * 2450 */ 2451 SPINEL_PROP_THREAD_DISCOVERY_SCAN_PANID = SPINEL_PROP_THREAD_EXT__BEGIN + 21, 2452 2453 /// Thread (out of band) steering data for MLE Discovery Response. 2454 /** Format `E` - Write only 2455 * 2456 * Required capability: SPINEL_CAP_OOB_STEERING_DATA. 2457 * 2458 * Writing to this property allows to set/update the MLE 2459 * Discovery Response steering data out of band. 2460 * 2461 * - All zeros to clear the steering data (indicating that 2462 * there is no steering data). 2463 * - All 0xFFs to set steering data/bloom filter to 2464 * accept/allow all. 2465 * - A specific EUI64 which is then added to current steering 2466 * data/bloom filter. 2467 * 2468 */ 2469 SPINEL_PROP_THREAD_STEERING_DATA = SPINEL_PROP_THREAD_EXT__BEGIN + 22, 2470 2471 /// Thread Router Table. 2472 /** Format: `A(t(ESCCCCCCb)` - Read only 2473 * 2474 * Data per item is: 2475 * 2476 * `E`: IEEE 802.15.4 Extended Address 2477 * `S`: RLOC16 2478 * `C`: Router ID 2479 * `C`: Next hop to router 2480 * `C`: Path cost to router 2481 * `C`: Link Quality In 2482 * `C`: Link Quality Out 2483 * `C`: Age (seconds since last heard) 2484 * `b`: Link established with Router ID or not. 2485 * 2486 */ 2487 SPINEL_PROP_THREAD_ROUTER_TABLE = SPINEL_PROP_THREAD_EXT__BEGIN + 23, 2488 2489 /// Thread Active Operational Dataset 2490 /** Format: `A(t(iD))` - Read-Write 2491 * 2492 * This property provides access to current Thread Active Operational Dataset. A Thread device maintains the 2493 * Operational Dataset that it has stored locally and the one currently in use by the partition to which it is 2494 * attached. This property corresponds to the locally stored Dataset on the device. 2495 * 2496 * Operational Dataset consists of a set of supported properties (e.g., channel, master key, network name, PAN id, 2497 * etc). Note that not all supported properties may be present (have a value) in a Dataset. 2498 * 2499 * The Dataset value is encoded as an array of structs containing pairs of property key (as `i`) followed by the 2500 * property value (as `D`). The property value must follow the format associated with the corresponding property. 2501 * 2502 * On write, any unknown/unsupported property keys must be ignored. 2503 * 2504 * The following properties can be included in a Dataset list: 2505 * 2506 * SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP 2507 * SPINEL_PROP_PHY_CHAN 2508 * SPINEL_PROP_PHY_CHAN_SUPPORTED (Channel Mask Page 0) 2509 * SPINEL_PROP_NET_MASTER_KEY 2510 * SPINEL_PROP_NET_NETWORK_NAME 2511 * SPINEL_PROP_NET_XPANID 2512 * SPINEL_PROP_MAC_15_4_PANID 2513 * SPINEL_PROP_IPV6_ML_PREFIX 2514 * SPINEL_PROP_NET_PSKC 2515 * SPINEL_PROP_DATASET_SECURITY_POLICY 2516 * 2517 */ 2518 SPINEL_PROP_THREAD_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 24, 2519 2520 /// Thread Pending Operational Dataset 2521 /** Format: `A(t(iD))` - Read-Write 2522 * 2523 * This property provide access to current locally stored Pending Operational Dataset. 2524 * 2525 * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_ACTIVE_DATASET. 2526 * 2527 * In addition supported properties in SPINEL_PROP_THREAD_ACTIVE_DATASET, the following properties can also 2528 * be included in the Pending Dataset: 2529 * 2530 * SPINEL_PROP_DATASET_PENDING_TIMESTAMP 2531 * SPINEL_PROP_DATASET_DELAY_TIMER 2532 * 2533 */ 2534 SPINEL_PROP_THREAD_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 25, 2535 2536 /// Send MGMT_SET Thread Active Operational Dataset 2537 /** Format: `A(t(iD))` - Write only 2538 * 2539 * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_ACTIVE_DATASET. 2540 * 2541 * This is write-only property. When written, it triggers a MGMT_ACTIVE_SET meshcop command to be sent to leader 2542 * with the given Dataset. The spinel frame response should be a `LAST_STATUS` with the status of the transmission 2543 * of MGMT_ACTIVE_SET command. 2544 * 2545 * In addition to supported properties in SPINEL_PROP_THREAD_ACTIVE_DATASET, the following property can be 2546 * included in the Dataset (to allow for custom raw TLVs): 2547 * 2548 * SPINEL_PROP_DATASET_RAW_TLVS 2549 * 2550 */ 2551 SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 26, 2552 2553 /// Send MGMT_SET Thread Pending Operational Dataset 2554 /** Format: `A(t(iD))` - Write only 2555 * 2556 * This property is similar to SPINEL_PROP_THREAD_PENDING_DATASET and follows the same format and rules. 2557 * 2558 * In addition to supported properties in SPINEL_PROP_THREAD_PENDING_DATASET, the following property can be 2559 * included the Dataset (to allow for custom raw TLVs to be provided). 2560 * 2561 * SPINEL_PROP_DATASET_RAW_TLVS 2562 * 2563 */ 2564 SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 27, 2565 2566 /// Operational Dataset Active Timestamp 2567 /** Format: `X` - No direct read or write 2568 * 2569 * It can only be included in one of the Dataset related properties below: 2570 * 2571 * SPINEL_PROP_THREAD_ACTIVE_DATASET 2572 * SPINEL_PROP_THREAD_PENDING_DATASET 2573 * SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET 2574 * SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET 2575 * SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET 2576 * SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET 2577 * 2578 */ 2579 SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP = SPINEL_PROP_THREAD_EXT__BEGIN + 28, 2580 2581 /// Operational Dataset Pending Timestamp 2582 /** Format: `X` - No direct read or write 2583 * 2584 * It can only be included in one of the Pending Dataset properties: 2585 * 2586 * SPINEL_PROP_THREAD_PENDING_DATASET 2587 * SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET 2588 * SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET 2589 * 2590 */ 2591 SPINEL_PROP_DATASET_PENDING_TIMESTAMP = SPINEL_PROP_THREAD_EXT__BEGIN + 29, 2592 2593 /// Operational Dataset Delay Timer 2594 /** Format: `L` - No direct read or write 2595 * 2596 * Delay timer (in ms) specifies the time renaming until Thread devices overwrite the value in the Active 2597 * Operational Dataset with the corresponding values in the Pending Operational Dataset. 2598 * 2599 * It can only be included in one of the Pending Dataset properties: 2600 * 2601 * SPINEL_PROP_THREAD_PENDING_DATASET 2602 * SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET 2603 * SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET 2604 * 2605 */ 2606 SPINEL_PROP_DATASET_DELAY_TIMER = SPINEL_PROP_THREAD_EXT__BEGIN + 30, 2607 2608 /// Operational Dataset Security Policy 2609 /** Format: `SC` - No direct read or write 2610 * 2611 * It can only be included in one of the Dataset related properties below: 2612 * 2613 * SPINEL_PROP_THREAD_ACTIVE_DATASET 2614 * SPINEL_PROP_THREAD_PENDING_DATASET 2615 * SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET 2616 * SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET 2617 * SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET 2618 * SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET 2619 * 2620 * Content is 2621 * `S` : Key Rotation Time (in units of hour) 2622 * `C` : Security Policy Flags (as specified in Thread 1.1 Section 8.10.1.15) 2623 * 2624 */ 2625 SPINEL_PROP_DATASET_SECURITY_POLICY = SPINEL_PROP_THREAD_EXT__BEGIN + 31, 2626 2627 /// Operational Dataset Additional Raw TLVs 2628 /** Format: `D` - No direct read or write 2629 * 2630 * This property defines extra raw TLVs that can be added to an Operational DataSet. 2631 * 2632 * It can only be included in one of the following Dataset properties: 2633 * 2634 * SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET 2635 * SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET 2636 * SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET 2637 * SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET 2638 * 2639 */ 2640 SPINEL_PROP_DATASET_RAW_TLVS = SPINEL_PROP_THREAD_EXT__BEGIN + 32, 2641 2642 /// Child table addresses 2643 /** Format: `A(t(ESA(6)))` - Read only 2644 * 2645 * This property provides the list of all addresses associated with every child 2646 * including any registered IPv6 addresses. 2647 * 2648 * Data per item is: 2649 * 2650 * `E`: Extended address of the child 2651 * `S`: RLOC16 of the child 2652 * `A(6)`: List of IPv6 addresses registered by the child (if any) 2653 * 2654 */ 2655 SPINEL_PROP_THREAD_CHILD_TABLE_ADDRESSES = SPINEL_PROP_THREAD_EXT__BEGIN + 33, 2656 2657 /// Neighbor Table Frame and Message Error Rates 2658 /** Format: `A(t(ESSScc))` 2659 * Required capability: `CAP_ERROR_RATE_TRACKING` 2660 * 2661 * This property provides link quality related info including 2662 * frame and (IPv6) message error rates for all neighbors. 2663 * 2664 * With regards to message error rate, note that a larger (IPv6) 2665 * message can be fragmented and sent as multiple MAC frames. The 2666 * message transmission is considered a failure, if any of its 2667 * fragments fail after all MAC retry attempts. 2668 * 2669 * Data per item is: 2670 * 2671 * `E`: Extended address of the neighbor 2672 * `S`: RLOC16 of the neighbor 2673 * `S`: Frame error rate (0 -> 0%, 0xffff -> 100%) 2674 * `S`: Message error rate (0 -> 0%, 0xffff -> 100%) 2675 * `c`: Average RSSI (in dBm) 2676 * `c`: Last RSSI (in dBm) 2677 * 2678 */ 2679 SPINEL_PROP_THREAD_NEIGHBOR_TABLE_ERROR_RATES = SPINEL_PROP_THREAD_EXT__BEGIN + 34, 2680 2681 /// EID (Endpoint Identifier) IPv6 Address Cache Table 2682 /** Format `A(t(6SCCt(bL6)t(bSS))) 2683 * 2684 * This property provides Thread EID address cache table. 2685 * 2686 * Data per item is: 2687 * 2688 * `6` : Target IPv6 address 2689 * `S` : RLOC16 of target 2690 * `C` : Age (order of use, 0 indicates most recently used entry) 2691 * `C` : Entry state (values are defined by enumeration `SPINEL_ADDRESS_CACHE_ENTRY_STATE_*`). 2692 * 2693 * `t` : Info when state is `SPINEL_ADDRESS_CACHE_ENTRY_STATE_CACHED` 2694 * `b` : Indicates whether last transaction time and ML-EID are valid. 2695 * `L` : Last transaction time 2696 * `6` : Mesh-local EID 2697 * 2698 * `t` : Info when state is other than `SPINEL_ADDRESS_CACHE_ENTRY_STATE_CACHED` 2699 * `b` : Indicates whether the entry can be evicted. 2700 * `S` : Timeout in seconds 2701 * `S` : Retry delay (applicable if in query-retry state). 2702 * 2703 */ 2704 SPINEL_PROP_THREAD_ADDRESS_CACHE_TABLE = SPINEL_PROP_THREAD_EXT__BEGIN + 35, 2705 2706 /// Thread UDP forward stream 2707 /** Format `dS6S` 2708 * Required capability: `SPINEL_CAP_THREAD_UDP_FORWARD` 2709 * 2710 * This property helps exchange UDP packets with host. 2711 * 2712 * `d`: UDP payload 2713 * `S`: Remote UDP port 2714 * `6`: Remote IPv6 address 2715 * `S`: Local UDP port 2716 * 2717 */ 2718 SPINEL_PROP_THREAD_UDP_FORWARD_STREAM = SPINEL_PROP_THREAD_EXT__BEGIN + 36, 2719 2720 /// Send MGMT_GET Thread Active Operational Dataset 2721 /** Format: `A(t(iD))` - Write only 2722 * 2723 * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET. This 2724 * property further allows the sender to not include a value associated with properties in formating of `t(iD)`, 2725 * i.e., it should accept either a `t(iD)` or a `t(i)` encoding (in both cases indicating that the associated 2726 * Dataset property should be requested as part of MGMT_GET command). 2727 * 2728 * This is write-only property. When written, it triggers a MGMT_ACTIVE_GET meshcop command to be sent to leader 2729 * requesting the Dataset related properties from the format. The spinel frame response should be a `LAST_STATUS` 2730 * with the status of the transmission of MGMT_ACTIVE_GET command. 2731 * 2732 * In addition to supported properties in SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET, the following property can be 2733 * optionally included in the Dataset: 2734 * 2735 * SPINEL_PROP_DATASET_DEST_ADDRESS 2736 * 2737 */ 2738 SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 37, 2739 2740 /// Send MGMT_GET Thread Pending Operational Dataset 2741 /** Format: `A(t(iD))` - Write only 2742 * 2743 * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET. 2744 * 2745 * This is write-only property. When written, it triggers a MGMT_PENDING_GET meshcop command to be sent to leader 2746 * with the given Dataset. The spinel frame response should be a `LAST_STATUS` with the status of the transmission 2747 * of MGMT_PENDING_GET command. 2748 * 2749 */ 2750 SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 38, 2751 2752 /// Operational Dataset (MGMT_GET) Destination IPv6 Address 2753 /** Format: `6` - No direct read or write 2754 * 2755 * This property specifies the IPv6 destination when sending MGMT_GET command for either Active or Pending Dataset 2756 * if not provided, Leader ALOC address is used as default. 2757 * 2758 * It can only be included in one of the MGMT_GET Dataset properties: 2759 * 2760 * SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET 2761 * SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET 2762 * 2763 */ 2764 SPINEL_PROP_DATASET_DEST_ADDRESS = SPINEL_PROP_THREAD_EXT__BEGIN + 39, 2765 2766 /// Thread New Operational Dataset 2767 /** Format: `A(t(iD))` - Read only - FTD build only 2768 * 2769 * This property allows host to request NCP to create and return a new Operation Dataset to use when forming a new 2770 * network. 2771 * 2772 * Operational Dataset consists of a set of supported properties (e.g., channel, master key, network name, PAN id, 2773 * etc). Note that not all supported properties may be present (have a value) in a Dataset. 2774 * 2775 * The Dataset value is encoded as an array of structs containing pairs of property key (as `i`) followed by the 2776 * property value (as `D`). The property value must follow the format associated with the corresponding property. 2777 * 2778 * The following properties can be included in a Dataset list: 2779 * 2780 * SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP 2781 * SPINEL_PROP_PHY_CHAN 2782 * SPINEL_PROP_PHY_CHAN_SUPPORTED (Channel Mask Page 0) 2783 * SPINEL_PROP_NET_MASTER_KEY 2784 * SPINEL_PROP_NET_NETWORK_NAME 2785 * SPINEL_PROP_NET_XPANID 2786 * SPINEL_PROP_MAC_15_4_PANID 2787 * SPINEL_PROP_IPV6_ML_PREFIX 2788 * SPINEL_PROP_NET_PSKC 2789 * SPINEL_PROP_DATASET_SECURITY_POLICY 2790 * 2791 */ 2792 SPINEL_PROP_THREAD_NEW_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 40, 2793 2794 SPINEL_PROP_THREAD_EXT__END = 0x1600, 2795 2796 SPINEL_PROP_IPV6__BEGIN = 0x60, 2797 2798 /// Link-Local IPv6 Address 2799 /** Format: `6` - Read only 2800 * 2801 */ 2802 SPINEL_PROP_IPV6_LL_ADDR = SPINEL_PROP_IPV6__BEGIN + 0, ///< [6] 2803 2804 /// Mesh Local IPv6 Address 2805 /** Format: `6` - Read only 2806 * 2807 */ 2808 SPINEL_PROP_IPV6_ML_ADDR = SPINEL_PROP_IPV6__BEGIN + 1, 2809 2810 /// Mesh Local Prefix 2811 /** Format: `6C` - Read-write 2812 * 2813 * Provides Mesh Local Prefix 2814 * 2815 * `6`: Mesh local prefix 2816 * `C` : Prefix length (64 bit for Thread). 2817 * 2818 */ 2819 SPINEL_PROP_IPV6_ML_PREFIX = SPINEL_PROP_IPV6__BEGIN + 2, 2820 2821 /// IPv6 (Unicast) Address Table 2822 /** Format: `A(t(6CLLC))` 2823 * 2824 * This property provides all unicast addresses. 2825 * 2826 * Array of structures containing: 2827 * 2828 * `6`: IPv6 Address 2829 * `C`: Network Prefix Length (in bits) 2830 * `L`: Valid Lifetime 2831 * `L`: Preferred Lifetime 2832 * 2833 */ 2834 SPINEL_PROP_IPV6_ADDRESS_TABLE = SPINEL_PROP_IPV6__BEGIN + 3, 2835 2836 /// IPv6 Route Table - Deprecated 2837 SPINEL_PROP_IPV6_ROUTE_TABLE = SPINEL_PROP_IPV6__BEGIN + 4, 2838 2839 /// IPv6 ICMP Ping Offload 2840 /** Format: `b` 2841 * 2842 * Allow the NCP to directly respond to ICMP ping requests. If this is 2843 * turned on, ping request ICMP packets will not be passed to the host. 2844 * 2845 * Default value is `false`. 2846 */ 2847 SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD = SPINEL_PROP_IPV6__BEGIN + 5, 2848 2849 /// IPv6 Multicast Address Table 2850 /** Format: `A(t(6))` 2851 * 2852 * This property provides all multicast addresses. 2853 * 2854 */ 2855 SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE = SPINEL_PROP_IPV6__BEGIN + 6, 2856 2857 /// IPv6 ICMP Ping Offload 2858 /** Format: `C` 2859 * 2860 * Allow the NCP to directly respond to ICMP ping requests. If this is 2861 * turned on, ping request ICMP packets will not be passed to the host. 2862 * 2863 * This property allows enabling responses sent to unicast only, multicast 2864 * only, or both. The valid value are defined by enumeration 2865 * `spinel_ipv6_icmp_ping_offload_mode_t`. 2866 * 2867 * SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED = 0 2868 * SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY = 1 2869 * SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY = 2 2870 * SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL = 3 2871 * 2872 * Default value is `NET_IPV6_ICMP_PING_OFFLOAD_DISABLED`. 2873 * 2874 */ 2875 SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD_MODE = SPINEL_PROP_IPV6__BEGIN + 7, ///< [b] 2876 2877 SPINEL_PROP_IPV6__END = 0x70, 2878 2879 SPINEL_PROP_IPV6_EXT__BEGIN = 0x1600, 2880 SPINEL_PROP_IPV6_EXT__END = 0x1700, 2881 2882 SPINEL_PROP_STREAM__BEGIN = 0x70, 2883 2884 /// Debug Stream 2885 /** Format: `U` (stream, read only) 2886 * 2887 * This property is a streaming property, meaning that you cannot explicitly 2888 * fetch the value of this property. The stream provides human-readable debugging 2889 * output which may be displayed in the host logs. 2890 * 2891 * The location of newline characters is not assumed by the host: it is 2892 * the NCP's responsibility to insert newline characters where needed, 2893 * just like with any other text stream. 2894 * 2895 * To receive the debugging stream, you wait for `CMD_PROP_VALUE_IS` 2896 * commands for this property from the NCP. 2897 * 2898 */ 2899 SPINEL_PROP_STREAM_DEBUG = SPINEL_PROP_STREAM__BEGIN + 0, 2900 2901 /// Raw Stream 2902 /** Format: `dD` (stream, read only) 2903 * Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO 2904 * 2905 * This stream provides the capability of sending and receiving raw 15.4 frames 2906 * to and from the radio. The exact format of the frame metadata and data is 2907 * dependent on the MAC and PHY being used. 2908 * 2909 * This property is a streaming property, meaning that you cannot explicitly 2910 * fetch the value of this property. To receive traffic, you wait for 2911 * `CMD_PROP_VALUE_IS` commands with this property id from the NCP. 2912 * 2913 * The general format of this property is: 2914 * 2915 * `d` : frame data 2916 * `D` : frame meta data 2917 * 2918 * The frame meta data is optional. Frame metadata MAY be empty or partially 2919 * specified. Partially specified metadata MUST be accepted. Default values 2920 * are used for all unspecified fields. 2921 * 2922 * The frame metadata field consists of the following fields: 2923 * 2924 * `c` : Received Signal Strength (RSSI) in dBm - default is -128 2925 * `c` : Noise floor in dBm - default is -128 2926 * `S` : Flags (see below). 2927 * `d` : PHY-specific data/struct 2928 * `d` : Vendor-specific data/struct 2929 * 2930 * Flags fields are defined by the following enumeration bitfields: 2931 * 2932 * SPINEL_MD_FLAG_TX = 0x0001 : Packet was transmitted, not received. 2933 * SPINEL_MD_FLAG_BAD_FCS = 0x0004 : Packet was received with bad FCS 2934 * SPINEL_MD_FLAG_DUPE = 0x0008 : Packet seems to be a duplicate 2935 * SPINEL_MD_FLAG_RESERVED = 0xFFF2 : Flags reserved for future use. 2936 * 2937 * The format of PHY-specific data for a Thread device contains the following 2938 * optional fields: 2939 2940 * `C` : 802.15.4 channel (Receive channel) 2941 * `C` : IEEE 802.15.4 LQI 2942 * `L` : The timestamp milliseconds 2943 * `S` : The timestamp microseconds, offset to mMsec 2944 * 2945 * Frames written to this stream with `CMD_PROP_VALUE_SET` will be sent out 2946 * over the radio. This allows the caller to use the radio directly. 2947 * 2948 * The frame meta data for the `CMD_PROP_VALUE_SET` contains the following 2949 * optional fields. Default values are used for all unspecified fields. 2950 * 2951 * `C` : Channel (for frame tx) 2952 * `C` : Maximum number of backoffs attempts before declaring CCA failure 2953 * (use Thread stack default if not specified) 2954 * `C` : Maximum number of retries allowed after a transmission failure 2955 * (use Thread stack default if not specified) 2956 * `b` : Set to true to enable CSMA-CA for this packet, false otherwise. 2957 * (default true). 2958 * `b` : Set to true to indicate it is a retransmission packet, false otherwise. 2959 * (default false). 2960 * `b` : Set to true to indicate that SubMac should skip AES processing, false otherwise. 2961 * (default false). 2962 * 2963 */ 2964 SPINEL_PROP_STREAM_RAW = SPINEL_PROP_STREAM__BEGIN + 1, 2965 2966 /// (IPv6) Network Stream 2967 /** Format: `dD` (stream, read only) 2968 * 2969 * This stream provides the capability of sending and receiving (IPv6) 2970 * data packets to and from the currently attached network. The packets 2971 * are sent or received securely (encryption and authentication). 2972 * 2973 * This property is a streaming property, meaning that you cannot explicitly 2974 * fetch the value of this property. To receive traffic, you wait for 2975 * `CMD_PROP_VALUE_IS` commands with this property id from the NCP. 2976 * 2977 * To send network packets, you call `CMD_PROP_VALUE_SET` on this property with 2978 * the value of the packet. 2979 * 2980 * The general format of this property is: 2981 * 2982 * `d` : packet data 2983 * `D` : packet meta data 2984 * 2985 * The packet metadata is optional. Packet meta data MAY be empty or partially 2986 * specified. Partially specified metadata MUST be accepted. Default values 2987 * are used for all unspecified fields. 2988 * 2989 * For OpenThread the meta data is currently empty. 2990 * 2991 */ 2992 SPINEL_PROP_STREAM_NET = SPINEL_PROP_STREAM__BEGIN + 2, 2993 2994 /// (IPv6) Network Stream Insecure 2995 /** Format: `dD` (stream, read only) 2996 * 2997 * This stream provides the capability of sending and receiving unencrypted 2998 * and unauthenticated data packets to and from nearby devices for the 2999 * purposes of device commissioning. 3000 * 3001 * This property is a streaming property, meaning that you cannot explicitly 3002 * fetch the value of this property. To receive traffic, you wait for 3003 * `CMD_PROP_VALUE_IS` commands with this property id from the NCP. 3004 * 3005 * To send network packets, you call `CMD_PROP_VALUE_SET` on this property with 3006 * the value of the packet. 3007 * 3008 * The general format of this property is: 3009 * 3010 * `d` : packet data 3011 * `D` : packet meta data 3012 * 3013 * The packet metadata is optional. Packet meta data MAY be empty or partially 3014 * specified. Partially specified metadata MUST be accepted. Default values 3015 * are used for all unspecified fields. 3016 * 3017 * For OpenThread the meta data is currently empty. 3018 * 3019 */ 3020 SPINEL_PROP_STREAM_NET_INSECURE = SPINEL_PROP_STREAM__BEGIN + 3, 3021 3022 /// Log Stream 3023 /** Format: `UD` (stream, read only) 3024 * 3025 * This property is a read-only streaming property which provides 3026 * formatted log string from NCP. This property provides asynchronous 3027 * `CMD_PROP_VALUE_IS` updates with a new log string and includes 3028 * optional meta data. 3029 * 3030 * `U`: The log string 3031 * `D`: Log metadata (optional). 3032 * 3033 * Any data after the log string is considered metadata and is OPTIONAL. 3034 * Presence of `SPINEL_CAP_OPENTHREAD_LOG_METADATA` capability 3035 * indicates that OpenThread log metadata format is used as defined 3036 * below: 3037 * 3038 * `C`: Log level (as per definition in enumeration 3039 * `SPINEL_NCP_LOG_LEVEL_<level>`) 3040 * `i`: OpenThread Log region (as per definition in enumeration 3041 * `SPINEL_NCP_LOG_REGION_<region>). 3042 * `X`: Log timestamp = <timestamp_base> + <current_time_ms> 3043 * 3044 */ 3045 SPINEL_PROP_STREAM_LOG = SPINEL_PROP_STREAM__BEGIN + 4, 3046 3047 SPINEL_PROP_STREAM__END = 0x80, 3048 3049 SPINEL_PROP_STREAM_EXT__BEGIN = 0x1700, 3050 SPINEL_PROP_STREAM_EXT__END = 0x1800, 3051 3052 SPINEL_PROP_MESHCOP__BEGIN = 0x80, 3053 3054 // Thread Joiner State 3055 /** Format `C` - Read Only 3056 * 3057 * Required capability: SPINEL_CAP_THREAD_JOINER 3058 * 3059 * The valid values are specified by `spinel_meshcop_joiner_state_t` (`SPINEL_MESHCOP_JOINER_STATE_<state>`) 3060 * enumeration. 3061 * 3062 */ 3063 SPINEL_PROP_MESHCOP_JOINER_STATE = SPINEL_PROP_MESHCOP__BEGIN + 0, ///<[C] 3064 3065 /// Thread Joiner Commissioning command and the parameters 3066 /** Format `b` or `bU(UUUUU)` (fields in parenthesis are optional) - Write Only 3067 * 3068 * This property starts or stops Joiner's commissioning process 3069 * 3070 * Required capability: SPINEL_CAP_THREAD_JOINER 3071 * 3072 * Writing to this property starts/stops the Joiner commissioning process. 3073 * The immediate `VALUE_IS` response indicates success/failure of the starting/stopping 3074 * the Joiner commissioning process. 3075 * 3076 * After a successful start operation, the join process outcome is reported through an 3077 * asynchronous `VALUE_IS(LAST_STATUS)` update with one of the following error status values: 3078 * 3079 * - SPINEL_STATUS_JOIN_SUCCESS the join process succeeded. 3080 * - SPINEL_STATUS_JOIN_SECURITY the join process failed due to security credentials. 3081 * - SPINEL_STATUS_JOIN_NO_PEERS no joinable network was discovered. 3082 * - SPINEL_STATUS_JOIN_RSP_TIMEOUT if a response timed out. 3083 * - SPINEL_STATUS_JOIN_FAILURE join failure. 3084 * 3085 * Frame format: 3086 * 3087 * `b` : Start or stop commissioning process (true to start). 3088 * 3089 * Only if the start commissioning. 3090 * 3091 * `U` : Joiner's PSKd. 3092 * 3093 * The next fields are all optional. If not provided, OpenThread default values would be used. 3094 * 3095 * `U` : Provisioning URL (use empty string if not required). 3096 * `U` : Vendor Name. If not specified or empty string, use OpenThread default (PACKAGE_NAME). 3097 * `U` : Vendor Model. If not specified or empty string, use OpenThread default (OPENTHREAD_CONFIG_PLATFORM_INFO). 3098 * `U` : Vendor Sw Version. If not specified or empty string, use OpenThread default (PACKAGE_VERSION). 3099 * `U` : Vendor Data String. Will not be appended if not specified. 3100 * 3101 */ 3102 SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING = SPINEL_PROP_MESHCOP__BEGIN + 1, 3103 3104 // Thread Commissioner State 3105 /** Format `C` 3106 * 3107 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3108 * 3109 * The valid values are specified by SPINEL_MESHCOP_COMMISSIONER_STATE_<state> enumeration. 3110 * 3111 */ 3112 SPINEL_PROP_MESHCOP_COMMISSIONER_STATE = SPINEL_PROP_MESHCOP__BEGIN + 2, 3113 3114 // Thread Commissioner Joiners 3115 /** Format `A(t(t(E|CX)UL))` - get, insert or remove. 3116 * 3117 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3118 * 3119 * Data per array entry is: 3120 * 3121 * `t()` | `t(E)` | `t(CX)` : Joiner info struct (formatting varies). 3122 * 3123 * - `t()` or empty struct indicates any joiner. 3124 * - `t(E)` specifies the Joiner EUI-64. 3125 * - `t(CX) specifies Joiner Discerner, `C` is Discerner length (in bits), and `X` is Discerner value. 3126 * 3127 * The struct is followed by: 3128 * 3129 * `L` : Timeout after which to remove Joiner (when written should be in seconds, when read is in milliseconds) 3130 * `U` : PSKd 3131 * 3132 * For CMD_PROP_VALUE_REMOVE the timeout and PSKd are optional. 3133 * 3134 */ 3135 SPINEL_PROP_MESHCOP_COMMISSIONER_JOINERS = SPINEL_PROP_MESHCOP__BEGIN + 3, 3136 3137 // Thread Commissioner Provisioning URL 3138 /** Format `U` 3139 * 3140 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3141 * 3142 */ 3143 SPINEL_PROP_MESHCOP_COMMISSIONER_PROVISIONING_URL = SPINEL_PROP_MESHCOP__BEGIN + 4, 3144 3145 // Thread Commissioner Session ID 3146 /** Format `S` - Read only 3147 * 3148 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3149 * 3150 */ 3151 SPINEL_PROP_MESHCOP_COMMISSIONER_SESSION_ID = SPINEL_PROP_MESHCOP__BEGIN + 5, 3152 3153 /// Thread Joiner Discerner 3154 /** Format `CX` - Read-write 3155 * 3156 * Required capability: SPINEL_CAP_THREAD_JOINER 3157 * 3158 * This property represents a Joiner Discerner. 3159 * 3160 * The Joiner Discerner is used to calculate the Joiner ID used during commissioning/joining process. 3161 * 3162 * By default (when a discerner is not provided or cleared), Joiner ID is derived as first 64 bits of the result 3163 * of computing SHA-256 over factory-assigned IEEE EUI-64. Note that this is the main behavior expected by Thread 3164 * specification. 3165 * 3166 * Format: 3167 * 3168 * 'C' : The Joiner Discerner bit length (number of bits). 3169 * `X` : The Joiner Discerner value (64-bit unsigned) - Only present/applicable when length is non-zero. 3170 * 3171 * When writing to this property, the length can be set to zero to clear any previously set Joiner Discerner value. 3172 * 3173 * When reading this property if there is no currently set Joiner Discerner, zero is returned as the length (with 3174 * no value field). 3175 * 3176 */ 3177 SPINEL_PROP_MESHCOP_JOINER_DISCERNER = SPINEL_PROP_MESHCOP__BEGIN + 6, 3178 3179 SPINEL_PROP_MESHCOP__END = 0x90, 3180 3181 SPINEL_PROP_MESHCOP_EXT__BEGIN = 0x1800, 3182 3183 // Thread Commissioner Announce Begin 3184 /** Format `LCS6` - Write only 3185 * 3186 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3187 * 3188 * Writing to this property sends an Announce Begin message with the specified parameters. Response is a 3189 * `LAST_STATUS` update with status of operation. 3190 * 3191 * `L` : Channel mask 3192 * `C` : Number of messages per channel 3193 * `S` : The time between two successive MLE Announce transmissions (milliseconds) 3194 * `6` : IPv6 destination 3195 * 3196 */ 3197 SPINEL_PROP_MESHCOP_COMMISSIONER_ANNOUNCE_BEGIN = SPINEL_PROP_MESHCOP_EXT__BEGIN + 0, 3198 3199 // Thread Commissioner Energy Scan Query 3200 /** Format `LCSS6` - Write only 3201 * 3202 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3203 * 3204 * Writing to this property sends an Energy Scan Query message with the specified parameters. Response is a 3205 * `LAST_STATUS` with status of operation. The energy scan results are emitted asynchronously through 3206 * `SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN_RESULT` updates. 3207 * 3208 * Format is: 3209 * 3210 * `L` : Channel mask 3211 * `C` : The number of energy measurements per channel 3212 * `S` : The time between energy measurements (milliseconds) 3213 * `S` : The scan duration for each energy measurement (milliseconds) 3214 * `6` : IPv6 destination. 3215 * 3216 */ 3217 SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN = SPINEL_PROP_MESHCOP_EXT__BEGIN + 1, 3218 3219 // Thread Commissioner Energy Scan Result 3220 /** Format `Ld` - Asynchronous event only 3221 * 3222 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3223 * 3224 * This property provides asynchronous `CMD_PROP_VALUE_INSERTED` updates to report energy scan results for a 3225 * previously sent Energy Scan Query message (please see `SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN`). 3226 * 3227 * Format is: 3228 * 3229 * `L` : Channel mask 3230 * `d` : Energy measurement data (note that `d` encoding includes the length) 3231 * 3232 */ 3233 SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN_RESULT = SPINEL_PROP_MESHCOP_EXT__BEGIN + 2, 3234 3235 // Thread Commissioner PAN ID Query 3236 /** Format `SL6` - Write only 3237 * 3238 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3239 * 3240 * Writing to this property sends a PAN ID Query message with the specified parameters. Response is a 3241 * `LAST_STATUS` with status of operation. The PAN ID Conflict results are emitted asynchronously through 3242 * `SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_CONFLICT_RESULT` updates. 3243 * 3244 * Format is: 3245 * 3246 * `S` : PAN ID to query 3247 * `L` : Channel mask 3248 * `6` : IPv6 destination 3249 * 3250 */ 3251 SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_QUERY = SPINEL_PROP_MESHCOP_EXT__BEGIN + 3, 3252 3253 // Thread Commissioner PAN ID Conflict Result 3254 /** Format `SL` - Asynchronous event only 3255 * 3256 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3257 * 3258 * This property provides asynchronous `CMD_PROP_VALUE_INSERTED` updates to report PAN ID conflict results for a 3259 * previously sent PAN ID Query message (please see `SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_QUERY`). 3260 * 3261 * Format is: 3262 * 3263 * `S` : The PAN ID 3264 * `L` : Channel mask 3265 * 3266 */ 3267 SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_CONFLICT_RESULT = SPINEL_PROP_MESHCOP_EXT__BEGIN + 4, 3268 3269 // Thread Commissioner Send MGMT_COMMISSIONER_GET 3270 /** Format `d` - Write only 3271 * 3272 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3273 * 3274 * Writing to this property sends a MGMT_COMMISSIONER_GET message with the specified parameters. Response is a 3275 * `LAST_STATUS` with status of operation. 3276 * 3277 * Format is: 3278 * 3279 * `d` : List of TLV types to get 3280 * 3281 */ 3282 SPINEL_PROP_MESHCOP_COMMISSIONER_MGMT_GET = SPINEL_PROP_MESHCOP_EXT__BEGIN + 5, 3283 3284 // Thread Commissioner Send MGMT_COMMISSIONER_SET 3285 /** Format `d` - Write only 3286 * 3287 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3288 * 3289 * Writing to this property sends a MGMT_COMMISSIONER_SET message with the specified parameters. Response is a 3290 * `LAST_STATUS` with status of operation. 3291 * 3292 * Format is: 3293 * 3294 * `d` : TLV encoded data 3295 * 3296 */ 3297 SPINEL_PROP_MESHCOP_COMMISSIONER_MGMT_SET = SPINEL_PROP_MESHCOP_EXT__BEGIN + 6, 3298 3299 // Thread Commissioner Generate PSKc 3300 /** Format: `UUd` - Write only 3301 * 3302 * Required capability: SPINEL_CAP_THREAD_COMMISSIONER 3303 * 3304 * Writing to this property allows user to generate PSKc from a given commissioning pass-phrase, network name, 3305 * extended PAN Id. 3306 * 3307 * Written value format is: 3308 * 3309 * `U` : The commissioning pass-phrase. 3310 * `U` : Network Name. 3311 * `d` : Extended PAN ID. 3312 * 3313 * The response on success would be a `VALUE_IS` command with the PSKc with format below: 3314 * 3315 * `D` : The PSKc 3316 * 3317 * On a failure a `LAST_STATUS` is emitted with the error status. 3318 * 3319 */ 3320 SPINEL_PROP_MESHCOP_COMMISSIONER_GENERATE_PSKC = SPINEL_PROP_MESHCOP_EXT__BEGIN + 7, 3321 3322 SPINEL_PROP_MESHCOP_EXT__END = 0x1900, 3323 3324 SPINEL_PROP_OPENTHREAD__BEGIN = 0x1900, 3325 3326 /// Channel Manager - Channel Change New Channel 3327 /** Format: `C` (read-write) 3328 * 3329 * Required capability: SPINEL_CAP_CHANNEL_MANAGER 3330 * 3331 * Setting this property triggers the Channel Manager to start 3332 * a channel change process. The network switches to the given 3333 * channel after the specified delay (see `CHANNEL_MANAGER_DELAY`). 3334 * 3335 * A subsequent write to this property will cancel an ongoing 3336 * (previously requested) channel change. 3337 * 3338 */ 3339 SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL = SPINEL_PROP_OPENTHREAD__BEGIN + 0, 3340 3341 /// Channel Manager - Channel Change Delay 3342 /** Format 'S' 3343 * Units: seconds 3344 * 3345 * Required capability: SPINEL_CAP_CHANNEL_MANAGER 3346 * 3347 * This property specifies the delay (in seconds) to be used for 3348 * a channel change request. 3349 * 3350 * The delay should preferably be longer than maximum data poll 3351 * interval used by all sleepy-end-devices within the Thread 3352 * network. 3353 * 3354 */ 3355 SPINEL_PROP_CHANNEL_MANAGER_DELAY = SPINEL_PROP_OPENTHREAD__BEGIN + 1, 3356 3357 /// Channel Manager Supported Channels 3358 /** Format 'A(C)' 3359 * 3360 * Required capability: SPINEL_CAP_CHANNEL_MANAGER 3361 * 3362 * This property specifies the list of supported channels. 3363 * 3364 */ 3365 SPINEL_PROP_CHANNEL_MANAGER_SUPPORTED_CHANNELS = SPINEL_PROP_OPENTHREAD__BEGIN + 2, 3366 3367 /// Channel Manager Favored Channels 3368 /** Format 'A(C)' 3369 * 3370 * Required capability: SPINEL_CAP_CHANNEL_MANAGER 3371 * 3372 * This property specifies the list of favored channels (when `ChannelManager` is asked to select channel) 3373 * 3374 */ 3375 SPINEL_PROP_CHANNEL_MANAGER_FAVORED_CHANNELS = SPINEL_PROP_OPENTHREAD__BEGIN + 3, 3376 3377 /// Channel Manager Channel Select Trigger 3378 /** Format 'b' 3379 * 3380 * Required capability: SPINEL_CAP_CHANNEL_MANAGER 3381 * 3382 * Writing to this property triggers a request on `ChannelManager` to select a new channel. 3383 * 3384 * Once a Channel Select is triggered, the Channel Manager will perform the following 3 steps: 3385 * 3386 * 1) `ChannelManager` decides if the channel change would be helpful. This check can be skipped if in the input 3387 * boolean to this property is set to `true` (skipping the quality check). 3388 * This step uses the collected link quality metrics on the device such as CCA failure rate, frame and message 3389 * error rates per neighbor, etc. to determine if the current channel quality is at the level that justifies 3390 * a channel change. 3391 * 3392 * 2) If first step passes, then `ChannelManager` selects a potentially better channel. It uses the collected 3393 * channel quality data by `ChannelMonitor` module. The supported and favored channels are used at this step. 3394 * 3395 * 3) If the newly selected channel is different from the current channel, `ChannelManager` requests/starts the 3396 * channel change process. 3397 * 3398 * Reading this property always yields `false`. 3399 * 3400 */ 3401 SPINEL_PROP_CHANNEL_MANAGER_CHANNEL_SELECT = SPINEL_PROP_OPENTHREAD__BEGIN + 4, 3402 3403 /// Channel Manager Auto Channel Selection Enabled 3404 /** Format 'b' 3405 * 3406 * Required capability: SPINEL_CAP_CHANNEL_MANAGER 3407 * 3408 * This property indicates if auto-channel-selection functionality is enabled/disabled on `ChannelManager`. 3409 * 3410 * When enabled, `ChannelManager` will periodically checks and attempts to select a new channel. The period interval 3411 * is specified by `SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_INTERVAL`. 3412 * 3413 */ 3414 SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_ENABLED = SPINEL_PROP_OPENTHREAD__BEGIN + 5, 3415 3416 /// Channel Manager Auto Channel Selection Interval 3417 /** Format 'L' 3418 * units: seconds 3419 * 3420 * Required capability: SPINEL_CAP_CHANNEL_MANAGER 3421 * 3422 * This property specifies the auto-channel-selection check interval (in seconds). 3423 * 3424 */ 3425 SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_INTERVAL = SPINEL_PROP_OPENTHREAD__BEGIN + 6, 3426 3427 /// Thread network time. 3428 /** Format: `Xc` - Read only 3429 * 3430 * Data per item is: 3431 * 3432 * `X`: The Thread network time, in microseconds. 3433 * `c`: Time synchronization status. 3434 * 3435 */ 3436 SPINEL_PROP_THREAD_NETWORK_TIME = SPINEL_PROP_OPENTHREAD__BEGIN + 7, 3437 3438 /// Thread time synchronization period 3439 /** Format: `S` - Read-Write 3440 * 3441 * Data per item is: 3442 * 3443 * `S`: Time synchronization period, in seconds. 3444 * 3445 */ 3446 SPINEL_PROP_TIME_SYNC_PERIOD = SPINEL_PROP_OPENTHREAD__BEGIN + 8, 3447 3448 /// Thread Time synchronization XTAL accuracy threshold for Router 3449 /** Format: `S` - Read-Write 3450 * 3451 * Data per item is: 3452 * 3453 * `S`: The XTAL accuracy threshold for Router, in PPM. 3454 * 3455 */ 3456 SPINEL_PROP_TIME_SYNC_XTAL_THRESHOLD = SPINEL_PROP_OPENTHREAD__BEGIN + 9, 3457 3458 /// Child Supervision Interval 3459 /** Format: `S` - Read-Write 3460 * Units: Seconds 3461 * 3462 * Required capability: `SPINEL_CAP_CHILD_SUPERVISION` 3463 * 3464 * The child supervision interval (in seconds). Zero indicates that child supervision is disabled. 3465 * 3466 * When enabled, Child supervision feature ensures that at least one message is sent to every sleepy child within 3467 * the given supervision interval. If there is no other message, a supervision message (a data message with empty 3468 * payload) is enqueued and sent to the child. 3469 * 3470 * This property is available for FTD build only. 3471 * 3472 */ 3473 SPINEL_PROP_CHILD_SUPERVISION_INTERVAL = SPINEL_PROP_OPENTHREAD__BEGIN + 10, 3474 3475 /// Child Supervision Check Timeout 3476 /** Format: `S` - Read-Write 3477 * Units: Seconds 3478 * 3479 * Required capability: `SPINEL_CAP_CHILD_SUPERVISION` 3480 * 3481 * The child supervision check timeout interval (in seconds). Zero indicates supervision check on the child is 3482 * disabled. 3483 * 3484 * Supervision check is only applicable on a sleepy child. When enabled, if the child does not hear from its parent 3485 * within the specified check timeout, it initiates a re-attach process by starting an MLE Child Update 3486 * Request/Response exchange with the parent. 3487 * 3488 * This property is available for FTD and MTD builds. 3489 * 3490 */ 3491 SPINEL_PROP_CHILD_SUPERVISION_CHECK_TIMEOUT = SPINEL_PROP_OPENTHREAD__BEGIN + 11, 3492 3493 // RCP (NCP in radio only mode) version 3494 /** Format `U` - Read only 3495 * 3496 * Required capability: SPINEL_CAP_POSIX 3497 * 3498 * This property gives the version string of RCP (NCP in radio mode) which is being controlled by a POSIX 3499 * application. It is available only in "POSIX" platform (i.e., `OPENTHREAD_PLATFORM_POSIX` is enabled). 3500 * 3501 */ 3502 SPINEL_PROP_RCP_VERSION = SPINEL_PROP_OPENTHREAD__BEGIN + 12, 3503 3504 /// Thread Parent Response info 3505 /** Format: `ESccCCCb` - Asynchronous event only 3506 * 3507 * `E`: Extended address 3508 * `S`: RLOC16 3509 * `c`: Instant RSSI 3510 * 'c': Parent Priority 3511 * `C`: Link Quality3 3512 * `C`: Link Quality2 3513 * `C`: Link Quality1 3514 * 'b': Is the node receiving parent response frame attached 3515 * 3516 * This property sends Parent Response frame information to the Host. 3517 * This property is available for FTD build only. 3518 * 3519 */ 3520 SPINEL_PROP_PARENT_RESPONSE_INFO = SPINEL_PROP_OPENTHREAD__BEGIN + 13, 3521 3522 /// SLAAC enabled 3523 /** Format `b` - Read-Write 3524 * Required capability: `SPINEL_CAP_SLAAC` 3525 * 3526 * This property allows the host to enable/disable SLAAC module on NCP at run-time. When SLAAC module is enabled, 3527 * SLAAC addresses (based on on-mesh prefixes in Network Data) are added to the interface. When SLAAC module is 3528 * disabled any previously added SLAAC address is removed. 3529 * 3530 */ 3531 SPINEL_PROP_SLAAC_ENABLED = SPINEL_PROP_OPENTHREAD__BEGIN + 14, 3532 3533 SPINEL_PROP_OPENTHREAD__END = 0x2000, 3534 3535 SPINEL_PROP_SERVER__BEGIN = 0xA0, 3536 3537 /// Server Allow Local Network Data Change 3538 /** Format `b` - Read-write 3539 * 3540 * Required capability: SPINEL_CAP_THREAD_SERVICE 3541 * 3542 * Set to true before changing local server net data. Set to false when finished. 3543 * This allows changes to be aggregated into a single event. 3544 * 3545 */ 3546 SPINEL_PROP_SERVER_ALLOW_LOCAL_DATA_CHANGE = SPINEL_PROP_SERVER__BEGIN + 0, 3547 3548 // Server Services 3549 /** Format: `A(t(LdbdS))` 3550 * 3551 * This property provides all services registered on the device 3552 * 3553 * Required capability: SPINEL_CAP_THREAD_SERVICE 3554 * 3555 * Array of structures containing: 3556 * 3557 * `L`: Enterprise Number 3558 * `d`: Service Data 3559 * `b`: Stable 3560 * `d`: Server Data 3561 * `S`: RLOC 3562 * 3563 */ 3564 SPINEL_PROP_SERVER_SERVICES = SPINEL_PROP_SERVER__BEGIN + 1, 3565 3566 // Server Leader Services 3567 /** Format: `A(t(CLdbdS))` 3568 * 3569 * This property provides all services registered on the leader 3570 * 3571 * Array of structures containing: 3572 * 3573 * `C`: Service ID 3574 * `L`: Enterprise Number 3575 * `d`: Service Data 3576 * `b`: Stable 3577 * `d`: Server Data 3578 * `S`: RLOC 3579 * 3580 */ 3581 SPINEL_PROP_SERVER_LEADER_SERVICES = SPINEL_PROP_SERVER__BEGIN + 2, 3582 3583 SPINEL_PROP_SERVER__END = 0xB0, 3584 3585 SPINEL_PROP_INTERFACE__BEGIN = 0x100, 3586 3587 /// UART Bitrate 3588 /** Format: `L` 3589 * 3590 * If the NCP is using a UART to communicate with the host, 3591 * this property allows the host to change the bitrate 3592 * of the serial connection. The value encoding is `L`, 3593 * which is a little-endian 32-bit unsigned integer. 3594 * The host should not assume that all possible numeric values 3595 * are supported. 3596 * 3597 * If implemented by the NCP, this property should be persistent 3598 * across software resets and forgotten upon hardware resets. 3599 * 3600 * This property is only implemented when a UART is being 3601 * used for Spinel. This property is optional. 3602 * 3603 * When changing the bitrate, all frames will be received 3604 * at the previous bitrate until the response frame to this command 3605 * is received. Once a successful response frame is received by 3606 * the host, all further frames will be transmitted at the new 3607 * bitrate. 3608 */ 3609 SPINEL_PROP_UART_BITRATE = SPINEL_PROP_INTERFACE__BEGIN + 0, 3610 3611 /// UART Software Flow Control 3612 /** Format: `b` 3613 * 3614 * If the NCP is using a UART to communicate with the host, 3615 * this property allows the host to determine if software flow 3616 * control (XON/XOFF style) should be used and (optionally) to 3617 * turn it on or off. 3618 * 3619 * This property is only implemented when a UART is being 3620 * used for Spinel. This property is optional. 3621 */ 3622 SPINEL_PROP_UART_XON_XOFF = SPINEL_PROP_INTERFACE__BEGIN + 1, 3623 3624 SPINEL_PROP_INTERFACE__END = 0x200, 3625 3626 SPINEL_PROP_15_4_PIB__BEGIN = 0x400, 3627 // For direct access to the 802.15.4 PID. 3628 // Individual registers are fetched using 3629 // `SPINEL_PROP_15_4_PIB__BEGIN+[PIB_IDENTIFIER]` 3630 // Only supported if SPINEL_CAP_15_4_PIB is set. 3631 // 3632 // For brevity, the entire 802.15.4 PIB space is 3633 // not defined here, but a few choice attributes 3634 // are defined for illustration and convenience. 3635 SPINEL_PROP_15_4_PIB_PHY_CHANNELS_SUPPORTED = SPINEL_PROP_15_4_PIB__BEGIN + 0x01, ///< [A(L)] 3636 SPINEL_PROP_15_4_PIB_MAC_PROMISCUOUS_MODE = SPINEL_PROP_15_4_PIB__BEGIN + 0x51, ///< [b] 3637 SPINEL_PROP_15_4_PIB_MAC_SECURITY_ENABLED = SPINEL_PROP_15_4_PIB__BEGIN + 0x5d, ///< [b] 3638 SPINEL_PROP_15_4_PIB__END = 0x500, 3639 3640 SPINEL_PROP_CNTR__BEGIN = 0x500, 3641 3642 /// Counter reset 3643 /** Format: Empty (Write only). 3644 * 3645 * Writing to this property (with any value) will reset all MAC, MLE, IP, and NCP counters to zero. 3646 * 3647 */ 3648 SPINEL_PROP_CNTR_RESET = SPINEL_PROP_CNTR__BEGIN + 0, 3649 3650 /// The total number of transmissions. 3651 /** Format: `L` (Read-only) */ 3652 SPINEL_PROP_CNTR_TX_PKT_TOTAL = SPINEL_PROP_CNTR__BEGIN + 1, 3653 3654 /// The number of transmissions with ack request. 3655 /** Format: `L` (Read-only) */ 3656 SPINEL_PROP_CNTR_TX_PKT_ACK_REQ = SPINEL_PROP_CNTR__BEGIN + 2, 3657 3658 /// The number of transmissions that were acked. 3659 /** Format: `L` (Read-only) */ 3660 SPINEL_PROP_CNTR_TX_PKT_ACKED = SPINEL_PROP_CNTR__BEGIN + 3, 3661 3662 /// The number of transmissions without ack request. 3663 /** Format: `L` (Read-only) */ 3664 SPINEL_PROP_CNTR_TX_PKT_NO_ACK_REQ = SPINEL_PROP_CNTR__BEGIN + 4, 3665 3666 /// The number of transmitted data. 3667 /** Format: `L` (Read-only) */ 3668 SPINEL_PROP_CNTR_TX_PKT_DATA = SPINEL_PROP_CNTR__BEGIN + 5, 3669 3670 /// The number of transmitted data poll. 3671 /** Format: `L` (Read-only) */ 3672 SPINEL_PROP_CNTR_TX_PKT_DATA_POLL = SPINEL_PROP_CNTR__BEGIN + 6, 3673 3674 /// The number of transmitted beacon. 3675 /** Format: `L` (Read-only) */ 3676 SPINEL_PROP_CNTR_TX_PKT_BEACON = SPINEL_PROP_CNTR__BEGIN + 7, 3677 3678 /// The number of transmitted beacon request. 3679 /** Format: `L` (Read-only) */ 3680 SPINEL_PROP_CNTR_TX_PKT_BEACON_REQ = SPINEL_PROP_CNTR__BEGIN + 8, 3681 3682 /// The number of transmitted other types of frames. 3683 /** Format: `L` (Read-only) */ 3684 SPINEL_PROP_CNTR_TX_PKT_OTHER = SPINEL_PROP_CNTR__BEGIN + 9, 3685 3686 /// The number of retransmission times. 3687 /** Format: `L` (Read-only) */ 3688 SPINEL_PROP_CNTR_TX_PKT_RETRY = SPINEL_PROP_CNTR__BEGIN + 10, 3689 3690 /// The number of CCA failure times. 3691 /** Format: `L` (Read-only) */ 3692 SPINEL_PROP_CNTR_TX_ERR_CCA = SPINEL_PROP_CNTR__BEGIN + 11, 3693 3694 /// The number of unicast packets transmitted. 3695 /** Format: `L` (Read-only) */ 3696 SPINEL_PROP_CNTR_TX_PKT_UNICAST = SPINEL_PROP_CNTR__BEGIN + 12, 3697 3698 /// The number of broadcast packets transmitted. 3699 /** Format: `L` (Read-only) */ 3700 SPINEL_PROP_CNTR_TX_PKT_BROADCAST = SPINEL_PROP_CNTR__BEGIN + 13, 3701 3702 /// The number of frame transmission failures due to abort error. 3703 /** Format: `L` (Read-only) */ 3704 SPINEL_PROP_CNTR_TX_ERR_ABORT = SPINEL_PROP_CNTR__BEGIN + 14, 3705 3706 /// The total number of received packets. 3707 /** Format: `L` (Read-only) */ 3708 SPINEL_PROP_CNTR_RX_PKT_TOTAL = SPINEL_PROP_CNTR__BEGIN + 100, 3709 3710 /// The number of received data. 3711 /** Format: `L` (Read-only) */ 3712 SPINEL_PROP_CNTR_RX_PKT_DATA = SPINEL_PROP_CNTR__BEGIN + 101, 3713 3714 /// The number of received data poll. 3715 /** Format: `L` (Read-only) */ 3716 SPINEL_PROP_CNTR_RX_PKT_DATA_POLL = SPINEL_PROP_CNTR__BEGIN + 102, 3717 3718 /// The number of received beacon. 3719 /** Format: `L` (Read-only) */ 3720 SPINEL_PROP_CNTR_RX_PKT_BEACON = SPINEL_PROP_CNTR__BEGIN + 103, 3721 3722 /// The number of received beacon request. 3723 /** Format: `L` (Read-only) */ 3724 SPINEL_PROP_CNTR_RX_PKT_BEACON_REQ = SPINEL_PROP_CNTR__BEGIN + 104, 3725 3726 /// The number of received other types of frames. 3727 /** Format: `L` (Read-only) */ 3728 SPINEL_PROP_CNTR_RX_PKT_OTHER = SPINEL_PROP_CNTR__BEGIN + 105, 3729 3730 /// The number of received packets filtered by whitelist. 3731 /** Format: `L` (Read-only) */ 3732 SPINEL_PROP_CNTR_RX_PKT_FILT_WL = SPINEL_PROP_CNTR__BEGIN + 106, 3733 3734 /// The number of received packets filtered by destination check. 3735 /** Format: `L` (Read-only) */ 3736 SPINEL_PROP_CNTR_RX_PKT_FILT_DA = SPINEL_PROP_CNTR__BEGIN + 107, 3737 3738 /// The number of received packets that are empty. 3739 /** Format: `L` (Read-only) */ 3740 SPINEL_PROP_CNTR_RX_ERR_EMPTY = SPINEL_PROP_CNTR__BEGIN + 108, 3741 3742 /// The number of received packets from an unknown neighbor. 3743 /** Format: `L` (Read-only) */ 3744 SPINEL_PROP_CNTR_RX_ERR_UKWN_NBR = SPINEL_PROP_CNTR__BEGIN + 109, 3745 3746 /// The number of received packets whose source address is invalid. 3747 /** Format: `L` (Read-only) */ 3748 SPINEL_PROP_CNTR_RX_ERR_NVLD_SADDR = SPINEL_PROP_CNTR__BEGIN + 110, 3749 3750 /// The number of received packets with a security error. 3751 /** Format: `L` (Read-only) */ 3752 SPINEL_PROP_CNTR_RX_ERR_SECURITY = SPINEL_PROP_CNTR__BEGIN + 111, 3753 3754 /// The number of received packets with a checksum error. 3755 /** Format: `L` (Read-only) */ 3756 SPINEL_PROP_CNTR_RX_ERR_BAD_FCS = SPINEL_PROP_CNTR__BEGIN + 112, 3757 3758 /// The number of received packets with other errors. 3759 /** Format: `L` (Read-only) */ 3760 SPINEL_PROP_CNTR_RX_ERR_OTHER = SPINEL_PROP_CNTR__BEGIN + 113, 3761 3762 /// The number of received duplicated. 3763 /** Format: `L` (Read-only) */ 3764 SPINEL_PROP_CNTR_RX_PKT_DUP = SPINEL_PROP_CNTR__BEGIN + 114, 3765 3766 /// The number of unicast packets received. 3767 /** Format: `L` (Read-only) */ 3768 SPINEL_PROP_CNTR_RX_PKT_UNICAST = SPINEL_PROP_CNTR__BEGIN + 115, 3769 3770 /// The number of broadcast packets received. 3771 /** Format: `L` (Read-only) */ 3772 SPINEL_PROP_CNTR_RX_PKT_BROADCAST = SPINEL_PROP_CNTR__BEGIN + 116, 3773 3774 /// The total number of secure transmitted IP messages. 3775 /** Format: `L` (Read-only) */ 3776 SPINEL_PROP_CNTR_TX_IP_SEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 200, 3777 3778 /// The total number of insecure transmitted IP messages. 3779 /** Format: `L` (Read-only) */ 3780 SPINEL_PROP_CNTR_TX_IP_INSEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 201, 3781 3782 /// The number of dropped (not transmitted) IP messages. 3783 /** Format: `L` (Read-only) */ 3784 SPINEL_PROP_CNTR_TX_IP_DROPPED = SPINEL_PROP_CNTR__BEGIN + 202, 3785 3786 /// The total number of secure received IP message. 3787 /** Format: `L` (Read-only) */ 3788 SPINEL_PROP_CNTR_RX_IP_SEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 203, 3789 3790 /// The total number of insecure received IP message. 3791 /** Format: `L` (Read-only) */ 3792 SPINEL_PROP_CNTR_RX_IP_INSEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 204, 3793 3794 /// The number of dropped received IP messages. 3795 /** Format: `L` (Read-only) */ 3796 SPINEL_PROP_CNTR_RX_IP_DROPPED = SPINEL_PROP_CNTR__BEGIN + 205, 3797 3798 /// The number of transmitted spinel frames. 3799 /** Format: `L` (Read-only) */ 3800 SPINEL_PROP_CNTR_TX_SPINEL_TOTAL = SPINEL_PROP_CNTR__BEGIN + 300, 3801 3802 /// The number of received spinel frames. 3803 /** Format: `L` (Read-only) */ 3804 SPINEL_PROP_CNTR_RX_SPINEL_TOTAL = SPINEL_PROP_CNTR__BEGIN + 301, 3805 3806 /// The number of received spinel frames with error. 3807 /** Format: `L` (Read-only) */ 3808 SPINEL_PROP_CNTR_RX_SPINEL_ERR = SPINEL_PROP_CNTR__BEGIN + 302, 3809 3810 /// Number of out of order received spinel frames (tid increase by more than 1). 3811 /** Format: `L` (Read-only) */ 3812 SPINEL_PROP_CNTR_RX_SPINEL_OUT_OF_ORDER_TID = SPINEL_PROP_CNTR__BEGIN + 303, 3813 3814 /// The number of successful Tx IP packets 3815 /** Format: `L` (Read-only) */ 3816 SPINEL_PROP_CNTR_IP_TX_SUCCESS = SPINEL_PROP_CNTR__BEGIN + 304, 3817 3818 /// The number of successful Rx IP packets 3819 /** Format: `L` (Read-only) */ 3820 SPINEL_PROP_CNTR_IP_RX_SUCCESS = SPINEL_PROP_CNTR__BEGIN + 305, 3821 3822 /// The number of failed Tx IP packets 3823 /** Format: `L` (Read-only) */ 3824 SPINEL_PROP_CNTR_IP_TX_FAILURE = SPINEL_PROP_CNTR__BEGIN + 306, 3825 3826 /// The number of failed Rx IP packets 3827 /** Format: `L` (Read-only) */ 3828 SPINEL_PROP_CNTR_IP_RX_FAILURE = SPINEL_PROP_CNTR__BEGIN + 307, 3829 3830 /// The message buffer counter info 3831 /** Format: `SSSSSSSSSSSSSSSS` (Read-only) 3832 * `S`, (TotalBuffers) The number of buffers in the pool. 3833 * `S`, (FreeBuffers) The number of free message buffers. 3834 * `S`, (6loSendMessages) The number of messages in the 6lo send queue. 3835 * `S`, (6loSendBuffers) The number of buffers in the 6lo send queue. 3836 * `S`, (6loReassemblyMessages) The number of messages in the 6LoWPAN reassembly queue. 3837 * `S`, (6loReassemblyBuffers) The number of buffers in the 6LoWPAN reassembly queue. 3838 * `S`, (Ip6Messages) The number of messages in the IPv6 send queue. 3839 * `S`, (Ip6Buffers) The number of buffers in the IPv6 send queue. 3840 * `S`, (MplMessages) The number of messages in the MPL send queue. 3841 * `S`, (MplBuffers) The number of buffers in the MPL send queue. 3842 * `S`, (MleMessages) The number of messages in the MLE send queue. 3843 * `S`, (MleBuffers) The number of buffers in the MLE send queue. 3844 * `S`, (ArpMessages) The number of messages in the ARP send queue. 3845 * `S`, (ArpBuffers) The number of buffers in the ARP send queue. 3846 * `S`, (CoapMessages) The number of messages in the CoAP send queue. 3847 * `S`, (CoapBuffers) The number of buffers in the CoAP send queue. 3848 */ 3849 SPINEL_PROP_MSG_BUFFER_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 400, 3850 3851 /// All MAC related counters. 3852 /** Format: t(A(L))t(A(L)) 3853 * 3854 * The contents include two structs, first one corresponds to 3855 * all transmit related MAC counters, second one provides the 3856 * receive related counters. 3857 * 3858 * The transmit structure includes: 3859 * 3860 * 'L': TxTotal (The total number of transmissions). 3861 * 'L': TxUnicast (The total number of unicast transmissions). 3862 * 'L': TxBroadcast (The total number of broadcast transmissions). 3863 * 'L': TxAckRequested (The number of transmissions with ack request). 3864 * 'L': TxAcked (The number of transmissions that were acked). 3865 * 'L': TxNoAckRequested (The number of transmissions without ack request). 3866 * 'L': TxData (The number of transmitted data). 3867 * 'L': TxDataPoll (The number of transmitted data poll). 3868 * 'L': TxBeacon (The number of transmitted beacon). 3869 * 'L': TxBeaconRequest (The number of transmitted beacon request). 3870 * 'L': TxOther (The number of transmitted other types of frames). 3871 * 'L': TxRetry (The number of retransmission times). 3872 * 'L': TxErrCca (The number of CCA failure times). 3873 * 'L': TxErrAbort (The number of frame transmission failures due to abort error). 3874 * 'L': TxErrBusyChannel (The number of frames that were dropped due to a busy channel). 3875 * 'L': TxDirectMaxRetryExpiry (The number of expired retransmission retries for direct message). 3876 * 'L': TxIndirectMaxRetryExpiry (The number of expired retransmission retries for indirect message). 3877 * 3878 * The receive structure includes: 3879 * 3880 * 'L': RxTotal (The total number of received packets). 3881 * 'L': RxUnicast (The total number of unicast packets received). 3882 * 'L': RxBroadcast (The total number of broadcast packets received). 3883 * 'L': RxData (The number of received data). 3884 * 'L': RxDataPoll (The number of received data poll). 3885 * 'L': RxBeacon (The number of received beacon). 3886 * 'L': RxBeaconRequest (The number of received beacon request). 3887 * 'L': RxOther (The number of received other types of frames). 3888 * 'L': RxAddressFiltered (The number of received packets filtered by address filter 3889 * (whitelist or blacklist)). 3890 * 'L': RxDestAddrFiltered (The number of received packets filtered by destination check). 3891 * 'L': RxDuplicated (The number of received duplicated packets). 3892 * 'L': RxErrNoFrame (The number of received packets with no or malformed content). 3893 * 'L': RxErrUnknownNeighbor (The number of received packets from unknown neighbor). 3894 * 'L': RxErrInvalidSrcAddr (The number of received packets whose source address is invalid). 3895 * 'L': RxErrSec (The number of received packets with security error). 3896 * 'L': RxErrFcs (The number of received packets with FCS error). 3897 * 'L': RxErrOther (The number of received packets with other error). 3898 * 3899 * Writing to this property with any value would reset all MAC counters to zero. 3900 * 3901 */ 3902 SPINEL_PROP_CNTR_ALL_MAC_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 401, 3903 3904 /// Thread MLE counters. 3905 /** Format: `SSSSSSSSS` 3906 * 3907 * 'S': DisabledRole (The number of times device entered OT_DEVICE_ROLE_DISABLED role). 3908 * 'S': DetachedRole (The number of times device entered OT_DEVICE_ROLE_DETACHED role). 3909 * 'S': ChildRole (The number of times device entered OT_DEVICE_ROLE_CHILD role). 3910 * 'S': RouterRole (The number of times device entered OT_DEVICE_ROLE_ROUTER role). 3911 * 'S': LeaderRole (The number of times device entered OT_DEVICE_ROLE_LEADER role). 3912 * 'S': AttachAttempts (The number of attach attempts while device was detached). 3913 * 'S': PartitionIdChanges (The number of changes to partition ID). 3914 * 'S': BetterPartitionAttachAttempts (The number of attempts to attach to a better partition). 3915 * 'S': ParentChanges (The number of times device changed its parents). 3916 * 3917 * Writing to this property with any value would reset all MLE counters to zero. 3918 * 3919 */ 3920 SPINEL_PROP_CNTR_MLE_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 402, 3921 3922 /// Thread IPv6 counters. 3923 /** Format: `t(LL)t(LL)` 3924 * 3925 * The contents include two structs, first one corresponds to 3926 * all transmit related MAC counters, second one provides the 3927 * receive related counters. 3928 * 3929 * The transmit structure includes: 3930 * 'L': TxSuccess (The number of IPv6 packets successfully transmitted). 3931 * 'L': TxFailure (The number of IPv6 packets failed to transmit). 3932 * 3933 * The receive structure includes: 3934 * 'L': RxSuccess (The number of IPv6 packets successfully received). 3935 * 'L': RxFailure (The number of IPv6 packets failed to receive). 3936 * 3937 * Writing to this property with any value would reset all IPv6 counters to zero. 3938 * 3939 */ 3940 SPINEL_PROP_CNTR_ALL_IP_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 403, 3941 3942 /// MAC retry histogram. 3943 /** Format: t(A(L))t(A(L)) 3944 * 3945 * Required capability: SPINEL_CAP_MAC_RETRY_HISTOGRAM 3946 * 3947 * The contents include two structs, first one is histogram which corresponds to retransmissions number of direct 3948 * messages, second one provides the histogram of retransmissions for indirect messages. 3949 * 3950 * The first structure includes: 3951 * 'L': DirectRetry[0] (The number of packets after 0 retry). 3952 * 'L': DirectRetry[1] (The number of packets after 1 retry). 3953 * ... 3954 * 'L': DirectRetry[n] (The number of packets after n retry). 3955 * 3956 * The size of the array is OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_MAX_SIZE_COUNT_DIRECT. 3957 * 3958 * The second structure includes: 3959 * 'L': IndirectRetry[0] (The number of packets after 0 retry). 3960 * 'L': IndirectRetry[1] (The number of packets after 1 retry). 3961 * ... 3962 * 'L': IndirectRetry[m] (The number of packets after m retry). 3963 * 3964 * The size of the array is OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_MAX_SIZE_COUNT_INDIRECT. 3965 * 3966 * Writing to this property with any value would reset MAC retry histogram. 3967 * 3968 */ 3969 SPINEL_PROP_CNTR_MAC_RETRY_HISTOGRAM = SPINEL_PROP_CNTR__BEGIN + 404, 3970 3971 SPINEL_PROP_CNTR__END = 0x800, 3972 3973 SPINEL_PROP_RCP__BEGIN = 0x800, 3974 3975 /// MAC Key 3976 /** Format: `CCddd`. 3977 * 3978 * `C`: MAC key ID mode 3979 * `C`: MAC key ID 3980 * `d`: previous MAC key material data 3981 * `d`: current MAC key material data 3982 * `d`: next MAC key material data 3983 * 3984 * The Spinel property is used to set/get MAC key materials to and from RCP. 3985 * 3986 */ 3987 SPINEL_PROP_RCP_MAC_KEY = SPINEL_PROP_RCP__BEGIN + 0, 3988 3989 /// MAC Frame Counter 3990 /** Format: `L`. 3991 * 3992 * `L`: MAC frame counter 3993 * 3994 * The Spinel property is used to set MAC frame counter to RCP. 3995 * 3996 */ 3997 SPINEL_PROP_RCP_MAC_FRAME_COUNTER = SPINEL_PROP_RCP__BEGIN + 1, 3998 3999 /// Timestamps when Spinel frame is received and transmitted 4000 /** Format: `X`. 4001 * 4002 * `X`: Spinel frame transmit timestamp 4003 * 4004 * The Spinel property is used to get timestamp from RCP to calculate host and RCP timer difference. 4005 * 4006 */ 4007 SPINEL_PROP_RCP_TIMESTAMP = SPINEL_PROP_RCP__BEGIN + 2, 4008 4009 SPINEL_PROP_RCP__END = 0x900, 4010 4011 SPINEL_PROP_NEST__BEGIN = 0x3BC0, 4012 4013 SPINEL_PROP_NEST_STREAM_MFG = SPINEL_PROP_NEST__BEGIN + 0, 4014 4015 /// The legacy network ULA prefix (8 bytes) 4016 /** Format: 'D' */ 4017 SPINEL_PROP_NEST_LEGACY_ULA_PREFIX = SPINEL_PROP_NEST__BEGIN + 1, 4018 4019 /// The EUI64 of last node joined using legacy protocol (if none, all zero EUI64 is returned). 4020 /** Format: 'E' */ 4021 SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED = SPINEL_PROP_NEST__BEGIN + 2, 4022 4023 SPINEL_PROP_NEST__END = 0x3C00, 4024 4025 SPINEL_PROP_VENDOR__BEGIN = 0x3C00, 4026 SPINEL_PROP_VENDOR__END = 0x4000, 4027 4028 SPINEL_PROP_DEBUG__BEGIN = 0x4000, 4029 4030 /// Testing platform assert 4031 /** Format: 'b' (read-only) 4032 * 4033 * Reading this property will cause an assert on the NCP. This is intended for testing the assert functionality of 4034 * underlying platform/NCP. Assert should ideally cause the NCP to reset, but if this is not supported a `false` 4035 * boolean is returned in response. 4036 * 4037 */ 4038 SPINEL_PROP_DEBUG_TEST_ASSERT = SPINEL_PROP_DEBUG__BEGIN + 0, 4039 4040 /// The NCP log level. 4041 /** Format: `C` */ 4042 SPINEL_PROP_DEBUG_NCP_LOG_LEVEL = SPINEL_PROP_DEBUG__BEGIN + 1, 4043 4044 /// Testing platform watchdog 4045 /** Format: Empty (read-only) 4046 * 4047 * Reading this property will causes NCP to start a `while(true) ;` loop and thus triggering a watchdog. 4048 * 4049 * This is intended for testing the watchdog functionality on the underlying platform/NCP. 4050 * 4051 */ 4052 SPINEL_PROP_DEBUG_TEST_WATCHDOG = SPINEL_PROP_DEBUG__BEGIN + 2, 4053 4054 /// The NCP timestamp base 4055 /** Format: X (write-only) 4056 * 4057 * This property controls the time base value that is used for logs timestamp field calculation. 4058 * 4059 */ 4060 SPINEL_PROP_DEBUG_LOG_TIMESTAMP_BASE = SPINEL_PROP_DEBUG__BEGIN + 3, 4061 4062 SPINEL_PROP_DEBUG__END = 0x4400, 4063 4064 SPINEL_PROP_EXPERIMENTAL__BEGIN = 2000000, 4065 SPINEL_PROP_EXPERIMENTAL__END = 2097152, 4066 }; 4067 4068 typedef uint32_t spinel_prop_key_t; 4069 4070 // ---------------------------------------------------------------------------- 4071 4072 #define SPINEL_HEADER_FLAG 0x80 4073 4074 #define SPINEL_HEADER_TID_SHIFT 0 4075 #define SPINEL_HEADER_TID_MASK (15 << SPINEL_HEADER_TID_SHIFT) 4076 4077 #define SPINEL_HEADER_IID_SHIFT 4 4078 #define SPINEL_HEADER_IID_MASK (3 << SPINEL_HEADER_IID_SHIFT) 4079 4080 #define SPINEL_HEADER_IID_0 (0 << SPINEL_HEADER_IID_SHIFT) 4081 #define SPINEL_HEADER_IID_1 (1 << SPINEL_HEADER_IID_SHIFT) 4082 #define SPINEL_HEADER_IID_2 (2 << SPINEL_HEADER_IID_SHIFT) 4083 #define SPINEL_HEADER_IID_3 (3 << SPINEL_HEADER_IID_SHIFT) 4084 4085 #define SPINEL_HEADER_GET_IID(x) (((x)&SPINEL_HEADER_IID_MASK) >> SPINEL_HEADER_IID_SHIFT) 4086 #define SPINEL_HEADER_GET_TID(x) (spinel_tid_t)(((x)&SPINEL_HEADER_TID_MASK) >> SPINEL_HEADER_TID_SHIFT) 4087 4088 #define SPINEL_GET_NEXT_TID(x) (spinel_tid_t)((x) >= 0xF ? 1 : (x) + 1) 4089 4090 #define SPINEL_BEACON_THREAD_FLAG_VERSION_SHIFT 4 4091 4092 #define SPINEL_BEACON_THREAD_FLAG_VERSION_MASK (0xf << SPINEL_BEACON_THREAD_FLAG_VERSION_SHIFT) 4093 4094 #define SPINEL_BEACON_THREAD_FLAG_JOINABLE (1 << 0) 4095 4096 #define SPINEL_BEACON_THREAD_FLAG_NATIVE (1 << 3) 4097 4098 // ---------------------------------------------------------------------------- 4099 4100 enum 4101 { 4102 SPINEL_DATATYPE_NULL_C = 0, 4103 SPINEL_DATATYPE_VOID_C = '.', 4104 SPINEL_DATATYPE_BOOL_C = 'b', 4105 SPINEL_DATATYPE_UINT8_C = 'C', 4106 SPINEL_DATATYPE_INT8_C = 'c', 4107 SPINEL_DATATYPE_UINT16_C = 'S', 4108 SPINEL_DATATYPE_INT16_C = 's', 4109 SPINEL_DATATYPE_UINT32_C = 'L', 4110 SPINEL_DATATYPE_INT32_C = 'l', 4111 SPINEL_DATATYPE_UINT64_C = 'X', 4112 SPINEL_DATATYPE_INT64_C = 'x', 4113 SPINEL_DATATYPE_UINT_PACKED_C = 'i', 4114 SPINEL_DATATYPE_IPv6ADDR_C = '6', 4115 SPINEL_DATATYPE_EUI64_C = 'E', 4116 SPINEL_DATATYPE_EUI48_C = 'e', 4117 SPINEL_DATATYPE_DATA_WLEN_C = 'd', 4118 SPINEL_DATATYPE_DATA_C = 'D', 4119 SPINEL_DATATYPE_UTF8_C = 'U', //!< Zero-Terminated UTF8-Encoded String 4120 SPINEL_DATATYPE_STRUCT_C = 't', 4121 SPINEL_DATATYPE_ARRAY_C = 'A', 4122 }; 4123 4124 typedef char spinel_datatype_t; 4125 4126 #define SPINEL_DATATYPE_NULL_S "" 4127 #define SPINEL_DATATYPE_VOID_S "." 4128 #define SPINEL_DATATYPE_BOOL_S "b" 4129 #define SPINEL_DATATYPE_UINT8_S "C" 4130 #define SPINEL_DATATYPE_INT8_S "c" 4131 #define SPINEL_DATATYPE_UINT16_S "S" 4132 #define SPINEL_DATATYPE_INT16_S "s" 4133 #define SPINEL_DATATYPE_UINT32_S "L" 4134 #define SPINEL_DATATYPE_INT32_S "l" 4135 #define SPINEL_DATATYPE_UINT64_S "X" 4136 #define SPINEL_DATATYPE_INT64_S "x" 4137 #define SPINEL_DATATYPE_UINT_PACKED_S "i" 4138 #define SPINEL_DATATYPE_IPv6ADDR_S "6" 4139 #define SPINEL_DATATYPE_EUI64_S "E" 4140 #define SPINEL_DATATYPE_EUI48_S "e" 4141 #define SPINEL_DATATYPE_DATA_WLEN_S "d" 4142 #define SPINEL_DATATYPE_DATA_S "D" 4143 #define SPINEL_DATATYPE_UTF8_S "U" //!< Zero-Terminated UTF8-Encoded String 4144 4145 #define SPINEL_DATATYPE_ARRAY_S(x) "A(" x ")" 4146 #define SPINEL_DATATYPE_STRUCT_S(x) "t(" x ")" 4147 4148 #define SPINEL_DATATYPE_ARRAY_STRUCT_S(x) SPINEL_DATATYPE_ARRAY_S(SPINEL_DATATYPE_STRUCT_WLEN_S(x)) 4149 4150 #define SPINEL_DATATYPE_COMMAND_S \ 4151 SPINEL_DATATYPE_UINT8_S /* header */ \ 4152 SPINEL_DATATYPE_UINT_PACKED_S /* command */ 4153 4154 #define SPINEL_DATATYPE_COMMAND_PROP_S \ 4155 SPINEL_DATATYPE_COMMAND_S /* prop command */ \ 4156 SPINEL_DATATYPE_UINT_PACKED_S /* property id */ 4157 4158 #define SPINEL_MAX_UINT_PACKED 2097151 4159 4160 SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_pack(uint8_t * data_out, 4161 spinel_size_t data_len_max, 4162 const char * pack_format, 4163 ...); 4164 SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vpack(uint8_t * data_out, 4165 spinel_size_t data_len_max, 4166 const char * pack_format, 4167 va_list args); 4168 SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_unpack(const uint8_t *data_in, 4169 spinel_size_t data_len, 4170 const char * pack_format, 4171 ...); 4172 /** 4173 * This function parses spinel data similar to sscanf(). 4174 * 4175 * This function actually calls spinel_datatype_vunpack_in_place() to parse data. 4176 * 4177 * @param[in] data_in A pointer to the data to parse. 4178 * @param[in] data_len The length of @p data_in in bytes. 4179 * @param[in] pack_format C string that contains a format string follows the same specification of spinel. 4180 * @param[in] ... Additional arguments depending on the format string @p pack_format. 4181 * 4182 * @returns The parsed length in bytes. 4183 * 4184 * @note This function behaves different from `spinel_datatype_unpack()`: 4185 * - This function expects composite data arguments of pointer to data type, while `spinel_datatype_unpack()` 4186 * expects them of pointer to data type pointer. For example, if `SPINEL_DATATYPE_EUI64_C` is present in 4187 * @p pack_format, this function expects a `spinel_eui64_t *` is included in variable arguments, while 4188 * `spinel_datatype_unpack()` expects a `spinel_eui64_t **` is included. 4189 * - For `SPINEL_DATATYPE_UTF8_C`, this function expects two arguments, the first of type `char *` and the 4190 * second is of type `size_t` to indicate length of the provided buffer in the first argument just like 4191 * `strncpy()`, while `spinel_datatype_unpack()` only expects a `const char **`. 4192 * 4193 * @sa spinel_datatype_vunpack_in_place() 4194 * 4195 */ 4196 SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_unpack_in_place(const uint8_t *data_in, 4197 spinel_size_t data_len, 4198 const char * pack_format, 4199 ...); 4200 SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vunpack(const uint8_t *data_in, 4201 spinel_size_t data_len, 4202 const char * pack_format, 4203 va_list args); 4204 /** 4205 * This function parses spinel data similar to vsscanf(). 4206 * 4207 * @param[in] data_in A pointer to the data to parse. 4208 * @param[in] data_len The length of @p data_in in bytes. 4209 * @param[in] pack_format C string that contains a format string follows the same specification of spinel. 4210 * @param[in] args A value identifying a variable arguments list. 4211 * 4212 * @returns The parsed length in bytes. 4213 * 4214 * @note This function behaves different from `spinel_datatype_vunpack()`: 4215 * - This function expects composite data arguments of pointer to data type, while `spinel_datatype_vunpack()` 4216 * expects them of pointer to data type pointer. For example, if `SPINEL_DATATYPE_EUI64_C` is present in 4217 * @p pack_format, this function expects a `spinel_eui64_t *` is included in variable arguments, while 4218 * `spinel_datatype_vunpack()` expects a `spinel_eui64_t **` is included. 4219 * - For `SPINEL_DATATYPE_UTF8_C`, this function expects two arguments, the first of type `char *` and the 4220 * second is of type `size_t` to indicate length of the provided buffer in the first argument just like 4221 * `strncpy()`, while `spinel_datatype_vunpack()` only expects a `const char **`. 4222 * 4223 * @sa spinel_datatype_unpack_in_place() 4224 * 4225 */ 4226 SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vunpack_in_place(const uint8_t *data_in, 4227 spinel_size_t data_len, 4228 const char * pack_format, 4229 va_list args); 4230 4231 SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_decode(const uint8_t *bytes, 4232 spinel_size_t len, 4233 unsigned int * value_ptr); 4234 SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_encode(uint8_t *bytes, spinel_size_t len, unsigned int value); 4235 SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_size(unsigned int value); 4236 4237 SPINEL_API_EXTERN const char *spinel_next_packed_datatype(const char *pack_format); 4238 4239 // ---------------------------------------------------------------------------- 4240 4241 SPINEL_API_EXTERN const char *spinel_command_to_cstr(spinel_command_t command); 4242 4243 SPINEL_API_EXTERN const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key); 4244 4245 SPINEL_API_EXTERN const char *spinel_net_role_to_cstr(uint8_t net_role); 4246 4247 SPINEL_API_EXTERN const char *spinel_mcu_power_state_to_cstr(uint8_t mcu_power_state); 4248 4249 SPINEL_API_EXTERN const char *spinel_status_to_cstr(spinel_status_t status); 4250 4251 SPINEL_API_EXTERN const char *spinel_capability_to_cstr(spinel_capability_t capability); 4252 4253 // ---------------------------------------------------------------------------- 4254 4255 #if defined(__cplusplus) 4256 } 4257 #endif 4258 4259 #endif /* defined(SPINEL_HEADER_INCLUDED) */ 4260