A P P E N D I X B
Alarm Relay Output Application
Programming Interface
This appendix provides a sample program that illustrates how to get/set the status of the alarms. The application can use LOMIOCALSTATE ioctl to obtain the status of each alarm and LOMIOCALCTL ioctl to set them individually. For more details on the Alarm Indicators, refer to the Netra 440 Server Service Manual
CODE EXAMPLE
#include <sys/types.h> #include <string.h> #include <stdlib.h> #include <sys/unistd.h> #include <fcntl.h> #include "lom_io.h"
#define ALARM_INVALID
static void usage();
static void get_alarm(const char *alarm);
static int set_alarm(const char *alarm, const char *alarmval); static int parse_alarm(const char *alarm);
static int lom_ioctl(int ioc, char *buf); static char *get_alarmval(int state); static void get_alarmvals();
main(int argc, char *argv[])
{
if (argc < 3) { usage();
if (argc == 1)
71