| 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 "device/bluetooth/bluez/bluetooth_advertisement_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_advertisement_bluez.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 void UnregisterFailure(device::BluetoothAdvertisement::ErrorCode error) { | 23 void UnregisterFailure(device::BluetoothAdvertisement::ErrorCode error) { |
| 24 LOG(ERROR) | 24 LOG(ERROR) |
| 25 << "BluetoothAdvertisementBlueZ::Unregister failed with error code = " | 25 << "BluetoothAdvertisementBlueZ::Unregister failed with error code = " |
| 26 << error; | 26 << error; |
| 27 } | 27 } |
| 28 | 28 |
| 29 device::BluetoothAdvertisement::ErrorCode GetErrorCodeFromErrorStrings( | 29 device::BluetoothAdvertisement::ErrorCode GetErrorCodeFromErrorStrings( |
| 30 const std::string& error_name, | 30 const std::string& error_name, |
| 31 const std::string& error_message) { | 31 const std::string& error_message) { |
| 32 if (error_name == bluetooth_advertising_manager::kErrorFailed || | 32 if (error_name == bluetooth_advertising_manager::kErrorAlreadyExists) { |
| 33 error_name == bluetooth_advertising_manager::kErrorAlreadyExists) { | |
| 34 return device::BluetoothAdvertisement::ErrorCode:: | 33 return device::BluetoothAdvertisement::ErrorCode:: |
| 35 ERROR_ADVERTISEMENT_ALREADY_EXISTS; | 34 ERROR_ADVERTISEMENT_ALREADY_EXISTS; |
| 35 } else if (error_name == bluetooth_advertising_manager::kErrorFailed) { |
| 36 return device::BluetoothAdvertisement::ErrorCode:: |
| 37 ERROR_ADVERTISEMENT_FAILED; |
| 36 } else if (error_name == | 38 } else if (error_name == |
| 37 bluetooth_advertising_manager::kErrorInvalidArguments) { | 39 bluetooth_advertising_manager::kErrorInvalidArguments) { |
| 38 return device::BluetoothAdvertisement::ErrorCode:: | 40 return device::BluetoothAdvertisement::ErrorCode:: |
| 39 ERROR_ADVERTISEMENT_INVALID_LENGTH; | 41 ERROR_ADVERTISEMENT_INVALID_LENGTH; |
| 40 } else if (error_name == bluetooth_advertising_manager::kErrorDoesNotExist) { | 42 } else if (error_name == bluetooth_advertising_manager::kErrorDoesNotExist) { |
| 41 return device::BluetoothAdvertisement::ErrorCode:: | 43 return device::BluetoothAdvertisement::ErrorCode:: |
| 42 ERROR_ADVERTISEMENT_DOES_NOT_EXIST; | 44 ERROR_ADVERTISEMENT_DOES_NOT_EXIST; |
| 43 } | 45 } |
| 44 return device::BluetoothAdvertisement::ErrorCode:: | 46 return device::BluetoothAdvertisement::ErrorCode:: |
| 45 INVALID_ADVERTISEMENT_ERROR_CODE; | 47 INVALID_ADVERTISEMENT_ERROR_CODE; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 129 } |
| 128 | 130 |
| 129 void BluetoothAdvertisementBlueZ::Released() { | 131 void BluetoothAdvertisementBlueZ::Released() { |
| 130 LOG(WARNING) << "Advertisement released."; | 132 LOG(WARNING) << "Advertisement released."; |
| 131 provider_.reset(); | 133 provider_.reset(); |
| 132 for (auto& observer : observers_) | 134 for (auto& observer : observers_) |
| 133 observer.AdvertisementReleased(this); | 135 observer.AdvertisementReleased(this); |
| 134 } | 136 } |
| 135 | 137 |
| 136 } // namespace bluez | 138 } // namespace bluez |
| OLD | NEW |