| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/child/bluetooth/web_bluetooth_impl.h" | |
| 6 | |
| 7 #include "content/child/bluetooth/bluetooth_dispatcher.h" | |
| 8 #include "content/child/thread_safe_sender.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 WebBluetoothImpl::WebBluetoothImpl(ThreadSafeSender* thread_safe_sender) | |
| 13 : thread_safe_sender_(thread_safe_sender) { | |
| 14 } | |
| 15 | |
| 16 WebBluetoothImpl::~WebBluetoothImpl() { | |
| 17 } | |
| 18 | |
| 19 void WebBluetoothImpl::requestDevice( | |
| 20 const blink::WebRequestDeviceOptions& options, | |
| 21 blink::WebBluetoothRequestDeviceCallbacks* callbacks) { | |
| 22 GetDispatcher()->requestDevice(options, callbacks); | |
| 23 } | |
| 24 | |
| 25 void WebBluetoothImpl::connectGATT(const blink::WebString& device_instance_id, | |
| 26 blink::WebBluetoothConnectGATTCallbacks* callbacks) { | |
| 27 GetDispatcher()->connectGATT(device_instance_id, callbacks); | |
| 28 } | |
| 29 | |
| 30 void WebBluetoothImpl::getPrimaryService( | |
| 31 const blink::WebString& device_instance_id, | |
| 32 const blink::WebString& service_uuid, | |
| 33 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) { | |
| 34 GetDispatcher()->getPrimaryService(device_instance_id, service_uuid, | |
| 35 callbacks); | |
| 36 } | |
| 37 | |
| 38 void WebBluetoothImpl::getCharacteristic( | |
| 39 const blink::WebString& service_instance_id, | |
| 40 const blink::WebString& characteristic_uuid, | |
| 41 blink::WebBluetoothGetCharacteristicCallbacks* callbacks) { | |
| 42 GetDispatcher()->getCharacteristic(service_instance_id, characteristic_uuid, | |
| 43 callbacks); | |
| 44 } | |
| 45 | |
| 46 void WebBluetoothImpl::readValue( | |
| 47 const blink::WebString& characteristic_instance_id, | |
| 48 blink::WebBluetoothReadValueCallbacks* callbacks) { | |
| 49 GetDispatcher()->readValue(characteristic_instance_id, callbacks); | |
| 50 } | |
| 51 | |
| 52 void WebBluetoothImpl::writeValue( | |
| 53 const blink::WebString& characteristic_instance_id, | |
| 54 const std::vector<uint8_t>& value, | |
| 55 blink::WebBluetoothWriteValueCallbacks* callbacks) { | |
| 56 GetDispatcher()->writeValue(characteristic_instance_id, value, callbacks); | |
| 57 } | |
| 58 | |
| 59 BluetoothDispatcher* WebBluetoothImpl::GetDispatcher() { | |
| 60 return BluetoothDispatcher::GetOrCreateThreadSpecificInstance( | |
| 61 thread_safe_sender_.get()); | |
| 62 } | |
| 63 | |
| 64 } // namespace content | |
| OLD | NEW |