John Mitchell / lpc4088_displaymodule_GC500_2_5inch

Dependencies:   DMBasicGUI DMSupport

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ColumnDHManualCalibrationPageHandler.h Source File

ColumnDHManualCalibrationPageHandler.h

00001 #ifndef COLUMNDHMANUALCALIBRATIONPAGEHANDLER_H
00002 #define COLUMNDHMANUALCALIBRATIONPAGEHANDLER_H
00003 
00004 #include "mbed.h"
00005 #include "DMBoard.h"
00006 
00007 #include "USBHostGC.h"
00008 
00009 #include "GuiLib.h"
00010 
00011 /*
00012     A struct to relate the index of an easyGUI touch area on the 'ColumnDHManualCalibrationPage',
00013     with the easyGUI variable and our own internal variable to which it corresponds
00014 */
00015 typedef struct structColumnDHManualCalibrationEasyGUITouchAreaAndVariables {
00016     int touchAreaIndex;
00017     GuiConst_TEXT * easyGUIVariablePtr;
00018     unsigned int maxValue;
00019     unsigned int placesOfDecimals;
00020     char variableTitle[41];
00021     char sprintfFormat[10];
00022 } ColumnDHManualCalibrationEasyGUITouchAreaAndVariables;
00023 
00024 
00025 /*
00026     This class handles user interaction with the easyGUI "ColumnDHManualCalibrationPage".
00027     
00028     Note that this class is a singleton - we do not need or want there to be more than one instance of it
00029     (we do not want multiple values for the calibration values, etc, and nor will we show 
00030     more than one easyGUI 'ColumnDHManualCalibrationPage' to the user at the same time).
00031 */
00032 
00033 class ColumnDHManualCalibrationPageHandler {
00034 public:
00035     /**
00036     * Static method to create (if necessary) and retrieve the single ColumnDHManualCalibrationPageHandler instance
00037     */
00038     static ColumnDHManualCalibrationPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);
00039     
00040     /**
00041     * Version of the above that does not create the instance. Provided for callers that do not have 
00042     * the 'usbDevice' and 'usbHostGC' pointers, and that just want access to the instance
00043     */
00044     static ColumnDHManualCalibrationPageHandler * GetInstance(void);
00045     
00046     bool TouchAreaIsOnCalibrationPage(int touchAreaIndex);
00047 
00048     bool DealWithTouch(int touchAreaIndex);
00049     
00050     void DisplayingEasyGUIPage(bool updateEasyGUIVariables);
00051 
00052 private:    
00053     static ColumnDHManualCalibrationPageHandler * theColumnDHManualCalibrationPageHandlerInstance;
00054     
00055     USBDeviceConnected* usbDevice;
00056     USBHostGC* usbHostGC;
00057     
00058     // singleton class -> constructor is private
00059     ColumnDHManualCalibrationPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);    
00060     ~ColumnDHManualCalibrationPageHandler();
00061     
00062     void GetCurrentCalibrationFromGC(void);
00063     void SetCurrentCalibrationInGC(void);
00064 
00065     void SendCommandToGCAndGetResponse(char* command, char* response);
00066     bool SendCommandToGCWithDACKResponse(char *cmd);
00067 
00068     bool GetColumnTemperaturePointFromGC(int pointNumber, GuiConst_TEXT* easyGUIVariable);
00069     bool GetColumnResistancePointFromGC(int pointNumber, GuiConst_TEXT* easyGUIVariable);
00070 
00071     bool SetColumnTemperaturePointInGC(int pointNumber, GuiConst_TEXT* easyGUIVariable);
00072     bool SetColumnResistancePointInGC(int pointNumber, GuiConst_TEXT* easyGUIVariable);
00073 
00074     void UpdateEasyGUIPage(void);
00075 
00076     enum { COUNT_OF_VARIABLES_FOR_TOUCH_AREAS = 6 };
00077     ColumnDHManualCalibrationEasyGUITouchAreaAndVariables variablesForTouchArea[COUNT_OF_VARIABLES_FOR_TOUCH_AREAS];
00078 
00079     int GetIndexOfValueToEditForTouchArea(int touchAreaIndex);
00080 
00081 };
00082 
00083 #endif // COLUMNDHMANUALCALIBRATIONPAGEHANDLER_H