Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_H_ | |
| 6 #define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include <vector> | |
| 12 | |
| 13 namespace proximity_auth { | |
| 14 // 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.
| |
| 15 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.
| |
| 16 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.
| |
| 17 // Determine whether a packet is a control packet or a data packet. | |
| 18 enum PacketType { DATA = 0x00, CONTROL = 0x01 }; | |
| 19 | |
| 20 // Identify the action intended by the control packet. | |
| 21 enum ControlCommand { | |
| 22 CONNECTION_REQUEST = 0x00, | |
| 23 CONNECTION_RESPONSE = 0x01, | |
| 24 CONNECTION_CLOSE = 0x02 | |
| 25 }; | |
| 26 | |
| 27 // Sent with the ConnectionClose control packet. | |
| 28 // Identify why the client/server wished to close the connection. | |
| 29 enum ReasonForClose { | |
| 30 CLOSE_WITHOUT_ERROR = 0x00, | |
| 31 UNKNOWN_ERROR = 0x01, | |
| 32 NO_COMMON_VERSION_SUPPORTED = 0x02, | |
| 33 RECEIVED_PACKET_OUT_OF_SEQUENCE = 0x03, | |
| 34 APPLICATION_ERROR = 0x80 | |
| 35 }; | |
| 36 | |
| 37 typedef std::vector<uint8_t> Packet; | |
| 38 }; | |
| 39 | |
| 40 } // namespace proximity_auth | |
| 41 | |
| 42 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_H_ | |
| OLD | NEW |