Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
Common Status and Error Codes

Shared result codes returned by every framework function. More...

Files

file  src/utils/status/sapi_status.c
 Implementation of sapi_status_to_string().

Enumerations

enum  sapi_status_t {
  SAPI_STATUS_OK = 0 , SAPI_STATUS_INVALID_PARAM = 1 , SAPI_STATUS_NOT_INITIALIZED = 2 , SAPI_STATUS_ALREADY_INITIALIZED = 3 ,
  SAPI_STATUS_TIMEOUT = 4 , SAPI_STATUS_RESOURCE_EXHAUSTED = 5 , SAPI_STATUS_NOT_SUPPORTED = 6 , SAPI_STATUS_NOT_IMPLEMENTED = 7 ,
  SAPI_STATUS_HARDWARE_FAULT = 8 , SAPI_STATUS_DATA_CORRUPTION = 9 , SAPI_STATUS_INTERNAL_ERROR = 10 , SAPI_STATUS_VALUE_OUT_OF_RANGE = 11 ,
  SAPI_STATUS_INVALID_STATE = 12
}
 Common result/status codes. More...

Functions

const char * sapi_status_to_string (sapi_status_t status)
 Returns a short, static, human-readable string for a status code. Intended for diagnostics/logging only; never on a safety-decision path.

Detailed Description

Shared result codes returned by every framework function.

Enumeration Type Documentation

◆ sapi_status_t

Common result/status codes.

Explicit numeric values are fixed and part of the ABI: do not renumber existing entries, only append.

Enumerator
SAPI_STATUS_OK 

Operation succeeded.

SAPI_STATUS_INVALID_PARAM 

Null pointer or out-of-range argument.

SAPI_STATUS_NOT_INITIALIZED 

Object used before create/init.

SAPI_STATUS_ALREADY_INITIALIZED 

Object already created/initialized.

SAPI_STATUS_TIMEOUT 

Blocking call exceeded its deadline.

SAPI_STATUS_RESOURCE_EXHAUSTED 

Static pool/storage/slots full.

SAPI_STATUS_NOT_SUPPORTED 

Valid request, backend cannot perform it.

SAPI_STATUS_NOT_IMPLEMENTED 

Backend is a stub (skeleton state).

SAPI_STATUS_HARDWARE_FAULT 

Backend reported a hardware-level fault.

SAPI_STATUS_DATA_CORRUPTION 

Integrity check (e.g. NVM CRC) failed.

SAPI_STATUS_INTERNAL_ERROR 

Defensive catch-all: should never happen.

SAPI_STATUS_VALUE_OUT_OF_RANGE 

Checked cast: value does not fit the destination type.

SAPI_STATUS_INVALID_STATE 

Operation not permitted in the application's current lifecycle phase (e.g. a setup-only constructor called after sapi_appmanager_run() has locked setup - see sapi_lifecycle.h).

Definition at line 26 of file sapi_status.h.

Function Documentation

◆ sapi_status_to_string()

const char * sapi_status_to_string ( sapi_status_t status)

Returns a short, static, human-readable string for a status code. Intended for diagnostics/logging only; never on a safety-decision path.

Convert a status code to a short, human-readable string.

REQ-OAL-COMMON-002

Returns a short, static, human-readable string for a status code. Intended for diagnostics/logging only; never on a safety-decision path.

Local makros Local types declarations Local variables declarations Global variables declarations Local function declarations Global functions

Parameters
statusStatus code to describe.
Returns
Static, non-NULL string literal naming status (e.g. "SAPI_STATUS_OK"); an unrecognized value yields "UNKNOWN_STATUS".
Safety:
Never returns NULL; safe to call with any int-range value.

Definition at line 27 of file sapi_status.c.