New macro to define Characteristic enum values.
New enums for ChargingStatus, DoorState, LeakStatus, SecuritySystemState
This commit is contained in:
parent
f96df1ae63
commit
e29e82205f
|
|
@ -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;
|
||||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue