John Mitchell / lpc4088_displaymodule_GC500_2_5inch

Dependencies:   DMBasicGUI DMSupport

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GasBackPressureDACPageHandler.h Source File

GasBackPressureDACPageHandler.h

00001 #ifndef GASBACKPRESSUREDACPAGEHANDLER_H
00002 #define GASBACKPRESSUREDACPAGEHANDLER_H
00003 
00004 #include "mbed.h"
00005 #include "DMBoard.h"
00006 
00007 #include "USBHostGC.h"
00008 
00009 #include "GuiLib.h"
00010 
00011 /*
00012     This class handles user interaction with the easyGUI "GasBackPressureDACPage",
00013     as well as storing the values in QSPI memory.
00014     
00015     Note that this class is a singleton - we do not need or want there to be more than one instance of it
00016     (we do not want multiple values for the gain and offset, etc, and nor will we show 
00017     more than one easyGUI 'GasBackPressureDACPage' to the user at the same time).
00018 */
00019 class GasBackPressureDACPageHandler {
00020 public:
00021     /**
00022     * Static method to create (if necessary) and retrieve the single GasBackPressureDACPageHandler instance
00023     */
00024     static GasBackPressureDACPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);
00025     
00026     bool TouchAreaIsOnGasBackPressureDACPage(int touchAreaIndex);
00027 
00028     bool DealWithTouch(int touchAreaIndex);
00029 
00030     void DisplayingEasyGUIPage(bool updateEasyGUIVariables);    
00031 
00032 private:
00033 
00034     typedef enum enumActiveField { NONE, GAIN, OFFSET } ActiveField;
00035     
00036     static const int minimumGainAndOffsetValue;
00037     static const int maximumGainAndOffsetValue;
00038     
00039     static const GuiConst_INTCOLOR inactiveFieldBackgroundColour;
00040     static const GuiConst_INTCOLOR activeFieldBackgroundColour;
00041     
00042     ActiveField currentlyActiveField;
00043     
00044     USBDeviceConnected* usbDevice;
00045     USBHostGC* usbHostGC;
00046     
00047     static GasBackPressureDACPageHandler * theGasBackPressureDACPageHandlerInstance;
00048     
00049     // singleton class -> constructor is private
00050     GasBackPressureDACPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);    
00051     ~GasBackPressureDACPageHandler();
00052 
00053     void UpdateEasyGUIPage(void);
00054 
00055     bool GetCurrentGasBackPressureDACValuesFromGC(void);
00056     
00057     bool SetCurrentGasBackPressureDACValuesInGC(void);
00058     
00059     void SetAllEditableFieldsToInactive(void);
00060 
00061     void SelectActiveField(ActiveField thisField, ActiveField otherField, GuiConst_INTCOLOR *thisFieldBGColour, GuiConst_INTCOLOR* otherFieldBGColour);
00062 
00063     void ConstructSetBackPressureCommand(char *command, char gainOrOffsetCharacter, GuiConst_TEXT* easyGUIVariable);
00064 };
00065 
00066 #endif // GASBACKPRESSUREDACPAGEHANDLER_H