#include "bt_types.h"
#include "btm_api.h"
#include "btm_ble_api.h"
+#include "types/ble_address_with_type.h"
#include "types/bt_transport.h"
/*****************************************************************************
#include <list>
#include <string>
#include "osi/include/config.h"
+#include "types/ble_address_with_type.h"
static const char BTIF_CONFIG_MODULE[] = "btif_config_module";
#include "bt_target.h"
#include "bt_types.h"
+#include "types/ble_address_with_type.h"
/*******************************************************************************
* Constants & Macros
#include "main/shim/acl_api.h"
#include "main/shim/helpers.h"
#include "main/shim/stack.h"
+#include "types/ble_address_with_type.h"
#include "types/raw_address.h"
void bluetooth::shim::ACL_CreateClassicConnection(
#pragma once
#include "stack/include/bt_types.h"
+#include "types/ble_address_with_type.h"
#include "types/raw_address.h"
namespace bluetooth {
#include <cstdint>
#include "stack/include/bt_types.h"
#include "stack/include/hci_error_code.h"
+#include "types/ble_address_with_type.h"
#include "types/raw_address.h"
namespace bluetooth {
#include "osi/include/allocator.h"
#include "stack/include/bt_types.h"
#include "stack/include/hci_error_code.h"
+#include "types/ble_address_with_type.h"
namespace bluetooth {
#include "osi/include/alarm.h"
#include "stack/include/btm_api_types.h"
+#include "types/ble_address_with_type.h"
#include "types/raw_address.h"
/* Discoverable modes */
#define BRCM_RESERVED_PSM_START 0x5AE1
#define BRCM_RESERVED_PSM_END 0x5AFF
-/*****************************************************************************
- * Low Energy definitions
- *
- * Address types
- */
-#define BLE_ADDR_PUBLIC 0x00
-#define BLE_ADDR_RANDOM 0x01
-#define BLE_ADDR_PUBLIC_ID 0x02
-#define BLE_ADDR_RANDOM_ID 0x03
-#define BLE_ADDR_ANONYMOUS 0xFF
-typedef uint8_t tBLE_ADDR_TYPE;
-#ifdef __cplusplus
-inline std::string AddressTypeText(tBLE_ADDR_TYPE type) {
- switch (type) {
- case BLE_ADDR_PUBLIC:
- return std::string("public");
- case BLE_ADDR_RANDOM:
- return std::string("random");
- case BLE_ADDR_PUBLIC_ID:
- return std::string("public identity");
- case BLE_ADDR_RANDOM_ID:
- return std::string("random identity");
- case BLE_ADDR_ANONYMOUS:
- return std::string("anonymous");
- default:
- return std::string("unknown");
- }
-}
-#endif // __cplusplus
-
-/* BLE ADDR type ID bit */
-#define BLE_ADDR_TYPE_ID_BIT 0x02
-
-#ifdef __cplusplus
-constexpr uint8_t kBleAddressPublicDevice = BLE_ADDR_PUBLIC;
-constexpr uint8_t kBleAddressRandomDevice = BLE_ADDR_RANDOM;
-constexpr uint8_t kBleAddressIdentityBit = BLE_ADDR_TYPE_ID_BIT;
-constexpr uint8_t kBleAddressPublicIdentity =
- kBleAddressIdentityBit | kBleAddressPublicDevice;
-constexpr uint8_t kBleAddressRandomIdentity =
- kBleAddressIdentityBit | kBleAddressRandomDevice;
-
-constexpr uint8_t kResolvableAddressMask = 0xc0;
-constexpr uint8_t kResolvableAddressMsb = 0x40;
-
-struct tBLE_BD_ADDR {
- tBLE_ADDR_TYPE type;
- RawAddress bda;
- bool AddressEquals(const RawAddress& other) const { return other == bda; }
- bool IsPublicDeviceType() const { return type == kBleAddressPublicDevice; }
- bool IsRandomDeviceType() const { return type == kBleAddressRandomDevice; }
- bool IsPublicIdentityType() const {
- return type == kBleAddressPublicIdentity;
- }
- bool lsRandomIdentityType() const {
- return type == kBleAddressRandomIdentity;
- }
- bool IsAddressResolvable() const {
- return ((bda.address)[0] & kResolvableAddressMask) == kResolvableAddressMsb;
- }
- bool IsPublic() const { return type & 0x01; }
- bool IsResolvablePrivateAddress() const {
- return IsAddressResolvable() && IsRandomDeviceType();
- }
- bool IsIdentityType() const {
- return IsPublicIdentityType() || lsRandomIdentityType();
- }
- bool TypeWithoutIdentityEquals(const tBLE_ADDR_TYPE other) const {
- return (other & ~kBleAddressIdentityBit) ==
- (type & ~kBleAddressIdentityBit);
- }
- std::string ToString() const {
- return std::string(bda.ToString() + "[" + AddressTypeText(type) + "]");
- }
-};
-#endif
-
/* Device Types
*/
enum : uint8_t {
#include "stack/include/btm_status.h"
#include "stack/include/hcidefs.h"
#include "stack/include/smp_api_types.h"
+#include "types/ble_address_with_type.h"
#include "types/bt_transport.h"
/* Device name of peer (may be truncated to save space in BTM database) */
#include <base/callback_forward.h>
#include <hardware/bt_common_types.h>
#include <vector>
+#include "types/ble_address_with_type.h"
#define CHNL_MAP_LEN 5
typedef uint8_t tBTM_BLE_CHNL_MAP[CHNL_MAP_LEN];
#define SMP_API_TYPES_H
#include "bt_target.h"
+#include "types/ble_address_with_type.h"
/* SMP command code */
#define SMP_OPCODE_PAIRING_REQ 0x01
--- /dev/null
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include "types/raw_address.h"
+
+#define BLE_ADDR_PUBLIC 0x00
+#define BLE_ADDR_RANDOM 0x01
+#define BLE_ADDR_PUBLIC_ID 0x02
+#define BLE_ADDR_RANDOM_ID 0x03
+#define BLE_ADDR_ANONYMOUS 0xFF
+typedef uint8_t tBLE_ADDR_TYPE;
+#ifdef __cplusplus
+inline std::string AddressTypeText(tBLE_ADDR_TYPE type) {
+ switch (type) {
+ case BLE_ADDR_PUBLIC:
+ return std::string("public");
+ case BLE_ADDR_RANDOM:
+ return std::string("random");
+ case BLE_ADDR_PUBLIC_ID:
+ return std::string("public identity");
+ case BLE_ADDR_RANDOM_ID:
+ return std::string("random identity");
+ case BLE_ADDR_ANONYMOUS:
+ return std::string("anonymous");
+ default:
+ return std::string("unknown");
+ }
+}
+#endif // __cplusplus
+
+/* BLE ADDR type ID bit */
+#define BLE_ADDR_TYPE_ID_BIT 0x02
+
+#ifdef __cplusplus
+constexpr uint8_t kBleAddressPublicDevice = BLE_ADDR_PUBLIC;
+constexpr uint8_t kBleAddressRandomDevice = BLE_ADDR_RANDOM;
+constexpr uint8_t kBleAddressIdentityBit = BLE_ADDR_TYPE_ID_BIT;
+constexpr uint8_t kBleAddressPublicIdentity =
+ kBleAddressIdentityBit | kBleAddressPublicDevice;
+constexpr uint8_t kBleAddressRandomIdentity =
+ kBleAddressIdentityBit | kBleAddressRandomDevice;
+
+constexpr uint8_t kResolvableAddressMask = 0xc0;
+constexpr uint8_t kResolvableAddressMsb = 0x40;
+
+struct tBLE_BD_ADDR {
+ tBLE_ADDR_TYPE type;
+ RawAddress bda;
+ bool AddressEquals(const RawAddress& other) const { return other == bda; }
+ bool IsPublicDeviceType() const { return type == kBleAddressPublicDevice; }
+ bool IsRandomDeviceType() const { return type == kBleAddressRandomDevice; }
+ bool IsPublicIdentityType() const {
+ return type == kBleAddressPublicIdentity;
+ }
+ bool lsRandomIdentityType() const {
+ return type == kBleAddressRandomIdentity;
+ }
+ bool IsAddressResolvable() const {
+ return ((bda.address)[0] & kResolvableAddressMask) == kResolvableAddressMsb;
+ }
+ bool IsPublic() const { return type & 0x01; }
+ bool IsResolvablePrivateAddress() const {
+ return IsAddressResolvable() && IsRandomDeviceType();
+ }
+ bool IsIdentityType() const {
+ return IsPublicIdentityType() || lsRandomIdentityType();
+ }
+ bool TypeWithoutIdentityEquals(const tBLE_ADDR_TYPE other) const {
+ return (other & ~kBleAddressIdentityBit) ==
+ (type & ~kBleAddressIdentityBit);
+ }
+ std::string ToString() const {
+ return std::string(bda.ToString() + "[" + AddressTypeText(type) + "]");
+ }
+};
+#endif