Created SpanService::setPrimary() and setHidden()
These optional methods can be "chained" when instantiating a new SpanService to configure the Service as Primary or Hidden (or both). This alleviates the need to ServiceType to be propogated through the Service constructor. Next Up: Eliminate ServiceType construct and update Examples to use setPrimary instead.
This commit is contained in:
parent
538a3a9531
commit
814d751e71
|
|
@ -933,6 +933,20 @@ SpanService::SpanService(const char *type, ServiceType mod){
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
|
SpanService *SpanService::setPrimary(){
|
||||||
|
primary=true;
|
||||||
|
return(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////
|
||||||
|
|
||||||
|
SpanService *SpanService::setHidden(){
|
||||||
|
hidden=true;
|
||||||
|
return(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////
|
||||||
|
|
||||||
int SpanService::sprintfAttributes(char *cBuf){
|
int SpanService::sprintfAttributes(char *cBuf){
|
||||||
int nBytes=0;
|
int nBytes=0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,9 @@ struct SpanService{
|
||||||
|
|
||||||
SpanService(const char *type, ServiceType mod=ServiceType::Regular);
|
SpanService(const char *type, ServiceType mod=ServiceType::Regular);
|
||||||
|
|
||||||
|
SpanService *setPrimary(); // sets the Service Type to be primary and returns pointer to self
|
||||||
|
SpanService *setHidden(); // sets the Service Type to be hidden and returns pointer to self
|
||||||
|
|
||||||
int sprintfAttributes(char *cBuf); // prints Service JSON records into buf; return number of characters printed, excluding null terminator
|
int sprintfAttributes(char *cBuf); // prints Service JSON records into buf; return number of characters printed, excluding null terminator
|
||||||
virtual StatusCode update() {return(StatusCode::OK);} // update Service and return final statusCode based on updated Characteristics - should be overridden by DEVICE-SPECIFIC Services
|
virtual StatusCode update() {return(StatusCode::OK);} // update Service and return final statusCode based on updated Characteristics - should be overridden by DEVICE-SPECIFIC Services
|
||||||
virtual void event(){} // event generation for Services that create their own events and need to notify HomeKit of a new Characteristic value(s)
|
virtual void event(){} // event generation for Services that create their own events and need to notify HomeKit of a new Characteristic value(s)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue