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 __init__(self): self.ob = ipaaca.OutputBuffer('PingOut') self.iu = ipaaca.IU('ping') self.iu.payload = {'data': '0'} self.ob.add(self.iu) self.ob.register_handler(self.handle_iu_event) self.counter = 0 self.last_time = time.time()
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, send_frequency): self.ob = ipaaca.OutputBuffer('PowerOut') self.iu = ipaaca.IU('spam') self.data_prefix = 'A' * 1024 self.iu.payload = {'data': '0'} self.ob.add(self.iu) self.counter = 0 self.frequency = send_frequency self.delay = 1.0 / send_frequency
def logger_set_log_filename(filename, existing=None): global OUTPUT_BUFFER if existing is not None and not existing in LOG_MODES: raise Exception('Invalid log mode {mode} given. ' 'Valid options are {options}.'.format( mode=existing, options=', '.join(LOG_MODES))) with LOGGER_LOCK: if OUTPUT_BUFFER is None: OUTPUT_BUFFER = ipaaca.OutputBuffer('LogSender') msg = ipaaca.Message('logcontrol') msg.payload = {'cmd': 'open_log_file', 'filename': filename} if existing is not None: msg.payload['existing'] = existing OUTPUT_BUFFER.add(msg)
def LOG_IPAACA(lvl, text, now=0.0, fn='???', thread='???'): global OUTPUT_BUFFER uid = str(uuid.uuid4())[0:8] with LOGGER_LOCK: if OUTPUT_BUFFER is None: OUTPUT_BUFFER = ipaaca.OutputBuffer('LogSender') msg = ipaaca.Message('log') msg.payload = { 'module': MODULE_NAME, 'function': fn, 'level': lvl, 'time': ' %.3f' % now, 'thread': thread, 'uuid': uid, 'text': text, } try: OUTPUT_BUFFER.add(msg) except Exception, e: LOG_ERROR('Caught an exception while logging via ipaaca. ' + ' str(e); ' + traceback.format_exc())
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.ob = ipaaca.OutputBuffer('WordSenderOut') self.ob.register_handler(self.outbuffer_handle_iu_event) self.window = None
# Excellence Initiative. import time import logging import ipaaca 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
# The development of this software was supported by the # Excellence Cluster EXC 277 Cognitive Interaction Technology. # The Excellence Cluster EXC 277 is a grant of the Deutsche # Forschungsgemeinschaft (DFG) in the context of the German # Excellence Initiative. import time import ipaaca def remote_change_dumper(iu, event_type, local): if local: print 'remote side ' + event_type + ': ' + str(iu) ob = ipaaca.OutputBuffer('CoolInformerOut') ob.register_handler(remote_change_dumper) iu_top = ipaaca.IU() iu_top.payload = {'data': 'raw'} ob.add(iu_top) iu = ipaaca.IU() iu.payload = {'a': 'a1'} ob.add(iu) iu.payload = {'a': 'a2', 'b': 'b1'} #OK del (iu.payload['b']) iu.payload['c'] = 'c1' iu.payload['a'] = 'a3' iu.add_links('sameold', iu_top.uid)