Repository for import to local machine
Dependencies: DMBasicGUI DMSupport
NudgeAndDampPageHandler.h@8:26e49e6955bd, 2017-07-31 (annotated)
- Committer:
- jmitc91516
- Date:
- Mon Jul 31 15:37:57 2017 +0000
- Revision:
- 8:26e49e6955bd
- Parent:
- 1:a5258871b33d
Method ramp scrolling improved, and more bitmaps moved to QSPI memory
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmitc91516 | 1:a5258871b33d | 1 | #ifndef NUDGEANDDAMPPAGEHANDLER_H |
jmitc91516 | 1:a5258871b33d | 2 | #define NUDGEANDDAMPPAGEHANDLER_H |
jmitc91516 | 1:a5258871b33d | 3 | |
jmitc91516 | 1:a5258871b33d | 4 | #include "mbed.h" |
jmitc91516 | 1:a5258871b33d | 5 | #include "DMBoard.h" |
jmitc91516 | 1:a5258871b33d | 6 | |
jmitc91516 | 1:a5258871b33d | 7 | #include "USBHostGC.h" |
jmitc91516 | 1:a5258871b33d | 8 | |
jmitc91516 | 1:a5258871b33d | 9 | #include "GuiLib.h" |
jmitc91516 | 1:a5258871b33d | 10 | |
jmitc91516 | 1:a5258871b33d | 11 | /* |
jmitc91516 | 1:a5258871b33d | 12 | A struct to relate the index of an easyGUI touch area on one of the nudge and damp pages |
jmitc91516 | 1:a5258871b33d | 13 | with the easyGUI variable to which it corresponds, and other parameters |
jmitc91516 | 1:a5258871b33d | 14 | which the NumericKeypadPageHandler will need to edit the variable |
jmitc91516 | 1:a5258871b33d | 15 | */ |
jmitc91516 | 1:a5258871b33d | 16 | typedef struct structNudgeAndDampEasyGUITouchAreaAndVariables { |
jmitc91516 | 1:a5258871b33d | 17 | int touchAreaIndex; |
jmitc91516 | 1:a5258871b33d | 18 | GuiConst_TEXT * easyGUIVariablePtr; |
jmitc91516 | 1:a5258871b33d | 19 | int maxValue; |
jmitc91516 | 1:a5258871b33d | 20 | // all values are integers (so there will be zero places of decimals for all of them) |
jmitc91516 | 1:a5258871b33d | 21 | int easyGUICallingPage; // We are handling more than one page here |
jmitc91516 | 1:a5258871b33d | 22 | char variableTitle[41]; |
jmitc91516 | 1:a5258871b33d | 23 | } NudgeAndDampEasyGUITouchAreaAndVariables; |
jmitc91516 | 1:a5258871b33d | 24 | |
jmitc91516 | 1:a5258871b33d | 25 | |
jmitc91516 | 1:a5258871b33d | 26 | /* |
jmitc91516 | 1:a5258871b33d | 27 | This class handles user interaction with the easyGUI pages that deal with the nudge and damp factors |
jmitc91516 | 1:a5258871b33d | 28 | for the various components. These pages are all so similar that it seems wasteful |
jmitc91516 | 1:a5258871b33d | 29 | to have a separate class for each. |
jmitc91516 | 1:a5258871b33d | 30 | |
jmitc91516 | 1:a5258871b33d | 31 | This class also deals with the Fan Power page, since that is very similar to the Nudge and Damp pages |
jmitc91516 | 1:a5258871b33d | 32 | (and the Fan Power parameters are handled in the "Heating Control" frame in the 500 Series GC VB6 application, |
jmitc91516 | 1:a5258871b33d | 33 | just like the Nudge and Damp pages). |
jmitc91516 | 1:a5258871b33d | 34 | |
jmitc91516 | 1:a5258871b33d | 35 | Note that this class is a singleton - we do not need or want there to be more than one instance of it |
jmitc91516 | 1:a5258871b33d | 36 | (we do not want multiple values for the various nudge and damp factors, etc, nor will we show |
jmitc91516 | 1:a5258871b33d | 37 | more than one easyGUI page to the user at the same time). |
jmitc91516 | 1:a5258871b33d | 38 | */ |
jmitc91516 | 1:a5258871b33d | 39 | |
jmitc91516 | 1:a5258871b33d | 40 | class NudgeAndDampPageHandler { |
jmitc91516 | 1:a5258871b33d | 41 | public: |
jmitc91516 | 1:a5258871b33d | 42 | /** |
jmitc91516 | 1:a5258871b33d | 43 | * Static method to create (if necessary) and retrieve the single NudgeAndDampPageHandler instance |
jmitc91516 | 1:a5258871b33d | 44 | */ |
jmitc91516 | 1:a5258871b33d | 45 | static NudgeAndDampPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 46 | |
jmitc91516 | 1:a5258871b33d | 47 | /** |
jmitc91516 | 1:a5258871b33d | 48 | * Version of the above that does not create the instance. Provided for callers that do not have |
jmitc91516 | 1:a5258871b33d | 49 | * the 'usbDevice' and 'usbHostGC' pointers, and that just want access to the instance |
jmitc91516 | 1:a5258871b33d | 50 | */ |
jmitc91516 | 1:a5258871b33d | 51 | static NudgeAndDampPageHandler * GetInstance(void); |
jmitc91516 | 1:a5258871b33d | 52 | |
jmitc91516 | 1:a5258871b33d | 53 | bool TouchAreaIsOnNudgeAndDampPage(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 54 | |
jmitc91516 | 1:a5258871b33d | 55 | bool DealWithTouch(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 56 | |
jmitc91516 | 1:a5258871b33d | 57 | void DisplayingEasyGUIPage(int pageNumber, bool updateEasyGUIVariables); |
jmitc91516 | 1:a5258871b33d | 58 | |
jmitc91516 | 1:a5258871b33d | 59 | static bool PageIsANudgeAndDampPage(int pageNumber); |
jmitc91516 | 1:a5258871b33d | 60 | |
jmitc91516 | 1:a5258871b33d | 61 | private: |
jmitc91516 | 1:a5258871b33d | 62 | static NudgeAndDampPageHandler * theNudgeAndDampPageHandlerInstance; |
jmitc91516 | 1:a5258871b33d | 63 | |
jmitc91516 | 1:a5258871b33d | 64 | USBDeviceConnected* usbDevice; |
jmitc91516 | 1:a5258871b33d | 65 | USBHostGC* usbHostGC; |
jmitc91516 | 1:a5258871b33d | 66 | |
jmitc91516 | 1:a5258871b33d | 67 | // singleton class -> constructor is private |
jmitc91516 | 1:a5258871b33d | 68 | NudgeAndDampPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 69 | ~NudgeAndDampPageHandler(); |
jmitc91516 | 1:a5258871b33d | 70 | |
jmitc91516 | 1:a5258871b33d | 71 | void SendCommandToGCAndGetResponse(char* command, char* response); |
jmitc91516 | 1:a5258871b33d | 72 | bool SendCommandToGCWithDACKResponse(char *cmd); |
jmitc91516 | 1:a5258871b33d | 73 | |
jmitc91516 | 1:a5258871b33d | 74 | bool GetNudgeOrDampFactorFromGC(char *cmd, GuiConst_TEXT* easyGUIVariable); |
jmitc91516 | 1:a5258871b33d | 75 | bool SetNudgeOrDampFactorInGC(char *cmd, GuiConst_TEXT* easyGUIVariable); |
jmitc91516 | 1:a5258871b33d | 76 | |
jmitc91516 | 1:a5258871b33d | 77 | void GetColumnOvenNudgeAndDampFactorsFromGC(void); |
jmitc91516 | 1:a5258871b33d | 78 | void GetColumnDHNudgeAndDampFactorsFromGC(void); |
jmitc91516 | 1:a5258871b33d | 79 | void GetInjectorNudgeAndDampFactorsFromGC(void); |
jmitc91516 | 1:a5258871b33d | 80 | void GetDetectorNudgeAndDampFactorsFromGC(void); |
jmitc91516 | 1:a5258871b33d | 81 | void GetAuxiliaryNudgeAndDampFactorsFromGC(void); |
jmitc91516 | 1:a5258871b33d | 82 | void GetFanPowerValuesFromGC(void); |
jmitc91516 | 1:a5258871b33d | 83 | |
jmitc91516 | 1:a5258871b33d | 84 | void SetColumnOvenNudgeAndDampFactorsInGC(void); |
jmitc91516 | 1:a5258871b33d | 85 | void SetColumnDHNudgeAndDampFactorsInGC(void); |
jmitc91516 | 1:a5258871b33d | 86 | void SetInjectorNudgeAndDampFactorsInGC(void); |
jmitc91516 | 1:a5258871b33d | 87 | void SetDetectorNudgeAndDampFactorsInGC(void); |
jmitc91516 | 1:a5258871b33d | 88 | void SetAuxiliaryNudgeAndDampFactorsInGC(void); |
jmitc91516 | 1:a5258871b33d | 89 | void SetFanPowerValuesInGC(void); |
jmitc91516 | 1:a5258871b33d | 90 | |
jmitc91516 | 1:a5258871b33d | 91 | enum { COUNT_OF_VARIABLES_FOR_TOUCH_AREAS = 19 }; |
jmitc91516 | 1:a5258871b33d | 92 | NudgeAndDampEasyGUITouchAreaAndVariables variablesForTouchArea[COUNT_OF_VARIABLES_FOR_TOUCH_AREAS]; |
jmitc91516 | 1:a5258871b33d | 93 | |
jmitc91516 | 1:a5258871b33d | 94 | int GetIndexOfValueToEditForTouchArea(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 95 | }; |
jmitc91516 | 1:a5258871b33d | 96 | |
jmitc91516 | 1:a5258871b33d | 97 | #endif // NUDGEANDDAMPPAGEHANDLER_H |