[openrtm-commit:02635] r843 - trunk/OpenRTM-aist-Python/OpenRTM_aist
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 6月 13日 (火) 15:27:27 JST
Author: miyamoto
Date: 2017-06-13 15:27:26 +0900 (Tue, 13 Jun 2017)
New Revision: 843
Modified:
trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
Log:
[compat,->RELENG_1_2] bug fix.
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py 2017-06-13 06:16:45 UTC (rev 842)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py 2017-06-13 06:27:26 UTC (rev 843)
@@ -211,37 +211,20 @@
if not self._buffer:
return self.PRECONDITION_NOT_MET
- cdr = [""]
- if self._buffer:
- ret = self._buffer.read(cdr)
+ if type(data) == list:
+ ret = self._buffer.read(data)
else:
- return self.PRECONDITION_NOT_MET
-
-
- if not self._dataType:
- return self.PRECONDITION_NOT_MET
- if self._endian is not None:
- _data = cdrUnmarshal(any.to_any(self._dataType).typecode(),cdr[0],self._endian)
- if type(data) == list:
- data[0] = _data
- else:
- self._rtcout.RTC_ERROR("unknown endian from connector")
- return self.PRECONDITION_NOT_MET
-
-
-
-
+ tmp = [data]
+ ret = self._buffer.read(tmp)
+
if ret == OpenRTM_aist.BufferStatus.BUFFER_OK:
- self.onBufferRead(cdr[0])
return self.PORT_OK
elif ret == OpenRTM_aist.BufferStatus.BUFFER_EMPTY:
- self.onBufferEmpty(cdr[0])
return self.BUFFER_EMPTY
elif ret == OpenRTM_aist.BufferStatus.TIMEOUT:
- self.onBufferReadTimeout(cdr[0])
return self.BUFFER_TIMEOUT
elif ret == OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET:
@@ -386,7 +369,19 @@
#
# ReturnCode write(const OpenRTM::CdrData& data);
def write(self, data):
- return self._buffer.write(data)
+ if not self._dataType:
+ return OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET
+
+ _data = None
+ # CDR -> (conversion) -> data
+ if self._endian is not None:
+ _data = cdrUnmarshal(any.to_any(self._dataType).typecode(),data,self._endian)
+
+ else:
+ self._rtcout.RTC_ERROR("unknown endian from connector")
+ return OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET
+
+ return self._buffer.write(_data)
##
@@ -412,18 +407,3 @@
if self._listeners and self._profile:
self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_DISCONNECT].notify(self._profile)
return
-
-
- def onBufferRead(self, data):
- if self._listeners and self._profile:
- self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ].notify(self._profile, data)
- return
- def onBufferEmpty(self, data):
- if self._listeners and self._profile:
- self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_EMPTY].notify(self._profile, data)
- return
- def onBufferReadTimeout(self, data):
- if self._listeners and self._profile:
- self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ_TIMEOUT].notify(self._profile, data)
- return
-
\ No newline at end of file
More information about the openrtm-commit
mailing list