Update Reference.md
This commit is contained in:
parent
f73c779913
commit
9b791e2ac3
|
|
@ -386,11 +386,15 @@ The following methods are supported:
|
||||||
* note that Linked Services are only applicable for select HAP Services. See Apple's HAP-R2 documentation for full details
|
* note that Linked Services are only applicable for select HAP Services. See Apple's HAP-R2 documentation for full details
|
||||||
* example: `(new Service::Faucet)->addLink(new Service::Valve)->addLink(new Service::Valve);` (links two Valves to a Faucet)
|
* example: `(new Service::Faucet)->addLink(new Service::Valve)->addLink(new Service::Valve);` (links two Valves to a Faucet)
|
||||||
|
|
||||||
* `vector<SpanService *> getLinks()`
|
* `vector<T> getLinks<T=SpanService *>(const char *serviceName=NULL)`
|
||||||
* returns a vector of pointers to Services that were added using `addLink()`
|
* template function that returns a vector of pointers to Services that were added using `addLink()`
|
||||||
* useful for creating loops that iterate over all linked Services
|
* if template parameter, *T*, is left blank, the elements of the returned vector will be of type *SpanService \**
|
||||||
* note that the returned vector points to generic SpanServices, which should be re-cast as needed
|
* if template parameter, *T*, is specified, the elements of the returned vector will be cast into type *T*
|
||||||
* example: `for(auto myValve : faucet->getLinks()) { if((MyValve *)myValve)->active->getVal()) ... }` checks all Valves linked to a Faucet
|
* if *serviceName* is specified, only those services matching *serviceName* will be included in the return vector
|
||||||
|
* *serviceName* must be one of HomeSpan's built-in Services (e.g. "Valve")
|
||||||
|
* if *serviceName* is left blank or set to NULL, all services will be included in the return vector
|
||||||
|
* this function is useful for creating loops that iterate over all linked Services
|
||||||
|
* example: from within a Faucet Service containing linked Valves defined in *MyValveService*, use `for(auto valve : getLinks<MyValveService *>()) { if(valve->active->getVal()) ... }` to check which Valves are active
|
||||||
|
|
||||||
* `virtual boolean update()`
|
* `virtual boolean update()`
|
||||||
* HomeSpan calls this method upon receiving a request from a HomeKit Controller to update one or more Characteristics associated with the Service. Users should override this method with code that implements that requested updates using one or more of the SpanCharacteristic methods below. Method **must** return *true* if update succeeds, or *false* if not.
|
* HomeSpan calls this method upon receiving a request from a HomeKit Controller to update one or more Characteristics associated with the Service. Users should override this method with code that implements that requested updates using one or more of the SpanCharacteristic methods below. Method **must** return *true* if update succeeds, or *false* if not.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue