src.dualinventive.com/fw/libdi_fw-tests/libdi/include/di/device/error.h

64 lines
1.5 KiB
C

#ifndef LIBDI_INCLUDE_DI_DEVICE_ERROR_H_
#define LIBDI_INCLUDE_DI_DEVICE_ERROR_H_
#include <di/types.h>
typedef struct mpack_writer_t mpack_writer_t;
#ifdef __cplusplus
extern "C" {
#endif
/**
* Check if one or more device errors are set
*/
bool di_device_error_is_set(void);
/**
* Set or increment device error. The only valid error codes ranges are:
* - Generic (1-255)
* - Firmware (1024-2999)
* - CAN Protocol (3000-3050)
* @param error Error code to set or increment
* @retval DNOK Error is set or incremented
* @retval DNE_PARAM Error is not within valid range
* @retval DNE_NOMEM No space left to store error
*/
di_errno_t di_device_error_set(const di_errno_t error);
/**
* Check if specific device error code is set
* @retval true Device error is set
* @retval false Device error is not set
*/
bool di_device_error_is_specific_set(di_errno_t error);
/**
* Unset device error code
* @retval true Device error is reset
* @retval false No such device error known
*/
void di_device_error_unset(const di_errno_t error);
/**
* Reset all device errors (this is called also at di_device_init)
*/
void di_device_error_reset_all(void);
/**
* Write all current errors in RPC message result format
* as Array of di_error items.
*/
di_errno_t di_device_error_list_write_rpc_result_msg(mpack_writer_t *writer);
/**
* Get the device error list size (maximum amount of errors can be stored)
*/
size_t di_device_error_list_size(void);
#ifdef __cplusplus
}
#endif
#endif /* LIBDI_INCLUDE_DI_DEVICE_ERROR_H_ */