/* ************************************************************** */ /* * Module LS450UI * This module contains functions for the Bell LS450 * user interface. * * Zachary Wolf * 1/24/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "ls450uir.h" #include "ls450ui.h" #include "ls450.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int ls450_ID; static int ls450_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void ls450ui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * ls450ui_init * This function initializes the user interface for the LS450. * * Input: * ID, LS450 device identifier * * Zachary Wolf * 1/24/00 */ void ls450ui_init(int ID) { /* Save the Gaussmeter ID */ ls450_ID = ID; /* Open the LS450 panel */ ls450_panel = LoadPanel(0, "ls450uir.uir", LS450PAN); if (ls450_panel < 0) { ls450ui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(ls450_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * ls450ui_error * This function handles error messages for the LS450 user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void ls450ui_error(char* message) { /* Declare variables */ char buf[LS450_MAX_CMD]; /* Notify the operator of the error */ printf("\nLS450UI 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, LS450_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK ls450ui_set_range(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int range; switch (event) { case EVENT_COMMIT: GetCtrlVal(ls450_panel, LS450PAN_NUM_SET_RANGE, &range); ls450_set_range(ls450_ID, range); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK ls450ui_get_b(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double B; switch (event) { case EVENT_COMMIT: ls450_get_B(ls450_ID, &B); SetCtrlVal(ls450_panel, LS450PAN_NUM_GET_B, B); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK ls450ui_zero(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: ls450_zero(ls450_ID); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK ls450ui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: ls450_exit(ls450_ID); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; }