Fixed message definitions; added a compile-time check for maximum serialized message length

This commit is contained in:
Pavel Kirienko
2015-04-30 11:24:06 +03:00
parent ecd7d8a8a5
commit 898fe67225
4 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -7,4 +7,4 @@ uint8 sysid
uint8 compid
uint8 msgid
uint8[<256] payload
uint8[<=105] payload
@@ -2,6 +2,7 @@
# Generic named parameter (key/value pair).
#
uint8[<=92] key
bool alignment
uint8[<=100] key
uavcan.protocol.param.Value value
float64[<=1] value
@@ -4,4 +4,4 @@
LogLevel level
uint8[<32] source
uint8[<128] text
uint8[<94] text
@@ -94,7 +94,11 @@ struct UAVCAN_EXPORT ${t.cpp_type_name}
% endfor
{
enum { MaxByteLen = ::uavcan::BitLenToByteLen<MaxBitLen>::Result };
::uavcan::StaticAssert<int(MaxByteLen) <= int(::uavcan::MaxPossibleTransferPayloadLen)>::check();
% if (t.kind == t.KIND_MESSAGE) and (t.has_default_dtid):
::uavcan::StaticAssert<int(MaxByteLen) <= int(::uavcan::MaxMessageBroadcastTransferPayloadLen)>::check();
% else:
::uavcan::StaticAssert<int(MaxByteLen) <= int(::uavcan::MaxServiceTransferPayloadLen)>::check();
% endif
::uavcan::StaticAssert<_tmpl == 0>::check(); // Usage check