![]() |
Helper Class Reference
1.3
HomeGenie - Automation Programs' Engine API
|
Events Helper class.
Class instance accessor: When
More...
Public Member Functions | |
| EventsHelper | SystemStarted (Func< bool > handler) |
Call the specified handler after HomeGenie service started. More... | |
| EventsHelper | SystemStopping (Func< bool > handler) |
Call the specified handler when HomeGenie service is stopping. More... | |
| EventsHelper | ProgramStopping (Func< bool > handler) |
Call the specified handler when the program is beign stopped. More... | |
| EventsHelper | ModuleParameterChanged (Func< ModuleHelper, ModuleParameter, bool > handler) |
Call the specified handler function when a parameter of a module changed. If either the handler returns false or changes the event value, the propagation will stop. More... | |
| EventsHelper | ModuleParameterIsChanging (Func< ModuleHelper, ModuleParameter, bool > handler) |
Call the specified handler function when a parameter of a module is changing. If either the handler returns false or changes the event value, the propagation will stop. More... | |
| EventsHelper | WebServiceCallReceived (string apiCall, Func< object, object > handler) |
Define a handler function that will be called when a web service call starting with apiCall is received. Use this to create user-defined web service API methods. More... | |
Events Helper class.
Class instance accessor: When
| EventsHelper SystemStarted | ( | Func< bool > | handler | ) |
Call the specified handler after HomeGenie service started.
| handler | The handler function to call. |
Example:
| EventsHelper SystemStopping | ( | Func< bool > | handler | ) |
Call the specified handler when HomeGenie service is stopping.
| handler | The handler function to call. |
Example:
| EventsHelper ProgramStopping | ( | Func< bool > | handler | ) |
Call the specified handler when the program is beign stopped.
| handler | The handler function to call. |
Example:
| EventsHelper ModuleParameterChanged | ( | Func< ModuleHelper, ModuleParameter, bool > | handler | ) |
Call the specified handler function when a parameter of a module changed. If either the handler returns false or changes the event value, the propagation will stop.
| handler | The handler function to call. |
Example:
| EventsHelper ModuleParameterIsChanging | ( | Func< ModuleHelper, ModuleParameter, bool > | handler | ) |
Call the specified handler function when a parameter of a module is changing. If either the handler returns false or changes the event value, the propagation will stop.
| handler | The handler function to call. |
Example:
| EventsHelper WebServiceCallReceived | ( | string | apiCall, |
| Func< object, object > | handler | ||
| ) |
Define a handler function that will be called when a web service call starting with apiCall is received. Use this to create user-defined web service API methods.
| apiCall | API call. |
| handler | Handler. |
API methods should respect the following format:
For instance, a program that control Philips Hue lights will implement API methods like this:
So an API call to set a Philips Hue light with address 3 to 50% can be done via HTTP GET
or from a csharp program
When this call is received by the handler, the object args passed to it must be parsed using Program.ParseApiCall method, which will return an object containing the following fields
This object also provide a method request.GetOption(<index>) to get eventual options passed with this call.
Example
1.8.17