For with fix for disconnection notifications
Fork of nRF51822 by
nordic/nrf-sdk/s110/ble_types.h@53:1e5c300cec7f, 2014-07-25 (annotated)
- Committer:
- Rohit Grover
- Date:
- Fri Jul 25 10:33:52 2014 +0100
- Revision:
- 53:1e5c300cec7f
- Parent:
- 37:c29c330d942c
move constants for appearance and UUIDs out to blecommon.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved. |
bogdanm | 0:eff01767de02 | 2 | * |
bogdanm | 0:eff01767de02 | 3 | * The information contained herein is confidential property of Nordic Semiconductor. The use, |
bogdanm | 0:eff01767de02 | 4 | * copying, transfer or disclosure of such information is prohibited except by express written |
bogdanm | 0:eff01767de02 | 5 | * agreement with Nordic Semiconductor. |
bogdanm | 0:eff01767de02 | 6 | * |
bogdanm | 0:eff01767de02 | 7 | */ |
bogdanm | 0:eff01767de02 | 8 | /** |
bogdanm | 0:eff01767de02 | 9 | @addtogroup BLE_COMMON |
bogdanm | 0:eff01767de02 | 10 | @{ |
bogdanm | 0:eff01767de02 | 11 | @defgroup ble_types Common types and macro definitions |
bogdanm | 0:eff01767de02 | 12 | @{ |
bogdanm | 0:eff01767de02 | 13 | |
bogdanm | 0:eff01767de02 | 14 | @brief Common types and macro definitions for the S110 SoftDevice. |
bogdanm | 0:eff01767de02 | 15 | */ |
bogdanm | 0:eff01767de02 | 16 | |
bogdanm | 0:eff01767de02 | 17 | #ifndef BLE_TYPES_H__ |
bogdanm | 0:eff01767de02 | 18 | #define BLE_TYPES_H__ |
bogdanm | 0:eff01767de02 | 19 | |
bogdanm | 0:eff01767de02 | 20 | #include <stdint.h> |
bogdanm | 0:eff01767de02 | 21 | |
bogdanm | 0:eff01767de02 | 22 | /** @addtogroup BLE_COMMON_DEFINES Defines |
bogdanm | 0:eff01767de02 | 23 | * @{ */ |
bogdanm | 0:eff01767de02 | 24 | |
bogdanm | 0:eff01767de02 | 25 | /** @defgroup BLE_CONN_HANDLES BLE Connection Handles |
bogdanm | 0:eff01767de02 | 26 | * @{ */ |
bogdanm | 0:eff01767de02 | 27 | #define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */ |
bogdanm | 0:eff01767de02 | 28 | #define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */ |
bogdanm | 0:eff01767de02 | 29 | /** @} */ |
bogdanm | 0:eff01767de02 | 30 | |
bogdanm | 0:eff01767de02 | 31 | |
Rohit Grover |
53:1e5c300cec7f | 32 | |
bogdanm | 0:eff01767de02 | 33 | |
bogdanm | 0:eff01767de02 | 34 | |
bogdanm | 0:eff01767de02 | 35 | /** @defgroup BLE_UUID_TYPES Types of UUID |
bogdanm | 0:eff01767de02 | 36 | * @{ */ |
bogdanm | 0:eff01767de02 | 37 | #define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */ |
bogdanm | 0:eff01767de02 | 38 | #define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */ |
bogdanm | 0:eff01767de02 | 39 | #define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */ |
bogdanm | 0:eff01767de02 | 40 | /** @} */ |
bogdanm | 0:eff01767de02 | 41 | |
bogdanm | 0:eff01767de02 | 42 | /** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */ |
bogdanm | 0:eff01767de02 | 43 | #define BLE_UUID_BLE_ASSIGN(instance, value) do {\ |
bogdanm | 0:eff01767de02 | 44 | instance.type = BLE_UUID_TYPE_BLE; \ |
bogdanm | 0:eff01767de02 | 45 | instance.uuid = value;} while(0) |
bogdanm | 0:eff01767de02 | 46 | |
bogdanm | 0:eff01767de02 | 47 | /** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */ |
bogdanm | 0:eff01767de02 | 48 | #define BLE_UUID_COPY_PTR(dst, src) do {\ |
bogdanm | 0:eff01767de02 | 49 | (dst)->type = (src)->type; \ |
bogdanm | 0:eff01767de02 | 50 | (dst)->uuid = (src)->uuid;} while(0) |
bogdanm | 0:eff01767de02 | 51 | |
bogdanm | 0:eff01767de02 | 52 | /** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */ |
bogdanm | 0:eff01767de02 | 53 | #define BLE_UUID_COPY_INST(dst, src) do {\ |
bogdanm | 0:eff01767de02 | 54 | (dst).type = (src).type; \ |
bogdanm | 0:eff01767de02 | 55 | (dst).uuid = (src).uuid;} while(0) |
bogdanm | 0:eff01767de02 | 56 | |
bogdanm | 0:eff01767de02 | 57 | /** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ |
bogdanm | 0:eff01767de02 | 58 | #define BLE_UUID_EQ(p_uuid1, p_uuid2) \ |
bogdanm | 0:eff01767de02 | 59 | (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid)) |
bogdanm | 0:eff01767de02 | 60 | |
bogdanm | 0:eff01767de02 | 61 | /** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */ |
bogdanm | 0:eff01767de02 | 62 | #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \ |
bogdanm | 0:eff01767de02 | 63 | (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid)) |
bogdanm | 0:eff01767de02 | 64 | |
bogdanm | 0:eff01767de02 | 65 | /** @} */ |
bogdanm | 0:eff01767de02 | 66 | |
Rohit Grover |
37:c29c330d942c | 67 | /** @addtogroup BLE_TYPES_STRUCTURES Structures |
Rohit Grover |
37:c29c330d942c | 68 | * @{ */ |
Rohit Grover |
37:c29c330d942c | 69 | |
bogdanm | 0:eff01767de02 | 70 | /** @brief 128 bit UUID values. */ |
bogdanm | 0:eff01767de02 | 71 | typedef struct |
Rohit Grover |
53:1e5c300cec7f | 72 | { |
bogdanm | 0:eff01767de02 | 73 | unsigned char uuid128[16]; |
bogdanm | 0:eff01767de02 | 74 | } ble_uuid128_t; |
bogdanm | 0:eff01767de02 | 75 | |
bogdanm | 0:eff01767de02 | 76 | /** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */ |
bogdanm | 0:eff01767de02 | 77 | typedef struct |
bogdanm | 0:eff01767de02 | 78 | { |
bogdanm | 0:eff01767de02 | 79 | uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */ |
bogdanm | 0:eff01767de02 | 80 | uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */ |
bogdanm | 0:eff01767de02 | 81 | } ble_uuid_t; |
bogdanm | 0:eff01767de02 | 82 | |
Rohit Grover |
37:c29c330d942c | 83 | /** @} */ |
bogdanm | 0:eff01767de02 | 84 | |
bogdanm | 0:eff01767de02 | 85 | #endif /* BLE_TYPES_H__ */ |
bogdanm | 0:eff01767de02 | 86 | |
bogdanm | 0:eff01767de02 | 87 | /** |
bogdanm | 0:eff01767de02 | 88 | @} |
bogdanm | 0:eff01767de02 | 89 | @} |
bogdanm | 0:eff01767de02 | 90 | */ |