150 self.
_profile = RTC.PortProfile(
"", [], RTC.PortService._nil, [], RTC.RTObject._nil,[])
153 self.
_profile.name =
"unknown.unknown"
158 self.
_profile.owner = RTC.RTObject._nil
161 self.
_rtcout = OpenRTM_aist.Manager.instance().getLogbuf(name)
191 self.
_rtcout.RTC_TRACE(
"PortBase.__del__()")
193 mgr = OpenRTM_aist.Manager.instance().getPOA()
194 oid = mgr.servant_to_id(self)
195 mgr.deactivate_object(oid)
197 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
244 self.
_rtcout.RTC_TRACE(
"get_port_profile()")
250 prof = RTC.PortProfile(self.
_profile.name,
286 self.
_rtcout.RTC_TRACE(
"getPortProfile()")
332 self.
_rtcout.RTC_TRACE(
"get_connector_profiles()")
337 return self.
_profile.connector_profiles
367 self.
_rtcout.RTC_TRACE(
"get_connector_profile(%s)", connector_id)
375 conn_prof = RTC.ConnectorProfile(
"",
"",[],[])
378 conn_prof = RTC.ConnectorProfile(self.
_profile.connector_profiles[index].name,
379 self.
_profile.connector_profiles[index].connector_id,
380 self.
_profile.connector_profiles[index].ports,
381 self.
_profile.connector_profiles[index].properties)
544 self.
_rtcout.RTC_TRACE(
"connect()")
547 self.
setUUID(connector_profile)
553 self.
_rtcout.RTC_ERROR(
"Connection already exists.")
554 return (RTC.PRECONDITION_NOT_MET,connector_profile)
558 retval,connector_profile = connector_profile.ports[0].
notify_connect(connector_profile)
559 if retval != RTC.RTC_OK:
560 self.
_rtcout.RTC_ERROR(
"Connection failed. cleanup.")
561 self.
disconnect(connector_profile.connector_id)
563 return (retval, connector_profile)
566 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
567 return (RTC.BAD_PARAMETER, connector_profile)
569 return (RTC.RTC_ERROR, connector_profile)
689 self.
_rtcout.RTC_TRACE(
"notify_connect()")
694 retval = [RTC.RTC_OK
for i
in range(3)]
698 if retval[0] != RTC.RTC_OK:
699 self.
_rtcout.RTC_ERROR(
"publishInterfaces() in notify_connect() failed.")
706 retval[1], connector_profile = self.
connectNext(connector_profile)
707 if retval[1] != RTC.RTC_OK:
708 self.
_rtcout.RTC_ERROR(
"connectNext() in notify_connect() failed.")
716 if retval[2] != RTC.RTC_OK:
717 self.
_rtcout.RTC_ERROR(
"subscribeInterfaces() in notify_connect() failed.")
722 self.
_rtcout.RTC_PARANOID(
"%d connectors are existing",
723 len(self.
_profile.connector_profiles))
731 self.
_rtcout.RTC_PARANOID(
"New connector_id. Push backed.")
734 self.
_profile.connector_profiles[index] = connector_profile
735 self.
_rtcout.RTC_PARANOID(
"Existing connector_id. Updated.")
738 if ret != RTC.RTC_OK:
740 return (ret, connector_profile)
746 return (RTC.RTC_OK, connector_profile)
816 self.
_rtcout.RTC_TRACE(
"disconnect(%s)", connector_id)
821 self.
_rtcout.RTC_ERROR(
"Invalid connector id: %s", connector_id)
822 return RTC.BAD_PARAMETER
825 if index < len(self.
_profile.connector_profiles):
826 prof = self.
_profile.connector_profiles[index]
829 if len(prof.ports) < 1:
830 self.
_rtcout.RTC_FATAL(
"ConnectorProfile has empty port list.")
831 return RTC.PRECONDITION_NOT_MET
833 for i
in range(len(prof.ports)):
836 return p.notify_disconnect(connector_id)
838 self.
_rtcout.RTC_WARN(OpenRTM_aist.Logger.print_exception())
841 self.
_rtcout.RTC_ERROR(
"notify_disconnect() for all ports failed.")
935 self.
_rtcout.RTC_TRACE(
"notify_disconnect(%s)", connector_id)
949 self.
_rtcout.RTC_ERROR(
"Invalid connector id: %s", connector_id)
950 return RTC.BAD_PARAMETER
952 prof = RTC.ConnectorProfile(self.
_profile.connector_profiles[index].name,
953 self.
_profile.connector_profiles[index].connector_id,
954 self.
_profile.connector_profiles[index].ports,
955 self.
_profile.connector_profiles[index].properties)
997 self.
_rtcout.RTC_TRACE(
"disconnect_all()")
999 plist = copy.deepcopy(self.
_profile.connector_profiles)
1002 retcode = RTC.RTC_OK
1004 self.
_rtcout.RTC_DEBUG(
"disconnecting %d connections.", len_)
1008 for i
in range(len_):
1009 tmpret = self.
disconnect(plist[i].connector_id)
1010 if tmpret != RTC.RTC_OK:
1041 self.
_rtcout.RTC_TRACE(
"setName(%s)", name)
1080 self.
_rtcout.RTC_TRACE(
"getProfile()")
1108 self.
_rtcout.RTC_TRACE(
"setPortRef()")
1137 self.
_rtcout.RTC_TRACE(
"getPortRef()")
1163 prof = owner.get_component_profile()
1168 plist = self.
_profile.name.split(
".")
1170 self.
_rtcout.RTC_ERROR(
"Owner is not set.")
1171 self.
_rtcout.RTC_ERROR(
"addXXXPort() should be called in onInitialize().")
1572 return (RTC.BAD_PARAMETER, connector_profile)
1575 if index < len(connector_profile.ports):
1576 p = connector_profile.ports[index]
1577 return p.notify_connect(connector_profile)
1579 return (RTC.RTC_OK, connector_profile)
1613 return RTC.BAD_PARAMETER
1615 if index == (len(connector_profile.ports) - 1):
1620 while index < len(connector_profile.ports):
1621 p = connector_profile.ports[index]
1624 return p.notify_disconnect(connector_profile.connector_id)
1626 self.
_rtcout.RTC_WARN(OpenRTM_aist.Logger.print_exception())
1629 return RTC.RTC_ERROR
1789 self.
_rtcout.RTC_PARANOID(
"Connected number has reached the limitation.")
1790 self.
_rtcout.RTC_PARANOID(
"Can connect the port up to %d ports.",
1792 self.
_rtcout.RTC_PARANOID(
"%d connectors are existing",
1793 len(self.
_profile.connector_profiles))
1794 return RTC.RTC_ERROR
1823 return connector_profile.connector_id ==
""
1848 return str(OpenRTM_aist.uuid1())
1872 connector_profile.connector_id = self.
getUUID()
1873 assert(connector_profile.connector_id !=
"")
1938 if index < 0
or index >= len(self.
_profile.connector_profiles):
1939 return RTC.ConnectorProfile(
"",
"",[],[])
1941 return self.
_profile.connector_profiles[index]
2014 self.
_profile.connector_profiles[index] = connector_profile
2116 prof = RTC.PortInterfaceProfile(instance_name, type_name, pol)
2229 clist = self.
_profile.connector_profiles
2233 connector_ids.append(cprof.connector_id)
2234 self.
_rtcout.RTC_WARN(
"Dead connection: %s", cprof.connector_id)
2236 for cid
in connector_ids:
2262 if port._non_existent():
2263 self.
_rtcout.RTC_WARN(
"Dead Port reference detected.")
2266 self.
_rtcout.RTC_WARN(OpenRTM_aist.Logger.print_exception())
2276 type = OpenRTM_aist.PortConnectListenerType.ON_NOTIFY_CONNECT
2285 type = OpenRTM_aist.PortConnectListenerType.ON_NOTIFY_DISCONNECT
2294 type = OpenRTM_aist.PortConnectListenerType.ON_UNSUBSCRIBE_INTERFACES
2304 type = OpenRTM_aist.PortConnectRetListenerType.ON_PUBLISH_INTERFACES
2314 type = OpenRTM_aist.PortConnectRetListenerType.ON_CONNECT_NEXTPORT
2324 type = OpenRTM_aist.PortConnectRetListenerType.ON_SUBSCRIBE_INTERFACES
2334 type = OpenRTM_aist.PortConnectRetListenerType.ON_CONNECTED
2344 type = OpenRTM_aist.PortConnectRetListenerType.ON_DISCONNECT_NEXT
2354 type = OpenRTM_aist.PortConnectRetListenerType.ON_DISCONNECTED
2376 return str(self.
_name) == str(prof.instance_name)
2395 \param cprof(RTC.ConnectorProfile)
2397 return str(self.
_id) == str(cprof.connector_id)
2409 \param port_ref(RTC.PortService)
2415 \param port_ref(RTC.PortService)
2417 return self.
_port_ref._is_equivalent(port_ref)
2429 \param p(RTC.PortService)
2430 \param prof(RTC.ConnectorProfile)
2438 \param p(RTC.PortService)
2440 if not self.
_port_ref._is_equivalent(p):
2442 if retval != RTC.RTC_OK:
2455 \param p(RTC.PortService)
2456 \param prof(RTC.ConnectorProfile)
2464 \param p(RTC.PortService)
2466 if not self.
_port_ref._is_equivalent(p):
2468 if retval != RTC.RTC_OK:
2481 \param p(OpenRTM_aist.PortBase)
2488 \param p(RTC.ConnectorProfile)
2491 if retval != RTC.RTC_OK:
2505 \param pol(RTC.PortInterfacePolarity)
2512 \param prof(RTC.PortInterfaceProfile)
2514 name = prof.instance_name
2515 return (str(self.
_name) == str(name))
and (self.
_pol == prof.polarity)