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

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

Issue 1606013002: BLE GATT service implementation in Chrome for Windows 8 and later (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Build.gn Created 4 years, 11 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_win.h" 5 #include "device/bluetooth/bluetooth_adapter_win.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "device/bluetooth/bluetooth_device_win.h" 16 #include "device/bluetooth/bluetooth_device_win.h"
17 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" 17 #include "device/bluetooth/bluetooth_discovery_session_outcome.h"
18 #include "device/bluetooth/bluetooth_socket_thread.h" 18 #include "device/bluetooth/bluetooth_socket_thread.h"
19 #include "device/bluetooth/bluetooth_socket_win.h" 19 #include "device/bluetooth/bluetooth_socket_win.h"
20 #include "device/bluetooth/bluetooth_task_manager_win.h" 20 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_win.h"
21 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_win.h"
22 #include "device/bluetooth/bluetooth_remote_gatt_service_win.h"
21 #include "device/bluetooth/bluetooth_uuid.h" 23 #include "device/bluetooth/bluetooth_uuid.h"
22 24
23 namespace device { 25 namespace device {
24 26
25 // static 27 // static
26 base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter( 28 base::WeakPtr<BluetoothAdapter> BluetoothAdapter::CreateAdapter(
27 const InitCallback& init_callback) { 29 const InitCallback& init_callback) {
28 return BluetoothAdapterWin::CreateAdapter(init_callback); 30 return BluetoothAdapterWin::CreateAdapter(init_callback);
29 } 31 }
30 32
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 370 }
369 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size(); 371 num_discovery_listeners_ -= on_stop_discovery_callbacks_.size();
370 on_stop_discovery_callbacks_.clear(); 372 on_stop_discovery_callbacks_.clear();
371 return; 373 return;
372 } 374 }
373 375
374 discovery_status_ = DISCOVERY_STOPPING; 376 discovery_status_ = DISCOVERY_STOPPING;
375 task_manager_->PostStopDiscoveryTask(); 377 task_manager_->PostStopDiscoveryTask();
376 } 378 }
377 379
380 void BluetoothAdapterWin::NotifyGattServiceAdded(
381 BluetoothDeviceWin* device,
382 BluetoothRemoteGattServiceWin* service) {
383 DCHECK(service);
384 DCHECK(device);
385 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
386 GattServiceAdded(this, device, service));
387 }
388
389 void BluetoothAdapterWin::NotifyGattServiceRemoved(
390 BluetoothDeviceWin* device,
391 BluetoothRemoteGattServiceWin* service) {
392 DCHECK(service);
393 DCHECK(device);
394 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
395 GattServiceRemoved(this, device, service));
396 }
397
398 void BluetoothAdapterWin::NotifyGattServicesDiscovered(
399 BluetoothDeviceWin* device) {
400 DCHECK(device);
401 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
402 GattServicesDiscovered(this, device));
403 }
404
405 void BluetoothAdapterWin::NotifyGattDiscoveryCompleteForService(
406 BluetoothRemoteGattServiceWin* service) {
407 DCHECK(service);
408 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
409 GattDiscoveryCompleteForService(this, service));
410 }
411
412 void BluetoothAdapterWin::NotifyGattServiceChanged(
413 BluetoothRemoteGattServiceWin* service) {
414 DCHECK(service);
415 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
416 GattServiceChanged(this, service));
417 }
418
419 void BluetoothAdapterWin::NotifyGattCharacteristicAdded(
420 BluetoothRemoteGattCharacteristicWin* characteristic) {
421 DCHECK(characteristic);
422 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
423 GattCharacteristicAdded(this, characteristic));
424 }
425
426 void BluetoothAdapterWin::NotifyGattCharacteristicRemoved(
427 BluetoothRemoteGattCharacteristicWin* characteristic) {
428 DCHECK(characteristic);
429 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
430 GattCharacteristicRemoved(this, characteristic));
431 }
432
433 void BluetoothAdapterWin::NotifyGattCharacteristicValueChanged(
434 BluetoothRemoteGattCharacteristicWin* characteristic,
435 const std::vector<uint8_t>& value) {
436 DCHECK(characteristic);
437 FOR_EACH_OBSERVER(
438 BluetoothAdapter::Observer, observers_,
439 GattCharacteristicValueChanged(this, characteristic, value));
440 }
441
442 void BluetoothAdapterWin::NotifyGattDescriptorAdded(
443 BluetoothRemoteGattDescriptorWin* descriptor) {
444 DCHECK(descriptor);
445 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
446 GattDescriptorAdded(this, descriptor));
447 }
448
449 void BluetoothAdapterWin::NotifyGattDescriptorRemoved(
450 BluetoothRemoteGattDescriptorWin* descriptor) {
451 DCHECK(descriptor);
452 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
453 GattDescriptorRemoved(this, descriptor));
454 }
455
456 void BluetoothAdapterWin::NotifyGattDescriptorValueChanged(
457 BluetoothRemoteGattDescriptorWin* descriptor,
458 const std::vector<uint8_t>& value) {
459 DCHECK(descriptor);
460 FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
461 GattDescriptorValueChanged(this, descriptor, value));
462 }
463
378 } // namespace device 464 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698