mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Make BT MacAddress optional in Private certs.
PiperOrigin-RevId: 797357330
This commit is contained in:
committed by
Copybara-Service
parent
f8e3f97c4e
commit
29f37997ec
@@ -17,8 +17,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "internal/platform/bluetooth_utils.h"
|
||||
#include "internal/platform/implementation/g3/bluetooth_classic.h"
|
||||
#include "internal/platform/mac_address.h"
|
||||
#include "internal/platform/medium_environment.h"
|
||||
#include "internal/platform/prng.h"
|
||||
|
||||
@@ -53,7 +52,11 @@ std::string BluetoothDevice::GetMacAddress() const {
|
||||
|
||||
BluetoothAdapter::BluetoothAdapter() {
|
||||
std::uint64_t raw_mac_addr = Prng().NextInt64() & kMacAddressMask;
|
||||
SetMacAddress(BluetoothUtils::FromNumber(raw_mac_addr));
|
||||
MacAddress mac_address;
|
||||
if (MacAddress::FromUint64(raw_mac_addr, mac_address) &&
|
||||
mac_address.IsSet()) {
|
||||
SetMacAddress(mac_address);
|
||||
}
|
||||
unique_id_ = raw_mac_addr;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
#define PLATFORM_IMPL_G3_BLUETOOTH_ADAPTER_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/base/thread_annotations.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
@@ -27,7 +25,6 @@
|
||||
#include "internal/platform/implementation/ble_v2.h"
|
||||
#include "internal/platform/implementation/bluetooth_adapter.h"
|
||||
#include "internal/platform/implementation/bluetooth_classic.h"
|
||||
#include "internal/platform/implementation/g3/single_thread_executor.h"
|
||||
#include "internal/platform/mac_address.h"
|
||||
|
||||
namespace nearby {
|
||||
@@ -131,8 +128,8 @@ class BluetoothAdapter : public api::BluetoothAdapter {
|
||||
void SetBleV2Medium(api::ble_v2::BleMedium* medium);
|
||||
api::ble_v2::BleMedium* GetBleV2Medium() { return ble_v2_medium_; }
|
||||
|
||||
void SetMacAddress(absl::string_view mac_address) {
|
||||
MacAddress::FromString(mac_address, mac_address_);
|
||||
void SetMacAddress(MacAddress mac_address) {
|
||||
mac_address_ = mac_address;
|
||||
}
|
||||
|
||||
std::uint64_t GetUniqueId() { return unique_id_; }
|
||||
|
||||
Reference in New Issue
Block a user