def __init__(self, ufc, node, iomap, cmd_pend_size = 2, timeout = 1):
self.ports = {
'cmd_async': {'dir': 'in', 'type': 'topic', 'callback': self.cmd_async_cb},
'cmd_sync': {'dir': 'in', 'type': 'service', 'callback': self.cmd_sync_cb},
'report': {'dir': 'out', 'type': 'topic'},
'status': {'dir': 'out', 'type': 'topic'}, # report lost, etc...
'service': {'dir': 'in', 'type': 'service', 'callback': self.service_cb},
'packet_in': {'dir': 'in', 'type': 'topic', 'callback': self.packet_in_cb},
'packet_out': {'dir': 'out', 'type': 'topic'},
}
self.node = node
self.logger = logging.getLogger('uf.' + node.replace('/', '.'))
self.cmd_pend = {}
self.cmd_pend_size = cmd_pend_size
self.cmd_pend_c = threading.Condition()
self.timeout = timeout
self.cnt_lock = _thread.allocate_lock()
self.cnt = 1 # no reply if cnt == 0, FIXME
ufc.node_init(node, self.ports, iomap)
评论列表
文章目录