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

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

Issue 395633003: Enumerate Bluetooth LE services and expose them to chrome.bluetooth API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix x64 build. Created 6 years, 5 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 | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_device_win_unittest.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 (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_device_win.h" 5 #include "device/bluetooth/bluetooth_device_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 29 matching lines...) Expand all
40 address_ = CanonicalizeAddress(state.address); 40 address_ = CanonicalizeAddress(state.address);
41 bluetooth_class_ = state.bluetooth_class; 41 bluetooth_class_ = state.bluetooth_class;
42 visible_ = state.visible; 42 visible_ = state.visible;
43 connected_ = state.connected; 43 connected_ = state.connected;
44 paired_ = state.authenticated; 44 paired_ = state.authenticated;
45 45
46 for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator 46 for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator
47 iter = state.service_record_states.begin(); 47 iter = state.service_record_states.begin();
48 iter != state.service_record_states.end(); 48 iter != state.service_record_states.end();
49 ++iter) { 49 ++iter) {
50 uint8 sdp_bytes_buffer[kSdpBytesBufferSize];
51 std::copy((*iter)->sdp_bytes.begin(),
52 (*iter)->sdp_bytes.end(),
53 sdp_bytes_buffer);
54 BluetoothServiceRecordWin* service_record = new BluetoothServiceRecordWin( 50 BluetoothServiceRecordWin* service_record = new BluetoothServiceRecordWin(
55 (*iter)->name, 51 state.address, (*iter)->name, (*iter)->sdp_bytes, (*iter)->gatt_uuid);
56 (*iter)->address,
57 (*iter)->sdp_bytes.size(),
58 sdp_bytes_buffer);
59 service_record_list_.push_back(service_record); 52 service_record_list_.push_back(service_record);
60 uuids_.push_back(service_record->uuid()); 53 uuids_.push_back(service_record->uuid());
61 } 54 }
62 } 55 }
63 56
64 BluetoothDeviceWin::~BluetoothDeviceWin() { 57 BluetoothDeviceWin::~BluetoothDeviceWin() {
65 } 58 }
66 59
67 void BluetoothDeviceWin::SetVisible(bool visible) { 60 void BluetoothDeviceWin::SetVisible(bool visible) {
68 visible_ = visible; 61 visible_ = visible;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 for (ServiceRecordList::const_iterator iter = service_record_list_.begin(); 218 for (ServiceRecordList::const_iterator iter = service_record_list_.begin();
226 iter != service_record_list_.end(); 219 iter != service_record_list_.end();
227 ++iter) { 220 ++iter) {
228 if ((*iter)->uuid() == uuid) 221 if ((*iter)->uuid() == uuid)
229 return *iter; 222 return *iter;
230 } 223 }
231 return NULL; 224 return NULL;
232 } 225 }
233 226
234 } // namespace device 227 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_device_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698