示例#1
0
    def enable_bt_scanning(self, on=True):
        bt_hcis = list(jm_dbus.get_hci_dict().keys())

        for hci in bt_hcis:
            if jm_dbus.enable_adapter(hci):
                self.pair.update_adapters()
            if on:
                jm_dbus.enable_pairable(hci)
            else:
                jm_dbus.disable_pairable(hci)
示例#2
0
    def __init__(self):
        """Use DBus to find bluetooth controllers"""
        self.hci_dict = jm_dbus.get_hci_dict()

        devices = self.hci_dict.values()
        self.bt_devices = {}
        for device in devices:
            self.bt_devices[device] = []

        self.pre_existing_devices()
示例#3
0
    def update_adapters(self):
        """
        Rescan for bluetooth adapters that may not have existed on program launch
        """
        self.hci_dict = jm_dbus.get_hci_dict()

        for addr in self.hci_dict.values():
            if addr not in self.bt_devices.keys():
                self.bt_devices[addr] = []

        self.pre_existing_devices()
示例#4
0
import jm_dbus

if __name__ == '__main__':
    hcis = jm_dbus.get_hci_dict().keys()
    for hci in hcis:
        hci_proxy = jm_dbus.get_adapter_proxy(hci)
        devices = jm_dbus.get_node_child_names(hci_proxy)

        for dev in devices:
            jm_dbus.remove_device(hci, dev)