def start(self): self.debug_print(1, 'start()') if not self.running: self.running = 1 self.__status = -1 # If Config has disabled Internal Modem Server, try to get a ref to the # ComIfRouteNode at the given rzhost_master_path (in nodetree): port_node = None self.debug_print(1, 'rzhost_master_path = %s', self.rzhost_master_path) if self.QA != 0: try: com_if_node = as_internal_node(self.rzhost_master_path) except ENoSuchName, segment: msglog.log('RznetNode', msglog.types.ERR, ('Failed to find' ' InterfaceRouterNode object' ' at %s, at segment %s!' ' Pass-through will not run.') % (self.rzhost_master_path, segment)) else: port_node = com_if_node.parent self.debug_print(1, 'port_node = %s', str(port_node)) # Create/init thread that runs the whole shootin' match. Pass in # desired rznet_addr: self.line_handler = RznetThread(self.parent, self.rzhost_slave_port, port_node, self.QA, self.rznet_addr, self) # applies to ALL devices self.line_handler.def_max_dev_subscrs = self.def_max_dev_subscrs # Discover kids in start() rather than in configure, because # creating nodes in configure could conceivably confuse the # framework (ie should it attempt to config the new nodes?). # discover_children() explicitly configs each child node. if self.parent.as_node_url() != '/services/control': #under com self.discover_children() #need to kick start old style nodes #next, start the line handler thread self.line_handler.start() # opens RS485 file object, and slave and # cmd sockets # @fixme HACK to wait for the line_handler thread to init. self.line_handler._internal_lock.acquire() self.line_handler._internal_lock.release() # @fixme END HACK to wait for the line_handler thread to init. self.rznet_addr = self.line_handler.get_addrs()[ 0] # get actual addr from ldisc: self.debug_print(1, 'ldisc has addr %d.', self.rznet_addr) CompositeNode.start(self) self.line_handler.broadcast_update_request( ) #send this out AFTER all bound_proxies are started self.__status = 1
def start(self): self.debug_print(1, 'start()') if not self.running: self.running = 1 self.__status = -1 # If Config has disabled Internal Modem Server, try to get a ref to the # ComIfRouteNode at the given rzhost_master_path (in nodetree): port_node = None self.debug_print(1, 'rzhost_master_path = %s', self.rzhost_master_path) if self.QA != 0: try: com_if_node = as_internal_node(self.rzhost_master_path) except ENoSuchName, segment: msglog.log('RznetNode', msglog.types.ERR, ('Failed to find' ' InterfaceRouterNode object' ' at %s, at segment %s!' ' Pass-through will not run.') % (self.rzhost_master_path, segment) ) else: port_node = com_if_node.parent self.debug_print(1, 'port_node = %s', str(port_node)) # Create/init thread that runs the whole shootin' match. Pass in # desired rznet_addr: self.line_handler = RznetThread(self.parent, self.rzhost_slave_port, port_node, self.QA, self.rznet_addr, self) # applies to ALL devices self.line_handler.def_max_dev_subscrs = self.def_max_dev_subscrs # Discover kids in start() rather than in configure, because # creating nodes in configure could conceivably confuse the # framework (ie should it attempt to config the new nodes?). # discover_children() explicitly configs each child node. if self.parent.as_node_url() != '/services/control': #under com self.discover_children() #need to kick start old style nodes #next, start the line handler thread self.line_handler.start(); # opens RS485 file object, and slave and # cmd sockets # @fixme HACK to wait for the line_handler thread to init. self.line_handler._internal_lock.acquire() self.line_handler._internal_lock.release() # @fixme END HACK to wait for the line_handler thread to init. self.rznet_addr = self.line_handler.get_addrs()[0] # get actual addr from ldisc: self.debug_print(1, 'ldisc has addr %d.', self.rznet_addr) CompositeNode.start(self) self.line_handler.broadcast_update_request() #send this out AFTER all bound_proxies are started self.__status = 1
def start(self): self.debug_print(1, 'start()') if not self.running: self.running = 1 self.__status = -1 # Discover kids in start() rather than in configure, because # creating nodes in configure could conceivably confuse the # framework (ie should it attempt to config the new nodes?). # discover_children() explicitly configs each child node. #if self.discover: #self.discover_children() # Create/init thread that runs the whole shootin' match. Pass in # desired rznet_addr: if self.com_port_path in ( '/interfaces/com3', '/interfaces/com4', '/interfaces/com5', '/interfaces/com6', ): self.line_handler = RznetThread(as_node(self.com_port_path), self.rzhost_slave_port, None, 0, self.rznet_addr, self) self.connection_type = 'rs-485' else: #since it must be a rs-232 protocol, either local com port or virtual via tunnel.... self.line_handler = RzhostThread(as_node(self.com_port_path), self.rzhost_slave_port, self.rznet_addr, self) self.connection_type = 'rs-232' # applies to ALL devices self.line_handler.def_max_dev_subscrs = self.def_max_dev_subscrs #next, start the line handler thread self.line_handler.start() # opens RS485 file object, and slave and # cmd sockets # @fixme HACK to wait for the line_handler thread to init. self.line_handler._internal_lock.acquire() self.line_handler._internal_lock.release() # @fixme END HACK to wait for the line_handler thread to init. self.rznet_addr = self.line_handler.get_addrs()[ 0] # get actual addr from ldisc: self.debug_print(1, 'ldisc has addr %d.', self.rznet_addr) CompositeNode.start(self) self.line_handler.broadcast_update_request( ) #send this out AFTER all bound_proxies are started else: msglog.log('RznetNode', msglog.types.INFO, 'Allready started. Attempt to start any children') CompositeNode.start(self) return
class RznetNode(CompositeNode): """class RznetNode: Encapsulates node operations for an rznet-protocol serial port interface. Instanciated as ONLY child of a Port node. (@fixme: Enforce the ONLY part...) """ version = '0.0' def __init__(self): CompositeNode.__init__(self) self.running = 0 self.line_handler = None self._pnts_map = {} self.debug_lvl = 0 # should be valid immediately after ctor, NOT just after configure() self.__status = None def configure(self, config): self.debug_print(1, 'RznetNode: configure()') CompositeNode.configure(self, config) #set_attribute(self, 'discover', 0, config, as_boolean) config_dir = _properties.properties.CONFIGURATION_DIR self.x_points_file_path = config_dir + '/xpoints_' + self.parent.name + '.net' # HARDCODED - rmv from nodedefs! self.debug_print(1, self.x_points_file_path) self.xml_file_path = config_dir + '/rznp_' + self.parent.name + '.xml' # HARDCODED - rmv from nodedefs! set_attribute( self, 'rzhost_slave_port', 6005, config, int) # potl conn to PhWin, via skt; points file datum overrides set_attribute( self, 'rzhost_master_path', '', config) # potl RZHostMaster conn to Ext Modem Server, via COMx set_attribute( self, 'QA', 0, config, as_boolean) # 1: disables Int Modem Server, enables pass-through set_attribute(self, 'rznet_addr', 100000, config, int) # rznet addr; '0' = let ldisc determine it set_attribute(self, 'def_max_dev_subscrs', 256, config, int) # max subscrs allowed per device set_attribute( self, '__node_id__', '120077', config ) # allows dyn node creation; not presently used for RznetNode set_attribute(self, 'debug_lvl', 0, config, int) self.com_port_path = self.parent.as_node_url() return def configuration(self): config = CompositeNode.configuration(self) get_attribute(self, 'debug_lvl', config, int) #get_attribute(self, 'discover', config, as_onoff) get_attribute(self, 'x_points_file_path', config) get_attribute(self, 'rzhost_slave_port', config, int) get_attribute(self, 'rzhost_master_path', config) get_attribute(self, 'QA', config, as_boolean) get_attribute(self, 'rznet_addr', config, int) # rznet addr; '0' = let ldisc determine it get_attribute(self, 'def_max_dev_subscrs', config, int) get_attribute(self, '__node_id__', config) get_attribute(self, 'com_port_path', config) try: self._token_list_ = self.get_token_list() get_attribute(self, '_token_list_', config) except: pass return config def start(self): self.debug_print(1, 'start()') if not self.running: self.running = 1 self.__status = -1 # If Config has disabled Internal Modem Server, try to get a ref to the # ComIfRouteNode at the given rzhost_master_path (in nodetree): port_node = None self.debug_print(1, 'rzhost_master_path = %s', self.rzhost_master_path) if self.QA != 0: try: com_if_node = as_internal_node(self.rzhost_master_path) except ENoSuchName, segment: msglog.log('RznetNode', msglog.types.ERR, ('Failed to find' ' InterfaceRouterNode object' ' at %s, at segment %s!' ' Pass-through will not run.') % (self.rzhost_master_path, segment)) else: port_node = com_if_node.parent self.debug_print(1, 'port_node = %s', str(port_node)) # Create/init thread that runs the whole shootin' match. Pass in # desired rznet_addr: self.line_handler = RznetThread(self.parent, self.rzhost_slave_port, port_node, self.QA, self.rznet_addr, self) # applies to ALL devices self.line_handler.def_max_dev_subscrs = self.def_max_dev_subscrs # Discover kids in start() rather than in configure, because # creating nodes in configure could conceivably confuse the # framework (ie should it attempt to config the new nodes?). # discover_children() explicitly configs each child node. if self.parent.as_node_url() != '/services/control': #under com self.discover_children() #need to kick start old style nodes #next, start the line handler thread self.line_handler.start() # opens RS485 file object, and slave and # cmd sockets # @fixme HACK to wait for the line_handler thread to init. self.line_handler._internal_lock.acquire() self.line_handler._internal_lock.release() # @fixme END HACK to wait for the line_handler thread to init. self.rznet_addr = self.line_handler.get_addrs()[ 0] # get actual addr from ldisc: self.debug_print(1, 'ldisc has addr %d.', self.rznet_addr) CompositeNode.start(self) self.line_handler.broadcast_update_request( ) #send this out AFTER all bound_proxies are started self.__status = 1 else:
class RznetNode(CompositeNode): """class RznetNode: Encapsulates node operations for an rznet-protocol serial port interface. Instanciated as ONLY child of a Port node. (@fixme: Enforce the ONLY part...) """ version = '0.0' def __init__(self): CompositeNode.__init__(self) self.running = 0 self.line_handler = None self._pnts_map = {} self.debug_lvl = 0 # should be valid immediately after ctor, NOT just after configure() self.__status = None def configure(self, config): self.debug_print(1, 'RznetNode: configure()') CompositeNode.configure(self, config) #set_attribute(self, 'discover', 0, config, as_boolean) config_dir = _properties.properties.CONFIGURATION_DIR self.x_points_file_path = config_dir + '/xpoints_' + self.parent.name + '.net' # HARDCODED - rmv from nodedefs! self.debug_print(1, self.x_points_file_path) self.xml_file_path = config_dir + '/rznp_' + self.parent.name + '.xml' # HARDCODED - rmv from nodedefs! set_attribute(self, 'rzhost_slave_port', 6005, config, int) # potl conn to PhWin, via skt; points file datum overrides set_attribute(self, 'rzhost_master_path', '', config) # potl RZHostMaster conn to Ext Modem Server, via COMx set_attribute(self, 'QA', 0, config, as_boolean) # 1: disables Int Modem Server, enables pass-through set_attribute(self, 'rznet_addr', 100000, config, int) # rznet addr; '0' = let ldisc determine it set_attribute(self, 'def_max_dev_subscrs', 256, config, int) # max subscrs allowed per device set_attribute(self, '__node_id__', '120077', config) # allows dyn node creation; not presently used for RznetNode set_attribute(self, 'debug_lvl', 0, config, int) self.com_port_path = self.parent.as_node_url() return def configuration(self): config = CompositeNode.configuration(self) get_attribute(self, 'debug_lvl', config, int) #get_attribute(self, 'discover', config, as_onoff) get_attribute(self, 'x_points_file_path', config) get_attribute(self, 'rzhost_slave_port', config, int) get_attribute(self, 'rzhost_master_path', config) get_attribute(self, 'QA', config, as_boolean) get_attribute(self, 'rznet_addr', config, int) # rznet addr; '0' = let ldisc determine it get_attribute(self, 'def_max_dev_subscrs', config, int) get_attribute(self, '__node_id__', config) get_attribute(self, 'com_port_path', config) try: self._token_list_ = self.get_token_list() get_attribute(self, '_token_list_', config) except: pass return config def start(self): self.debug_print(1, 'start()') if not self.running: self.running = 1 self.__status = -1 # If Config has disabled Internal Modem Server, try to get a ref to the # ComIfRouteNode at the given rzhost_master_path (in nodetree): port_node = None self.debug_print(1, 'rzhost_master_path = %s', self.rzhost_master_path) if self.QA != 0: try: com_if_node = as_internal_node(self.rzhost_master_path) except ENoSuchName, segment: msglog.log('RznetNode', msglog.types.ERR, ('Failed to find' ' InterfaceRouterNode object' ' at %s, at segment %s!' ' Pass-through will not run.') % (self.rzhost_master_path, segment) ) else: port_node = com_if_node.parent self.debug_print(1, 'port_node = %s', str(port_node)) # Create/init thread that runs the whole shootin' match. Pass in # desired rznet_addr: self.line_handler = RznetThread(self.parent, self.rzhost_slave_port, port_node, self.QA, self.rznet_addr, self) # applies to ALL devices self.line_handler.def_max_dev_subscrs = self.def_max_dev_subscrs # Discover kids in start() rather than in configure, because # creating nodes in configure could conceivably confuse the # framework (ie should it attempt to config the new nodes?). # discover_children() explicitly configs each child node. if self.parent.as_node_url() != '/services/control': #under com self.discover_children() #need to kick start old style nodes #next, start the line handler thread self.line_handler.start(); # opens RS485 file object, and slave and # cmd sockets # @fixme HACK to wait for the line_handler thread to init. self.line_handler._internal_lock.acquire() self.line_handler._internal_lock.release() # @fixme END HACK to wait for the line_handler thread to init. self.rznet_addr = self.line_handler.get_addrs()[0] # get actual addr from ldisc: self.debug_print(1, 'ldisc has addr %d.', self.rznet_addr) CompositeNode.start(self) self.line_handler.broadcast_update_request() #send this out AFTER all bound_proxies are started self.__status = 1 else: