#ifndef INCLUDE_DI_ERRNO_H_ #define INCLUDE_DI_ERRNO_H_ #ifdef __cplusplus extern "C" { #endif #include #include #define DI_ERRNO_LIST \ \ /******************/ \ /* error sections */ \ /******************/ \ \ DI_ERRNO(DNOK, 0U, "Valid/success") \ /* 1 - 255: Generic */ \ DI_ERRNO(DNE_PARAM, 1U, "Invalid parameter") \ DI_ERRNO(DNE_RANGE, 2U, "Value/parameter out of range") \ DI_ERRNO(DNE_NODEV, 3U, "No such device") \ DI_ERRNO(DNE_NORES, 4U, "No such resource") \ DI_ERRNO(DNE_BUSY, 5U, "Device or resource busy") \ DI_ERRNO(DNE_OPNOTSUPP, 6U, "Operation not supported") \ DI_ERRNO(DNE_PROTO, 7U, "Protocol error") \ DI_ERRNO(DNE_CHECKSUM, 8U, "Checksum error") \ DI_ERRNO(DNE_TIMEOUT, 9U, "Timeout") \ DI_ERRNO(DNE_DISCONNECTED, 10U, "Disconnected") \ DI_ERRNO(DNE_AGAIN, 11U, "Try again") \ DI_ERRNO(DNE_OPDENIED, 12U, "Operation denied") \ DI_ERRNO(DNE_IOFAILED, 13U, "I/O operation failed") \ DI_ERRNO(DNE_NOTFOUND, 14U, "Not found") \ DI_ERRNO(DNE_NOMEM, 15U, "Out of memory") \ /* 256 - 511: Secure server */ \ DI_ERRNO(DNE_DUPLICATE_PROJECT, 256U, "Duplicate project found") \ DI_ERRNO(DNE_INVALID_PROJECT_STATE, 257U, "Invalid project state reached") \ DI_ERRNO(DNE_INVALID_MUTATION, 258U, "Invalid mutation requested") \ DI_ERRNO(DNE_INVALID_ACTION, 259U, "Invalid action specified") \ DI_ERRNO(DNE_PROJECT_CHANGED, 260U, "Project data changed") \ DI_ERRNO(DNE_PLANNING_CHANGED, 261U, "Project planning changed") \ DI_ERRNO(DNE_DESIGN_CHANGED, 262U, "Project design changed") \ DI_ERRNO(DNE_DATABASE_ERROR, 263U, "Database error occurred") \ DI_ERRNO(DNE_NO_PROJECT_DATA, 264U, "No project data provided") \ DI_ERRNO(DNE_INVALID_PROJECT, 265U, "Invalid project selected") \ DI_ERRNO(DNE_INVALID_REQUEST, 266U, "Invalid request supplied") \ DI_ERRNO(DNE_INTERNAL_ERROR, 267U, "Internal error supplied") \ DI_ERRNO(DNE_NO_BACKEND, 268U, "Back-end is not connected") \ DI_ERRNO(DNE_BACKEND_INVALID_MESSAGE, 269U, "Back-end sent an invalid message") \ DI_ERRNO(DNE_SETUP_CHANGED, 270U, "Project setup changed") \ DI_ERRNO(DNE_INVALID_PROJECT_TYPE, 271U, "Project type not recognized") \ DI_ERRNO(DNE_NO_PROJECT_GROUP, 273U, "No project groups provided") \ /* 512 - 767: Backend */ \ DI_ERRNO(DNE_BACKEND_DUPLICATE_PROJECT, 512U, "Duplicate project") \ DI_ERRNO(DNE_BACKEND_INVALID_PROJECT, 513U, "Invalid project") \ DI_ERRNO(DNE_BACKEND_DEVICE_ERROR, 514U, "Device error") \ DI_ERRNO(DNE_BACKEND_INTERNAL_ERROR, 515U, "Back-end internal error") \ DI_ERRNO(DNE_BACKEND_INVALID_MUTATION, 516U, "Invalid mutation requested") \ DI_ERRNO(DNE_BACKEND_INVALID_GROUP, 517U, "Invalid group action") \ /* 768 - 1023 reserved for future use */ \ /* 1024 - 2999: Firmware */ \ DI_ERRNO(DNE_FIRMWARE_TILT, 1024U, "Tilt position error") \ DI_ERRNO(DNE_FIRMWARE_ULTRASONIC, 1025U, "Ultrasonic error") \ DI_ERRNO(DNE_FIRMWARE_SPEAKER, 1026U, "Speaker error") \ DI_ERRNO(DNE_FIRMWARE_EEPROM, 1027U, "EEPROM error") \ DI_ERRNO(DNE_FIRMWARE_CALIBRATION, 1028U, "Calibration error") \ DI_ERRNO(DNE_FIRMWARE_BA, 1029U, "BA error") \ DI_ERRNO(DNE_FIRMWARE_VREF_TOO_LOW, 1030U, "Vref below threshhold") \ DI_ERRNO(DNE_FIRMWARE_VREF_CLIPPING, 1031U, "Vref clipping") \ DI_ERRNO(DNE_FIRMWARE_LEADER_FAILURE, 1032U, "Leader failed (failsafe)") \ DI_ERRNO(DNE_FIRMWARE_FOLLOWER_FAILURE, 1033U, "Follower failed (failsafe)") \ DI_ERRNO(DNE_FIRMWARE_ROTATION, 1034U, "Rotation position error") \ DI_ERRNO(DNE_FIRMWARE_DETECTIONBUTTON, 1035U, "Detection button error") \ DI_ERRNO(DNE_FIRMWARE_DEADMAN_TIMEOUT, 1036U, "Deadman timeout error") \ DI_ERRNO(DNE_FIRMWARE_BATTERY_TOO_LOW, 1037U, "Battery too low") \ DI_ERRNO(DNE_FIRMWARE_SWITCH_COMM, 1038U, "Switch communication error") \ DI_ERRNO(DNE_FIRMWARE_LEADER_CONFLICT, 1039U, "Leader conflict") \ DI_ERRNO(DNE_FIRMWARE_TEMPERATURE, 1040U, "Temperature sensor failure") \ DI_ERRNO(DNE_FIRMWARE_MEASUREMENT, 1041U, "Measurement error") \ DI_ERRNO(DNE_FIRMWARE_GPS, 1042U, "GPS error") \ DI_ERRNO(DNE_FIRMWARE_MCU_COMM, 1043U, "MCU communication error") \ DI_ERRNO(DNE_FIRMWARE_DU_STRIKE_ROLE_UNKNOWN, 1044U, "Detection unit strike role unknown") \ DI_ERRNO(DNE_FIRMWARE_MODEM_UART_FRAMING, 1045U, "Modem UART framing error") \ DI_ERRNO(DNE_FIRMWARE_BATTERY_BOARD, 1046U, "At least 1 battery section broken") \ DI_ERRNO(DNE_FIRMWARE_SPEAKER_L, 1047U, "Speaker error Main board") \ DI_ERRNO(DNE_FIRMWARE_SPEAKER_F, 1048U, "Speaker error Monitor board") \ DI_ERRNO(DNE_FIRMWARE_EEPROM_L, 1049U, "EEPROM error Main board") \ DI_ERRNO(DNE_FIRMWARE_EEPROM_F, 1050U, "EEPROM error Monitor board") \ DI_ERRNO(DNE_FIRMWARE_BATTERY_TOO_LOW_L, 1051U, "Battery too low Main board") \ DI_ERRNO(DNE_FIRMWARE_BATTERY_TOO_LOW_F, 1052U, "Battery too low Monitor board") \ DI_ERRNO(DNE_FIRMWARE_NO_MEASUREMENT, 1053U, "There is no measurement available") \ DI_ERRNO(DNE_FIRMWARE_BATTERY1_LOW, 1054U, "Battery 1 is low") \ DI_ERRNO(DNE_FIRMWARE_BATTERY1_CRITICAL, 1055U, "Battery 1 is critical") \ DI_ERRNO(DNE_FIRMWARE_BATTERY1_EMPTY, 1056U, "Battery 1 is empty") \ DI_ERRNO(DNE_FIRMWARE_BATTERY1_REMOVED, 1057U, "Battery 1 is removed") \ DI_ERRNO(DNE_FIRMWARE_BATTERY2_LOW, 1058U, "Battery 2 is low") \ DI_ERRNO(DNE_FIRMWARE_BATTERY2_CRITICAL, 1059U, "Battery 2 is critical") \ DI_ERRNO(DNE_FIRMWARE_BATTERY2_EMPTY, 1060U, "Battery 2 is empty") \ DI_ERRNO(DNE_FIRMWARE_BATTERY2_REMOVED, 1061U, "Battery 2 is removed") \ DI_ERRNO(DNE_FIRMWARE_KEYSWITCH_NOT_OPERATIONAL, 1062U, "Keyswitch is not operational") \ DI_ERRNO(DNE_FIRMWARE_DEVICE_CONTAINS_ERRORS, 1063U, "Device contains errors") \ DI_ERRNO(DNE_FIRMWARE_DEVICE_SERVICE, 1064U, "State transition not allowed, device is service") \ DI_ERRNO(DNE_FIRMWARE_DEVICE_ARMED, 1065U, "State transition not allowed, device is armed") \ DI_ERRNO(DNE_FIRMWARE_DEVICE_ACTIVE, 1066U, "State transition not allowed, device is active") \ DI_ERRNO(DNE_FIRMWARE_DEVICE_IDLE, 1067U, "State transition not allowed, device is idle") \ DI_ERRNO(DNE_FIRMWARE_DNCM_NO_REQREP_BUFFER, 1068U, "No space for request in buffer") \ DI_ERRNO(DNE_FIRMWARE_MISMATCH_TOKEN, 1069U, "Device is already armed using a different token") \ DI_ERRNO(DNE_FIRMWARE_RELEASE_SWITCH_COMM, 1070U, "Switch communication error during release") \ DI_ERRNO(DNE_FIRMWARE_ACTIVATE_SWITCH_COMM, 1071U, "Switch communication error during activate") \ DI_ERRNO(DNE_FIRMWARE_DEACTIVATE_SWITCH_COMM, 1072U, "Switch communication error during deactivate") \ DI_ERRNO(DNE_FIRMWARE_ACTIVATE_SHORT_NOT_ENABLED, 1073U, "Switch communication error during deactivate") \ DI_ERRNO(DNE_FIRMWARE_DEACTIVATE_SHORT_ENABLED, 1074U, "Short is not disabled after deactivate") \ DI_ERRNO(DNE_FIRMWARE_ULTRASONIC_CURRENT_1, 1075U, "Ultrasonic sensor 1 failed (current measurement)") \ DI_ERRNO(DNE_FIRMWARE_ULTRASONIC_CURRENT_2, 1076U, "Ultrasonic sensor 2 failed (current measurement)") \ DI_ERRNO(DNE_FIRMWARE_ULTRASONIC_CURRENT_BOTH, 1077U, "Ultrasonic sensor 1 & 2 failed (current measurement)") \ DI_ERRNO(DNE_FIRMWARE_ULTRASONIC_IO_1, 1078U, "Ultrasonic sensor 1 failed (IO-path measurement)") \ DI_ERRNO(DNE_FIRMWARE_ULTRASONIC_IO_2, 1079U, "Ultrasonic sensor 2 failed (IO-path measurement)") \ DI_ERRNO(DNE_FIRMWARE_ULTRASONIC_IO_BOTH, 1080U, "Ultrasonic sensor 1 & 2 failed (IO-path measurement)") \ DI_ERRNO(DNE_FIRMWARE_IO_FAILED_I2C, 1081U, "I2C bus communication error") \ DI_ERRNO(DNE_FIRMWARE_IO_FAILED_ADC, 1082U, "ADC peripheral error") \ /* 3000 - 3050: DI CAN Protocol */ \ DI_ERRNO(DNE_CAN_INVAL, 3000U, "CAN invalid argument") \ DI_ERRNO(DNE_CAN_IO, 3001U, "CAN peripheral I/O error") \ DI_ERRNO(DNE_CAN_TIMEOUT, 3002U, "CAN timeout") \ DI_ERRNO(DNE_CAN_AGAIN, 3003U, "CAN try again") \ DI_ERRNO(DNE_CAN_NOBUFS, 3004U, "CAN buffers depleted") \ DI_ERRNO(DNE_CAN_PROTO, 3005U, "CAN protocol error") \ DI_ERRNO(DNE_CAN_CRC, 3006U, "CAN msg CRC error") \ /* 3051 - 9215 reserved for future use */ \ /* 9216 - 10239 Frontend */ \ /* 10240 - 999999 reserved for future use */ \ /* 1000000 - 1000999 MTinfo 3000 client API */ \ \ /********************/ \ /* warning sections */ \ /********************/ \ /* 2000001 - 2000255: Generic */ \ /* 2000256 - 2000511: Secure server */ \ /* 2000512 - 2000767: Backend */ \ DI_ERRNO(DNE_WRN_BACKEND_DEVICE_WARNING, 2000512, "Backend device warning") \ /* 2000768 - 2001023 reserved for future use */ \ /* 2001024 - 2002999: Firmware */ \ DI_ERRNO(DNE_WRN_FIRMWARE_ACTIVATE_SHORT_PRESENT, 2001024, "ZKL unexpected short while activating") \ DI_ERRNO(DNE_WRN_FIRMWARE_DEACTIVATE_SHORT_PRESENT, 2001025, "ZKL unexpected short while deactivating") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY1_LOW, 2001026, "Battery 1 is low") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY1_CRITICAL, 2001027, "Battery 1 is critical") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY1_EMPTY, 2001028, "Battery 1 is empty") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY1_REMOVED, 2001029, "Battery 1 is removed") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY2_LOW, 2001030, "Battery 2 is low") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY2_CRITICAL, 2001031, "Battery 2 is critical") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY2_EMPTY, 2001032, "Battery 2 is empty") \ DI_ERRNO(DNE_WRN_FIRMWARE_BATTERY2_REMOVED, 2001033, "Battery 2 is removed") \ DI_ERRNO(DNE_WRN_FIRMWARE_ULTRASONIC_CURRENT_1, 2001034, "Ultrasonic sensor 1 failed (current measurement)") \ DI_ERRNO(DNE_WRN_FIRMWARE_ULTRASONIC_CURRENT_2, 2001035, "Ultrasonic sensor 2 failed (current measurement)") \ DI_ERRNO(DNE_WRN_FIRMWARE_ULTRASONIC_CURRENT_BOTH, 2001036, "Ultrasonic sensor 1 & 2 failed (current measurement)") \ DI_ERRNO(DNE_WRN_FIRMWARE_ULTRASONIC_IO_1, 2001037, "Ultrasonic sensor 1 failed (IO-path measurement)") \ DI_ERRNO(DNE_WRN_FIRMWARE_ULTRASONIC_IO_2, 2001038, "Ultrasonic sensor 2 failed (IO-path measurement)") \ DI_ERRNO(DNE_WRN_FIRMWARE_ULTRASONIC_IO_BOTH, 2001039, "Ultrasonic sensor 1 & 2 failed (IO-path measurement)") \ DI_ERRNO(DNE_WRN_FIRMWARE_ACTIVATE_DETECTION_NOK, 2001040, "Detection is not ok after activate") \ DI_ERRNO(DNE_WRN_FIRMWARE_NEEDS_REBOOT, 2001041, "Firmware needs reboot") \ /* 2003000 - 2003050: DI CAN Protocol */ \ /* 2003051 - 2009215 reserved for future use */ \ /* 2009216 - 2010239 Frontend */ \ /* 2010240 - 2999999 reserved for future use */ \ /* 3000000 - 3000999 MTinfo 3000 client API */ \ /* 3001000 - (UINT32_MAX - 1) reserved for future use */ \ /* UINT32_MAX: Unknown/reserved */ \ DI_ERRNO(DNE_UNKNOWN, UINT32_MAX, "") #define DI_ERRNO(_e, _v, descr) _e = _v, enum di_errno { DI_ERRNO_LIST }; #undef DI_ERRNO /** Error code ranges */ enum di_errno_ranges { DI_ERRNO_RANGE_GENERIC_FIRST = 1, DI_ERRNO_RANGE_GENERIC_LAST = 255, DI_ERRNO_RANGE_SECURE_SERVER_FIRST = 256, DI_ERRNO_RANGE_SECURE_SERVER_LAST = 511, DI_ERRNO_RANGE_BACKEND_FIRST = 512, DI_ERRNO_RANGE_BACKEND_LAST = 767, /* 768-1023 reserved for future use */ DI_ERRNO_RANGE_FIRMWARE_FIRST = 1024, DI_ERRNO_RANGE_FIRMWARE_LAST = 2999, DI_ERRNO_RANGE_CAN_PROTOCOL_FIRST = 3000, DI_ERRNO_RANGE_CAN_PROTOCOL_LAST = 3050, /* 3051 - 9215 reserved for future use */ DI_ERRNO_RANGE_FRONTEND_FIRST = 9216, DI_ERRNO_RANGE_FRONTEND_LAST = 10239, /* 10240 - 999999 reserved for future use */ DI_ERRNO_RANGE_MTINFO3000_CLIENT_API_FIRST = 1000000, DI_ERRNO_RANGE_MTINFO3000_CLIENT_API_LAST = 1000999, /* 1001000 - 1999999 reserved for future use */ DI_ERRNO_RANGE_WARNING_GENERIC_FIRST = 2000001, DI_ERRNO_RANGE_WARNING_GENERIC_LAST = 2000255, DI_ERRNO_RANGE_WARNING_SECURE_SERVER_FIRST = 2000256, DI_ERRNO_RANGE_WARNING_SECURE_SERVER_LAST = 2000511, DI_ERRNO_RANGE_WARNING_BACKEND_FIRST = 2000512, DI_ERRNO_RANGE_WARNING_BACKEND_LAST = 2000767, DI_ERRNO_RANGE_WARNING_FIRMWARE_FIRST = 2001024, DI_ERRNO_RANGE_WARNING_FIRMWARE_LAST = 2002999, /* 2001256 - (UINT32_MAX - 1) reserved for future use */ }; /** * Get errno enumerator description * @param errnum Error number of type di_errno */ const char *di_errno_descr(uint32_t errnum); /** * Get errno enumerator string * @param errnum Error number of type di_errno */ const char *di_errno_str(uint32_t errnum); /** * Returns true when errnum is an error * @param errnum Error number of type di_errno */ bool di_errno_is_error(const uint32_t errnum); /** * Returns true when errnum is a warning * @param errnum Error number of type di_errno */ bool di_errno_is_warning(const uint32_t errnum); #ifdef __cplusplus } #endif #endif /* INCLUDE_DI_ERRNO_H_ */