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,