add "LE Device Address" 0x1B to advertising data types
Fork of BLE_API by
BLEProtocol.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __BLE_PROTOCOL_H__ 00018 #define __BLE_PROTOCOL_H__ 00019 00020 #include <stddef.h> 00021 #include <stdint.h> 00022 #include <algorithm> 00023 00024 /** 00025 * A common namespace for types and constants used everywhere in BLE API. 00026 */ 00027 namespace BLEProtocol { 00028 /**< 00029 * A simple container for the enumeration of address-types for Protocol addresses. 00030 * 00031 * Adding a struct to encapsulate the contained enumeration prevents 00032 * polluting the BLEProtocol namespace with the enumerated values. It also 00033 * allows type-aliases for the enumeration while retaining the enumerated 00034 * values. i.e. doing: 00035 * typedef AddressType AliasedType; 00036 * 00037 * would allow the use of AliasedType::PUBLIC in code. 00038 */ 00039 struct AddressType { 00040 /**< Address-types for Protocol addresses. */ 00041 enum Type { 00042 PUBLIC = 0, 00043 RANDOM_STATIC, 00044 RANDOM_PRIVATE_RESOLVABLE, 00045 RANDOM_PRIVATE_NON_RESOLVABLE 00046 }; 00047 }; 00048 typedef AddressType::Type AddressType_t; /**< Alias for AddressType::Type */ 00049 00050 static const size_t ADDR_LEN = 6; /**< Length (in octets) of the BLE MAC address. */ 00051 typedef uint8_t AddressBytes_t[ADDR_LEN]; /**< 48-bit address, in LSB format. */ 00052 00053 /** 00054 * BLE address. It contains an address-type (@ref AddressType_t) and bytes (@ref AddressBytes_t). 00055 */ 00056 struct Address_t { 00057 AddressType_t type; /**< @ref AddressType_t */ 00058 AddressBytes_t address; /**< @ref AddressBytes_t */ 00059 00060 Address_t(AddressType_t typeIn, const AddressBytes_t& addressIn) : type(typeIn) { 00061 std::copy(addressIn, addressIn + ADDR_LEN, address); 00062 } 00063 00064 Address_t() : type(), address() { 00065 } 00066 }; 00067 }; 00068 00069 #endif /* __BLE_PROTOCOL_H__ */
Generated on Fri Jul 15 2022 20:49:45 by
![doxygen](doxygen.png)