| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 BluetoothServiceRecordWin::BluetoothServiceRecordWin( | 123 BluetoothServiceRecordWin::BluetoothServiceRecordWin( |
| 124 const std::string& device_address, | 124 const std::string& device_address, |
| 125 const std::string& name, | 125 const std::string& name, |
| 126 const std::vector<uint8>& sdp_bytes, | 126 const std::vector<uint8>& sdp_bytes, |
| 127 const BluetoothUUID& gatt_uuid) | 127 const BluetoothUUID& gatt_uuid) |
| 128 : device_bth_addr_(ConvertToBthAddr(device_address)), | 128 : device_bth_addr_(ConvertToBthAddr(device_address)), |
| 129 device_address_(device_address), | 129 device_address_(device_address), |
| 130 name_(name), | 130 name_(name), |
| 131 uuid_(gatt_uuid), | 131 uuid_(gatt_uuid), |
| 132 supports_rfcomm_(false), | 132 supports_rfcomm_(false), |
| 133 rfcomm_channel_(-1) { | 133 rfcomm_channel_(0xFF) { |
| 134 // Bluetooth 2.0 | 134 // Bluetooth 2.0 |
| 135 if (sdp_bytes.size() > 0) { | 135 if (sdp_bytes.size() > 0) { |
| 136 LPBYTE blob_data = const_cast<LPBYTE>(&sdp_bytes[0]); | 136 LPBYTE blob_data = const_cast<LPBYTE>(&sdp_bytes[0]); |
| 137 ULONG blob_size = static_cast<ULONG>(sdp_bytes.size()); | 137 ULONG blob_size = static_cast<ULONG>(sdp_bytes.size()); |
| 138 SDP_ELEMENT_DATA protocol_descriptor_list_data; | 138 SDP_ELEMENT_DATA protocol_descriptor_list_data; |
| 139 if (ERROR_SUCCESS == | 139 if (ERROR_SUCCESS == |
| 140 BluetoothSdpGetAttributeValue(blob_data, | 140 BluetoothSdpGetAttributeValue(blob_data, |
| 141 blob_size, | 141 blob_size, |
| 142 kProtocolDescriptorListId, | 142 kProtocolDescriptorListId, |
| 143 &protocol_descriptor_list_data)) { | 143 &protocol_descriptor_list_data)) { |
| 144 ExtractChannels( | 144 ExtractChannels( |
| 145 protocol_descriptor_list_data, &supports_rfcomm_, &rfcomm_channel_); | 145 protocol_descriptor_list_data, &supports_rfcomm_, &rfcomm_channel_); |
| 146 } | 146 } |
| 147 SDP_ELEMENT_DATA uuid_data; | 147 SDP_ELEMENT_DATA uuid_data; |
| 148 if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue( | 148 if (ERROR_SUCCESS == BluetoothSdpGetAttributeValue( |
| 149 blob_data, blob_size, kUuidId, &uuid_data)) { | 149 blob_data, blob_size, kUuidId, &uuid_data)) { |
| 150 ExtractUuid(uuid_data, &uuid_); | 150 ExtractUuid(uuid_data, &uuid_); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace device | 155 } // namespace device |
| OLD | NEW |