11 from omniORB
import CORBA
13 myserviceconsumer_spec = [
"implementation_id",
"MyServiceConsumer",
14 "type_name",
"MyServiceConsumer",
15 "description",
"MyService Consumer Sample component",
17 "vendor",
"Shinji Kurihara",
18 "category",
"example",
19 "activity_type",
"DataFlowComponent",
22 "lang_type",
"script",
34 print "No service connected." 44 OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
58 self._myServicePort.registerConsumer(
"myservice0",
"MyService", self.
_myservice0)
68 print "Command list: " 69 print " echo [msg] : echo message." 70 print " set_value [value]: set value." 71 print " get_value : get current value." 72 print " get_echo_history : get input messsage history." 73 print " get_value_history: get input value history." 76 args = str(sys.stdin.readline())
77 argv = string.split(args)
78 argv[-1] = argv[-1].rstrip(
"\n")
80 if self.
_async_echo and self._async_echo.finished():
81 print "echo() finished: ", self.
_result[0]
84 if argv[0] ==
"echo" and len(argv) > 1:
88 self.
_async_echo = OpenRTM_aist.Async_tInvoker(self._myservice0._ptr(),
90 self._async_echo.invoke()
92 print "echo() still invoking" 96 if argv[0] ==
"set_value" and len(argv) > 1:
98 self._myservice0._ptr().set_value(val)
99 print "Set remote value: ", val
102 if argv[0] ==
"get_value":
103 retval = self._myservice0._ptr().get_value()
104 print "Current remote value: ", retval
107 if argv[0] ==
"get_echo_history":
112 if argv[0] ==
"get_value_history":
117 print "Invalid command or argument(s)." 129 print self.
_cnt,
": ", val
136 manager.registerFactory(profile,
145 comp = manager.createComponent(
"MyServiceConsumer")
151 mgr = OpenRTM_aist.Manager.init(sys.argv)
155 mgr.setModuleInitProc(MyModuleInit)
158 mgr.activateManager()
169 if __name__ ==
"__main__":
def __init__(self, msg, result)
RT Conponent CORBA service/consumer Port.
def onExecute(self, ec_id)
def for_each(seq, f)
Apply the functor to all CORBA sequence elements.
def MyModuleInit(manager)
The Properties class represents a persistent set of properties.
def __init__(self, manager)
def MyServiceConsumerInit(manager)
DataFlowComponentBase class.