-
Notifications
You must be signed in to change notification settings - Fork 1
/
gecko_ble_errors.c
63 lines (52 loc) · 1.31 KB
/
gecko_ble_errors.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* ble_errors.c
*
* Created on: Feb 13, 2019
* Author: Dan Walkes
*
* @brief A file to help with handling of bluetooth BLE errors from the Blue Gecko
*/
#include "gecko_ble_errors.h"
/**
* Redefine the enumeration for use in the bleResponseFailureDescription function below
*/
#undef BG_ERROR_ENUM
#define BG_ERROR_ENUM(enumval,detail)\
case enumval:\
detailstr=detail;\
break;
/**
* @return a const char* to the failure description string for the error represented by
* @param error.
* For instance passing error enum bg_err_hardware_ps_store_full will
* return "Flash reserved for PS store is full"
*/
const char *bleResponseFailureDescription(enum bg_error error)
{
const char *detailstr = "Unknown";
switch(error) {
BG_ERROR_LIST
}
return detailstr;
}
/**
* Redefine the enumeration for use in the bleResponseString function below
*/
#undef BG_ERROR_ENUM
#define BG_ERROR_ENUM(enumval,detail)\
case enumval:\
enumstr=#enumval;\
break;
/**
* @return the response string corresponding to the @param error bg_error enumeration.
* For instance passing error bg_err_hardware_ps_store_full will return
* "bg_err_hardware_ps_store_full"
*/
const char *bleResponseString(enum bg_error error)
{
const char *enumstr = "Unknown";
switch(error) {
BG_ERROR_LIST
}
return enumstr;
}