parseHistory static method
AsyncReply<KeyList<PropertyTemplate, List<PropertyValue> > >
parseHistory(
- DC data,
- int offset,
- int length,
- IResource resource,
- DistributedConnection connection,
Implementation
static AsyncReply<KeyList<PropertyTemplate, List<PropertyValue>>>
parseHistory(DC data, int offset, int length, IResource resource,
DistributedConnection connection) {
var list = <
PropertyTemplate>[]; //new KeyList<PropertyTemplate, List<PropertyValue>?>();
var reply =
new AsyncReply<KeyList<PropertyTemplate, List<PropertyValue>>>();
var bagOfBags = new AsyncBag<List<PropertyValue>>();
var ends = offset + length;
//var sizeObject = new SizeObject();
while (offset < ends) {
var index = data[offset++];
var pt = resource.instance?.template.getPropertyTemplateByIndex(index);
if (pt != null) {
list.add(pt); //, null);
var cs = data.getUint32(offset);
offset += 4;
bagOfBags.add(parsePropertyValueArray(data, offset, cs, connection));
offset += cs;
}
}
bagOfBags.seal();
bagOfBags.then((x) {
var keyList = KeyList<PropertyTemplate, List<PropertyValue>>();
for (var i = 0; i < list.length; i++) keyList.add(list[i], x[i]);
//list[list.keys.elementAt(i)] = x[i];
reply.trigger(keyList);
});
return reply;
}