The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
emilmont
Date:
Fri Feb 21 12:21:39 2014 +0000
Revision:
80:8e73be2a2ac1
First alpha release for the NRF51822 target (to be tested in the online IDE)

Who changed what in which revision?

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