71
APPENDIX 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

(817-3883-xx).

CODE EXAMPLE B-1 Example Program for get/set Status of the Alarms
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <sys/unistd.h>
#include <fcntl.h>
#include "lom_io.h"
#define ALARM_INVALID -1
#define LOM_DEVICE "/dev/lom"
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)