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

Unified Diff: device/bluetooth/bluetooth_service_record_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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_service_record_win.cc
diff --git a/device/bluetooth/bluetooth_service_record_win.cc b/device/bluetooth/bluetooth_service_record_win.cc
index 48f87232ab42a23e5f3794904869a1f6c08f6858..a5ecdf7690465eb27d147a62215bc9975b31f5fb 100644
--- a/device/bluetooth/bluetooth_service_record_win.cc
+++ b/device/bluetooth/bluetooth_service_record_win.cc
@@ -121,30 +121,34 @@ BTH_ADDR ConvertToBthAddr(const std::string& address) {
namespace device {
BluetoothServiceRecordWin::BluetoothServiceRecordWin(
+ const std::string& device_address,
const std::string& name,
- const std::string& address,
- uint64 blob_size,
- uint8* blob_data) : bth_addr_(ConvertToBthAddr(address)) {
- name_ = name;
- address_ = address;
- supports_rfcomm_ = false;
- SDP_ELEMENT_DATA protocol_descriptor_list_data;
- if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue(
- blob_data,
- blob_size,
- kProtocolDescriptorListId,
- &protocol_descriptor_list_data)) {
- ExtractChannels(protocol_descriptor_list_data,
- &supports_rfcomm_,
- &rfcomm_channel_);
- }
- SDP_ELEMENT_DATA uuid_data;
- if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue(
- blob_data,
- blob_size,
- kUuidId,
- &uuid_data)) {
- ExtractUuid(uuid_data, &uuid_);
+ const std::vector<uint8>& sdp_bytes,
+ const BluetoothUUID& gatt_uuid)
+ : device_bth_addr_(ConvertToBthAddr(device_address)),
+ device_address_(device_address),
+ name_(name),
+ uuid_(gatt_uuid),
+ supports_rfcomm_(false),
+ rfcomm_channel_(-1) {
+ // Bluetooth 2.0
+ if (sdp_bytes.size() > 0) {
+ LPBYTE blob_data = const_cast<LPBYTE>(&sdp_bytes[0]);
+ ULONG blob_size = static_cast<ULONG>(sdp_bytes.size());
+ SDP_ELEMENT_DATA protocol_descriptor_list_data;
+ if (ERROR_SUCCESS ==
+ BluetoothSdpGetAttributeValue(blob_data,
+ blob_size,
+ kProtocolDescriptorListId,
+ &protocol_descriptor_list_data)) {
+ ExtractChannels(
+ protocol_descriptor_list_data, &supports_rfcomm_, &rfcomm_channel_);
+ }
+ SDP_ELEMENT_DATA uuid_data;
+ if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue(
+ blob_data, blob_size, kUuidId, &uuid_data)) {
+ ExtractUuid(uuid_data, &uuid_);
+ }
}
}
« no previous file with comments | « device/bluetooth/bluetooth_service_record_win.h ('k') | device/bluetooth/bluetooth_service_record_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698