[openrtm-commit:02449] r950 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 2月 16日 (木) 17:33:23 JST
Author: win-ei
Date: 2017-02-16 17:33:23 +0900 (Thu, 16 Feb 2017)
New Revision: 950
Modified:
trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java
Log:
[FSM4RTC] for multi-buffer mode. refs #3780
Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2017-02-16 01:06:48 UTC (rev 949)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/port/InPort.java 2017-02-16 08:33:23 UTC (rev 950)
@@ -228,18 +228,28 @@
return true;
}
}
+ int index = 0;;
synchronized (m_connectorsMutex){
synchronized (m_connectors){
if (m_connectors.size() == 0) {
rtcout.println(Logbuf.DEBUG, "no connectors");
return false;
}
- r = m_connectors.elementAt(0).getBuffer().readable();
+ //r = m_connectors.elementAt(0).getBuffer().readable();
+ for(int ic=0;ic<m_connectors.size();++ic){
+ r = m_connectors.elementAt(ic).getBuffer().readable();
+ if (r > 0) {
+ index =ic;
+ break;
+ }
+ }
}
}
if (r > 0) {
+ String name = m_connectors.elementAt(index).name();
rtcout.println(Logbuf.DEBUG,
- "isNew() = true, readable data: " + r);
+ "isNew() = true, connector name="+ name +
+ ", readable data: " + r);
return true;
}
@@ -345,7 +355,7 @@
// rtcout.println(Logbuf.TRACE, "OnRead called");
// }
- ReturnCode ret;
+ ReturnCode ret = ReturnCode.PORT_OK;
EncapsOutputStreamExt cdr = new EncapsOutputStreamExt(m_orb,
isLittleEndian());
DataRef<InputStream> dataref
@@ -357,7 +367,14 @@
return false;
}
- ret = m_connectors.elementAt(0).read(dataref);
+ //ret = m_connectors.elementAt(0).read(dataref);
+ int index = 0;
+ for(int ic=0;ic<m_connectors.size();++ic){
+ ret = m_connectors.elementAt(ic).read(dataref);
+ if (ret.equals(ReturnCode.PORT_OK)) {
+ break;
+ }
+ }
}
if (ret.equals(ReturnCode.PORT_OK)) {
openrtm-commit メーリングリストの案内