List process(int waitingAckId)

Source

List process(int waitingAckId) {
  List rslts = new List();
  if (_caching && _isCacheValid) {
    for (ValueUpdate lastValue in lastValues) {
      rslts.add([sid, lastValue.value, lastValue.ts]);
    }

    if (_qosLevel > 0) {
      for (ValueUpdate update in lastValues) {
        update.waitingAck = waitingAckId;
      }
    }
    lastValues.length = 0;
  } else {
    if (lastValue.count > 1 || lastValue.status != null) {
      Map m = lastValue.toMap();
      m['sid'] = sid;
      rslts.add(m);
    } else {
      rslts.add([sid, lastValue.value, lastValue.ts]);
    }
    if (_qosLevel > 0) {
      lastValue.waitingAck = waitingAckId;
    }
    _isCacheValid = true;
  }
  lastValue = null;
  return rslts;
}