OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_connection.h" | 5 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // Deprecated signal send as the first byte in send byte operations. | 46 // Deprecated signal send as the first byte in send byte operations. |
47 const int kFirstByteZero = 0; | 47 const int kFirstByteZero = 0; |
48 | 48 |
49 // The maximum number of bytes written in a remote characteristic with a single | 49 // The maximum number of bytes written in a remote characteristic with a single |
50 // write request. This is not the connection MTU, we are assuming that the | 50 // write request. This is not the connection MTU, we are assuming that the |
51 // remote device allows for writes larger than MTU. | 51 // remote device allows for writes larger than MTU. |
52 const int kMaxChunkSize = 500; | 52 const int kMaxChunkSize = 500; |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 BluetoothLowEnergyConnection::BluetoothLowEnergyConnection( | 55 BluetoothLowEnergyConnection::BluetoothLowEnergyConnection( |
56 const RemoteDevice& device, | 56 const cryptauth::RemoteDevice& device, |
57 scoped_refptr<device::BluetoothAdapter> adapter, | 57 scoped_refptr<device::BluetoothAdapter> adapter, |
58 const BluetoothUUID remote_service_uuid, | 58 const BluetoothUUID remote_service_uuid, |
59 BluetoothThrottler* bluetooth_throttler, | 59 BluetoothThrottler* bluetooth_throttler, |
60 int max_number_of_write_attempts) | 60 int max_number_of_write_attempts) |
61 : Connection(device), | 61 : Connection(device), |
62 adapter_(adapter), | 62 adapter_(adapter), |
63 remote_service_({remote_service_uuid, ""}), | 63 remote_service_({remote_service_uuid, ""}), |
64 to_peripheral_char_({BluetoothUUID(kToPeripheralCharUUID), ""}), | 64 to_peripheral_char_({BluetoothUUID(kToPeripheralCharUUID), ""}), |
65 from_peripheral_char_({BluetoothUUID(kFromPeripheralCharUUID), ""}), | 65 from_peripheral_char_({BluetoothUUID(kFromPeripheralCharUUID), ""}), |
66 bluetooth_throttler_(bluetooth_throttler), | 66 bluetooth_throttler_(bluetooth_throttler), |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 const uint32_t value) { | 609 const uint32_t value) { |
610 std::vector<uint8_t> bytes(4, 0); | 610 std::vector<uint8_t> bytes(4, 0); |
611 bytes[0] = static_cast<uint8_t>(value); | 611 bytes[0] = static_cast<uint8_t>(value); |
612 bytes[1] = static_cast<uint8_t>(value >> 8); | 612 bytes[1] = static_cast<uint8_t>(value >> 8); |
613 bytes[2] = static_cast<uint8_t>(value >> 16); | 613 bytes[2] = static_cast<uint8_t>(value >> 16); |
614 bytes[3] = static_cast<uint8_t>(value >> 24); | 614 bytes[3] = static_cast<uint8_t>(value >> 24); |
615 return bytes; | 615 return bytes; |
616 } | 616 } |
617 | 617 |
618 } // namespace proximity_auth | 618 } // namespace proximity_auth |
OLD | NEW |