Golioth Firmware SDK
Loading...
Searching...
No Matches
golioth_status.h File Reference

Go to the source code of this file.

Macros

#define FOREACH_GOLIOTH_STATUS(STATUS)
 Status code enum used throughout Golioth SDK.
 
#define GENERATE_GOLIOTH_STATUS_ENUM(code)   code,
 
#define GOLIOTH_STATUS_RETURN_IF_ERROR(expr)
 

Enumerations

enum  golioth_status { FOREACH_GOLIOTH_STATUS =(GENERATE_GOLIOTH_STATUS_ENUM) NUM_GOLIOTH_STATUS_CODES }
 

Functions

const char * golioth_status_to_str (enum golioth_status status)
 

Macro Definition Documentation

◆ FOREACH_GOLIOTH_STATUS

#define FOREACH_GOLIOTH_STATUS ( STATUS)
Value:
STATUS(GOLIOTH_OK) /* 0 */ \
STATUS(GOLIOTH_ERR_FAIL) \
STATUS(GOLIOTH_ERR_DNS_LOOKUP) \
STATUS(GOLIOTH_ERR_NOT_IMPLEMENTED) \
STATUS(GOLIOTH_ERR_MEM_ALLOC) \
STATUS(GOLIOTH_ERR_NULL) /* 5 */ \
STATUS(GOLIOTH_ERR_INVALID_FORMAT) \
STATUS(GOLIOTH_ERR_SERIALIZE) \
STATUS(GOLIOTH_ERR_IO) \
STATUS(GOLIOTH_ERR_TIMEOUT) \
STATUS(GOLIOTH_ERR_QUEUE_FULL) /* 10 */ \
STATUS(GOLIOTH_ERR_NOT_ALLOWED) \
STATUS(GOLIOTH_ERR_INVALID_STATE) \
STATUS(GOLIOTH_ERR_NO_MORE_DATA) \
STATUS(GOLIOTH_ERR_NACK) \
STATUS(GOLIOTH_ERR_BAD_REQUEST) /* 15 */ \
STATUS(GOLIOTH_ERR_INVALID_BLOCK_SIZE)

Status code enum used throughout Golioth SDK.

Definition at line 15 of file golioth_status.h.

◆ GENERATE_GOLIOTH_STATUS_ENUM

#define GENERATE_GOLIOTH_STATUS_ENUM ( code)    code,

Definition at line 35 of file golioth_status.h.

◆ GOLIOTH_STATUS_RETURN_IF_ERROR

#define GOLIOTH_STATUS_RETURN_IF_ERROR ( expr)
Value:
do \
{ \
enum golioth_status status = (expr); \
if (status != GOLIOTH_OK) \
{ \
return status; \
} \
} while (0)
golioth_status

Helper macro, for functions that return type enum golioth_status, if they want to return early when an expression returns something other than GOLIOTH_OK.

Definition at line 51 of file golioth_status.h.

Enumeration Type Documentation

◆ golioth_status

Enumerator
FOREACH_GOLIOTH_STATUS 

Definition at line 36 of file golioth_status.h.

Function Documentation

◆ golioth_status_to_str()

const char * golioth_status_to_str ( enum golioth_status status)

Convert status code to human-readable string

Parameters
statusstatus code to convert to string
Returns
static string representation of status code