Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: device/bluetooth/bluetooth_adapter_bluez.cc

Issue 1542163002: Switch to standard integer types in device/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bluetooth_adapter_bluez.h" 5 #include "device/bluetooth/bluetooth_adapter_bluez.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "build/build_config.h"
16 #include "device/bluetooth/bluetooth_adapter_profile_bluez.h" 17 #include "device/bluetooth/bluetooth_adapter_profile_bluez.h"
17 #include "device/bluetooth/bluetooth_advertisement_bluez.h" 18 #include "device/bluetooth/bluetooth_advertisement_bluez.h"
18 #include "device/bluetooth/bluetooth_audio_sink_bluez.h" 19 #include "device/bluetooth/bluetooth_audio_sink_bluez.h"
19 #include "device/bluetooth/bluetooth_device.h" 20 #include "device/bluetooth/bluetooth_device.h"
20 #include "device/bluetooth/bluetooth_device_bluez.h" 21 #include "device/bluetooth/bluetooth_device_bluez.h"
21 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" 22 #include "device/bluetooth/bluetooth_discovery_session_outcome.h"
22 #include "device/bluetooth/bluetooth_pairing_bluez.h" 23 #include "device/bluetooth/bluetooth_pairing_bluez.h"
23 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h" 24 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h"
24 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h" 25 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_bluez.h"
25 #include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h" 26 #include "device/bluetooth/bluetooth_remote_gatt_service_bluez.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 BluetoothPairingBlueZ* pairing = GetPairing(device_path); 574 BluetoothPairingBlueZ* pairing = GetPairing(device_path);
574 if (!pairing) { 575 if (!pairing) {
575 callback.Run(REJECTED, 0); 576 callback.Run(REJECTED, 0);
576 return; 577 return;
577 } 578 }
578 579
579 pairing->RequestPasskey(callback); 580 pairing->RequestPasskey(callback);
580 } 581 }
581 582
582 void BluetoothAdapterBlueZ::DisplayPasskey(const dbus::ObjectPath& device_path, 583 void BluetoothAdapterBlueZ::DisplayPasskey(const dbus::ObjectPath& device_path,
583 uint32 passkey, 584 uint32_t passkey,
584 uint16 entered) { 585 uint16_t entered) {
585 DCHECK(IsPresent()); 586 DCHECK(IsPresent());
586 DCHECK(agent_.get()); 587 DCHECK(agent_.get());
587 VLOG(1) << device_path.value() << ": DisplayPasskey: " << passkey << " (" 588 VLOG(1) << device_path.value() << ": DisplayPasskey: " << passkey << " ("
588 << entered << " entered)"; 589 << entered << " entered)";
589 590
590 BluetoothPairingBlueZ* pairing = GetPairing(device_path); 591 BluetoothPairingBlueZ* pairing = GetPairing(device_path);
591 if (!pairing) 592 if (!pairing)
592 return; 593 return;
593 594
594 if (entered == 0) 595 if (entered == 0)
595 pairing->DisplayPasskey(passkey); 596 pairing->DisplayPasskey(passkey);
596 597
597 pairing->KeysEntered(entered); 598 pairing->KeysEntered(entered);
598 } 599 }
599 600
600 void BluetoothAdapterBlueZ::RequestConfirmation( 601 void BluetoothAdapterBlueZ::RequestConfirmation(
601 const dbus::ObjectPath& device_path, 602 const dbus::ObjectPath& device_path,
602 uint32 passkey, 603 uint32_t passkey,
603 const ConfirmationCallback& callback) { 604 const ConfirmationCallback& callback) {
604 DCHECK(IsPresent()); 605 DCHECK(IsPresent());
605 DCHECK(agent_.get()); 606 DCHECK(agent_.get());
606 VLOG(1) << device_path.value() << ": RequestConfirmation: " << passkey; 607 VLOG(1) << device_path.value() << ": RequestConfirmation: " << passkey;
607 608
608 BluetoothPairingBlueZ* pairing = GetPairing(device_path); 609 BluetoothPairingBlueZ* pairing = GetPairing(device_path);
609 if (!pairing) { 610 if (!pairing) {
610 callback.Run(REJECTED); 611 callback.Run(REJECTED);
611 return; 612 return;
612 } 613 }
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 descriptor->GetCharacteristic()->GetService()) 988 descriptor->GetCharacteristic()->GetService())
988 ->GetAdapter(), 989 ->GetAdapter(),
989 this); 990 this);
990 991
991 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 992 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
992 GattDescriptorRemoved(this, descriptor)); 993 GattDescriptorRemoved(this, descriptor));
993 } 994 }
994 995
995 void BluetoothAdapterBlueZ::NotifyGattCharacteristicValueChanged( 996 void BluetoothAdapterBlueZ::NotifyGattCharacteristicValueChanged(
996 BluetoothRemoteGattCharacteristicBlueZ* characteristic, 997 BluetoothRemoteGattCharacteristicBlueZ* characteristic,
997 const std::vector<uint8>& value) { 998 const std::vector<uint8_t>& value) {
998 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>( 999 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
999 characteristic->GetService()) 1000 characteristic->GetService())
1000 ->GetAdapter(), 1001 ->GetAdapter(),
1001 this); 1002 this);
1002 1003
1003 FOR_EACH_OBSERVER( 1004 FOR_EACH_OBSERVER(
1004 BluetoothAdapter::Observer, observers_, 1005 BluetoothAdapter::Observer, observers_,
1005 GattCharacteristicValueChanged(this, characteristic, value)); 1006 GattCharacteristicValueChanged(this, characteristic, value));
1006 } 1007 }
1007 1008
1008 void BluetoothAdapterBlueZ::NotifyGattDescriptorValueChanged( 1009 void BluetoothAdapterBlueZ::NotifyGattDescriptorValueChanged(
1009 BluetoothRemoteGattDescriptorBlueZ* descriptor, 1010 BluetoothRemoteGattDescriptorBlueZ* descriptor,
1010 const std::vector<uint8>& value) { 1011 const std::vector<uint8_t>& value) {
1011 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>( 1012 DCHECK_EQ(static_cast<BluetoothRemoteGattServiceBlueZ*>(
1012 descriptor->GetCharacteristic()->GetService()) 1013 descriptor->GetCharacteristic()->GetService())
1013 ->GetAdapter(), 1014 ->GetAdapter(),
1014 this); 1015 this);
1015 1016
1016 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, 1017 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
1017 GattDescriptorValueChanged(this, descriptor, value)); 1018 GattDescriptorValueChanged(this, descriptor, value));
1018 } 1019 }
1019 1020
1020 void BluetoothAdapterBlueZ::UseProfile( 1021 void BluetoothAdapterBlueZ::UseProfile(
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 1503
1503 // If the queued request resulted in a pending call, then let it 1504 // If the queued request resulted in a pending call, then let it
1504 // asynchonously process the remaining queued requests once the pending 1505 // asynchonously process the remaining queued requests once the pending
1505 // call returns. 1506 // call returns.
1506 if (discovery_request_pending_) 1507 if (discovery_request_pending_)
1507 return; 1508 return;
1508 } 1509 }
1509 } 1510 }
1510 1511
1511 } // namespace bluez 1512 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_bluez.h ('k') | device/bluetooth/bluetooth_adapter_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698