Add SDUtils_GetStatusStr

This commit is contained in:
Maschell 2022-09-03 23:40:32 +02:00
parent 77c4c30d6f
commit aa469e5fa3
2 changed files with 30 additions and 0 deletions

View File

@ -32,6 +32,8 @@ typedef void (*SDAttachHandlerFn)(SDUtilsAttachStatus status);
typedef void (*SDCleanUpHandlesHandlerFn)(); typedef void (*SDCleanUpHandlesHandlerFn)();
const char *SDUtils_GetStatusStr(SDUtilsStatus status);
/** /**
* Initializes the SDUtils library. This must be call before any other function can be called * Initializes the SDUtils library. This must be call before any other function can be called
* @return SDUTILS_RESULT_SUCCESS on success, the functions of this lib can be used <br> * @return SDUTILS_RESULT_SUCCESS on success, the functions of this lib can be used <br>

View File

@ -14,6 +14,34 @@ static bool (*sSDUtilsRemoveAttachHandler)(SDAttachHandlerFn) = nullptr;
static bool (*sSDUtilsAddCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr; static bool (*sSDUtilsAddCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr;
static bool (*sSDUtilsRemoveCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr; static bool (*sSDUtilsRemoveCleanUpHandlesHandler)(SDCleanUpHandlesHandlerFn) = nullptr;
const char *SDUtils_GetStatusStr(SDUtilsStatus status) {
switch (status) {
case SDUTILS_RESULT_SUCCESS:
return "SDUTILS_RESULT_SUCCESS";
case SDUTILS_RESULT_MODULE_NOT_FOUND:
return "SDUTILS_RESULT_MODULE_NOT_FOUND";
case SDUTILS_RESULT_MODULE_MISSING_EXPORT:
return "SDUTILS_RESULT_MODULE_MISSING_EXPORT";
case SDUTILS_RESULT_MAX_CALLBACKS:
return "SDUTILS_RESULT_MAX_CALLBACKS";
case SDUTILS_RESULT_NOT_FOUND:
return "SDUTILS_RESULT_NOT_FOUND";
case SDUTILS_RESULT_INVALID_ARGUMENT:
return "SDUTILS_RESULT_INVALID_ARGUMENT";
case SDUTILS_RESULT_FAILED:
return "SDUTILS_RESULT_FAILED";
case SDUTILS_RESULT_LIB_UNINITIALIZED:
return "SDUTILS_RESULT_LIB_UNINITIALIZED";
case SDUTILS_RESULT_UNSUPPORTED_VERSION:
return "SDUTILS_RESULT_UNSUPPORTED_VERSION";
case SDUTILS_RESULT_UNSUPPORTED_COMMAND:
return "SDUTILS_RESULT_UNSUPPORTED_COMMAND";
case SDUTILS_RESULT_UNKNOWN_ERROR:
return "SDUTILS_RESULT_UNKNOWN_ERROR";
}
return "SDUTILS_RESULT_UNKNOWN_ERROR";
}
static SDUtilsVersion sSDUtilsVersion = SD_UTILS_MODULE_VERSION_ERROR; static SDUtilsVersion sSDUtilsVersion = SD_UTILS_MODULE_VERSION_ERROR;
SDUtilsStatus SDUtils_InitLibrary() { SDUtilsStatus SDUtils_InitLibrary() {