platypush/plugins/bluetooth/__init__.py
def recv(self, device: str, port: int, service_uuid: str = None, service_name: str = None, size: int = 1024,
             binary: bool = False) -> BluetoothResponse:
        """
        Send data to an active bluetooth connection

        :param device: Device address or name
        :param port: Port number
        :param service_uuid: Service UUID
        :param service_name: Service name
        :param size: Maximum number of bytes to be read
        :param binary: Set to true to return a base64-encoded binary string
        """
        from bluetooth import BluetoothError

        sock = self._get_sock(device=device, port=port, service_uuid=service_uuid, service_name=service_name,
                              connect_if_closed=True)

        if not sock:
            self.connect(device=device, port=port, service_uuid=service_uuid, service_name=service_name)
            sock = self._get_sock(device=device, port=port, service_uuid=service_uuid, service_name=service_name)

        try:
            data = sock.recv(size)
        except BluetoothError as e:
            self.close(device=device, port=port, service_uuid=service_uuid, service_name=service_name)
            raise e

        if binary:
            data = base64.encodebytes(data)

        return BluetoothResponse(output=data.decode())

        Send data to an active bluetooth connection

        :param device: Device address or name
        :param port: Port number
        :param service_uuid: Service UUID
        :param service_name: Service name
        :param size: Maximum number of bytes to be read
        :param binary: Set to true to return a base64-encoded binary string
        
Send data to an active bluetooth connection
Send data to an active bluetooth connection
def recv(self, device: str, port: int, service_uuid: str = None, service_name: str = None, size: int = 1024,
             binary: bool = False) -> BluetoothResponse:
        from bluetooth import BluetoothError
        sock = self._get_sock(device=device, port=port, service_uuid=service_uuid, service_name=service_name,
                              connect_if_closed=True)
        if not sock:
            self.connect(device=device, port=port, service_uuid=service_uuid, service_name=service_name)
            sock = self._get_sock(device=device, port=port, service_uuid=service_uuid, service_name=service_name)
        try:
            data = sock.recv(size)
        except BluetoothError as e:
            self.close(device=device, port=port, service_uuid=service_uuid, service_name=service_name)
            raise e
        if binary:
            data = base64.encodebytes(data)
        return BluetoothResponse(output=data.decode())
def recv ( self , device : str , port : int , service_uuid : str = None , service_name : str = None , size : int = 1024 , binary : bool = False ) -> BluetoothResponse : from bluetooth import BluetoothError sock = self . _get_sock ( device = device , port = port , service_uuid = service_uuid , service_name = service_name , connect_if_closed = True ) if not sock : self . connect ( device = device , port = port , service_uuid = service_uuid , service_name = service_name ) sock = self . _get_sock ( device = device , port = port , service_uuid = service_uuid , service_name = service_name ) try : data = sock . recv ( size ) except BluetoothError as e : self . close ( device = device , port = port , service_uuid = service_uuid , service_name = service_name ) raise e if binary : data = base64 . encodebytes ( data ) return BluetoothResponse ( output = data . decode ( ) )
Send data to an active bluetooth connection
Send data to an active bluetooth connection
"""
        Send data to an active bluetooth connection

        :param device: Device address or name
        :param port: Port number
        :param service_uuid: Service UUID
        :param service_name: Service name
        :param size: Maximum number of bytes to be read
        :param binary: Set to true to return a base64-encoded binary string
        """
self
device
str
Device address or name
Device address or name
port
int
None
service_uuid
str
None
service_name
str
None
size
int
Maximum number of bytes to be read
Maximum number of bytes to be read
binary
bool
Set to true to return a base64-encoded binary string
Set to true to return a base64 - encoded binary string