Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
BLETypes.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2017-2017 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef BLE_TYPES_H_ 00018 #define BLE_TYPES_H_ 00019 00020 #include <stddef.h> 00021 #include <stdint.h> 00022 00023 /** 00024 * @addtogroup ble 00025 * @{ 00026 * @addtogroup common 00027 * @{ 00028 */ 00029 00030 namespace ble { 00031 00032 /** 00033 * Opaque reference to a connection. 00034 * 00035 * Internally a connection handle is an unsigned integer capable of holding a 00036 * pointer. 00037 * 00038 * The real type (either a pointer to an object or an integer) is opaque for 00039 * users and platform dependent. 00040 */ 00041 typedef uintptr_t connection_handle_t; 00042 00043 /** 00044 * Reference to an attribute in a GATT database. 00045 */ 00046 typedef uint16_t attribute_handle_t; 00047 00048 00049 /** 00050 * Inclusive range of GATT attributes handles. 00051 * 00052 * @note Instances can be constructed with the help of the factory function 00053 * attribute_handle_range(). 00054 */ 00055 struct attribute_handle_range_t { 00056 /** 00057 * Begining of the range. 00058 */ 00059 attribute_handle_t begin; 00060 00061 /** 00062 * End of the range. 00063 */ 00064 attribute_handle_t end; 00065 00066 /** 00067 * Equal operator for attribute_handle_range_t. 00068 * 00069 * @param[in] lhs Left hand side of the expression. 00070 * @param[in] rhs Right hand side of the expression. 00071 * 00072 * @return true if lhs is equal to rhs and false otherwise. 00073 */ 00074 friend bool operator==( 00075 const attribute_handle_range_t &lhs, const attribute_handle_range_t &rhs 00076 ) { 00077 return (lhs.begin == rhs.begin) && (lhs.end == rhs.end); 00078 } 00079 00080 /** 00081 * Not equal operator for attribute_handle_range_t. 00082 * 00083 * @param[in] lhs Left hand side of the expression. 00084 * @param[in] rhs Right hand side of the expression. 00085 * 00086 * @return true if lhs is not equal to rhs and false otherwise. 00087 */ 00088 friend bool operator!=( 00089 const attribute_handle_range_t &lhs, const attribute_handle_range_t &rhs 00090 ) { 00091 return !(lhs == rhs); 00092 } 00093 }; 00094 00095 00096 /** 00097 * Construct an attribute_handle_range_t from its first and last attribute handle. 00098 * 00099 * @param begin Handle at the begining of the range. 00100 * @param end Handle at the end of the range. 00101 * 00102 * @return An instance of attribute_handle_range_t where 00103 * attribute_handle_range_t::begin is equal to begin and 00104 * attribute_handle_range_t::end is equal to end. 00105 * 00106 * @note This function is defined instead of a constructor to keep "POD-ness" 00107 * of attribute_handle_range_t. 00108 */ 00109 static inline attribute_handle_range_t attribute_handle_range( 00110 attribute_handle_t begin, 00111 attribute_handle_t end 00112 ) { 00113 attribute_handle_range_t result = { 00114 begin, 00115 end 00116 }; 00117 return result; 00118 } 00119 00120 } // namespace ble 00121 00122 /** 00123 * @} 00124 * @} 00125 */ 00126 00127 #endif /* BLE_TYPES_H_ */
Generated on Sun Jul 17 2022 08:25:20 by 1.7.2