Define FastPairDeviceRepository

Move onwership of Fast Par Devices to a single point, FastPairDeviceRepository,
which will live inside a singleton FastPairService.

PiperOrigin-RevId: 534547186
This commit is contained in:
Janusz Sobczak
2023-05-23 13:54:05 -07:00
committed by Copybara-Service
parent 27267f57b8
commit c2fc33038c
16 changed files with 315 additions and 49 deletions
+9 -1
View File
@@ -45,8 +45,9 @@ class FastPairDevice {
: model_id_(model_id), ble_address_(ble_address), protocol_(protocol) {}
FastPairDevice(const FastPairDevice&) = delete;
FastPairDevice(FastPairDevice&&) = default;
FastPairDevice& operator=(const FastPairDevice&) = delete;
FastPairDevice& operator=(FastPairDevice&&) = delete;
FastPairDevice& operator=(FastPairDevice&&) = default;
~FastPairDevice() = default;
std::optional<std::string> GetPublicAddress() const {
@@ -87,6 +88,13 @@ class FastPairDevice {
Protocol GetProtocol() const { return protocol_; }
const std::string& GetUniqueId() const {
if (public_address_.has_value()) {
return *public_address_;
}
return ble_address_;
}
private:
std::string model_id_;