/* ************************************************************** */ /* * Module SENMEASUI * This module contains functions for the SENMEAS * user interface. * * Zachary Wolf * 2/7/03 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "senmeasuir.h" #include "senmeasui.h" #include "senmeas.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int senmeas_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void senmeasui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * senmeasui_init * This function initializes the user interface. * * Zachary Wolf * 2/7/03 */ void senmeasui_init(void) { /* Open the SENMEAS panel */ senmeas_panel = LoadPanel(0, "senmeasuir.uir", SENMEASPAN); if (senmeas_panel < 0) { senmeasui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(senmeas_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * senmeasui_error * This function handles error messages for the SENMEAS user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void senmeasui_error(char* message) { /* Declare variables */ char buf[SENMEAS_MAX_NUM_CHAR]; /* Notify the operator of the error */ printf("\nSENMEASUI 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, SENMEAS_MAX_NUM_CHAR, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK senmeasui_get_sensor_meas_val(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int sensor_num; double sensor_raw_output; double sensor_meas_val; switch (event) { case EVENT_COMMIT: GetCtrlVal(senmeas_panel, SENMEASPAN_NUM_SENSOR_NUM, &sensor_num); senmeas_get_sensor_raw_output(sensor_num, &sensor_raw_output); senmeas_get_sensor_meas_val(sensor_num, &sensor_meas_val); SetCtrlVal(senmeas_panel, SENMEASPAN_NUM_SENSOR_RAW_OUTPUT, sensor_raw_output); SetCtrlVal(senmeas_panel, SENMEASPAN_NUM_SENSOR_MEAS_VAL, sensor_meas_val); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK senmeasui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: senmeas_exit(); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; }