Esempio n. 1
0
    def distrust(self, mac: str) -> None:
        """
        Overriding EngineBluew's untrust method.
        :param mac: Device path. @mac_to_dev takes care of getting the proper
        path from the device's mac address.
        :return: True if succeeded, False otherwise..
        """

        deviface = BluezDeviceInterface(self._bus, mac, self.cntrl)
        deviface.distrust_device()
Esempio n. 2
0
    def pair(self, mac: str) -> None:
        """
        Overriding EngineBluew's pair method.
        :param mac: Device path. @mac_to_dev takes care of getting the proper
        path from the device's mac address.
        :return: True if succeeded, False otherwise..
        """

        deviface = BluezDeviceInterface(self._bus, mac, self.cntrl)
        deviface.pair_device()
        paired = self._is_device_paired_timeout(mac)
        if not paired:
            raise PairError(self.name, self.version)
Esempio n. 3
0
 def trust(self, dev) -> None:
     mac = self.dev_to_path(dev)
     bid = BluezDeviceInterface(self._bus, mac, self.cntl)
     did = '/org/bluez/' + self.cntl + mac
     bo = self._bus.get_object('org.bluez', did)
     dif = dbus.Interface(bo, 'org.bluez.Device1')
     prop = dbus.Interface(bo, 'org.freedesktop.DBus.Properties')
     prop.Set('org.bluez.Device1', 'Trusted', True)  # trust
Esempio n. 4
0
 def disconnect(self, dev) -> None:
     mac = self.dev_to_path(dev)
     bid = BluezDeviceInterface(self._bus, mac, self.cntl)
     did = '/org/bluez/' + self.cntl + mac
     _logger.debug(did)
     bo = self._bus.get_object('org.bluez', did)
     _logger.debug(bo)
     dif = dbus.Interface(bo, 'org.bluez.Device1')
     _logger.debug(dif)
     # connect
     dif.Disconnect()
Esempio n. 5
0
 def pair(self, dev) -> None:
     mac = self.dev_to_path(dev)
     bid = BluezDeviceInterface(self._bus, mac, self.cntl)
     did = '/org/bluez/' + self.cntl + mac
     _logger.debug(did)
     bo = self._bus.get_object('org.bluez', did)
     _logger.debug(bo)
     dif = dbus.Interface(bo, 'org.bluez.Device1')
     prop = dbus.Interface(bo, 'org.freedesktop.DBus.Properties')
     _logger.debug(dif)
     dif.Pair()  # pair
     dif.Connect()  # connect
     prop.Set('org.bluez.Device1', 'Trusted', True)  # trust
     _logger.debug(bid.dev)
     _logger.info('pairing')