Пример #1
0
 def __init__(self, **kwargs):
     BaseIO.__init__(self, **kwargs)
     Config.__init__(self, **kwargs)
     self.comm = kwargs.get('comm')
     self.register_signal('msg_received', 'msg_sent')
     self.time_scale = self.get_time_scale()
     self.detected_inputs = ChildGroup(name='Inputs')
     self.detected_outputs = ChildGroup(name='Outputs')
     self.dev_info = {'in':self.detected_inputs, 
                      'out':self.detected_outputs}
     self.devices = {}
     for key, cls in self.get_io_device_classes().iteritems():
         self.devices[key] = ChildGroup(name=key, child_class=cls)
     
     self.init_module()
     now = time.time()
     self.start_time = {'module':self.get_module_time(), 
                        'time':now, 
                        'dt':datetime.datetime.fromtimestamp(now)}
     #print self.start_time
     
     
     self.update_devices()
     conf = self.get_conf()
     for key, confkey in {'in':'enabled_inputs', 'out':'enabled_outputs'}.iteritems():
         val = conf.get(confkey)
         if not val:
             continue
         for dev in val:
             self.add_device(key, dev, update_conf=False)
     self.prepare_conf_update()
     self.Mapper = MidiMapper(midi_io=self)
Пример #2
0
 def __init__(self, **kwargs):
     self.Manager = kwargs.get('Manager')
     self.ioManager = self.Manager.ioManager
     self.comm = self.Manager.comm
     self.root_node = self.Manager.root_node
     self.osc_tree = self.Manager.osc_tree
     BaseIO.BaseIO.__init__(self, **kwargs)
     Config.__init__(self, **kwargs)
     self.register_signal('client_added', 'client_removed', 'new_master')
     #self.oscMaster = None
     self.bind(oscMaster=self._on_oscMaster_set)
     self.set_master_timeout = None
     self.master_takeover_timer = None
     self.check_master_attempts = None
     self.local_client = None
     self.clients = ChildGroup(name='clients', 
                               osc_address='CLIENTS', 
                               osc_parent_node=self.root_node, 
                               child_class=Client, 
                               ignore_index=True)
     self.clients_by_address = {}
     #self.root_node.addCallback('/getMaster', self.on_master_requested_by_osc)
     #self.root_node.addCallback('/setMaster', self.on_master_set_by_osc)
     #self.getMasterNode = self.root_node.add_child(name='getMaster')
     #self.getMasterNode.bind(message_received=self.on_master_requested_by_osc)
     #self.setMasterNode = self.root_node.add_child(name='setMaster')
     #self.setMasterNode.bind(message_received=self.on_master_set_by_osc)
     self.GLOBAL_CONFIG.bind(update=self.on_GLOBAL_CONFIG_update)
     if self.GLOBAL_CONFIG.get('osc_use_discovery', True):
         self.comm.ServiceConnector.connect('new_host', self.on_host_discovered)
         self.comm.ServiceConnector.connect('remove_host', self.on_host_removed)
     
     self.Manager.bind(master_priority=self._on_master_priority_set, 
                       session_name=self._on_session_name_set, 
                       ring_master=self._on_ring_master_set)
Пример #3
0
    def __init__(self, **kwargs):
        self.Manager = kwargs.get("Manager")
        self.ioManager = self.Manager.ioManager
        self.comm = self.Manager.comm
        self.root_node = self.Manager.root_node
        self.osc_tree = self.Manager.osc_tree
        BaseIO.BaseIO.__init__(self, **kwargs)
        Config.__init__(self, **kwargs)
        self.register_signal("client_added", "client_removed", "new_master")
        # self.oscMaster = None
        self.bind(oscMaster=self._on_oscMaster_set)
        self.set_master_timeout = None
        self.master_takeover_timer = None
        self.check_master_attempts = None
        self.local_client = None
        self.clients = ChildGroup(
            name="clients", osc_address="CLIENTS", osc_parent_node=self.root_node, child_class=Client, ignore_index=True
        )
        self.clients_by_address = {}
        # self.root_node.addCallback('/getMaster', self.on_master_requested_by_osc)
        # self.root_node.addCallback('/setMaster', self.on_master_set_by_osc)
        # self.getMasterNode = self.root_node.add_child(name='getMaster')
        # self.getMasterNode.bind(message_received=self.on_master_requested_by_osc)
        # self.setMasterNode = self.root_node.add_child(name='setMaster')
        # self.setMasterNode.bind(message_received=self.on_master_set_by_osc)
        self.GLOBAL_CONFIG.bind(update=self.on_GLOBAL_CONFIG_update)
        if self.GLOBAL_CONFIG.get("osc_use_discovery", True):
            self.comm.ServiceConnector.connect("new_host", self.on_host_discovered)
            self.comm.ServiceConnector.connect("remove_host", self.on_host_removed)

        self.Manager.bind(
            master_priority=self._on_master_priority_set,
            session_name=self._on_session_name_set,
            ring_master=self._on_ring_master_set,
        )
Пример #4
0
 def __init__(self, **kwargs):
     self.comm = kwargs.get('comm')
     BaseIO.BaseIO.__init__(self, **kwargs)
     Config.__init__(self, **kwargs)
     self.register_signal('client_added', 'client_removed', 'unique_address_changed', 'new_master')
     self.discovered_sessions = ChildGroup(name='discovered_sessions', 
                                           child_class=Session, 
                                           ignore_index=True)
     self.app_address = self.GLOBAL_CONFIG.get('app_name', self.get_conf('app_address', 'OSCApp'))
     self.default_root_address = kwargs.get('root_address', '%s-%s' % (self.app_address, socket.gethostname()))
     self.root_address = self.default_root_address
     self.wildcard_address = None
     self.master_priority = int(self.get_conf('master_priority', 10))
     self.GLOBAL_CONFIG['master_priority'] = self.master_priority
     s = self.GLOBAL_CONFIG.get('session_name')
     if s == 'None':
         s = None
     if s is not None:
         self.session_name = s
     else:
         self.session_name = socket.gethostname()
         self.GLOBAL_CONFIG['session_name'] = self.session_name
     self.osc_tree = OSCNode(name=self.app_address, 
                             root_node=True, 
                             transmit_callback=self.on_node_tree_send, 
                             get_client_cb=self.get_client, 
                             get_epoch_offset_cb=self.get_epoch_offset)
     #self.root_node = self.osc_tree.add_child(name=self.app_address)
     self.root_node = self.osc_tree
     #self.epoch_offset = datetime.timedelta()
     #self.epoch_offset = 0.
     self.clock_send_thread = None
     s = kwargs.get('use_unique_addresses', self.get_conf('use_unique_addresses', 'True'))
     flag = not s == 'False'
     
     #self.root_node.addCallback('/clocksync', self.on_master_sent_clocksync)
     #csnode = self.root_node.add_child(name='clocksync')
     #csnode.bind(message_received=self.on_master_sent_clocksync)
     #self.clocksync_node = csnode
     self.ioManager = oscIO(Manager=self)
     self.SessionManager = OSCSessionManager(Manager=self)
     self.SessionManager.bind(client_added=self.on_client_added, 
                              client_removed=self.on_client_removed, 
                              new_master=self.on_new_master)
     self.set_use_unique_address(flag, update_conf=False)
     io = kwargs.get('connection_type', self.get_conf('connection_type', 'Unicast'))
     self.ioManager.build_io(iotype=io, update_conf=False)
     self.ClockSync = ClockSync(osc_parent_node=self.root_node, 
                                clients=self.clients)
     self.ClockSync.bind(offset=self.on_ClockSync_offset_set)
Пример #5
0
    def __init__(self, **kwargs):
        self.comm = kwargs.get("comm")
        BaseIO.BaseIO.__init__(self, **kwargs)
        Config.__init__(self, **kwargs)
        self.register_signal("client_added", "client_removed", "unique_address_changed", "new_master")
        self.discovered_sessions = ChildGroup(name="discovered_sessions", child_class=Session, ignore_index=True)
        self.app_address = self.GLOBAL_CONFIG.get("app_name", self.get_conf("app_address", "OSCApp"))
        self.default_root_address = kwargs.get("root_address", "%s-%s" % (self.app_address, socket.gethostname()))
        self.root_address = self.default_root_address
        self.wildcard_address = None
        self.master_priority = int(self.get_conf("master_priority", 10))
        self.GLOBAL_CONFIG["master_priority"] = self.master_priority
        s = self.GLOBAL_CONFIG.get("session_name")
        if s == "None":
            s = None
        if s is not None:
            self.session_name = s
        else:
            self.session_name = socket.gethostname()
            self.GLOBAL_CONFIG["session_name"] = self.session_name
        self.osc_tree = OSCNode(
            name=self.app_address,
            root_node=True,
            transmit_callback=self.on_node_tree_send,
            get_client_cb=self.get_client,
            get_epoch_offset_cb=self.get_epoch_offset,
        )
        # self.root_node = self.osc_tree.add_child(name=self.app_address)
        self.root_node = self.osc_tree
        # self.epoch_offset = datetime.timedelta()
        # self.epoch_offset = 0.
        self.clock_send_thread = None
        s = kwargs.get("use_unique_addresses", self.get_conf("use_unique_addresses", "True"))
        flag = not s == "False"

        # self.root_node.addCallback('/clocksync', self.on_master_sent_clocksync)
        # csnode = self.root_node.add_child(name='clocksync')
        # csnode.bind(message_received=self.on_master_sent_clocksync)
        # self.clocksync_node = csnode
        self.ioManager = oscIO(Manager=self)
        self.SessionManager = OSCSessionManager(Manager=self)
        self.SessionManager.bind(
            client_added=self.on_client_added, client_removed=self.on_client_removed, new_master=self.on_new_master
        )
        self.set_use_unique_address(flag, update_conf=False)
        io = kwargs.get("connection_type", self.get_conf("connection_type", "Unicast"))
        self.ioManager.build_io(iotype=io, update_conf=False)
        self.ClockSync = ClockSync(osc_parent_node=self.root_node, clients=self.clients)
        self.ClockSync.bind(offset=self.on_ClockSync_offset_set)
Пример #6
0
    def __init__(self, **kwargs):
        self.Manager = kwargs.get('Manager')
        self.comm = self.Manager.comm
        BaseIO.BaseIO.__init__(self, **kwargs)
        Config.__init__(self, **kwargs)

        self.hostdata = {}
        self.hostdata_info = {
            'mcastaddr': {
                'conf': 'multicast_address',
                'default': '224.168.2.9'
            },
            'mcastport': {
                'conf': 'multicast_port',
                'default': 18889
            },
            'hostaddr': {
                'conf': 'host_address',
                'default': BaseIO.detect_usable_address()
            },
            'sendport': {
                'conf': 'send_port',
                'default': 18889
            },
            'recvport': {
                'conf': 'recv_port',
                'default': 18888
            }
        }
        for k, v in self.hostdata_info.iteritems():
            val = kwargs.get(k, self.get_conf(v['conf'], v['default']))
            d = {k: type(v['default'])(val)}
            update = k in kwargs
            d.update({'update_conf': update})
            v.update({'update_conf': update})
            self.set_hostdata(**d)
        #print 'hostdata:',  self.hostdata
        self._iotype = None
        self._sender = None
        self._receiver = None
Пример #7
0
 def __init__(self, **kwargs):
     BaseIO.__init__(self, **kwargs)
     Config.__init__(self, **kwargs)
     self.comm = kwargs.get('comm')
     self.device = None
     self.universe_obj = None
     self.universe_thread = None
     self.receive_thread = None
     univ = self.get_conf('universe_index')
     if univ is not None:
         self.universe_index = int(univ)
     iotype = self.get_conf('io_type')
     if iotype is not None:
         self.io_type = iotype
     port = self.get_conf('usb_port')
     if port is not None:
         self.usb_port = int(port)
     self.bind(property_changed=self._on_own_property_changed)
     if self.comm.MainController:
         self.on_comm_MainController_set()
     else:
         self.comm.bind(MainController_set=self.on_comm_MainController_set)
Пример #8
0
 def __init__(self, **kwargs):
     BaseIO.__init__(self, **kwargs)
     Config.__init__(self, **kwargs)
     self.comm = kwargs.get('comm')
     self.device = None
     self.universe_obj = None
     self.universe_thread = None
     self.receive_thread = None
     univ = self.get_conf('universe_index')
     if univ is not None:
         self.universe_index = int(univ)
     iotype = self.get_conf('io_type')
     if iotype is not None:
         self.io_type = iotype
     port = self.get_conf('usb_port')
     if port is not None:
         self.usb_port = int(port)
     self.bind(property_changed=self._on_own_property_changed)
     if self.comm.MainController:
         self.on_comm_MainController_set()
     else:
         self.comm.bind(MainController_set=self.on_comm_MainController_set)
Пример #9
0
 def __init__(self, **kwargs):
     self.reconnect_timer = None
     self.ds_universes = None
     self.universe_obj = None
     self.universe_thread = None
     self.socket = None
     self.should_be_connected = False
     BaseIO.__init__(self, **kwargs)
     Config.__init__(self, **kwargs)
     self.comm = kwargs.get('comm')
     univ = self.get_conf('universe_index')
     if univ is not None:
         self.universe_index = int(univ)
     self.netlinx_address = self.get_conf('netlinx_address')
     port = self.get_conf('netlinx_port')
     if port is not None:
         self.netlinx_port = port
     self.bind(property_changed=self._on_own_property_changed)
     if self.comm.MainController:
         self.on_comm_MainController_set()
     else:
         self.comm.bind(MainController_set=self.on_comm_MainController_set)
Пример #10
0
    def __init__(self, **kwargs):
        BaseIO.__init__(self, **kwargs)
        Config.__init__(self, **kwargs)
        self.comm = kwargs.get('comm')
        self.register_signal('msg_received', 'msg_sent')
        self.time_scale = self.get_time_scale()
        self.detected_inputs = ChildGroup(name='Inputs')
        self.detected_outputs = ChildGroup(name='Outputs')
        self.dev_info = {
            'in': self.detected_inputs,
            'out': self.detected_outputs
        }
        self.devices = {}
        for key, cls in self.get_io_device_classes().iteritems():
            self.devices[key] = ChildGroup(name=key, child_class=cls)

        self.init_module()
        now = time.time()
        self.start_time = {
            'module': self.get_module_time(),
            'time': now,
            'dt': datetime.datetime.fromtimestamp(now)
        }
        #print self.start_time

        self.update_devices()
        conf = self.get_conf()
        for key, confkey in {
                'in': 'enabled_inputs',
                'out': 'enabled_outputs'
        }.iteritems():
            val = conf.get(confkey)
            if not val:
                continue
            for dev in val:
                self.add_device(key, dev, update_conf=False)
        self.prepare_conf_update()
        self.Mapper = MidiMapper(midi_io=self)
Пример #11
0
 def __init__(self, **kwargs):
     self.Manager = kwargs.get('Manager')
     self.comm = self.Manager.comm
     BaseIO.BaseIO.__init__(self, **kwargs)
     Config.__init__(self, **kwargs)
     
     self.hostdata = {}
     self.hostdata_info = {'mcastaddr':{'conf':'multicast_address', 'default':'224.168.2.9'}, 
                           'mcastport':{'conf':'multicast_port', 'default':18889}, 
                           'hostaddr':{'conf':'host_address', 'default':BaseIO.detect_usable_address()}, 
                           'sendport':{'conf':'send_port', 'default':18889}, 
                           'recvport':{'conf':'recv_port', 'default':18888}}
     for k, v in self.hostdata_info.iteritems():
         val = kwargs.get(k, self.get_conf(v['conf'], v['default']))
         d = {k:type(v['default'])(val)}
         update = k in kwargs
         d.update({'update_conf':update})
         v.update({'update_conf':update})
         self.set_hostdata(**d)
     #print 'hostdata:',  self.hostdata
     self._iotype = None
     self._sender = None
     self._receiver = None