changed low freq. clock source to IRC

Dependents:   BLE_ANCS_SDAPI_IRC

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_types.h Source File

ble_types.h

00001 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is confidential property of Nordic Semiconductor. The use,
00004  * copying, transfer or disclosure of such information is prohibited except by express written
00005  * agreement with Nordic Semiconductor.
00006  *
00007  */
00008 /**
00009   @addtogroup BLE_COMMON
00010   @{
00011   @defgroup ble_types Common types and macro definitions
00012   @{
00013 
00014   @brief Common types and macro definitions for the S110 SoftDevice.
00015  */
00016 
00017 #ifndef BLE_TYPES_H__
00018 #define BLE_TYPES_H__
00019 
00020 #include <stdint.h>
00021 #include "nordic_global.h"
00022 
00023 /** @addtogroup BLE_COMMON_DEFINES Defines
00024  * @{ */
00025 
00026 /** @defgroup BLE_CONN_HANDLES BLE Connection Handles
00027  * @{ */
00028 #define BLE_CONN_HANDLE_INVALID 0xFFFF  /**< Invalid Connection Handle. */
00029 #define BLE_CONN_HANDLE_ALL     0xFFFE  /**< Applies to all Connection Handles. */
00030 /** @} */
00031 
00032 
00033 /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs
00034  * @{ */
00035 /* Generic UUIDs, applicable to all services */
00036 #define BLE_UUID_UNKNOWN                              0x0000 /**< Reserved UUID. */
00037 #define BLE_UUID_SERVICE_PRIMARY                      0x2800 /**< Primary Service. */
00038 #define BLE_UUID_SERVICE_SECONDARY                    0x2801 /**< Secondary Service. */
00039 #define BLE_UUID_SERVICE_INCLUDE                      0x2802 /**< Include. */
00040 #define BLE_UUID_CHARACTERISTIC                       0x2803 /**< Characteristic. */
00041 #define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP             0x2900 /**< Characteristic Extended Properties Descriptor. */
00042 #define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC            0x2901 /**< Characteristic User Description Descriptor. */
00043 #define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG        0x2902 /**< Client Characteristic Configuration Descriptor. */
00044 #define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG        0x2903 /**< Server Characteristic Configuration Descriptor. */
00045 #define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT  0x2904 /**< Characteristic Presentation Format Descriptor. */
00046 #define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT     0x2905 /**< Characteristic Aggregate Format Descriptor. */
00047 /* GATT specific UUIDs */
00048 #define BLE_UUID_GATT                                 0x1801 /**< Generic Attribute Profile. */
00049 #define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED  0x2A05 /**< Service Changed Characteristic. */
00050 /* GAP specific UUIDs */
00051 #define BLE_UUID_GAP                                  0x1800 /**< Generic Access Profile. */
00052 #define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME       0x2A00 /**< Device Name Characteristic. */
00053 #define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE        0x2A01 /**< Appearance Characteristic. */
00054 #define BLE_UUID_GAP_CHARACTERISTIC_PPF               0x2A02 /**< Peripheral Privacy Flag Characteristic. */
00055 #define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR       0x2A03 /**< Reconnection Address Characteristic. */
00056 #define BLE_UUID_GAP_CHARACTERISTIC_PPCP              0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */
00057 /** @} */
00058 
00059 
00060 /** @defgroup BLE_UUID_TYPES Types of UUID
00061  * @{ */
00062 #define BLE_UUID_TYPE_UNKNOWN       0x00 /**< Invalid UUID type. */
00063 #define BLE_UUID_TYPE_BLE           0x01 /**< Bluetooth SIG UUID (16-bit). */
00064 #define BLE_UUID_TYPE_VENDOR_BEGIN  0x02 /**< Vendor UUID types start at this index (128-bit). */
00065 /** @} */
00066 
00067 
00068 /** @defgroup BLE_APPEARANCES Bluetooth Appearance values
00069  *  @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml
00070  * @{ */
00071 #define BLE_APPEARANCE_UNKNOWN                              0   /**< Unknown. */
00072 #define BLE_APPEARANCE_GENERIC_PHONE                        64  /**< Generic Phone. */
00073 #define BLE_APPEARANCE_GENERIC_COMPUTER                     128 /**< Generic Computer. */
00074 #define BLE_APPEARANCE_GENERIC_WATCH                        192 /**< Generic Watch. */
00075 #define BLE_APPEARANCE_WATCH_SPORTS_WATCH                   193 /**< Watch: Sports Watch. */
00076 #define BLE_APPEARANCE_GENERIC_CLOCK                        256 /**< Generic Clock. */
00077 #define BLE_APPEARANCE_GENERIC_DISPLAY                      320 /**< Generic Display. */
00078 #define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL               384 /**< Generic Remote Control. */
00079 #define BLE_APPEARANCE_GENERIC_EYE_GLASSES                  448 /**< Generic Eye-glasses. */
00080 #define BLE_APPEARANCE_GENERIC_TAG                          512 /**< Generic Tag. */
00081 #define BLE_APPEARANCE_GENERIC_KEYRING                      576 /**< Generic Keyring. */
00082 #define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER                 640 /**< Generic Media Player. */
00083 #define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER              704 /**< Generic Barcode Scanner. */
00084 #define BLE_APPEARANCE_GENERIC_THERMOMETER                  768 /**< Generic Thermometer. */
00085 #define BLE_APPEARANCE_THERMOMETER_EAR                      769 /**< Thermometer: Ear. */
00086 #define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR            832 /**< Generic Heart rate Sensor. */
00087 #define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT    833 /**< Heart Rate Sensor: Heart Rate Belt. */
00088 #define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE               896 /**< Generic Blood Pressure. */
00089 #define BLE_APPEARANCE_BLOOD_PRESSURE_ARM                   897 /**< Blood Pressure: Arm. */
00090 #define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST                 898 /**< Blood Pressure: Wrist. */
00091 #define BLE_APPEARANCE_GENERIC_HID                          960 /**< Human Interface Device (HID). */
00092 #define BLE_APPEARANCE_HID_KEYBOARD                         961 /**< Keyboard (HID Subtype). */
00093 #define BLE_APPEARANCE_HID_MOUSE                            962 /**< Mouse (HID Subtype). */
00094 #define BLE_APPEARANCE_HID_JOYSTICK                         963 /**< Joystiq (HID Subtype). */
00095 #define BLE_APPEARANCE_HID_GAMEPAD                          964 /**< Gamepad (HID Subtype). */
00096 #define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE                 965 /**< Digitizer Tablet (HID Subtype). */
00097 #define BLE_APPEARANCE_HID_CARD_READER                      966 /**< Card Reader (HID Subtype). */
00098 #define BLE_APPEARANCE_HID_DIGITAL_PEN                      967 /**< Digital Pen (HID Subtype). */
00099 #define BLE_APPEARANCE_HID_BARCODE                          968 /**< Barcode Scanner (HID Subtype). */
00100 #define BLE_APPEARANCE_GENERIC_GLUCOSE_METER               1024 /**< Generic Glucose Meter. */
00101 #define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR      1088 /**< Generic Running Walking Sensor. */
00102 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE      1089 /**< Running Walking Sensor: In-Shoe. */
00103 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE      1090 /**< Running Walking Sensor: On-Shoe. */
00104 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP       1091 /**< Running Walking Sensor: On-Hip. */
00105 #define BLE_APPEARANCE_GENERIC_CYCLING                     1152 /**< Generic Cycling. */
00106 #define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER            1153 /**< Cycling: Cycling Computer. */
00107 #define BLE_APPEARANCE_CYCLING_SPEED_SENSOR                1154 /**< Cycling: Speed Sensor. */
00108 #define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR              1155 /**< Cycling: Cadence Sensor. */
00109 #define BLE_APPEARANCE_CYCLING_POWER_SENSOR                1156 /**< Cycling: Power Sensor. */
00110 #define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR        1157 /**< Cycling: Speed and Cadence Sensor. */
00111 /** @} */
00112 
00113 /** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */
00114 #define BLE_UUID_BLE_ASSIGN(instance, value) do {\
00115             instance.type = BLE_UUID_TYPE_BLE; \
00116             instance.uuid = value;} while(0)
00117 
00118 /** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */
00119 #define BLE_UUID_COPY_PTR(dst, src) do {\
00120             (dst)->type = (src)->type; \
00121             (dst)->uuid = (src)->uuid;} while(0)
00122 
00123 /** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */
00124 #define BLE_UUID_COPY_INST(dst, src) do {\
00125             (dst).type = (src).type; \
00126             (dst).uuid = (src).uuid;} while(0)
00127 
00128 /** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
00129 #define BLE_UUID_EQ(p_uuid1, p_uuid2) \
00130             (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid))
00131 
00132 /** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
00133 #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \
00134             (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid))
00135 
00136 /** @} */
00137 
00138 /** @brief 128 bit UUID values. */
00139 typedef struct
00140 { 
00141     unsigned char uuid128[16];
00142 } ble_uuid128_t;
00143 
00144 /** @brief  Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */
00145 typedef struct
00146 {
00147     uint16_t    uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */
00148     uint8_t     type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */
00149 } ble_uuid_t;
00150 
00151 
00152 
00153 #endif /* BLE_TYPES_H__ */
00154 
00155 /**
00156   @}
00157   @}
00158 */