def udev_event_callback(action, device): global copy_thread, message_q if not copy_thread: copy_thread = DeviceManager(kwargs={ 'return_q': message_q, 'action': action, 'device': device }) copy_thread.start()
def init(): global s_channel global s_stub global s_device_manager start_perfdog_service(PERFDOG_SERVICE_PATH) s_channel = grpc.insecure_channel( '%s:%s' % (PERFDOG_SERVICE_IP, PERFDOG_SERVICE_PORT), options=[('grpc.max_receive_message_length', 100 * 1024 * 1024)]) s_stub = perfdog_pb2_grpc.PerfDogServiceStub(s_channel) s_stub.loginWithToken(perfdog_pb2.Token(token=PERFDOG_SERVICE_TOKEN)) s_device_manager = DeviceManager(s_stub) s_device_manager.start()
if __name__ == '__main__': QApplication.setGraphicsSystem("raster") app = QApplication(sys.argv) view = QDeclarativeView() engine = view.engine() engine.quit.connect(app.quit) if len(sys.argv) > 1: manager = DeviceManager(sys.argv[1]) else: manager = DeviceManager() deviceListModel = DeviceListModel(manager) serviceListModel = ServiceListModel() deviceListModel.deviceSelected.connect(serviceListModel.loadDevice) view.rootContext().setContextProperty("deviceManager", manager) view.rootContext().setContextProperty("deviceListModel", deviceListModel) view.rootContext().setContextProperty("serviceListModel", serviceListModel) context = view.rootContext() view.setSource(QUrl('./qml/bluez.qml')) view.setMinimumSize(480, 800) view.show() manager.start() sys.exit(app.exec_())
def udev_event_callback(action, device): global copy_thread, message_q if not copy_thread: copy_thread = DeviceManager(kwargs={'return_q': message_q, 'action': action, 'device': device}) copy_thread.start()