コード例 #1
0
    def __init__(self, device_address, max_apdu_len, seg_supported, obj_id,
                 obj_name, ven_id, **kwargs):
        super(BACnetProxyAgent, self).__init__(**kwargs)

        self.async_call = AsyncCall()
        self.setup_device(device_address, max_apdu_len, seg_supported, obj_id,
                          obj_name, ven_id)
コード例 #2
0
    def __init__(self,
                 device_address,
                 max_apdu_len,
                 seg_supported,
                 obj_id,
                 obj_name,
                 ven_id,
                 max_per_request,
                 request_check_interval=100,
                 **kwargs):
        super(BACnetProxyAgent, self).__init__(**kwargs)

        async_call = AsyncCall()

        # IO callback
        class IOCB:
            def __init__(self, request):
                # requests and responses
                self.ioRequest = request
                self.ioResult = AsyncResult()

            def set(self, value):
                async_call.send(None, self.ioResult.set, value)

            def set_exception(self, exception):
                async_call.send(None, self.ioResult.set_exception, exception)

        self.iocb_class = IOCB
        self._max_per_request = max_per_request

        self.setup_device(async_call, device_address, max_apdu_len,
                          seg_supported, obj_id, obj_name, ven_id,
                          request_check_interval)
コード例 #3
0
ファイル: rough.py プロジェクト: miraabid/bemoss
 def __init__(self, device_address, max_apdu_len, seg_supported, obj_id,
              obj_name, ven_id, **kwargs):
     #super(BACnetProxyAgent, self).__init__(**kwargs)
     self.simple = False
     self.async_call = AsyncCall()
     self.setup_device(device_address, max_apdu_len, seg_supported, obj_id,
                       obj_name, ven_id)
     pointmap = {"Energy": ["analogInput", 2, "presentValue"]}
     Address = "2001:2"
     result = self.read_properties(Address, pointmap)
コード例 #4
0
        def __init__(self, **kwargs):
            super(BACnetProxyAgent, self).__init__(identity=vip_identity,
                                                   **kwargs)

            self.async_call = AsyncCall()
            self.setup_device(config["device_address"],
                              max_apdu_len=config.get("max_apdu_length", 1024),
                              seg_supported=config.get(
                                  "segmentation_supported", "segmentedBoth"),
                              obj_id=config.get("object_id", 599),
                              obj_name=config.get("object_name",
                                                  "Volttron BACnet driver"),
                              ven_id=config.get("vendor_id", 15))
コード例 #5
0
        def setup(self, sender, **kwargs):
            if not os.environ.get('VOLTTRON_HOME', None):
                raise ValueError('VOLTTRON_HOME environment must be set!')

            db_path = os.path.join(os.environ.get('VOLTTRON_HOME'),
                                   'data/volttron.central')
            db_dir = os.path.dirname(db_path)
            try:
                os.makedirs(db_dir)
            except OSError as exc:
                if exc.errno != errno.EEXIST or not os.path.isdir(db_dir):
                    raise
            self.persistence_path = db_path

            # Returns None if there has been no registration of any platforms.
            registered = self._load('registry')
            if registered:
                self.registry.unpackage(registered)

            self.async_caller = AsyncCall()
コード例 #6
0
 def setup(self):
     print "Setting up"
     self.async_caller = AsyncCall()