| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_service_record_win.h" | 5 #include "device/bluetooth/bluetooth_service_record_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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 byte_position++; | 114 byte_position++; |
| 115 } | 115 } |
| 116 return bth_addr; | 116 return bth_addr; |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace | 119 } // namespace |
| 120 | 120 |
| 121 namespace device { | 121 namespace device { |
| 122 | 122 |
| 123 BluetoothServiceRecordWin::BluetoothServiceRecordWin( | 123 BluetoothServiceRecordWin::BluetoothServiceRecordWin( |
| 124 const std::string& device_address, |
| 124 const std::string& name, | 125 const std::string& name, |
| 125 const std::string& address, | 126 const std::vector<uint8>& sdp_bytes, |
| 126 uint64 blob_size, | 127 const BluetoothUUID& gatt_uuid) |
| 127 uint8* blob_data) : bth_addr_(ConvertToBthAddr(address)) { | 128 : device_bth_addr_(ConvertToBthAddr(device_address)), |
| 128 name_ = name; | 129 device_address_(device_address), |
| 129 address_ = address; | 130 name_(name), |
| 130 supports_rfcomm_ = false; | 131 uuid_(gatt_uuid), |
| 131 SDP_ELEMENT_DATA protocol_descriptor_list_data; | 132 supports_rfcomm_(false), |
| 132 if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue( | 133 rfcomm_channel_(-1) { |
| 133 blob_data, | 134 // Bluetooth 2.0 |
| 134 blob_size, | 135 if (sdp_bytes.size() > 0) { |
| 135 kProtocolDescriptorListId, | 136 LPBYTE blob_data = const_cast<LPBYTE>(&sdp_bytes[0]); |
| 136 &protocol_descriptor_list_data)) { | 137 ULONG blob_size = static_cast<ULONG>(sdp_bytes.size()); |
| 137 ExtractChannels(protocol_descriptor_list_data, | 138 SDP_ELEMENT_DATA protocol_descriptor_list_data; |
| 138 &supports_rfcomm_, | 139 if (ERROR_SUCCESS == |
| 139 &rfcomm_channel_); | 140 BluetoothSdpGetAttributeValue(blob_data, |
| 140 } | 141 blob_size, |
| 141 SDP_ELEMENT_DATA uuid_data; | 142 kProtocolDescriptorListId, |
| 142 if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue( | 143 &protocol_descriptor_list_data)) { |
| 143 blob_data, | 144 ExtractChannels( |
| 144 blob_size, | 145 protocol_descriptor_list_data, &supports_rfcomm_, &rfcomm_channel_); |
| 145 kUuidId, | 146 } |
| 146 &uuid_data)) { | 147 SDP_ELEMENT_DATA uuid_data; |
| 147 ExtractUuid(uuid_data, &uuid_); | 148 if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue( |
| 149 blob_data, blob_size, kUuidId, &uuid_data)) { |
| 150 ExtractUuid(uuid_data, &uuid_); |
| 151 } |
| 148 } | 152 } |
| 149 } | 153 } |
| 150 | 154 |
| 151 } // namespace device | 155 } // namespace device |
| OLD | NEW |