Skip to content
Snippets Groups Projects
Commit 900ddedb authored by Ramin Yaghoubzadeh's avatar Ramin Yaghoubzadeh
Browse files

The old test cases work again -> refactoring of Payload seems to be complete.

We added links, tests pending.
parent 678c5ef9
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import time
import ipaaca
def remote_change_dumper(iu, event_type, local):
if local:
print 'remote side '+event_type+': '+str(iu)
ob = ipaaca.OutputBuffer('CoolComponent')
ob.register_handler(remote_change_dumper)
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'
time.sleep(1)
iu.commit()
while True:
time.sleep(1)
This diff is collapsed.
#!/usr/bin/env python
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
ib = ipaaca.InputBuffer('CoolReceiver', ['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 % 3 == 1:
iu.payload['a'] = 'REMOTELY SET '+str(counter)
elif counter % 3 == 2:
del iu.payload['a']
else:
iu.payload = {'a': 'reset'}
except ipaaca.IUUpdateFailedError, e:
ipaaca.logger.warning("Payload update failed (IU changed in the mean time)")
time.sleep(0.1)
exit(0)
[transport.spread]
host = localhost # default type is string
port = 4803 # types can be specified in angle brackets
enabled = true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment