/* ************************************************************** */ /* * Module SENSORUI * This module contains functions for the SENSOR * user interface. * * Zachary Wolf * 4/13/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "sensoruir.h" #include "sensorui.h" #include "sensor.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int sensor_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void sensorui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * sensorui_init * This function initializes the user interface. * * Zachary Wolf * 4/13/00 */ void sensorui_init(void) { /* Open the SENSOR panel */ sensor_panel = LoadPanel(0, "sensoruir.uir", SENSORPAN); if (sensor_panel < 0) { sensorui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(sensor_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * sensorui_error * This function handles error messages for the SENSOR user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void sensorui_error(char* message) { /* Declare variables */ char buf[SENSOR_MAX_CMD]; /* Notify the operator of the error */ printf("\nSENSORUI 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, SENSOR_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK sensorui_get_v(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double v; int chan; switch (event) { case EVENT_COMMIT: GetCtrlVal(sensor_panel, SENSORPAN_NUM_CHAN, &chan); sensor_get_chan_voltage(chan, &v); SetCtrlVal(sensor_panel, SENSORPAN_NUM_GET_V, v); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK sensorui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: sensor_exit(); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; }