just a fork
Fork of BLE_API by
ble/BLEProtocol.h@1078:79c089630b38, 2016-01-11 (annotated)
- Committer:
- vcoubard
- Date:
- Mon Jan 11 08:51:44 2016 +0000
- Revision:
- 1078:79c089630b38
- Child:
- 1115:82d4a8a56d91
Synchronized with git rev 4774e2cd
Author: Rohit Grover
Add an alias for BLEProtocol::AddressType::Type
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 1078:79c089630b38 | 1 | /* mbed Microcontroller Library |
vcoubard | 1078:79c089630b38 | 2 | * Copyright (c) 2006-2013 ARM Limited |
vcoubard | 1078:79c089630b38 | 3 | * |
vcoubard | 1078:79c089630b38 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vcoubard | 1078:79c089630b38 | 5 | * you may not use this file except in compliance with the License. |
vcoubard | 1078:79c089630b38 | 6 | * You may obtain a copy of the License at |
vcoubard | 1078:79c089630b38 | 7 | * |
vcoubard | 1078:79c089630b38 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
vcoubard | 1078:79c089630b38 | 9 | * |
vcoubard | 1078:79c089630b38 | 10 | * Unless required by applicable law or agreed to in writing, software |
vcoubard | 1078:79c089630b38 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
vcoubard | 1078:79c089630b38 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vcoubard | 1078:79c089630b38 | 13 | * See the License for the specific language governing permissions and |
vcoubard | 1078:79c089630b38 | 14 | * limitations under the License. |
vcoubard | 1078:79c089630b38 | 15 | */ |
vcoubard | 1078:79c089630b38 | 16 | |
vcoubard | 1078:79c089630b38 | 17 | #ifndef __BLE_PROTOCOL_H__ |
vcoubard | 1078:79c089630b38 | 18 | #define __BLE_PROTOCOL_H__ |
vcoubard | 1078:79c089630b38 | 19 | |
vcoubard | 1078:79c089630b38 | 20 | #include <stddef.h> |
vcoubard | 1078:79c089630b38 | 21 | #include <stdint.h> |
vcoubard | 1078:79c089630b38 | 22 | |
vcoubard | 1078:79c089630b38 | 23 | /** |
vcoubard | 1078:79c089630b38 | 24 | * A common namespace for types and constants used everywhere in BLE API. |
vcoubard | 1078:79c089630b38 | 25 | */ |
vcoubard | 1078:79c089630b38 | 26 | namespace BLEProtocol { |
vcoubard | 1078:79c089630b38 | 27 | /**< Address-type for Protocol addresses. */ |
vcoubard | 1078:79c089630b38 | 28 | struct AddressType { /* Adding a struct to encapsulate the contained enumeration |
vcoubard | 1078:79c089630b38 | 29 | * prevents polluting the BLEProtocol namespace with the |
vcoubard | 1078:79c089630b38 | 30 | * enumerated values. It also allows type-aliases for the |
vcoubard | 1078:79c089630b38 | 31 | * enumeration while retaining the enumerated values. i.e. |
vcoubard | 1078:79c089630b38 | 32 | * |
vcoubard | 1078:79c089630b38 | 33 | * doing: |
vcoubard | 1078:79c089630b38 | 34 | * typedef AddressType_t AliasedType_t; |
vcoubard | 1078:79c089630b38 | 35 | * would allow the use of AliasedType_t::PUBLIC in code. */ |
vcoubard | 1078:79c089630b38 | 36 | enum Type { |
vcoubard | 1078:79c089630b38 | 37 | PUBLIC = 0, |
vcoubard | 1078:79c089630b38 | 38 | RANDOM_STATIC, |
vcoubard | 1078:79c089630b38 | 39 | RANDOM_PRIVATE_RESOLVABLE, |
vcoubard | 1078:79c089630b38 | 40 | RANDOM_PRIVATE_NON_RESOLVABLE |
vcoubard | 1078:79c089630b38 | 41 | }; |
vcoubard | 1078:79c089630b38 | 42 | }; |
vcoubard | 1078:79c089630b38 | 43 | typedef AddressType::Type AddressType_t; /**< Alias for AddressType::Type */ |
vcoubard | 1078:79c089630b38 | 44 | |
vcoubard | 1078:79c089630b38 | 45 | static const size_t ADDR_LEN = 6; /**< Length (in octets) of the BLE MAC address. */ |
vcoubard | 1078:79c089630b38 | 46 | typedef uint8_t Address_t[ADDR_LEN]; /**< 48-bit address, in LSB format. */ |
vcoubard | 1078:79c089630b38 | 47 | }; |
vcoubard | 1078:79c089630b38 | 48 | |
vcoubard | 1078:79c089630b38 | 49 | #endif /* __BLE_PROTOCOL_H__ */ |