def _test_2_test_service_control(self): # Run main _proc = subprocess.Popen(args = ["python", os.path.normpath(Test_Script_Dir + "/../main.py")], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Connect to it and sent message osc.init() self.oscid = osc.listen(ipAddr='0.0.0.0', port=3002) osc.bind(self.oscid, self._status_result, '/status') self.test_2_result = None sleep(1) osc.sendMsg(oscAddress ='/status', ipAddr="0.0.0.0", dataArray=[""], port=3000) while self.test_2_result is None: osc.readQueue(self.oscid) sleep(.1) if self.test_2_result is True: self.assertTrue(True) else: self.assertTrue(False, "Test failed, service returned:" + str(self.test_2_result)) osc.sendMsg(oscAddress ='/stop', ipAddr="0.0.0.0", dataArray=[], port=3000) osc.dontListen(self.oscid)
def on_stop(self): """ Unload the kivy language file when the application stops """ Builder.unload_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'anontunnel.kv')) resource_remove_path(os.path.dirname(os.path.abspath(__file__))) osc.dontListen(self.oscid) return True
def on_stop(self): """ Unload the kivy language file when the application stops """ Builder.unload_file( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'anontunnel.kv')) resource_remove_path(os.path.dirname(os.path.abspath(__file__))) osc.dontListen(self.oscid) return True
def on_stop(self): osc.dontListen() if self.service: self.service.stop() self.service = None return True
def stop(self): '''Stop the TUIO provider''' osc.dontListen(self.oscid)
def stop(self): osc.dontListen()
def stop(self): """Stop the tuio provider""" osc.dontListen(self.oscid)
bt_connection = BluetoothConnection() service_should_run = Event() service_should_run.set() bt_thread = Thread(target=bt_rx_thread) bt_thread.start() osc.init() oscid = osc.listen(ipAddr='0.0.0.0', port=SERVICE_API_PORT) osc.bind(oscid, tx_api_callback, TX_API) osc.bind(oscid, cmd_api_callback, CMD_API) global last_keep_alive_time while service_should_run.is_set(): try: osc.readQueue(oscid) if time() > last_keep_alive_time + KEEP_ALIVE_TIMEOUT: Logger.warn("RC_SVC: keep alive timeout!") service_should_run.clear() sleep(OSC_PROCESSING_INTERVAL) except Exception as e: Logger.error('RC_SVC: Exception in OSC queue processing ' + str(e)) traceback.print_exc() osc.dontListen() bt_connection.close() bt_thread.join(RX_THREAD_JOIN_DELAY) del bt_thread Logger.info('RC_SVC: ############################## Android Service Exiting ##############################') exit(0) #This is needed else the service hangs around in a zombie like state forever
def on_stop(self): L.debug("on_stop()") osc.dontListen(self.oscid) self.oscid = None self.pending = {} self.stopped = True
def on_pause(self): osc.dontListen(self.oscid) self.oscid = None self.pending = {}