VeriFone MX800 series Programmer's Manual page 115

Hide thumbs Also See for MX800 series:
Table of Contents

Advertisement

The SIGIO signal is issued by the OS whenever any hardware device detects data
I/O has occurred. For example, an application may like to know when data is
available on a serial port. The application could create a signal handler for the
SIGIO signal associated with the file descriptor (handle) of the open port.
However, if any other process (thread, linked library) would also like to know of
this event, then a common handler must be used.
x
The M
800 series of terminals OS provides the svcSetRxCallback() function
to manage all handlers for the SIGIO signal for any open device. This function
allows a callback function to be called whenever data is available for a particular
device. It determines this by the file descriptor (handle) of the device and the
function pointer passed into the function. svcSetRxCallback() should be used
whenever the application would like to be notified of data available on a particular
device. More detailed explanation of the function call can be found under the
svcSetRxCallback() section.
When the application wants to close the port or does not need to know of a SIGIO
event any longer, then a call to the function svcReleaseRxCallback() should
be used prior to closing of the port/device. This function will unregister the
callback function associated with that device. More information about this function
can be found under the svcReleaseRxCallback() section.
The SIGALRM signal is currently being used by the ECR library to set a timer that
is used in the retransmit logic of an ECR packet. Since this library uses this signal,
it is required that any application that links with this library to use the common
function call svcSetAlarmCallback() if it also wants to utilize the Alarm
signal. Even if the application does not link with the ECR library, this function call
can still be used to manage all handlers defined within a process and its child
processes for the SIGALRM signal. There is a restriction, however, in using
multiple handlers for the SIGALRM signal in an application. When the
svcSetAlarmCallback() function is called, it registers what handler should be
called by the process id of the process that will issue the signal. This means that
when the SIGALRM signal is issued it must do so by providing the process id
number.
In Linux, this is done with the kill() command. The kill() command takes two
arguments, the process id to send the signal to and the signal to issue. In this
case it would be: kill(getpid(), SIGALRM). Another way for an application
to issue a SIGALRM signal is to use the command alarm(). This command
automatically sets a timer for the number of seconds passed into it and then when
that timer expires, it will send the SIGALRM signal. However, alarm() does not
send the process id and should never be used. An application must create their
own timer by using a combination of sleep() and kill() commands to issue a
SIGALRM signal.
D
X
M
800 S
P
ERIES
ROGRAMMERS
D
EVICE
RIVERS
Signals
115
G
UIDE

Advertisement

Table of Contents
loading

Table of Contents