Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DMBasicGUI DMSupport
GasCalibrationPageHandler.h
00001 #ifndef GASCALIBRATIONPAGEHANDLER_H 00002 #define GASCALIBRATIONPAGEHANDLER_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 'GasCalibrationPage', 00013 with the easyGUI variable and our own internal variable to which it corresponds 00014 */ 00015 typedef struct structGasCalibrationEasyGUITouchAreaAndVariables { 00016 int touchAreaIndex; 00017 GuiConst_TEXT * easyGUIVariablePtr; 00018 unsigned int maxValue; 00019 GuiConst_INTCOLOR * easyGUIBackgroundColorVariablePtr; 00020 char variableName[41]; 00021 } GasCalibrationEasyGUITouchAreaAndVariables; 00022 00023 00024 /* 00025 This class handles user interaction with the easyGUI "GasCalibrationPage", 00026 as well as storing the values in QSPI memory. 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 carrier gas selection, etc, and nor will we show 00030 more than one easyGUI 'GasCalibrationPage' to the user at the same time). 00031 */ 00032 class GasCalibrationPageHandler { 00033 public: 00034 /** 00035 * Static method to create (if necessary) and retrieve the single GasCalibrationPageHandler instance 00036 */ 00037 static GasCalibrationPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); 00038 00039 bool TouchAreaIsOnCalibrationPage(int touchAreaIndex); 00040 00041 bool DealWithTouch(int touchAreaIndex); 00042 00043 void DisplayingEasyGUIPage(bool updateEasyGUIVariables); 00044 00045 private: 00046 enum {CARRIER_GAS_HELIUM = 0, CARRIER_GAS_HYDROGEN = 1, CARRIER_GAS_NITROGEN = 2}; 00047 00048 static GasCalibrationPageHandler * theGasCalibrationPageHandlerInstance; 00049 00050 static const GuiConst_INTCOLOR inactiveFieldBackgroundColour; 00051 static const GuiConst_INTCOLOR activeFieldBackgroundColour; 00052 00053 USBDeviceConnected* usbDevice; 00054 USBHostGC* usbHostGC; 00055 00056 int indexOfValueCurrentlyBeingEdited; 00057 00058 // singleton class -> constructor is private 00059 GasCalibrationPageHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); 00060 ~GasCalibrationPageHandler(); 00061 00062 void SaveCarrierGasSelectionToQSPISettings(void); 00063 void ReadCarrierGasSelectionFromQSPISettings(void); 00064 00065 void UpdateEasyGUIPage(void); 00066 00067 void GetCurrentCalibrationFromGC(void); 00068 void SetCurrentCalibrationInGC(void); 00069 00070 bool GetCalibrationDACAndFlowValuesFromGC(int carrierGasSelection, int valueIndex, char *bufferForDACValue, char *bufferForFlowValue); 00071 bool SetCalibrationDACAndFlowValuesInGC(int carrierGasSelection, int valueIndex, char *bufferForDACValue, char *bufferForFlowValue); 00072 00073 bool ConstructGasCalibrationGCCommand(bool wantSetCommand, int carrierGasSelection, int valueIndex, bool wantDACCommand, char *commandBuffer); 00074 void CopyBufferDigitsToCommand(char *commandBuffer, char *digitsBuffer); 00075 00076 enum { COUNT_OF_VARIABLES_FOR_TOUCH_AREAS = 12 }; 00077 GasCalibrationEasyGUITouchAreaAndVariables variablesForTouchArea[COUNT_OF_VARIABLES_FOR_TOUCH_AREAS]; 00078 00079 void SetAllFieldBackgroundColoursToInactive(void); 00080 00081 int GetIndexOfValueToEditForTouchArea(int touchAreaIndex); 00082 00083 void CopyCommandResponseToBufferWithoutLeadingZeroes(char *commandResponse, char *buffer); 00084 }; 00085 00086 #endif // GASCALIBRATIONPAGEHANDLER_H 00087
Generated on Tue Jul 19 2022 00:31:06 by
1.7.2