テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8468a4403fea 1 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8468a4403fea 2 *
jksoft 0:8468a4403fea 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
jksoft 0:8468a4403fea 4 * copying, transfer or disclosure of such information is prohibited except by express written
jksoft 0:8468a4403fea 5 * agreement with Nordic Semiconductor.
jksoft 0:8468a4403fea 6 *
jksoft 0:8468a4403fea 7 */
jksoft 0:8468a4403fea 8 /**
jksoft 0:8468a4403fea 9 @addtogroup BLE_COMMON
jksoft 0:8468a4403fea 10 @{
jksoft 0:8468a4403fea 11 @defgroup ble_types Common types and macro definitions
jksoft 0:8468a4403fea 12 @{
jksoft 0:8468a4403fea 13
jksoft 0:8468a4403fea 14 @brief Common types and macro definitions for the S110 SoftDevice.
jksoft 0:8468a4403fea 15 */
jksoft 0:8468a4403fea 16
jksoft 0:8468a4403fea 17 #ifndef BLE_TYPES_H__
jksoft 0:8468a4403fea 18 #define BLE_TYPES_H__
jksoft 0:8468a4403fea 19
jksoft 0:8468a4403fea 20 #include <stdint.h>
jksoft 0:8468a4403fea 21
jksoft 0:8468a4403fea 22 /** @addtogroup BLE_COMMON_DEFINES Defines
jksoft 0:8468a4403fea 23 * @{ */
jksoft 0:8468a4403fea 24
jksoft 0:8468a4403fea 25 /** @defgroup BLE_CONN_HANDLES BLE Connection Handles
jksoft 0:8468a4403fea 26 * @{ */
jksoft 0:8468a4403fea 27 #define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */
jksoft 0:8468a4403fea 28 #define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */
jksoft 0:8468a4403fea 29 /** @} */
jksoft 0:8468a4403fea 30
jksoft 0:8468a4403fea 31
jksoft 0:8468a4403fea 32 /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs
jksoft 0:8468a4403fea 33 * @{ */
jksoft 0:8468a4403fea 34 /* Generic UUIDs, applicable to all services */
jksoft 0:8468a4403fea 35 #define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */
jksoft 0:8468a4403fea 36 #define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */
jksoft 0:8468a4403fea 37 #define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */
jksoft 0:8468a4403fea 38 #define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */
jksoft 0:8468a4403fea 39 #define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */
jksoft 0:8468a4403fea 40 #define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */
jksoft 0:8468a4403fea 41 #define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */
jksoft 0:8468a4403fea 42 #define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */
jksoft 0:8468a4403fea 43 #define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */
jksoft 0:8468a4403fea 44 #define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */
jksoft 0:8468a4403fea 45 #define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */
jksoft 0:8468a4403fea 46 /* GATT specific UUIDs */
jksoft 0:8468a4403fea 47 #define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */
jksoft 0:8468a4403fea 48 #define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */
jksoft 0:8468a4403fea 49 /* GAP specific UUIDs */
jksoft 0:8468a4403fea 50 #define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */
jksoft 0:8468a4403fea 51 #define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */
jksoft 0:8468a4403fea 52 #define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */
jksoft 0:8468a4403fea 53 #define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */
jksoft 0:8468a4403fea 54 #define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */
jksoft 0:8468a4403fea 55 #define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */
jksoft 0:8468a4403fea 56 /** @} */
jksoft 0:8468a4403fea 57
jksoft 0:8468a4403fea 58
jksoft 0:8468a4403fea 59 /** @defgroup BLE_UUID_TYPES Types of UUID
jksoft 0:8468a4403fea 60 * @{ */
jksoft 0:8468a4403fea 61 #define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */
jksoft 0:8468a4403fea 62 #define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */
jksoft 0:8468a4403fea 63 #define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */
jksoft 0:8468a4403fea 64 /** @} */
jksoft 0:8468a4403fea 65
jksoft 0:8468a4403fea 66
jksoft 0:8468a4403fea 67 /** @defgroup BLE_APPEARANCES Bluetooth Appearance values
jksoft 0:8468a4403fea 68 * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml
jksoft 0:8468a4403fea 69 * @{ */
jksoft 0:8468a4403fea 70 #define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */
jksoft 0:8468a4403fea 71 #define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */
jksoft 0:8468a4403fea 72 #define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */
jksoft 0:8468a4403fea 73 #define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */
jksoft 0:8468a4403fea 74 #define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */
jksoft 0:8468a4403fea 75 #define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */
jksoft 0:8468a4403fea 76 #define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */
jksoft 0:8468a4403fea 77 #define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */
jksoft 0:8468a4403fea 78 #define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */
jksoft 0:8468a4403fea 79 #define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */
jksoft 0:8468a4403fea 80 #define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */
jksoft 0:8468a4403fea 81 #define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */
jksoft 0:8468a4403fea 82 #define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */
jksoft 0:8468a4403fea 83 #define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */
jksoft 0:8468a4403fea 84 #define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */
jksoft 0:8468a4403fea 85 #define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart rate Sensor. */
jksoft 0:8468a4403fea 86 #define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */
jksoft 0:8468a4403fea 87 #define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */
jksoft 0:8468a4403fea 88 #define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */
jksoft 0:8468a4403fea 89 #define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */
jksoft 0:8468a4403fea 90 #define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */
jksoft 0:8468a4403fea 91 #define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */
jksoft 0:8468a4403fea 92 #define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */
jksoft 0:8468a4403fea 93 #define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystiq (HID Subtype). */
jksoft 0:8468a4403fea 94 #define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */
jksoft 0:8468a4403fea 95 #define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */
jksoft 0:8468a4403fea 96 #define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */
jksoft 0:8468a4403fea 97 #define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */
jksoft 0:8468a4403fea 98 #define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */
jksoft 0:8468a4403fea 99 #define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */
jksoft 0:8468a4403fea 100 #define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */
jksoft 0:8468a4403fea 101 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */
jksoft 0:8468a4403fea 102 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */
jksoft 0:8468a4403fea 103 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */
jksoft 0:8468a4403fea 104 #define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */
jksoft 0:8468a4403fea 105 #define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */
jksoft 0:8468a4403fea 106 #define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */
jksoft 0:8468a4403fea 107 #define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */
jksoft 0:8468a4403fea 108 #define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */
jksoft 0:8468a4403fea 109 #define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */
jksoft 0:8468a4403fea 110 #define BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 3136 /**< Generic Pulse Oximeter. */
jksoft 0:8468a4403fea 111 #define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */
jksoft 0:8468a4403fea 112 #define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */
jksoft 0:8468a4403fea 113 #define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */
jksoft 0:8468a4403fea 114 #define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */
jksoft 0:8468a4403fea 115 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */
jksoft 0:8468a4403fea 116 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */
jksoft 0:8468a4403fea 117 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */
jksoft 0:8468a4403fea 118 #define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */
jksoft 0:8468a4403fea 119 /** @} */
jksoft 0:8468a4403fea 120
jksoft 0:8468a4403fea 121 /** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */
jksoft 0:8468a4403fea 122 #define BLE_UUID_BLE_ASSIGN(instance, value) do {\
jksoft 0:8468a4403fea 123 instance.type = BLE_UUID_TYPE_BLE; \
jksoft 0:8468a4403fea 124 instance.uuid = value;} while(0)
jksoft 0:8468a4403fea 125
jksoft 0:8468a4403fea 126 /** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */
jksoft 0:8468a4403fea 127 #define BLE_UUID_COPY_PTR(dst, src) do {\
jksoft 0:8468a4403fea 128 (dst)->type = (src)->type; \
jksoft 0:8468a4403fea 129 (dst)->uuid = (src)->uuid;} while(0)
jksoft 0:8468a4403fea 130
jksoft 0:8468a4403fea 131 /** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */
jksoft 0:8468a4403fea 132 #define BLE_UUID_COPY_INST(dst, src) do {\
jksoft 0:8468a4403fea 133 (dst).type = (src).type; \
jksoft 0:8468a4403fea 134 (dst).uuid = (src).uuid;} while(0)
jksoft 0:8468a4403fea 135
jksoft 0:8468a4403fea 136 /** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
jksoft 0:8468a4403fea 137 #define BLE_UUID_EQ(p_uuid1, p_uuid2) \
jksoft 0:8468a4403fea 138 (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid))
jksoft 0:8468a4403fea 139
jksoft 0:8468a4403fea 140 /** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
jksoft 0:8468a4403fea 141 #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \
jksoft 0:8468a4403fea 142 (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid))
jksoft 0:8468a4403fea 143
jksoft 0:8468a4403fea 144 /** @} */
jksoft 0:8468a4403fea 145
jksoft 0:8468a4403fea 146 /** @addtogroup BLE_TYPES_STRUCTURES Structures
jksoft 0:8468a4403fea 147 * @{ */
jksoft 0:8468a4403fea 148
jksoft 0:8468a4403fea 149 /** @brief 128 bit UUID values. */
jksoft 0:8468a4403fea 150 typedef struct
jksoft 0:8468a4403fea 151 {
jksoft 0:8468a4403fea 152 unsigned char uuid128[16];
jksoft 0:8468a4403fea 153 } ble_uuid128_t;
jksoft 0:8468a4403fea 154
jksoft 0:8468a4403fea 155 /** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */
jksoft 0:8468a4403fea 156 typedef struct
jksoft 0:8468a4403fea 157 {
jksoft 0:8468a4403fea 158 uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */
jksoft 0:8468a4403fea 159 uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */
jksoft 0:8468a4403fea 160 } ble_uuid_t;
jksoft 0:8468a4403fea 161
jksoft 0:8468a4403fea 162 /** @} */
jksoft 0:8468a4403fea 163
jksoft 0:8468a4403fea 164 #endif /* BLE_TYPES_H__ */
jksoft 0:8468a4403fea 165
jksoft 0:8468a4403fea 166 /**
jksoft 0:8468a4403fea 167 @}
jksoft 0:8468a4403fea 168 @}
jksoft 0:8468a4403fea 169 */