Files
MicrOBU/obu-firmware/external/vanetza-idf/vanetza/rpc/vanetza.capnp
T

98 lines
2.3 KiB
Cap'n Proto
Raw Normal View History

@0xcb50be3531badf53;
using Cxx = import "/capnp/c++.capnp";
$Cxx.namespace("vanetza::rpc");
interface LinkLayer
{
struct Frame
{
sourceAddress @0 :Data;
destinationAddress @1 :Data;
payload @2 :Data;
}
struct WlanParameters
{
# Parameters for WLAN devices in OCB mode (IEEE 802.11 p and bd)
priority @0 :UInt8; # 802.1 user priority (0-7)
power @1 :Int16; # dBm scaled by 8
datarate @2 :UInt16; # Mbps scaled by 2 (500kbps steps)
}
struct Cv2xParameters
{
# Parameters for C-V2X devices (LTE-V2X and 5G-V2X)
priority @0 :UInt8; # PPPP (0-7)
power @1 :Int16; # dBm scaled by 8
}
struct TxParameters
{
union
{
unspecified @0 :Void;
wlan @1 :WlanParameters;
cv2x @2 :Cv2xParameters;
}
}
struct RxParameters
{
union
{
unspecified @0 :Void;
wlan @1 :WlanParameters;
cv2x @2 :Cv2xParameters;
}
timestamp :union
{
none @3 :Void;
hardware @4 :UInt64;
# time stamp accurately generated by hardware
software @5 :UInt64;
# time stamp added by software (slightly inaccurate)
}
}
interface DataListener
{
onDataIndication @0 (frame: Frame, rxParams :RxParameters);
}
interface CbrListener
{
onCbrReport @0 (cbr :ChannelBusyRatio);
}
struct ChannelBusyRatio
{
busy @0 :UInt16; # number of samples sensed as busy
samples @1 :UInt16; # total number of samples in measurement interval
}
enum ErrorCode
{
ok @0;
invalidArgument @1;
unsupported @2;
internalError @3;
}
identify @0 () -> (id :UInt64, version :UInt32, info :Text);
# lookup identify of link layer device
transmitData @1 (frame :Frame, txParams :TxParameters) -> (error :ErrorCode, message :Text);
# request transmission of a data frame
subscribeData @2 (listener :DataListener);
# subscribe to received data frames
subscribeCbr @3 (listener :CbrListener);
# subscribe to channel busy ratio reports
setSourceAddress @4 (address :Data) -> (error :ErrorCode);
# set (own) source address of link layer (for ACKs)
}