version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Apr 07 18:28:36 2014 +0100
Revision:
82:6473597d706e
Release 82 of the mbed library

Main changes:

- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes

Who changed what in which revision?

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