When defining scalable service-oriented middleware over IP (SOME/IP) mappings in
VSIDL, you describe the structure of the SOME/IP payload. You describe the
structure using the SomeIpType message, which lets you model primitives,
strings, arrays, and complex structs.
This page focuses on how to write a SomeIpStruct type
definition, which is used in type_definition blocks for event and method
mappings.
SomeIpStruct message
A SomeIpStruct message represents a structured SOME/IP payload consisting of
multiple fields. The structure defined here is used by the SOME/IP broker to
translate between raw SOME/IP bytes and the fields of an SDV protobuf message.
When defining a struct, you configure two main properties:
length_field_size(optional): Specifies the size (in bytes) of the length field that precedes the struct in the serialized payload. Used values from theLengthFieldSizeenum includeZERO(no length field),ONE,TWO, andFOUR.field(repeated): A list of fields that make up the struct.
Define struct fields
Each field inside SomeIpStruct requires:
field_name: The name of the field. This must exactly match the corresponding field name defined in the SDV protobuf message to ensure proper message translation.field_type: The SOME/IP data type of the field (SomeIpType). This can be a primitive, string, array, or another nested struct.
Write SomeIpType field types
The field_type block configures the specific data type using one of the
following variants:
- Primitive types: Use
someip_primitivewith values likeUINT8,UINT32,INT32,FLOAT32andBOOL. - Strings: Use
someip_stringand specify the encoding (for example,UTF_8,UTF_16_LE) and length information (eitherfixed_lengthorlength_field_size). - Arrays: Use
someip_arrayand definearray_type(which is another recursiveSomeIpType), along with length information (fixed_lengthorlength_field_size). - Nested structs: Use
someip_structto embed another struct definition recursively.
Example: Write a struct type definition
Here is a practical example of how to write a SomeIpStruct inside a
type_definition block. This payload contains an 8-bit unsigned integer named
interval and a 32-bit unsigned integer named counter:
type_definition {
# No length field precedes this struct
length_field_size: ZERO
# First field: interval
field {
field_name: "interval"
field_type {
someip_primitive: UINT8
}
}
# Second field: counter
field {
field_name: "counter"
field_type {
someip_primitive: UINT32
}
}
}
Add complex types
To include a dynamic-length string field and an array inside the struct, add fields like this:
field {
field_name: "status_message"
field_type {
someip_string {
string_encoding: UTF_8
length_field_size: FOUR
}
}
}
field {
field_name: "measurements"
field_type {
someip_array {
length_field_size: FOUR
array_type { someip_primitive: FLOAT32 }
}
}
}