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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1149883011: bluetooth: Browser-side implementation of readValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-get-characteristic-initial
Patch Set: Fix merge conflicts Created 5 years, 6 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
« no previous file with comments | « content/browser/bad_message.h ('k') | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/common/bluetooth/bluetooth_error.h" 10 #include "content/common/bluetooth/bluetooth_error.h"
11 #include "content/public/browser/browser_message_filter.h" 11 #include "content/public/browser/browser_message_filter.h"
12 #include "device/bluetooth/bluetooth_adapter.h" 12 #include "device/bluetooth/bluetooth_adapter.h"
13 #include "device/bluetooth/bluetooth_gatt_connection.h" 13 #include "device/bluetooth/bluetooth_gatt_connection.h"
14 #include "device/bluetooth/bluetooth_gatt_service.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 // Dispatches and sends bluetooth related messages sent to/from a child 18 // Dispatches and sends bluetooth related messages sent to/from a child
18 // process BluetoothDispatcher from/to the main browser process. 19 // process BluetoothDispatcher from/to the main browser process.
19 // 20 //
20 // Intended to be instantiated by the RenderProcessHost and installed as 21 // Intended to be instantiated by the RenderProcessHost and installed as
21 // a filter on the channel. BrowserMessageFilter is refcounted and typically 22 // a filter on the channel. BrowserMessageFilter is refcounted and typically
22 // lives as long as it is installed on a channel. 23 // lives as long as it is installed on a channel.
23 // 24 //
(...skipping 30 matching lines...) Expand all
54 void OnConnectGATT(int thread_id, int request_id, 55 void OnConnectGATT(int thread_id, int request_id,
55 const std::string& device_instance_id); 56 const std::string& device_instance_id);
56 void OnGetPrimaryService(int thread_id, 57 void OnGetPrimaryService(int thread_id,
57 int request_id, 58 int request_id,
58 const std::string& device_instance_id, 59 const std::string& device_instance_id,
59 const std::string& service_uuid); 60 const std::string& service_uuid);
60 void OnGetCharacteristic(int thread_id, 61 void OnGetCharacteristic(int thread_id,
61 int request_id, 62 int request_id,
62 const std::string& service_instance_id, 63 const std::string& service_instance_id,
63 const std::string& characteristic_uuid); 64 const std::string& characteristic_uuid);
65 void OnReadValue(int thread_id,
66 int request_id,
67 const std::string& characteristic_instance_id);
64 68
65 // Callbacks for BluetoothAdapter::StartDiscoverySession. 69 // Callbacks for BluetoothAdapter::StartDiscoverySession.
66 void OnDiscoverySessionStarted( 70 void OnDiscoverySessionStarted(
67 int thread_id, 71 int thread_id,
68 int request_id, 72 int request_id,
69 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); 73 scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
70 void OnDiscoverySessionStartedError(int thread_id, int request_id); 74 void OnDiscoverySessionStartedError(int thread_id, int request_id);
71 75
72 // Stop in progress discovery session. 76 // Stop in progress discovery session.
73 void StopDiscoverySession( 77 void StopDiscoverySession(
74 int thread_id, 78 int thread_id,
75 int request_id, 79 int request_id,
76 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); 80 scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
77 81
78 // Callbacks for BluetoothDiscoverySession::Stop. 82 // Callbacks for BluetoothDiscoverySession::Stop.
79 void OnDiscoverySessionStopped(int thread_id, int request_id); 83 void OnDiscoverySessionStopped(int thread_id, int request_id);
80 void OnDiscoverySessionStoppedError(int thread_id, int request_id); 84 void OnDiscoverySessionStoppedError(int thread_id, int request_id);
81 85
82 // Callbacks for BluetoothDevice::CreateGattConnection 86 // Callbacks for BluetoothDevice::CreateGattConnection.
83 void OnGATTConnectionCreated( 87 void OnGATTConnectionCreated(
84 int thread_id, 88 int thread_id,
85 int request_id, 89 int request_id,
86 const std::string& device_instance_id, 90 const std::string& device_instance_id,
87 scoped_ptr<device::BluetoothGattConnection> connection); 91 scoped_ptr<device::BluetoothGattConnection> connection);
88 void OnCreateGATTConnectionError( 92 void OnCreateGATTConnectionError(
89 int thread_id, 93 int thread_id,
90 int request_id, 94 int request_id,
91 const std::string& device_instance_id, 95 const std::string& device_instance_id,
92 device::BluetoothDevice::ConnectErrorCode error_code); 96 device::BluetoothDevice::ConnectErrorCode error_code);
93 97
94 // Callback for future BluetoothAdapter::ServicesDiscovered callback: 98 // Callback for future BluetoothAdapter::ServicesDiscovered callback:
95 // For now we just post a delayed task. 99 // For now we just post a delayed task.
96 // See: https://crbug.com/484504 100 // See: https://crbug.com/484504
97 void OnServicesDiscovered(int thread_id, 101 void OnServicesDiscovered(int thread_id,
98 int request_id, 102 int request_id,
99 const std::string& device_instance_id, 103 const std::string& device_instance_id,
100 const std::string& service_uuid); 104 const std::string& service_uuid);
101 105
106 // Callbacks for BluetoothGattCharacteristic::ReadRemoteCharacteristic.
107 void OnCharacteristicValueRead(int thread_id,
108 int request_id,
109 const std::vector<uint8>& value);
110 void OnCharacteristicReadValueError(
111 int thread_id,
112 int request_id,
113 device::BluetoothGattService::GattErrorCode);
114
102 // Maps to get the object's parent based on it's instanceID 115 // Maps to get the object's parent based on it's instanceID
103 // Map of service_instance_id to device_instance_id. 116 // Map of service_instance_id to device_instance_id.
104 std::map<std::string, std::string> service_to_device_; 117 std::map<std::string, std::string> service_to_device_;
118 // Map of characteristic_instance_id to service_instance_id.
119 std::map<std::string, std::string> characteristic_to_service_;
105 120
106 // Defines how long to scan for and how long to discover services for. 121 // Defines how long to scan for and how long to discover services for.
107 int current_delay_time_; 122 int current_delay_time_;
108 123
109 // A BluetoothAdapter instance representing an adapter of the system. 124 // A BluetoothAdapter instance representing an adapter of the system.
110 scoped_refptr<device::BluetoothAdapter> adapter_; 125 scoped_refptr<device::BluetoothAdapter> adapter_;
111 126
112 // Must be last member, see base/memory/weak_ptr.h documentation 127 // Must be last member, see base/memory/weak_ptr.h documentation
113 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; 128 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_;
114 129
115 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); 130 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost);
116 }; 131 };
117 132
118 } // namespace content 133 } // namespace content
119 134
120 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 135 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/bad_message.h ('k') | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698