Programming Overview
General
The Control-Freak IDE and Run-time does already some legwork:
- Creating the Javascript class file from a template, ready to be completed by your code.
- Instantiating the class when a device is referencing this driver
- Cleanup and stop the driver when not needed anymore
- Calling the driver API for each device or system event
- adding useful attributes to the instance like quick access the drivers meta database or more methods to access other drivers, devices and also calling xblox.
The Driver base class
Please find its API documentation here
All driver code is written in OOP. The system inherits your driver class automatically from a driver base class which provides the most wanted functions. It also enforces a a strict API (signature) when it comes to device communication but its entirely up to you to you to make use of it.
General Entry Points
The most important methods being called by the system are:
You may override or complete this methods. If you don't override it, then the methods of the base class will be called.
Tools
There are more utils functions in your driver instance to have direct access to variables, commands or xBlox. Here some of them:
Variables
Commands
xBlox
- runBlock('BlockTitle',args)