nearby: snapshot of cl/304428753

Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: I0023ac6e40456fc4a8169c3173bcbff3b5ccc476
This commit is contained in:
Alexey Polyudov
2020-04-04 12:54:05 -07:00
parent 204f76077d
commit d455926d89
87 changed files with 2869 additions and 631 deletions
+32
View File
@@ -41,6 +41,38 @@ class BLEPacket {
ScopedPtr<ConstPtr<ByteArray> > data_;
};
// Represents the format of data sent over BLE sockets.
//
// [SERVICE_ID_HASH][DATA]
//
// See go/nearby-ble-design for more information.
class BlePacket {
public:
static BlePacket FromBytes(const ByteArray& bytes);
static ByteArray ToBytes(const ByteArray& service_id_hash,
const ByteArray& data);
static const uint32_t kServiceIdHashLength;
~BlePacket();
ByteArray GetServiceIdHash() const;
ByteArray GetData() const;
private:
static size_t ComputeDataSize(const ByteArray& ble_packet_bytes);
static size_t ComputePacketLength(const ByteArray& data);
static const uint32_t kMinPacketLength;
static const uint32_t kMaxDataSize;
BlePacket(const ByteArray& service_id_hash, const ByteArray& data);
ByteArray service_id_hash_;
ByteArray data_;
};
} // namespace mediums
} // namespace connections
} // namespace nearby