/* ************************************************************** */ /* * Module GP3UI * This module contains functions for the Bell GP3 * user interface. * * Zachary Wolf * 1/24/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "gp3uir.h" #include "gp3ui.h" #include "gp3.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int gp3_ID; static int gp3_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void gp3ui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * gp3ui_init * This function initializes the user interface for the GP3. * * Input: * ID, GP3 device identifier * * Zachary Wolf * 1/24/00 */ void gp3ui_init(int ID) { /* Save the Gaussmeter ID */ gp3_ID = ID; /* Open the GP3 panel */ gp3_panel = LoadPanel(0, "gp3uir.uir", GP3PAN); if (gp3_panel < 0) { gp3ui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(gp3_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * gp3ui_error * This function handles error messages for the GP3 user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void gp3ui_error(char* message) { /* Declare variables */ char buf[GP3_MAX_CMD]; /* Notify the operator of the error */ printf("\nGP3UI 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, GP3_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK gp3ui_set_range(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int range; switch (event) { case EVENT_COMMIT: GetCtrlVal(gp3_panel, GP3PAN_NUM_SET_RANGE, &range); gp3_set_range(gp3_ID, range); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK gp3ui_get_b(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double B; switch (event) { case EVENT_COMMIT: gp3_get_B(gp3_ID, &B); SetCtrlVal(gp3_panel, GP3PAN_NUM_GET_B, B); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK gp3ui_zero(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: gp3_zero(gp3_ID); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK gp3ui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: gp3_exit(gp3_ID); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; }