mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 07:06:11 -04:00
internal update
PiperOrigin-RevId: 729773934
This commit is contained in:
committed by
Copybara-Service
parent
5f3b7493cc
commit
a7bb6673a6
@@ -24,6 +24,8 @@
|
||||
namespace nearby::connections::advertisements {
|
||||
|
||||
std::optional<std::string> ReadDeviceName(const ByteArray& endpoint_info) {
|
||||
// Should always match the protocol implementation to read device name.
|
||||
// LINT.IfChange
|
||||
StreamReader reader(endpoint_info);
|
||||
std::optional<uint8_t> version = reader.ReadBits(3);
|
||||
if (!version.has_value() || *version != 1) {
|
||||
@@ -55,6 +57,7 @@ std::optional<std::string> ReadDeviceName(const ByteArray& endpoint_info) {
|
||||
}
|
||||
|
||||
return std::string(*device_name);
|
||||
// LINT.ThenChange(//depot/google3/third_party/nearby/sharing/advertisement.cc)
|
||||
}
|
||||
|
||||
} // namespace nearby::connections::advertisements
|
||||
|
||||
@@ -195,6 +195,9 @@ std::vector<uint8_t> Advertisement::ToEndpointInfo() const {
|
||||
|
||||
std::unique_ptr<Advertisement> Advertisement::FromEndpointInfo(
|
||||
absl::Span<const uint8_t> endpoint_info) {
|
||||
// Should always match the Nearby Connections implementation to read device
|
||||
// name.
|
||||
// LINT.IfChange
|
||||
if (endpoint_info.size() < kMinimumSize) {
|
||||
NL_LOG(ERROR) << "Failed to parse advertisement because it was too short.";
|
||||
return nullptr;
|
||||
@@ -271,6 +274,7 @@ std::unique_ptr<Advertisement> Advertisement::FromEndpointInfo(
|
||||
return Advertisement::NewInstance(
|
||||
std::move(salt), std::move(encrypted_metadata_key), device_type,
|
||||
std::move(optional_device_name), vendor_id);
|
||||
// LINT.ThenChange(//depot/google3/third_party/nearby/connections/implementation/mediums/advertisements/advertisement_util.cc)
|
||||
}
|
||||
|
||||
bool Advertisement::operator==(const Advertisement& other) const {
|
||||
|
||||
Reference in New Issue
Block a user