Custom Drivers Callback Methods API

From HSYCO
Jump to navigation Jump to search

A few callback methods are called by the HSYCO core engine during initialization, exit, and for normal operations.

You should write your custom interface code inside these methods, and also set the default values of some static properties.

Static Properties

DEFAULTSOCKETPORT

DEFAULTSOCKETPORT

Used to set the default IP socket port, to be used when the port field is not set in the configuration. For example, if your driver is interfacing an HTTP-based service, you may want to set DEFAULTSOCKETPORT to 80.

COMMANDSQUEUESIZE

COMMANDSQUEUESIZE

Defines the size of the command queue.

The command queue is used to accumulate commands that the driver should execute, and are generated by ioSet() JavaScript or Java calls, the IOSET event or users pressing (button) objects in the Web user interface.

The command queue should be large enough to let the driver have time to consume incoming commands and not lose any. At the same time a queue that is too large could let a large number of messages to accumulate in case the driver has temporary issues talking to the external system.

HSYCO's built-in drivers usually have queue sizes between 64 and 1024. 256 is normally a good value.

SHUTDOWNWHENSLAVE

SHUTDOWNWHENSLAVE

This is the default value of the "shutdown when inactive" configuration parameter. If true and the "shutdown when inactive" is not defined, the driver will be automatically shut down when the HSYCO server is in a high availability configuration and the server is not the active server.

Callback Methods

init

boolean init(String name, HashMap<String, String> config)

loop

boolean loop()

end

boolean end()

user

String user(String session, String user, String id, HashMap<String, String> fields)

command

void command(String name, String value)