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.
Fork of nrf51-sdk by
ble_types.h
00001 /* 00002 * Copyright (c) Nordic Semiconductor ASA 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, this 00012 * list of conditions and the following disclaimer in the documentation and/or 00013 * other materials provided with the distribution. 00014 * 00015 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 00016 * contributors to this software may be used to endorse or promote products 00017 * derived from this software without specific prior written permission. 00018 * 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00027 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 */ 00032 00033 /** 00034 @addtogroup BLE_COMMON 00035 @{ 00036 @defgroup ble_types Common types and macro definitions 00037 @{ 00038 00039 @brief Common types and macro definitions for the BLE SoftDevice. 00040 */ 00041 00042 #ifndef BLE_TYPES_H__ 00043 #define BLE_TYPES_H__ 00044 00045 #include <stdint.h> 00046 00047 /** @addtogroup BLE_TYPES_DEFINES Defines 00048 * @{ */ 00049 00050 /** @defgroup BLE_CONN_HANDLES BLE Connection Handles 00051 * @{ */ 00052 #define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */ 00053 #define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */ 00054 /** @} */ 00055 00056 00057 #if 0 /* The following have been duplicated in blecommon.h */ 00058 /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs 00059 * @{ */ 00060 /* Generic UUIDs, applicable to all services */ 00061 #define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */ 00062 #define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */ 00063 #define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */ 00064 #define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */ 00065 #define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */ 00066 #define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */ 00067 #define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */ 00068 #define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */ 00069 #define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */ 00070 #define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */ 00071 #define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */ 00072 /* GATT specific UUIDs */ 00073 #define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */ 00074 #define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */ 00075 /* GAP specific UUIDs */ 00076 #define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */ 00077 #define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */ 00078 #define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */ 00079 #define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */ 00080 #define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */ 00081 #define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */ 00082 /** @} */ 00083 #endif /* The following have been duplicated in blecommon.h */ 00084 00085 00086 /** @defgroup BLE_UUID_TYPES Types of UUID 00087 * @{ */ 00088 #define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */ 00089 #define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */ 00090 #define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */ 00091 /** @} */ 00092 00093 00094 #if 0 /* The following have been duplicated in blecommon.h */ 00095 /** @defgroup BLE_APPEARANCES Bluetooth Appearance values 00096 * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml 00097 * @{ */ 00098 #define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */ 00099 #define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */ 00100 #define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */ 00101 #define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */ 00102 #define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */ 00103 #define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */ 00104 #define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */ 00105 #define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */ 00106 #define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */ 00107 #define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */ 00108 #define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */ 00109 #define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */ 00110 #define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */ 00111 #define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */ 00112 #define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */ 00113 #define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart rate Sensor. */ 00114 #define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */ 00115 #define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */ 00116 #define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */ 00117 #define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */ 00118 #define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */ 00119 #define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */ 00120 #define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */ 00121 #define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystiq (HID Subtype). */ 00122 #define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */ 00123 #define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */ 00124 #define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */ 00125 #define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */ 00126 #define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */ 00127 #define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */ 00128 #define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */ 00129 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */ 00130 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */ 00131 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */ 00132 #define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */ 00133 #define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */ 00134 #define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */ 00135 #define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */ 00136 #define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */ 00137 #define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */ 00138 #define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136 /**< Generic Pulse Oximeter. */ 00139 #define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */ 00140 #define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */ 00141 #define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */ 00142 #define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */ 00143 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */ 00144 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */ 00145 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */ 00146 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ 00147 /** @} */ 00148 #endif /* The following have been duplicated in blecommon.h */ 00149 00150 /** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */ 00151 #define BLE_UUID_BLE_ASSIGN(instance, value) do {\ 00152 instance.type = BLE_UUID_TYPE_BLE; \ 00153 instance.uuid = value;} while(0) 00154 00155 /** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */ 00156 #define BLE_UUID_COPY_PTR(dst, src) do {\ 00157 (dst)->type = (src)->type; \ 00158 (dst)->uuid = (src)->uuid;} while(0) 00159 00160 /** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */ 00161 #define BLE_UUID_COPY_INST(dst, src) do {\ 00162 (dst).type = (src).type; \ 00163 (dst).uuid = (src).uuid;} while(0) 00164 00165 /** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ 00166 #define BLE_UUID_EQ(p_uuid1, p_uuid2) \ 00167 (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid)) 00168 00169 /** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ 00170 #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \ 00171 (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid)) 00172 00173 /** @} */ 00174 00175 /** @addtogroup BLE_TYPES_STRUCTURES Structures 00176 * @{ */ 00177 00178 /** @brief 128 bit UUID values. */ 00179 typedef struct 00180 { 00181 unsigned char uuid128[16]; /**< Little-Endian UUID bytes. */ 00182 } ble_uuid128_t; 00183 00184 /** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */ 00185 typedef struct 00186 { 00187 uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */ 00188 uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is @ref BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */ 00189 } ble_uuid_t; 00190 00191 /** @} */ 00192 00193 #endif /* BLE_TYPES_H__ */ 00194 00195 /** 00196 @} 00197 @} 00198 */
Generated on Tue Jul 12 2022 11:17:15 by
1.7.2
