Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Unified Diff: components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc

Issue 2096103003: Move weave packet to common location b/t generator and receiver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved common enums to a namespace Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc b/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc
index 576296ca3b6f5fc647ae84d882251d707c0e578a..fd05ecfc0935ee8c85e833fcd107aea31645b0c3 100644
--- a/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc
+++ b/components/proximity_auth/ble/bluetooth_low_energy_weave_packet_generator.cc
@@ -16,25 +16,16 @@
#include "base/logging.h"
+namespace proximity_auth {
+namespace weave {
namespace {
-typedef proximity_auth::BluetoothLowEnergyWeavePacketGenerator::Packet Packet;
-
-const uint16_t kMinSupportedWeaveVersion = 1;
-const uint16_t kMaxSupportedWeaveVersion = 1;
-const uint16_t kServerWeaveVersion = 1;
const uint16_t kMinConnectionRequestSize = 7;
const uint16_t kMinConnectionResponseSize = 5;
const uint16_t kMinConnectionCloseSize = 3;
-const uint32_t kDefaultMaxPacketSize = 20;
-// Max packet size is 0, which means defer the decision to the server.
-const uint16_t kMaxSupportedPacketSize = 0;
-const uint8_t kMaxPacketCounter = 8;
} // namespace
-namespace proximity_auth {
-
// static.
BluetoothLowEnergyWeavePacketGenerator::Factory*
BluetoothLowEnergyWeavePacketGenerator::Factory::factory_instance_ =
@@ -72,9 +63,9 @@ Packet BluetoothLowEnergyWeavePacketGenerator::CreateConnectionRequest() {
// resets the packet counter.
next_packet_counter_ = 1;
SetControlCommand(ControlCommand::CONNECTION_REQUEST, &packet);
- SetShortField(1, kMinSupportedWeaveVersion, &packet);
- SetShortField(3, kMaxSupportedWeaveVersion, &packet);
- SetShortField(5, kMaxSupportedPacketSize, &packet);
+ SetShortField(1, kWeaveVersion, &packet);
+ SetShortField(3, kWeaveVersion, &packet);
+ SetShortField(5, kSelectMaxPacketSize, &packet);
return packet;
}
@@ -87,7 +78,7 @@ Packet BluetoothLowEnergyWeavePacketGenerator::CreateConnectionResponse() {
// resets the next packet counter.
next_packet_counter_ = 1;
SetControlCommand(ControlCommand::CONNECTION_RESPONSE, &packet);
- SetShortField(1, kServerWeaveVersion, &packet);
+ SetShortField(1, kWeaveVersion, &packet);
SetShortField(3, max_packet_size_, &packet);
return packet;
@@ -212,4 +203,5 @@ void BluetoothLowEnergyWeavePacketGenerator::SetDataLastBit(Packet* packet) {
packet->at(0) = packet->at(0) | (1 << 2);
}
+} // namespace weave
} // namespace proximity_auth

Powered by Google App Engine
This is Rietveld 408576698