| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef BluetoothAttributeInstanceMap_h | 5 #ifndef BluetoothAttributeInstanceMap_h |
| 6 #define BluetoothAttributeInstanceMap_h | 6 #define BluetoothAttributeInstanceMap_h |
| 7 | 7 |
| 8 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" | 8 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" |
| 9 #include "modules/bluetooth/BluetoothRemoteGATTService.h" | 9 #include "modules/bluetooth/BluetoothRemoteGATTService.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // Methods in this map are used to create or retrieve these attributes. | 22 // Methods in this map are used to create or retrieve these attributes. |
| 23 class BluetoothAttributeInstanceMap final | 23 class BluetoothAttributeInstanceMap final |
| 24 : public GarbageCollected<BluetoothAttributeInstanceMap> { | 24 : public GarbageCollected<BluetoothAttributeInstanceMap> { |
| 25 public: | 25 public: |
| 26 BluetoothAttributeInstanceMap(BluetoothDevice*); | 26 BluetoothAttributeInstanceMap(BluetoothDevice*); |
| 27 | 27 |
| 28 // Constructs a new BluetoothRemoteGATTService object if there was | 28 // Constructs a new BluetoothRemoteGATTService object if there was |
| 29 // no service with the same instance id and adds it to the map. | 29 // no service with the same instance id and adds it to the map. |
| 30 // Otherwise returns the BluetoothRemoteGATTService object already | 30 // Otherwise returns the BluetoothRemoteGATTService object already |
| 31 // in the map. | 31 // in the map. |
| 32 BluetoothRemoteGATTService* getOrCreateBluetoothRemoteGATTService( | 32 BluetoothRemoteGATTService* getOrCreateRemoteGATTService( |
| 33 const String& serviceInstanceId, | 33 const String& serviceInstanceId, |
| 34 const String& uuid, | 34 const String& uuid, |
| 35 bool isPrimary, | 35 bool isPrimary, |
| 36 const String& deviceInstanceId); | 36 const String& deviceInstanceId); |
| 37 | 37 |
| 38 // Returns true if a BluetoothRemoteGATTService with |serviceInstanceId| | 38 // Returns true if a BluetoothRemoteGATTService with |serviceInstanceId| |
| 39 // is in the map. | 39 // is in the map. |
| 40 bool containsService(const String& serviceInstanceId); | 40 bool containsService(const String& serviceInstanceId); |
| 41 | 41 |
| 42 // Constructs a new BluetoothRemoteGATTCharacteristic object if there was no | 42 // Constructs a new BluetoothRemoteGATTCharacteristic object if there was no |
| 43 // characteristic with the same instance id and adds it to the map. | 43 // characteristic with the same instance id and adds it to the map. |
| 44 // Otherwise returns the BluetoothRemoteGATTCharacteristic object already in | 44 // Otherwise returns the BluetoothRemoteGATTCharacteristic object already in |
| 45 // the map. | 45 // the map. |
| 46 BluetoothRemoteGATTCharacteristic* | 46 BluetoothRemoteGATTCharacteristic* getOrCreateRemoteGATTCharacteristic( |
| 47 getOrCreateBluetoothRemoteGATTCharacteristic( | |
| 48 ExecutionContext*, | 47 ExecutionContext*, |
| 49 const String& characteristicInstanceId, | 48 const String& characteristicInstanceId, |
| 50 const String& serviceInstanceId, | 49 const String& serviceInstanceId, |
| 51 const String& uuid, | 50 const String& uuid, |
| 52 uint32_t characteristicProperties, | 51 uint32_t characteristicProperties, |
| 53 BluetoothRemoteGATTService*); | 52 BluetoothRemoteGATTService*); |
| 54 | 53 |
| 55 // Returns true if a BluetoothRemoteGATTCharacteristic with | 54 // Returns true if a BluetoothRemoteGATTCharacteristic with |
| 56 // |characteristicInstanceId| is in the map. | 55 // |characteristicInstanceId| is in the map. |
| 57 bool containsCharacteristic(const String& characteristicInstanceId); | 56 bool containsCharacteristic(const String& characteristicInstanceId); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 68 // Map of service instance ids to objects. | 67 // Map of service instance ids to objects. |
| 69 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject; | 68 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject; |
| 70 // Map of characteristic instance ids to objects. | 69 // Map of characteristic instance ids to objects. |
| 71 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>> | 70 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>> |
| 72 m_characteristicIdToObject; | 71 m_characteristicIdToObject; |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 } // namespace blink | 74 } // namespace blink |
| 76 | 75 |
| 77 #endif // BluetoothAttributeInstanceMap_h | 76 #endif // BluetoothAttributeInstanceMap_h |
| OLD | NEW |