def setUp(self): self.ib = ipaaca.InputBuffer('TestIn', ['sensorcategory', 'decisioncategory']) self.ob = ipaaca.OutputBuffer('TestOut') self.sensor_iu = ipaaca.IU('sensorcategory') self.sensor_iu.payload = {'data': 'sensordata'} self.ob.add(self.sensor_iu)
def setUp(self): self.ib = ipaaca.InputBuffer('TestIn', ['sensorcategory']) self.ib.register_handler(handle_iu_event) self.ob = ipaaca.OutputBuffer('TestOut') self.sensor_iu = ipaaca.IU('sensorcategory') self.sensor_iu.payload = {'data': 'sensordata'} time.sleep(0.1) self.ob.add(self.sensor_iu) time.sleep(0.1)
def __init__(self, filename, log_mode='append'): self.ib = ipaaca.InputBuffer('Logger', ['log', 'logcontrol']) self.ib.register_handler(self._logger_handle_iu_event) self.logfile = None self.log_mode = log_mode self.open_logfile(filename) if self.logfile is None: print('Logging to console only ...') print('Press Ctrl-C at any time to terminate the logger.')
def setUp(self): self.ib = ipaaca.InputBuffer('TestIn', ['sensorcategory']) self.ob = ipaaca.OutputBuffer('TestOut') self.iu = ipaaca.IU('sensorcategory')
def __init__(self): self.ob = ipaaca.OutputBuffer('TextSenderOut') self.ob.register_handler(self.outbuffer_handle_iu_event) self.ib = ipaaca.InputBuffer('TextSenderIn', [RECV_CATEGORY]) self.ib.register_handler(self.inbuffer_handle_iu_event)
def __init__(self): self.count = 0 self.last_time = 0 self.ib = ipaaca.InputBuffer('PowerIn', ['spam']) self.ib.register_handler(self.handle_iu_event)
def __init__(self): self.ib = ipaaca.InputBuffer('TestIn', ['testcategory']) self.ib.register_handler(self.handle_iu_event)
iu_to_write = None def my_update_handler(iu, event_type, local): global iu_to_write print(event_type + ': ' + str(iu)) iu_to_write = iu ob = ipaaca.OutputBuffer('CoolListenerOut') my_iu = ipaaca.IU() my_iu.payload = {'some': 'info'} ob.add(my_iu) ib = ipaaca.InputBuffer('CoolListenerIn', ['undef']) ib.register_handler(my_update_handler) counter = 0 #time.sleep(5) while True: if iu_to_write is not None: try: counter += 1 iu = iu_to_write #if counter == 1: # iu.payload['a'] = 'remote' if counter == 10: iu.add_links('special', my_iu.uid) elif counter % 3 == 1: iu.payload['a'] = 'REMOTELY SET ' + str(counter)