Actions
機能 #4118
closed同一ポート間で二重接続をデフォルトで許可しないようにする、オプション指定で接続数等を設定する機能を追加する
Start date:
06/14/2017
Due date:
% Done:
100%
Estimated time:
Description
同一ポート間で二重接続をデフォルトで許可しないようにする、オプション指定で接続数等を設定する機能を追加する。
オプション¶
- port.[port_name].dataport.allow_dup_connection: YES/NO [default: NO]
- port.[port_name].dataport.fan_out: [number of connection, OutPort only]
- port.[port_name].dataport.fan_in: [number of connection, InPort only]
Updated by n-miyamoto over 7 years ago
- Status changed from 新規 to 解決
- Assignee set to n-miyamoto
- % Done changed from 0 to 100
二重接続をしないための処理は以下のようにPortBaseのnotify_connect関数内で実装しました。
rtc.confとコネクタプロファイルでどちらにも設定がある場合はコネクタプロファイルを優先します。
def notify_connect(self, connector_profile): self._rtcout.RTC_TRACE("notify_connect()") prop = OpenRTM_aist.Properties() OpenRTM_aist.NVUtil.copyToProperties(prop, connector_profile.properties) default_value = OpenRTM_aist.toBool(self._properties.getProperty("dataport.allow_dup_connection"), "YES","NO",False) if not OpenRTM_aist.toBool(prop.getProperty("dataport.allow_dup_connection"), "YES","NO",default_value): for port in connector_profile.ports: if not port._is_equivalent(self._objref): ret = OpenRTM_aist.CORBA_RTCUtil.already_connected(port, self._objref) if ret: return (RTC.PRECONDITION_NOT_MET, connector_profile)
OutPortの接続数で接続するか判定する処理については、OutPortBaseのnotify_connect関数内に記述しました。InPortもほぼ同じです。
def notify_connect(self, connector_profile): prop = OpenRTM_aist.Properties() OpenRTM_aist.NVUtil.copyToProperties(prop, connector_profile.properties) _str = self._properties.getProperty("dataport.fan_out") _type = [int(100)] OpenRTM_aist.stringTo(_type, _str) _str = prop.getProperty("dataport.fan_out") OpenRTM_aist.stringTo(_type, _str) value = _type[0] if value <= len(self._connectors): return (RTC.PRECONDITION_NOT_MET, connector_profile) return OpenRTM_aist.PortBase.notify_connect(self, connector_profile)
Actions