예제 #1
0
 public MessageData(UInt16 msgId, byte[] value, MessageSubscription s)
 {
     this.msgId        = msgId;
     this.value        = value;
     this.subscription = s;
     this.format       = s.format;
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }