ACC Utilities Reference Guide

234 Chapter12
PMON - ACC E1/T1 Line Monitor
Receiving E1/T1 Line Status with a Customer Application
For example, the initialization code may look something like:
{
zsinfo_type sip;
zaddr_type paddr, taddr;
zltt_type ltt;
uint32 pflag, limit;
char name[8];
int zlu;
int32 err;
/* Initialise ZCOM API */
if (err = zinit(&sip)) {
--- Report error ---
exit(0);
}
/* Get a primary ZLU */
pflag = 1;
strcpy (name,"MY_APPL");
limit = 0;
if (err = zopen(&paddr,pflag,name,limit)) {
--- Report error ---
exit(1);
}
/* Look for PMON devices and set up as shared receiver */
for (zlu=1;zlu<=sip.sintzlu;zlu++) {
taddr.zlu = zlu;
taddr.node = sip.sinode;
if (err = zinfo (&taddr, 1, (char*)&ltt, sizeof(ltt)))
continue;
if (ltt.ltapno == 45) {
taddr.zcs = ltt.ltzcs;
if (err = zset_rcvr (ZcADD_SHARED, taddr, 0, &paddr)) {
--- Report error ---
}
}
}
}
Once this is done the application needs to wait on the zread() function to
receive messages. Status messages from the E1/T1 monitor devices are
received as type ZCOM_MSTYPE_RSLT, a nd the request code is
ZCOM_MRQCODE_STATUS.
Bit 7 of the status code is the UP/DOWN flag. Bits 0-6 of the status code
contain the actual code. If this code is greater than 63, then this is an
E1/T1 specific status message (used to indicate E1/T1 specific events on