[openrtm-commit:00408] r476 - branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 9月 15日 (木) 18:52:39 JST


Author: kurihara
Date: 2011-09-15 18:52:39 +0900 (Thu, 15 Sep 2011)
New Revision: 476

Modified:
   branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py
Log:
Added listener about port-connection.

Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py	2011-09-15 09:51:49 UTC (rev 475)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py	2011-09-15 09:52:39 UTC (rev 476)
@@ -38,8 +38,22 @@
     print "------------------------------"
 
 
+class ConnListener(OpenRTM_aist.ConnectorListener):
+  def __init__(self, name):
+    self._name = name
 
+  def __del__(self):
+    print "dtor of ", self._name
 
+  def __call__(self, info):
+    print "------------------------------"
+    print "Listener:       ", self._name
+    print "Profile::name:  ", info.name
+    print "Profile::id:    ", info.id
+    print "------------------------------"
+
+
+
 class ConsoleOut(OpenRTM_aist.DataFlowComponentBase):
   def __init__(self, manager):
     OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
@@ -82,6 +96,11 @@
     self._inport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_ERROR,
                                           DataListener("ON_RECEIVER_ERROR"))
 
+    self._inport.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_CONNECT,
+                                      ConnListener("ON_CONNECT"))
+    self._inport.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_DISCONNECT,
+                                      ConnListener("ON_DISCONNECT"))
+
     return RTC.RTC_OK
 
   def onExecute(self, ec_id):



openrtm-commit メーリングリストの案内