HomeKey Services and Characteristics

and a watchdog trigger prevention hack
This commit is contained in:
White Red 2024-04-13 18:06:26 +03:00
parent 5ded77d6d9
commit 8f1c69150d
5 changed files with 51 additions and 6 deletions

View File

@ -131,6 +131,16 @@ struct HapCharacteristics {
HAPCHAR( LockCurrentState, 1D, PR+EV, UINT8, true );
HAPCHAR( LockPhysicalControls, A7, PW+PR+EV, UINT8, true );
HAPCHAR(LockTargetState, 1E, PW + PR + EV, UINT8, true);
HAPCHAR( HardwareFinish, 26C, PR, TLV_ENC, true );
HAPCHAR( ConfigurationState, 263, PR+EV, UINT16, true );
HAPCHAR( NFCAccessControlPoint, 264, PR+PW+WR, TLV_ENC, true );
HAPCHAR( NFCAccessSupportedConfiguration, 265, PR, TLV_ENC, true );
HAPCHAR( LockControlPoint, 19, PW, TLV_ENC, true );
HAPCHAR( AdministratorOnlyAccess, 1, PW+PR+EV, BOOL, true );
HAPCHAR( AudioFeedback, 5, PW+PR+EV, BOOL, true );
HAPCHAR( LockManagementAutoSecurityTimeout, 1A, PW+PR+EV, UINT32, true );
HAPCHAR( LockLastKnownAction, 1C, PR+EV, UINT8, false );
HAPCHAR( Logs, 1F, PR+EV, TLV_ENC, true );
HAPCHAR( Manufacturer, 20, PR, STRING, true);
HAPCHAR( Model, 21, PR, STRING, true );
HAPCHAR( MotionDetected, 22, PR+EV, BOOL, true );

View File

@ -34,6 +34,7 @@
#include "HAPConstants.h"
#include "HKDF.h"
#include "SRP.h"
#include <sodium/crypto_sign.h>
const TLV8_names HAP_Names[] = {
{kTLVType_Separator,"SEPARATOR"},

View File

@ -226,6 +226,9 @@ void Network::apConfigure(){
LOG2("\n");
} // process Client
else {
vTaskDelay(100 / portTICK_PERIOD_MS);
}
} // while 1

View File

@ -61,6 +61,7 @@ namespace Service {
OPT(Model);
OPT(SerialNumber);
OPT(HardwareRevision);
OPT(HardwareFinish);
OPT_DEP(AccessoryFlags);
END_SERV
@ -348,6 +349,24 @@ namespace Service {
OPT_DEP(Name);
END_SERV
CREATE_SERV(LockManagement, 44)
REQ(LockControlPoint);
REQ(Version);
OPT(AdministratorOnlyAccess);
OPT(AudioFeedback);
OPT(CurrentDoorState);
OPT(LockManagementAutoSecurityTimeout);
OPT(LockLastKnownAction);
OPT(Logs);
OPT(MotionDetected);
END_SERV
CREATE_SERV(NFCAccess, 266)
REQ(ConfigurationState);
REQ(NFCAccessControlPoint);
REQ(NFCAccessSupportedConfiguration);
END_SERV
CREATE_SERV(Window,8B) // Defines a motorized Window.
REQ(CurrentPosition);
REQ(TargetPosition);
@ -530,6 +549,16 @@ namespace Characteristic {
CREATE_CHAR(uint8_t,LockCurrentState,0,0,3,UNLOCKED,LOCKED,JAMMED,UNKNOWN); // indicates state of a lock
CREATE_CHAR(uint8_t,LockPhysicalControls,0,0,1,CONTROL_LOCK_DISABLED,CONTROL_LOCK_ENABLED); // indicates if local control lock is enabled
CREATE_CHAR(uint8_t, LockTargetState, 0, 0, 1, UNLOCK, LOCK); // indicates desired state of lock
CREATE_CHAR(const char *,LockControlPoint,"",0,1);
CREATE_CHAR(boolean,AdministratorOnlyAccess,false,0,1);
CREATE_CHAR(boolean,AudioFeedback,false,0,1);
CREATE_CHAR(uint32_t,LockManagementAutoSecurityTimeout,0,0,1);
CREATE_CHAR(uint8_t,LockLastKnownAction,0,0,8);
CREATE_CHAR(const char *,HardwareFinish,"AQQAAAAA",0,1);
CREATE_CHAR(const char *,Logs,"",0,1);
CREATE_CHAR(uint16_t,ConfigurationState,0,0,1);
CREATE_CHAR(const char *,NFCAccessControlPoint,"",0,1);
CREATE_CHAR(const char *,NFCAccessSupportedConfiguration,"AQEQAgEQ",0,1);
CREATE_CHAR(const char*, Manufacturer, "HomeSpan", 0, 1); // any string - informational only
CREATE_CHAR(const char *,Model,"HomeSpan-ESP32",0,1); // any string - informational only
CREATE_CHAR(boolean,MotionDetected,0,0,1,NOT_DETECTED,DETECTED); // indicates if motion is detected

View File

@ -51,7 +51,9 @@ char *Utils::readSerial(char *c, int max){
while(1){
while(!Serial.available()); // wait until there is a new character
while(!Serial.available()){ // wait until there is a new character
vTaskDelay(100 / portTICK_PERIOD_MS);
}
buf=Serial.read();