Transferring Data
lgo_Event()
Read a waiting control event.
#include "laygo.h"
LEvent lgo_Event
(
LCid cid,
LCtlBuffer buffer,
LBufferSize * size
);
| cid | connection to read a non-data event from |
| buffer | buffer for protocol-specific data returned with event |
| size | size of buffer on input size of data in buffer on output |
lgo_Event() reads non-data events which have occurred on the connection. lgo_Poll() can be used to poll a connection for control events and/or data, but control events can only be read using lgo_Event().
If successful, lgo_Event() returns a non-negative event identifier indicating the type of control event received. Possible successful return values are:
Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:
if ((event = lgo_Poll(cid, &bufferSize)) < 0)
{
/* process error */
}
else
{
switch(event)
{
case lgo_EVENT_DATA_OK:
/* read good data */
break;
case lgo_EVENT_DATA_LENGTH_ERROR:
case lgo_EVENT_DATA_CRC_ERROR:
case lgo_EVENT_DATA_ABORTED_FRAME:
/* discard bad data */
break;
default:
lgo_Event(cid, buffer, &bufferCapacity);
/* process any event data */
break;
}
}