/* ************************************************************** */ /* * Module VRZ404UI * This module contains functions for the Heidenhain VRZ404 * user interface. * * Zachary Wolf * 4/4/01 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "vrz404uir.h" #include "vrz404ui.h" #include "vrz404.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int vrz404_ID; static int vrz404_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void vrz404ui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * vrz404ui_init * This function initializes the user interface for the VRZ404. * * Input: * ID, VRZ404 device identifier * * Zachary Wolf * 4/4/01 */ void vrz404ui_init(int ID) { /* Save the Gaussmeter ID */ vrz404_ID = ID; /* Open the VRZ404 panel */ vrz404_panel = LoadPanel(0, "vrz404uir.uir", VRZ404PAN); if (vrz404_panel < 0) { vrz404ui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(vrz404_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * vrz404ui_error * This function handles error messages for the VRZ404 user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void vrz404ui_error(char* message) { /* Declare variables */ char buf[VRZ404_MAX_CMD]; /* Notify the operator of the error */ printf("\nVRZ404UI 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, VRZ404_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK vrz404ui_get_pos(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double pos; switch (event) { case EVENT_COMMIT: vrz404_get_pos(vrz404_ID, &pos); SetCtrlVal(vrz404_panel, VRZ404PAN_NUM_GET_POS, pos); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK vrz404ui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: vrz404_exit(vrz404_ID); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; }