March 2018
Beginner to intermediate
410 pages
10h 40m
English
As we did for the other observable resources we added to the sensor, we need to specify when the output resource is to be triggered. We mimic the motion detector setup in that we first add a longer interval of 1 minute to let the subscriber know the subscription is active:
this.outputResource?.TriggerAll(new TimeSpan(0, 1, 0));
We then update the SetOutput method to trigger the resource whenever the resource is changed, whether internally or from an incoming request:
internal async Task SetOutput(bool On, string Actor)
{
...
this.outputResource?.TriggerAll();
}
Read now
Unlock full access