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 45228c0379ccf23323cfdf50c117b724f27ca508..5d2d9a8eb3bc24568fa0fd6088dbf3b51b551c6b 100644 |
| --- a/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| +++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| @@ -46,6 +46,7 @@ using device::BluetoothUUID; |
| namespace { |
| const int kMinBtleVersion = 1; |
| +const int kMinBtleNotifyVersion = 2; |
|
ortuno
2016/06/21 23:23:06
enum { kMinBtleNotifyVersion = 2 };
Context: http
puthik_chromium
2016/06/23 02:53:34
Done.
|
| const uint32_t kGattReadPermission = |
| BluetoothGattCharacteristic::Permission::PERMISSION_READ | |
| BluetoothGattCharacteristic::Permission::PERMISSION_READ_ENCRYPTED | |
| @@ -257,7 +258,31 @@ void ArcBluetoothBridge::GattCharacteristicValueChanged( |
| BluetoothAdapter* adapter, |
| BluetoothRemoteGattCharacteristic* characteristic, |
| const std::vector<uint8_t>& value) { |
| - // Placeholder for GATT client functionality |
| + if (!HasBluetoothInstance()) |
| + return; |
| + |
| + if (arc_bridge_service()->bluetooth_version() < kMinBtleNotifyVersion) { |
| + LOG(WARNING) << "Bluetooth instance is too old and does not support notify"; |
| + return; |
| + } |
| + BluetoothRemoteGattService* service = characteristic->GetService(); |
| + BluetoothDevice* device = service->GetDevice(); |
| + mojom::BluetoothAddressPtr address = |
| + mojom::BluetoothAddress::From(device->GetAddress()); |
| + mojom::BluetoothGattServiceIDPtr service_id = |
| + mojom::BluetoothGattServiceID::New(); |
| + service_id->is_primary = service->IsPrimary(); |
| + service_id->id = mojom::BluetoothGattID::New(); |
| + service_id->id->inst_id = ConvertGattIdentifierToId(service->GetIdentifier()); |
| + service_id->id->uuid = mojom::BluetoothUUID::From(service->GetUUID()); |
| + |
| + mojom::BluetoothGattIDPtr char_id = mojom::BluetoothGattID::New(); |
| + char_id->inst_id = ConvertGattIdentifierToId(characteristic->GetIdentifier()); |
| + char_id->uuid = mojom::BluetoothUUID::From(characteristic->GetUUID()); |
| + |
| + arc_bridge_service()->bluetooth_instance()->OnGattNotify( |
| + std::move(address), std::move(service_id), std::move(char_id), |
| + true /* is_notify */, mojo::Array<uint8_t>::From(value)); |
| } |
| void ArcBluetoothBridge::GattDescriptorValueChanged( |