Ejemplo n.º 1
0
 public void ComputeOffsetForFields(MavMessage mess)
 {
     int offset = 0;
     foreach (var field in mess.fields)
     {
         field.offset = offset;
         //compute next offset
         if (field.isArray)
         {
             int size = field.array_length * typeSize[field.type];
             offset = offset + size;
         }
         else
         {
             offset = offset + typeSize[field.type];
         }
     }
 }
Ejemplo n.º 2
0
        public void ComputePtype(MavMessage mess)
        {
            foreach (var field in mess.fields)
            {
                if (intTypes.Contains(field.type))
                {
                    field.ptype = "int";
                    if (field.type == "uint8_t_mavlink_version")
                    {
                        field.type = "uint8_t";
                    }
                }
                else if (field.type == "float")
                {
                    field.ptype = "float32";
                }
                else if (field.type == "double")
                {
                    field.ptype = "float64";
                }
                else if (field.type.Contains("["))
                {
                    var sindex = field.type.IndexOf('[');
                    var eindex = field.type.IndexOf(']');
                    field.array_length = int.Parse(field.type.Substring(sindex + 1, (eindex - sindex - 1)));
                    field.isArray = true;
                    field.type = field.type.Substring(0, sindex);
                    if (intTypes.Contains(field.type))
                    {
                        field.ptype = "seq[int]";
                    }
                    else if (field.type == "float")
                    {
                        field.ptype = "seq[float32]";
                    }
                    else if (field.type == "double")
                    {
                        field.ptype = "seq[float64]";
                    }
                }

            }
        }
Ejemplo n.º 3
0
        public void ComputeOffsetForFields(MavMessage mess)
        {
            int offset = 0;

            foreach (var field in mess.fields)
            {
                field.offset = offset;
                //compute next offset
                if (field.isArray)
                {
                    int size = field.array_length * typeSize[field.type];
                    offset = offset + size;
                }
                else
                {
                    offset = offset + typeSize[field.type];
                }
            }
        }
Ejemplo n.º 4
0
 public void ComputePtype(MavMessage mess)
 {
     foreach (var field in mess.fields)
     {
         if (intTypes.Contains(field.type))
         {
             field.ptype = "int";
             if (field.type == "uint8_t_mavlink_version")
             {
                 field.type = "uint8_t";
             }
         }
         else if (field.type == "float")
         {
             field.ptype = "float32";
         }
         else if (field.type == "double")
         {
             field.ptype = "float64";
         }
         else if (field.type.Contains("["))
         {
             var sindex = field.type.IndexOf('[');
             var eindex = field.type.IndexOf(']');
             field.array_length = int.Parse(field.type.Substring(sindex + 1, (eindex - sindex - 1)));
             field.isArray      = true;
             field.type         = field.type.Substring(0, sindex);
             if (intTypes.Contains(field.type))
             {
                 field.ptype = "seq[int]";
             }
             else if (field.type == "float")
             {
                 field.ptype = "seq[float32]";
             }
             else if (field.type == "double")
             {
                 field.ptype = "seq[float64]";
             }
         }
     }
 }