Index: device/bluetooth/bluetooth_low_energy_win_fake.h |
diff --git a/device/bluetooth/bluetooth_low_energy_win_fake.h b/device/bluetooth/bluetooth_low_energy_win_fake.h |
index a22d5cbb86327ad7280abcef6f7197d6c9b57cbe..c75a6d511675e9837ddfbed09a09fa04f35031a0 100644 |
--- a/device/bluetooth/bluetooth_low_energy_win_fake.h |
+++ b/device/bluetooth/bluetooth_low_energy_win_fake.h |
@@ -7,9 +7,55 @@ |
#include "device/bluetooth/bluetooth_low_energy_win.h" |
+#include <set> |
+ |
+#include "base/containers/scoped_ptr_hash_map.h" |
+ |
namespace device { |
namespace win { |
+struct BLEDevice; |
+struct BLEGattService; |
+struct BLEGattCharacteristic; |
+struct BLEGattDescriptor; |
+ |
+// The key of BLEDevicesMap is the string of BLE device address. |
scheib
2016/02/07 02:24:08
"of the BLE"
^^^^
gogerald1
2016/02/08 19:23:51
Done.
|
+typedef base::ScopedPtrHashMap<std::string, scoped_ptr<BLEDevice>> |
+ BLEDevicesMap; |
+// The key of BLEGattServicesMap, BLEGattCharacteristicsMap and |
+// BLEGattDescriptorsMap is the string of attribute handle. |
scheib
2016/02/07 02:24:08
"string of the attribute"
^^^^
gogerald1
2016/02/08 19:23:51
Done.
|
+typedef base::ScopedPtrHashMap<std::string, scoped_ptr<BLEGattService>> |
+ BLEGattServicesMap; |
+typedef base::ScopedPtrHashMap<std::string, scoped_ptr<BLEGattCharacteristic>> |
+ BLEGattCharacteristicsMap; |
+typedef base::ScopedPtrHashMap<std::string, scoped_ptr<BLEGattDescriptor>> |
+ BLEGattDescriptorsMap; |
+// The key of BLEAttributeHandleTable is the string of BLE device address. |
scheib
2016/02/07 02:24:08
"of the BLE"
^^^^
gogerald1
2016/02/08 19:23:51
Done.
|
+typedef base::ScopedPtrHashMap<std::string, scoped_ptr<std::set<USHORT>>> |
+ BLEAttributeHandleTable; |
+ |
+struct BLEDevice { |
+ scoped_ptr<BluetoothLowEnergyDeviceInfo> device_info; |
+ BLEGattServicesMap primary_services; |
+}; |
+ |
+struct BLEGattService { |
+ scoped_ptr<BTH_LE_GATT_SERVICE> service_info; |
+ BLEGattServicesMap included_services; |
+ BLEGattCharacteristicsMap included_characteristics; |
+}; |
+ |
+struct BLEGattCharacteristic { |
+ scoped_ptr<BTH_LE_GATT_CHARACTERISTIC> characteristic_info; |
+ scoped_ptr<BTH_LE_GATT_CHARACTERISTIC_VALUE> value; |
+ BLEGattDescriptorsMap included_descriptors; |
+}; |
+ |
+struct BLEGattDescriptor { |
+ scoped_ptr<BTH_LE_GATT_DESCRIPTOR> descriptor_info; |
+ scoped_ptr<BTH_LE_GATT_DESCRIPTOR_VALUE> value; |
+}; |
+ |
// Fake implementation of BluetoothLowEnergyWrapper. Used for BluetoothTestWin. |
class BluetoothLowEnergyWrapperFake : public BluetoothLowEnergyWrapper { |
public: |
@@ -26,6 +72,25 @@ class BluetoothLowEnergyWrapperFake : public BluetoothLowEnergyWrapper { |
const base::FilePath& device_path, |
ScopedVector<BluetoothLowEnergyServiceInfo>* services, |
std::string* error) override; |
+ |
+ BLEDevice* SimulateBLEDevice(std::string device_name, |
+ BLUETOOTH_ADDRESS device_address); |
+ BLEGattService* SimulateBLEGattService(BLEDevice* device, std::string uuid); |
+ |
+ private: |
+ // Generate an unique attribute handle on |device_address|. |
+ USHORT GenerateAnUniqueAttributeHandle(std::string device_address); |
scheib
2016/02/07 02:24:08
GenerateAUniqueAttributeHandle
or
GenerateUniqueA
gogerald1
2016/02/08 19:23:51
Done.
|
+ |
+ // 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(). |
scheib
2016/02/07 02:24:08
Capital UUID.
gogerald1
2016/02/08 19:23:51
Done.
|
+ 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_; |
}; |
} // namespace win |