/* ************************************************************** */ /* * Module B9900UI * This module contains functions for the Bell B9900 * user interface. * * Zachary Wolf * 1/24/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "b9900uir.h" #include "b9900ui.h" #include "b9900.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int b9900_ID; static int b9900_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void b9900ui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * b9900ui_init * This function initializes the user interface for the B9900. * * Input: * ID, B9900 device identifier * * Zachary Wolf * 1/24/00 */ void b9900ui_init(int ID) { /* Save the Gaussmeter ID */ b9900_ID = ID; /* Open the B9900 panel */ b9900_panel = LoadPanel(0, "b9900uir.uir", B9900PAN); if (b9900_panel < 0) { b9900ui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(b9900_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * b9900ui_error * This function handles error messages for the B9900 user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void b9900ui_error(char* message) { /* Declare variables */ char buf[B9900_MAX_CMD]; /* Notify the operator of the error */ printf("\nB9900UI ERROR: %s\n", message); Beep(); Delay(.5); Beep(); /* Terminate the program if the operator desires */ printf("Press ENTER to continue.\nPress any key then ENTER to terminate program.\n"); fgets(buf, B9900_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK b9900ui_set_range(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int channel; int range; switch (event) { case EVENT_COMMIT: GetCtrlVal(b9900_panel, B9900PAN_NUM_CHANNEL, &channel); GetCtrlVal(b9900_panel, B9900PAN_NUM_SET_RANGE, &range); b9900_set_range(b9900_ID, channel, range); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK b9900ui_get_b(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int channel; double B; switch (event) { case EVENT_COMMIT: GetCtrlVal(b9900_panel, B9900PAN_NUM_CHANNEL, &channel); b9900_get_B(b9900_ID, channel, &B); SetCtrlVal(b9900_panel, B9900PAN_NUM_GET_B, B); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK b9900ui_zero(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int channel; switch (event) { case EVENT_COMMIT: GetCtrlVal(b9900_panel, B9900PAN_NUM_CHANNEL, &channel); b9900_zero(b9900_ID, channel); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK b9900ui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: b9900_exit(b9900_ID); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; }