sdo.py
Go to the documentation of this file.
1 # -*- Python -*-
2 # -*- coding: utf-8 -*-
3 
4 '''rtctree
5 
6 Copyright (C) 2009-2014
7  Geoffrey Biggs
8  RT-Synthesis Research Group
9  Intelligent Systems Research Institute,
10  National Institute of Advanced Industrial Science and Technology (AIST),
11  Japan
12  All rights reserved.
13 Licensed under the Eclipse Public License -v 1.0 (EPL)
14 http://www.opensource.org/licenses/eclipse-1.0.txt
15 
16 SDO client objects.
17 
18 '''
19 
20 
21 import OpenRTM__POA
22 import RTC
23 import SDOPackage
24 
25 
26 class RTCObserver(OpenRTM__POA.ComponentObserver):
27  def __init__(self, target):
28  self._tgt = target
29 
30  def update_status(self, kind, hint):
31  kind = str(kind)
32  if kind == 'COMPONENT_PROFILE':
33  self._tgt._profile_update([x.strip() for x in hint.split(',')])
34  elif kind == 'RTC_STATUS':
35  status, ec_handle = hint.split(':')
36  if status == 'INACTIVE':
37  status = self._tgt.INACTIVE
38  elif status == 'ACTIVE':
39  status = self._tgt.ACTIVE
40  elif status == 'ERROR':
41  status = self._tgt.ERROR
42  self._tgt._set_state_in_ec(int(ec_handle), status)
43  elif kind == 'EC_STATUS':
44  event, ec_handle = hint.split(':')
45  if event == 'ATTACHED':
46  event = self._tgt.EC_ATTACHED
47  elif event == 'DETACHED':
48  event = self._tgt.EC_DETACHED
49  elif event == 'RATE_CHANGED':
50  event = self._tgt.EC_RATE_CHANGED
51  elif event == 'STARTUP':
52  event = self._tgt.EC_STARTUP
53  elif event == 'SHUTDOWN':
54  event = self._tgt.EC_SHUTDOWN
55  self._tgt._ec_event(int(ec_handle), event)
56  elif kind == 'PORT_PROFILE':
57  event, port_name = hint.split(':')
58  if event == 'ADD':
59  event = self._tgt.PORT_ADD
60  elif event == 'REMOVE':
61  event = self._tgt.PORT_REMOVE
62  elif event == 'CONNECT':
63  event = self._tgt.PORT_CONNECT
64  elif event == 'DISCONNECT':
65  event = self._tgt.PORT_DISCONNECT
66  self._tgt._port_event(port_name, event)
67  elif kind == 'CONFIGURATION':
68  event, arg = hint.split(':')
69  if event == 'UPDATE_CONFIGSET':
70  event = self._tgt.CFG_UPDATE_SET
71  elif event == 'UPDATE_PARAMETER':
72  event = self._tgt.CFG_UPDATE_PARAM
73  elif event == 'SET_CONFIG_SET':
74  event = self._tgt.CFG_SET_SET
75  elif event == 'ADD_CONFIG_SET':
76  event = self._tgt.CFG_ADD_SET
77  elif event == 'REMOVE_CONFIG_SET':
78  event = self._tgt.CFG_REMOVE_SET
79  elif event == 'ACTIVATE_CONFIG_SET':
80  event = self._tgt.CFG_ACTIVATE_SET
81  self._tgt._config_event(arg, event)
82  elif kind == 'HEARTBEAT':
83  self._tgt._heartbeat()
84 
85 
86 class RTCLogger(OpenRTM__POA.Logger):
87  def __init__(self, target, callback):
88  self._tgt = target
89  self._cb = callback
90 
91  def publish(self, record):
92  ts = record.time.sec + record.time.nsec / 1e9
93  self._cb(self._tgt.name, ts, loggername, level, message)
94 
95 
96 # vim: tw=79
97 
def update_status(self, kind, hint)
Definition: sdo.py:30
def __init__(self, target, callback)
Definition: sdo.py:87
def __init__(self, target)
Definition: sdo.py:27
def publish(self, record)
Definition: sdo.py:91


rtctree
Author(s): Geoffrey Biggs
autogenerated on Fri Jun 7 2019 21:56:24