EasyManua.ls Logo

Sun Microsystems Netra T2000 - Page 113

Sun Microsystems Netra T2000
122 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix B Alarm Relay Output Application Programming Interface 97
if ((ald.alarm_state != ALARM_OFF) &&
(ald.alarm_state != ALARM_ON)) {
printf("Invalid value returned: %d\n", ald.alarm_state);
exit(1);
}
printf("ALARM.%s = %s\n", alarm, get_alarmval(ald.alarm_state));
}
static int
set_alarm(const char *alarm, const char *alarmstate)
{
ts_aldata_t ald;
int alarmval = ALARM_OFF, altype = parse_alarm(alarm);
if (altype == ALARM_INVALID) {
usage();
exit (1);
}
if (strcmp(alarmstate, "on") == 0)
alarmval = ALARM_ON;
else
if (strcmp(alarmstate, "off") == 0)
alarmval = ALARM_OFF;
else {
usage();
exit (1);
}
ald.alarm_no = altype;
ald.alarm_state = alarmval;
if (lom_ioctl(LOMIOCALCTL, (char *)&ald) != 0) {
printf("Setting ALARM.%s to %s failed\n", alarm, alarmstate);
return (1);
} else {
printf("Setting ALARM.%s successfully set to %s\n", alarm,
alarmstate);
return (1);
}
}
static int
parse_alarm(const char *alarm)
{
int altype;
CODE EXAMPLE B-1 Example Program to get and set Status of the Alarms (Continued)

Table of Contents

Other manuals for Sun Microsystems Netra T2000

Related product manuals