mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 13:13:35 +08:00
Error codes are constants, not enum. That fixes another MISRA violation.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <uavcan/impl_constants.hpp>
|
#include <uavcan/impl_constants.hpp>
|
||||||
|
#include <uavcan/stdint.hpp>
|
||||||
|
|
||||||
namespace uavcan
|
namespace uavcan
|
||||||
{
|
{
|
||||||
@@ -13,20 +14,22 @@ namespace uavcan
|
|||||||
* Functions that return signed integers may also return inverted error codes,
|
* Functions that return signed integers may also return inverted error codes,
|
||||||
* i.e. returned value should be inverted back to get the actual error code.
|
* i.e. returned value should be inverted back to get the actual error code.
|
||||||
*/
|
*/
|
||||||
enum
|
namespace
|
||||||
{
|
{
|
||||||
ErrOk,
|
|
||||||
ErrFailure,
|
const int16_t ErrOk = 0;
|
||||||
ErrInvalidParam,
|
const int16_t ErrFailure = 1;
|
||||||
ErrMemory,
|
const int16_t ErrInvalidParam = 2;
|
||||||
ErrDriver,
|
const int16_t ErrMemory = 3;
|
||||||
ErrUnknownDataType,
|
const int16_t ErrDriver = 4;
|
||||||
ErrInvalidMarshalData,
|
const int16_t ErrUnknownDataType = 5;
|
||||||
ErrInvalidTransferListener,
|
const int16_t ErrInvalidMarshalData = 6;
|
||||||
ErrNotInited,
|
const int16_t ErrInvalidTransferListener = 7;
|
||||||
ErrRecursiveCall,
|
const int16_t ErrNotInited = 8;
|
||||||
ErrLogic
|
const int16_t ErrRecursiveCall = 9;
|
||||||
};
|
const int16_t ErrLogic = 10;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fatal error handler.
|
* Fatal error handler.
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ class SocketCanIface : public uavcan::ICanIface
|
|||||||
/*
|
/*
|
||||||
* Flags
|
* Flags
|
||||||
*/
|
*/
|
||||||
loopback = !!(msg.msg_flags & MSG_CONFIRM);
|
loopback = (msg.msg_flags & static_cast<int>(MSG_CONFIRM)) != 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user