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