Bike service
Fork of BLE_API by
ble/BLEProtocol.h@1158:a37be30efc66, 2016-04-06 (annotated)
- Committer:
- vcoubard
- Date:
- Wed Apr 06 19:14:41 2016 +0100
- Revision:
- 1158:a37be30efc66
- Parent:
- 1136:22aada733dbd
- Child:
- 1172:cef71495d95d
Synchronized with git rev be76a698
Author: Andres Amaya Garcia
Fix doxygen warnings in BLEProtocol.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 1136:22aada733dbd | 1 | /* mbed Microcontroller Library |
vcoubard | 1136:22aada733dbd | 2 | * Copyright (c) 2006-2013 ARM Limited |
vcoubard | 1136:22aada733dbd | 3 | * |
vcoubard | 1136:22aada733dbd | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vcoubard | 1136:22aada733dbd | 5 | * you may not use this file except in compliance with the License. |
vcoubard | 1136:22aada733dbd | 6 | * You may obtain a copy of the License at |
vcoubard | 1136:22aada733dbd | 7 | * |
vcoubard | 1136:22aada733dbd | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
vcoubard | 1136:22aada733dbd | 9 | * |
vcoubard | 1136:22aada733dbd | 10 | * Unless required by applicable law or agreed to in writing, software |
vcoubard | 1136:22aada733dbd | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
vcoubard | 1136:22aada733dbd | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vcoubard | 1136:22aada733dbd | 13 | * See the License for the specific language governing permissions and |
vcoubard | 1136:22aada733dbd | 14 | * limitations under the License. |
vcoubard | 1136:22aada733dbd | 15 | */ |
vcoubard | 1136:22aada733dbd | 16 | |
vcoubard | 1136:22aada733dbd | 17 | #ifndef __BLE_PROTOCOL_H__ |
vcoubard | 1136:22aada733dbd | 18 | #define __BLE_PROTOCOL_H__ |
vcoubard | 1136:22aada733dbd | 19 | |
vcoubard | 1136:22aada733dbd | 20 | #include <stddef.h> |
vcoubard | 1136:22aada733dbd | 21 | #include <stdint.h> |
vcoubard | 1136:22aada733dbd | 22 | #include <algorithm> |
vcoubard | 1136:22aada733dbd | 23 | |
vcoubard | 1136:22aada733dbd | 24 | /** |
vcoubard | 1136:22aada733dbd | 25 | * A common namespace for types and constants used everywhere in BLE API. |
vcoubard | 1136:22aada733dbd | 26 | */ |
vcoubard | 1136:22aada733dbd | 27 | namespace BLEProtocol { |
vcoubard | 1136:22aada733dbd | 28 | /**< |
vcoubard | 1136:22aada733dbd | 29 | * A simple container for the enumeration of address-types for Protocol addresses. |
vcoubard | 1136:22aada733dbd | 30 | * |
vcoubard | 1136:22aada733dbd | 31 | * Adding a struct to encapsulate the contained enumeration prevents |
vcoubard | 1136:22aada733dbd | 32 | * polluting the BLEProtocol namespace with the enumerated values. It also |
vcoubard | 1136:22aada733dbd | 33 | * allows type-aliases for the enumeration while retaining the enumerated |
vcoubard | 1136:22aada733dbd | 34 | * values. i.e. doing: |
vcoubard | 1136:22aada733dbd | 35 | * typedef AddressType AliasedType; |
vcoubard | 1136:22aada733dbd | 36 | * |
vcoubard | 1136:22aada733dbd | 37 | * would allow the use of AliasedType::PUBLIC in code. |
vcoubard | 1136:22aada733dbd | 38 | */ |
vcoubard | 1136:22aada733dbd | 39 | struct AddressType { |
vcoubard | 1136:22aada733dbd | 40 | /**< Address-types for Protocol addresses. */ |
vcoubard | 1136:22aada733dbd | 41 | enum Type { |
vcoubard | 1136:22aada733dbd | 42 | PUBLIC = 0, |
vcoubard | 1136:22aada733dbd | 43 | RANDOM_STATIC, |
vcoubard | 1136:22aada733dbd | 44 | RANDOM_PRIVATE_RESOLVABLE, |
vcoubard | 1136:22aada733dbd | 45 | RANDOM_PRIVATE_NON_RESOLVABLE |
vcoubard | 1136:22aada733dbd | 46 | }; |
vcoubard | 1136:22aada733dbd | 47 | }; |
vcoubard | 1136:22aada733dbd | 48 | typedef AddressType::Type AddressType_t; /**< Alias for AddressType::Type */ |
vcoubard | 1136:22aada733dbd | 49 | |
vcoubard | 1136:22aada733dbd | 50 | static const size_t ADDR_LEN = 6; /**< Length (in octets) of the BLE MAC address. */ |
vcoubard | 1136:22aada733dbd | 51 | typedef uint8_t AddressBytes_t[ADDR_LEN]; /**< 48-bit address, in LSB format. */ |
vcoubard | 1136:22aada733dbd | 52 | |
vcoubard | 1136:22aada733dbd | 53 | /** |
vcoubard | 1136:22aada733dbd | 54 | * BLE address. It contains an address-type (@ref AddressType_t) and bytes (@ref AddressBytes_t). |
vcoubard | 1136:22aada733dbd | 55 | */ |
vcoubard | 1136:22aada733dbd | 56 | struct Address_t { |
vcoubard | 1136:22aada733dbd | 57 | AddressType_t type; /**< @ref AddressType_t */ |
vcoubard | 1136:22aada733dbd | 58 | AddressBytes_t address; /**< @ref AddressBytes_t */ |
vcoubard | 1136:22aada733dbd | 59 | |
vcoubard | 1158:a37be30efc66 | 60 | /** |
vcoubard | 1158:a37be30efc66 | 61 | * Construct an Address_t object with the supplied type and address. |
vcoubard | 1158:a37be30efc66 | 62 | * |
vcoubard | 1158:a37be30efc66 | 63 | * @param[in] typeIn |
vcoubard | 1158:a37be30efc66 | 64 | * The BLE address type. |
vcoubard | 1158:a37be30efc66 | 65 | * @param[in] addressIn |
vcoubard | 1158:a37be30efc66 | 66 | * The BLE address. |
vcoubard | 1158:a37be30efc66 | 67 | */ |
vcoubard | 1136:22aada733dbd | 68 | Address_t(AddressType_t typeIn, const AddressBytes_t& addressIn) : type(typeIn) { |
vcoubard | 1136:22aada733dbd | 69 | std::copy(addressIn, addressIn + ADDR_LEN, address); |
vcoubard | 1136:22aada733dbd | 70 | } |
vcoubard | 1136:22aada733dbd | 71 | |
vcoubard | 1136:22aada733dbd | 72 | Address_t() : type(), address() { |
vcoubard | 1136:22aada733dbd | 73 | } |
vcoubard | 1136:22aada733dbd | 74 | }; |
vcoubard | 1136:22aada733dbd | 75 | }; |
vcoubard | 1136:22aada733dbd | 76 | |
vcoubard | 1136:22aada733dbd | 77 | #endif /* __BLE_PROTOCOL_H__ */ |