 Chromium Code Reviews
 Chromium Code Reviews Issue 2096103003:
  Move weave packet to common location b/t generator and receiver  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2096103003:
  Move weave packet to common location b/t generator and receiver  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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_ | |
| 
Tim Song
2016/06/27 23:16:10
Also rename this file to something like weave_defi
 
jingxuy
2016/06/27 23:27:24
Done.
 | |
| 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 namespace weave { | |
| 15 | |
| 16 enum PacketType { DATA = 0x00, CONTROL = 0x01 }; | |
| 17 | |
| 18 // Identify the action intended by the control packet. | |
| 19 enum ControlCommand { | |
| 20 CONNECTION_REQUEST = 0x00, | |
| 21 CONNECTION_RESPONSE = 0x01, | |
| 22 CONNECTION_CLOSE = 0x02 | |
| 23 }; | |
| 24 | |
| 25 // Sent with the ConnectionClose control packet. | |
| 26 // Identify why the client/server wished to close the connection. | |
| 27 enum ReasonForClose { | |
| 28 CLOSE_WITHOUT_ERROR = 0x00, | |
| 29 UNKNOWN_ERROR = 0x01, | |
| 30 NO_COMMON_VERSION_SUPPORTED = 0x02, | |
| 31 RECEIVED_PACKET_OUT_OF_SEQUENCE = 0x03, | |
| 32 APPLICATION_ERROR = 0x80 | |
| 33 }; | |
| 34 | |
| 35 typedef std::vector<uint8_t> Packet; | |
| 36 | |
| 37 const uint16_t kMinConnectionRequestSize = 7; | |
| 38 const uint16_t kMinConnectionResponseSize = 5; | |
| 39 const uint16_t kMaxConnectionCloseSize = 3; | |
| 40 const uint16_t kDefaultMaxPacketSize = 20; | |
| 41 const uint16_t kWeaveVersion = 1; | |
| 42 // Defer selecting the max packet size to the server. | |
| 43 const uint16_t kSelectMaxPacketSize = 0; | |
| 44 const uint8_t kMaxPacketCounter = 8; | |
| 45 | |
| 46 // Used only for tests. | |
| 47 const uint8_t kByteDefaultMaxPacketSize = 20; | |
| 48 const uint8_t kByteWeaveVersion = 1; | |
| 49 const uint8_t kByteSelectMaxPacketSize = 0; | |
| 50 const uint8_t kEmptyUpperByte = 0; | |
| 51 | |
| 52 } // namespace weave | |
| 53 } // namespace proximity_auth | |
| 54 | |
| 55 #endif // COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_PACKET_H_ | |
| OLD | NEW |