| Index: device/bluetooth/bluetooth_device.cc
|
| diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc
|
| index a2249c50709db713510a7caab4ed1fb546269bb7..fcda56884af90f9cef345e85311992f1feb11679 100644
|
| --- a/device/bluetooth/bluetooth_device.cc
|
| +++ b/device/bluetooth/bluetooth_device.cc
|
| @@ -18,84 +18,75 @@ bool BluetoothDevice::IsUUIDValid(const std::string& uuid) {
|
| return !bluetooth_utils::CanonicalUuid(uuid).empty();
|
| }
|
|
|
| -BluetoothDevice::BluetoothDevice()
|
| - : bluetooth_class_(0),
|
| - visible_(false),
|
| - bonded_(false),
|
| - connected_(false),
|
| - connectable_(true),
|
| - connecting_(false) {
|
| +BluetoothDevice::BluetoothDevice() {
|
| }
|
|
|
| BluetoothDevice::~BluetoothDevice() {
|
| }
|
|
|
| -const std::string& BluetoothDevice::address() const {
|
| - return address_;
|
| -}
|
| -
|
| string16 BluetoothDevice::GetName() const {
|
| - if (!name_.empty()) {
|
| - return UTF8ToUTF16(name_);
|
| + if (!name().empty()) {
|
| + return UTF8ToUTF16(name());
|
| } else {
|
| return GetAddressWithLocalizedDeviceTypeName();
|
| }
|
| }
|
|
|
| string16 BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() const {
|
| - string16 address = UTF8ToUTF16(address_);
|
| + string16 address_utf16 = UTF8ToUTF16(address());
|
| BluetoothDevice::DeviceType device_type = GetDeviceType();
|
| switch (device_type) {
|
| case DEVICE_COMPUTER:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_COMPUTER,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_PHONE:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_PHONE,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_MODEM:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_MODEM,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_AUDIO:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_AUDIO,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_CAR_AUDIO:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_CAR_AUDIO,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_VIDEO:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_VIDEO,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_JOYSTICK:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_JOYSTICK,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_GAMEPAD:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_GAMEPAD,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_KEYBOARD:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_KEYBOARD,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_MOUSE:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_MOUSE,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_TABLET:
|
| return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_TABLET,
|
| - address);
|
| + address_utf16);
|
| case DEVICE_KEYBOARD_MOUSE_COMBO:
|
| return l10n_util::GetStringFUTF16(
|
| - IDS_BLUETOOTH_DEVICE_KEYBOARD_MOUSE_COMBO, address);
|
| + IDS_BLUETOOTH_DEVICE_KEYBOARD_MOUSE_COMBO, address_utf16);
|
| default:
|
| - return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_UNKNOWN, address);
|
| + return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_UNKNOWN,
|
| + address_utf16);
|
| }
|
| }
|
|
|
| BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const {
|
| // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
|
| - switch ((bluetooth_class_ & 0x1f00) >> 8) {
|
| + switch ((bluetooth_class() & 0x1f00) >> 8) {
|
| case 0x01:
|
| // Computer major device class.
|
| return DEVICE_COMPUTER;
|
| case 0x02:
|
| // Phone major device class.
|
| - switch ((bluetooth_class_ & 0xfc) >> 2) {
|
| + switch ((bluetooth_class() & 0xfc) >> 2) {
|
| case 0x01:
|
| case 0x02:
|
| case 0x03:
|
| @@ -109,7 +100,7 @@ BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const {
|
| break;
|
| case 0x04:
|
| // Audio major device class.
|
| - switch ((bluetooth_class_ & 0xfc) >> 2) {
|
| + switch ((bluetooth_class() & 0xfc) >> 2) {
|
| case 0x08:
|
| // Car audio.
|
| return DEVICE_CAR_AUDIO;
|
| @@ -127,10 +118,10 @@ BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const {
|
| break;
|
| case 0x05:
|
| // Peripheral major device class.
|
| - switch ((bluetooth_class_ & 0xc0) >> 6) {
|
| + switch ((bluetooth_class() & 0xc0) >> 6) {
|
| case 0x00:
|
| // "Not a keyboard or pointing device."
|
| - switch ((bluetooth_class_ & 0x01e) >> 2) {
|
| + switch ((bluetooth_class() & 0x01e) >> 2) {
|
| case 0x01:
|
| // Joystick.
|
| return DEVICE_JOYSTICK;
|
| @@ -146,7 +137,7 @@ BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const {
|
| return DEVICE_KEYBOARD;
|
| case 0x02:
|
| // Pointing device.
|
| - switch ((bluetooth_class_ & 0x01e) >> 2) {
|
| + switch ((bluetooth_class() & 0x01e) >> 2) {
|
| case 0x05:
|
| // Digitizer tablet.
|
| return DEVICE_TABLET;
|
| @@ -165,30 +156,11 @@ BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const {
|
| return DEVICE_UNKNOWN;
|
| }
|
|
|
| -bool BluetoothDevice::IsVisible() const {
|
| - return visible_;
|
| -}
|
| -
|
| -bool BluetoothDevice::IsBonded() const {
|
| - return bonded_;
|
| -}
|
| -
|
| -bool BluetoothDevice::IsConnected() const {
|
| - return connected_;
|
| -}
|
| -
|
| -bool BluetoothDevice::IsConnectable() const {
|
| - return connectable_;
|
| -}
|
| -
|
| -bool BluetoothDevice::IsConnecting() const {
|
| - return connecting_;
|
| -}
|
|
|
| bool BluetoothDevice::ProvidesServiceWithUUID(
|
| const std::string& uuid) const {
|
| std::string canonical_uuid = bluetooth_utils::CanonicalUuid(uuid);
|
| - const BluetoothDevice::ServiceList& services = GetServices();
|
| + BluetoothDevice::ServiceList services = GetServices();
|
| for (BluetoothDevice::ServiceList::const_iterator iter = services.begin();
|
| iter != services.end();
|
| ++iter) {
|
|
|