John Mitchell / lpc4088_displaymodule_GC500_2_5inch

Dependencies:   DMBasicGUI DMSupport

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NudgeAndDampPageHandler.h Source File

NudgeAndDampPageHandler.h

00001 #ifndef NUDGEANDDAMPPAGEHANDLER_H
00002 #define NUDGEANDDAMPPAGEHANDLER_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 one of the nudge and damp pages
00013     with the easyGUI variable to which it corresponds, and other parameters 
00014     which the NumericKeypadPageHandler will need to edit the variable
00015 */
00016 typedef struct structNudgeAndDampEasyGUITouchAreaAndVariables {
00017     int touchAreaIndex;
00018     GuiConst_TEXT * easyGUIVariablePtr;
00019     int maxValue;
00020     // all values are integers (so there will be zero places of decimals for all of them)
00021     int easyGUICallingPage; // We are handling more than one page here
00022     char variableTitle[41];
00023 } NudgeAndDampEasyGUITouchAreaAndVariables;
00024 
00025 
00026 /*
00027     This class handles user interaction with the easyGUI pages that deal with the nudge and damp factors 
00028     for the various components. These pages are all so similar that it seems wasteful 
00029     to have a separate class for each. 
00030     
00031     This class also deals with the Fan Power page, since that is very similar to the Nudge and Damp pages 
00032     (and the Fan Power parameters are handled in the "Heating Control" frame in the 500 Series GC VB6 application, 
00033     just like the Nudge and Damp pages).
00034     
00035     Note that this class is a singleton - we do not need or want there to be more than one instance of it
00036     (we do not want multiple values for the various nudge and damp factors, etc, nor will we show 
00037     more than one easyGUI page to the user at the same time).
00038 */
00039 
00040 class NudgeAndDampPageHandler {
00041 public:
00042     /**
00043     * Static method to create (if necessary) and retrieve the single NudgeAndDampPageHandler instance
00044     */
00045     static NudgeAndDampPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);
00046     
00047     /**
00048     * Version of the above that does not create the instance. Provided for callers that do not have 
00049     * the 'usbDevice' and 'usbHostGC' pointers, and that just want access to the instance
00050     */
00051     static NudgeAndDampPageHandler * GetInstance(void);
00052     
00053     bool TouchAreaIsOnNudgeAndDampPage(int touchAreaIndex);
00054 
00055     bool DealWithTouch(int touchAreaIndex);
00056     
00057     void DisplayingEasyGUIPage(int pageNumber, bool updateEasyGUIVariables);
00058     
00059     static bool PageIsANudgeAndDampPage(int pageNumber);
00060 
00061 private:    
00062     static NudgeAndDampPageHandler * theNudgeAndDampPageHandlerInstance;
00063     
00064     USBDeviceConnected* usbDevice;
00065     USBHostGC* usbHostGC;
00066     
00067     // singleton class -> constructor is private
00068     NudgeAndDampPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);    
00069     ~NudgeAndDampPageHandler();
00070     
00071     void SendCommandToGCAndGetResponse(char* command, char* response);
00072     bool SendCommandToGCWithDACKResponse(char *cmd);
00073 
00074     bool GetNudgeOrDampFactorFromGC(char *cmd, GuiConst_TEXT* easyGUIVariable);
00075     bool SetNudgeOrDampFactorInGC(char *cmd, GuiConst_TEXT* easyGUIVariable);
00076 
00077     void GetColumnOvenNudgeAndDampFactorsFromGC(void);
00078     void GetColumnDHNudgeAndDampFactorsFromGC(void);
00079     void GetInjectorNudgeAndDampFactorsFromGC(void);
00080     void GetDetectorNudgeAndDampFactorsFromGC(void);
00081     void GetAuxiliaryNudgeAndDampFactorsFromGC(void);
00082     void GetFanPowerValuesFromGC(void);
00083 
00084     void SetColumnOvenNudgeAndDampFactorsInGC(void);
00085     void SetColumnDHNudgeAndDampFactorsInGC(void);
00086     void SetInjectorNudgeAndDampFactorsInGC(void);
00087     void SetDetectorNudgeAndDampFactorsInGC(void);
00088     void SetAuxiliaryNudgeAndDampFactorsInGC(void);
00089     void SetFanPowerValuesInGC(void);
00090 
00091     enum { COUNT_OF_VARIABLES_FOR_TOUCH_AREAS = 19 };
00092     NudgeAndDampEasyGUITouchAreaAndVariables variablesForTouchArea[COUNT_OF_VARIABLES_FOR_TOUCH_AREAS];
00093 
00094     int GetIndexOfValueToEditForTouchArea(int touchAreaIndex);
00095 };
00096 
00097 #endif // NUDGEANDDAMPPAGEHANDLER_H