OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/proximity_auth/ble/bluetooth_low_energy_weave_packet_genera
tor.h" | 5 #include "components/cryptauth/ble/bluetooth_low_energy_weave_packet_generator.h
" |
6 | 6 |
7 #ifdef OS_WIN | 7 #ifdef OS_WIN |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 #else | 9 #else |
10 #include <netinet/in.h> | 10 #include <netinet/in.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include <algorithm> | 15 #include <algorithm> |
16 | 16 |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 | 18 |
19 namespace proximity_auth { | 19 namespace cryptauth { |
20 namespace weave { | 20 namespace weave { |
21 | 21 |
22 // static. | 22 // static. |
23 std::shared_ptr<BluetoothLowEnergyWeavePacketGenerator::Factory> | 23 std::shared_ptr<BluetoothLowEnergyWeavePacketGenerator::Factory> |
24 BluetoothLowEnergyWeavePacketGenerator::Factory::factory_instance_ = | 24 BluetoothLowEnergyWeavePacketGenerator::Factory::factory_instance_ = |
25 nullptr; | 25 nullptr; |
26 | 26 |
27 // static. | 27 // static. |
28 std::unique_ptr<BluetoothLowEnergyWeavePacketGenerator> | 28 std::unique_ptr<BluetoothLowEnergyWeavePacketGenerator> |
29 BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance() { | 29 BluetoothLowEnergyWeavePacketGenerator::Factory::NewInstance() { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 void BluetoothLowEnergyWeavePacketGenerator::SetDataLastBit(Packet* packet) { | 191 void BluetoothLowEnergyWeavePacketGenerator::SetDataLastBit(Packet* packet) { |
192 DCHECK(packet); | 192 DCHECK(packet); |
193 DCHECK(!packet->empty()); | 193 DCHECK(!packet->empty()); |
194 | 194 |
195 // Last bit is the bit 2 of the packet's first byte and set it to 1. | 195 // Last bit is the bit 2 of the packet's first byte and set it to 1. |
196 packet->at(0) = packet->at(0) | (1 << 2); | 196 packet->at(0) = packet->at(0) | (1 << 2); |
197 } | 197 } |
198 | 198 |
199 } // namespace weave | 199 } // namespace weave |
200 | 200 |
201 } // namespace proximity_auth | 201 } // namespace cryptauth |
OLD | NEW |