Topic RSS6:22, EEST
September 24, 2015
OfflineWe want to get history data in batches, for that we set numValuesPerNode =10; But its not working, It returns entire Data
UnsignedInteger batchsize=new UnsignedInteger(10);
DataValue[] result = client.historyReadRaw(nodeId,
DateTime.MIN_VALUE, DateTime.currentTime(),
UnsignedInteger.ONE, true, null, TimestampsToReturn.Source);
8:45, EEST
December 21, 2011
OfflineYes, that is true. The current implementation fetches the data in batches automatically and provides the data as a whole, when ready.
historyRead() is the raw interface for calling the service with your own parameters and doing it in batches on your own code.
This is the internal implementation:
startTime, endTime, numValuesPerNode, returnBounds);
return historyReadAll(nodeId, indexRange, timestampsToReturn, details);
where
TimestampsToReturn timestampsToReturn, HistoryReadDetails details)
throws ServiceException, StatusException,
DecodingException {
HistoryReadValueId id = new HistoryReadValueId();
id.setNodeId(nodeId);
if (indexRange != null)
id.setIndexRange(indexRange.toString());
List<DataValue> dataList = null;
HistoryData data;
byte[] continuationPoint;
// While continuationPoints returned
do {
HistoryReadResult[] results = historyRead(details,
timestampsToReturn, false, id);
checkOperationResult(results[0].getStatusCode());
if (results[0].getStatusCode().getValue()
.equals(StatusCodes.Good_NoData))
break;
ExtensionObject historyDataObject = results[0].getHistoryData();
if (historyDataObject == null)
break;
data = historyDataObject.decode(client.getEncoderContext());
continuationPoint = results[0].getContinuationPoint();
if ((continuationPoint == null) && (dataList == null))
return data.getDataValues();
if (dataList == null)
dataList = new ArrayList<DataValue>();
dataList.addAll(Arrays.asList(data.getDataValues()));
id.setContinuationPoint(continuationPoint);
if ((data.getDataValues().length == 0)
&& (continuationPoint != null)) {
logger.info(
"historyReadAll: Received empty HistoryData with continuationPoint");
break;
} else
logger.debug("historyReadAll: got {} values",
data.getDataValues().length);
} while (continuationPoint != null);
return dataList == null ? new DataValue[0]
: dataList.toArray(new DataValue[dataList.size()]);
}
1 Guest(s)

Log In
Register