diff options
author | gogerald <gogerald@chromium.org> | 2016-02-26 07:36:09 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-26 15:37:17 +0000 |
commit | e069a45ceb26f426aae38a1f0e88d7d6e447b6cc (patch) | |
tree | c4e1f9ad8a438ca2abcd22fc47e5185c5ee6efa8 /device/bluetooth/bluetooth_low_energy_win_fake.h | |
parent | 920e3f0cb63252e35a01ccea4abe1492f164eef1 (diff) | |
download | chromium_src-e069a45ceb26f426aae38a1f0e88d7d6e447b6cc.zip chromium_src-e069a45ceb26f426aae38a1f0e88d7d6e447b6cc.tar.gz chromium_src-e069a45ceb26f426aae38a1f0e88d7d6e447b6cc.tar.bz2 |
Implement BluetoothRemoteGattServiceWin and related unit tests
This CL implements BluetoothRemoteGattServiceWin and related unit tests.
BUG=579202
Review URL: https://codereview.chromium.org/1690133002
Cr-Commit-Position: refs/heads/master@{#377893}
Diffstat (limited to 'device/bluetooth/bluetooth_low_energy_win_fake.h')
-rw-r--r-- | device/bluetooth/bluetooth_low_energy_win_fake.h | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/device/bluetooth/bluetooth_low_energy_win_fake.h b/device/bluetooth/bluetooth_low_energy_win_fake.h index a4da0c7..b069daa 100644 --- a/device/bluetooth/bluetooth_low_energy_win_fake.h +++ b/device/bluetooth/bluetooth_low_energy_win_fake.h @@ -68,6 +68,7 @@ class BluetoothLowEnergyWrapperFake : public BluetoothLowEnergyWrapper { BluetoothLowEnergyWrapperFake(); ~BluetoothLowEnergyWrapperFake() override; + bool IsBluetoothLowEnergySupported() override; bool EnumerateKnownBluetoothLowEnergyDevices( ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, std::string* error) override; @@ -78,11 +79,38 @@ class BluetoothLowEnergyWrapperFake : public BluetoothLowEnergyWrapper { const base::FilePath& device_path, ScopedVector<BluetoothLowEnergyServiceInfo>* services, std::string* error) override; + HRESULT ReadCharacteristicsOfAService( + base::FilePath& service_path, + const PBTH_LE_GATT_SERVICE service, + scoped_ptr<BTH_LE_GATT_CHARACTERISTIC>* out_included_characteristics, + USHORT* out_counts) override; BLEDevice* SimulateBLEDevice(std::string device_name, BLUETOOTH_ADDRESS device_address); BLEDevice* GetSimulatedBLEDevice(std::string device_address); - BLEGattService* SimulateBLEGattService(BLEDevice* device, std::string uuid); + + // Note: |parent_service| may be nullptr to indicate a primary service. + BLEGattService* SimulateBLEGattService(BLEDevice* device, + BLEGattService* parent_service, + const BTH_LE_UUID& uuid); + + // Note: |parent_service| may be nullptr to indicate a primary service. + void SimulateBLEGattServiceRemoved(BLEDevice* device, + BLEGattService* parent_service, + std::string attribute_handle); + + // Note: |chain_of_att_handle| contains the attribute handles of the services + // in order from primary service to target service. The last item in + // |chain_of_att_handle| is the target service's attribute handle. + BLEGattService* GetSimulatedGattService( + BLEDevice* device, + const std::vector<std::string>& chain_of_att_handle); + BLEGattCharacteristic* SimulateBLEGattCharacterisc( + std::string device_address, + BLEGattService* parent_service, + const BTH_LE_GATT_CHARACTERISTIC& characteristic); + void SimulateBLEGattCharacteriscRemove(BLEGattService* parent_service, + std::string attribute_handle); private: // Generate an unique attribute handle on |device_address|. @@ -102,18 +130,15 @@ class BluetoothLowEnergyWrapperFake : public BluetoothLowEnergyWrapper { // GenerateBLEDevicePath or GenerateBLEGattServiceDevicePath. base::string16 ExtractDeviceAddressFromDevicePath(base::string16 path); - // Extract service attribute handle from the |path| generated by + // Extract service attribute handles from the |path| generated by // GenerateBLEGattServiceDevicePath. - base::string16 ExtractServiceAttributeHandleFromDevicePath( + std::vector<std::string> ExtractServiceAttributeHandlesFromDevicePath( base::string16 path); // The canonical BLE device address string format is the // BluetoothDevice::CanonicalizeAddress. std::string BluetoothAddressToCanonicalString(const BLUETOOTH_ADDRESS& btha); - // The canonical UUID string format is device::BluetoothUUID.value(). - BTH_LE_UUID CanonicalStringToBTH_LE_UUID(std::string uuid); - // Table to store allocated attribute handle for a device. BLEAttributeHandleTable attribute_handle_table_; BLEDevicesMap simulated_devices_; |