Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
thread_diagcop_lib.h
00001 /* 00002 * Copyright (c) 2016 ARM Limited. All rights reserved. 00003 * 00004 * SPDX-License-Identifier: LicenseRef-PBL 00005 * 00006 * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * https://www.mbed.com/licenses/PBL-1.0 00010 * 00011 * See the License for the specific language governing permissions and limitations under the License. 00012 * 00013 */ 00014 00015 00016 #ifndef NANOSTACK_SOURCE_6LOWPAN_THREAD_THREAD_DIAGCOP_LIB_H_ 00017 #define NANOSTACK_SOURCE_6LOWPAN_THREAD_THREAD_DIAGCOP_LIB_H_ 00018 00019 #include "ns_types.h" 00020 #include "thread_meshcop_lib.h" // this uses the same parser functions than meshcop but different message types 00021 00022 /** 00023 * \file thread_diagcop_lib.h 00024 * \brief CoAP diagnostic TLV. 00025 * Note that these TLV types overlap with meshcop 00026 * and must not be used in same messages. 00027 */ 00028 00029 #define DIAGCOP_TLV_EXTENDED_MAC_ADDRESS 0 /**< Can not reset*/ 00030 #define DIAGCOP_TLV_ADDRESS16 1 /**< Can not reset*/ 00031 #define DIAGCOP_TLV_MODE 2 /**< Can not reset*/ 00032 #define DIAGCOP_TLV_TIMEOUT 3 /**< Can not reset*/ 00033 #define DIAGCOP_TLV_CONNECTIVITY 4 /**< Can not reset*/ 00034 #define DIAGCOP_TLV_ROUTE64 5 /**< Can not reset*/ 00035 #define DIAGCOP_TLV_LEADER_DATA 6 /**< Can not reset*/ 00036 #define DIAGCOP_TLV_NETWORK_DATA 7 /**< Can not reset*/ 00037 #define DIAGCOP_TLV_IPV6_ADDRESS_LIST 8 /**< Can not reset*/ 00038 #define DIAGCOP_TLV_MAC_COUNTERS 9 /**< Can reset*/ 00039 #define DIAGCOP_TLV_BATTERY_LEVEL 14 /**< Can reset*/ 00040 #define DIAGCOP_TLV_SUPPLY_VOLTAGE 15 /**< Can not reset*/ 00041 #define DIAGCOP_TLV_CHILD_TABLE 16 /**< Can not reset*/ 00042 #define DIAGCOP_TLV_CHANNEL_PAGES 17 /**< Can not reset*/ 00043 00044 #define DIAGCOP_TLV_GET 13 00045 00046 /** 00047 * \brief Write array TLV. 00048 * 00049 * \param ptr A pointer to array in which to write the TLV. 00050 * \param type The type of TLV. 00051 * \param length The length of the data that is written in TLV. 00052 * \param data The array for TLV value. 00053 * \return pointer The value for writing the next TLV. 00054 */ 00055 #define thread_diagcop_tlv_data_write(ptr,type,length,data) thread_meshcop_tlv_data_write(ptr,type,length,data) 00056 00057 /** 00058 * \brief Write 1 byte length TLV. 00059 * 00060 * \param ptr A pointer to array in which to write the TLV. 00061 * \param type The type of TLV. 00062 * \param data value. 00063 * \return pointer value for writing the next TLV. 00064 */ 00065 #define thread_diagcop_tlv_data_write_uint8(ptr,type,data) thread_meshcop_tlv_data_write_uint8(ptr,type,data) 00066 00067 /** 00068 * \brief Write 2 byte length TLV. 00069 * 00070 * \param ptr pointer for array where to write the TLV. 00071 * \param type Type of TLV. 00072 * \param data value. 00073 * \return pointer value for writing the next TLV. 00074 */ 00075 #define thread_diagcop_tlv_data_write_uint16(ptr,type,data) thread_meshcop_tlv_data_write_uint16(ptr,type,data) 00076 00077 /** 00078 * \brief Write 4 byte length TLV. 00079 * 00080 * \param ptr pointer for array where to write the TLV. 00081 * \param type Type of TLV. 00082 * \param data value. 00083 * \return pointer value for writing the next TLV. 00084 */ 00085 #define thread_diagcop_tlv_data_write_uint32(ptr,type,data) thread_meshcop_tlv_data_write_uint32(ptr,type,data) 00086 00087 /** 00088 * \brief Write 8 byte length TLV. 00089 * 00090 * \param ptr pointer for array where to write the TLV. 00091 * \param type Type of TLV. 00092 * \param data value. 00093 * \return pointer value for writing the next TLV. 00094 */ 00095 #define thread_diagcop_tlv_data_write_uint64(ptr,type,data) thread_meshcop_tlv_data_write_uint64(ptr,type,data) 00096 00097 /** 00098 * \brief Find TLV from message. 00099 * 00100 * \param ptr Message buffer. 00101 * \param length Length of the message buffer to validate message. 00102 * \param type Type of TLV searched. 00103 * \param result_ptr Pointer value is given as result if length is positive. Can be NULL which only searches for the length. 00104 * \return The length of the TLV data found 00105 * \return 0 if TLV is empty or no TLV found. 00106 * \return negative value indicates corrupted message. 00107 */ 00108 #define thread_diagcop_tlv_find(ptr,length,type,result) thread_meshcop_tlv_find(ptr,length,type,result) 00109 00110 /** 00111 * \brief Read 1 byte length TLV. 00112 * 00113 * \param ptr pointer TLV message array. 00114 * \param length length of TLV message array. 00115 * \param type Type of TLV. 00116 * \param data_ptr pointer to variable where the value is read. 00117 * \return pointer length of TLV 1 if success. 0 means TLV not found or does not have any data. 00118 * Any other value indicates that TLV is not as expected. 00119 */ 00120 #define thread_diagcop_tlv_data_get_uint8(ptr,length,type,data) thread_meshcop_tlv_data_get_uint8(ptr,length,type,data) 00121 00122 /** 00123 * \brief Read 2 byte length TLV. 00124 * 00125 * \param ptr pointer TLV message array. 00126 * \param length length of TLV message array. 00127 * \param type Type of TLV. 00128 * \param data_ptr pointer to variable where the value is read. 00129 * \return pointer length of TLV 2 if success. 0 means TLV not found or does not have any data. 00130 * Any other value indicates that TLV is not as expected. 00131 */ 00132 #define thread_diagcop_tlv_data_get_uint16(ptr,length,type,data) thread_meshcop_tlv_data_get_uint16(ptr,length,type,data) 00133 00134 /** 00135 * \brief Read 4 byte length TLV. 00136 * 00137 * \param ptr pointer TLV message array. 00138 * \param length length of TLV message array. 00139 * \param type Type of TLV. 00140 * \param data_ptr pointer to variable where the value is read. 00141 * \return pointer length of TLV 4 if success. 0 means TLV not found or does not have any data. 00142 * Any other value indicates that TLV is not as expected. 00143 */ 00144 #define thread_diagcop_tlv_data_get_uint32(ptr,length,type,data) thread_meshcop_tlv_data_get_uint32(ptr,length,type,data) 00145 00146 /** 00147 * \brief Read 8 byte length TLV. 00148 * 00149 * \param ptr pointer TLV message array. 00150 * \param length length of TLV message array. 00151 * \param type Type of TLV. 00152 * \param data_ptr pointer to variable where the value is read. 00153 * \return pointer length of TLV 4 if success. 0 means TLV not found or does not have any data. 00154 * Any other value indicates that TLV is not as expected. 00155 */ 00156 #define thread_diagcop_tlv_data_get_uint64(ptr,length,type,data) thread_meshcop_tlv_data_get_uint64(ptr,length,type,data) 00157 00158 00159 #endif /* NANOSTACK_SOURCE_6LOWPAN_THREAD_THREAD_DIAGCOP_LIB_H_ */
Generated on Tue Jul 12 2022 12:28:55 by
