Home  Contents

Finger callbacks

Finger Core4 Lua Event System

SYNOPSIS

General use
  1. fgrhandle.responseReceived = function(fgrhandle, cmd, param, size, flag[, data])
  2. fgrhandle.responseReceivedFrom = function(fgrhandle, addr, cmd, param, size, flag[, data])
  3. fgrhandle.error = function(fgrhandle, name, code)
In-depth
  1. fgrhandle.headerReceived = function(fgrhandle, cmd, param, size, flag)
  2. fgrhandle.headerReceivedFrom = function(fgrhandle, addr, cmd, param, size, flag)
  3. fgrhandle.dataReceived = function(fgrhandle, data)

DESCRIPTION

General use

The callbacks spfinger.responseReceived() and spfinger.responseReceivedFrom() fire whenever a complete response (header and data) has arrived.

The parameter addr contains the Terminal ID used for the 'Network Packet Protocol', if applicable. The parameters cmd, param, size and flag are directly taken from the received header.

The spfinger.error() callback is executed when an error was encountered during reception. The arguments are the same as the values returned by spfinger:lastError().

In-depth

For more fine grained control, the callbacks spfinger.headerReceived() and spfinger.headerReceivedFrom() activate as soon as a response header has arrived, without regard to any data that may follow.

Correspondingly, spfinger.dataReceived() gets called with every chunk of data that is received. This means that if a command is using the 'Extended Packet Protocol', the spfinger.dataReceived() might be called multiple times.

In any case, each reception always culminates in a call to spfinger.responseReceived(), spfinger.responseReceivedFrom() or spfinger.error().

NOTES

Callbacks are called from the event loop.

If 'Network Packet Protocol' is not used, there is no need to provide the callbacks spfinger.responseReceivedFrom() or spfinger.headerReceivedFrom().

You must clear a response when you are done processing it by calling spfinger:clearResponse().

SEE ALSO