19 sys.path.insert(1,
".")
45 self.
_observed = [
False for i
in range(OpenRTM.STATUS_KIND_NUM._v)]
88 def init(self, rtobj, profile):
89 if not self.
_observer.setObject(profile.service):
111 if not self.
_observer._ptr()._is_equivalent(profile.service):
113 if not tmp.setObject(profile.service):
116 self.
_observer.setObject(profile.service)
166 self.
_observer._ptr().update_status(statuskind, msg)
180 kinds = [
"COMPONENT_PROFILE",
186 if kind._v < OpenRTM.STATUS_KIND_NUM._v:
187 return kinds[kind._v]
200 if not prop.getProperty(
"observed_status"):
201 prop.setProperty(
"observed_status",
"ALL")
203 observed_ = [s.strip()
for s
in prop.getProperty(
"observed_status").
split(
",")]
204 flags_ = [
False for i
in range(OpenRTM.STATUS_KIND_NUM._v) ]
206 for i
in range(len(observed_)):
207 observed_[i] = observed_[i].upper()
208 if observed_[i] ==
"COMPONENT_PROFILE":
209 flags_[OpenRTM.COMPONENT_PROFILE._v] =
True 210 elif observed_[i] ==
"RTC_STATUS":
211 flags_[OpenRTM.RTC_STATUS._v] =
True 212 elif observed_[i] ==
"EC_STATUS":
213 flags_[OpenRTM.EC_STATUS._v] =
True 214 elif observed_[i] ==
"PORT_PROFILE":
215 flags_[OpenRTM.PORT_PROFILE._v] =
True 216 elif observed_[i] ==
"CONFIGURATION":
217 flags_[OpenRTM.CONFIGURATION._v] =
True 218 elif observed_[i] ==
"ALL":
219 for j
in range(OpenRTM.STATUS_KIND_NUM._v):
225 OpenRTM.COMPONENT_PROFILE._v,
231 OpenRTM.RTC_STATUS._v,
237 OpenRTM.EC_STATUS._v,
243 OpenRTM.PORT_PROFILE._v,
249 OpenRTM.CONFIGURATION._v,
267 if (
not pre[pre_idx])
and next:
270 elif pre[pre_idx]
and (
not next):
302 if OpenRTM_aist.toBool(prop.getProperty(
"heartbeat.enable"),
"YES",
"NO",
False):
303 interval_ = prop.getProperty(
"heartbeat.interval")
307 tmp_ = float(interval_)
312 ComponentObserverConsumer.heartbeat,
356 self.
_rtobj.addPostComponentActionListener(postclistener_.POST_ON_ACTIVATED,
358 if not self.
_compstat.deactivatedListener:
360 self.
_rtobj.addPostComponentActionListener(postclistener_.POST_ON_DEACTIVATED,
365 self.
_rtobj.addPostComponentActionListener(postclistener_.POST_ON_RESET,
370 self.
_rtobj.addPostComponentActionListener(postclistener_.POST_ON_ABORTING,
375 self.
_rtobj.addPostComponentActionListener(postclistener_.POST_ON_FINALIZE,
392 self.
_rtobj.removePostComponentActionListener(postclistener_.POST_ON_ACTIVATED,
397 self.
_rtobj.removePostComponentActionListener(postclistener_.POST_ON_DEACTIVATED,
399 self.
_compstat.deactivatedListener =
None 402 self.
_rtobj.removePostComponentActionListener(postclistener_.POST_ON_RESET,
407 self.
_rtobj.removePostComponentActionListener(postclistener_.POST_ON_ABORTING,
412 self.
_rtobj.removePostComponentActionListener(postclistener_.POST_ON_FINALIZE,
434 self.
_rtobj.addPortActionListener(plistener_.ADD_PORT,
439 self.
_rtobj.addPortActionListener(plistener_.REMOVE_PORT,
445 self.
_rtobj.addPortConnectRetListener(pclistener_.ON_CONNECTED,
450 self.
_rtobj.addPortConnectRetListener(pclistener_.ON_DISCONNECTED,
466 self.
_rtobj.removePortActionListener(plistener_.ADD_PORT,
471 self.
_rtobj.removePortActionListener(plistener_.REMOVE_PORT,
477 self.
_rtobj.removePortConnectRetListener(pclistener_.ON_CONNECTED,
482 self.
_rtobj.removePortConnectRetListener(pclistener_.ON_DISCONNECTED,
504 self.
_rtobj.addExecutionContextActionListener(ectype_.EC_ATTACHED,
509 self.
_rtobj.addExecutionContextActionListener(ectype_.EC_DETACHED,
515 self.
_rtobj.addPostComponentActionListener(pcaltype_.POST_ON_RATE_CHANGED,
520 self.
_rtobj.addPostComponentActionListener(pcaltype_.POST_ON_STARTUP,
525 self.
_rtobj.addPostComponentActionListener(pcaltype_.POST_ON_SHUTDOWN,
542 self.
_rtobj.removeExecutionContextActionListener(ectype_.EC_ATTACHED,
546 self.
_rtobj.removeExecutionContextActionListener(ectype_.EC_ATTACHED,
551 self.
_rtobj.removePostComponentActionListener(pcaltype_.POST_ON_RATE_CHANGED,
555 self.
_rtobj.removePostComponentActionListener(pcaltype_.POST_ON_STARTUP,
559 self.
_rtobj.removePostComponentActionListener(pcaltype_.POST_ON_SHUTDOWN,
606 self.
_rtobj.addConfigurationParamListener(confprmlistenertype_.ON_UPDATE_CONFIG_PARAM,
611 self.
_rtobj.addConfigurationSetListener(confsetlistenertype_.ON_SET_CONFIG_SET,
615 self.
_rtobj.addConfigurationSetListener(confsetlistenertype_.ON_ADD_CONFIG_SET,
620 self.
_rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_UPDATE_CONFIG_SET,
624 self.
_rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_REMOVE_CONFIG_SET,
627 self.
_rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_ACTIVATE_CONFIG_SET,
643 self.
_rtobj.removeConfigurationParamListener(confprmlistenertype_.ON_UPDATE_CONFIG_PARAM,
645 self.
_configMsg.updateConfigParamListener =
None 649 self.
_rtobj.removeConfigurationSetListener(confsetlistenertype_.ON_SET_CONFIG_SET,
654 self.
_rtobj.removeConfigurationSetListener(confsetlistenertype_.ON_ADD_CONFIG_SET,
660 self.
_rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_UPDATE_CONFIG_SET,
662 self.
_configMsg.updateConfigSetListener =
None 665 self.
_rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_REMOVE_CONFIG_SET,
667 self.
_configMsg.removeConfigSetListener =
None 670 self.
_rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_ACTIVATE_CONFIG_SET,
672 self.
_configMsg.activateConfigSetListener =
None 704 if ret == RTC.RTC_OK:
773 self.
onGeneric(
"REMOVE:", str(pprof.name))
779 if ret == RTC.RTC_OK:
786 if ret == RTC.RTC_OK:
818 msg_ = _msg + str(ec_id)
834 if ret == RTC.RTC_OK:
840 if ret == RTC.RTC_OK:
846 if ret == RTC.RTC_OK:
879 msg_ =
"UPDATE_CONFIG_PARAM: " 880 msg_ += configsetname
882 msg_ += configparamname
888 msg_ =
"SET_CONFIG_SET: " 889 msg_ += config_set.getName()
895 msg_ =
"ADD_CONFIG_SET: " 896 msg_ += config_set.getName()
902 msg_ =
"UPDATE_CONFIG_SET: " 903 msg_ += config_set_name
909 msg_ =
"REMOVE_CONFIG_SET: " 910 msg_ += config_set_name
916 msg_ =
"ACTIVATE_CONFIG_SET: " 917 msg_ += config_set_name
922 factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
923 factory.addFactory(OpenRTM.ComponentObserver._NP_RepositoryId,
924 ComponentObserverConsumer,
def onDetached(self, ec_id)
def activateConfigSet(self, config_set_name)
The types of ConnectorDataListener.
def updateConfigSet(self, config_set_name)
def finalize(self)
Finalizationvirtual void finalize();.
The types of ExecutionContextActionListener.
def reinit(self, profile)
Re-initializationvirtual bool reinit(const SDOPackage::ServiceProfile& profile);. ...
The types of PortActionListener.
def unsetPortProfileListeners(self)
Unsetting port profile listenervoid unsetPortProfileListeners();.
PostComponentActionListener class.
def split(input, delimiter)
Split string by delimiter.
def onConnect(self, portname, pprof, ret)
ExecutionContextActionListener.
def onActivated(self, ec_id, ret)
def removeConfigSet(self, config_set_name)
def setConfigSet(self, config_set)
def updateStatus(self, statuskind, msg)
Calling remote objectinline void updateStatus(OpenRTM::StatusKind statuskind, const char* msg) ...
def copyToProperties(prop, nvlist)
Copy to Proeprties from NVList.
def ComponentObserverConsumerInit(mgr=None)
def toString(self, kind)
Converting kind to stringinline const char* toString(OpenRTM::StatusKind kind)
The Properties class represents a persistent set of properties.
def onGeneric(self, _msg, portname)
def onRateChanged(self, ec_id, ret)
def onDisconnect(self, portname, pprof, ret)
def init(self, rtobj, profile)
Initializationvirtual bool init(RTObject_impl& rtobj, const SDOPackage::ServiceProfile& profile);...
def onAborting(self, ec_id, ret)
def onReset(self, ec_id, ret)
activateConfigSetListener
def setListeners(self, prop)
Connectiong listeners to RTObjectvoid setListeners(coil::Properties& prop);.
The types of ConfigurationSetNameListener.
def switchListeners(self, next, pre, pre_idx, setfunc, unsetfunc)
Switching listeners connecting/disconnectingvoid switchListeners(bool& next, bool& pre...
def unsetConfigurationListeners(self)
Unsetting Configurationlistenervoid unsetConfigurationListeners();.
The types of ConnectorDataListener.
def setHeartbeat(self, prop)
Setting heartbeatvoid setHeartbeat(coil::Properties& prop);.
def onFinalize(self, ec_id, ret)
updateConfigParamListener
def heartbeat(self)
Sending a heartbeart signal to observervoid heartbeat();.
def setComponentStatusListeners(self)
Setting RTC status listenersvoid setComponentStatusListeners();.
def setComponentProfileListeners(self)
Setting ComponentProfile listenervoid setComponentProfileListeners();.
def unsetComponentStatusListeners(self)
Unsetting RTC status listenersvoid unsetComponentStatusListeners();.
def unsetComponentProfileListeners(self)
Unsetting ComponentProfile listenervoid unsetComponentProfileListeners();.
The types of PortConnectRetListenerType.
def setPortProfileListeners(self)
Setting port profile listenervoid setPortProfileListeners();.
def onGeneric(self, _msg, ec_id)
def __init__(self)
ctor of ComponentObserverConsumer
def unsetExecutionContextListeners(self)
Unsetting EC status listenervoid unsetExecutionContextListeners();.
def onDeactivated(self, ec_id, ret)
def onRemovePort(self, pprof)
def onAttached(self, ec_id)
def updateConfigParam(self, configsetname, configparamname)
def onShutdown(self, ec_id, ret)
def setConfigurationListeners(self)
Setting Configuration listenervoid setConfigurationListeners();.
def setExecutionContextListeners(self)
Setting EC status listenervoid setExecutionContextListeners();.
def onAddPort(self, pprof)
The types of ConfigurationSetListener.
def onGeneric(self, msgprefix, ec_id, ret)
def unsetHeartbeat(self)
Unsetting heartbeatvoid unsetHeartbeat();.
def getProfile(self)
getting ServiceProfilevirtual const SDOPackage::ServiceProfile& getProfile() const; ...
def onStartup(self, ec_id, ret)
def addConfigSet(self, config_set)