Index: components/proximity_auth/ble/bluetooth_low_energy_weave_packet.h |
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_weave_packet.h b/components/proximity_auth/ble/bluetooth_low_energy_weave_packet.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d9991c641e7e68e26fac403c85639e0e896575ac |
--- /dev/null |
+++ b/components/proximity_auth/ble/bluetooth_low_energy_weave_packet.h |
@@ -0,0 +1,42 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_H_ |
+#define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_H_ |
+ |
+#include <stddef.h> |
+#include <stdint.h> |
+ |
+#include <vector> |
+ |
+namespace proximity_auth { |
+// Generates the messages sent using the uWeave protocol. |
Tim Song
2016/06/27 20:47:30
This comment needs updating.
jingxuy
2016/06/27 22:21:33
Done.
|
+class BluetoothLowEnergyWeavePacket { |
Tim Song
2016/06/27 20:47:30
Maybe name this something like WeaveDefines. This
Kyle Horimoto
2016/06/27 20:51:11
+1, this should not even be a class at all. Just a
jingxuy
2016/06/27 22:21:33
Done.
|
+ public: |
Tim Song
2016/06/27 20:47:30
You should also make a private constructor, so thi
Kyle Horimoto
2016/06/27 20:51:11
It won't need a constructor at all once you make i
jingxuy
2016/06/27 22:21:33
Done.
|
+ // Determine whether a packet is a control packet or a data packet. |
+ enum PacketType { DATA = 0x00, CONTROL = 0x01 }; |
+ |
+ // Identify the action intended by the control packet. |
+ enum ControlCommand { |
+ CONNECTION_REQUEST = 0x00, |
+ CONNECTION_RESPONSE = 0x01, |
+ CONNECTION_CLOSE = 0x02 |
+ }; |
+ |
+ // Sent with the ConnectionClose control packet. |
+ // Identify why the client/server wished to close the connection. |
+ enum ReasonForClose { |
+ CLOSE_WITHOUT_ERROR = 0x00, |
+ UNKNOWN_ERROR = 0x01, |
+ NO_COMMON_VERSION_SUPPORTED = 0x02, |
+ RECEIVED_PACKET_OUT_OF_SEQUENCE = 0x03, |
+ APPLICATION_ERROR = 0x80 |
+ }; |
+ |
+ typedef std::vector<uint8_t> Packet; |
+}; |
+ |
+} // namespace proximity_auth |
+ |
+#endif // COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_H_ |