Go to the documentation of this file.00001
00002
00003
00004
00005 import sys
00006
00007 from omniORB import CORBA
00008
00009 import RTC
00010 import OpenRTM_aist
00011
00012 def usage():
00013 print "usage: ConnectorComp [options]"
00014 print " python MyServiceProvider.py "
00015 print " python MyServiceConsumer.py "
00016 print " python Connector.py "
00017
00018
00019 def main():
00020
00021
00022 orb = CORBA.ORB_init(sys.argv)
00023
00024
00025 naming = OpenRTM_aist.CorbaNaming(orb, "localhost")
00026
00027 consumer = OpenRTM_aist.CorbaConsumer()
00028 provider = OpenRTM_aist.CorbaConsumer()
00029
00030
00031 consumer.setObject(naming.resolve("MyServiceConsumer0.rtc"))
00032
00033
00034 consobj = consumer.getObject()._narrow(RTC.RTObject)
00035 pcons = consobj.get_ports()
00036 pcons[0].disconnect_all()
00037
00038
00039
00040 provider.setObject(naming.resolve("MyServiceProvider0.rtc"))
00041
00042
00043 provobj = provider.getObject()._narrow(RTC.RTObject)
00044 prov = provobj.get_ports()
00045 prov[0].disconnect_all()
00046
00047
00048
00049 conprof = RTC.ConnectorProfile("connector0", "", [pcons[0],prov[0]], [])
00050
00051 ret = pcons[0].connect(conprof)
00052
00053
00054 eclistin = consobj.get_owned_contexts()
00055 eclistin[0].activate_component(consobj)
00056
00057
00058 eclistout = provobj.get_owned_contexts()
00059 eclistout[0].activate_component(provobj)
00060
00061
00062
00063 if __name__ == "__main__":
00064 main()