def init(self, buffer_id, chunk_size, interval):
     self.chunk_size = chunk_size
     self.buffer_id = buffer_id
     self.interval = interval
     self.mem_buffer = []
     self.received = 0
     self.sent = 0
     self.timer = calvinsys.open(self, "sys.timer.repeating", period=10)
     self.fifo = calvinsys.open(self, 'buffer.persistent', buffer_id=self.buffer_id, reporting=10)
Пример #2
0
 def open_file(self, filename):
     obj = calvinsys.open(self, "io.filesize", filename=filename)
     if calvinsys.can_read(obj):
         self.filelen = calvinsys.read(obj)
         calvinsys.close(obj)
         self.file = calvinsys.open(self,
                                    "io.filereader",
                                    filename=filename)
     if self.file is None:
         self.file_not_found = True
Пример #3
0
 def init(self, buffer_id, chunk_size, interval):
     self.chunk_size = chunk_size
     self.buffer_id = buffer_id
     self.interval = interval
     self.mem_buffer = []
     self.received = 0
     self.sent = 0
     self.timer = calvinsys.open(self, "sys.timer.repeating", period=10)
     self.fifo = calvinsys.open(self,
                                'buffer.persistent',
                                buffer_id=self.buffer_id,
                                reporting=10)
Пример #4
0
 def init(self, tx_id, group_cmd, channel, unit):
     self.databits = (tx_id & 0x03FFFFFF) << 6
     self.databits |= ((group_cmd & 0x1) << 5)
     self.databits |= ((channel & 0x3) << 2)
     self.databits |= (unit & 0x3)
     self.databits &= 0xFFFFFFEF
     self.tx = calvinsys.open(self, "io.tx433MHz")
Пример #5
0
 def init(self, url, headers, params, auth):
     self.command = calvinsys.open(self,
                                   "http.get",
                                   url=url,
                                   headers=headers or None,
                                   auth=auth or None,
                                   params=params or None)
Пример #6
0
 def init(self, tx_id, group_cmd, channel, unit):
     self.databits = (tx_id & 0x03FFFFFF) << 6
     self.databits |= ((group_cmd & 0x1) << 5)
     self.databits |= ((channel & 0x3) << 2)
     self.databits |= (unit & 0x3)
     self.databits &= 0xFFFFFFEF
     self.tx = calvinsys.open(self, "io.tx433MHz")
Пример #7
0
 def setup(self):
     fname = new_filename(self.basename, self.counter, self.suffix)
     self.counter += 1
     self.file = calvinsys.open(self,
                                "io.filewriter",
                                filename=fname,
                                mode="w")
Пример #8
0
 def init(self, hostname, port, settings):
     if not settings:
         settings = {}
     self.mqtt = calvinsys.open(self,
                                "mqtt.publish",
                                hostname=hostname,
                                port=port,
                                **settings)
Пример #9
0
 def init(self, hostname, port, topics, settings):
     if not settings:
         settings = {}
     self.mqtt = calvinsys.open(self,
                                "mqtt.subscribe",
                                topics=topics,
                                hostname=hostname,
                                port=port,
                                **settings)
Пример #10
0
 def step_no_periodic(self):
     calvinsys.read(self.timer)  # Ack
     if self.count == self.start + 2:
         # now continue with periodic timer events
         calvinsys.close(self.timer)
         self.timer = calvinsys.open(self, 'sys.timer.repeating')
     calvinsys.can_write(self.timer)  # Dummy read
     calvinsys.write(self.timer, self.sleep)
     self.count += 1
     return (self.count - 1, )
Пример #11
0
 def step_no_periodic(self):
     calvinsys.read(self.timer) # Ack
     if self.count == self.start + 2:
         # now continue with periodic timer events
         calvinsys.close(self.timer)
         self.timer = calvinsys.open(self, 'sys.timer.repeating')
     calvinsys.can_write(self.timer) # Dummy read
     calvinsys.write(self.timer, self.sleep)
     self.count += 1
     return (self.count - 1, )
Пример #12
0
 def start(self):
     try:
         self.server = calvinsys.open(self,
             'network.tcpserver',
             host=self.host,
             port=self.port,
             mode=self.mode,
             delimiter=self.delimiter,
             max_length=self.max_length)
     except Exception as e:
         _log.exception(e)
Пример #13
0
 def start(self):
     try:
         self.server = calvinsys.open(self,
                                      'network.tcpserver',
                                      host=self.host,
                                      port=self.port,
                                      mode=self.mode,
                                      delimiter=self.delimiter,
                                      max_length=self.max_length)
     except Exception as e:
         _log.exception(e)
Пример #14
0
 def setup(self):
     self._service = calvinsys.open(self, "weather.local")
     calvinsys.write(self._service, None)
Пример #15
0
 def init(self, delay):
     self.delay = delay
     self.timer = calvinsys.open(self, "sys.timer.repeating")
     self.started = False
Пример #16
0
 def setup(self):
     self._timer = calvinsys.open(self, "sys.timer.repeating")
 def init(self, attribute):
     self.attribute = attribute
     self.registry = calvinsys.open(self, "sys.attribute.indexed")
     # select attribute to read
     calvinsys.write(self.registry, self.attribute)
Пример #18
0
 def setup(self):
     self._twit = calvinsys.open(self, "web.twitter.post")
Пример #19
0
 def init(self):
     self.cmd = calvinsys.open(self, "http.get")
     self.response = None
Пример #20
0
 def init(self, sleep=0.1, start=1, steps=sys.maxint):
     self.start = start
     self.count = start
     self.sleep = sleep
     self.steps = steps + start
     self.timer = calvinsys.open(self, 'sys.timer.once', period=self.sleep)
Пример #21
0
 def init(self):
     self.cmd = calvinsys.open(self, "http.get")
     self.response = None
Пример #22
0
 def init(self, tags=None):
     if isinstance(tags, basestring):
         tags = [tags]
     self.source = calvinsys.open(self, "data.source", tags=tags)
Пример #23
0
 def setup(self):
     self._service = calvinsys.open(self, "weather")
Пример #24
0
 def setup(self):
     _log.info("setup")
     self._distance = calvinsys.open(self, "io.distance")
     self._timer = calvinsys.open(self, "sys.timer.repeating")
     calvinsys.write(self._timer, 1.0/self.frequency)
 def setup(self):
     self._service = calvinsys.open(self, "weather")
Пример #26
0
 def setup(self):
     self._sink = calvinsys.open(self, "image.render")
Пример #27
0
 def setup(self):
     self._pin = calvinsys.open(self, "io.digitalin")
Пример #28
0
 def setup(self):
     self.level = calvinsys.open(self, "io.soilmoisture")
Пример #29
0
 def init(self):
     self.light = calvinsys.open(self, "io.light")
Пример #30
0
 def init(self, period):
     self.period = period
     self.temperature = calvinsys.open(self, "io.temperature")
     self.timer = calvinsys.open(self, "sys.timer.once", period=period)
Пример #31
0
 def init(self, url, headers, params, auth):
     self.command = calvinsys.open(self, "http.post", url=url, headers=headers or None, params=params or None, auth=auth or None)
Пример #32
0
 def init(self):
     self.stdout = calvinsys.open(self, "io.stdout")
Пример #33
0
 def setup(self):
     self._pin = calvinsys.open(self, "io.digitalout")
Пример #34
0
 def setup(self):
     self._object_counter = calvinsys.open(self, "image.facefinding")
Пример #35
0
 def new_timer(self):
     timer = calvinsys.open(self, "sys.timer.once")
     rng = calvinlib.use("math.random")
     delay = rng.random_integer(lower=0, upper=2)
     calvinsys.write(timer, delay)
     return timer
Пример #36
0
 def connect(self):
     self.cc = calvinsys.open(self, "network.socketclient", address=self.address, port=self.port, connection_type="TCP")
Пример #37
0
 def setup(self):
     self._object_counter = calvinsys.open(self, "image.objectdetection")
 def setup(self):
     self.listener = calvinsys.open(self, "network.udplistener", host=self.host, port=self.port)
Пример #39
0
 def new_timer(self):
     timer = calvinsys.open(self, "sys.timer.once")
     rng = calvinlib.use("math.random")
     delay = rng.random_integer(lower=0, upper=2)
     calvinsys.write(timer, delay)
     return timer
Пример #40
0
 def listen(self):
     self.listener = calvinsys.open(self,
                                    "network.udplistener",
                                    host=self.host,
                                    port=self.port)
Пример #41
0
 def setup(self):
     self.relhum = calvinsys.open(self, 'io.humidity')
Пример #42
0
 def setup(self):
     fname = new_filename(self.basename, self.counter, self.suffix)
     self.counter += 1
     self.file = calvinsys.open(self, "io.filewriter", filename=fname, mode="w")
Пример #43
0
 def init(self):
     self.stdout = calvinsys.open(self, "io.stdout")
 def setup(self):
     self.relhum = calvinsys.open(self, 'io.humidity')
Пример #45
0
 def init(self):
     self.time = calvinlib.use('time')
     self.rfid = calvinsys.open(self, "io.rfid")
Пример #46
0
 def setup(self):
     self.switch = calvinsys.open(self, "io.switch")
Пример #47
0
 def init(self, attribute):
     self.attribute = attribute
     self.registry = calvinsys.open(self, "sys.attribute.public")
     # select attribute to read
     calvinsys.write(self.registry, self.attribute)
Пример #48
0
 def setup(self):
     self.sensor = calvinsys.open(self, "io.hallswitch")
Пример #49
0
 def setup(self):
     self.buzzer = calvinsys.open(self, "io.buzzer")
     if self.volume and calvinsys.can_write(self.buzzer):
         calvinsys.write(self.buzzer, self.volume)
Пример #50
0
 def init(self):
     self.log = calvinsys.open(self, "log.info")
Пример #51
0
 def init(self, delay):
     self.delay = delay
     self.timer = calvinsys.open(self, "sys.timer.repeating")
     self.started = False
Пример #52
0
 def init(self):
     self.registry = calvinsys.open(self, "sys.attribute.indexed")
     # select attribute to read
     calvinsys.write(self.registry, "node_name.name")
 def init(self):
     self.pressure= calvinsys.open(self, "io.pressure")
Пример #54
0
 def setup(self):
     self._object_counter = calvinsys.open(self, "image.objectdetection")
Пример #55
0
 def init(self, hostname, port, settings):
     if not settings:
         settings = {}
     self.mqtt = calvinsys.open(self, "mqtt.publish", hostname=hostname, port=port, **settings)
Пример #56
0
 def init(self, period):
     self.period = period
     self.temperature = calvinsys.open(self, "io.temperature")
     self.timer = calvinsys.open(self, "sys.timer.once", period=0)
Пример #57
0
 def setup(self):
     self._temperature = calvinsys.open(self, "io.temperature")
     self.use("calvinsys.events.timer", shorthand="timer")
     self._timer = self['timer'].once(0)
Пример #58
0
 def setup(self):
     self.sensor = calvinsys.open(self, "io.lightbreaker")
Пример #59
0
 def setup(self):
     self.file = calvinsys.open(self, "io.stdin")