How to use the bleak.BleakError function in bleak

To help you get started, we’ve selected a few bleak examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hbldh / bleak / bleak / backends / service.py View on Github external
def add_characteristic(self, characteristic: BleakGATTCharacteristic):
        """Add a :py:class:`~BleakGATTCharacteristic` to the service collection.

        Should not be used by end user, but rather by `bleak` itself.
        """
        if characteristic.uuid not in self.__characteristics:
            self.__characteristics[characteristic.uuid] = characteristic
            self.__services[characteristic.service_uuid].add_characteristic(
                characteristic
            )
        else:
            raise BleakError(
                "This characteristic is already present in this BleakGATTServiceCollection!"
            )
github hbldh / bleak / bleak / backends / service.py View on Github external
def add_descriptor(self, descriptor: BleakGATTDescriptor):
        """Add a :py:class:`~BleakGATTDescriptor` to the service collection.

         Should not be used by end user, but rather by `bleak` itself.
         """
        if descriptor.handle not in self.__descriptors:
            self.__descriptors[descriptor.handle] = descriptor
            self.__characteristics[descriptor.characteristic_uuid].add_descriptor(
                descriptor
            )
        else:
            raise BleakError(
                "This descriptor is already present in this BleakGATTServiceCollection!"
            )
github hbldh / bleak / bleak / backends / service.py View on Github external
def add_service(self, service: BleakGATTService):
        """Add a :py:class:`~BleakGATTService` to the service collection.

        Should not be used by end user, but rather by `bleak` itself.
        """
        if service.uuid not in self.__services:
            self.__services[service.uuid] = service
        else:
            raise BleakError(
                "This service is already present in this BleakGATTServiceCollection!"
            )