Added more error logging
parent
dc4f96affb
commit
255e1e2b90
|
|
@ -49,6 +49,11 @@ static constexpr const char* ERROR_OUTPUT_TRUNCATED = "The output was too large
|
||||||
static constexpr const char* ERROR_PARAMETER_OUT_OF_RANGE = "A parameter was out of range.";
|
static constexpr const char* ERROR_PARAMETER_OUT_OF_RANGE = "A parameter was out of range.";
|
||||||
static constexpr const char* ERROR_DEVICE_CURRENTLY_OPEN = "The device is currently open. Perhaps a different device state was required.";
|
static constexpr const char* ERROR_DEVICE_CURRENTLY_OPEN = "The device is currently open. Perhaps a different device state was required.";
|
||||||
static constexpr const char* ERROR_DEVICE_CURRENTLY_CLOSED = "The device is currently closed. Perhaps a different device state was required.";
|
static constexpr const char* ERROR_DEVICE_CURRENTLY_CLOSED = "The device is currently closed. Perhaps a different device state was required.";
|
||||||
|
static constexpr const char* ERROR_DEVICE_CURRENTLY_ONLINE = "The device is currently online. Perhaps a different device state was required.";
|
||||||
|
static constexpr const char* ERROR_DEVICE_CURRENTLY_OFFLINE = "The device is currently offline. Perhaps a different device state was required.";
|
||||||
|
static constexpr const char* ERROR_DEVICE_NOT_POLLING = "The device is not currently polling for messages.";
|
||||||
|
static constexpr const char* ERROR_UNSUPPORTED_TX_NETWORK = "Message network is not a supported TX network.";
|
||||||
|
static constexpr const char* ERROR_MESSAGE_MAX_LENGTH_EXCEEDED = "The message was too long.";
|
||||||
|
|
||||||
// Device Errors
|
// Device Errors
|
||||||
static constexpr const char* ERROR_POLLING_MESSAGE_OVERFLOW = "Too many messages have been recieved for the polling message buffer, some have been lost!";
|
static constexpr const char* ERROR_POLLING_MESSAGE_OVERFLOW = "Too many messages have been recieved for the polling message buffer, some have been lost!";
|
||||||
|
|
@ -71,7 +76,6 @@ static constexpr const char* ERROR_SETTINGS_STRUCTURE_MISMATCH = "Unexpected set
|
||||||
static constexpr const char* ERROR_SETTINGS_STRUCTURE_TRUNCATED = "Settings structure is longer than the device supports and will be truncated.";
|
static constexpr const char* ERROR_SETTINGS_STRUCTURE_TRUNCATED = "Settings structure is longer than the device supports and will be truncated.";
|
||||||
static constexpr const char* ERROR_NO_DEVICE_RESPONSE = "Expected a response from the device but none were found.";
|
static constexpr const char* ERROR_NO_DEVICE_RESPONSE = "Expected a response from the device but none were found.";
|
||||||
static constexpr const char* ERROR_MESSAGE_FORMATTING = "The message was not properly formed.";
|
static constexpr const char* ERROR_MESSAGE_FORMATTING = "The message was not properly formed.";
|
||||||
static constexpr const char* ERROR_MESSAGE_DATA_OVER_CAPACITY = "The message has too much data for the protocol.";
|
|
||||||
static constexpr const char* ERROR_CANFD_NOT_SUPPORTED = "This device does not support CANFD.";
|
static constexpr const char* ERROR_CANFD_NOT_SUPPORTED = "This device does not support CANFD.";
|
||||||
static constexpr const char* ERROR_RTR_NOT_SUPPORTED = "RTR is not supported with CANFD.";
|
static constexpr const char* ERROR_RTR_NOT_SUPPORTED = "RTR is not supported with CANFD.";
|
||||||
|
|
||||||
|
|
@ -105,6 +109,16 @@ const char* APIError::DescriptionForType(ErrorType type) {
|
||||||
return ERROR_DEVICE_CURRENTLY_OPEN;
|
return ERROR_DEVICE_CURRENTLY_OPEN;
|
||||||
case DeviceCurrentlyClosed:
|
case DeviceCurrentlyClosed:
|
||||||
return ERROR_DEVICE_CURRENTLY_CLOSED;
|
return ERROR_DEVICE_CURRENTLY_CLOSED;
|
||||||
|
case DeviceCurrentlyOnline:
|
||||||
|
return ERROR_DEVICE_CURRENTLY_ONLINE;
|
||||||
|
case DeviceCurrentlyOffline:
|
||||||
|
return ERROR_DEVICE_CURRENTLY_OFFLINE;
|
||||||
|
case DeviceNotPolling:
|
||||||
|
return ERROR_DEVICE_NOT_POLLING;
|
||||||
|
case UnsupportedTXNetwork:
|
||||||
|
return ERROR_UNSUPPORTED_TX_NETWORK;
|
||||||
|
case MessageMaxLengthExceeded:
|
||||||
|
return ERROR_MESSAGE_MAX_LENGTH_EXCEEDED;
|
||||||
|
|
||||||
// Device Errors
|
// Device Errors
|
||||||
case PollingMessageOverflow:
|
case PollingMessageOverflow:
|
||||||
|
|
@ -147,8 +161,6 @@ const char* APIError::DescriptionForType(ErrorType type) {
|
||||||
return ERROR_NO_DEVICE_RESPONSE;
|
return ERROR_NO_DEVICE_RESPONSE;
|
||||||
case MessageFormattingError:
|
case MessageFormattingError:
|
||||||
return ERROR_MESSAGE_FORMATTING;
|
return ERROR_MESSAGE_FORMATTING;
|
||||||
case MessageDataOverCapacity:
|
|
||||||
return ERROR_MESSAGE_DATA_OVER_CAPACITY;
|
|
||||||
case CANFDNotSupported:
|
case CANFDNotSupported:
|
||||||
return ERROR_CANFD_NOT_SUPPORTED;
|
return ERROR_CANFD_NOT_SUPPORTED;
|
||||||
case RTRNotSupported:
|
case RTRNotSupported:
|
||||||
|
|
@ -188,6 +200,9 @@ APIError::Severity APIError::SeverityForType(ErrorType type) {
|
||||||
case OutputTruncated:
|
case OutputTruncated:
|
||||||
case DeviceCurrentlyOpen:
|
case DeviceCurrentlyOpen:
|
||||||
case DeviceCurrentlyClosed:
|
case DeviceCurrentlyClosed:
|
||||||
|
case DeviceCurrentlyOnline:
|
||||||
|
case DeviceCurrentlyOffline:
|
||||||
|
case DeviceNotPolling:
|
||||||
// Device Warnings
|
// Device Warnings
|
||||||
case PollingMessageOverflow:
|
case PollingMessageOverflow:
|
||||||
case DeviceFirmwareOutOfDate:
|
case DeviceFirmwareOutOfDate:
|
||||||
|
|
@ -202,6 +217,8 @@ APIError::Severity APIError::SeverityForType(ErrorType type) {
|
||||||
case RequiredParameterNull:
|
case RequiredParameterNull:
|
||||||
case BufferInsufficient:
|
case BufferInsufficient:
|
||||||
case ParameterOutOfRange:
|
case ParameterOutOfRange:
|
||||||
|
case UnsupportedTXNetwork:
|
||||||
|
case MessageMaxLengthExceeded:
|
||||||
|
|
||||||
// Device Errors
|
// Device Errors
|
||||||
case NoSerialNumber:
|
case NoSerialNumber:
|
||||||
|
|
@ -221,7 +238,6 @@ APIError::Severity APIError::SeverityForType(ErrorType type) {
|
||||||
case SettingsStructureMismatch:
|
case SettingsStructureMismatch:
|
||||||
case NoDeviceResponse:
|
case NoDeviceResponse:
|
||||||
case MessageFormattingError:
|
case MessageFormattingError:
|
||||||
case MessageDataOverCapacity:
|
|
||||||
case CANFDNotSupported:
|
case CANFDNotSupported:
|
||||||
case RTRNotSupported:
|
case RTRNotSupported:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ bool HardwareCANPacket::EncodeFromMessage(const CANMessage& message, std::vector
|
||||||
|
|
||||||
const size_t dataSize = message.data.size();
|
const size_t dataSize = message.data.size();
|
||||||
if(dataSize > 64 || (dataSize > 8 && !message.isCANFD)) {
|
if(dataSize > 64 || (dataSize > 8 && !message.isCANFD)) {
|
||||||
err(APIError::MessageDataOverCapacity);
|
err(APIError::MessageMaxLengthExceeded);
|
||||||
return false; // Too much data for the protocol
|
return false; // Too much data for the protocol
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ bool HardwareCANPacket::EncodeFromMessage(const CANMessage& message, std::vector
|
||||||
lengthNibble = 0xF;
|
lengthNibble = 0xF;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
err(APIError::Unknown);
|
err(APIError::MessageMaxLengthExceeded);
|
||||||
return false; // CAN FD frame may have had an incorrect byte count
|
return false; // CAN FD frame may have had an incorrect byte count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,11 @@ public:
|
||||||
ParameterOutOfRange = 0x1004,
|
ParameterOutOfRange = 0x1004,
|
||||||
DeviceCurrentlyOpen = 0x1005,
|
DeviceCurrentlyOpen = 0x1005,
|
||||||
DeviceCurrentlyClosed = 0x1006,
|
DeviceCurrentlyClosed = 0x1006,
|
||||||
|
DeviceCurrentlyOnline = 0x1007,
|
||||||
|
DeviceCurrentlyOffline = 0x1008,
|
||||||
|
DeviceNotPolling = 0x1009,
|
||||||
|
UnsupportedTXNetwork = 0x1010,
|
||||||
|
MessageMaxLengthExceeded = 0x1011,
|
||||||
|
|
||||||
// Device Errors
|
// Device Errors
|
||||||
PollingMessageOverflow = 0x2000,
|
PollingMessageOverflow = 0x2000,
|
||||||
|
|
@ -62,9 +67,8 @@ public:
|
||||||
SettingsStructureTruncated = 0x2017,
|
SettingsStructureTruncated = 0x2017,
|
||||||
NoDeviceResponse = 0x2018,
|
NoDeviceResponse = 0x2018,
|
||||||
MessageFormattingError = 0x2019,
|
MessageFormattingError = 0x2019,
|
||||||
MessageDataOverCapacity = 0x2020,
|
CANFDNotSupported = 0x2020,
|
||||||
CANFDNotSupported = 0x2021,
|
RTRNotSupported = 0x2021,
|
||||||
RTRNotSupported = 0x2022,
|
|
||||||
|
|
||||||
// Transport Errors
|
// Transport Errors
|
||||||
FailedToRead = 0x3000,
|
FailedToRead = 0x3000,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue