Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import sys
00019
00020 from omniORB import CORBA, PortableServer
00021 import RTC
00022 import OpenRTM, OpenRTM__POA
00023 import SDOPackage
00024 import OpenRTM_aist
00025
00026 class ComponentObserver_i(OpenRTM__POA.ComponentObserver):
00027 def __init__(self):
00028 pass
00029
00030 def update_status(self, status_kind, hint):
00031 print "update_status: ", status_kind, ", ", hint
00032 return
00033
00034 def main():
00035 orb = CORBA.ORB_init(sys.argv)
00036 poa = orb.resolve_initial_references("RootPOA")
00037 poa._get_the_POAManager().activate()
00038 naming = OpenRTM_aist.CorbaNaming(orb, "localhost")
00039 servant = ComponentObserver_i()
00040 oid = poa.servant_to_id(servant)
00041 provider = poa.id_to_reference(oid)
00042
00043 rtc = naming.resolve("ConsoleIn0.rtc")._narrow(RTC.RTObject)
00044 config = rtc.get_configuration()
00045 properties = [OpenRTM_aist.NVUtil.newNV("heartbeat.enable","YES"),
00046 OpenRTM_aist.NVUtil.newNV("heartbeat.interval","10"),
00047 OpenRTM_aist.NVUtil.newNV("observed_status","ALL")]
00048
00049 id = OpenRTM_aist.toTypename(servant)
00050 sprof = SDOPackage.ServiceProfile("test_id", id,
00051 properties, provider)
00052
00053 ret = config.add_service_profile(sprof)
00054 flag = True
00055 print "If you exit program, please input 'q'."
00056 sys.stdin.readline()
00057 ret = config.remove_service_profile("test_id")
00058 print "test program end. ret : ", ret
00059 return
00060
00061
00062 if __name__ == '__main__':
00063 main()