當前位置: 首頁>>代碼示例>>Python>>正文


Python OSC.OSCServer方法代碼示例

本文整理匯總了Python中OSC.OSCServer方法的典型用法代碼示例。如果您正苦於以下問題:Python OSC.OSCServer方法的具體用法?Python OSC.OSCServer怎麽用?Python OSC.OSCServer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OSC的用法示例。


在下文中一共展示了OSC.OSCServer方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import OSC [as 別名]
# 或者: from OSC import OSCServer [as 別名]
def __init__(self, FAKE_CONNECTION=None):
        super(Anoto, self).__init__()

        if FAKE_CONNECTION is None:
            FAKE_CONNECTION = config.getboolean('Anoto Server',
                                                'fake_connection')
        self.speed = TraceSpeed()
        self.keep_serving = True

        if not FAKE_CONNECTION:
            receive_address = (config.get('Anoto Server', 'receive_ip'),
                               config.getint('Anoto Server', 'receive_port'))
            # self.osc_server = OSC.OSCServer(receive_address)  # basic
            self.osc_server = OSC.ThreadingOSCServer(receive_address)
        else:
            receive_address = (config.get('Anoto Server', 'fake_receive_ip'),
                               config.getint('Anoto Server', 'receive_port'))
            self.osc_server = OSC.ThreadingOSCServer(receive_address)
        # either way - print tracebacks
        self.osc_server.print_tracebacks = True 
開發者ID:PedroLopes,項目名稱:muscle-plotter,代碼行數:22,代碼來源:anotoconnect.py

示例2: start_osc_server

# 需要導入模塊: import OSC [as 別名]
# 或者: from OSC import OSCServer [as 別名]
def start_osc_server(self):

        def serve_long(osc_server):
            '''Target function for OSC Server Thead
            '''
            try:
                while self.keep_serving:
                    osc_server.handle_request()
            except Exception as e:
                if not e.args[0] == 9:
                    raise e

        # Start OSCServer
        if DEBUG:
            print("Starting OSCServer.")
        # self.thread_target = self.osc_server.serve_forever
        self.server_thread = threading.Thread(
            target=serve_long,
            args=(self.osc_server, ))
        self.server_thread.start()
        self.server_thread.setName('OSC Client') 
開發者ID:PedroLopes,項目名稱:muscle-plotter,代碼行數:23,代碼來源:anotoconnect.py

示例3: close_connection

# 需要導入模塊: import OSC [as 別名]
# 或者: from OSC import OSCServer [as 別名]
def close_connection(self):

        if DEBUG:
            print("Closing OSCServer.")
        self.keep_serving = False
        self.osc_server.client.close()
        self.osc_server.server_close()
        if DEBUG:
            print("Waiting for Server-thread to finish")
        self.server_thread.join() 
開發者ID:PedroLopes,項目名稱:muscle-plotter,代碼行數:12,代碼來源:anotoconnect.py

示例4: __init__

# 需要導入模塊: import OSC [as 別名]
# 或者: from OSC import OSCServer [as 別名]
def __init__(self,
                 osc_server,
                 opc_client,
                 scenes=None,
                 first_scene=None,
                 no_interaction_timeout=5 * 60,
                 max_scene_timeout=15 * 60,
                 tags=[]):
        # type: (OSCServer, Client, List(OSCClient), {str, Scene}) -> None
        self.osc_server = osc_server
        self.opc_client = opc_client
        self.fps = STATE.fps
        self.no_interaction_timeout = no_interaction_timeout
        self.max_scene_timeout = max_scene_timeout

        # Load all scenes from effects package. Then set initial index and load it up
        if not tags:
            print "Tags not specified. Using only scenes with tags [production]"
            tags = [Scene.TAG_PRODUCTION]
        loaded_scenes = load_scenes_and_fountains(tags=tags)
        self.scenes = scenes or loaded_scenes
        self.non_game_scenes = [name for name, scene in self.scenes.items()
                                if not scene.is_game()]  #  TODO: validation

        map(lambda s: s.after_all_scenes_loaded(), self.scenes.values())

        self.curr_scene = None
        self.queued_scene = self.scenes[first_scene if first_scene else self.non_game_scenes[0]]
        self._last_scene_change_timestamp = time.time()

        self.serve = False
        self.is_running = False

        self.osc_data = OSCDataAccumulator(last_data=None)
        self.setup_osc_input_handlers({0: 50}) 
開發者ID:house-of-enlightenment,項目名稱:house-of-enlightenment,代碼行數:37,代碼來源:animation_framework.py

示例5: mode_started

# 需要導入模塊: import OSC [as 別名]
# 或者: from OSC import OSCServer [as 別名]
def mode_started(self):
        """Starts the OSC server when this OSC game mode is loaded"""
        receive_address = (self.serverIP, self.serverPort)
        self.server = OSC.OSCServer(receive_address)
        self.server.addDefaultHandlers()
        self.server.addMsgHandler("default", self.process_message)

        # start the OSC server
        self.game.logger.info("OSC Server listening on %s:%s", self.serverIP,
                              self.serverPort)
        self.server_thread = threading.Thread(target=self.server.serve_forever)
        self.server_thread.daemon = True  # needed so OSC thread shuts down
        self.server_thread.start()
        self.set_initial_closed_switches() 
開發者ID:adamrgodfrey,項目名稱:RoadKingsApocalypse,代碼行數:16,代碼來源:osc.py


注:本文中的OSC.OSCServer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。