error.c: Add SR_ERR_DEV_CLOSED.

This commit is contained in:
Uwe Hermann 2013-04-27 10:49:52 +02:00
parent 3a581560f1
commit 409a811b8c
2 changed files with 13 additions and 2 deletions

10
error.c
View File

@ -55,7 +55,7 @@ SR_API const char *sr_strerror(int error_code)
const char *str; const char *str;
/* /*
* Note: All defined SR_* error macros from libsigrok.h should have * Note: All defined SR_* error macros from libsigrok.h must have
* an entry in this function, as well as in sr_strerror_name(). * an entry in this function, as well as in sr_strerror_name().
*/ */
@ -81,6 +81,9 @@ SR_API const char *sr_strerror(int error_code)
case SR_ERR_NA: case SR_ERR_NA:
str = "not applicable"; str = "not applicable";
break; break;
case SR_ERR_DEV_CLOSED:
str = "device closed but should be open";
break;
default: default:
str = "unknown error"; str = "unknown error";
break; break;
@ -112,7 +115,7 @@ SR_API const char *sr_strerror_name(int error_code)
const char *str; const char *str;
/* /*
* Note: All defined SR_* error macros from libsigrok.h should have * Note: All defined SR_* error macros from libsigrok.h must have
* an entry in this function, as well as in sr_strerror(). * an entry in this function, as well as in sr_strerror().
*/ */
@ -138,6 +141,9 @@ SR_API const char *sr_strerror_name(int error_code)
case SR_ERR_NA: case SR_ERR_NA:
str = "SR_ERR_NA"; str = "SR_ERR_NA";
break; break;
case SR_ERR_DEV_CLOSED:
str = "SR_ERR_DEV_CLOSED";
break;
default: default:
str = "unknown error code"; str = "unknown error code";
break; break;

View File

@ -72,6 +72,11 @@ enum {
SR_ERR_SAMPLERATE = -5, /**< Incorrect samplerate. */ SR_ERR_SAMPLERATE = -5, /**< Incorrect samplerate. */
SR_ERR_NA = -6, /**< Not applicable. */ SR_ERR_NA = -6, /**< Not applicable. */
SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but needs to be open. */ SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but needs to be open. */
/*
* Note: When adding entries here, don't forget to also update the
* sr_strerror() and sr_strerror_name() functions in error.c.
*/
}; };
#define SR_MAX_NUM_PROBES 64 /* Limited by uint64_t. */ #define SR_MAX_NUM_PROBES 64 /* Limited by uint64_t. */