Exemplo n.º 1
0
    def start(self):
        if self.parent.room == 1:
            msglog.log(
                'USAP', INFO, 'Object:start() - %s --> %s --> %s' %
                (self.parent.parent.name, self.parent.name, self.name))
            self.path = string.join([self.parent.name, self.name], '.')
            self.lh = self.parent.parent.lh
            self.request_obj = self.parent.parent.request_obj
            self.response_obj = self.parent.parent.response_obj
            self.unison_v1_9_0_or_prior = self.parent.parent.unison_v1_9_0_or_prior
        else:
            msglog.log(
                'USAP', INFO, 'Object:start() - %s --> %s --> %s --> %s' %
                (self.parent.parent.parent.name, self.parent.parent.name,
                 self.parent.name, self.name))
            self.path = string.join([self.parent.parent.name, \
                                     self.parent.name, self.name], '.')
            self.lh = self.parent.parent.parent.lh
            self.request_obj = self.parent.parent.parent.request_obj
            self.response_obj = self.parent.parent.parent.response_obj
            self.unison_v1_9_0_or_prior = self.parent.parent.parent.unison_v1_9_0_or_prior

        # Find the relevant protocol child objects ahead of time to
        # be more efficient.
        self.req_startCode_obj = self.request_obj.findChildByName("startCode")
        self.req_vData_obj = self.request_obj.findChildByName("vData")
        self.req_crc_obj = self.request_obj.findChildByName("crc")
        #
        self.resp_startCode_obj = self.response_obj.findChildByName(
            "startCode")
        self.resp_vData_obj = self.response_obj.findChildByName("vData")
        self.resp_crc_obj = self.response_obj.findChildByName("crc")
        #
        CompositeNode.start(self)
Exemplo n.º 2
0
 def start(self):
     CompositeNode.start(self)
     self.local_context = {}
     try:
         self.compiled_statement = compile(self.statement, '', 'eval')
         #examine each variable and decide what to do with it
         for variable in self.variables:
             name = variable['vn']
             definition = variable['node_reference']
             if self.local_context.has_key(name):
                 raise EInvalidValue('variable',name,
                                     'Variable name duplicated')
             exceptions = []
             conversions = self._conversions[:]
             while conversions:
                 conversion = conversions.pop(0)
                 try:
                     reference = conversion(definition)
                     break
                 except Exception,e:
                     exceptions.append(e)
             else:
                 self.local_context = {}
                 raise EInvalidValue('variable',name,
                                     ('Conversions %s Gave Errors %s.' %
                                      (self._conversions,exceptions)))
             self.local_context[name] = reference
         self.started = 1
Exemplo n.º 3
0
 def start(self):
     #only if we are an active point (not simply a parent node)
     if self.lan_address != 0 and self.id_number != 0:
         #do we have a _line_handler and therefore want get/set
         if self._line_handler is None: #preconfigured instead of autodiscovered
             self._line_handler = self.get_line_handler()
         if self._line_handler:
             self.get = self._get
             self.get_result = self._get_result
             self.set = self._set
             self.has_cov = self._has_cov
             self.event_subscribe = self._event_subscribe
             self.event_unsubscribe = self._event_unsubscribe
             self._line_handler_up = self.__line_handler_up
             try:
                 if not self.has_child("_status"):
                     self.__status = self.Status(self)
                     self.__status.configure({'name':'_status', 'parent':self})
             except:
                 msglog.exception()
             if self.is_bound_proxy():
                 self._line_handler.register_bound_proxy(self)
     CompositeNode.start(self)
     ActiveProxyAbstractClass.start(self)
     return
Exemplo n.º 4
0
 def start(self):
     self.maps = self.parent.maps #children may reference maps
     if self.separate_cache:
         if self.group_base_register:
             if not self.maps.has_key(self.group_base_register):
                 self.maps[self.group_base_register] = ([], 1.0)
     CompositeNode.start(self)
Exemplo n.º 5
0
 def start(self):
     self.port = self.parent
     if not self.port.is_open():
         self.port.open()
     self.line_handler = cat_lib.CCMLineHandler(self.port)
     self.line_handler.start(self.password)
     CompositeNode.start(self)
Exemplo n.º 6
0
 def start(self):
     self.device_map = {}
     if self.debug: print 'Start modbus serial slave node'
     CompositeNode.start(self)
     self.subnet.start()
     if self.debug: print 'modbus serial slave node started'
     return
Exemplo n.º 7
0
 def start(self):
     enable = 0
     if self.debug:
         print "start bbmd"
         print self.bbmd_table
         print self.enabled
     if self.enabled:
         if self.debug:
             print "bbmd is enabled"
         p_table = _PersistentBBMDTable(self)
         self._persistent_table = p_table
         p_table.load()
         if p_table.bbmd_table:
             table = p_table.bbmd_table
             enable = p_table.enable_bbmd
         else:  # no persistent data, read config
             table = []
             for b in self.bbmd_table:
                 table.append((b["ip"], b["udp_port"], b["mask"]))
                 if self.debug:
                     print str(b)
             if len(table):
                 enable = 1
         if self.debug:
             print str(table)
             print "start bbmd_service"
         start_bbmd_service(self.parent.interface, table, self)
         if enable:
             enable_bbmd(self.parent.interface.network)
     CompositeNode.start(self)
Exemplo n.º 8
0
 def start(self):
     CompositeNode.start(self)
     if not self.isStarted:
         self.isStarted = 1
         self._schedule()
     else:
         raise EAlreadyRunning
Exemplo n.º 9
0
    def start(self):
        if self.parent.room == 1:
            msglog.log('USAP', INFO, 'Object:start() - %s --> %s --> %s' % (self.parent.parent.name, self.parent.name, self.name))
            self.path = string.join([self.parent.name, self.name], '.')
            self.lh = self.parent.parent.lh
            self.request_obj = self.parent.parent.request_obj
            self.response_obj = self.parent.parent.response_obj
            self.unison_v1_9_0_or_prior = self.parent.parent.unison_v1_9_0_or_prior
        else:
            msglog.log('USAP', INFO, 'Object:start() - %s --> %s --> %s --> %s' % (self.parent.parent.parent.name, self.parent.parent.name, self.parent.name, self.name))
            self.path = string.join([self.parent.parent.name, \
                                     self.parent.name, self.name], '.')
            self.lh = self.parent.parent.parent.lh
            self.request_obj = self.parent.parent.parent.request_obj
            self.response_obj = self.parent.parent.parent.response_obj
            self.unison_v1_9_0_or_prior = self.parent.parent.parent.unison_v1_9_0_or_prior

        # Find the relevant protocol child objects ahead of time to
        # be more efficient.
        self.req_startCode_obj = self.request_obj.findChildByName("startCode")
        self.req_vData_obj = self.request_obj.findChildByName("vData")
        self.req_crc_obj = self.request_obj.findChildByName("crc")
        #
        self.resp_startCode_obj = self.response_obj.findChildByName("startCode")
        self.resp_vData_obj = self.response_obj.findChildByName("vData")
        self.resp_crc_obj = self.response_obj.findChildByName("crc")
        #
        CompositeNode.start(self)
Exemplo n.º 10
0
 def start(self):
     CompositeNode.start(self)
     next_position = 0
     timestamp = PeriodicColumn()
     timestamp.configure({'parent':self.get_child('recorders'),
                          'name':'timestamp',
                          'position':next_position,
                          'sort_order':'ascending',
                          'args':(),
                          'function':self.scheduled_time})
     timestamp.sequence = 0
     sequences = []
     for child in self.get_child('recorders').children_nodes():
         if child.__class__ == Recorder:
             if child.sequence in sequences:
                 raise EConfiguration(
                     'Conflicting RecorderSet sequence %s on %r' %
                     (child.sequence, child.name))
         sequences.append(child.sequence)
     # Force Timestamp as column '0'.
     self.collector.add_column(timestamp)
     children = self.get_child('recorders').children_nodes()
     children.sort(_sort)
     for child in children:
         if child.__class__ == Recorder:
             for channel in child.channels():
                 next_position += 1
                 channel.position = next_position
                 self.collector.add_column(channel)
     cc = ColumnConfiguration()
     cc.configure(timestamp.configuration())
     self.log.configure([cc]+self.collector.columns[1:],
                        self.minimum_size,self.maximum_size)
     self.collector.start()
Exemplo n.º 11
0
 def start(self):
     #only if we are an active point (not simply a parent node)
     if self.lan_address != 0 and self.id_number != 0:
         #do we have a _line_handler and therefore want get/set
         if self._line_handler is None:  #preconfigured instead of autodiscovered
             self._line_handler = self.get_line_handler()
         if self._line_handler:
             self.get = self._get
             self.get_result = self._get_result
             self.set = self._set
             self.has_cov = self._has_cov
             self.event_subscribe = self._event_subscribe
             self.event_unsubscribe = self._event_unsubscribe
             self._line_handler_up = self.__line_handler_up
             try:
                 if not self.has_child("_status"):
                     self.__status = self.Status(self)
                     self.__status.configure({
                         'name': '_status',
                         'parent': self
                     })
             except:
                 msglog.exception()
             if self.is_bound_proxy():
                 self._line_handler.register_bound_proxy(self)
     CompositeNode.start(self)
     ActiveProxyAbstractClass.start(self)
     return
Exemplo n.º 12
0
 def start(self):
     self._pdo = PersistentDataObject(self)
     self._pdo.last_dictionary = None
     self._pdo.load()
     self._started = 1
     self.parent.event_subscribe(self,AlarmTriggerEvent)
     CompositeNode.start(self)
Exemplo n.º 13
0
 def start(self):
     self.port = self.parent
     if not self.port.is_open():
         self.port.open()
     self.line_handler = cat_lib.CCMLineHandler(self.port)
     self.line_handler.start(self.password)
     CompositeNode.start(self)
Exemplo n.º 14
0
    def start(self):
        if self.__running:
            return
        if self.debug:
            msglog.log('EnergywiseManager :', msglog.types.INFO, 'Inside start' )
        CompositeNode.start(self)
#        start_node = as_node('/services/EnergywiseManager/')
#        self.configure_trend_in_switches(start_node, 60)
        self.__running = True
        self._pdo_lock.acquire()
        self._pdo = PersistentDataObject(self, dmtype=GC_NEVER)
        self._pdo.trends = {}
        self._pdo.load()
        self._pdo_lock.release()
        if self.has_child('trends'):
            self.trends = self.get_child('trends')
        else:
            self.trends = CompositeNode()
            self.trends.configure({'parent':self, 'name':'trends'})
            self.trends.start()
        # start trending for saved domains
        for domain,freq in self._pdo.trends.items():
            try:
                start_node = as_node(domain)
               # self.configure_trend_in_switches( start_node,freq )
                start_node.new_trend(freq)
            except:
                self.delete_trend_configuration(domain)
        return
Exemplo n.º 15
0
 def start( self ):
     CompositeNode.start( self )
     if not self.isStarted:
         self.isStarted = 1
         self._schedule(.15)
     else:
         raise EAlreadyRunning
Exemplo n.º 16
0
 def start(self):
     CompositeNode.start(self)
     self._set_zip_file()
     tread = Thread(name="AutoDiscovery",target=self.kick_start_discovery)
     scheduler.after(2, tread.start)
     self.ad = AutoDiscovery()
     self.ad.configure({"parent":self,"name":"AutoDiscover"})
Exemplo n.º 17
0
 def start(self):
     self.device_map = {}
     if self.debug: print 'Start modbus serial slave node'
     CompositeNode.start(self)
     self.subnet.start()
     if self.debug: print 'modbus serial slave node started'
     return
Exemplo n.º 18
0
 def start(self):
     if self.readwrite != 1: #since not readonly
         if not(self.parameter == 'L' or self.parameter == 'K' or self.parameter == 'M'):
             self.set = self._set  #read only parameters
     self.line_handler = self.parent.line_handler
     self.unit_number = self.parent.unit_number
     CompositeNode.start(self)
Exemplo n.º 19
0
 def start(self):
     CompositeNode.start(self)
     self.local_context = {}
     try:
         self.compiled_statement = compile(self.statement, '', 'eval')
         #examine each variable and decide what to do with it
         for variable in self.variables:
             name = variable['vn']
             definition = variable['node_reference']
             if self.local_context.has_key(name):
                 raise EInvalidValue('variable', name,
                                     'Variable name duplicated')
             exceptions = []
             conversions = self._conversions[:]
             while conversions:
                 conversion = conversions.pop(0)
                 try:
                     reference = conversion(definition)
                     break
                 except Exception, e:
                     exceptions.append(e)
             else:
                 self.local_context = {}
                 raise EInvalidValue('variable', name,
                                     ('Conversions %s Gave Errors %s.' %
                                      (self._conversions, exceptions)))
             self.local_context[name] = reference
         self.started = 1
Exemplo n.º 20
0
 def start(self):
     if self.readwrite != 1:  #since not readonly
         if not (self.parameter == 'L' or self.parameter == 'K'
                 or self.parameter == 'M'):
             self.set = self._set  #read only parameters
     self.line_handler = self.parent.line_handler
     self.unit_number = self.parent.unit_number
     CompositeNode.start(self)
Exemplo n.º 21
0
 def start(self):
     CompositeNode.start(self)
     self.bcu_list = []
     self.running = 1
     if self._who_is_thread is None: #kick off who_is thread
         network._who_are_devices()
         self._who_is_thread = _WhoIsThread(self)
         self._who_is_thread.start()
Exemplo n.º 22
0
 def start(self):
     if self._running == 0:
         self._running = 1
         for event_class in self._event_handlers.keys():
             self.parent.event_subscribe(self, event_class)
     else:
         msglog.log("broadway", msglog.types.WARN, "Instance of %s is already running." % str(self.__class__))
     CompositeNode.start(self)
Exemplo n.º 23
0
 def start(self): #bind to the correct driver functions based on the node name
     self.driver = self.parent.parent.driver
     self._mutex = self.parent.parent._mutex
     if self.name in self.driver.eeprom_parameters.keys():
         addr, length, rw, type, _range, desc = self.driver.eeprom_parameters[self.name]
         if rw:
             self.set = self._set
     CompositeNode.start(self)
Exemplo n.º 24
0
 def start(self):
     if not self.isDaemon():
         self.setDaemon(True)
     if self.messaging is None:
         self.messaging = as_node("/services/messaging")
     self.commands = self.messaging.get_destination("/node-commands")
     CompositeNode.start(self)
     Thread.start(self)
Exemplo n.º 25
0
 def start(self):
     if not self.isDaemon():
         self.setDaemon(True)
     if self.messaging is None:
         self.messaging = as_node("/services/messaging")
     self.commands = self.messaging.get_destination("/node-commands")
     CompositeNode.start(self)
     Thread.start(self)
Exemplo n.º 26
0
 def start(self):
     if self._running == 0:
         self._running = 1
         for event_class in self._event_handlers.keys():
             self.parent.event_subscribe(self, event_class)
     else:
         msglog.log('broadway', msglog.types.WARN, \
                    'Instance of %s is already running.' % str(self.__class__))
     CompositeNode.start(self)
Exemplo n.º 27
0
 def start(self):
     if not self.isDaemon():
         self.setDaemon(True)
     if self.messaging is None:
         self.messaging = as_node("/services/messaging")
     self.responses = self.messaging.get_destination("/responses")
     self.deadletters = self.messaging.get_destination("/dead-letters")
     CompositeNode.start(self)
     Thread.start(self)
Exemplo n.º 28
0
 def start(self):
     if not self.running:
         if not self.parent.is_open():
             self.parent.open()
         self.csafe = CSafe(self.parent) #port
         if feu_poll_thread:
             #global feu_poll_thread
             feu_poll_thread.add_feu(self)   #register with the status loop
     CompositeNode.start(self)
     self.running = 1
Exemplo n.º 29
0
 def start(self):
     self.port = self.parent.parent.port #pass it down
     self.line_handler = self.parent.parent.line_handler
     if cat_lib.is_writeable(self.PID):
         self.set = self._set
     pid = cat_lib._hex_str_2_int(self.PID)
     if cat_lib.PID.has_key(pid):
         self.description, self.security_level, self.conversion, self.propattrs = cat_lib.PID[pid]
     CompositeNode.start(self)
     return
Exemplo n.º 30
0
 def start(self):
     if not self._threadpool:
         port_name = self.parent.name
         self._threadpool = thread_pool.ThreadPool(
             1, name='Sensorsoft ThreadPool-' + port_name)
     if not self._port or not self._port.is_open():
         self._port = self.parent
         self._port.open()
         self._port.drain()
     CompositeNode.start(self)
Exemplo n.º 31
0
 def start(self):
     # all known relevant calculators are presently imported to this name space from xconvert.
     # NameError raised if there's issue.
     self.group_id = _get_group_id(self)
     self.addr = _get_addr(self)
     self.timeout = _get_timeout(self)
     self.cache = _get_cache(self)
     self.ion = self.parent
     self.translator = ConversionFactory(self.cls_name, self)
     CompositeNode.start(self)
Exemplo n.º 32
0
 def start(self):
     # all known relevant calculators are presently imported to this name space from xconvert. 
     # NameError raised if there's issue. 
     self.group_id = _get_group_id(self)
     self.addr = _get_addr(self)
     self.timeout = _get_timeout(self)
     self.cache = _get_cache(self)
     self.ion = self.parent
     self.translator = ConversionFactory(self.cls_name, self)
     CompositeNode.start(self)
Exemplo n.º 33
0
 def start(self):
     if self.is_remote():
         e_prop = EntityProp(name='Entity',
                             type='Entity',
                             label='',
                             description='',
                             url=self.display,
                             entity=as_entity_url(self))
         self._properties = [e_prop.as_dict()]
     CompositeNode.start(self)
Exemplo n.º 34
0
 def start(self):
     self.device_map = {}
     if self.debug: print 'Start modbus tcpip server node'
     if self.parent.__class__ == IP:  #then must be an 'internet_protocol' node (1.3)
         self.ip = self.parent.address
     else:  #must be directly under the eth# port (1.4)
         self.ip = ip_address(self.parent.name)
     self.server = TcpServerConnection(self.ip, self.udp_port, self)
     CompositeNode.start(self)
     if self.debug: print 'modbus tcpip server node started'
Exemplo n.º 35
0
 def start(self):
     self.device_map = {}
     if self.debug: print 'Start modbus tcpip server node'
     if self.parent.__class__ == IP: #then must be an 'internet_protocol' node (1.3)
         self.ip = self.parent.address
     else: #must be directly under the eth# port (1.4)
         self.ip = ip_address(self.parent.name)
     self.server = TcpServerConnection(self.ip, self.udp_port, self)
     CompositeNode.start(self)
     if self.debug: print 'modbus tcpip server node started'
Exemplo n.º 36
0
 def start(self):
     self.line_handler = self.parent.parent.line_handler #pass it down
     self.parameters = {}
     CompositeNode.start(self)  #do children first so they register with us
     #collect list of children and create broadcast list
     self.broadcast_list = self.parameters.keys()  #set the order of the request
     index = 0 #assign an index number to each parameter and cross index
     for p in self.broadcast_list:
         self.parameters[p] = index
         index += 1
     return
Exemplo n.º 37
0
 def start(self):
     if not self._threadpool:
         port_name = self.parent.name
         self._threadpool = thread_pool.ThreadPool(
             1, name='Sensorsoft ThreadPool-'+port_name
             )
     if not self._port or not self._port.is_open():
         self._port = self.parent
         self._port.open()
         self._port.drain()
     CompositeNode.start(self)
Exemplo n.º 38
0
 def start(self):
     self.port = self.parent.parent.port  #pass it down
     self.line_handler = self.parent.parent.line_handler
     if cat_lib.is_writeable(self.PID):
         self.set = self._set
     pid = cat_lib._hex_str_2_int(self.PID)
     if cat_lib.PID.has_key(pid):
         self.description, self.security_level, self.conversion, self.propattrs = cat_lib.PID[
             pid]
     CompositeNode.start(self)
     return
Exemplo n.º 39
0
 def start(self):
     if self.interval_calculation == self.CHARACTER_TIME:
         self.__silent_interval = (self.silent_interval_characters *
                                   self.port.seconds_per_character())
     elif self.interval_calculation == self.ABSOLUTE:
         self.__silent_interval = self.silent_interval_absolute
     else:
         raise EInvalidValue('interval_calculation',
                             self.interval_calculation)
     CompositeNode.start(self)
     return
Exemplo n.º 40
0
 def start(self):
     if self.interval_calculation == self.CHARACTER_TIME:
         self.__silent_interval = (self.silent_interval_characters *
                                   self.port.seconds_per_character())
     elif self.interval_calculation == self.ABSOLUTE:
         self.__silent_interval = self.silent_interval_absolute
     else:
         raise EInvalidValue('interval_calculation',
                             self.interval_calculation)
     CompositeNode.start(self)
     return
Exemplo n.º 41
0
    def start(self):
        if debug: print 'starting tcs line driver'
        if not self.running:
            self.running = 1
            self.line_handler = line_handler.TCSLineHandler(self.parent)
            if self.discover != 'never':
                self.discover_children()
            CompositeNode.start(self)

        else:
            raise EAlreadyRunning
Exemplo n.º 42
0
 def start(self):
     CompositeNode.start(self)
     for i in range(0,4):
         label = getattr(self,'label%s' % (i+1,))
         point = getattr(self,'point%s' % (i+1,))
         if point:
             node = as_node(point)
         else:
             node = None
         self._channels.append(_Channel(i,self.id,label,node))
     return
Exemplo n.º 43
0
    def start(self):
        if debug:
            print "starting tcs line driver"
        if not self.running:
            self.running = 1
            self.line_handler = line_handler.TCSLineHandler(self.parent)
            if self.discover != "never":
                self.discover_children()
            CompositeNode.start(self)

        else:
            raise EAlreadyRunning
Exemplo n.º 44
0
 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
Exemplo n.º 45
0
 def start(self):
     self.line_handler = self.parent.parent.line_handler  #pass it down
     self.parameters = {}
     CompositeNode.start(self)  #do children first so they register with us
     #collect list of children and create broadcast list
     self.broadcast_list = self.parameters.keys(
     )  #set the order of the request
     index = 0  #assign an index number to each parameter and cross index
     for p in self.broadcast_list:
         self.parameters[p] = index
         index += 1
     return
Exemplo n.º 46
0
 def start(self):
     if self.running == 0:
         if debug:
             print 'start called on server.BacnetDevice'
             print self.children_names()
         CompositeNode.start(self)
         self.running = 1
         self.properties = self.get_child('BACnet_Device_properties')
         self.obj_type = self.properties.obj_type
         self.instance = self.properties.instance
         self.lib_device = create_server_device(self, self.parent.network)
         self._obj_lookup_cache = {}
Exemplo n.º 47
0
 def start(self):
     if self._running != 0:
         raise EAlreadyRunning('MemoryNode')
     meminfo_dict = self._get_data_dict()
     # Create child _PropAttr nodes:
     for record_name in meminfo_dict.keys():
         record = _Record()
         cd = {'parent': self, 'name': record_name}
         record.configure(cd)
     CompositeNode.start(self)  # starts newly-created kids, too
     self._running = 1
     return
Exemplo n.º 48
0
 def start(self):
     if self._running != 0:
         raise EAlreadyRunning('MemoryNode')
     meminfo_dict = self._get_data_dict()
     # Create child _PropAttr nodes:
     for record_name in meminfo_dict.keys():
         record = _Record()
         cd = {'parent':self,'name':record_name}
         record.configure(cd)
     CompositeNode.start(self) # starts newly-created kids, too
     self._running = 1
     return
Exemplo n.º 49
0
 def start(self):
     if self.is_remote():
         e_prop = EntityProp(
             name='Entity', 
             type='Entity', 
             label='',
             description='',
             url=self.display,
             entity=as_entity_url(self)
         )
         self._properties = [e_prop.as_dict()]
     CompositeNode.start(self)
Exemplo n.º 50
0
    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
Exemplo n.º 51
0
 def start(self):
     if self.running == 0:
         if debug:
             print 'start called on BacnetDevice:', self.name
             print self._get_children()
         self._create_device_properties() #if required
         CompositeNode.start(self)
         self.running = 1
         if self.instance is None: # autodiscovered this device node, so autodiscover properties child:
             self.properties = self.get_child('BACnet_Device_properties')
             #self.obj_type = self.properties.obj_type
             self.instance = self.properties.instance
         self.cache.device = self.instance
Exemplo n.º 52
0
    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
Exemplo n.º 53
0
 def start(self):
     msglog.log('USAP', INFO, 'Device: In start().')
     if self.enabled:
         self.conn = gdconn.FrameworkSerialPortWrapper(self.parent)
         self.lh = gdlh.SimpleLineHandler(self.conn)
     # Find the relevant protocol child objects ahead of time to
     # be more efficient.
     self.req_startCode_obj = self.request_obj.findChildByName("startCode")
     self.req_vData_obj = self.request_obj.findChildByName("vData")
     self.req_crc_obj = self.request_obj.findChildByName("crc")
     #
     self.resp_startCode_obj = self.response_obj.findChildByName(
         "startCode")
     self.resp_vData_obj = self.response_obj.findChildByName("vData")
     self.resp_crc_obj = self.response_obj.findChildByName("crc")
     CompositeNode.start(self)
Exemplo n.º 54
0
 def start(self):
     if self.running == 0:
         self.cache = self.parent.cache
         self.obj_type = self._object_type
         if self.instance is None:  #must not have been autodiscovered, get it from xml
             self.instance = self.get_child('object_identifier').instance
         self.object_identifier = BACnetObjectIdentifier(
             self.obj_type, self.instance)
         if (85 in self._required_properties) or \
            (property.PresentValue in self._required_properties):
             self.get = self._get
         CompositeNode.start(self)
         self.running = 1  #placed here to prevent CompositeNode.start from autodiscovering
         if self.is_proxy():
             ProxyAbstractClass.start(
                 self)  #take over the get and set methods
Exemplo n.º 55
0
 def start(self):
     if not self.isStarted:
         self.set('running')
         self.isStarted = 1
         self._schedule()
     else:
         raise EAlreadyRunning
     return CompositeNode.start(self)