Repository for import to local machine
Dependencies: DMBasicGUI DMSupport
GasBackPressureDACPageHandler.h@1:a5258871b33d, 2017-07-20 (annotated)
- Committer:
- jmitc91516
- Date:
- Thu Jul 20 08:42:29 2017 +0000
- Revision:
- 1:a5258871b33d
Version before re-layout (July 2017). Also for mbed CLI import to local machine.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmitc91516 | 1:a5258871b33d | 1 | #ifndef GASBACKPRESSUREDACPAGEHANDLER_H |
jmitc91516 | 1:a5258871b33d | 2 | #define GASBACKPRESSUREDACPAGEHANDLER_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 | This class handles user interaction with the easyGUI "GasBackPressureDACPage", |
jmitc91516 | 1:a5258871b33d | 13 | as well as storing the values in QSPI memory. |
jmitc91516 | 1:a5258871b33d | 14 | |
jmitc91516 | 1:a5258871b33d | 15 | 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 | 16 | (we do not want multiple values for the gain and offset, etc, and nor will we show |
jmitc91516 | 1:a5258871b33d | 17 | more than one easyGUI 'GasBackPressureDACPage' to the user at the same time). |
jmitc91516 | 1:a5258871b33d | 18 | */ |
jmitc91516 | 1:a5258871b33d | 19 | class GasBackPressureDACPageHandler { |
jmitc91516 | 1:a5258871b33d | 20 | public: |
jmitc91516 | 1:a5258871b33d | 21 | /** |
jmitc91516 | 1:a5258871b33d | 22 | * Static method to create (if necessary) and retrieve the single GasBackPressureDACPageHandler instance |
jmitc91516 | 1:a5258871b33d | 23 | */ |
jmitc91516 | 1:a5258871b33d | 24 | static GasBackPressureDACPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 25 | |
jmitc91516 | 1:a5258871b33d | 26 | bool TouchAreaIsOnGasBackPressureDACPage(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 27 | |
jmitc91516 | 1:a5258871b33d | 28 | bool DealWithTouch(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 29 | |
jmitc91516 | 1:a5258871b33d | 30 | void DisplayingEasyGUIPage(bool updateEasyGUIVariables); |
jmitc91516 | 1:a5258871b33d | 31 | |
jmitc91516 | 1:a5258871b33d | 32 | private: |
jmitc91516 | 1:a5258871b33d | 33 | |
jmitc91516 | 1:a5258871b33d | 34 | typedef enum enumActiveField { NONE, GAIN, OFFSET } ActiveField; |
jmitc91516 | 1:a5258871b33d | 35 | |
jmitc91516 | 1:a5258871b33d | 36 | static const int minimumGainAndOffsetValue; |
jmitc91516 | 1:a5258871b33d | 37 | static const int maximumGainAndOffsetValue; |
jmitc91516 | 1:a5258871b33d | 38 | |
jmitc91516 | 1:a5258871b33d | 39 | static const GuiConst_INTCOLOR inactiveFieldBackgroundColour; |
jmitc91516 | 1:a5258871b33d | 40 | static const GuiConst_INTCOLOR activeFieldBackgroundColour; |
jmitc91516 | 1:a5258871b33d | 41 | |
jmitc91516 | 1:a5258871b33d | 42 | ActiveField currentlyActiveField; |
jmitc91516 | 1:a5258871b33d | 43 | |
jmitc91516 | 1:a5258871b33d | 44 | USBDeviceConnected* usbDevice; |
jmitc91516 | 1:a5258871b33d | 45 | USBHostGC* usbHostGC; |
jmitc91516 | 1:a5258871b33d | 46 | |
jmitc91516 | 1:a5258871b33d | 47 | static GasBackPressureDACPageHandler * theGasBackPressureDACPageHandlerInstance; |
jmitc91516 | 1:a5258871b33d | 48 | |
jmitc91516 | 1:a5258871b33d | 49 | // singleton class -> constructor is private |
jmitc91516 | 1:a5258871b33d | 50 | GasBackPressureDACPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 51 | ~GasBackPressureDACPageHandler(); |
jmitc91516 | 1:a5258871b33d | 52 | |
jmitc91516 | 1:a5258871b33d | 53 | void UpdateEasyGUIPage(void); |
jmitc91516 | 1:a5258871b33d | 54 | |
jmitc91516 | 1:a5258871b33d | 55 | bool GetCurrentGasBackPressureDACValuesFromGC(void); |
jmitc91516 | 1:a5258871b33d | 56 | |
jmitc91516 | 1:a5258871b33d | 57 | bool SetCurrentGasBackPressureDACValuesInGC(void); |
jmitc91516 | 1:a5258871b33d | 58 | |
jmitc91516 | 1:a5258871b33d | 59 | void SetAllEditableFieldsToInactive(void); |
jmitc91516 | 1:a5258871b33d | 60 | |
jmitc91516 | 1:a5258871b33d | 61 | void SelectActiveField(ActiveField thisField, ActiveField otherField, GuiConst_INTCOLOR *thisFieldBGColour, GuiConst_INTCOLOR* otherFieldBGColour); |
jmitc91516 | 1:a5258871b33d | 62 | |
jmitc91516 | 1:a5258871b33d | 63 | void ConstructSetBackPressureCommand(char *command, char gainOrOffsetCharacter, GuiConst_TEXT* easyGUIVariable); |
jmitc91516 | 1:a5258871b33d | 64 | }; |
jmitc91516 | 1:a5258871b33d | 65 | |
jmitc91516 | 1:a5258871b33d | 66 | #endif // GASBACKPRESSUREDACPAGEHANDLER_H |