/* ************************************************************** */ /* * Module K7011UI * This module contains functions for the Keithley 7011 multiplexer * user interface. * * Zachary Wolf * 8/24/98 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "k7011uir.h" #include "k7011ui.h" #include "k7011.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int k7011_ID; static int k7011_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void k7011ui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * k7011ui_init * This function initializes the user interface for the K7011. * * Input: * ID, K7011 device identifier * * Zachary Wolf * 8/24/98 */ void k7011ui_init(int ID) { /* Save the K7011 ID */ k7011_ID = ID; /* Open the K7011 panel */ k7011_panel = LoadPanel(0, "k7011uir.uir", K7011PANEL); if (k7011_panel < 0) { k7011ui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(k7011_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * k7011ui_error * This function handles error messages for the K7011 user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/24/98 */ void k7011ui_error(char* message) { /* Declare variables */ char buf[K7011_MAX_CMD]; /* Notify the operator of the error */ printf("\nK7011UI 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, K7011_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK k7011ui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: k7011_exit(k7011_ID); QuitUserInterface(0); break; } return 0; } /* ************************************************************** */ int CVICALLBACK k7011ui_close_card_chan(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int card, chan; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, K7011PANEL_NUM_CARD, &card); GetCtrlVal(panel, K7011PANEL_NUM_CHAN, &chan); k7011_close_card_chan(k7011_ID, card, chan); break; } return 0; } /* ************************************************************** */ int CVICALLBACK k7011ui_open_all(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: k7011_open_all(k7011_ID); break; } return 0; }