User Tools

Site Tools


uphp:functions:register_callback

register_callback

WM-MEGA, WM-M2, WM-MINI2 >= 2.1000

Register a call back to a system event

Description

int register_callback ( string $callback_type [, int $script_name ] [, string $function_name ] )

This function will register a callback which will be called when a system event occurs.</html>

Parameters

$callback_type:

Name Description
DATA_RX Data is received
DATA_TX Data is sent
RS232_RX Data is received on RS-232
RS232_TX Data is sent on RS-232
CONNECTED Internet is connected via dongle
DISCONNECTED Internet is disconnected
MQTT_CONNECTED MQTT connection is established
MQTT_DISCONNECTED MQTT connection is lost
MQTT_ERROR MQTT has an error connecting

$script_name: Optional name of script to execute, or leave blank ('') in order to specify a function name in the currently executing script.

$function_name: Optional name of function to execute, leave blank if executing a script. This only works if the event occurs while the current script is still running and the hook will be automatically removed once the script terminates.

Return Values

Integer: 1 on success or 0 on failure

Example

<?
  register_callback("CONNECTED","/scripts/internet_connected.cgi","");
?>

See Also

unregister_callback() - Remove a callback

uphp/functions/register_callback.txt · Last modified: 2021/09/13 05:57 (external edit)