[lib] Add macro OWL_IS_REQUEST_TYPE()
This macro allows to check if a given number is a valid request type.
This commit is contained in:
parent
669f5b1064
commit
d995cdfc7d
|
@ -218,6 +218,8 @@ typedef struct _owl_autocalibration_order owl_autocalibration_order ;
|
||||||
/// Undefined or unknown request type
|
/// Undefined or unknown request type
|
||||||
#define OWL_REQUEST_UNDEFINED 255
|
#define OWL_REQUEST_UNDEFINED 255
|
||||||
//@}
|
//@}
|
||||||
|
/* Don't forget to update the OWL_IS_REQUEST_TYPE macro below when you
|
||||||
|
* change something here! */
|
||||||
|
|
||||||
|
|
||||||
/** @name Wi-Fi channels' frequencies in MHz */
|
/** @name Wi-Fi channels' frequencies in MHz */
|
||||||
|
@ -304,11 +306,27 @@ extern bool owl_run ;
|
||||||
|
|
||||||
|
|
||||||
/* Macros */
|
/* Macros */
|
||||||
|
|
||||||
/// Converts a bool to the corresponding string
|
/// Converts a bool to the corresponding string
|
||||||
#define OWL_BOOL_TO_STRING(B) ((B) ? "true" : "false")
|
#define OWL_BOOL_TO_STRING(B) ((B) ? "true" : "false")
|
||||||
|
|
||||||
|
/// Make sure the given integer is a valid request type
|
||||||
|
/**
|
||||||
|
* True if `I` is a valid request type, false otherwise.
|
||||||
|
* Do *not* pass an incremented number to this macro (e.g. type++ or
|
||||||
|
* ++type). This shouldn't be a problem with a request type, though.
|
||||||
|
*/
|
||||||
|
#define OWL_IS_REQUEST_TYPE(I) \
|
||||||
|
( (I) == OWL_REQUEST_NORMAL \
|
||||||
|
|| (I) == OWL_REQUEST_CALIBRATION \
|
||||||
|
|| (I) == OWL_REQUEST_AUTOCALIBRATION \
|
||||||
|
|| (I) == OWL_REQUEST_GENERATED \
|
||||||
|
|| (I) == OWL_REQUEST_IMPLICIT \
|
||||||
|
|| (I) == OWL_REQUEST_UNDEFINED)
|
||||||
|
|
||||||
|
|
||||||
/* Function headers */
|
/* Function headers */
|
||||||
|
|
||||||
/** @name Miscellaneous */
|
/** @name Miscellaneous */
|
||||||
//@{
|
//@{
|
||||||
/// Converts a MAC address from bytes to string
|
/// Converts a MAC address from bytes to string
|
||||||
|
|
Loading…
Reference in New Issue