mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
C2: Add AppError support
This commit is contained in:
committed by
Kyle Schwarz
parent
3d99898598
commit
d86e3164af
@@ -4,6 +4,7 @@
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include "icsneo/icsneoc2types.h"
|
||||
#include <unordered_set>
|
||||
#include <memory>
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
@@ -11,57 +12,57 @@
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
enum class AppErrorType : uint16_t {
|
||||
AppErrorRxMessagesFull = 0,
|
||||
AppErrorTxMessagesFull = 1,
|
||||
AppErrorTxReportMessagesFull = 2,
|
||||
AppErrorBadCommWithDspIC = 3,
|
||||
AppErrorDriverOverflow = 4,
|
||||
AppErrorPCBuffOverflow = 5,
|
||||
AppErrorPCChksumError = 6,
|
||||
AppErrorPCMissedByte = 7,
|
||||
AppErrorPCOverrunError = 8,
|
||||
AppErrorSettingFailure = 9,
|
||||
AppErrorTooManySelectedNetworks = 10,
|
||||
AppErrorNetworkNotEnabled = 11,
|
||||
AppErrorRtcNotCorrect = 12,
|
||||
AppErrorLoadedDefaultSettings = 13,
|
||||
AppErrorFeatureNotUnlocked = 14,
|
||||
AppErrorFeatureRtcCmdDropped = 15,
|
||||
AppErrorTxMessagesFlushed = 16,
|
||||
AppErrorTxMessagesHalfFull = 17,
|
||||
AppErrorNetworkNotValid = 18,
|
||||
AppErrorTxInterfaceNotImplemented = 19,
|
||||
AppErrorTxMessagesCommEnableIsOff = 20,
|
||||
AppErrorRxFilterMatchCountExceeded = 21,
|
||||
AppErrorEthPreemptionNotEnabled = 22,
|
||||
AppErrorTxNotSupportedInMode = 23,
|
||||
AppErrorJumboFramesNotSupported = 24,
|
||||
AppErrorEthernetIpFragment = 25,
|
||||
AppErrorTxMessagesUnderrun = 26,
|
||||
AppErrorDeviceFanFailure = 27,
|
||||
AppErrorDeviceOvertemperature = 28,
|
||||
AppErrorTxMessageIndexOutOfRange = 29,
|
||||
AppErrorUndersizedFrameDropped = 30,
|
||||
AppErrorOversizedFrameDropped = 31,
|
||||
AppErrorWatchdogEvent = 32,
|
||||
AppErrorSystemClockFailure = 33,
|
||||
AppErrorSystemClockRecovered = 34,
|
||||
AppErrorSystemPeripheralReset = 35,
|
||||
AppErrorSystemCommunicationFailure = 36,
|
||||
AppErrorTxMessagesUnsupportedSourceOrPacketId = 37,
|
||||
AppErrorWbmsManagerConnectFailed = 38,
|
||||
AppErrorWbmsManagerConnectBadState = 39,
|
||||
AppErrorWbmsManagerConnectTimeout = 40,
|
||||
AppErrorFailedToInitializeLoggerDisk = 41,
|
||||
AppErrorInvalidSetting = 42,
|
||||
AppErrorSystemFailureRequestedReset = 43,
|
||||
AppErrorPortKeyMistmatch = 45,
|
||||
AppErrorBusFailure = 46,
|
||||
AppErrorTapOverflow = 47,
|
||||
AppErrorEthTxNoLink = 48,
|
||||
AppErrorErrorBufferOverflow = 254,
|
||||
AppNoError = 255
|
||||
enum class AppErrorType : icsneoc2_app_error_type_t {
|
||||
AppErrorRxMessagesFull = icsneoc2_app_error_type_rx_messages_full,
|
||||
AppErrorTxMessagesFull = icsneoc2_app_error_type_tx_messages_full,
|
||||
AppErrorTxReportMessagesFull = icsneoc2_app_error_type_tx_report_messages_full,
|
||||
AppErrorBadCommWithDspIC = icsneoc2_app_error_type_bad_comm_with_dsp_ic,
|
||||
AppErrorDriverOverflow = icsneoc2_app_error_type_driver_overflow,
|
||||
AppErrorPCBuffOverflow = icsneoc2_app_error_type_pc_buff_overflow,
|
||||
AppErrorPCChksumError = icsneoc2_app_error_type_pc_chksum_error,
|
||||
AppErrorPCMissedByte = icsneoc2_app_error_type_pc_missed_byte,
|
||||
AppErrorPCOverrunError = icsneoc2_app_error_type_pc_overrun_error,
|
||||
AppErrorSettingFailure = icsneoc2_app_error_type_setting_failure,
|
||||
AppErrorTooManySelectedNetworks = icsneoc2_app_error_type_too_many_selected_networks,
|
||||
AppErrorNetworkNotEnabled = icsneoc2_app_error_type_network_not_enabled,
|
||||
AppErrorRtcNotCorrect = icsneoc2_app_error_type_rtc_not_correct,
|
||||
AppErrorLoadedDefaultSettings = icsneoc2_app_error_type_loaded_default_settings,
|
||||
AppErrorFeatureNotUnlocked = icsneoc2_app_error_type_feature_not_unlocked,
|
||||
AppErrorFeatureRtcCmdDropped = icsneoc2_app_error_type_feature_rtc_cmd_dropped,
|
||||
AppErrorTxMessagesFlushed = icsneoc2_app_error_type_tx_messages_flushed,
|
||||
AppErrorTxMessagesHalfFull = icsneoc2_app_error_type_tx_messages_half_full,
|
||||
AppErrorNetworkNotValid = icsneoc2_app_error_type_network_not_valid,
|
||||
AppErrorTxInterfaceNotImplemented = icsneoc2_app_error_type_tx_interface_not_implemented,
|
||||
AppErrorTxMessagesCommEnableIsOff = icsneoc2_app_error_type_tx_messages_comm_enable_is_off,
|
||||
AppErrorRxFilterMatchCountExceeded = icsneoc2_app_error_type_rx_filter_match_count_exceeded,
|
||||
AppErrorEthPreemptionNotEnabled = icsneoc2_app_error_type_eth_preemption_not_enabled,
|
||||
AppErrorTxNotSupportedInMode = icsneoc2_app_error_type_tx_not_supported_in_mode,
|
||||
AppErrorJumboFramesNotSupported = icsneoc2_app_error_type_jumbo_frames_not_supported,
|
||||
AppErrorEthernetIpFragment = icsneoc2_app_error_type_ethernet_ip_fragment,
|
||||
AppErrorTxMessagesUnderrun = icsneoc2_app_error_type_tx_messages_underrun,
|
||||
AppErrorDeviceFanFailure = icsneoc2_app_error_type_device_fan_failure,
|
||||
AppErrorDeviceOvertemperature = icsneoc2_app_error_type_device_overtemperature,
|
||||
AppErrorTxMessageIndexOutOfRange = icsneoc2_app_error_type_tx_message_index_out_of_range,
|
||||
AppErrorUndersizedFrameDropped = icsneoc2_app_error_type_undersized_frame_dropped,
|
||||
AppErrorOversizedFrameDropped = icsneoc2_app_error_type_oversized_frame_dropped,
|
||||
AppErrorWatchdogEvent = icsneoc2_app_error_type_watchdog_event,
|
||||
AppErrorSystemClockFailure = icsneoc2_app_error_type_system_clock_failure,
|
||||
AppErrorSystemClockRecovered = icsneoc2_app_error_type_system_clock_recovered,
|
||||
AppErrorSystemPeripheralReset = icsneoc2_app_error_type_system_peripheral_reset,
|
||||
AppErrorSystemCommunicationFailure = icsneoc2_app_error_type_system_communication_failure,
|
||||
AppErrorTxMessagesUnsupportedSourceOrPacketId = icsneoc2_app_error_type_tx_messages_unsupported_source_or_packet_id,
|
||||
AppErrorWbmsManagerConnectFailed = icsneoc2_app_error_type_wbms_manager_connect_failed,
|
||||
AppErrorWbmsManagerConnectBadState = icsneoc2_app_error_type_wbms_manager_connect_bad_state,
|
||||
AppErrorWbmsManagerConnectTimeout = icsneoc2_app_error_type_wbms_manager_connect_timeout,
|
||||
AppErrorFailedToInitializeLoggerDisk = icsneoc2_app_error_type_failed_to_initialize_logger_disk,
|
||||
AppErrorInvalidSetting = icsneoc2_app_error_type_invalid_setting,
|
||||
AppErrorSystemFailureRequestedReset = icsneoc2_app_error_type_system_failure_requested_reset,
|
||||
AppErrorPortKeyMistmatch = icsneoc2_app_error_type_port_key_mistmatch,
|
||||
AppErrorBusFailure = icsneoc2_app_error_type_bus_failure,
|
||||
AppErrorTapOverflow = icsneoc2_app_error_type_tap_overflow,
|
||||
AppErrorEthTxNoLink = icsneoc2_app_error_type_eth_tx_no_link,
|
||||
AppErrorErrorBufferOverflow = icsneoc2_app_error_type_error_buffer_overflow,
|
||||
AppNoError = icsneoc2_app_error_type_no_error
|
||||
};
|
||||
|
||||
class AppErrorMessage : public RawMessage {
|
||||
|
||||
@@ -516,6 +516,42 @@ icsneoc2_error_t icsneoc2_message_can_error_props_get(
|
||||
icsneoc2_can_error_code_t *data_error_code,
|
||||
icsneoc2_message_can_error_flags_t *flags);
|
||||
|
||||
/**
|
||||
* Check if a message is an application error message
|
||||
*
|
||||
* @param[in] message The message to check.
|
||||
* @param[out] is_app_error Pointer to a bool to copy the app error status of the message into.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_message_is_app_error(icsneoc2_message_t* message, bool* is_app_error);
|
||||
|
||||
/**
|
||||
* Get the application error specific properties of a message
|
||||
*
|
||||
* @param[in] message The message to check.
|
||||
* @param[out] error_type Pointer to a icsneoc2_app_error_type_t to copy the error type into. If NULL, it's ignored.
|
||||
* @param[out] error_netid Pointer to a icsneoc2_netid_t to copy the associated network ID into. If NULL, it's ignored.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_invalid_type otherwise.
|
||||
*
|
||||
* @see icsneoc2_app_error_type_t, icsneoc2_message_app_error_string_get
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_message_app_error_props_get(icsneoc2_message_t* message,
|
||||
icsneoc2_app_error_type_t* error_type, icsneoc2_netid_t* error_netid);
|
||||
|
||||
/**
|
||||
* Get a human-readable description string for an application error message
|
||||
*
|
||||
* @param[in] message The message to check.
|
||||
* @param[out] value Pointer to a char buffer to copy the description into.
|
||||
* @param[in,out] value_length On input, the size of the value buffer; on output, the length of the copied string.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters, icsneoc2_error_invalid_type, or icsneoc2_error_string_copy_failed otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_message_app_error_string_get(icsneoc2_message_t* message,
|
||||
char* value, size_t* value_length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -465,6 +465,61 @@ typedef uint8_t icsneoc2_can_error_code_t;
|
||||
#define ICSNEOC2_MESSAGE_CAN_ERROR_FLAGS_ERROR_PASSIVE 0x02 // Error passive state
|
||||
#define ICSNEOC2_MESSAGE_CAN_ERROR_FLAGS_ERROR_WARN 0x04 // Error warning state
|
||||
|
||||
typedef enum _icsneoc2_app_error_type_t {
|
||||
icsneoc2_app_error_type_rx_messages_full = 0,
|
||||
icsneoc2_app_error_type_tx_messages_full = 1,
|
||||
icsneoc2_app_error_type_tx_report_messages_full = 2,
|
||||
icsneoc2_app_error_type_bad_comm_with_dsp_ic = 3,
|
||||
icsneoc2_app_error_type_driver_overflow = 4,
|
||||
icsneoc2_app_error_type_pc_buff_overflow = 5,
|
||||
icsneoc2_app_error_type_pc_chksum_error = 6,
|
||||
icsneoc2_app_error_type_pc_missed_byte = 7,
|
||||
icsneoc2_app_error_type_pc_overrun_error = 8,
|
||||
icsneoc2_app_error_type_setting_failure = 9,
|
||||
icsneoc2_app_error_type_too_many_selected_networks = 10,
|
||||
icsneoc2_app_error_type_network_not_enabled = 11,
|
||||
icsneoc2_app_error_type_rtc_not_correct = 12,
|
||||
icsneoc2_app_error_type_loaded_default_settings = 13,
|
||||
icsneoc2_app_error_type_feature_not_unlocked = 14,
|
||||
icsneoc2_app_error_type_feature_rtc_cmd_dropped = 15,
|
||||
icsneoc2_app_error_type_tx_messages_flushed = 16,
|
||||
icsneoc2_app_error_type_tx_messages_half_full = 17,
|
||||
icsneoc2_app_error_type_network_not_valid = 18,
|
||||
icsneoc2_app_error_type_tx_interface_not_implemented = 19,
|
||||
icsneoc2_app_error_type_tx_messages_comm_enable_is_off = 20,
|
||||
icsneoc2_app_error_type_rx_filter_match_count_exceeded = 21,
|
||||
icsneoc2_app_error_type_eth_preemption_not_enabled = 22,
|
||||
icsneoc2_app_error_type_tx_not_supported_in_mode = 23,
|
||||
icsneoc2_app_error_type_jumbo_frames_not_supported = 24,
|
||||
icsneoc2_app_error_type_ethernet_ip_fragment = 25,
|
||||
icsneoc2_app_error_type_tx_messages_underrun = 26,
|
||||
icsneoc2_app_error_type_device_fan_failure = 27,
|
||||
icsneoc2_app_error_type_device_overtemperature = 28,
|
||||
icsneoc2_app_error_type_tx_message_index_out_of_range = 29,
|
||||
icsneoc2_app_error_type_undersized_frame_dropped = 30,
|
||||
icsneoc2_app_error_type_oversized_frame_dropped = 31,
|
||||
icsneoc2_app_error_type_watchdog_event = 32,
|
||||
icsneoc2_app_error_type_system_clock_failure = 33,
|
||||
icsneoc2_app_error_type_system_clock_recovered = 34,
|
||||
icsneoc2_app_error_type_system_peripheral_reset = 35,
|
||||
icsneoc2_app_error_type_system_communication_failure = 36,
|
||||
icsneoc2_app_error_type_tx_messages_unsupported_source_or_packet_id = 37,
|
||||
icsneoc2_app_error_type_wbms_manager_connect_failed = 38,
|
||||
icsneoc2_app_error_type_wbms_manager_connect_bad_state = 39,
|
||||
icsneoc2_app_error_type_wbms_manager_connect_timeout = 40,
|
||||
icsneoc2_app_error_type_failed_to_initialize_logger_disk = 41,
|
||||
icsneoc2_app_error_type_invalid_setting = 42,
|
||||
icsneoc2_app_error_type_system_failure_requested_reset = 43,
|
||||
icsneoc2_app_error_type_port_key_mistmatch = 45,
|
||||
icsneoc2_app_error_type_bus_failure = 46,
|
||||
icsneoc2_app_error_type_tap_overflow = 47,
|
||||
icsneoc2_app_error_type_eth_tx_no_link = 48,
|
||||
icsneoc2_app_error_type_error_buffer_overflow = 254,
|
||||
icsneoc2_app_error_type_no_error = 255
|
||||
} _icsneoc2_app_error_type_t;
|
||||
|
||||
typedef uint16_t icsneoc2_app_error_type_t;
|
||||
|
||||
typedef uint64_t icsneoc2_message_can_error_flags_t;
|
||||
|
||||
typedef enum _icsneoc2_tc10_wake_status_t {
|
||||
|
||||
Reference in New Issue
Block a user