Moved Controller Class definition back to HAP.h instead of HomeSpan.h

As long as `class Controller` is forward-declared in HomeSpan.h, the definition can live in HAP.h
This commit is contained in:
Gregg 2024-06-05 13:32:15 -05:00
parent 9d29b73dac
commit 153ab451fd
2 changed files with 28 additions and 29 deletions

View File

@ -72,6 +72,34 @@ struct Accessory {
uint8_t LTPK[crypto_sign_PUBLICKEYBYTES]; // Long Term Ed2519 Public Key uint8_t LTPK[crypto_sign_PUBLICKEYBYTES]; // Long Term Ed2519 Public Key
}; };
//////////////////////////////////////////////////////////
// Paired Controller Structure for Permanently-Stored Data
class Controller {
friend class HAPClient;
boolean allocated=false; // DEPRECATED (but needed for backwards compatability with original NVS storage of Controller info)
boolean admin; // Controller has admin privileges
uint8_t ID[36]; // Pairing ID
uint8_t LTPK[32]; // Long Term Ed2519 Public Key
public:
Controller(uint8_t *id, uint8_t *ltpk, boolean ad){
allocated=true;
admin=ad;
memcpy(ID,id,36);
memcpy(LTPK,ltpk,32);
}
Controller(){}
const uint8_t *getID() const {return(ID);}
const uint8_t *getLTPK() const {return(LTPK);}
boolean isAdmin() const {return(admin);}
};
///////////////////////////////////////////////// /////////////////////////////////////////////////
// HAPClient Structure // HAPClient Structure
// Reads and Writes from each HAP Client connection // Reads and Writes from each HAP Client connection

View File

@ -189,35 +189,6 @@ struct SpanOTA{ // manages OTA process
static void error(ota_error_t err); static void error(ota_error_t err);
}; };
//////////////////////////////////////////////////////////
// Paired Controller Structure for Permanently-Stored Data
class Controller {
friend class HAPClient;
boolean allocated=false; // DEPRECATED (but needed for backwards compatability with original NVS storage of Controller info)
boolean admin; // Controller has admin privileges
uint8_t ID[36]; // Pairing ID
uint8_t LTPK[32]; // Long Term Ed2519 Public Key
public:
Controller(uint8_t *id, uint8_t *ltpk, boolean ad){
allocated=true;
admin=ad;
memcpy(ID,id,36);
memcpy(LTPK,ltpk,32);
}
Controller(){}
const uint8_t *getID() const {return(ID);}
const uint8_t *getLTPK() const {return(LTPK);}
boolean isAdmin() const {return(admin);}
};
////////////////////////////////////// //////////////////////////////////////
// USER API CLASSES BEGINS HERE // // USER API CLASSES BEGINS HERE //
////////////////////////////////////// //////////////////////////////////////