SOME/IP报文格式-Serialization of Parameters

文章目录

    • Basic Data types
    • Structured Datatypes (structs)
    • String
    • Arrays (fixed length)
    • Dynamic Length Arrays / Variable Size Arrays
    • Union

Basic Data types

The following basic datatypes shall be supported:

Type Description Size [bit] Remark
boolean TRUE/FALSE value 8 FALSE(0),TURE(1)
uint8 unsigned Integer 8
uint16 unsigned Integer 16
uint32 unsigned Integer 32
sint8 signed Integer 8
sint16 signed Integer 16
sint32 signed Integer 32
float32 floating point number 32 IEEE 754 binary32 (Single Precision)
float64 floating point number 64 IEEE 754 binary64 (Double Precision)

The Byte Order is specified for each parameter by the interface definition.
In addition, uint64 and sint64 types shall be supported at least on infotainment ECUs.

Structured Datatypes (structs)

SOME/IP报文格式-Serialization of Parameters_第1张图片

String

  • Serialization of string (fixed length)
    在这里插入图片描述
  • Serialization of string (dynamic length)
    在这里插入图片描述

Arrays (fixed length)

  • One-dimensional array, fixed length: a[n]
    在这里插入图片描述
  • Multi-dimensional array, fixed length: a[n][m]
    在这里插入图片描述

Dynamic Length Arrays / Variable Size Arrays

  • One-dimensional array, dynamic length在这里插入图片描述
  • Multi-dimensional array, dynamic length
    在这里插入图片描述

Union

  • The default serialization layout of unions in SOME/IP is shown as following.
    SOME / IP中 union的默认序列化布局。

  • SOME/IP allows to add a length field of 8, 16 or 32 bit in front of unions.
    SOME / IP允许在union前添加8,16或32位的长度字段。

  • The length field of a union describes the number of bytes in the union. This allows the deserializer to quickly calculate the position where the data after the union begin in the serialized data stream. This gets necessary if the union contains data which are larger than expected, for example if a struct was extended with appended new members and only the first “old” members are deserialized by the SOME/IP transformer.
    union的长度字段描述联合中的字节数。 这允许deserializer快速计算串行数据流中union开始后的数据的位置。 如果联合包含比预期更大的数据,则这是必要的,例如,如果一个结构体扩展了附加的新成员,并且只有第一个“旧”成员被SOME / IP transformer反序列化。
    在这里插入图片描述

  • Example:
    Union of uint8/uint16 both padded to 32 bit.
    uint8 / uint16的联合都填充为32位。

    In this example a length of the length field is specified as 32 bits. The union shall support a uint8 and a uint16 as elements. Both are padded to the 32 bit boundary (length=4 Bytes).

    在这个例子中,长度字段的长度被指定为32位。 union应支持uint8和uint16作为元素。 两者都填充到32位边界(长度= 4字节)。

A uint8 will be serialized like this:
uint8将会像这样被序列化:

Lentgh =4 Bytes Type =1 uint 8 Padding 0x00 Padding 0x00 Padding 0x00

A uint16 will be serialized like this:
uint16将会像这样被序列化:

Lentgh =4 Bytes Type =2 uint 16 Padding 0x00 Padding 0x00

你可能感兴趣的:(车载以太网,#SOME/IP)