public MessageData(UInt16 msgId, byte[] value, MessageSubscription s) { this.msgId = msgId; this.value = value; this.subscription = s; this.format = s.format; }
LogItemSchema CreateSchemaItem(MessageSubscription sub, MessageFormat fmt) { LogItemSchema element = new LogItemSchema() { Name = fmt.name, Parent = schema, Id = sub.id }; foreach (var f in fmt.fields) { LogItemSchema column = new LogItemSchema() { Name = f.name, Parent = element, Type = f.typeName + (f.arraySize > 0 ? "[" + f.arraySize + "]" : "") }; if (f.type == FieldType.Struct) { // nested var child = CreateSchemaItem(sub, f.structType); column.ChildItems = child.ChildItems; } if (element.ChildItems == null) { element.ChildItems = new List <Model.LogItemSchema>(); } element.ChildItems.Add(column); } return(element); }
public Message ReadAddLoggedMessage(ushort len) { byte multi_id = reader.ReadByte(); UInt16 msgId = reader.ReadUInt16(); string msgName = reader.ReadAsciiString(len - 3); MessageFormat fmt = formats[msgName]; subscriptions[msgId] = new MessageSubscription(msgId, fmt, multi_id); return(null); }
public MessageData ReadDataMessage(ushort len) { if (!resolveNestedTypes) { ResolveNestedTypes(); } UInt16 msgId = reader.ReadUInt16(); int valueSize = len - 2; byte[] value = new byte[valueSize]; reader.Read(value, 0, valueSize); MessageSubscription s = null; subscriptions.TryGetValue(msgId, out s); MessageData data = new MessageData(msgId, value, s); return(data); }
LogItemSchema CreateSchemaItem(MessageSubscription sub, MessageFormat fmt) { LogItemSchema element = new LogItemSchema() { Name = fmt.name, Parent = schema, Id = sub.id }; foreach (var f in fmt.fields) { LogItemSchema column = new LogItemSchema() { Name = f.name, Parent = element, Type = f.typeName + (f.arraySize > 0 ? "[" + f.arraySize + "]" : ""), Id = sub.id }; if (f.type == FieldType.Struct) { // nested var child = CreateSchemaItem(sub, f.structType); column.ChildItems = child.ChildItems; } else if (f.arraySize > 0) { List <LogItemSchema> arrayItems = new List <LogItemSchema>(); // break out the elements of the array as separate items. for (int i = 0; i < f.arraySize; i++) { arrayItems.Add(new LogItemSchema() { Name = i.ToString(), Parent = column, Type = f.typeName, Id = sub.id }); } column.ChildItems = arrayItems; } if (element.ChildItems == null) { element.ChildItems = new List <Model.LogItemSchema>(); } element.ChildItems.Add(column); } return(element); }
LogItemSchema CreateSchemaItem(MessageSubscription sub, MessageFormat fmt) { LogItemSchema element = new LogItemSchema() { Name = fmt.name, Id = sub.id }; foreach (var f in fmt.fields) { LogItemSchema column = new LogItemSchema() { Name = f.name, Type = f.typeName + (f.arraySize > 0 ? "[" + f.arraySize + "]" : ""), Id = sub.id }; if (f.type == FieldType.Struct) { // nested var child = CreateSchemaItem(sub, f.structType); foreach (var item in child.CopyChildren()) { column.AddChild(item); } } else if (f.arraySize > 0) { column.IsArray = true; // break out the elements of the array as separate items. for (int i = 0; i < f.arraySize; i++) { column.AddChild(new LogItemSchema() { Name = i.ToString(), Type = f.typeName, Id = sub.id }); } } element.AddChild(column); } return(element); }