For with fix for disconnection notifications

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 
00022 /** @addtogroup BLE_COMMON_DEFINES Defines
00023  * @{ */
00024 
00025 /** @defgroup BLE_CONN_HANDLES BLE Connection Handles
00026  * @{ */
00027 #define BLE_CONN_HANDLE_INVALID 0xFFFF  /**< Invalid Connection Handle. */
00028 #define BLE_CONN_HANDLE_ALL     0xFFFE  /**< Applies to all Connection Handles. */
00029 /** @} */
00030 
00031 
00032 
00033 
00034 
00035 /** @defgroup BLE_UUID_TYPES Types of UUID
00036  * @{ */
00037 #define BLE_UUID_TYPE_UNKNOWN       0x00 /**< Invalid UUID type. */
00038 #define BLE_UUID_TYPE_BLE           0x01 /**< Bluetooth SIG UUID (16-bit). */
00039 #define BLE_UUID_TYPE_VENDOR_BEGIN  0x02 /**< Vendor UUID types start at this index (128-bit). */
00040 /** @} */
00041 
00042 /** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */
00043 #define BLE_UUID_BLE_ASSIGN(instance, value) do {\
00044             instance.type = BLE_UUID_TYPE_BLE; \
00045             instance.uuid = value;} while(0)
00046 
00047 /** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */
00048 #define BLE_UUID_COPY_PTR(dst, src) do {\
00049             (dst)->type = (src)->type; \
00050             (dst)->uuid = (src)->uuid;} while(0)
00051 
00052 /** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */
00053 #define BLE_UUID_COPY_INST(dst, src) do {\
00054             (dst).type = (src).type; \
00055             (dst).uuid = (src).uuid;} while(0)
00056 
00057 /** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
00058 #define BLE_UUID_EQ(p_uuid1, p_uuid2) \
00059             (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid))
00060 
00061 /** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
00062 #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \
00063             (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid))
00064 
00065 /** @} */
00066 
00067 /** @addtogroup BLE_TYPES_STRUCTURES Structures
00068  * @{ */
00069 
00070 /** @brief 128 bit UUID values. */
00071 typedef struct
00072 {
00073     unsigned char uuid128[16];
00074 } ble_uuid128_t;
00075 
00076 /** @brief  Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */
00077 typedef struct
00078 {
00079     uint16_t    uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */
00080     uint8_t     type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */
00081 } ble_uuid_t;
00082 
00083 /** @} */
00084 
00085 #endif /* BLE_TYPES_H__ */
00086 
00087 /**
00088   @}
00089   @}
00090 */