[openrtm-commit:00217] r416 - in branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist: . test
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 7月 9日 (土) 00:22:07 JST
Author: kurihara
Date: 2011-07-09 00:22:06 +0900 (Sat, 09 Jul 2011)
New Revision: 416
Added:
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceProviderBase.py
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/BasicDataType.idl
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/ComponentObserver.idl
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/DataPort.idl
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/MySdoServiceConsumer.py
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/OpenRTM.idl
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/RTC.idl
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/SDOPackage.idl
Modified:
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/ConfigAdmin.py
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/test_RTObject.py
Log:
SDO service provider framework is implemented. Some SDO service
related interfaces are added/delete/updated. refs #2033 #2040 #2049 #2050
Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/ConfigAdmin.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/ConfigAdmin.py 2011-06-16 07:03:44 UTC (rev 415)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/ConfigAdmin.py 2011-07-08 15:22:06 UTC (rev 416)
@@ -346,15 +346,8 @@
self._params = []
self._emptyconf = OpenRTM_aist.Properties()
self._newConfig = []
+ self._listeners = OpenRTM_aist.ConfigurationListeners()
- self._updateCb = None
- self._updateParamCb = None
- self._setConfigSetCb = None
- self._addConfigSetCb = None
- self._removeConfigSetCb = None
- self._activateSetCb = None
-
-
##
# @if jp
#
@@ -1031,6 +1024,10 @@
return True
+ #------------------------------------------------------------
+ # obsolete functions
+ #
+
##
# @if jp
#
@@ -1052,7 +1049,9 @@
#
# void setOnUpdate(OnUpdateCallback* cb);
def setOnUpdate(self, cb):
- self._updateCb = cb
+ print "setOnUpdate function is obsolete."
+ print "Use addConfigurationSetNameListener instead."
+ self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET].addListener(cb, False)
return
@@ -1077,7 +1076,9 @@
#
# void setOnUpdateParam(OnUpdateParamCallback* cb);
def setOnUpdateParam(self, cb):
- self._updateParamCb = cb
+ print "setOnUpdateParam function is obsolete."
+ print "Use addConfigurationParamListener instead."
+ self._listeners.configparam_[OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM].addListener(cb, False)
return
@@ -1102,7 +1103,9 @@
#
# void setOnSetConfigurationSet(OnSetConfigurationSetCallback* cb);
def setOnSetConfigurationSet(self, cb):
- self._setConfigSetCb = cb
+ print "setOnSetConfigurationSet function is obsolete."
+ print "Use addConfigurationSetListener instead."
+ self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET].addListener(cb, False)
return
@@ -1127,7 +1130,9 @@
#
# void setOnAddConfigurationSet(OnAddConfigurationAddCallback* cb);
def setOnAddConfigurationSet(self, cb):
- self._addConfigSetCb = cb
+ print "setOnAddConfigurationSet function is obsolete."
+ print "Use addConfigurationSetListener instead."
+ self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET].addListener(cb, False)
return
@@ -1152,7 +1157,9 @@
#
# void setOnRemoveConfigurationSet(OnRemoveConfigurationSetCallback* cb);
def setOnRemoveConfigurationSet(self, cb):
- self._removeConfigSetCb = cb
+ print "setOnRemoveConfigurationSet function is obsolete."
+ print "Use addConfigurationSetNameListener instead."
+ self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_REMOVE_CONFIG_SET].addListener(cb, False)
return
@@ -1177,13 +1184,231 @@
#
# void setOnActivateSet(OnActivateSetCallback* cb);
def setOnActivateSet(self, cb):
- self._activateSetCb = cb
+ print "setOnActivateSet function is obsolete."
+ print "Use addConfigurationSetNameListener instead."
+ self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_ACTIVATE_CONFIG_SET].addListener(cb, False)
return
+ #
+ # end of obsolete functions
+ #------------------------------------------------------------
##
# @if jp
#
+ # @brief ConfigurationParamListener を追加する
+ #
+ # update(const char* config_set, const char* config_param) が呼ばれた際に
+ # コールされるリスナ ConfigurationParamListener を追加する。
+ # type には現在のところ ON_UPDATE_CONFIG_PARAM のみが入る。
+ #
+ # @param type ConfigurationParamListenerType型の値。
+ # ON_UPDATE_CONFIG_PARAM がある。
+ #
+ # @param listener ConfigurationParamListener 型のリスナオブジェクト。
+ # @param autoclean リスナオブジェクトを自動で削除するかどうかのフラグ
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationParamListener
+ #
+ # This function adds a listener object which is called when
+ # update(const char* config_set, const char* config_param) is
+ # called. In the type argument, currently only
+ # ON_UPDATE_CONFIG_PARAM is allowed.
+ #
+ # @param type ConfigurationParamListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ #
+ # @param listener ConfigurationParamListener listener object.
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # void addConfigurationParamListener(ConfigurationParamListenerType type,
+ # ConfigurationParamListener* listener,
+ # bool autoclean = true);
+ def addConfigurationParamListener(self, type, listener, autoclean = True):
+ self._listeners.configparam_[type].addListener(listener, autoclean)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationParamListener を削除する
+ #
+ # addConfigurationParamListener で追加されたリスナオブジェクトを削除する。
+ #
+ # @param type ConfigurationParamListenerType型の値。
+ # ON_UPDATE_CONFIG_PARAM がある。
+ # @param listener 与えたリスナオブジェクトへのポインタ
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationParamListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationParamListener() function.
+ #
+ # @param type ConfigurationParamListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ # @param listener a pointer to ConfigurationParamListener listener object.
+ #
+ # @endif
+ #
+ # void removeConfigurationParamListener(ConfigurationParamListenerType type,
+ # ConfigurationParamListener* listener);
+ def removeConfigurationParamListener(self, type, listener):
+ self._listeners.configparam_[type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetListener を追加する
+ #
+ # ConfigurationSet が更新されたときなどに呼ばれるリスナ
+ # ConfigurationSetListener を追加する。設定可能なイベントは以下の
+ # 2種類がある。
+ #
+ # - ON_SET_CONFIG_SET: setConfigurationSetValues() で
+ # ConfigurationSet に値が設定された場合。
+ # - ON_ADD_CONFIG_SET: addConfigurationSet() で新しい
+ # ConfigurationSet が追加された場合。
+ #
+ # @param type ConfigurationSetListenerType型の値。
+ # @param listener ConfigurationSetListener 型のリスナオブジェクト。
+ # @param autoclean リスナオブジェクトを自動で削除するかどうかのフラグ
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationSetListener
+ #
+ # This function add a listener object which is called when
+ # ConfigurationSet is updated. Available events are the followings.
+ #
+ # @param type ConfigurationSetListenerType value
+ # @param listener ConfigurationSetListener listener object.
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # void addConfigurationSetListener(ConfigurationSetListenerType type,
+ # ConfigurationSetListener* listener,
+ # bool autoclean = true);
+ def addConfigurationSetListener(self, type, listener, autoclean = True):
+ self._listeners.configset_[type].addListener(listener, autoclean)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetListener を削除する
+ #
+ # addConfigurationSetListener で追加されたリスナオブジェクトを削除する。
+ #
+ # @param type ConfigurationSetListenerType型の値。
+ # @param listener 与えたリスナオブジェクトへのポインタ
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationSetListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationSetListener() function.
+ #
+ # @param type ConfigurationSetListenerType value
+ # @param listener a pointer to ConfigurationSetListener listener object.
+ #
+ # @endif
+ # void removeConfigurationSetListener(ConfigurationSetListenerType type,
+ # ConfigurationSetListener* listener);
+ def removeConfigurationSetListener(self, type, listener):
+ self._listeners.configset_[type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetNameListener を追加する
+ #
+ # ConfigurationSetName が更新されたときなどに呼ばれるリスナ
+ # ConfigurationSetNameListener を追加する。設定可能なイベントは以下の
+ # 3種類がある。
+ #
+ # - ON_UPDATE_CONFIG_SET: ある ConfigurationSet がアップデートされた
+ # - ON_REMOVE_CONFIG_SET: ある ConfigurationSet が削除された
+ # - ON_ACTIVATE_CONFIG_SET: ある ConfigurationSet がアクティブ化された
+ #
+ # @param type ConfigurationSetNameListenerType型の値。
+ # @param listener ConfigurationSetNameListener 型のリスナオブジェクト。
+ # @param autoclean リスナオブジェクトを自動で削除するかどうかのフラグ
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationSetNameListener
+ #
+ # This function add a listener object which is called when
+ # ConfigurationSetName is updated. Available events are the followings.
+ #
+ # - ON_UPDATE_CONFIG_SET: A ConfigurationSet has been updated.
+ # - ON_REMOVE_CONFIG_SET: A ConfigurationSet has been deleted.
+ # - ON_ACTIVATE_CONFIG_SET: A ConfigurationSet has been activated.
+ #
+ # @param type ConfigurationSetNameListenerType value
+ # @param listener ConfigurationSetNameListener listener object.
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ # void
+ # addConfigurationSetNameListener(ConfigurationSetNameListenerType type,
+ # ConfigurationSetNameListener* listener,
+ # bool autoclean = true);
+ def addConfigurationSetNameListener(self, type, listener, autoclean = True):
+ self._listeners.configsetname_[type].addListener(listener, autoclean)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetNameListener を削除する
+ #
+ # addConfigurationSetNameListener で追加されたリスナオブジェクトを
+ # 削除する。
+ #
+ # @param type ConfigurationSetNameListenerType型の値。
+ # ON_UPDATE_CONFIG_PARAM がある。
+ # @param listener 与えたリスナオブジェクトへのポインタ
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationSetNameListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationSetNameListener() function.
+ #
+ # @param type ConfigurationSetNameListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ # @param listener a pointer to ConfigurationSetNameListener
+ # listener object.
+ #
+ # @endif
+ # void
+ # removeConfigurationSetNameListener(ConfigurationSetNameListenerType type,
+ # ConfigurationSetNameListener* listener);
+ def removeConfigurationSetNameListener(self, type, listener):
+ self._listeners.configsetname_[type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ #
# @brief コンフィギュレーションパラメータの更新(ID指定)時にコールされる
#
# 設定されてるコールバックオブジェクトを呼び出す。
@@ -1204,8 +1429,7 @@
#
# void onUpdate(const char* config_set);
def onUpdate(self, config_set):
- if self._updateCb is not None:
- self._updateCb(config_set)
+ self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET].notify(config_set)
return
@@ -1234,8 +1458,8 @@
#
# void onUpdateParam(const char* config_set, const char* config_param);
def onUpdateParam(self, config_set, config_param):
- if self._updateParamCb is not None:
- self._updateParamCb(config_set, config_param)
+ self._listeners.configparam_[OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM].notify(config_set,
+ config_param)
return
@@ -1262,8 +1486,7 @@
#
# void onSetConfigurationSet(const coil::Properties& config_set);
def onSetConfigurationSet(self, config_set):
- if self._setConfigSetCb is not None:
- self._setConfigSetCb(config_set)
+ self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET].notify(config_set)
return
@@ -1290,8 +1513,7 @@
#
# void onAddConfigurationSet(const coil::Properties& config_set);
def onAddConfigurationSet(self, config_set):
- if self._addConfigSetCb is not None:
- self._addConfigSetCb(config_set)
+ self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET].notify(config_set)
return
@@ -1318,8 +1540,7 @@
#
# void onRemoveConfigurationSet(const char* config_id);
def onRemoveConfigurationSet(self, config_id):
- if self._removeConfigSetCb is not None:
- self._removeConfigSetCb(config_id)
+ self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_REMOVE_CONFIG_SET].notify(config_id)
return
@@ -1346,8 +1567,7 @@
#
# void onActivateSet(const char* config_id);
def onActivateSet(self, config_id):
- if self._activateSetCb is not None:
- self._activateSetCb(config_id)
+ self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_ACTIVATE_CONFIG_SET].notify(config_id)
return
Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2011-06-16 07:03:44 UTC (rev 415)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2011-07-08 15:22:06 UTC (rev 416)
@@ -109,8 +109,9 @@
self._properties = OpenRTM_aist.Properties(defaults_str=default_conf)
self._configsets = OpenRTM_aist.ConfigAdmin(self._properties.getNode("conf"))
self._profile = RTC.ComponentProfile("","","","","","",[],None,[])
-
- self._SdoConfigImpl = OpenRTM_aist.Configuration_impl(self._configsets)
+
+ self._sdoservice = OpenRTM_aist.SdoServiceAdmin(self)
+ self._SdoConfigImpl = OpenRTM_aist.Configuration_impl(self._configsets,self._sdoservice)
self._SdoConfig = self._SdoConfigImpl.getObjRef()
self._execContexts = []
self._objref = self._this()
@@ -128,6 +129,8 @@
self._writeAllCompletion = False
self._inports = []
self._outports = []
+ self._actionListeners = OpenRTM_aist.ComponentActionListeners()
+ self._portconnListeners = OpenRTM_aist.PortConnectListeners()
return
@@ -1001,12 +1004,15 @@
for i in range(len(self._ecOther)):
if CORBA.is_nil(self._ecOther[i]):
self._ecOther[i] = ecs
- return i + ECOTHER_OFFSET
+ ec_id = i + ECOTHER_OFFSET
+ self.onAttachExecutionContext(ec_id)
+ return ec_id
# no space in the list, push back ec to the last.
OpenRTM_aist.CORBA_SeqUtil.push_back(self._ecOther,ecs)
-
- return long(len(self._ecOther) - 1 + ECOTHER_OFFSET)
+ ec_id = long(len(self._ecOther) - 1 + ECOTHER_OFFSET)
+ self.onAttachExecutionContext(ec_id)
+ return ec_id
# UniqueId bindContext(ExecutionContext_ptr exec_context);
@@ -1026,6 +1032,7 @@
for i in range(len(self._ecMine)):
if CORBA.is_nil(self._ecMine[i]):
self._ecMine[i] = ecs
+ self.onAttachExecutionContext(i)
return i
#return i + ECOTHER_OFFSET
@@ -1098,7 +1105,7 @@
#OpenRTM_aist.CORBA_SeqUtil.erase(self._ecOther, index)
self._ecOther[index] = RTC.ExecutionContextService._nil
-
+ self.onDetachExecutionContext(ec_id)
return RTC.RTC_OK
@@ -1130,19 +1137,21 @@
self._rtcout.RTC_TRACE("on_initialize()")
ret = RTC.RTC_ERROR
try:
+ self.preOnInitialize(0)
ret = self.onInitialize()
- active_set = self._properties.getProperty("configuration.active_config",
- "default")
-
- if self._configsets.haveConfig(active_set):
- self._configsets.update(active_set)
- else:
- self._configsets.update("default")
-
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
+ ret = RTC.RTC_ERROR
+ active_set = self._properties.getProperty("configuration.active_config",
+ "default")
+
+ if self._configsets.haveConfig(active_set):
+ self._configsets.update(active_set)
+ else:
+ self._configsets.update("default")
+
+ self.postOnInitialize(0,ret)
return ret
@@ -1174,11 +1183,12 @@
self._rtcout.RTC_TRACE("on_finalize()")
ret = RTC.RTC_ERROR
try:
+ self.preOnFinalize(0)
ret = self.onFinalize()
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnFinalize(0, ret)
return ret
@@ -1213,11 +1223,12 @@
self._rtcout.RTC_TRACE("on_startup(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnStartup(ec_id)
ret = self.onStartup(ec_id)
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnStartup(ec_id, ret)
return ret
@@ -1252,11 +1263,12 @@
self._rtcout.RTC_TRACE("on_shutdown(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnShutdown(ec_id)
ret = self.onShutdown(ec_id)
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnShutdown(ec_id, ret)
return ret
@@ -1289,13 +1301,14 @@
self._rtcout.RTC_TRACE("on_activated(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnActivated(ec_id)
self._configsets.update()
ret = self.onActivated(ec_id)
self._portAdmin.activatePorts()
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnActivated(ec_id, ret)
return ret
@@ -1328,12 +1341,13 @@
self._rtcout.RTC_TRACE("on_deactivated(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnDeactivated(ec_id)
self._portAdmin.deactivatePorts()
ret = self.onDeactivated(ec_id)
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnDeactivated(ec_id, ret)
return ret
@@ -1372,11 +1386,12 @@
self._rtcout.RTC_TRACE("on_aborting(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnAborting(ec_id)
ret = self.onAborting(ec_id)
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnAborting(ec_id, ret)
return ret
@@ -1426,12 +1441,13 @@
self._rtcout.RTC_TRACE("on_error(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnError(ec_id)
ret = self.onError(ec_id)
- self._configsets.update()
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self._configsets.update()
+ self.postOnError(ec_id, ret)
return ret
@@ -1471,11 +1487,12 @@
self._rtcout.RTC_TRACE("on_reset(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnReset(ec_id)
ret = self.onReset(ec_id)
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnReset(ec_id, ret)
return ret
@@ -1523,6 +1540,7 @@
self._rtcout.RTC_TRACE("on_execute(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnExecute(ec_id)
if self._readAll:
self.readAll()
@@ -1533,8 +1551,8 @@
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnExecute(ec_id, ret)
return ret
@@ -1582,12 +1600,13 @@
self._rtcout.RTC_TRACE("on_state_update(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnStateUpdate(ec_id)
ret = self.onStateUpdate(ec_id)
self._configsets.update()
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnStateUpdate(ec_id, ret)
return ret
@@ -1629,11 +1648,12 @@
self._rtcout.RTC_TRACE("on_rate_changed(%d)", ec_id)
ret = RTC.RTC_ERROR
try:
+ self.preOnRateChanged(ec_id)
ret = self.onRateChanged(ec_id)
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- return RTC.RTC_ERROR
-
+ ret = RTC.RTC_ERROR
+ self.postOnRateChanged(ec_id, ret)
return ret
@@ -2659,7 +2679,7 @@
elif isinstance(port, RTC._objref_PortService):
self._rtcout.RTC_TRACE("addPort(PortService)")
-
+ self.onAddPort(port.getPortProfile())
return self._portAdmin.addPort(port)
@@ -2864,6 +2884,7 @@
# new interface. since 1.0.0-RELEASE
def removePort(self, port):
self._rtcout.RTC_TRACE("removePort()")
+ self.onRemovePort(port.getPortProfile())
return self._portAdmin.removePort(port)
@@ -2889,6 +2910,424 @@
##
# @if jp
#
+ # @brief [local interface] 実行コンテキストを取得する
+ #
+ # get_context() と同じ機能のローカル版。違いはない。
+ # この関数は以下の関数内で呼ばれることを前提としている。
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # この関数の引数はこれらの関数の引数 UniquieID exec_handle でなけ
+ # ればならない。
+ #
+ # @param ec_id 上記関数の第1引数 exec_handle を渡す必要がある。
+ #
+ # @else
+ #
+ # @brief [local interface] Getting current execution context
+ #
+ # This function is the local version of get_context(). completely
+ # same as get_context() function. This function is assumed to be
+ # called from the following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ #
+ # @endif
+ #
+ # ExecutionContext_ptr getExecutionContext(RTC::UniqueId ec_id);
+ def getExecutionContext(self, ec_id):
+ return self.get_context(ec_id)
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] 実行コンテキストの実行レートを取得する
+ #
+ # 現在実行中の実行コンテキストの実行レートを取得する。実行コンテキ
+ # ストのKindがPERIODIC以外の場合の動作は未定義である。この関数は以
+ # 下の関数内で呼ばれることを前提としている。
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # この関数の引数はこれらの関数の引数 UniquieID exec_handle でなけ
+ # ればならない。
+ #
+ # @param ec_id 上記関数の第1引数 exec_handle を渡す必要がある。
+ #
+ # @else
+ #
+ # @brief [local interface] Getting current context' execution rate
+ #
+ # This function returns current execution rate in this
+ # context. If this context's kind is not PERIODC, behavior is not
+ # defined. This function is assumed to be called from the
+ # following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ #
+ # @endif
+ #
+ # double getExecutionRate(RTC::UniqueId ec_id);
+ def getExecutionRate(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return 0.0
+
+ return ec.get_rate()
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] 実行コンテキストの実行レートを設定する
+ #
+ # 現在実行中の実行コンテキストの実行レートを設定する。実行コンテキ
+ # ストのKindがPERIODIC以外の場合の動作は未定義である。この関数は以
+ # 下の関数内で呼ばれることを前提としている。
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # この関数の引数はこれらの関数の引数 UniquieID exec_handle でなけ
+ # ればならない。
+ #
+ # @param ec_id 上記関数の第1引数 exec_handle を渡す必要がある。
+ # @param rate 実行レートを [Hz] で与える
+ #
+ # @else
+ #
+ # @brief [local interface] Setting current context' execution rate
+ #
+ # This function sets a execution rate in the context. If this
+ # context's kind is not PERIODC, behavior is not defined. This
+ # function is assumed to be called from the following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @param rate Execution rate in [Hz].
+ #
+ # @endif
+ #
+ # ReturnCode_t setExecutionRate(RTC::UniqueId ec_id, double rate);
+ def setExecutionRate(self, ec_id, rate):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ ec.set_rate(rate)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] 実行コンテキストの所有権を調べる
+ #
+ # 現在実行中の実行コンテキストの所有権を調べる。この関数は以下の関
+ # 数内で呼ばれることを前提としている。
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # この関数の引数はこれらの関数の引数 UniquieID exec_handle でなけ
+ # ればならない。
+ #
+ # @param ec_id 上記関数の第1引数 exec_handle を渡す必要がある。
+ # @return true: 自身の実行コンテキスト、false: 他の実行コンテキスト
+ #
+ # @else
+ #
+ # @brief [local interface] Checking if the current context is own context
+ #
+ # This function checks if the current context is own execution
+ # context. This function is assumed to be called from the
+ # following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return true: Own context, false: other's context
+ #
+ # @endif
+ #
+ # bool isOwnExecutionContext(RTC::UniqueId ec_id);
+ def isOwnExecutionContext(self, ec_id):
+ global ECOTHER_OFFSET
+ if ec_id < ECOTHER_OFFSET:
+ return True
+ return False
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] 状態を Inactive に遷移させる
+ #
+ # 状態を Active から Inactive に遷移させる。この関数は以下の関
+ # 数内で呼ばれることを前提としている。
+ #
+ # - onActivated()
+ # - onExecute()
+ # - onStateUpdate()
+ #
+ # この関数の引数は上記の関数の引数 UniquieID exec_handle でなけ
+ # ればならない。
+ #
+ # @param ec_id 上記関数の第1引数 exec_handle を渡す必要がある。
+ # @return リターンコード
+ #
+ # @else
+ #
+ # @brief [local interface] Make transition to Inactive state
+ #
+ # This function makes transition from Active to Inactive
+ # state. This function is assumed to be called from the following
+ # functions.
+ #
+ # - onActivated()
+ # - onExecute()
+ # - onStateUpdate()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above function.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return Return code
+ #
+ # @endif
+ #
+ # ReturnCode_t deactivate(RTC::UniqueId ec_id);
+ def deactivate(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ return ec.deactivate_component(self.getObjRef())
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] 状態を Active に遷移させる
+ #
+ # 状態を Inactive から Active に遷移させる。この関数は以下の関
+ # 数内で呼ばれることを前提としている。
+ #
+ # - onStartup()
+ # - onDeactivated()
+ #
+ # この関数の引数は上記の関数の引数 UniquieID exec_handle でなけ
+ # ればならない。
+ #
+ # @param ec_id 上記関数の第1引数 exec_handle を渡す必要がある。
+ # @return リターンコード
+ #
+ # @else
+ #
+ # @brief [local interface] Make transition to Active state
+ #
+ # This function makes transition from Inactive to Active
+ # state. This function is assumed to be called from the following
+ # functions.
+ #
+ # - onStartup()
+ # - onDeactivated()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above function.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return Return code
+ #
+ # @endif
+ #
+ # ReturnCode_t activate(RTC::UniqueId ec_id);
+ def activate(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ return ec.activate_component(self.getObjRef())
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] 状態をリセットし Inactive に遷移させる
+ #
+ # 状態を Error から Inactive に遷移させる。この関数は以下の関
+ # 数内で呼ばれることを前提としている。
+ #
+ # - onError()
+ #
+ # この関数の引数は上記の関数の引数 UniquieID exec_handle でなけ
+ # ればならない。
+ #
+ # @param ec_id 上記関数の第1引数 exec_handle を渡す必要がある。
+ # @return リターンコード
+ #
+ # @else
+ #
+ # @brief [local interface] Resetting and go to Inactive state
+ #
+ # This function reset RTC and makes transition from Error to Inactive
+ # state. This function is assumed to be called from the following
+ # functions.
+ #
+ # - onError()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above function.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return Return code
+ #
+ # @endif
+ #
+ # ReturnCode_t reset(RTC::UniqueId ec_id);
+ def reset(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ return ec.reset_component(self.getObjRef())
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service provider をセットする
+ # @else
+ # @brief [local interface] Set a SDO service provider
+ # @endif
+ #
+ # bool addSdoServiceProvider(const SDOPackage::ServiceProfile& prof,
+ # SdoServiceProviderBase* provider);
+ def addSdoServiceProvider(self, prof, provider):
+ return self._sdoservice.addSdoServiceProvider(prof, provider)
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service provider を削除する
+ # @else
+ # @brief [local interface] Remove a SDO service provider
+ # @endif
+ #
+ # bool removeSdoServiceProvider(const char* id);
+ def removeSdoServiceProvider(self, id):
+ return self._sdoservice.removeSdoServiceProvider(id)
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service consumer をセットする
+ # @else
+ # @brief [local interface] Set a SDO service consumer
+ # @endif
+ #
+ # bool addSdoServiceConsumer(const SDOPackage::ServiceProfile& prof);
+ def addSdoServiceConsumer(self, prof):
+ return self._sdoservice.addSdoServiceConsumer(prof)
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service consumer を削除する
+ # @else
+ # @brief [local interface] Remove a SDO service consumer
+ # @endif
+ #
+ # bool removeSdoServiceConsumer(const char* id);
+ def removeSdoServiceConsumer(self, id):
+ return self._sdoservice.removeSdoServiceConsumer(id)
+
+
+ ##
+ # @if jp
+ #
# @brief 全 InPort のデータを読み込む。
#
# RTC が保持する全ての InPort のデータを読み込む。
@@ -3061,17 +3500,958 @@
for i in range(len_):
idx = (len_ - 1) - i
self._eclist[idx].stop()
- self._poa.deactivate_object(self._poa.servant_to_id(self._eclist[idx]))
- #self._default_POA().deactivate_object(self._default_POA().servant_to_id(self._eclist[idx]))
+ try:
+ self._poa.deactivate_object(self._poa.servant_to_id(self._eclist[idx]))
+ except:
+ self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
del self._eclist[idx]
if self._eclist:
self._eclist = []
+ return
##
# @if jp
+ # @brief PreComponentActionListener リスナを追加する
#
+ # ComponentAction 実装関数の呼び出し直前のイベントに関連する各種リ
+ # スナを設定する。
+ #
+ # 設定できるリスナのタイプとコールバックイベントは以下の通り
+ #
+ # - PRE_ON_INITIALIZE: onInitialize 直前
+ # - PRE_ON_FINALIZE: onFinalize 直前
+ # - PRE_ON_STARTUP: onStartup 直前
+ # - PRE_ON_SHUTDOWN: onShutdown 直前
+ # - PRE_ON_ACTIVATED: onActivated 直前
+ # - PRE_ON_DEACTIVATED: onDeactivated 直前
+ # - PRE_ON_ABORTED: onAborted 直前
+ # - PRE_ON_ERROR: onError 直前
+ # - PRE_ON_RESET: onReset 直前
+ # - PRE_ON_EXECUTE: onExecute 直前
+ # - PRE_ON_STATE_UPDATE: onStateUpdate 直前
+ #
+ # リスナは PreComponentActionListener を継承し、以下のシグニチャを持つ
+ # operator() を実装している必要がある。
+ #
+ # PreComponentActionListener::operator()(UniqueId ec_id)
+ #
+ # デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+ # RTObjectに移り、RTObject解体時もしくは、
+ # removePreComponentActionListener() により削除時に自動的に解体される。
+ # リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+ # 数に false を指定し、自動的な解体を抑制することができる。
+ #
+ # @param listener_type リスナタイプ
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトの自動的解体を行うかどうかのフラグ
+ #
+ # @else
+ # @brief Adding PreComponentAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # pre events.
+ # The following listener types are available.
+ #
+ # - PRE_ON_INITIALIZE: before onInitialize
+ # - PRE_ON_FINALIZE: before onFinalize
+ # - PRE_ON_STARTUP: before onStartup
+ # - PRE_ON_SHUTDOWN: before onShutdown
+ # - PRE_ON_ACTIVATED: before onActivated
+ # - PRE_ON_DEACTIVATED: before onDeactivated
+ # - PRE_ON_ABORTED: before onAborted
+ # - PRE_ON_ERROR: before onError
+ # - PRE_ON_RESET: before onReset
+ # - PRE_ON_EXECUTE: before onExecute
+ # - PRE_ON_STATE_UPDATE: before onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PreComponentActionListener::operator()(UniqueId ec_id)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePreComponentActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PreComponentActionListener*
+ # addPreComponentActionListener(PreCompActionListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(UniqueId ec_id),
+ # bool autoclean = true)
+ def addPreComponentActionListener(self, listener_type,
+ obj, memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PreComponentActionListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+
+ def __call__(self, ec_id):
+ self._memfunc(ec_id)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._actionListeners.preaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PreComponentActionListener リスナを削除する
+ #
+ # 設定した各種リスナを削除する。
+ #
+ # @param listener_type リスナタイプ
+ # @param listener リスナオブジェクトへのポインタ
+ #
+ # @else
+ # @brief Removing PreComponentAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removePreComponentActionListener(PreComponentActionListenerType listener_type,
+ # PreComponentActionListener* listener);
+ def removePreComponentActionListener(self, listener_type, listener):
+ self._actionListeners.preaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PostComponentActionListener リスナを追加する
+ #
+ # ComponentAction 実装関数の呼び出し直後のイベントに関連する各種リ
+ # スナを設定する。
+ #
+ # 設定できるリスナのタイプとコールバックイベントは以下の通り
+ #
+ # - POST_ON_INITIALIZE: onInitialize 直後
+ # - POST_ON_FINALIZE: onFinalize 直後
+ # - POST_ON_STARTUP: onStartup 直後
+ # - POST_ON_SHUTDOWN: onShutdown 直後
+ # - POST_ON_ACTIVATED: onActivated 直後
+ # - POST_ON_DEACTIVATED: onDeactivated 直後
+ # - POST_ON_ABORTED: onAborted 直後
+ # - POST_ON_ERROR: onError 直後
+ # - POST_ON_RESET: onReset 直後
+ # - POST_ON_EXECUTE: onExecute 直後
+ # - POST_ON_STATE_UPDATE: onStateUpdate 直後
+ #
+ # リスナは PostComponentActionListener を継承し、以下のシグニチャを持つ
+ # operator() を実装している必要がある。
+ #
+ # PostComponentActionListener::operator()(UniqueId ec_id, ReturnCode_t ret)
+ #
+ # デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+ # RTObjectに移り、RTObject解体時もしくは、
+ # removePostComponentActionListener() により削除時に自動的に解体される。
+ # リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+ # 数に false を指定し、自動的な解体を抑制することができる。
+ #
+ # @param listener_type リスナタイプ
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトの自動的解体を行うかどうかのフラグ
+ #
+ # @else
+ # @brief Adding PostComponentAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - POST_ON_INITIALIZE: after onInitialize
+ # - POST_ON_FINALIZE: after onFinalize
+ # - POST_ON_STARTUP: after onStartup
+ # - POST_ON_SHUTDOWN: after onShutdown
+ # - POST_ON_ACTIVATED: after onActivated
+ # - POST_ON_DEACTIVATED: after onDeactivated
+ # - POST_ON_ABORTED: after onAborted
+ # - POST_ON_ERROR: after onError
+ # - POST_ON_RESET: after onReset
+ # - POST_ON_EXECUTE: after onExecute
+ # - POST_ON_STATE_UPDATE: after onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PostComponentActionListener::operator()(UniqueId ec_id, ReturnCode_t ret)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePostComponentActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PostComponentActionListener*
+ # addPostComponentActionListener(PostCompActionListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(UniqueId ec_id,
+ # ReturnCode_t ret),
+ # bool autoclean = true)
+ def addPostComponentActionListener(self, listener_type, obj,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PostComponentActionListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+ def __call__(self, ec_id, ret):
+ self._memfunc(ec_id, ret)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._actionListeners.postaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PostComponentActionListener リスナを削除する
+ #
+ # 設定した各種リスナを削除する。
+ #
+ # @param listener_type リスナタイプ
+ # @param listener リスナオブジェクトへのポインタ
+ #
+ # @else
+ # @brief Removing PostComponentAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ ##
+ # void
+ # removePostComponentActionListener(PostComponentActionListenerType listener_type,
+ # PostComponentActionListener* listener);
+ def removePostComponentActionListener(self, listener_type, listener):
+ self._actionListeners.postaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PortActionListener リスナを追加する
+ #
+ # Portの追加、削除時にコールバックされる各種リスナを設定する。
+ #
+ # 設定できるリスナのタイプとコールバックイベントは以下の通り
+ #
+ # - ADD_PORT: Port追加時
+ # - REMOVE_PORT: Port削除時
+ #
+ # リスナは PortActionListener を継承し、以下のシグニチャを持つ
+ # operator() を実装している必要がある。
+ #
+ # PortActionListener::operator()(PortProfile& pprof)
+ #
+ # デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+ # RTObjectに移り、RTObject解体時もしくは、
+ # removePortActionListener() により削除時に自動的に解体される。
+ # リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+ # 数に false を指定し、自動的な解体を抑制することができる。
+ #
+ # @param listener_type リスナタイプ
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトの自動的解体を行うかどうかのフラグ
+ #
+ # @else
+ # @brief Adding PortAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - ADD_PORT: At adding Port
+ # - REMOVE_PORT: At removing Port
+ #
+ # Listeners should have the following function operator().
+ #
+ # PortActionListener::operator()(RTC::PortProfile pprof)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePortActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PortActionListener*
+ # addPortActionListener(PortActionListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(const RTC::PortProfile&),
+ # bool autoclean=true)
+ def addPortActionListener(self, listener_type, obj,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PortActionListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, pprofile):
+ self._memfunc(pprofile)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._actionListeners.portaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PortActionListener リスナを削除する
+ #
+ # 設定した各種リスナを削除する。
+ #
+ # @param listener_type リスナタイプ
+ # @param listener リスナオブジェクトへのポインタ
+ #
+ # @else
+ # @brief Removing PortAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ # void
+ # removePortActionListener(PortActionListenerType listener_type,
+ # PortActionListener* listener);
+ def removePortActionListener(self, listener_type, listener):
+ self._actionListeners.portaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief ExecutionContextActionListener リスナを追加する
+ #
+ # ExecutionContextの追加、削除時にコールバックされる各種リスナを設定する。
+ #
+ # 設定できるリスナのタイプとコールバックイベントは以下の通り
+ #
+ # - ATTACH_EC: ExecutionContext アタッチ時
+ # - DETACH_EC: ExecutionContext デタッチ時
+ #
+ # リスナは ExecutionContextActionListener を継承し、以下のシグニチャを持つ
+ # operator() を実装している必要がある。
+ #
+ # ExecutionContextActionListener::operator()(UniqueId ec_id)
+ #
+ # デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+ # RTObjectに移り、RTObject解体時もしくは、
+ # removeExecutionContextActionListener() により削除時に自動的に解体される。
+ # リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+ # 数に false を指定し、自動的な解体を抑制することができる。
+ #
+ # @param listener_type リスナタイプ
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトの自動的解体を行うかどうかのフラグ
+ #
+ # @else
+ # @brief Adding ExecutionContextAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - ADD_PORT: At adding ExecutionContext
+ # - REMOVE_PORT: At removing ExecutionContext
+ #
+ # Listeners should have the following function operator().
+ #
+ # ExecutionContextActionListener::operator()(UniqueId ec_id)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removeExecutionContextActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ECActionListener*
+ # addExecutionContextActionListener(ECActionListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(UniqueId),
+ # bool autoclean = true);
+ def addExecutionContextActionListener(self, listener_type,
+ obj, memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ExecutionContextActionListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, ec_id):
+ self._memfunc(ec_id)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._actionListeners.ecaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief ExecutionContextActionListener リスナを削除する
+ #
+ # 設定した各種リスナを削除する。
+ #
+ # @param listener_type リスナタイプ
+ # @param listener リスナオブジェクトへのポインタ
+ #
+ # @else
+ # @brief Removing ExecutionContextAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removeExecutionContextActionListener(ECActionListenerType listener_type,
+ # ECActionListener* listener);
+ def removeExecutionContextActionListener(self, listener_type, listener):
+ self._actionListeners.ecaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PortConnectListener リスナを追加する
+ #
+ # Portの接続時や接続解除時に呼び出される各種リスナを設定する。
+ #
+ # 設定できるリスナのタイプとコールバックイベントは以下の通り
+ #
+ # - ON_NOTIFY_CONNECT: notify_connect() 関数内呼び出し直後
+ # - ON_NOTIFY_DISCONNECT: notify_disconnect() 呼び出し直後
+ # - ON_UNSUBSCRIBE_INTERFACES: notify_disconnect() 内のIF購読解除時
+ #
+ # リスナは PortConnectListener を継承し、以下のシグニチャを持つ
+ # operator() を実装している必要がある。
+ #
+ # PortConnectListener::operator()(const char*, ConnectorProfile)
+ #
+ # デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+ # RTObjectに移り、RTObject解体時もしくは、
+ # removePortConnectListener() により削除時に自動的に解体される。
+ # リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+ # 数に false を指定し、自動的な解体を抑制することができる。
+ #
+ # @param listener_type リスナタイプ
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトの自動的解体を行うかどうかのフラグ
+ #
+ # @else
+ # @brief Adding PortConnect type listener
+ #
+ # This operation adds certain listeners related to Port's connect actions.
+ # The following listener types are available.
+ #
+ # - ON_NOTIFY_CONNECT: right after entering into notify_connect()
+ # - ON_NOTIFY_DISCONNECT: right after entering into notify_disconnect()
+ # - ON_UNSUBSCRIBE_INTERFACES: unsubscribing IF in notify_disconnect()
+ #
+ # Listeners should have the following function operator().
+ #
+ # PortConnectListener::operator()(const char*, ConnectorProfile)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePortConnectListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PortConnectListener*
+ # addPortConnectListener(PortConnectListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(const char*,
+ # ConnectorProfile&),
+ # bool autoclean = true)
+ def addPortConnectListener(self, listener_type,
+ obj, memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PortConnectListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, portname, cprofile):
+ self._memfunc(portname, cprofile)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._portconnListeners.portconnect_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PortConnectListener リスナを削除する
+ #
+ # 設定した各種リスナを削除する。
+ #
+ # @param listener_type リスナタイプ
+ # @param listener リスナオブジェクトへのポインタ
+ #
+ # @else
+ # @brief Removing PortConnect type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removePortConnectListener(PortConnectListenerType listener_type,
+ # PortConnectListener* listener);
+ def removePortConnectListener(self, listener_type, listener):
+ self._portconnListeners.portconnect_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PortConnectRetListener リスナを追加する
+ #
+ # Portの接続時や接続解除時に呼び出される各種リスナを設定する。
+ #
+ # 設定できるリスナのタイプとコールバックイベントは以下の通り
+ #
+ # - ON_CONNECT_NEXTPORT: notify_connect() 中のカスケード呼び出し直後
+ # - ON_SUBSCRIBE_INTERFACES: notify_connect() 中のインターフェース購読直後
+ # - ON_CONNECTED: nofity_connect() 接続処理完了時に呼び出される
+ # - ON_DISCONNECT_NEXT: notify_disconnect() 中にカスケード呼び出し直後
+ # - ON_DISCONNECTED: notify_disconnect() リターン時
+ #
+ # リスナは PortConnectRetListener を継承し、以下のシグニチャを持つ
+ # operator() を実装している必要がある。
+ #
+ # PortConnectRetListener::operator()(const char*, ConnectorProfile)
+ #
+ # デフォルトでは、この関数に与えたリスナオブジェクトの所有権は
+ # RTObjectに移り、RTObject解体時もしくは、
+ # removePortConnectRetListener() により削除時に自動的に解体される。
+ # リスナオブジェクトの所有権を呼び出し側で維持したい場合は、第3引
+ # 数に false を指定し、自動的な解体を抑制することができる。
+ #
+ # @param listener_type リスナタイプ
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトの自動的解体を行うかどうかのフラグ
+ #
+ # @else
+ # @brief Adding PortConnectRet type listener
+ #
+ # This operation adds certain listeners related to Port's connect actions.
+ # The following listener types are available.
+ #
+ # - ON_CONNECT_NEXTPORT: after cascade-call in notify_connect()
+ # - ON_SUBSCRIBE_INTERFACES: after IF subscribing in notify_connect()
+ # - ON_CONNECTED: completed nofity_connect() connection process
+ # - ON_DISCONNECT_NEXT: after cascade-call in notify_disconnect()
+ # - ON_DISCONNECTED: completed notify_disconnect() disconnection process
+ #
+ # Listeners should have the following function operator().
+ #
+ # PortConnectRetListener::operator()(const char*, ConnectorProfile)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePortConnectRetListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PortConnectRetListener*
+ # addPortConnectRetListener(PortConnectRetListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(const char*,
+ # ConnectorProfile&,
+ # ReturnCode_t))
+ def addPortConnectRetListener(self, listener_type, obj,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PortConnectRetListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, portname, cprofile, ret):
+ self._memfunc(portname, cprofile, ret)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._portconnListeners.portconnret_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PortConnectRetListener リスナを削除する
+ #
+ # 設定した各種リスナを削除する。
+ #
+ # @param listener_type リスナタイプ
+ # @param listener リスナオブジェクトへのポインタ
+ #
+ # @else
+ # @brief Removing PortConnectRet type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removePortConnectRetListener(PortConnectRetListenerType listener_type,
+ # PortConnectRetListener* listener);
+ def removePortConnectRetListener(self, listener_type, listener):
+ self._portconnListeners.portconnret_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationParamListener を追加する
+ #
+ # update(const char* config_set, const char* config_param) が呼ばれた際に
+ # コールされるリスナ ConfigurationParamListener を追加する。
+ # type には現在のところ ON_UPDATE_CONFIG_PARAM のみが入る。
+ #
+ # @param type ConfigurationParamListenerType型の値。
+ # ON_UPDATE_CONFIG_PARAM がある。
+ #
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトを自動で削除するかどうかのフラグ
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationParamListener
+ #
+ # This function adds a listener object which is called when
+ # update(const char* config_set, const char* config_param) is
+ # called. In the type argument, currently only
+ # ON_UPDATE_CONFIG_PARAM is allowed.
+ #
+ # @param type ConfigurationParamListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ #
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ConfigurationParamListener*
+ # addConfigurationParamListener(ConfigurationParamListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(const char*,
+ # const char*),
+ # bool autoclean = true)
+ def addConfigurationParamListener(self, type,
+ obj, memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ConfigurationParamListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, config_set_name, config_param_name):
+ self._memfunc(config_set_name, config_param_name)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._configsets.addConfigurationParamListener(type, listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationParamListener を削除する
+ #
+ # addConfigurationParamListener で追加されたリスナオブジェクトを削除する。
+ #
+ # @param type ConfigurationParamListenerType型の値。
+ # ON_UPDATE_CONFIG_PARAM がある。
+ # @param listener 与えたリスナオブジェクトへのポインタ
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationParamListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationParamListener() function.
+ #
+ # @param type ConfigurationParamListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ # @param listener a pointer to ConfigurationParamListener listener object.
+ #
+ # @endif
+ #
+ # void removeConfigurationParamListener(ConfigurationParamListenerType type,
+ # ConfigurationParamListener* listener);
+ def removeConfigurationParamListener(self, type, listener):
+ self._configsets.removeConfigurationParamListener(type, listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetListener を追加する
+ #
+ # ConfigurationSet が更新されたときなどに呼ばれるリスナ
+ # ConfigurationSetListener を追加する。設定可能なイベントは以下の
+ # 2種類がある。
+ #
+ # - ON_SET_CONFIG_SET: setConfigurationSetValues() で
+ # ConfigurationSet に値が設定された場合。
+ # - ON_ADD_CONFIG_SET: addConfigurationSet() で新しい
+ # ConfigurationSet が追加された場合。
+ #
+ # @param type ConfigurationSetListenerType型の値。
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトを自動で削除するかどうかのフラグ
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationSetListener
+ #
+ # This function add a listener object which is called when
+ # ConfigurationSet is updated. Available events are the followings.
+ #
+ # @param type ConfigurationSetListenerType value
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ConfigurationSetListener*
+ # addConfigurationSetListener(ConfigurationSetListenerType listener_type,
+ # Listener& obj,
+ # void (Listener::*memfunc)
+ # (const coil::Properties& config_set))
+ def addConfigurationSetListener(self, listener_type, obj,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ConfigurationSetListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, config_set):
+ self._memfunc(config_set)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._configsets.addConfigurationSetListener(listener_type, listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetListener を削除する
+ #
+ # addConfigurationSetListener で追加されたリスナオブジェクトを削除する。
+ #
+ # @param type ConfigurationSetListenerType型の値。
+ # @param listener 与えたリスナオブジェクトへのポインタ
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationSetListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationSetListener() function.
+ #
+ # @param type ConfigurationSetListenerType value
+ # @param listener a pointer to ConfigurationSetListener listener object.
+ #
+ # @endif
+ #
+ # void removeConfigurationSetListener(ConfigurationSetListenerType type,
+ # ConfigurationSetListener* listener);
+ def removeConfigurationSetListener(self, type, listener):
+ self._configsets.removeConfigurationSetListener(type, listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetNameListener を追加する
+ #
+ # ConfigurationSetName が更新されたときなどに呼ばれるリスナ
+ # ConfigurationSetNameListener を追加する。設定可能なイベントは以下の
+ # 3種類がある。
+ #
+ # - ON_UPDATE_CONFIG_SET: ある ConfigurationSet がアップデートされた
+ # - ON_REMOVE_CONFIG_SET: ある ConfigurationSet が削除された
+ # - ON_ACTIVATE_CONFIG_SET: ある ConfigurationSet がアクティブ化された
+ #
+ # @param type ConfigurationSetNameListenerType型の値。
+ # @param obj リスナオブジェクト
+ # @param memfunc 関数オブジェクト
+ # @param autoclean リスナオブジェクトを自動で削除するかどうかのフラグ
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationSetNameListener
+ #
+ # This function add a listener object which is called when
+ # ConfigurationSetName is updated. Available events are the followings.
+ #
+ # - ON_UPDATE_CONFIG_SET: A ConfigurationSet has been updated.
+ # - ON_REMOVE_CONFIG_SET: A ConfigurationSet has been deleted.
+ # - ON_ACTIVATE_CONFIG_SET: A ConfigurationSet has been activated.
+ #
+ # @param type ConfigurationSetNameListenerType value
+ # @param obj A listener object
+ # @param memfunc member function object
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ConfigurationSetNameListener*
+ # addConfigurationSetNameListener(ConfigurationSetNameListenerType type,
+ # Listener& obj,
+ # void (Listener::*memfunc)(const char*))
+ def addConfigurationSetNameListener(self, type, obj, memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ConfigurationSetNameListener):
+ def __init__(self, obj, memfunc):
+ self._obj = obj
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, config_set_name):
+ self._memfunc(config_set_name)
+ return
+
+ listener = Noname(obj, memfunc)
+ self._configsets.addConfigurationSetNameListener(type, listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetNameListener を削除する
+ #
+ # addConfigurationSetNameListener で追加されたリスナオブジェクトを
+ # 削除する。
+ #
+ # @param type ConfigurationSetNameListenerType型の値。
+ # ON_UPDATE_CONFIG_PARAM がある。
+ # @param listener 与えたリスナオブジェクトへのポインタ
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationSetNameListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationSetNameListener() function.
+ #
+ # @param type ConfigurationSetNameListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ # @param listener a pointer to ConfigurationSetNameListener
+ # listener object.
+ #
+ # @endif
+ # void
+ # removeConfigurationSetNameListener(ConfigurationSetNameListenerType type,
+ # ConfigurationSetNameListener* listener);
+ def removeConfigurationSetNameListener(self, type, listener):
+ self._configsets.removeConfigurationSetNameListener(type, listener)
+ return
+
+
+ ##
+ # @if jp
+ #
# @brief RTC を終了する
#
# RTC の終了処理を実行する。
@@ -3099,8 +4479,164 @@
return
+ # inline void preOnInitialize(UniqueId ec_id)
+ def preOnInitialize(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_INITIALIZE].notify(ec_id)
+ return
+ # inline void preOnFinalize(UniqueId ec_id)
+ def preOnFinalize(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_FINALIZE].notify(ec_id)
+ return
+ # inline void preOnStartup(UniqueId ec_id)
+ def preOnStartup(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STARTUP].notify(ec_id)
+ return
+
+ # inline void preOnShutdown(UniqueId ec_id)
+ def preOnShutdown(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_SHUTDOWN].notify(ec_id)
+ return
+
+ # inline void preOnActivated(UniqueId ec_id)
+ def preOnActivated(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ACTIVATED].notify(ec_id)
+ return
+
+ # inline void preOnDeactivated(UniqueId ec_id)
+ def preOnDeactivated(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_DEACTIVATED].notify(ec_id)
+ return
+
+ # inline void preOnAborting(UniqueId ec_id)
+ def preOnAborting(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ABORTING].notify(ec_id)
+ return
+
+ # inline void preOnError(UniqueId ec_id)
+ def preOnError(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ERROR].notify(ec_id)
+ return
+
+ # inline void preOnReset(UniqueId ec_id)
+ def preOnReset(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RESET].notify(ec_id)
+ return
+
+ # inline void preOnExecute(UniqueId ec_id)
+ def preOnExecute(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_EXECUTE].notify(ec_id)
+ return
+
+ # inline void preOnStateUpdate(UniqueId ec_id)
+ def preOnStateUpdate(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STATE_UPDATE].notify(ec_id)
+ return
+
+
+ # inline void preOnRateChanged(UniqueId ec_id)
+ def preOnRateChanged(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RATE_CHANGED].notify(ec_id)
+ return
+
+
+ # inline void postOnInitialize(UniqueId ec_id, ReturnCode_t ret)
+ def postOnInitialize(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_INITIALIZE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnFinalize(UniqueId ec_id, ReturnCode_t ret)
+ def postOnFinalize(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_FINALIZE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnStartup(UniqueId ec_id, ReturnCode_t ret)
+ def postOnStartup(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STARTUP].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnShutdown(UniqueId ec_id, ReturnCode_t ret)
+ def postOnShutdown(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_SHUTDOWN].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnActivated(UniqueId ec_id, ReturnCode_t ret)
+ def postOnActivated(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ACTIVATED].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnDeactivated(UniqueId ec_id, ReturnCode_t ret)
+ def postOnDeactivated(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_DEACTIVATED].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnAborting(UniqueId ec_id, ReturnCode_t ret)
+ def postOnAborting(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ABORTING].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnError(UniqueId ec_id, ReturnCode_t ret)
+ def postOnError(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ERROR].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnReset(UniqueId ec_id, ReturnCode_t ret)
+ def postOnReset(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RESET].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnExecute(UniqueId ec_id, ReturnCode_t ret)
+ def postOnExecute(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_EXECUTE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnStateUpdate(UniqueId ec_id, ReturnCode_t ret)
+ def postOnStateUpdate(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STATE_UPDATE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnRateChanged(UniqueId ec_id, ReturnCode_t ret)
+ def postOnRateChanged(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RATE_CHANGED].notify(ec_id, ret)
+ return
+
+
+ # inline void onAddPort(const PortProfile& pprof)
+ def onAddPort(self, pprof):
+ self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.ADD_PORT].notify(pprof)
+ return
+
+
+ # inline void onRemovePort(const PortProfile& pprof)
+ def onRemovePort(self, pprof):
+ self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.REMOVE_PORT].notify(pprof)
+ return
+
+
+ # inline void onAttachExecutionContext(UniqueId ec_id)
+ def onAttachExecutionContext(self, ec_id):
+ self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_ATTACHED].notify(ec_id)
+ return
+
+
+ # inline void onDetachExecutionContext(UniqueId ec_id)
+ def onDetachExecutionContext(self, ec_id):
+ self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_DETACHED].notify(ec_id)
+ return
+
+
##
# @if jp
# @class svc_name
Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py 2011-06-16 07:03:44 UTC (rev 415)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py 2011-07-08 15:22:06 UTC (rev 416)
@@ -107,8 +107,10 @@
def __init__(self, rtobj):
self._rtobj = rtobj
self._consumerTypes = []
- self._allConsumerAllowed = True
+ self._providers = []
+ self._allConsumerEnabled = True
+
##
# @if jp
# @brief Lock 付き SDO ServiceProfileList
@@ -138,18 +140,67 @@
self._rtcout.RTC_TRACE("SdoServiceAdmin::SdoServiceAdmin(%s)",
rtobj.getProperties().getProperty("instance_name"))
+ prop = self._rtobj.getProperties()
+
+ # ------------------------------------------------------------
+ # SDO service provider
+ enabledProviderTypes = [s.strip() for s in prop.getProperty("sdo.service.provider.enabled_services").split(",")]
+ self._rtcout.RTC_DEBUG("sdo.service.provider.enabled_services: %s",
+ prop.getProperty("sdo.service.provider.enabled_services"))
+
+ availableProviderTypes = OpenRTM_aist.SdoServiceProviderFactory.instance().getIdentifiers()
+ prop.setProperty("sdo.service.provider.available_services",
+ str(OpenRTM_aist.flatten(availableProviderTypes)))
+ self._rtcout.RTC_DEBUG("sdo.service.provider.available_services: %s",
+ prop.getProperty("sdo.service.provider.available_services"))
+
+
+ # If types include '[Aa][Ll][Ll]', all types enabled in this RTC
+ activeProviderTypes = []
+ for i in range(len(enabledProviderTypes)):
+ tmp = enabledProviderTypes[i].lower()
+ if tmp == "all":
+ activeProviderTypes = availableProviderTypes
+ self._rtcout.RTC_DEBUG("sdo.service.provider.enabled_services: ALL")
+ break
+
+ for j in range(len(availableProviderTypes)):
+ if availableProviderTypes[j] == enabledProviderTypes[i]:
+ activeProviderTypes.append(availableProviderTypes[j])
+
+ factory = OpenRTM_aist.SdoServiceProviderFactory.instance()
+ for i in range(len(activeProviderTypes)):
+ svc = factory.createObject(activeProviderTypes[i])
+ propkey = self.ifrToKey(activeProviderTypes[i])
+ properties = []
+ OpenRTM_aist.NVUtil.copyFromProperties(properties,
+ prop.getNode(str(propkey)))
+ prof = SDOPackage.ServiceProfile(str(activeProviderTypes[i]),
+ str(activeProviderTypes[i]),
+ properties,
+ svc._this())
+
+ svc.init(rtobj, prof)
+ self._providers.append(svc)
+
+ # ------------------------------------------------------------
+ # SDO service consumer
# getting consumer types from RTC's properties
- prop = copy.deepcopy(self._rtobj.getProperties())
- constypes = prop.getProperty("sdo_service.consumer_types")
+ constypes = prop.getProperty("sdo.service.consumer.enabled_services")
self._consumerTypes = [s.strip() for s in constypes.split(",")]
- self._rtcout.RTC_DEBUG("sdo_service.consumer_types: %s",
- str(OpenRTM_aist.flatten(self._consumerTypes)))
+ self._rtcout.RTC_DEBUG("sdo.service.consumer.enabled_services: %s",
+ str(constypes))
+ prop.setProperty("sdo.service.consumer.available_services",
+ str(OpenRTM_aist.flatten(OpenRTM_aist.SdoServiceConsumerFactory.instance().getIdentifiers())))
+ self._rtcout.RTC_DEBUG("sdo.service.consumer.available_services: %s",
+ prop.getProperty("sdo.service.consumer.available_services"))
+
# If types include '[Aa][Ll][Ll]', all types allowed in this RTC
for ctype in self._consumerTypes:
tmp = ctype.lower()
if tmp == "all":
- self._allConsumerAllowed = True
+ self._allConsumerEnabled = True
self._rtcout.RTC_DEBUG("sdo_service.consumer_types: ALL")
return
@@ -165,33 +216,124 @@
# Virtual destractor.
# @endif
def __del__(self):
+ len_ = len(self._proiders)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ self._providers[idx].finalize()
+ del self._providers[idx]
+
+ self._providers = []
+
+ len_ = len(self._consumers)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ self._consumers[idx].finalize()
+ del self._consumers[idx]
+
+ self._consumers = []
return
-
+
##
# @if jp
- # @brief Service Consumer Factory を登録する
- #
+ # @brief SDO Service Provider の ServiceProfileList を取得する
# @else
- # @brief Add Service Consumer Factory
+ # @brief Get ServiceProfileList of SDO Service Provider
# @endif
- # bool addSdoServiceConsumerFactory();
- def addSdoServiceConsumerFactory(self):
- return False
+ #
+ # SDOPackage::ServiceProfileList* SdoServiceAdmin::getServiceProviderProfiles()
+ def getServiceProviderProfiles(self):
+ prof = []
+ guard = OpenRTM_aist.ScopedLock(self._provider_mutex)
+ for i in range(len(self._providers)):
+ prof.append(self._providers[i].getProfile())
+ return prof
##
# @if jp
- # @brief Service Consumer Factory を削除する
- #
+ # @brief SDO Service Provider の ServiceProfile を取得する
# @else
- # @brief Remove Service Consumer Factory
+ # @brief Get ServiceProfile of an SDO Service Provider
# @endif
- # bool removeSdoServiceConsumerFactory();
- def removeSdoServiceConsumerFactory(self):
+ #
+ # SDOPackage::ServiceProfile*
+ # SdoServiceAdmin::getServiceProviderProfile(const char* id)
+ def getServiceProviderProfile(self, id):
+ idstr = id
+ guard = OpenRTM_aist.ScopedLock(self._provider_mutex)
+ for i in range(len(self._providers)):
+ if idstr == str(self._providers[i].getProfile().id):
+ return self._providers[i].getProfile()
+
+ raise SDOPackage.InvalidParameter()
+
+
+ ##
+ # @if jp
+ # @brief SDO Service Provider の Service を取得する
+ # @else
+ # @brief Get ServiceProfile of an SDO Service
+ # @endif
+ #
+ # SDOPackage::SDOService_ptr SdoServiceAdmin::getServiceProvider(const char* id)
+ def getServiceProvider(self, id):
+ prof = self.getServiceProviderProfile(id)
+ return prof.service
+
+
+ ##
+ # @if jp
+ # @brief SDO service provider をセットする
+ # @else
+ # @brief Set a SDO service provider
+ # @endif
+ #
+ # bool SdoServiceAdmin::
+ # addSdoServiceProvider(const SDOPackage::ServiceProfile& prof,
+ # SdoServiceProviderBase* provider)
+ def addSdoServiceProvider(self, prof, provider):
+ self._rtcout.RTC_TRACE("SdoServiceAdmin::addSdoServiceProvider(if=%s)",
+ prof.interface_type)
+ guard = OpenRTM_aist.ScopedLock(self._provider_mutex)
+ id = prof.id
+ for i in range(len(self._providers)):
+ if id == str(self._providers[i].getProfile().id):
+ self._rtcout.RTC_ERROR("SDO service(id=%s, ifr=%s) already exists",
+ str(prof.id), str(prof.interface_type))
+ return False
+
+ self._providers.append(provider)
+ return True
+
+
+ ##
+ # @if jp
+ # @brief SDO service provider を削除する
+ # @else
+ # @brief Remove a SDO service provider
+ # @endif
+ #
+ # bool SdoServiceAdmin::removeSdoServiceProvider(const char* id)
+ def removeSdoServiceProvider(self, id):
+ self._rtcout.RTC_TRACE("removeSdoServiceProvider(%d)", id)
+ guard = OpenRTM_aist.ScopedLock(self._provider_mutex)
+
+ strid = id
+ len_ = len(self._providers)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ if strid == str(self._providers[idx].getProfile().id):
+ self._providers[idx].finalize()
+ factory = OpenRTM_aist.SdoServiceProviderFactory.instance()
+ factory.deleteObject(self._providers[idx])
+ del self._providers[idx]
+ self._rtcout.RTC_INFO("SDO service provider has been deleted: %s", id)
+ return True
+ self._rtcout.RTC_WARN("Specified SDO service provider not found: %s", id)
return False
-
+
##
# @if jp
# @brief Service Consumer を追加する
@@ -206,14 +348,13 @@
profile = copy.deepcopy(sProfile)
# Not supported consumer type -> error return
- if not self.isAllowedConsumerType(sProfile):
+ if not self.isEnabledConsumerType(sProfile):
self._rtcout.RTC_ERROR("Not supported consumer type. %s", profile.id)
return False
if not self.isExistingConsumerType(sProfile):
self._rtcout.RTC_ERROR("type %s already exists.", profile.id)
return False
-
if str(profile.id) == "":
self._rtcout.RTC_WARN("No id specified. It should be given by clients.")
return False
@@ -289,20 +430,24 @@
##
# @if jp
# @brief 許可されたサービス型かどうか調べる
- #
# @else
- # @brief If it is allowed service type
+ # @brief If it is enabled service type
# @endif
- # bool isAllowedConsumerType(const SDOPackage::ServiceProfile& sProfile);
- def isAllowedConsumerType(self, sProfile):
- if self._allConsumerAllowed:
+ #
+ # bool SdoServiceAdmin::
+ # isEnabledConsumerType(const SDOPackage::ServiceProfile& sProfile)
+ def isEnabledConsumerType(self, sProfile):
+ if self._allConsumerEnabled:
return True
for i in range(len(self._consumerTypes)):
if self._consumerTypes[i] == str(sProfile.interface_type):
- self._rtcout.RTC_DEBUG("%s is supported SDO service.", str(sProfile.interface_type))
+ self._rtcout.RTC_DEBUG("%s is supported SDO service.",
+ str(sProfile.interface_type))
return True
- self._rtcout.RTC_WARN("Consumer type is not supported: %s", str(sProfile.interface_type))
+
+ self._rtcout.RTC_WARN("Consumer type is not supported: %s",
+ str(sProfile.interface_type))
return False
@@ -330,3 +475,11 @@
# const std::string getUUID() const;
def getUUID(self):
return str(OpenRTM_aist.uuid1())
+
+ # std::string SdoServiceAdmin::ifrToKey(std::string& ifr)
+ def ifrToKey(self, ifr):
+ ifrvstr = ifr.split(":")
+ ifrvstr[1] = ifrvstr[1].lower()
+ ifrvstr[1] = ifrvstr[1].replace(".", "_")
+ ifrvstr[1] = ifrvstr[1].replace("/", ".")
+ return ifrvstr[1]
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceProviderBase.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceProviderBase.py (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceProviderBase.py 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,252 @@
+#!/usr/bin/env python
+# -*- Python -*-
+
+##
+# @file SdoServiceProviderBase.py
+# @brief SDO service provider base class and its factory
+# @date $Date$
+# @author Noriaki Ando <n-ando at aist.go.jp> and Shinji Kurihara
+#
+# Copyright (C) 2011
+# Noriaki Ando
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+import RTC
+import OpenRTM_aist
+import SDOPackage, SDOPackage__POA
+
+
+##
+# @if jp
+#
+# @brief SdoServiceProvider 基底クラス
+#
+# SDOで定義されているSDOサービスのプロバイダを実装するための基底クラ
+# ス。SDOサービスには、外部から提供サービスをRTC(SDO)側で利用する
+# SDOサービスコンシューマと、RTC(SDO)自身がSDOサービスを提供するSDO
+# サービスプロバイダがある。すべてのSDOサービスプロバイダはこの基底
+# クラスを継承して実装される。
+#
+# このオブジェクトのライフサイクルは以下の通り。
+#
+# -# オブジェクトは通常、共有オブジェクト (so, DLL) としてコンパイル・
+# リンクされる。
+# -# マネージャに対してロードされるとモジュール初期化関数によりオブ
+# ジェクトファクトリが、SdoServiceProviderFactory に対して登録さ
+# れる。登録のキーにはサービスインターフェースの IFR (interface
+# repository) ID が利用され、これによりサービスが区別される。
+# -# rtc.conf等のコンフィギュレーション指定により、有効化することが
+# 指定されているサービスインプロバイダは、RTCの起動と同時にインス
+# タンス化される。
+# -# インスタンス化後、初期化関数 init() が呼ばれる。引数には当該サー
+# ビスのためのコンフィギュレーションオプションが coil::Propertyに
+# より渡される。
+# -# インスタンス化されたSDOサービスプロバイダは
+# SDO::get_get_sdo_service() により外部からアクセスされる。このと
+# き、サービスを指定するIDはIFR IDと同じである。このときのアタッ
+# チシーケンスは以下の通り。
+# -# RTCがfinalizeされ解体されると同時にSDOサービスプロバイダも解体
+# されるが、その際にはSdoServiceProviderBase::finalize()がコール
+# されるので、ここでリソースの解放など終了処理を行う。
+#
+# <pre>
+#
+# [RTC] [SDO service] [Other]
+# | : |
+# | instantiate : |
+# |------------->: |
+# | init() | |
+# |------------->| |
+# | | get_service_profiles() |
+# |<--------------------------------------|
+# | | get_sdo_service() |
+# |<--------------------------------------|
+# | | use service |
+# | |<-----------------------|
+# | | |
+# | finalize() | |
+# |------------->x |
+# x x |
+#
+# </pre>
+#
+# このクラスの実装に当たっては、少なくとも以下の純粋仮想関数を実装す
+# る必要がある。
+#
+# - init(): 初期化関数。与えられた RTObject および ServiceProfile か
+# ら、当該オブジェクトを初期化する。
+# - reinit(): 再初期化関数。ServiceProfile は設定情報更新のため同一
+# IDで呼び出されることが有るが、その際にこの関数が新たな
+# ServiceProfile とともに呼び出される。関数内では、設定の変更など
+# 再初期化処理を実装する。
+# - getProfile(): 設定されたプロファイルを返す関数。
+# - finalize(): 終了処理。コンシューマがデタッチされる際に呼び出され
+# る関数。関数内では終了処理を実装する。
+#
+# SdoServiceProvider は通常共有オブジェクトとしてコンパイル・リンク
+# される。共有オブジェクトのエントリポイントは通常コンパイルされたファ
+# イル名の basename + "Init" にしておく。以下に、クラス名、ファイル
+# 名、エントリポイント関数名の推奨例を示す。
+#
+# - 実装クラス名: MySdoServiceConusmer
+# - ファイル名: MySdoServiceProvider.h. MySdoServiceProvider.cpp
+# - 共有オブジェクト名: MySdoServiceProvider.so (or DLL)
+# - エントリポイント関数名: MySdoServiceProviderInit()
+#
+# エントリポイント関数は通常以下のように、SdoServiceProviderFactory
+# に当該コンシューマのファクトリ (と解体ファンクタ) を登録する以下の
+# ような関数になる。
+#
+# <pre>
+# extern "C"
+# {
+# void MySdoServiceProviderInit()
+# {
+# RTC::SdoServiceProviderFactory& factory
+# = RTC::SdoServiceProviderFactory::instance();
+# factory.addFactory(CORBA_Util::toRepositoryId<OpenRTM::MySdoService>(),
+# ::coil::Creator< ::RTC::SdoServiceProviderBase,
+# ::RTC::MySdoServiceProvider>,
+# ::coil::Destructor< ::RTC::SdoServiceProviderBase,
+# ::RTC::MySdoServiceProvider>);
+# }
+# };
+# </pre>
+#
+# @else
+#
+# @endif
+#
+class SdoServiceProviderBase(SDOPackage__POA.SDOService):
+
+ ##
+ # @if jp
+ # @brief 仮想デストラクタ
+ # @else
+ # @brief virtual destructor
+ # @endif
+ def __del__(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief コンシューマクラスの初期化関数
+ #
+ # このオブジェクトの初期化を行う。外部からSDOサービスが
+ # ServiceProfile とともにアタッチされると、SDOコンシューマがインス
+ # タンス化され、その直後に SDO サービスがアタッチされた RTC と与え
+ # られた ServiceProfile を引数としてこの関数が呼ばれる。
+ #
+ # 関数内では、ServiceProfile 内の SDO サービスリファレンスを
+ # CorbaProvider クラス等を利用しオブジェクト内に保持するとともに、
+ # properties から設定内容を読み込みサービス固有の設定等を行う。与
+ # えられたサービスのオブジェクトリファレンスが不正、あるいは
+ # properties の内容が不正、等の場合は戻り値に false を返す。
+ #
+ # @param rtobj このオブジェクトがインスタンス化された RTC
+ # @param profile 外部から与えられた SDO ServiceProfile
+ # @return 与えられた SDO Service や ServiceProfile が不正の場合 false
+ #
+ # @else
+ # @brief Initialization function of the consumer class
+ #
+ # @endif
+ # virtual bool init(RTObject_impl& rtobj,
+ # const SDOPackage::ServiceProfile& profile) = 0;
+ def init(self, rtobj, profile):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief コンシューマクラスの再初期化関数
+ #
+ # このオブジェクトの再初期化を行う。ServiceProfile には id フィー
+ # ルドにセッション固有の UUID がセットされているが、同一の id の場
+ # 合、properties に設定された設定情報の変更や、service フィールド
+ # のサービスの参照の変更が行われる。その際に呼ばれるのがこの
+ # reinit() 関数である。実装では、service フィールドのオブジェクト
+ # リファレンスの同一性を確認し、異なっている場合保持しているリファ
+ # レンスを更新する必要がある。また properties には新たな設定が与え
+ # られている可能性があるので、内容を読み込み設定を更新する。
+ #
+ # @param profile 新たに与えられた SDO ServiceProfile
+ # @return 不正な ServiceProfile が与えられた場合は false
+ #
+ # @else
+ # @brief Reinitialization function of the consumer class
+ #
+ # @endif
+ # virtual bool reinit(const SDOPackage::ServiceProfile& profile) = 0;
+ def reinit(self, profile):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief ServiceProfile を返す
+ #
+ # init()/reinit()で与えられた ServiceProfile は通常オブジェクト内
+ # で保持される。SDO Service 管理フレームワークは管理上このオブジェ
+ # クトに対応する ServiceProfile を必要とするので、この関数では保持
+ # されている ServiceProfile を返す。
+ #
+ # @return このオブジェクトが保持している ServiceProfile
+ #
+ # @else
+ # @brief Getting ServiceProfile
+ # @endif
+ # virtual const SDOPackage::ServiceProfile& getProfile() const = 0;
+ def getProfile(self):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # SDOサービスがでタッチされる際に呼び出される終了処理用関数。サー
+ # ビスのでタッチに際して、当該オブジェクトが保持するリソースを解放
+ # するなどの処理を行う。
+ #
+ # @else
+ # @brief Finalization
+ #
+ # @endif
+ # virtual void finalize() = 0;
+ def finalize(self):
+ pass
+
+
+sdoserviceproviderfactory = None
+
+##
+# @if jp
+# @brief SdoServiceProviderFactory の typedef
+# @else
+# @brief typedef of sdoServiceProviderFactory
+# @endif
+# typedef ::coil::GlobalFactory<
+# ::RTC::SdoServiceProviderBase > SdoServiceProviderFactory;
+class SdoServiceProviderFactory(OpenRTM_aist.Factory,SdoServiceProviderBase):
+ def __init__(self):
+ OpenRTM_aist.Factory.__init__(self)
+ return
+
+ def __del__(self):
+ pass
+
+ def instance():
+ global sdoserviceproviderfactory
+
+ if sdoserviceproviderfactory is None:
+ sdoserviceproviderfactory = SdoServiceProviderFactory()
+
+ return sdoserviceproviderfactory
+
+ instance = staticmethod(instance)
+
Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2011-06-16 07:03:44 UTC (rev 415)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2011-07-08 15:22:06 UTC (rev 416)
@@ -65,6 +65,7 @@
from SdoConfiguration import *
from SdoOrganization import *
from SdoServiceConsumerBase import *
+from SdoServiceProviderBase import *
from SdoServiceAdmin import *
from ConfigurationListener import *
from PeriodicECSharedComposite import *
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/BasicDataType.idl
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/BasicDataType.idl (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/BasicDataType.idl 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,189 @@
+// -*- IDL -*-
+/*!
+ * @file DataType.idl
+ * @brief Basic Data Type definition
+ * @date $Date: 2007-01-09 15:36:29 $
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2003-2006
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id: BasicDataType.idl 1580 2009-12-07 08:54:10Z kurihara $
+ *
+ */
+
+#ifndef BasicDataType_idl
+#define BasicDataType_idl
+
+module RTC {
+ //------------------------------------------------------------
+ // Basic data type definition
+ //------------------------------------------------------------
+ struct Time
+ {
+ unsigned long sec; // sec
+ unsigned long nsec; // nano sec
+ };
+
+ struct TimedState
+ {
+ Time tm;
+ short data;
+ };
+
+ struct TimedShort
+ {
+ Time tm;
+ short data;
+ };
+
+ struct TimedLong
+ {
+ Time tm;
+ long data;
+ };
+
+ struct TimedUShort
+ {
+ Time tm;
+ unsigned short data;
+ };
+
+ struct TimedULong
+ {
+ Time tm;
+ unsigned long data;
+ };
+
+ struct TimedFloat
+ {
+ Time tm;
+ float data;
+ };
+
+ struct TimedDouble
+ {
+ Time tm;
+ double data;
+ };
+
+ struct TimedChar
+ {
+ Time tm;
+ char data;
+ };
+
+ struct TimedWChar
+ {
+ Time tm;
+ wchar data;
+ };
+
+ struct TimedBoolean
+ {
+ Time tm;
+ boolean data;
+ };
+
+ struct TimedOctet
+ {
+ Time tm;
+ octet data;
+ };
+
+ struct TimedString
+ {
+ Time tm;
+ string data;
+ };
+
+
+ struct TimedWString
+ {
+ Time tm;
+ wstring data;
+ };
+
+
+ /*!
+ * Sequence data type
+ */
+ struct TimedShortSeq
+ {
+ Time tm;
+ sequence<short> data;
+ };
+
+ struct TimedLongSeq
+ {
+ Time tm;
+ sequence<long> data;
+ };
+
+ struct TimedUShortSeq
+ {
+ Time tm;
+ sequence<unsigned short> data;
+ };
+
+ struct TimedULongSeq
+ {
+ Time tm;
+ sequence<unsigned long> data;
+ };
+
+ struct TimedFloatSeq
+ {
+ Time tm;
+ sequence<float> data;
+ };
+
+ struct TimedDoubleSeq
+ {
+ Time tm;
+ sequence<double> data;
+ };
+
+ struct TimedCharSeq
+ {
+ Time tm;
+ sequence<char> data;
+ };
+
+ struct TimedWCharSeq
+ {
+ Time tm;
+ sequence<wchar> data;
+ };
+
+ struct TimedBooleanSeq
+ {
+ Time tm;
+ sequence<boolean> data;
+ };
+
+ struct TimedOctetSeq
+ {
+ Time tm;
+ sequence<octet> data;
+ };
+
+ struct TimedStringSeq
+ {
+ Time tm;
+ sequence<string> data;
+ };
+
+ struct TimedWStringSeq
+ {
+ Time tm;
+ sequence<wstring> data;
+ };
+
+};
+
+#endif // end of BasicDataType_idl
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/ComponentObserver.idl
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/ComponentObserver.idl (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/ComponentObserver.idl 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,512 @@
+// -*- IDL -*-
+/*!
+ * @file ComponentObserver.idl
+ * @brief Component observer SDO service
+ * @date $Date$
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2011
+ * Noriaki Ando
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id$
+ *
+ */
+
+#include "SDOPackage.idl"
+#include "RTC.idl"
+
+/*!
+ * @if jp
+ * @brief コンポーネント状態オブザーバインターフェース
+ *
+ * コンポーネントの状態を監視するためのオブザーバインターフェース。オブ
+ * ザーバパターンに従い、外部ツールがコンポーネントにオブザーバオブジェ
+ * クトをセットし、コンポーネントは各種内部状態変更時にをオブザーバオブ
+ * ジェクトをコールし、オブザーバに対して変更を通知する。
+ *
+ * @since 1.1
+ *
+ * @else
+ * @brief Component state observer interface
+ *
+ * This interface defines observer interface for component states.
+ * According to the observer pattern, tools which want to observe
+ * component state set observer objects to the RT-Component, and weh
+ * RT-Component changes its status, the observer object is called and
+ * notice the changes to tools.
+ *
+ *
+ * @since 1.1
+ * @endif
+ */
+module OpenRTM
+{
+ /*!
+ * @if jp
+ *
+ * @brief 更新された状態の種類
+ *
+ * ターゲットRTCで更新された状態の種類を分類する列挙型。
+ *
+ * @else
+ *
+ * @brief A kind of updated status
+ *
+ * This is a enumeration type to classify updated status in target RTC.
+ *
+ * @endif
+ */
+ enum StatusKind
+ {
+ /*!
+ * @if jp
+ *
+ * @brief コンポーネントプロファイル
+ *
+ * コンポーネントプロファイル RTC::ComponentProfile が更新されたこ
+ * とを示す列挙型。
+ *
+ * RTC::ComponentProfile のメンバーのうち、instance_name,
+ * type_name, description, version, vendor, category はRTC動作中に
+ * 変更されることはない。これらが変更された場合には、
+ * ComponentObserver::updatestatus() の hint には、それぞれのメンバー
+ * 名が文字列で指定される。また、parent に対する変更は通知されない。
+ * さらに、properties に対する変更は、hint に "<key0>, <key1>,
+ * ..." の形で通知される。
+ *
+ * port_profiles に対する変更は、後述の PORT_PROFILE によって通知さ
+ * れるため、COMPONENT_PROFILE では通知されない。
+ *
+ * @else
+ *
+ * @brief Component profile
+ *
+ * This is enumeration member to specify that the target
+ * component's RTC::componentProfile has been changed.
+ *
+ * In the member of RTC::ComponentProfile, instance_name,
+ * type_name, description, version, vendor, category are not
+ * modified during RTC running. If these members are changed, each
+ * member's name is specified in the
+ * ComponentObserver::updateStatus() 's hint argument. And,
+ * modification to parent is not notified. In the properties, the
+ * modification is notified as "<key0>, <key1>, ..." in the hint
+ * argument.
+ *
+ * The modification to port_profiles is not notified as
+ * COMPONENT_PROFILE becauase it is notified as PORT_PROFILE.
+ *
+ * @endif
+ */
+ COMPONENT_PROFILE,
+ /*!
+ * @if jp
+ *
+ * @brief コンポーネントの状態
+ *
+ * コンポーネントの状態が変化したことを示す列挙子。
+ *
+ * RTCにはECの状態として、INACTIVE_STATE, ACTIVE_STATE,
+ * ERROR_STATE があるが、この状態が変化したことを通知するための列挙
+ * 子。
+ *
+ * ComponentObserver::updatestatus() の hint には、状態と、どの実行
+ * コンテキストで変化があったかを知らせる以下の文字列が hint に引数
+ * として与えられる。
+ *
+ * hint: (INACTIVE, ACTIVE, ERROR):<Execution Context ID>
+ * 例:
+ * ACTIVE:0 (デフォルトコンテキストでRTCがアクティブになった)
+ * ERROR:1002 (実行コンテキスト1002でRTCがエラーになった)
+ *
+ * @else
+ *
+ * @brief Component status
+ *
+ * This is INACTIVE_STATE, ACTIVE_STATE,
+ * ERROR_STATE status, and this enumerator specify a status of RTC changed.
+ *
+ * A status and ExecutionContext's id is specified in the argument of
+ * ComponentObserver::updateStatus() 's hint.
+ *
+ * hint: (INACTIVE, ACTIVE, ERROR):<Execution Context ID>
+ * Example:
+ * ACTIVE:0 (RTC is activated in the default ExecuionContext)
+ * ERROR:1002 (RTC go to ERROR state in the EC of id 1002)
+ *
+ * @endif
+ */
+ RTC_STATUS,
+ /*!
+ * @if jp
+ *
+ * @brief ExecutionContextの状態
+ *
+ * ExecutionContextの状態が変化したことを示す列挙子。
+ *
+ * RTCにECが attach/detach/rate_change/startup/shutdown されたことを
+ * 示す列挙子。
+ *
+ * ComponentObserver::updatestatus() の hint には、
+ * attach/detach/rate_change/startup/shutdow のいずれが行われたかと、
+ * 対象となるECのidが与えられる。
+ *
+ * hint: (ATTACHED, DETACHED, RATE_CHANGED, STARTUP,
+ * SHUTDOWN):<Execution Context ID>
+ *
+ * 例:
+ * ATTACHED:1002 (ECがアタッチされ、そのIDは1002)
+ *
+ * @else
+ *
+ * @brief The stauts of ExecutionContext
+ *
+ * This is enumerator notifies that ExecutionContext is
+ * attach/detach/rate_change/startup/shutdown. Attach or detach
+ * operation and target ExecutionContext's id is given in the
+ * argument of ComponentObserver::updateStatus() 's hint.
+ *
+ * hint: (ATTACHED, DETACHED, RATE_CHANGED, STARTUP,
+ * SHUTDOWN):<Execution Context ID>
+ *
+ * Example:
+ * ATTACHED:1002 (EC is attached and its ID is 1002)
+ *
+ * @endif
+ */
+ EC_STATUS,
+ /*!
+ * @if jp
+ *
+ * @brief Portの状態
+ *
+ * Portの状態が変化したことを示す列挙子。Portの追加、削除、接続、切
+ * 断が行われたことを示す。ComponentObserver::updatestatus() の
+ * hint には、いずれかのアクションが行われたかと、対象となるポート
+ * の名前が与えられる。
+ *
+ * hint: (ADD, REMOVE, CONNECT, DISCONNECT):<port name>
+ * 例:
+ * CONNECT:velocity (velocity ポートで接続が確立された)
+ *
+ * @else
+ *
+ * @brief The stauts of ports
+ *
+ * This is enumerator which notifies that port is added, removed,
+ * connected and/or disconnected. Which action is performed and
+ * target port's name is given to the hint argument in
+ * ComponentObserver::updateStatus() operation.
+ *
+ * hint: (ADD, REMOVE, CONNECT, DISCONNECT):<port name>
+ * Example:
+ * CONNECT:velocity (A connection established in the velocity port)
+ *
+ * @endif
+ */
+ PORT_PROFILE,
+ /*!
+ * @if jp
+ *
+ * @brief Configurationの状態
+ *
+ * Configurationの状態が変化したことを示す列挙子。Configurationに対
+ * して、コンフィギュレーションパラメータが更新された
+ * (UPDATE_CONFIG_PARAM)、コンフィギュレーションがセット(更新)さ
+ * れた (SET_CONFIG_SET)、コンフィギュレーションセットが追加された
+ * (ADD_CONFIG_SET)、コンフィギュレーションが更新された
+ * (UPDATE_CONFIG_SET)、コンフィギュレーションセットが削除された
+ * (REMOVE_CONFIG_SET)、コンフィギュレーションセットがアクティブに
+ * された (ACTIVATE_CONFIG_SET) といったアクションがあったことが通
+ * 知される。
+ *
+ * - UPDATE_CONFIG_PARAM: <config set name>.<config param name>
+ * - SDOPackage::Configuration::set_configuration_parameter
+ * - SET_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::set_configuration_set_values
+ * - ADD_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::add_configuration_set
+ * - UPDATE_CONFIG_SET: <config set name>
+ * - 内部のコンフィグセットを実際の変数に反映する
+ * - REMOVE_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::remove_configuration_set
+ * - ACTIVATE_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::activate_configuration_set
+ *
+ * @else
+ *
+ * @brief The stauts of ports
+ *
+ * This is enumerator which notifies that configuration is
+ * changed. To the configuration, a configuration parameter has
+ * been updated (UPDATE_CONFIG_PARAM), a configuration-set is set
+ * (SET_CONFIG_SET), a configuration set has been updated
+ * (UPDATE_CONFIG_SET), a configuration set has been added
+ * (ADD_CONFIG_SET) or removed (REMOVE_CONFIG_SET), the active
+ * configuration set has been changed (ACTIVATE_CONFIG_SET), these
+ * actions would be notified.
+ *
+ * - UPDATE_CONFIG_PARAM: <config set name>.<config param name>
+ * - SDOPackage::Configuration::set_configuration_parameter
+ * - SET_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::set_configuration_set_values
+ * - ADD_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::add_configuration_set
+ * - UPDATE_CONFIG_SET: <config set name>
+ * - Apply configuration-set values into actual variables.
+ * - REMOVE_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::remove_configuration_set
+ * - ACTIVATE_CONFIG_SET: <config set name>
+ * - SDOPackage::Configuration::activate_configuration_set
+ *
+ * @endif
+ */
+ CONFIGURATION,
+ /*!
+ * @if jp
+ *
+ * @brief ハートビートイベント
+ *
+ * 当該RTCが生存していることをオブザーバー側に通知する列挙子。
+ *
+ * ハートビートを利用するかどうか、およびハートビートの周期は、
+ * ServiceProfile::properties の以下のプロパティによって与えられる。
+ *
+ * heartbeat.enable: YES/NO
+ * heartbeat.interval: x [s]
+ *
+ * @else
+ *
+ * @brief The stauts of ports
+ *
+ * This enumerator is heart beat notification.
+ *
+ * Whether if the heart-beat function is used is specified in the
+ * ServiceProfile::properties as the following properties.
+ *
+ * heartbeat.enable: YES/NO
+ * heartbeat.interval: x [s]
+ *
+ * @endif
+ */
+ HEARTBEAT,
+
+ STATUS_KIND_NUM
+ };
+
+ /*!
+ * @if jp
+ *
+ * @interface ComponentObserver
+ *
+ * RTCの各種状態の更新を知らせるためのオブザーバーオブジェクトのため
+ * のインターフェース。SDO Service として、対象となるRTC/SDOに対して
+ * アタッチされ、RTC/SDO内の状態が変更された場合に、変更された状態の
+ * 種類とヒントを同時に通知する。ツールなどで、ポーリングによらずRTC
+ * の状態の変化を知りたい場合などに利用する。
+ *
+ * 想定している利用方法は以下のとおりである。
+ *
+ * -# SDO::get_configuration() により Configuration オブジェクトを取得
+ * -# Configuration::add_service_profile() によりTool側の
+ * ComponentObserver を ServiceProfile により RTC に与える。
+ * ServiceProfile のメンバーは以下のように設定すること
+ * - id: UUID など一意なIDを設定する。削除時にも必要になるので、Tool
+ * 側ではIDを保持しておかなければならない。
+ * - interface_type: 当該サービスのIFRのIDを文字列として指定。RTC側で
+ * はこの文字列により当該サービスオブジェクトを受け入れるか決定す
+ * るため指定は必須となる。
+ * - properties: RTC側のサービスの受け入れ側に通知するプロパティを設
+ * 定する。このサービスでは、下記の heartbeat 関連のプロパティを
+ * 指定する。
+ * - service: SDOService オブジェクトの参照を指定する。
+ * -# RTC側で状態の変化があった場合に update_status() オペレーション
+ * が StatusKind および hint の文字列とともに呼び出される。Tool側
+ * では、StatusKind と hint に基づき RTC のある部分の状態が変化し
+ * たことを知り、必要な処理を行う。
+ * -# 最終的にComponentObserverオブジェクトが不要になった場合には、
+ * Configuration::remove_service_profile() を id とともに呼び出し
+ * RTC から削除する。
+ *
+ * <pre>
+ *
+ * [RTC] [Configuration] [Observer] [Tool]
+ * | | | |
+ * | | get_configuration() | |
+ * |<------------------------------------------------|
+ * | | | |
+ * | | add_service_profile(prof) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | update_status(kind, hint) |
+ * |----------------------------------->| |
+ * | | update_status(kind, hint) |
+ * |----------------------------------->| |
+ * | | : | |
+ * | | | |
+ * | | remove_service_profile(id) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | x x
+ *
+ * </pre>
+ *
+ * なお、ServiceProfile::properties に指定するプロパティとしては、
+ *
+ * - observed_status: ALL or kind of status
+ * - heartbeat.enable: YES/NO
+ * - heartbeat.interval: x [s]
+ *
+ * がある。
+ *
+ * - observed_staus: ALL または状態の種類をカンマ区切りで指定
+ * 監視する状態を指定する。指定可能な状態を表す文字列は、
+ * COMPONENT_PROFILE, RTC_STATUS, EC_STATUS, PORT_PROFILE,
+ * CONFIGURATION 5種類である。監視したい対象をカンマで区切り複数指
+ * 定することができる。また、すべての状態を監視する場合、ALL を指定
+ * することができる。指定文字列は大文字、小文字を問わない。
+ *
+ * - heartbeat.interval: 秒単位で数値で指定
+ * ハートビートを送信する周期を秒単位で指定する。なお、指定した秒数
+ * でハートビートが必ず送信される保証はない。したがって、RTCが死ん
+ * だかどうかを確認するには、heartbeat.interval 数回分の時間を待つ
+ * 必要がある。
+ *
+ * - heartbeat.enable: YES または NOで指定
+ * Tool側では、状態に変化があるまで RTC が生存しているかどうか知る
+ * ことはできないため、突然RTCが死んだ場合には、これを知ることがで
+ * きない。そこで、HEART_BEAT イベントを周期的にRTC側から送らせるこ
+ * とができる。ハートビートを有効にするか否かをこのオプションで指定
+ * する。
+ *
+ *
+ * @else
+ *
+ * @interface ComponentObserver
+ *
+ * This is an interface to notify various status changed in RTC to
+ * others. This is attached into a target RTC/SDO as a SDO service,
+ * and if an RTC/SDO's status change, a kind of changed status and
+ * its hints are notified to observers. For example, it can be used
+ * to notify RTC's status changed without polling in certain tools.
+ *
+ * An assumed usage is as follows.
+ *
+ * -# SDO::get_configuration() is called to get a Configuration object
+ *
+ * -# Configuration::add_service_profile() is called by Tool.
+ * A ComponentObserver in a ServiceProfile is given to RTC.
+ * ServiceProfile members should be set as follows.
+ *
+ * - id: UUID and other unique ID should be specified. Since this ID
+ * is used when the service is removed, tools should remember
+ * this ID.
+ *
+ * - interface_type: IFR ID should be specified here. Since the RTC
+ * decides if the given SDO service object can be accepted by
+ * using the interface_type string, this member is mandatory.
+ *
+ * - properties: This member specifies properties to be notified to
+ * RTC side. In this service, the following heartbeat related
+ * properties should be specified.
+ *
+ * - service: SDOService object reference should be specified.
+ *
+ * -# If some changes happen in RTC, the update_status() operation
+ * is called with StatusKind and hint string. RTC's status change
+ * is notified to tool and some processes would be performed by
+ * the tool according to the StatusKind and hint.
+ *
+ * -# Finally, When the ComponentObserver object becomes
+ * unnecessary, Configuration::remove_service_profile() is called
+ * with id and it is removed from RTC.
+ *
+ * <pre>
+ *
+ * [RTC] [Configuration] [Observer] [Tool]
+ * | | | |
+ * | | get_configuration() | |
+ * |<------------------------------------------------|
+ * | | | |
+ * | | add_service_profile(prof) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | update_status(kind, hint) |
+ * |----------------------------------->| |
+ * | | update_status(kind, hint) |
+ * |----------------------------------->| |
+ * | | : | |
+ * | | | |
+ * | | remove_service_profile(id) |
+ * | |<-----------------------------------|
+ * | | | |
+ * | | x x
+ *
+ * </pre>
+ *
+ * Properties which is specified in ServiceProfile::properties is as follows.
+ *
+ * - observed_status: ALL or kind of status
+ * - heartbeat.enable: YES/NO
+ * - heartbeat.interval: x [s]
+ *
+ *
+ * - observed_staus: ALL or comma separated status kinds This
+ * property specifies kind of status to be observed. Available
+ * kind of statuses are COMPONENT_PROFILE, RTC_STATUS, EC_STATUS,
+ * PORT_PROFILE, CONFIGURATION. You can specify comma-separated
+ * status list to be observed. And if you want to observe all the
+ * status, you just specify ALL instead of all the status kind
+ * list. Uppercase, lowercase and mixture are allowed in the
+ * specified status kind.
+ *
+ * - heartbeat.enable: YES or NO
+ *
+ * Since tools cannot know whether the RTC is alive or not until
+ * status change happens, if the RTC suddenly died, the tools
+ * cannot know it forever. To eliminate this problems, Observer
+ * object can send periodic heartbeat signals to observers. The
+ * heartbeat.enable option specifies whether the functionality is
+ * activated or not.
+ *
+ * - heartbeat.interval: Heartbeat interval should be specified in
+ * seconds. This specification does not guarantee that heartbeat
+ * signals precisely send back to observer. Therefore if you need
+ * to decide whether an RTC died or not, you have to wait for
+ * several heartbeat signals.
+ *
+ * @endif
+ */
+ interface ComponentObserver
+ : SDOPackage::SDOService
+ {
+ /*!
+ * @if jp
+ *
+ * @brief 状態が更新されたことを知らせる
+ *
+ * 状態が更新されたことを知らせるオペレーション。status_kind によっ
+ * て更新された状態の種類、hint によってどのような状態が変更された
+ * かに関するヒントが与えられる。
+ *
+ * @param status_kind: StatusKind 型の状態の種類
+ * @param hint; StatusKind 毎に決まる状態変更に関するヒント
+ *
+ * @else
+ *
+ * @brief Notifies the status updated
+ *
+ * This operation notifies the updated status. The status_kind
+ * notifies kind of updated status, and the hint give some hint
+ * about updated status.
+ *
+ * @endif
+ */
+ oneway void update_status(in StatusKind status_kind, in string hint);
+ };
+
+};
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/DataPort.idl
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/DataPort.idl (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/DataPort.idl 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,48 @@
+// -*- IDL -*-
+/*!
+ * @file DataPort.idl
+ * @brief DataPort interface definition
+ * @date $Date: 2007-01-09 15:40:14 $
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2006
+ * Noriaki Ando
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ *
+ * All rights reserved.
+ *
+ * $Id: DataPort.idl 1597 2009-12-22 02:26:17Z n-ando $
+ *
+ */
+
+#ifndef DataInPort_idl
+#define DataInPort_idl
+
+module OpenRTM
+{
+ enum PortStatus
+ {
+ PORT_OK,
+ PORT_ERROR,
+ BUFFER_FULL,
+ BUFFER_EMPTY,
+ BUFFER_TIMEOUT,
+ UNKNOWN_ERROR
+ };
+
+ typedef sequence<octet> CdrData;
+
+ interface InPortCdr
+ {
+ PortStatus put(in CdrData data);
+ };
+
+ interface OutPortCdr
+ {
+ PortStatus get(out CdrData data);
+ };
+};
+#endif
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/MySdoServiceConsumer.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/MySdoServiceConsumer.py (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/MySdoServiceConsumer.py 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# -*- Python -*-
+
+
+## \file MySdoServiceConsumer.py
+## \brief test for SdoServiceConsumer class
+## \date $Date: $
+## \author Shinji Kurihara
+#
+# Copyright (C) 2011
+# Task-intelligence Research Group,
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+#
+
+import sys
+sys.path.insert(1,"../")
+sys.path.insert(1,"../RTM_IDL")
+import OpenRTM_aist
+import OpenRTM
+
+
+class MySdoServiceConsumer(OpenRTM_aist.SdoServiceConsumerBase):
+ def __init__(self):
+ self._profile = None
+ self._rtobj = None
+ return
+
+ def __del__(self):
+ return
+
+ def init(self, rtobj, profile):
+ self._rtobj = rtobj
+ self._profile = profile
+ return True
+
+ def reinit(self, profile):
+ return
+
+ def getProfile(self):
+ return self._profile
+
+ def finalize(self):
+ return
+
+
+def MySdoServiceConsumerInit(manager):
+ factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
+ factory.addFactory(OpenRTM_aist.toTypename(OpenRTM.ComponentObserver),
+ MySdoServiceConsumer,
+ OpenRTM_aist.Delete)
+ return
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/OpenRTM.idl
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/OpenRTM.idl (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/OpenRTM.idl 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,64 @@
+// -*- IDL -*-
+/*!
+ * @file OpenRTM.idl
+ * @brief OpenRTM interface definition
+ * @date $Date: 2007-09-21 09:19:33 $
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2007
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id: OpenRTM.idl 1338 2009-05-18 05:58:25Z n-ando $
+ *
+ */
+
+#include "RTC.idl"
+
+#pragma prefix "openrtm.aist.go.jp"
+
+module OpenRTM
+{
+
+ interface DataFlowComponent
+ : RTC::RTObject, RTC::DataFlowComponent
+ {
+ };
+
+// interface FiniteStateMachineComponent
+// : RTC::RTObject, RTC::FsmParticipant
+// {
+// };
+//
+// interface DataFlowFiniteStateMachineComponent
+// : RTC::RTObject, RTC::DataFlowComponent, RTC::FsmParticipant
+// {
+// };
+//
+// interface DataFlowMultiModeComponent
+// : RTC::RTObject, RTC::DataFlowComponent, RTC::MultiModeObject
+// {
+// };
+//
+// interface FiniteStateMachineMultiModeComponent
+// : RTC::RTObject, RTC::FsmParticipant, RTC::MultiModeObject
+// {
+// };
+//
+// interface DataFlowFiniteStateMachineMultiModeComponent
+// : RTC::RTObject, RTC::DataFlowComponent,
+// RTC::FsmParticipant, RTC::MultiModeObject
+// {
+// };
+
+
+ interface ExtTrigExecutionContextService
+ : RTC::ExecutionContextService
+ {
+ void tick();
+ };
+
+};
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/RTC.idl
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/RTC.idl (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/RTC.idl 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,2649 @@
+// RTC.idl
+
+#include "SDOPackage.idl"
+
+#pragma prefix "omg.org"
+
+#define EXECUTION_HANDLE_TYPE_NATIVE long
+
+module RTC
+{
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ExecutionContextHandle_t
+ *
+ * @section Description
+ *
+ * This data type represents the association between an RTC and an
+ * ExecutionContext in which it participates.
+ *
+ * @section Semantics
+ *
+ * This is an opaque DataType. It has no attributes or operations.
+ *
+ * @endif
+ */
+ typedef EXECUTION_HANDLE_TYPE_NATIVE ExecutionContextHandle_t;
+
+ typedef SDOPackage::UniqueIdentifier UniqueIdentifier;
+ typedef SDOPackage::NVList NVList;
+
+ /*!
+ * @if jp
+ * @brief ReturnCode_t
+ *
+ * OMG RTC 1.0 仕様中の多くのオペレーションは、クラインとに対して考え
+ * られるエラー状態を報告する必要がある。これは、ReturnCode_t型の所謂
+ * リターンコードにより行われる。
+ *
+ * OMG RTC 1.0 の PIM 内において、ReturnCode_t型の値を返さないオペレーションは
+ * それらの戻り値の型に依存して、次の方法によりエラーを報告するものとする。
+ * -オペレーションが正数値を返す場合 (OMG RTC 1.0 Section 5.2.2.6.4 の
+ * get_rateのように)、負数値を返すことによりエラーを示すものとする。
+ * - オペレーションがオブジェクトリファレンス(RTObject::get_component_profile
+ * OMG RTC 1.0 5.4.2.2.1を参照) を通常返す場合、nil参照を返すことにより
+ * エラーを示すものとする。
+ *
+ * @else
+ * @brief ReturnCode_t
+ *
+ * A number of operations in this specification will need to report
+ * potential error conditions to their clients. This task shall be
+ * accomplished by means of operation "return codes" of type
+ * ReturnCode_t
+ *
+ * Operations in the PIM that do not return a value of type
+ * ReturnCode_t shall report errors in the following ways, depending
+ * on their return type:
+ * - If an operation normally returns a positive numerical value (such as
+ * get_rate, see [OMG RTC 1.0 Section 5.2.2.6.4]), it shall indicate
+ * failure by returning a negative value.
+ * - If an operation normally returns an object reference (such as
+ * RTObject::get_component_profile, see [OMG RTC 1.0 Section 5.4.2.2.1]),
+ * it shall indicate failure by returning a nil reference.
+ *
+ * @param RTC_OK The operation completed successfully.
+ * @param RTC_ERROR The operation failed with a generic, unspecified error.
+ * @param BAD_PARAMETER The operation failed because an illegal argument was
+ * passed to it.
+ * @param UNSUPPORTED The operation is unsupported by the implementation
+ * (e.g., it belongs to a compliance point that is not implemented).
+ * @param OUT_OF_RESOURCES The target of the operation ran out of the
+ * resources needed to complete the operation.
+ * @param PRECONDITION_NOT_MET A pre-condition for the operation was not met.
+ *
+ * @endif
+ */
+ enum ReturnCode_t
+ {
+ RTC_OK,
+ RTC_ERROR,
+ BAD_PARAMETER,
+ UNSUPPORTED,
+ OUT_OF_RESOURCES,
+ PRECONDITION_NOT_MET
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief LifeCycleState
+ *
+ * @section Description
+ * LifeCycleState is an enumeration of the states in the lifecycle above.
+ *
+ * @endif
+ */
+ enum LifeCycleState
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief CREATED
+ *
+ * @section Description
+ *
+ * The RTC object has been instantiated but not yet fully initialized.
+ * @endif
+ */
+ CREATED_STATE,
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief INACTIVE
+ *
+ * @section Description
+ *
+ * The RTC is Alive but is not being invoked in any execution
+ * context (see Section 5.2.2.5), regardless of whether the context
+ * is Running or not.
+ *
+ * @section Semantics
+ *
+ * An instance of this state exists for each execution context in
+ * which the RTC participates. If the RTC does not participate in
+ * any execution context, a single instance of this state exists.
+ *
+ * @endif
+ */
+ INACTIVE_STATE,
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ACTIVE
+ *
+ * @section Description
+ *
+ * The RTC is Alive and will be invoked in the execution context
+ * if the context is Running.
+ *
+ * @section Semantics
+ *
+ * An instance of this state exists for each execution context in
+ * which the RTC participates. If the RTC does not participate in
+ * any execution context, this state shall never be observed.
+ *
+ * @endif
+ */
+ ACTIVE_STATE,
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ERROR
+ *
+ * @section Description
+ *
+ * The RTC has encountered a problem in a given execution context
+ * and cannot continue functioning in that context without being
+ * reset.
+ *
+ * @endif
+ */
+ ERROR_STATE
+ };
+
+ interface ExecutionContext;
+ typedef sequence<ExecutionContext> ExecutionContextList;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ComponentAction
+ *
+ * @section Description
+ *
+ * The ComponentAction interface provides callbacks corresponding to
+ * the execution of the lifecycle operations of LightweightRTObject
+ * (see Section 5.2.2.2) and ExecutionContext (see Section
+ * 5.2.2.5). An RTC developer may implement these callback
+ * operations in order to execute application-specific logic
+ * pointing response to those transitions.
+ *
+ * @section Semantics
+ *
+ * Clients of an RTC are not expected to invoke these operations
+ * directly; they are provided for the benefit of the RTC middleware
+ * implementation.
+ *
+ * @endif
+ */
+ interface ComponentAction
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_initialize
+ *
+ * @section Description
+ *
+ * The RTC has been initialized and entered the Alive state.
+ *
+ * @section Semantics
+ *
+ * Any RTC-specific initialization logic should be performed here.
+ *
+ * @endif
+ */
+ ReturnCode_t on_initialize();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_finalize
+ *
+ * @section Description
+ *
+ * The RTC is being destroyed.
+ *
+ * @section Semantics
+ *
+ * Any final RTC-specific tear-down logic should be performed here.
+ *
+ * @endif
+ */
+ ReturnCode_t on_finalize();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_startup
+ *
+ * @section Description
+ *
+ * The given execution context, in which the RTC is participating,
+ * has transitioned from Stopped to Running.
+ *
+ * @endif
+ */
+ ReturnCode_t on_startup(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_shutdown
+ *
+ * @section Description
+ *
+ * The given execution context, in which the RTC is participating,
+ * has transitioned from Running to Stopped.
+ *
+ * @endif
+ */
+ ReturnCode_t on_shutdown(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_activated
+ *
+ * @section Description
+ *
+ * The RTC has been activated in the given execution context.
+ *
+ * @endif
+ */
+ ReturnCode_t on_activated(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_deactivated
+ *
+ * @section Description
+ *
+ * The RTC has been deactivated in the given execution context.
+ *
+ * @endif
+ */
+ ReturnCode_t on_deactivated(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_aborting
+ *
+ * @section Description
+ *
+ * The RTC is transitioning from the Active state to the Error
+ * state in some execution context.
+ *
+ * @section Semantics
+ *
+ * This callback is invoked only a single time for time that the
+ * RTC transitions into the Error state from another state. This
+ * behavior is in contrast to that of on_error.
+ *
+ * @endif
+ */
+ ReturnCode_t on_aborting(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_error
+ *
+ * @section Description
+ *
+ * The RTC remains in the Error state.
+ *
+ * @section Semantics
+ *
+ * If the RTC is in the Error state relative to some execution
+ * context when it would otherwise be invoked from that context
+ * (according to the context’s ExecutionKind), this callback
+ * shall be invoked instead. For example,
+ *
+ * - If the ExecutionKind is PERIODIC, this operation shall be
+ * invoked in sorted order at the rate of the context instead of
+ * DataFlowComponentAction::on_execute and on_state_update.
+ *
+ * - If the ExecutionKind is EVENT_DRIVEN, this operation shall be
+ * invoked whenever FsmParticipantAction::on_action would
+ * otherwise have been invoked.
+ *
+ * @endif
+ */
+ ReturnCode_t on_error(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_reset
+ *
+ * @section Description
+ *
+ * The RTC is in the Error state. An attempt is being made to
+ * recover it such that it can return to the Inactive state.
+ *
+ * @section Semantics
+ *
+ * If the RTC was successfully recovered and can safely return to
+ * the Inactive state, this method shall complete with
+ * ReturnCode_t::OK. Any other result shall indicate that the RTC
+ * should remain in the Error state.
+ *
+ * @endif
+ */
+ ReturnCode_t on_reset(in ExecutionContextHandle_t exec_handle);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief LightweightRTObject
+ *
+ * @section Description
+ *
+ * This interface is realized by all lightweight RTCs (as required
+ * by the lightweightRTComponent stereotype). It defines the states
+ * and transitions through which all RTCs will pass from the time
+ * they are created until the time they are destroyed.
+ *
+ * @section Semantics
+ * @subsection Initialization
+ *
+ * An RTC begins in the Created state; at this point, it has been
+ * instantiated but not yet fully initialized. Note that this state
+ * is highly implementation-dependent. For example, it may
+ * correspond to the invocation of a constructor in languages that
+ * support that concept, but not all languages do. Furthermore, how
+ * soon this state is entered before initialize is invoked is
+ * implementation-dependent. Therefore, it should be relied on by
+ * RTC implementers only to the minimum extent possible. An RTC
+ * that has completed its initialization and has not been finalized
+ * is said to be Alive.
+ *
+ * @subsection Execution Context
+ *
+ * An RTC in the Alive state may participate in any number of
+ * execution contexts (see Section 5.2.2.5 ). These contexts shall
+ * be represented to an RTC as distinct instances of the
+ * ExecutionContext class. The ExecutionContext manages the behavior
+ * of each RTC that participates in it. This relationship is defined
+ * by the following state machine, which is embedded within the
+ * ExecutionContext's own lifecycle (see Figure 5.5 ). Each
+ * participating RTC is represented as a separate parallel region.
+ *
+ * Relative to a given execution context, an RTC may either be
+ * Active, Inactive, or in Error. When the RTC is Active in a
+ * Running execution context, the ComponentAction callbacks (see
+ * Section 5.2.2.4) shall be invoked as appropriate for the context’
+ * s ExecutionKind. The callbacks shall not be invoked relative to
+ * that context when either the RTC is Inactive in that context or
+ * the context is Stopped. (Note that starting and stopping an
+ * execution context shall not impact whether its participating RTCs
+ * are Active or Inactive.) It may be that a given RTC does not
+ * directly participate in any execution contexts. Such an RTC is
+ * referred to as passive. A passive RTC may provide services to
+ * other components upon request. At any other time, it shall not be
+ * required to perform any ongoing activity of its own; therefore,
+ * instances of such an RTC typically exist only as parts (directly
+ * or indirectly) of a containing active RTC.
+ *
+ * @subsection Error Handling
+ *
+ * If an operation fails while the RTC is Active in a given
+ * execution context, the RTC will transition to the Error state
+ * corresponding to that context. While the RTC is in Error, the
+ * ComponentAction::on_error callback will be invoked in place of
+ * those callbacks that would otherwise have been invoked according
+ * to the context’s ExecutionKind. For example, if the kind is
+ * PERIODIC, on_error shall be invoked instead of the pair of
+ * on_execute, and on_state_update. When an RTC is in Error, it may
+ * be reset. If resetting is successful, the RTC shall return to the
+ * Inactive state. If resetting is unsuccessful, it shall remain in
+ * the Error state.
+ *
+ * @endif
+ */
+ interface LightweightRTObject
+ : ComponentAction
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief initialize
+ *
+ * @section Description
+ * Initialize the RTC that realizes this interface.
+ *
+ * @section Semantics
+ * The invocation of this operation shall result in the invocation
+ * of the callback ComponentAction::on_initialize.
+ *
+ * @section Constraints
+ *
+ * - An RTC may be initialized only while it is in the Created
+ * state. Any attempt to invoke this operation while in another
+ * state shall fail with ReturnCode_t::PRECONDITION_NOT_MET.
+ * - Application developers are not expected to call this operation
+ * directly; it exists for use by the RTC infrastructure.
+ *
+ * @endif
+ */
+ ReturnCode_t initialize();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief finalize
+ *
+ * @section Description
+ *
+ * Finalize the RTC that realizes this interface, preparing it for
+ * destruction.
+ *
+ * @section Semantics
+ *
+ * This invocation of this operation shall result in the
+ * invocation of the callback ComponentAction::on_finalize
+ *
+ * @section Constraints
+ *
+ * - An RTC may not be finalized while it is participating in any
+ * execution context. It must first be removed with
+ * ExecutionContextOperations::remove_component. Otherwise, this
+ * operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET. See Figure 5.9.
+ *
+ * - An RTC may not be finalized while it is in the Created state. Any
+ * attempt to invoke this operation while in that state shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * - Application developers are not expected to call this operation
+ * directly; it exists for use by the RTC infrastructure.
+ *
+ * @endif
+ */
+ ReturnCode_t finalize();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief is_alive
+ *
+ * @section Description
+ *
+ * A component is alive or not regardless of the execution context
+ * from which it is observed. However, whether or not it is
+ * Active, Inactive, or in Error is dependent on the execution
+ * context(s) (see Figure 5.7) in which it is running. That is, it
+ * may be Active in one context but Inactive in
+ * another. Therefore, this operation shall report whether this
+ * RTC is either Active, Inactive, or in Error; which of those
+ * states a component is in with respect to a particular context
+ * may be queried from the context itself.
+ *
+ * @endif
+ *
+ */
+ boolean is_alive(in ExecutionContext exec_context);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief exit
+ *
+ * @section Description
+ *
+ * Stop the RTC’s execution context(s) and finalize it along with
+ * its contents.
+ *
+ * @section Semantics
+ *
+ * Any execution contexts for which the RTC is the owner shall be
+ * stopped. If the RTC participates in any execution contexts
+ * belonging to another RTC that contains it, directly or
+ * indirectly (i.e., the containing RTC is the owner of the
+ * ExecutionContext), it shall be deactivated in those contexts.
+ * After the RTC is no longer Active in any Running execution
+ * context, it and any RTCs contained transitively within it shall
+ * be finalized.
+ *
+ * @section Constraints
+ *
+ * An RTC cannot be exited if it has not yet been initialized. Any
+ * attempt to exit an RTC that is in the Created state shall fail
+ * with ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * @endif
+ */
+ ReturnCode_t exit();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief attach_context
+ *
+ * @section Description
+ *
+ * Inform this RTC that it is participating in the given execution
+ * context. Return a handle that represents the association of
+ * this RTC with the context.
+ *
+ * @section Semantics
+ *
+ * This operation is intended to be invoked by
+ * ExecutionContextOperations::add_component (see Section
+ * 5.2.2.6.6). It is not intended for use by other clients.
+ *
+ * @endif
+ */
+ ExecutionContextHandle_t attach_context(in ExecutionContext exec_context);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief detach_context
+ * @section Description
+ *
+ * Inform this RTC that it is no longer participating in the given
+ * execution context.
+ *
+ * @section Semantics
+ *
+ * This operation is intended to be invoked by
+ * ExecutionContextOperations::remove_component (see Section
+ * 5.2.2.6.7). It is not intended for use by other clients.
+ *
+ * @section Constraints
+ *
+ * - This operation may not be invoked if this RTC is not already
+ * participating in the execution context. Such a call shall fail
+ * with ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * - This operation may not be invoked if this RTC is Active in
+ * the indicated execution context. Otherwise, it shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * @endif
+ */
+ ReturnCode_t detach_context(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_context
+ *
+ * @section Description
+ *
+ * Obtain a reference to the execution context represented by the
+ * given handle.
+ *
+ * @section Semantics
+ *
+ * The mapping from handle to context is specific to a particular
+ * RTC instance. The given handle must have been obtained by a
+ * previous call to attach_context on this RTC.
+ *
+ * @endif
+ */
+ ExecutionContext get_context(in ExecutionContextHandle_t exec_handle);
+
+ /*!
+ * @if jp
+ * @brief get_owned_contexts
+ *
+ * @section Description
+ *
+ * この RTC が所有する ExecutionContext のリストを取得する。
+ *
+ * @else
+ * @brief get_owned_contexts
+ *
+ * @section Description
+ *
+ * This operation returns a list of all execution contexts owned
+ * by this RTC.
+ *
+ * @endif
+ */
+ ExecutionContextList get_owned_contexts();
+
+ /*!
+ * @if jp
+ * @brief get_participating_contexts
+ *
+ * @section Description
+ *
+ * この RTC が参加しているすべての ExecutionContext のリストを取得する。
+ *
+ * @section Semantics
+ *
+ * このリストに含まれる実行コンテキストは、attach_context が呼び出
+ * されるごとに、リストに追加され、detach_context が呼び出されるご
+ * とに、リストから削除される。
+ *
+ * @else
+ * @brief* get_participating_contexts
+ *
+ * @section Description
+ *
+ * This operation returns a list of all execution contexts in
+ * which this RTC participates.
+ *
+ * @section Semantics
+ *
+ * Each call to attach_context causes the provided context to be
+ * added to this list. Each call to detach_context causes the
+ * provided context to be removed from this list.
+ *
+ * @endif
+ */
+ ExecutionContextList get_participating_contexts();
+
+ /*!
+ * @if jp
+ * ### [誤植] RTC.idl には含まれていないがPIMには含まれている。
+ * ### PIMが正しい。
+ *
+ * @brief
+ * @else
+ * @brief get_context_handle
+ *
+ * @section Description
+ *
+ * This operation returns a handle that is associated with the given
+ * execution context.
+ *
+ * @endif
+ */
+ ExecutionContextHandle_t get_context_handle(in ExecutionContext cxt);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ExecutionKind
+ *
+ * @sectioni Description
+ *
+ * The ExecutionKind enumeration defines the execution semantics
+ * (see Section 5.3) of the RTCs that participate in an execution
+ * context.
+ *
+ * @endif
+ */
+ enum ExecutionKind
+ {
+ /*!
+ * @if jp
+ * @brief
+ *
+ * @else
+ * @brief PERIODIC
+ *
+ * @section Description
+ *
+ * The participant RTCs are executing according to periodic
+ * sampled data semantics (see Section 5.3.1).
+ *
+ * @endif
+ */
+ PERIODIC,
+ /*!
+ * @if jp
+ * @brief
+ *
+ * @else
+ * @brief EVENT_DRIVEN
+ *
+ * @section Description
+ *
+ * The participant RTCs are executing according to stimulus
+ * response semantics (see Section 5.3.2).
+ *
+ * @endif
+ */
+ EVENT_DRIVEN,
+ /*!
+ * @if jp
+ * @brief
+ *
+ * @else
+ * @brief OTHER
+ *
+ * @section Description
+ *
+ * The participant RTCs are executing according to some semantics
+ * not defined by this specification.
+ *
+ * @endif
+ */
+ OTHER
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ExecutionContext
+ *
+ * @section Description
+ *
+ * An ExecutionContext allows the business logic of an RTC to be
+ * decoupled from the thread of control in which it is executed. The
+ * context represents a logical thread of control and is provided to
+ * RTCs at runtime as an argument to various operations, allowing
+ * them to query and modify their own state, and that of other RTCs
+ * executing within the same context, in the lifecycle. This
+ * separation of concerns is important for two primary reasons:
+ *
+ * - Large number of components may collaborate tightly within a
+ * single node or process. If each component were to run within its
+ * own thread of control, the infrastructure may not be able to
+ * satisfy the timeliness and determinism requirements of real-time
+ * applications due to the large number of threads and the required
+ * synchronization between them.
+ *
+ * - A single application may carry out a number of independent
+ * tasks that require different execution rates. For example, it may
+ * need to sample a sensor periodically at a very high rate and update a
+ * user interface at a much lower rate.
+ *
+ * @section Semantics
+ *
+ * The state machine of an ExecutionContext has two parts. The
+ * behavior of the ExecutionContext itself is defined by the upper
+ * region in the above figure. The behavior of the RTCs that
+ * participate in the context is defined by the lower region. The
+ * contents of that region are displayed in more detail in Figure
+ * 5.5 in Section 5.2.2.2. Ownership and Participation Each
+ * execution context is owned by a single RTC and may be used to
+ * execute that RTC and the RTCs contained within it, directly or
+ * indirectly. An RTC that owns one or more execution contexts is
+ * known as an autonomous RTC. An autonomous RTC and some subset of
+ * the RTCs within it (to be defined by the application developer)
+ * shall be executed by the infrastructure according to the context’
+ * s execution kind, which defines when each RTC’s operations will
+ * be invoked when and in which order. These RTCs are said to
+ * participate in the context. The available execution kinds are
+ * described in Section 5.2.2.7. The relationship between RTCs and
+ * execution contexts may be many-to-many in the general case:
+ * multiple RTCs may be invoked from the same execution context, and
+ * a single RTC may be invoked from multiple contexts. In the case
+ * where multiple RTCs are invoked from the same context, starting
+ * or stopping the context shall result in the corresponding
+ * lifecycle transitions for all of those components.
+ *
+ * @section Logical and Physical Threads
+ *
+ * Although an execution context represents a logical thread of
+ * control, the choice of how it maps to a physical thread shall be
+ * left to the application’s deployment
+ * environment. Implementations may elect to associate contexts with
+ * threads with a one-to-one mapping, to serve multiple contexts
+ * from a single thread, or by any other means. In the case where a
+ * given RTC may be invoked from multiple contexts, concurrency
+ * management is implementation-dependent.
+ *
+ * @endif
+ */
+ interface ExecutionContext
+ {
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief is_running
+ * @section Description
+ *
+ * This operation shall return true if the context is in the
+ * Running state.
+ *
+ * @section Semantics
+ *
+ * While the context is Running, all Active RTCs participating in
+ * the context shall be executed according to the context’s
+ * execution kind.
+ *
+ * @endif
+ */
+ boolean is_running();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ *
+ * @brief start
+ *
+ * @section Description
+ *
+ * Request that the context enter the Running state. Once the
+ * state transition occurs, the ComponentAction::on_startup
+ * operation (see Section 5.2.2.4.3) will be invoked. @section *
+ *
+ * @section Semantics
+ *
+ * An execution context may not be started
+ * until the RT components that participate in it have been
+ * initialized. An execution context may be started and stopped
+ * multiple times.
+ *
+ * @section Constraints
+ *
+ * - This operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET if the context is not in the
+ * Stopped state.
+ *
+ * - This operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET if any of the participating
+ * components are not in their Alive state.
+ *
+ * @endif
+ */
+ ReturnCode_t start();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief stop
+ *
+ * @section Description
+ *
+ * Request that the context enter the Stopped state. Once the
+ * transition occurs, the ComponentAction::on_shutdown operation
+ * (see Section 5.2.2.4.4) will be invoked.
+ *
+ * @section Semantics
+ *
+ * An execution context must be stopped before the RT components
+ * that participate in it are finalized.
+ *
+ * An execution context may be started and stopped multiple times.
+ *
+ * @section Constraints
+ *
+ * - This operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET if the context is not in the
+ * Running state.
+ *
+ * @endif
+ */
+ ReturnCode_t stop();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_rate
+ *
+ * @section Description
+ *
+ * This operation shall return the rate (in hertz) at which its
+ * Active participating RTCs are being invoked.
+ *
+ * @section Semantics
+ *
+ * An implementation is permitted to perform some periodic or
+ * quasi-periodic processing within an execution context with an
+ * ExecutionKind other than PERIODIC. In such a case, the result
+ * of this operation is implementation-defined. If no periodic
+ * processing of any kind is taking place within the context, this
+ * operation shall fail as described in Section 5.2.1.
+ *
+ * @section Constraints
+ *
+ * - If the context has an ExecutionKind of PERIODIC, this
+ * operation shall return a rate greater than zero.
+ *
+ * @endif
+ */
+ double get_rate();
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief set_rate
+ *
+ * @section Description
+ *
+ * This operation shall set the rate (in hertz) at which this
+ * context’s Active participating RTCs are being called.
+ *
+ * @section Semantics
+ *
+ * If the execution kind of the context is PERIODIC, a rate change
+ * shall result in the invocation of on_rate_changed on any RTCs
+ * realizing DataFlowComponentAction that are registered with any
+ * RTCs participating in the context. An implementation is
+ * permitted to perform some periodic or quasi-periodic processing
+ * within an execution context with an ExecutionKind other than
+ * PERIODIC. If such is the case, and the implementation reports a
+ * rate from get_rate, this operation shall set that rate
+ * successfully provided that the given rate is valid. If no
+ * periodic processing of any kind is taking place within the
+ * context, this operation shall fail with
+ * ReturnCode_t::UNSUPPORTED.
+ *
+ * @section Constraints
+ *
+ * - The given rate must be greater than zero. Otherwise, this
+ * operation shall fail with ReturnCode_t::BAD_PARAMETER.
+ *
+ * @endif
+ */
+ ReturnCode_t set_rate(in double rate);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief add_component
+ *
+ * @section Description
+ *
+ * The operation causes the given RTC to begin participating in
+ * the execution context.
+ *
+ * @section Semantics
+ *
+ * The newly added RTC will receive a call to
+ * LightweightRTComponent::attach_context (see Section 5.2.2.2.5)
+ * and then enter the Inactive state.
+ *
+ * @section Constraints
+ *
+ * - If the ExecutionKind of this context is PERIODIC, the RTC
+ * must be a data flow component (see Section 5.3.1.1).
+ * Otherwise, this operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * - If the ExecutionKind of this context is EVENT_DRIVEN, the RTC
+ * must be an FSM participant (see Section 5.3.2.3). Otherwise,
+ * this operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * @endif
+ */
+ ReturnCode_t add_component(in LightweightRTObject comp);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief remove_component
+ *
+ * @section Description
+ *
+ * This operation causes a participant RTC to stop participating
+ * in the execution context.
+ *
+ * @section Semantics
+ *
+ * The removed RTC will receive a call to
+ * LightweightRTComponent::detach_context (see Section 5.2.2.2.6).
+ *
+ * @section Constraints
+ *
+ * - If the given RTC is not currently participating in the
+ * execution context, this operation shall fail with
+ * ReturnCode_t::BAD_PARAMETER.
+ *
+ * - An RTC must be deactivated before it can be removed from an
+ * execution context. If the given RTC is participating in the
+ * execution context but is still in the Active state, this
+ * operation shall fail with ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * @endif
+ */
+ ReturnCode_t remove_component(in LightweightRTObject comp);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief activate_component
+ *
+ * @section Description
+ *
+ * The given participant RTC is Inactive and is therefore not
+ * being invoked according to the execution context’s execution
+ * kind. This operation shall cause the RTC to transition to the
+ * Active state such that it may subsequently be invoked in this
+ * execution context.
+ *
+ * @section Semantics
+ *
+ * The callback on_activate shall be called as a result of calling
+ * this operation. This operation shall not return until the
+ * callback has returned, and shall result in an error if the
+ * callback does. The following figure is a non-normative example
+ * sequence diagram for activate_component.
+ *
+ * @section Constraints
+ *
+ * - An execution context can only activate its participant
+ * components. If the given RTC is not participating in the
+ * execution context, this operation shall fail with
+ * ReturnCode_t::BAD_PARAMETER.
+ *
+ * - An RTC that is in the Error state cannot be activated until
+ * after it has been reset. If the given RTC is in the Error
+ * state, this operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET.
+ *
+ * - This operation shall fail with ReturnCode_t::BAD_PARAMETER if
+ * the given component is not in its Alive state.
+ *
+ * @endif
+ */
+ ReturnCode_t activate_component(in LightweightRTObject comp);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief deactivate_component
+ *
+ * @section Description
+ *
+ * The given RTC is Active in the execution context. Cause it to
+ * transition to the Inactive state such that it will not be
+ * subsequently invoked from the context unless and until it is
+ * activated again.
+ *
+ * @section Semantics
+ *
+ * The callback on_deactivate shall be called as a result of
+ * calling this operation. This operation shall not return until
+ * the callback has returned, and shall result in an error if the
+ * callback does. The following figure is a non-normative example
+ * sequence diagram for deactivate_component.
+ *
+ * @section Constraints
+ *
+ * - An execution context can only deactivate its participant
+ * components. If the given RTC is not participating in the
+ * execution context, this operation shall fail with
+ * ReturnCode_t::BAD_PARAMETER.
+ *
+ * - This operation shall fail with ReturnCode_t::BAD_PARAMETER if
+ * the given component is not in its Alive state.
+ *
+ * @endif
+ */
+ ReturnCode_t deactivate_component(in LightweightRTObject comp);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief reset_component
+ *
+ * @section Description
+ *
+ * Attempt to recover the RTC when it is in Error.
+ *
+ * @section Semantics
+ *
+ * The ComponentAction::on_reset callback shall be invoked. This
+ * operation shall not return until the callback has returned, and
+ * shall result in an error if the callback does. If possible, the
+ * RTC developer should implement that callback such that the RTC
+ * may be returned to a valid state. * If this operation fails,
+ * the RTC will remain in Error.
+ *
+ * @section Constraints
+ *
+ * - An RTC may only be reset in an execution context in which it
+ * is in error. If the RTC is not in Error in the identified
+ * context, this operation shall fail with
+ * ReturnCode_t::PRECONDITION_NOT_MET. However, that failure shall
+ * not cause the RTC to enter the Error state.
+ *
+ * - An RTC may not be reset while in the Created state. Any
+ * attempt to invoke this operation while the RTC is in that state
+ * shall fail with ReturnCode_t::PRECONDITION_NOT_MET. However,
+ * that failure shall not cause the RTC to enter the Error state.
+ *
+ * @endif
+ */
+ ReturnCode_t reset_component(in LightweightRTObject comp);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_component_state
+ *
+ * @section Description
+ *
+ * This operation shall report the LifeCycleState of the given
+ * participant RTC.
+ *
+ * @section Constraints
+ *
+ * - The given RTC must be Alive.
+ *
+ * - The given RTC must be a participant in the target execution context.
+ *
+ * - The LifeCycleState returned by this operation shall be one of
+ * LifeCycleState::INACTIVE, ACTIVE, or ERROR.
+ *
+ * @endif
+ */
+ LifeCycleState get_component_state(in LightweightRTObject comp);
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_kind
+ *
+ * @section Description
+ *
+ * This operation shall report the execution kind of the execution
+ * context.
+ *
+ * @endif
+ */
+ ExecutionKind get_kind();
+ };
+
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief DataFlowComponentAction
+ *
+ * @section Description
+ *
+ * DataFlowComponentAction is a companion to ComponentAction (see
+ * Section 5.2.2.4) that provides additional callbacks for
+ * intercepting the two execution passes defined in Section
+ * 5.3.1.1.2.
+ *
+ * @endif
+ */
+ interface DataFlowComponentAction
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_execute
+ * @section Description
+ *
+ * This operation will be invoked periodically at the rate of the
+ * given execution context as long as the following conditions
+ * hold:
+ *
+ * - The RTC is Active.
+ *
+ * - The given execution context is Running.
+ *
+ * @section Semantics
+ *
+ This callback occurs during the first execution pass.
+ *
+ * @section Constraints
+ *
+ * - The execution context of the given context shall be PERIODIC.
+ *
+ * @endif
+ */
+ ReturnCode_t on_execute(in ExecutionContextHandle_t exec_handle);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_state_update
+ *
+ * @section Description
+ *
+ * This operation will be invoked periodically at the rate of the
+ * given execution context as long as the following conditions hold:
+ *
+ * - The RTC is Active.
+ *
+ * - The given execution context is Running.
+ *
+ * @section Semantics
+ *
+ * This callback occurs during the second execution pass.
+ *
+ * @section Constraints
+ *
+ * - The execution context of the given context shall be PERIODIC.
+ *
+ *
+ * @endif
+ */
+ ReturnCode_t on_state_update(in ExecutionContextHandle_t exec_handle);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_rate_changed
+ *
+ * @section Description
+ *
+ * This operation is a notification that the rate of the indicated
+ * execution context (see Section 5.2.2.6.4) has changed.
+ *
+ * @section Constraints
+ *
+ * - The execution context of the given context shall be PERIODIC.
+ *
+ *
+ * @endif
+ */
+ ReturnCode_t on_rate_changed(in ExecutionContextHandle_t exec_handle);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief dataFlowComponent
+ *
+ * @section Description
+ *
+ * The dataFlowComponent stereotype may be applied to a component
+ * type to indicate that its instances should be executed in sorted
+ * order by a periodic execution context.
+ *
+ * @section Constraints
+ *
+ * - An instance of a component extended by the dataFlowComponent
+ * stereotype must participate in at least one * execution context
+ * of kind PERIODIC, which shall also be used for the execution of
+ * any contained data flow components.
+ *
+ * - A component extended by dataFlowComponent must realize the
+ * interface DataFlowComponentAction.
+ *
+ *
+ * @endif
+ */
+ interface DataFlowComponent
+ : LightweightRTObject, DataFlowComponentAction
+ {
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief fsm
+ *
+ * @section Description
+ *
+ * Applying the fsm stereotype to a component implies the ability to
+ * define component-specific states and transitions.
+ *
+ * @section Semantics
+ *
+ * In creating a state machine such as is depicted in Figure 5.22,
+ * the RTC developer is implicitly defining the Active state to be a
+ * submachine state. * The BehaviorStateMachines package described
+ * in [UML] is considered the normative definition of a state
+ * machine.
+ *
+ * @endif
+ */
+ interface Fsm
+ : LightweightRTObject
+ {
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief FsmParticipantAction
+ *
+ * @section Description
+ *
+ * FsmParticipantAction is companion to ComponentAction (see Section
+ * 5.2.2.4) that is intended for use with FSM participant RTCs. It
+ * adds a callback for the interception of state transitions, state
+ * entries, and state exits.
+ *
+ * @endif
+ */
+ interface FsmParticipantAction
+ {
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_action
+ *
+ * @section Description
+ *
+ * The indicated FSM participant RTC has been invoked as a result
+ * of a transition, state entry, or state exit in its containing
+ * FSM.
+ *
+ * @section Constraints
+ *
+ * - The given execution context shall be of kind EVENT_DRIVEN.
+ *
+ * @endif
+ */
+ ReturnCode_t on_action(in ExecutionContextHandle_t exec_handle);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief
+ * @endif
+ */
+ interface FsmParticipant
+ : LightweightRTObject, FsmParticipantAction
+ {
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief Mode
+ *
+ * @section Description
+ *
+ * Each mode defined by a given RTC shall be represented by an
+ * instance of Mode.
+ *
+ * @endif
+ */
+ interface Mode
+ {
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ModeCapable
+ *
+ * @section Description
+ *
+ * The ModeCapable interface provides access to an object’s modes
+ * and a means to set the current mode.
+ *
+ * @section Semantics
+ *
+ * A given RTC may support multiple modes as well as multiple
+ * execution contexts. In such a case, a request for a mode change
+ * (e.g., from "cruise control on" to "cruise control off") may
+ * come asynchronously with respect to one or more of those
+ * execution contexts. The mode of an RTC may therefore be observed
+ * to be different from one execution context to another. - A mode
+ * is pending in a given execution context when a mode change has
+ * been requested but the new mode has not yet been observed by that
+ * context.
+ *
+ * - The new mode has been committed in a given execution context
+ * when the context finally observes the new mode.
+ *
+ * - The new mode has stabilized once it has been committed in all
+ * execution contexts in which the RTC participates.
+ *
+ * Figure 5.26 depicts a state machine that describes mode
+ * changes. Each parallel region in the composite state Mode Pending
+ * represents an execution context. The trigger "sample" within
+ * that state is considered to have occurred: - …just before the
+ * next call to on_execute (see Section 5.3.1.2.1) in the case where
+ * immediate is false and the execution kind is PERIODIC, …
+ *
+ * - …just before the processing of the next stimulus in the case
+ * where immediate is false and the execution kind is
+ * EVENT_DRIVEN, or …- …immediately in all other cases.
+ *
+ * @endif
+ */
+ interface ModeCapable
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_default_mode
+ *
+ * @section Description
+ *
+ * This operation shall return the mode in which the RTC shall be
+ * when no other mode has been set.
+ *
+ * @section Constraints
+ *
+ * - This operation shall not return nil.
+ *
+ * @endif
+ */
+ Mode get_default_mode();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_current_mode
+ *
+ * @section Description
+ *
+ * This operation shall return the last mode to have
+ * stabilized. If no mode has been explicitly set, the current
+ * mode shall be the default mode.
+ *
+ * @section Constraints
+ *
+ * - This operation shall never return nil.
+ *
+ * @endif
+ */
+ Mode get_current_mode();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_current_mode_in_context
+ *
+ * @section Description
+ *
+ * This operation returns the current mode of the component as
+ * seen by the indicated execution context.
+ *
+ * @section Semantics
+ *
+ * The manner in which this property changes is described in Figure 5.26.
+ *
+ * @endif
+ */
+ Mode get_current_mode_in_context(in ExecutionContext exec_context);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_pending_mode
+ *
+ * @section Description
+ *
+ * This operation shall return the last mode to have been passed
+ * to set_mode that has not yet stabilized. Once the RTC’s mode
+ * has stabilized, this operation shall return nil.
+ *
+ * @endif
+ */
+ Mode get_pending_mode();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_pending_mode_in_context
+ *
+ * @section Description
+ *
+ * If the last mode to be requested by a call to set_mode is
+ * different than the current mode as seen by the indicated
+ * execution context (see get_current_mode_in_context), this
+ * operation returns the former. If the requested mode has already
+ * been seen in that context, it returns nil.
+ *
+ * @section Semantics
+ *
+ * See Figure 5.26 for a description of how the pending mode
+ * relates to the current mode within a given execution context.
+ *
+ * @endif
+ */
+ Mode get_pending_mode_in_context(in ExecutionContext exec_context);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief set_mode
+ *
+ * @section Description
+ *
+ * This operation shall request that the RTC change to the indicated mode.
+ *
+ * @section Semantics
+ *
+ * Usually, the new mode will be pending in each execution context
+ * in which the component executes until the next sample period
+ * (if the execution kind is PERIODIC); at that point it will
+ * become the current mode in that context and there will no
+ * longer be a pending mode. However, in some cases it is
+ * important for a mode change to take place immediately; for
+ * example, a serious fault has occurred and the component must
+ * enter an emergency mode to ensure fail-safe behavior in a
+ * safety-critical system. In such a case, immediate should be
+ * true and the mode change will take place in all contexts
+ * without waiting for the next sample period.
+ *
+ * @endif
+ */
+ ReturnCode_t set_mode(in Mode new_mode,
+ in boolean immediate);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief MultiModeComponentAction
+ *
+ * MultiModeComponentAction is a companion to ComponentAction that
+ is realized by RTCs that support multiple modes.
+ *
+ * @endif
+ */
+ interface MultiModeComponentAction
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief on_mode_changed
+ *
+ * @section Description
+ *
+ * This callback is invoked each time the observed mode of a
+ * component has changed with respect to a particular execution
+ * context.
+ *
+ * @section Semantics
+ *
+ * If the context is PERIODIC, this callback shall come before the
+ * next call to on_execute (see Section 5.3.1.2.1) within that
+ * context. The new mode can be retrieved with
+ * get_current_mode_in_context. If the result is the same as the
+ * result of get_current_mode, the mode has stabilized.
+ *
+ * @endif
+ */
+ ReturnCode_t on_mode_changed(in ExecutionContextHandle_t exec_handle);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief
+ * @endif
+ */
+ interface MultiModeObject
+ : LightweightRTObject, ModeCapable, MultiModeComponentAction
+ {
+ };
+
+ interface RTObject;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief PortInterfacePolarity
+ *
+ * @section Description
+ *
+ * The PortInterfacePolarity enumeration identifies exposed
+ * interface instances as provided or required. @endif
+ */
+ enum PortInterfacePolarity
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief PROVIDED
+ *
+ * @section Description
+ *
+ * The target interface is provided as an output by the target
+ * port.
+ *
+ * @endif
+ */
+ PROVIDED,
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief REQUIRED
+ *
+ * @section Description
+ *
+ * The target interface is required as an input by the target port.
+ *
+ * @endif
+ */
+ REQUIRED
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief PortInterfaceProfile
+ *
+ * @section Description
+ *
+ * PortInterfaceProfile describes an instance of a particular
+ * interface as it is exposed by a particular port. These objects
+ * are referred to below as the "target interface" and "target
+ * port" respectively.
+ *
+ * @endif
+ */
+ struct PortInterfaceProfile
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief instance_name
+ *
+ * @section Description
+ *
+ * This attribute stores the name of the target interface instance.
+ *
+ * @endif
+ */
+ string instance_name;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief type_name
+ *
+ * @section Description
+ *
+ * This attribute stores the name of the target interface type.
+ *
+ * @endif
+ */
+ string type_name;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief polarity
+ *
+ * @section Description
+ *
+ * This attribute indicates whether the target interface instance
+ * is provided or required by the RTC.
+ *
+ * @endif
+ */
+ PortInterfacePolarity polarity;
+ };
+
+ typedef sequence<PortInterfaceProfile> PortInterfaceProfileList;
+
+ interface PortService;
+ typedef sequence<PortService> PortServiceList;
+ typedef sequence<RTObject> RTCList;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ConnectorProfile
+ *
+ * @section Description
+ *
+ * The ConnectorProfile contains information about a connection
+ * between the ports of collaborating RTCs.
+ *
+ * @endif
+ */
+ struct ConnectorProfile
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief name
+ *
+ * @section Description
+ *
+ * This attribute contains the name of this connection.
+ *
+ * @endif
+ */
+ string name;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief connector_id
+ *
+ * @section Description
+ *
+ * Each connector has a unique identifier that is assigned when
+ * connection is established. This attribute stores that
+ * identifier.
+ *
+ * @endif
+ */
+ UniqueIdentifier connector_id;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ports
+ *
+ * @section Description
+ *
+ * This field stores references to all ports connected by the
+ * target connector.
+ *
+ * @endif
+ */
+ PortServiceList ports;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief properties
+ *
+ * @section Description
+ *
+ * This attribute contains additional properties of the connection.
+ *
+ * @section Semantics
+ *
+ * This attribute provides implementations the opportunity to
+ * describe additional characteristics of a particular connection
+ * that are outside of the scope of this specification.
+ *
+ * @endif
+ */
+ NVList properties;
+ };
+
+ typedef sequence<ConnectorProfile> ConnectorProfileList;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief PortProfile
+ *
+ * @section Description
+ *
+ * A PortProfile describes a port of an RTC (referred to as the
+ * "target" RTC). This port is referred to as the "target" port.
+ * From this profile, other components and tools can obtain Port’s
+ * name, type, object reference, and so on.
+ *
+ * @endif
+ */
+ struct PortProfile
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief name
+ *
+ * @section Description
+ *
+ * This attribute contains the name of the target port.
+ *
+ * @section Semantics
+ *
+ * Ports owned by an RTC are distinguished by their
+ * names. Therefore, this name should be unique within the target
+ * RTC.
+ *
+ * @endif
+ */
+ string name;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief interfaces
+ *
+ * @section Description
+ *
+ * This attribute contains the name and polarity of each interface
+ * exposed by the target port.
+ *
+ * @endif
+ */
+ PortInterfaceProfileList interfaces;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief port_ref
+ *
+ * @section Description
+ *
+ * This attributes contains a reference to the target port.
+ *
+ * @endif
+ */
+ PortService port_ref;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief connector_profiles
+ *
+ * @section Description
+ *
+ * This attribute contains a collection of profiles describing the
+ * connections to the target port.
+ *
+ * @endif
+ */
+ ConnectorProfileList connector_profiles;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief owner
+ *
+ * @section Description
+ *
+ * This attribute contains a reference to the target RTC.
+ *
+ * @endif
+ */
+ RTObject owner;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief properties
+ *
+ * @section Description
+ *
+ * This attribute contains additional properties of the port.
+ *
+ * @section Semantics
+ *
+ * This attribute provides implementations the opportunity to
+ * describe additional characteristics of a particular port that
+ * are otherwise outside of the scope of this specification.
+ *
+ * @endif
+ */
+ NVList properties;
+ };
+
+ typedef sequence<PortProfile> PortProfileList;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief
+ * @endif
+ */
+ struct ExecutionContextProfile
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief kind
+ *
+ * @section Description
+ *
+ * This attribute stores the context’s ExecutionKind.
+ *
+ * @endif
+ */
+ ExecutionKind kind;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief rate
+ *
+ * @section Description
+ *
+ * This attribute stores execution rate.
+ *
+ * @section Semantics
+ *
+ * If the execution kind is not PERIODIC, the value here may not
+ * be valid (and should be negative in that case). See
+ * ExecutionContext::get_rate (see Section 5.2.2.6.4) and set_rate
+ * (see Section 5.2.2.6.5) for more information.
+ *
+ * @endif
+ */
+ double rate;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief owner
+ *
+ * @section Description
+ *
+ * This attribute stores a reference to the RTC that owns the context.
+ *
+ * @endif
+ */
+ RTObject owner;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief participants
+ *
+ * @section Description
+ *
+ * This attribute stores references to the context’s participant RTCs.
+ *
+ * @endif
+ */
+ RTCList participants;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief properties
+ *
+ * @section Description
+ *
+ * This attribute contains additional properties of the execution
+ * context.
+ *
+ * @section Semantics
+ *
+ * This attribute provides implementations the opportunity to
+ * describe additional characteristics of a particular execution
+ * context that are outside the scope of this specification.
+ *
+ * @endif
+ */
+ NVList properties;
+ };
+
+ typedef sequence<ExecutionContextProfile>
+ ExecutionContextProfileList;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief FsmObject
+ *
+ * @section Description
+ *
+ * The FsmObject interface allows programs to send stimuli to a
+ * finite state machine, possibly causing it to change states.
+ *
+ * @endif
+ */
+ interface FsmObject
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief send_stimulus
+ *
+ * @section Description
+ *
+ * Send a stimulus to an FSM that realizes this interface.
+ *
+ * @section Semantics
+ *
+ * If the stimulus corresponds to any outgoing transition of the
+ * current state, that transition shall be taken and the state
+ * shall change. Any FSM participants associated with the exit of
+ * the current state, the transition to the new state, or the
+ * entry to the new state shall be invoked. If the stimulus does
+ * not correspond to any such transition, this operation shall
+ * succeed but have no effect.
+ *
+ * If the given execution context is a non-nil reference to a
+ * context in which this FSM participates, the transition shall be
+ * executed in that context. If the argument is nil, the FSM shall
+ * choose an EVENT_DRIVEN context in which to execute the
+ * transition. If the argument is non-nil, but this FSM does not
+ * participate in the given context, this operation shall fail
+ * with * ReturnCode_t::BAD_PARAMETER.
+ *
+ * @section Constraints
+ *
+ * - The given execution context shall be of kind EVENT_DRIVEN.
+ *
+ * @endif
+ */
+ ReturnCode_t send_stimulus(in string message,
+ in ExecutionContextHandle_t exec_handle);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief FsmBehaviorProfile
+ *
+ * @section Description
+ *
+ * FsmBehaviorProfile represents the association of an FSM
+ * participant with a transition, state entry, or state exit in an
+ * FSM.
+ *
+ * @section Semantics
+ *
+ * The assignment of identifiers to particular transitions, state
+ * entries, or state exits is implementation-dependent.
+ *
+ * @endif
+ */
+ struct FsmBehaviorProfile
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief action_component
+ *
+ * @section Description
+ *
+ * This attribute stores a reference to the FSM participant that
+ * is invoked when the containing Fsm receives a message
+ * distinguished by id.
+ *
+ * @endif
+ */
+ FsmParticipantAction action_component;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief id
+ *
+ * @section Description
+ *
+ * This attribute stores the message identifier.
+ *
+ * @endif
+ */
+ UniqueIdentifier id;
+ };
+
+ typedef sequence<FsmBehaviorProfile> FsmBehaviorProfileList;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief FsmProfile
+ *
+ * @section Description
+ *
+ * The FsmProfile describes the correspondence between an FSM and
+ * its contained FSM participants. This Profile is necessary for
+ * Stimulus Response Processing.
+ *
+ * @endif
+ */
+ struct FsmProfile
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief behavior_profiles
+ *
+ * @section Description
+ *
+ * This attribute lists the correspondences between an FSM and its
+ * contained FSM participants.
+ *
+ * @endif
+ */
+ FsmBehaviorProfileList behavior_profiles;
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief FsmService
+ *
+ * @section Description
+ *
+ * The FsmService interface defines operations necessary for
+ * Stimulus Response Processing as an SDO service.
+ *
+ * @endif
+ */
+ interface FsmService
+ : SDOPackage::SDOService
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_fsm_profile
+ *
+ * @section Description
+ *
+ * Get the current state of the FSM.
+ *
+ * @section Semantics
+ *
+ * Modifications to the object returned by this operation will not
+ * be reflected in the FSM until and unless set_fsm_profile is
+ * called.
+ *
+ * @endif
+ */
+ FsmProfile get_fsm_profile();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief set_fsm_profile
+ *
+ * @section Description
+ *
+ * This operation will be used to modify the behavior of an FSM as
+ * described in Stimulus Response Processing.
+ *
+ * @endif
+ */
+ ReturnCode_t set_fsm_profile(in FsmProfile fsm_profile);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ComponentProfile
+ *
+ * @section Description
+ *
+ * ComponentProfile represents the static state of an RTC that is
+ * referred to here as the "target" RTC.
+ *
+ * @endif
+ */
+ struct ComponentProfile
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief instance_name
+ *
+ * @section Description
+ *
+ * This attribute shall contain the name of the target RTC instance.
+ *
+ * @section Semantics
+ *
+ * The instance_name should be unique among RTC instances
+ * contained within the same containing component.
+ *
+ * @endif
+ */
+ string instance_name;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief type_name
+ *
+ * @section Description
+ *
+ * This attribute shall contain the name of the target RTC class.
+ *
+ * @section Semantics
+ *
+ * Each RTC class must have a name that is unique within an
+ * application.
+ *
+ * @endif
+ */
+ string type_name;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief description
+ *
+ * @section Description
+ *
+ * This attribute shall briefly describe the target RTC for the
+ * benefit of a human operator.
+ *
+ * @endif
+ */
+ string description;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief version
+ *
+ * @section Description
+ *
+ * This attribute shall contain the version number of the target
+ * RTC class.
+ *
+ * @section Semantics
+ *
+ * The format of the version number is outside of the scope of
+ * this specification.
+ *
+ * @endif
+ */
+ string version;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief vendor
+ *
+ * @section Description
+ *
+ * The name of the individual or organization that produced the
+ * target RTC class.
+ *
+ * @endif
+ */
+ string vendor;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief category
+ *
+ * @section Description
+ *
+ * This attribute contains the name of a "category" or group to
+ * which the target RTC belongs.
+ *
+ *
+ * @endif
+ */
+ string category;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief port_profiles
+ *
+ * @section Description
+ *
+ * This attribute contains a list of PortProfiles that describe
+ * the ports of the target RTC.
+ *
+ * @section Semantics
+ *
+ * There shall be a one-to-one correspondence between the members
+ * of this list and the ports of the target RTC.
+ *
+ *
+ * @endif
+ */
+ PortProfileList port_profiles;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief parent
+ *
+ * @section Description
+ *
+ * This attribute contains a reference to the RTC that contains
+ * the target RTC instance. If the target RTC instance is not
+ * owned by any other RTC, this field stores a nil reference.
+ *
+ * @endif
+ */
+ RTObject parent;
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief properties
+ *
+ * @section Description
+ *
+ * This attribute contains additional properties of the target RTC.
+ *
+ * @section Semantics
+ *
+ * This attribute provides implementations the opportunity to
+ * describe additional characteristics of a particular RTC that
+ * are otherwise outside of the scope of this specification.
+ *
+ * @endif
+ */
+ NVList properties;
+ };
+
+ typedef sequence<ComponentProfile> ComponentProfileList;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief PortService
+ *
+ * @section Description
+ *
+ * An instance of the PortService interface represents a port (i.e.,
+ * UML::Composite Structures::Ports::Port) of an RTC. It provides
+ * operations that allow it to be connected to and disconnected from
+ * other ports.
+ *
+ * @section Semantics
+ *
+ * A port service can support unidirectional or bidirectional
+ * communication. A port service may allow for a service-oriented
+ * connection, in which other connected ports, invoke methods on
+ * it. It may also allow for a data-centric connection, in which
+ * data values are streamed in or out. In either case, the
+ * connection is described by an instance of
+ * ConnectorProfile. However, the behavioral contracts of such
+ * connections are dependent on the interfaces exposed by the ports
+ * and are not described normatively by this specification.
+ *
+ * @endif
+ */
+ interface PortService
+ : SDOPackage::SDOService
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_port_profile
+ *
+ * @section Description
+ *
+ * This operation returns the PortProfile of the PortService.
+ *
+ * @endif
+ */
+ PortProfile get_port_profile();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_connector_profiles
+ *
+ * @section Description
+ *
+ * This operation returns a list of the ConnectorProfiles of the
+ * PortService.
+ *
+ * @endif
+ */
+ ConnectorProfileList get_connector_profiles();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_connector_profiles
+ *
+ * @section Description
+ *
+ * This operation returns a list of the ConnectorProfiles of the
+ * PortService.
+ *
+ * @endif
+ */
+ ConnectorProfile get_connector_profile(in UniqueIdentifier connector_id);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief connect
+ *
+ * @section Description
+ *
+ * This operation establishes connection between this port and the
+ * peer ports according to given ConnectionProfile.
+ *
+ * @section Semantics
+ *
+ * A ConnectorProfile has a sequence of port references. This port
+ * invokes the notify_connect operation of one of the ports
+ * included in the sequence. It follows that the notification of
+ * connection is propagated by the notify_connect operation with
+ * ConnectorProfile. This operation returns ConnectorProfile
+ * return value and returns ReturnCode_t as return codes.
+ *
+ * @endif
+ */
+ ReturnCode_t connect(inout ConnectorProfile connector_profile);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief disconnect
+ *
+ * @section Description
+ *
+ * This operation destroys the connection between this port and
+ * its peer ports using the ID that was given when the connection
+ * was established.
+ *
+ * @section Semantics
+ *
+ * This port invokes the notify_disconnect operation of one of the
+ * ports included in the sequence of the ConnectorProfile stored
+ * when the connection was established. The notification of
+ * disconnection is propagated by the notify_disconnect operation.
+ *
+ * @endif
+ */
+ ReturnCode_t disconnect(in UniqueIdentifier connector_id);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief disconnect_all
+ *
+ * @section Description
+ *
+ * This operation destroys all connection channels owned by the
+ * PortService.
+ *
+ * @endif
+ */
+ ReturnCode_t disconnect_all();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief notify_connect
+ *
+ * @section Description
+ *
+ * This operation notifies this PortService of the connection
+ * between its corresponding port and the other ports and
+ * propagates the given ConnectionProfile.
+ *
+ * @section Semantics
+ *
+ * A ConnectorProfile has a sequence of port references. This
+ * PortService stores the ConnectorProfile and invokes the
+ * notify_connect operation of the next PortService in the
+ * sequence. As ports are added to the connector, PortService
+ * references are added to the ConnectorProfile and provided to
+ * the caller. In this way, notification of connection is
+ * propagated with the ConnectorProfile.
+ *
+ * @endif
+ */
+ ReturnCode_t notify_connect(inout ConnectorProfile connector_profile);
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief notify_disconnect
+ *
+ * @section Description
+ *
+ * This operation notifies a PortService of a disconnection
+ * between its corresponding port and the other ports. The
+ * disconnected connector is identified by the given ID, which was
+ * given when the connection was established.
+ *
+ * @section Semantics
+ *
+ * This port invokes the notify_disconnect operation of the next
+ * PortService in the sequence of the ConnectorProfile that was
+ * stored when the connection was established. As ports are
+ * disconnected, PortService references are removed from the
+ * ConnectorProfile. In this way, the notification of
+ * disconnection is propagated by the notify_disconnect operation.
+ *
+ * @endif
+ */
+ ReturnCode_t notify_disconnect(in UniqueIdentifier connector_id);
+ };
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief ExecutionContextService
+ *
+ * @section Description
+ *
+ * An ExecutionContextService exposes an ExecutionContext as an SDO
+ * service such that the context may be controlled remotely.
+ *
+ * @section Semantics
+ *
+ * Depending on the implementation, this interface may itself be an
+ * execution context (that is, it may be passed to the operations of
+ * ComponentAction) or it may represent a remote execution context
+ * that is not of type ExecutionContextService. @endif
+ */
+ interface ExecutionContextService
+ : ExecutionContext, SDOPackage::SDOService
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_profile
+ *
+ * @section Description
+ *
+ * This operation provides a profile "descriptor" for the
+ * execution context.
+ *
+ * @endif
+ */
+ ExecutionContextProfile get_profile();
+ };
+
+ typedef sequence<ExecutionContextService>
+ ExecutionContextServiceList;
+
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief RTObject
+ *
+ * @section Description
+ *
+ * The RTObject interface defines the operations that all SDO-based
+ * RTCs must provide. It is required by the rtComponent stereotype.
+ *
+ * @endif
+ */
+ interface RTObject
+ : LightweightRTObject, SDOPackage::SDO
+ {
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_component_profile
+ *
+ * @section Description
+ *
+ * This operation returns the ComponentProfile of the RTC.
+ *
+ * @endif
+ */
+ ComponentProfile get_component_profile();
+ /*!
+ * @if jp
+ * @brief
+ * @else
+ * @brief get_ports
+ *
+ * @section Description
+ *
+ * This operation returns a list of the RTCs ports.
+ *
+ * @endif
+ */
+ PortServiceList get_ports();
+ };
+};
+
Added: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/SDOPackage.idl
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/SDOPackage.idl (rev 0)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/SDOPackage.idl 2011-07-08 15:22:06 UTC (rev 416)
@@ -0,0 +1,294 @@
+//Platform Independent Model (PIM) and Platform Specific Model (PSM)
+//for Super Distributed Objects (SDO) Specification, v1.1 - OMG IDL Summary File
+//Object Management Group, Inc.
+//Copyright (c) 2003, Fraunhofer FOKUS
+//Copyright (c) 2003, Hitachi, Ltd.
+//The companies listed above have granted to the Object Management Group, Inc.
+//(OMG) a nonexclusive, royalty-free, paid up, worldwide license to copy and
+//distribute this document and to modify this document and distribute copies of
+//the modified version. Each of the copyright holders listed above has agreed
+//that no person shall be deemed to have infringed the copyright in the included
+//material of any such copyright holder by reason of having used the
+//specification set forth herein or having conformed any computer software to
+//the specification.
+//
+//This file contains OMG IDL from the Naming Service Specification, v1.2.
+//OMG regularly publishes a summary file that contains all the "code" parts of
+//an OMG formal document. Every formal document line that is IDL, PIDL, or
+//language code is included in the summary file. The reason for such a listing
+//is to give readers an electronic version of the "code" so that they can
+//extract pieces of it. Readers might want to test an example, include it in
+//their own code, or use it for documentation purposes. Having the code lines
+//available electronically means there is less likelihood of a transcription
+//error.
+//
+// ver 1.0 formal/2004-11-02
+// ver 1.1 (RTF report: dtc/2008-03-05)
+//
+//SDOPackage.idl
+
+#ifndef _SDO_PACKAGE_IDL_
+#define _SDO_PACKAGE_IDL_
+
+#ifdef TAO_IDL
+#include <orb.idl>
+#endif
+#ifdef USE_MONITORING
+#include <CosNotifyComm.idl>
+#endif
+#ifndef ORBIT2_IDL
+#define TypeCode CORBA::TypeCode
+#endif
+/** CORBA specific model for SDOs */
+
+#pragma prefix "org.omg"
+#define exception_body { string description; }
+
+module SDOPackage
+{
+ interface SDO;
+ interface SDOService;
+ interface SDOSystemElement;
+ interface Configuration;
+ interface Monitoring;
+ interface Organization;
+
+ /** ------- Data Types -------*/
+ typedef sequence<string> StringList;
+ typedef sequence<SDO> SDOList;
+ typedef sequence<Organization> OrganizationList;
+ typedef string UniqueIdentifier;
+
+ struct NameValue
+ {
+ string name;
+ any value;
+ };
+
+ typedef sequence<NameValue> NVList;
+
+ enum NumericType
+ {
+ SHORT_TYPE,
+ LONG_TYPE,
+ FLOAT_TYPE,
+ DOUBLE_TYPE
+ };
+
+ union Numeric switch (NumericType)
+ {
+ case SHORT_TYPE: short short_value;
+ case LONG_TYPE: long long_value;
+ case FLOAT_TYPE: float float_value;
+ case DOUBLE_TYPE: double double_value;
+ };
+
+ struct EnumerationType
+ {
+ StringList enumerated_values;
+ };
+
+ struct RangeType
+ {
+ Numeric min;
+ Numeric max;
+ boolean min_inclusive;
+ boolean max_inclusive;
+ };
+
+ struct IntervalType
+ {
+ Numeric min;
+ Numeric max;
+ boolean min_inclusive;
+ boolean max_inclusive;
+ Numeric step;
+ };
+
+ enum ComplexDataType
+ {
+ ENUMERATION, RANGE, INTERVAL
+ };
+
+ union AllowedValues switch (ComplexDataType)
+ {
+ case ENUMERATION: EnumerationType allowed_enum;
+ case INTERVAL: IntervalType allowed_interval;
+ case RANGE: RangeType allowed_range;
+ };
+
+ struct Parameter
+ {
+ string name;
+ TypeCode type;
+ AllowedValues allowed_values;
+ };
+
+ typedef sequence<Parameter> ParameterList;
+ struct OrganizationProperty
+ {
+ NVList properties;
+ };
+ enum DependencyType
+ {
+ OWN,
+ OWNED,
+ NO_DEPENDENCY
+ };
+
+ struct DeviceProfile
+ {
+ string device_type;
+ string manufacturer;
+ string model;
+ string version;
+ NVList properties;
+ };
+
+ struct ServiceProfile
+ {
+ string id;
+ string interface_type;
+ NVList properties;
+ SDOService service;
+ };
+
+ typedef sequence <ServiceProfile> ServiceProfileList;
+ struct ConfigurationSet
+ {
+ string id;
+ string description;
+ NVList configuration_data;
+ };
+
+ typedef sequence<ConfigurationSet> ConfigurationSetList;
+
+
+ /** ------- Exceptions -------*/
+ exception NotAvailable exception_body;
+ exception InterfaceNotImplemented exception_body;
+ exception InvalidParameter exception_body;
+ exception InternalError exception_body;
+
+ /** ------- Interfaces -------*/
+ interface SDOSystemElement
+ {
+ OrganizationList get_owned_organizations()
+ raises (NotAvailable,InternalError);
+ };
+ interface SDO : SDOSystemElement
+ {
+ UniqueIdentifier get_sdo_id()
+ raises (NotAvailable, InternalError);
+ string get_sdo_type()
+ raises (NotAvailable, InternalError);
+ DeviceProfile get_device_profile ()
+ raises (NotAvailable, InternalError);
+ ServiceProfileList get_service_profiles ()
+ raises (NotAvailable, InternalError);
+ ServiceProfile get_service_profile (in UniqueIdentifier id)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ SDOService get_sdo_service (in UniqueIdentifier id)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ Configuration get_configuration ()
+ raises (InterfaceNotImplemented, NotAvailable, InternalError);
+ Monitoring get_monitoring ()
+ raises (InterfaceNotImplemented, NotAvailable, InternalError);
+ OrganizationList get_organizations ()
+ raises (NotAvailable, InternalError);
+ NVList get_status_list ()
+ raises (NotAvailable, InternalError);
+ any get_status (in string nme)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ };
+
+
+ interface Configuration
+ {
+ boolean set_device_profile (in DeviceProfile dProfile)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean add_service_profile (in ServiceProfile sProfile)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean add_organization (in Organization organization_object)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean remove_service_profile (in UniqueIdentifier id)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean remove_organization (in UniqueIdentifier organization_id)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ ParameterList get_configuration_parameters ()
+ raises (NotAvailable, InternalError);
+ NVList get_configuration_parameter_values ()
+ raises (NotAvailable, InternalError);
+ any get_configuration_parameter_value (in string name)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean set_configuration_parameter (in string name,
+ in any value)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ ConfigurationSetList get_configuration_sets ()
+ raises (NotAvailable, InternalError);
+ ConfigurationSet get_configuration_set (in UniqueIdentifier config_id)
+ raises (NotAvailable, InternalError);
+ boolean set_configuration_set_values (in ConfigurationSet configuration_set)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ ConfigurationSet get_active_configuration_set ()
+ raises (NotAvailable, InternalError);
+ boolean add_configuration_set (in ConfigurationSet configuration_set)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean remove_configuration_set (in UniqueIdentifier config_id)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean activate_configuration_set (in UniqueIdentifier config_id)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ };
+
+
+#ifdef USE_MONITORING
+ interface Monitoring : CosNotifyComm::StructuredPushConsumer,
+ CosNotifyComm::StructuredPushSupplier
+ {
+ any get_monitoring_parameter_value (in string name)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ ParameterList get_monitoring_parameters ()
+ raises (NotAvailable, InternalError);
+ NVList get_monitoring_parameter_values ()
+ raises (NotAvailable, InternalError);
+ };
+#else
+ interface Monitoring {};
+#endif
+
+ interface SDOService {};
+
+ interface Organization
+ {
+ UniqueIdentifier get_organization_id ()
+ raises (InvalidParameter, NotAvailable, InternalError);
+ OrganizationProperty get_organization_property ()
+ raises (NotAvailable, InternalError);
+ any get_organization_property_value (in string name)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean add_organization_property (in OrganizationProperty organization_property)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean set_organization_property_value (in string name,
+ in any value)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean remove_organization_property ( in string name )
+ raises (InvalidParameter, NotAvailable, InternalError);
+ SDOSystemElement get_owner ()
+ raises (NotAvailable, InternalError);
+ boolean set_owner (in SDOSystemElement sdo)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ SDOList get_members ()
+ raises (NotAvailable, InternalError);
+ boolean set_members (in SDOList sdos)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean add_members ( in SDOList sdo_list)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ boolean remove_member (in UniqueIdentifier id)
+ raises (InvalidParameter, NotAvailable, InternalError);
+ DependencyType get_dependency()
+ raises (NotAvailable, InternalError);
+ boolean set_dependency (in DependencyType dependency)
+ raises (NotAvailable, InternalError);
+ };
+};
+#endif //_SDO_PACKAGE_IDL_
Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/test_RTObject.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/test_RTObject.py 2011-06-16 07:03:44 UTC (rev 415)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/test/test_RTObject.py 2011-07-08 15:22:06 UTC (rev 416)
@@ -20,11 +20,11 @@
sys.path.insert(1,"../RTM_IDL")
import RTC
+import OpenRTM
import SDOPackage
import OpenRTM_aist
from omniORB import CORBA, PortableServer
from omniORB import any
-
import unittest
configsample_spec = ["implementation_id", "TestComp",
@@ -108,6 +108,30 @@
com = manager.createComponent("TestComp")
+class MySdoServiceProviderBase(OpenRTM_aist.SdoServiceProviderBase):
+ def __init__(self):
+ self._profile = None
+ self._rtobj = None
+ return
+
+ def __del__(self):
+ return
+
+ def init(self, rtobj, profile):
+ self._rtobj = rtobj
+ self._profile = profile
+ return
+
+ def reinit(self, profile):
+ return
+
+ def getProfile(self):
+ return self._profile
+
+ def finalize(self):
+ return
+
+
class TestRTObject_impl(unittest.TestCase):
def setUp(self):
self._orb = CORBA.ORB_init(sys.argv)
@@ -291,9 +315,429 @@
rtobj.finalizePorts()
return
+ # since 1.1.0
+ def test_getExecutionContext(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ self.assertNotEqual(rtobj.getExecutionContext(0),None)
+ return
+ def test_getExecutionRate(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ self.assertNotEqual(rtobj.getExecutionRate(0),1000)
+ return
+ def test_setExecutionRate(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ self.assertEqual(rtobj.setExecutionRate(0,10000),RTC.RTC_OK)
+ self.assertEqual(rtobj.getExecutionRate(0),10000.0)
+ return
+ def test_isOwnExecutionContext(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ self.assertEqual(rtobj.isOwnExecutionContext(0),True)
+ return
+
+ def test_activate_deactivate(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ self.assertEqual(rtobj.activate(0),RTC.RTC_OK)
+ ec.start()
+ time.sleep(0.1)
+ self.assertEqual(rtobj.deactivate(0),RTC.RTC_OK)
+ ec.stop()
+ return
+
+ def test_reset(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ self.assertEqual(rtobj.activate(0),RTC.RTC_OK)
+ ec.start()
+ ec._comps[0]._sm._sm.goTo(RTC.ERROR_STATE)
+ time.sleep(0.1)
+ self.assertEqual(rtobj.reset(0),RTC.RTC_OK)
+ ec.stop()
+ return
+
+ def test_addRemoveSdoServiceProvider(self):
+ rtobj = TestComp(self._orb, self._poa)
+ prof = SDOPackage.ServiceProfile("id","interface_type",
+ OpenRTM_aist.NVUtil.newNV("test","any"),
+ SDOPackage.SDOService._nil)
+ prov = MySdoServiceProviderBase()
+ prov.init(rtobj,prof)
+ self.assertEqual(rtobj.addSdoServiceProvider(prof, prov),True)
+ self.assertEqual(rtobj.removeSdoServiceProvider("id"),True)
+ return
+
+ def test_addRemoveSdoServiceConsumer(self):
+ import MySdoServiceConsumer
+ OpenRTM_aist.Manager.instance().load("MySdoServiceConsumer.py",
+ "MySdoServiceConsumerInit")
+ rtobj = TestComp(self._orb, self._poa)
+ prof = SDOPackage.ServiceProfile(OpenRTM_aist.toTypename(OpenRTM.ComponentObserver),OpenRTM_aist.toTypename(OpenRTM.ComponentObserver),
+ [OpenRTM_aist.NVUtil.newNV("test","any")],
+ SDOPackage.SDOService._nil)
+ self.assertEqual(rtobj.addSdoServiceConsumer(prof),True)
+ self.assertEqual(rtobj.removeSdoServiceConsumer(OpenRTM_aist.toTypename(OpenRTM.ComponentObserver)),True)
+ return
+
+ def prelistenerFunc(self, id):
+ print "prelistenerFunc called !!!!"
+ return
+
+ def test_addRemovePreComponentActionListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addPreComponentActionListener(OpenRTM_aist.PreComponentActionListenerType.PRE_ON_INITIALIZE,
+ self, self.prelistenerFunc)
+
+ rtobj.removePreComponentActionListener(OpenRTM_aist.PreComponentActionListenerType.PRE_ON_INITIALIZE,
+ self.prelistenerFunc)
+
+ rtobj.addPreComponentActionListener(OpenRTM_aist.PreComponentActionListenerType.PRE_ON_FINALIZE,
+ self, self.prelistenerFunc)
+
+ rtobj.removePreComponentActionListener(OpenRTM_aist.PreComponentActionListenerType.PRE_ON_FINALIZE,
+ self.prelistenerFunc)
+ return
+
+ def postlistenerFunc(self, id, ret):
+ print "postlistenerFunc called !!!!"
+ return
+
+ def test_addRemovePostComponentActionListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addPostComponentActionListener(OpenRTM_aist.PostComponentActionListenerType.POST_ON_FINALIZE,
+ self, self.postlistenerFunc)
+
+ rtobj.removePostComponentActionListener(OpenRTM_aist.PostComponentActionListenerType.POST_ON_FINALIZE,
+ self.postlistenerFunc)
+ return
+
+ def test_addRemovePortActionListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addPortActionListener(OpenRTM_aist.PortActionListenerType.ADD_PORT,
+ self, self.prelistenerFunc)
+
+ rtobj.removePortActionListener(OpenRTM_aist.PortActionListenerType.ADD_PORT,
+ self.prelistenerFunc)
+ return
+
+ def test_addRemoveExecutionContextActionListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addExecutionContextActionListener(OpenRTM_aist.ExecutionContextActionListenerType.EC_ATTACHED,
+ self, self.prelistenerFunc)
+
+ rtobj.removeExecutionContextActionListener(OpenRTM_aist.ExecutionContextActionListenerType.EC_ATTACHED,
+ self.prelistenerFunc)
+ return
+
+ def test_addRemovePortConnectListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addPortConnectListener(OpenRTM_aist.PortConnectListenerType.ON_NOTIFY_CONNECT,
+ self, self.postlistenerFunc)
+
+ rtobj.removePortConnectListener(OpenRTM_aist.PortConnectListenerType.ON_NOTIFY_CONNECT,
+ self.postlistenerFunc)
+ return
+
+ def portconretlistenerFunc(self, pname, cprof, ret):
+ print "portconretlistenerFunc called !!!!"
+ return
+
+ def test_addRemovePortConnectRetListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addPortConnectRetListener(OpenRTM_aist.PortConnectRetListenerType.ON_CONNECTED,
+ self, self.portconretlistenerFunc)
+
+ rtobj.removePortConnectRetListener(OpenRTM_aist.PortConnectRetListenerType.ON_CONNECTED,
+ self.portconretlistenerFunc)
+ return
+
+ def configparamlistenerFunc(self, pname, cprof, ret):
+ print "configparamlistenerFunc called !!!!"
+ return
+
+ def test_addRemoveConfigurationParamListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addConfigurationParamListener(OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM,
+ self, self.configparamlistenerFunc)
+
+ rtobj.removeConfigurationParamListener(OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM,
+ self.configparamlistenerFunc)
+ return
+
+ def test_addRemoveConfigurationSetListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addConfigurationSetListener(OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET,
+ self, self.prelistenerFunc)
+
+ rtobj.removeConfigurationSetListener(OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET,
+ self.prelistenerFunc)
+ return
+
+ def test_addRemoveConfigurationSetNameListener(self):
+ rtobj = TestComp(self._orb, self._poa)
+
+ rtobj.addConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET,
+ self, self.prelistenerFunc)
+
+ rtobj.removeConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET,
+ self.prelistenerFunc)
+ return
+
+ def test_shutdown(self):
+ return
+
+ def test_preOnInitialize(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ print "preOnInitialize()"
+ rtobj.preOnInitialize(0)
+ return
+
+ def test_preOnFinalize(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnFinalize(0)
+ return
+
+ def test_preOnStartup(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnStartup(0)
+ return
+
+ def test_preOnShutdown(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnShutdown(0)
+ return
+
+ def test_preOnActivated(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnActivated(0)
+ return
+
+ def test_preOnDeactivated(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnDeactivated(0)
+ return
+
+ def test_preOnAborting(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnAborting(0)
+ return
+
+ def test_preOnError(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnError(0)
+ return
+
+ def test_preOnReset(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnReset(0)
+ return
+
+ def test_preOnExecute(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnExecute(0)
+ return
+
+ def test_preOnStateUpdate(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnStateUpdate(0)
+ return
+
+ def test_preOnRateChanged(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.preOnRateChanged(0)
+ return
+
+ def test_postOnInitialize(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnInitialize(0,True)
+ return
+
+ def test_postOnFinalize(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnFinalize(0,True)
+ return
+
+ def test_postOnStartup(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnStartup(0,True)
+ return
+
+ def test_postOnShutdown(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnShutdown(0,True)
+ return
+
+ def test_postOnActivated(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnActivated(0,True)
+ return
+
+ def test_postOnDeactivated(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnDeactivated(0,True)
+ return
+
+ def test_postOnAborting(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnAborting(0,True)
+ return
+
+ def test_postOnError(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnError(0,True)
+ return
+
+ def test_postOnReset(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnReset(0,True)
+ return
+
+ def test_postOnExecute(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnExecute(0,True)
+ return
+
+ def test_postOnStateUpdate(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnStateUpdate(0,True)
+ return
+
+ def test_postOnRateChanged(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.postOnRateChanged(0,True)
+ return
+
+ def test_onAddPort(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.onAddPort(0)
+ return
+
+ def test_onRemovePort(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.onRemovePort(0)
+ return
+
+ def test_onAttachExecutionContext(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.onAttachExecutionContext(0)
+ return
+
+ def test_onDetachExecutionContext(self):
+ rtobj = TestComp(self._orb, self._poa)
+ ec_args = "PeriodicExecutionContext"+"?" + "rate=1000"
+ ec=OpenRTM_aist.Manager.instance().createContext(ec_args)
+ ec.bindComponent(rtobj)
+ rtobj.onDetachExecutionContext(0)
+ return
+
+
############### test #################
if __name__ == '__main__':
unittest.main()
openrtm-commit メーリングリストの案内