/* mon.c August, 1998 * Kevin Scott kcscott@cc.gatech.edu * FCE Lab, GaTEch * * Example program using simple library functions to access Intellon * CEMonitor powerline modems and the Rhino boards */ #include "plSerial.h" main() { int i, CONTINUE = 1; char userInput[2]; char command; /* open serial port two (2) on SGI O2 */ plOpen("/dev/ttyd2"); /* set session configuration */ printf("\nTalk to which Rhino? "); gets(userInput); plSetDestinationAddress(userInput); plSendConfiguration(); /* uses defaults or set values */ /* rather arbitrary settings */ NPDU = 0x50; APDU_HEADER = 0x00; /* loop until quit */ while (CONTINUE == 1) { printf("\nCommand: "); gets(userInput); command = userInput[0]; if ((command == 'q') || (command == 'Q')) { CONTINUE = 0; } else { plSendMessage(command); /* send one charachter command to Rhino */ /* l - toggle led * b - boot * s - toggle switch * t - get temp * i - get infrared * h - get help */ /* wait at most two (2) seconds for a reply from the Rhino or modem */ while (plReceive(2) == 1) { plPrintMessage(IN); } } } /* end while */ printf("\nQuitting...\n"); plClose(); return 1; } /* end main*/