コード例 #1
0
ファイル: batch_manager.py プロジェクト: ed-aicradle/monotone
 def get(self, manager, **keywords):
     if debug: print 'Start of Batch:%s' % (self.properties)
     now = time.time()
     self.last_get_time = now
     callback = None
     if keywords.has_key('callback'):
         keywords['callback'].callback(self.rpm_callback)
     try:
         #print 'Calling read property multiple'   
         rars = rpm(self.device, self.properties, self.timeout, **keywords)
         if isinstance(rars, Callback):
             return rars #if we are in callback mode
         #print 'RPM TIME:%s' % (time.time()-now,)
     except BACnetException, e:
         if len(self.ids) == 1: #single propety rpms throw exceptions at this level
             return {self.ids[0]: e} #simply return exception as the result
         self.total_rpm_error_counter += 1
         if self.total_rpm_error_counter > 0: #catch run away thrashing
             for id in self.ids:
                 nr = self.map[id]
                 nr.set_batch_manager(None) #none of these points can batch
             raise EBadBatch('bacnet', self, 'error threshold exceeded')
         #at this point this is a multiple property read that failed
         msglog.exception()
         if debug: print 'rpm failed, trying rp', str(self.properties)
         answer = {}
         for id in self.ids:
             nr = self.map[id]
             result = nr.get_result()
             answer[id] = result
             if isinstance(result.value.value, BACnetError):
                 nr.set_batch_manager(None) #turn off rpm for the offending property
                 msglog.log('bacnet', nr.as_node_url(), 'cannot get multiple')
                 if debug: msglog.exception()
         raise EBadBatch('bacnet', self, 'rpm failed')
コード例 #2
0
from mpx.lib.node import as_node
t=as_node('/services/network/BACnet/internetwork1/Services/TSWS')
t=as_node('/services/network/BACnet/internetwork/Configuration')

t.change_hardware_settings('IP','eth0','1','47802')
t.change_hardware_settings('IP','eth0','1','47821')
t.change_hardware_settings('IP','eth0','1','47428')


from mpx.lib.node import as_node
ai1 = as_node('interfaces/eth0/BACnetIP/2/AnalogInput_01')
aipv=as_node('interfaces/eth0/BACnetIP/2/AnalogInput_01/present_value')
ain=as_node('interfaces/eth0/BACnetIP/2/AnalogInput_01/object_name')
from mpx.lib.bacnet._bacnet import read_property_multiple_g3 as rpm
rpm(aipv.bacnet_property.device, [aipv.bacnet_property.property_tuple, ain.bacnet_property.property_tuple])

from mpx.service.subscription_manager._manager import SUBSCRIPTION_MANAGER as SM
from mpx.lib.node import as_node
ai1 = as_node('interfaces/eth0/BACnetIP/2/AnalogInput_01')
aipv=as_node('interfaces/eth0/BACnetIP/2/AnalogInput_01/present_value')
ain=as_node('interfaces/eth0/BACnetIP/2/AnalogInput_01/object_name')
sid = SM.create_polled({1:aipv, 2:ain})

from mpx.service.subscription_manager._manager import SUBSCRIPTION_MANAGER as SM
from mpx.lib.node import as_node
aipv=as_node('services/network/BACnet/internetwork1/Devices/1/8/1/77')
ain =as_node('services/network/BACnet/internetwork1/Devices/1/8/1/79')
pcm1=as_node('services/network/BACnet/internetwork1/Devices/1/151/1/85')
pcm2=as_node('services/network/BACnet/internetwork1/Devices/1/151/1/79')
up = as_node('services/network/BACnet/internetwork1/Devices/1/151/1/10209')