mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Add GetFastPairVersion to DeviceMetadata
PiperOrigin-RevId: 520094589
This commit is contained in:
committed by
Copybara-Service
parent
b25314c34c
commit
ec0944a61b
@@ -18,6 +18,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "fastpair/proto/fastpair_rpcs.proto.h"
|
||||
#include "fastpair/common/fast_pair_device.h"
|
||||
|
||||
namespace nearby {
|
||||
namespace fastpair {
|
||||
@@ -35,6 +36,15 @@ class DeviceMetadata {
|
||||
return response_;
|
||||
}
|
||||
|
||||
DeviceFastPairVersion GetFastPairVersion() const {
|
||||
// Anti-spoofing keys were introduced in Fast Pair v2, so if this isn't
|
||||
// available then the device is v1.
|
||||
if (GetDetails().anti_spoofing_key_pair().public_key().empty()) {
|
||||
return DeviceFastPairVersion::kV1;
|
||||
}
|
||||
return DeviceFastPairVersion::kHigherThanV1;
|
||||
}
|
||||
|
||||
private:
|
||||
const proto::GetObservedDeviceResponse response_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user