OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "device/bluetooth/bluez/bluetooth_device_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_device_bluez.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (vendor_id_source != NULL) | 81 if (vendor_id_source != NULL) |
82 *vendor_id_source = source_value; | 82 *vendor_id_source = source_value; |
83 if (vendor_id != NULL) | 83 if (vendor_id != NULL) |
84 *vendor_id = vendor_value; | 84 *vendor_id = vendor_value; |
85 if (product_id != NULL) | 85 if (product_id != NULL) |
86 *product_id = product_value; | 86 *product_id = product_value; |
87 if (device_id != NULL) | 87 if (device_id != NULL) |
88 *device_id = device_value; | 88 *device_id = device_value; |
89 } | 89 } |
90 | 90 |
91 int8_t ClampPower(int16_t power) { | |
92 if (power < INT8_MIN) { | |
93 return INT8_MIN; | |
94 } | |
95 if (power > INT8_MAX) { | |
96 return INT8_MAX; | |
97 } | |
98 return static_cast<int8_t>(power); | |
99 } | |
100 | |
101 void RecordPairingResult(BluetoothDevice::ConnectErrorCode error_code) { | 91 void RecordPairingResult(BluetoothDevice::ConnectErrorCode error_code) { |
102 UMAPairingResult pairing_result; | 92 UMAPairingResult pairing_result; |
103 switch (error_code) { | 93 switch (error_code) { |
104 case BluetoothDevice::ERROR_INPROGRESS: | 94 case BluetoothDevice::ERROR_INPROGRESS: |
105 pairing_result = UMA_PAIRING_RESULT_INPROGRESS; | 95 pairing_result = UMA_PAIRING_RESULT_INPROGRESS; |
106 break; | 96 break; |
107 case BluetoothDevice::ERROR_FAILED: | 97 case BluetoothDevice::ERROR_FAILED: |
108 pairing_result = UMA_PAIRING_RESULT_FAILED; | 98 pairing_result = UMA_PAIRING_RESULT_FAILED; |
109 break; | 99 break; |
110 case BluetoothDevice::ERROR_AUTH_FAILED: | 100 case BluetoothDevice::ERROR_AUTH_FAILED: |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, | 879 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, |
890 const std::string& error_name, | 880 const std::string& error_name, |
891 const std::string& error_message) { | 881 const std::string& error_message) { |
892 LOG(WARNING) << object_path_.value() | 882 LOG(WARNING) << object_path_.value() |
893 << ": Failed to remove device: " << error_name << ": " | 883 << ": Failed to remove device: " << error_name << ": " |
894 << error_message; | 884 << error_message; |
895 error_callback.Run(); | 885 error_callback.Run(); |
896 } | 886 } |
897 | 887 |
898 } // namespace bluez | 888 } // namespace bluez |
OLD | NEW |