diff --git a/src/HAPConstants.h b/src/HAPConstants.h index d15b9a2..fc87ad3 100644 --- a/src/HAPConstants.h +++ b/src/HAPConstants.h @@ -87,12 +87,3 @@ enum class StatusCode { InvalidValue=-70410, TBD=-1 // status To-Be-Determined (TBD) once service.update() called - internal use only }; - -// Based on HomeKit documentation for HMCharacteristicTypeCurrentSecuritySystemState -typedef enum { - Stay=0, // Armed for Stay, or Armed while at Home - Away=1, // Armed for Away - Night=2, // Armed for Night - Disarmed=3, // Disarmed, or Off - Alarm=4 // Alarm is triggered -} HSSecuritySystemState; \ No newline at end of file diff --git a/src/Span.h b/src/Span.h index ff43382..c1d527f 100644 --- a/src/Span.h +++ b/src/Span.h @@ -406,6 +406,9 @@ namespace Service { // SPAN CHARACTERISTICS (HAP Chapter 9) // ////////////////////////////////////////// +#define CREATE_CHAR_ENUM(HAPCHAR, ...) \ + typedef enum { __VA_ARGS__ } HAPCHAR; + // Macro to define Span Characteristic structures based on name of HAP Characteristic, default value, and min/max value (not applicable for STRING or BOOL which default to min=0, max=1) #define CREATE_CHAR(TYPE,HAPCHAR,DEFVAL,MINVAL,MAXVAL) \ @@ -530,6 +533,12 @@ namespace Characteristic { CREATE_CHAR(uint8_t,VolumeSelector,0,0,1); CREATE_CHAR(double,WaterLevel,0,0,100); + // Macros to define enum values for specific characteristic states / values. + CREATE_CHAR_ENUM(ChargingStatus, NotCharging=0, Charging=1, NotChargeable=2); + CREATE_CHAR_ENUM(DoorState, Open=0, Closed=1); + CREATE_CHAR_ENUM(LeakStatus, NoLeak=0, LeakDetected=1); + CREATE_CHAR_ENUM(SecuritySystemState, Stay=0, Away=1, Night=2, Disarmed=3, Alarm=4); + } ////////////////////////////////////////////////////////