Exemplo n.º 1
0
    def __init__(self):
        self.local_device = QtBt.QBluetoothLocalDevice()
        self.local_device.deviceConnected.connect(self.notify_connect)
        self.local_device.deviceDisconnected.connect(self.notify_disconnect)

        self.agent = QtBt.QBluetoothDeviceDiscoveryAgent()
        self.agent.deviceDiscovered.connect(self.notify_discovered)
        self.agent.finished.connect(self.notify_finished)
        self.agent.error.connect(self.notify_error)
        self.agent.setLowEnergyDiscoveryTimeout(60000)

        self.scan_loop_timer = QTimer()
        self.scan_loop_timer.timeout.connect(self.scan_loop)

        self.bluetooth_speaker_cb = object()
Exemplo n.º 2
0
    def __init__(self, device, postman, parent=None):
        super(BluetoothSearch, self).__init__(parent)
        uic.loadUi('GUI/bluetoothSearch.ui', self)

        self.device = device
        self.postman = postman
        self.agent = QtBluetooth.QBluetoothDeviceDiscoveryAgent(self)
        self.agent.error.connect(self.error)
        self.agent.deviceDiscovered.connect(self.discovered)
        self.agent.finished.connect(self.stop)

        self.bScan.clicked.connect(self.scan)
        self.buttonBox.accepted.connect(self.save)
        self.localDevice = QtBluetooth.QBluetoothLocalDevice()
        if self.localDevice.isValid():
            self.localDevice.powerOn()
        self.postman.Post.emit("Bluetooth_" + self.device.getName(),
                               self.device.getName(),
                               'Connect to: ' + self.localDevice.name())
Exemplo n.º 3
0
 def __init__(self, app):
     self.local_device = QtBt.QBluetoothLocalDevice()
     self.agent = QtBt.QBluetoothDeviceDiscoveryAgent()
     self.timer = QTimer()
     self.ben = object
     self.app = app