BLE can only fit 251 bytes of payload in notifications which isn't nearly enough for a raw V2X message. So only publish a notification which message was received and let the client poll the content from the characteristic (since reads can get data in fragments)
126 lines
5.5 KiB
Protocol Buffer
126 lines
5.5 KiB
Protocol Buffer
syntax = "proto2";
|
|
|
|
package c_its_io;
|
|
|
|
// ------------------------------
|
|
// Data Types
|
|
// ------------------------------
|
|
|
|
message Position {
|
|
required float latitude_deg = 1;
|
|
required float longitude_deg = 2;
|
|
}
|
|
|
|
enum TrafficDir {
|
|
// for all directions of traffic
|
|
ALL_DIRECTIONS = 0;
|
|
// for the direction of traffic according to the reference direction, and the portion of traffic upstream of the reference position
|
|
UPSTREAM = 1;
|
|
// for the direction of traffic according to the reference direction, and the portion of traffic downstream of the reference position
|
|
DOWNSTREAM = 2;
|
|
// for the direction of traffic opposite to the reference direction
|
|
OPPOSITE = 3;
|
|
}
|
|
|
|
message VehicleContainer {
|
|
optional uint32 heading_deg = 1; // vehicle heading in degrees, if not "unavailable"
|
|
optional uint32 speed = 2; // vehicle speed in 1/100 m/s, if not "unavailable"
|
|
optional uint32 vehicle_length_dm = 3; // vehicle length in 1/10 m, if not "unavailable"
|
|
optional uint32 vehicle_width_dm = 4; // vehicle width in 1/10 m, if not "unavailable"
|
|
}
|
|
|
|
|
|
// GeoNetworking Destination Area Shape
|
|
enum GNAreaShape {
|
|
ETSI_AREASHAPE_CIRCLE = 0;
|
|
ETSI_AREASHAPE_RECTANGLE = 1;
|
|
ETSI_AREASHAPE_ELLIPSIS = 2;
|
|
}
|
|
|
|
// GeoNetworking Destination Area/ Source Position
|
|
message ITSPosition {
|
|
required int32 latitude = 1; // Latitude in 1/10th of micro degrees
|
|
required int32 longitude = 2; // Longitude in 1/10th of micro degrees
|
|
}
|
|
|
|
// GeoNetworking Destination Area
|
|
message GNArea {
|
|
optional GNAreaShape area = 1;
|
|
optional ITSPosition position = 2;
|
|
optional int32 distA = 3; // Distance A of the geometric shape in meters
|
|
optional int32 distB = 4; // Distance B of the geometric shape in meters, mandatory for rectangle and ellipsis
|
|
optional int32 angle = 5; // Angle of the geometric shape in degrees, mandatory for rectangle and ellipsis
|
|
}
|
|
|
|
// GeoNetworking Transport
|
|
enum GNTransport {
|
|
GN_TRANSPORT_GAC = 3; // Geographically-Scoped Anycast
|
|
GN_TRANSPORT_GBC = 4; // Geographically-Scoped broadcast
|
|
GN_TRANSPORT_TSB = 5; // Topologically-scoped broadcast
|
|
GN_TRANSPORT_SHB = 7; // Single hop broadcast
|
|
}
|
|
|
|
message RawMsgTx {
|
|
required bytes payload = 1; // as UPER
|
|
required uint32 message_type = 2; // ITS `MessageId` integer value
|
|
|
|
required GNTransport gnTransport = 3;
|
|
required GNArea gnArea = 4;
|
|
required uint32 hopLimit = 5;
|
|
|
|
optional uint32 stationType = 6; // for source position vector
|
|
}
|
|
|
|
message RawNotify {
|
|
required uint32 message_type = 1; // ITS `MessageId` integer value
|
|
}
|
|
|
|
// ------------------------------
|
|
// Messages
|
|
// ------------------------------
|
|
|
|
message PositionState {
|
|
required sfixed64 timestamp_ms = 1; // current UNIX time in milliseconds
|
|
required Position position = 2;
|
|
optional uint32 heading = 3; // heading in 1/10 deg
|
|
optional uint32 speed = 4; // speed in 1/100 m/s
|
|
}
|
|
|
|
message DenmEvent {
|
|
required fixed64 timestamp = 1; // DENM reference time as UNIX time (in seconds)
|
|
required fixed64 validity_end_ts = 2; // UNIX time when event validity ends (from denm.management.validityDuration)
|
|
required fixed32 station_id = 3; // unique ID of the event when combined with `seq_num`
|
|
required uint32 seq_num = 4; // unique ID of the event when combined with `station_id`
|
|
optional Position event_position = 5; // event location (from denm.management.eventPosition)
|
|
optional uint32 event_heading_deg = 6; // event heading (from denm.location.eventPositionHeading)
|
|
optional TrafficDir direction = 7; // relevance traffic direction (from denm.management.trafficDirection)
|
|
optional uint32 cause_code = 8;
|
|
optional uint32 sub_cause_code = 9;
|
|
}
|
|
|
|
message CamEvent {
|
|
required fixed32 station_id = 1; // Station ID of the vehicle
|
|
required uint32 station_type = 2; // ITS `StationType`
|
|
required Position position = 3; // vehicle position
|
|
optional uint32 vehicle_role = 4; // ITS `VehicleRole`
|
|
optional VehicleContainer vehicle_data = 5; // speed, etc unless CAM contains an RSU container
|
|
}
|
|
|
|
message RawMsgRx {
|
|
required uint32 msg_type = 1; // ITS message type (`MessageId` from PDU header)
|
|
required bytes payload = 2; // UPER message with Geonetworking and BTP headers
|
|
}
|
|
|
|
message SerialOutputMsg {
|
|
oneof payload {
|
|
DenmEvent denm = 1;
|
|
RawMsgRx rx_msg = 2;
|
|
}
|
|
}
|
|
|
|
message SerialInputMsg {
|
|
oneof payload {
|
|
PositionState position = 1;
|
|
RawMsgTx tx_msg = 2;
|
|
}
|
|
}
|