Esempio n. 1
0
    async def discover_descriptors(self,
                                   characteristic: CBCharacteristic,
                                   use_cached: bool = True) -> NSArray:
        if characteristic.descriptors() is not None and use_cached:
            return characteristic.descriptors()

        future = self._event_loop.create_future()
        self._characteristic_descriptor_discover_futures[
            characteristic.handle()] = future
        self.peripheral.discoverDescriptorsForCharacteristic_(characteristic)
        await future

        return characteristic.descriptors()
Esempio n. 2
0
    async def discover_descriptors(
            self, characteristic: CBCharacteristic) -> NSArray:
        future = self._event_loop.create_future()
        self._characteristic_descriptor_discover_futures[
            characteristic.handle()] = future
        self.peripheral.discoverDescriptorsForCharacteristic_(characteristic)
        await future

        return characteristic.descriptors()