Added getLinks() method to SpanServices

This returns a vector of linked Services that can be used in a for-each loop as such:

for(auto services : getLinks()){ ... }

Must cast services into specific Service type to access anything not generic to the SpanService   class
This commit is contained in:
HomeSpan 2021-11-09 21:18:34 -06:00
parent 3f833beb74
commit fcf715d874
2 changed files with 2 additions and 2 deletions

View File

@ -225,6 +225,7 @@ struct SpanService{
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
SpanService *addLink(SpanService *svc); // adds svc as a Linked Service and returns pointer to self
vector<SpanService *> getLinks(){return(linkedServices);} // returns linkedServices vector for use as range in "for-each" loops
int sprintfAttributes(char *cBuf); // prints Service JSON records into buf; return number of characters printed, excluding null terminator
void validate(); // error-checks Service
@ -238,7 +239,6 @@ struct SpanService{
struct SpanCharacteristic{
union UVal {
BOOL_t BOOL;
UINT8_t UINT8;

View File

@ -74,7 +74,7 @@ void setup() {
new Characteristic::Name("Light 3");
new Characteristic::TargetPosition();
new Characteristic::OzoneDensity();
(new Characteristic::OzoneDensity())->addPerms(PW+AA)->removePerms(EV+PR);
(new Characteristic::OzoneDensity())->addPerms(PW|AA)->removePerms(EV|PR);
} // end of setup()