Chromium Code Reviews| Index: components/arc/bluetooth/arc_bluetooth_bridge.cc |
| diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.cc b/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| index dbc6747b662299696c5c1ebb56d1a9f069e3b04c..ba28224e58d195633813f0950a2d05f2699f7604 100644 |
| --- a/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| +++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| @@ -173,6 +173,11 @@ bool IsGattOffsetValid(int offset) { |
| return 0 <= offset && offset < kMaxGattAttributeLength; |
| } |
| +uint16_t GetUuid16(const BluetoothUUID& uuid) { |
|
rkc
2016/08/04 20:01:57
GetUUID16 to keep it consistent with the casing of
puthik_chromium
2016/08/10 19:07:27
Done.
|
| + // Convert xxxxyyyy-xxxx-xxxx-xxxx-xxxxxxxxxxxx to int16 yyyy |
| + return std::stoi(uuid.canonical_value().substr(4, 4), nullptr, 16); |
| +} |
| + |
| } // namespace |
| namespace arc { |
| @@ -1524,11 +1529,15 @@ ArcBluetoothBridge::GetAdvertisingData(BluetoothDevice* device) const { |
| // ServiceUuid |
| BluetoothDevice::UUIDList uuid_list = device->GetServiceDataUUIDs(); |
| if (uuid_list.size() > 0) { |
| - mojom::BluetoothAdvertisingDataPtr service_uuids = |
| + mojom::BluetoothAdvertisingDataPtr service_uuids_16 = |
| mojom::BluetoothAdvertisingData::New(); |
| - service_uuids->set_service_uuids( |
| - mojo::Array<mojom::BluetoothUUIDPtr>::From(uuid_list)); |
| - advertising_data.push_back(std::move(service_uuids)); |
| + mojo::Array<uint16_t> uuid16s = |
| + mojo::Array<uint16_t>::New(uuid_list.size()); |
|
Luis Héctor Chávez
2016/08/08 14:41:37
This would cause |uuid_list.size()| zeroes to be a
puthik_chromium
2016/08/10 19:07:27
Done.
|
| + for (auto& uuid : uuid_list) { |
| + uuid16s.push_back(GetUuid16(uuid)); |
| + } |
| + service_uuids_16->set_service_uuids_16(std::move(uuid16s)); |
| + advertising_data.push_back(std::move(service_uuids_16)); |
| } |
| // Service data |
| @@ -1545,9 +1554,7 @@ ArcBluetoothBridge::GetAdvertisingData(BluetoothDevice* device) const { |
| mojom::BluetoothServiceDataPtr service_data = |
| mojom::BluetoothServiceData::New(); |
| - std::string uuid_str = uuid.canonical_value(); |
| - // Convert xxxxyyyy-xxxx-xxxx-xxxx-xxxxxxxxxxxx to int16 yyyy |
| - service_data->uuid_16bit = std::stoi(uuid_str.substr(4, 4), nullptr, 16); |
| + service_data->uuid_16bit = GetUuid16(uuid); |
| for (auto& c : data_str) { |
| service_data->data.push_back(c); |
| } |