John Mitchell / lpc4088_displaymodule_GC500_2_5inch

Dependencies:   DMBasicGUI DMSupport

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GetGCStatusLoop.h Source File

GetGCStatusLoop.h

00001 #ifndef GETGCSTATUSLOOP_H
00002 #define GETGCSTATUSLOOP_H
00003 
00004 #include "USBHostGC.h"
00005 #include "GuiLib.h"
00006 
00007 #include "GCComponentStatusEnums.h"
00008 #include "GCComponentStatusColorArea.h"
00009 #include "GCComponentTypeEnums.h"
00010 #include "GCIgnitionStateEnum.h"
00011 
00012 #include "GCStateAndFaultCodes.h"
00013 #include "TouchPanelPageSelector.h"
00014 #include "EasyGUITouchAreaIndices.h"
00015 #include "SimplifiedTouchListener.h"
00016 #include "EthernetHandler.h"
00017 #include "ProgressBar.h"
00018 #include "QSPIBitmap.h"
00019 #include "MethodRampData.h"
00020 
00021 #include "EthernetInterface.h"
00022 
00023 #include "GuiLibGraph.h"
00024 
00025 
00026 /*
00027     Together with functions in main.cpp - especially TouchCallback - this class does most of the work
00028     of interfacing with and controlling the GC. After the appropriate setting up and initialisation,
00029     the main() function calls this class's member function MainLoopWithEthernet - which never returns.
00030     
00031     Note that GetGCStatusLoop is a singleton - we do not need or want there to be more than one instance of it
00032     (there is only one GC, and only one LPC4088). On creation, the instance is passed pointers to the USBHostGC instance
00033     and the USB device corresponding to the GC.
00034 */
00035 class GetGCStatusLoop {
00036 public:
00037     /**
00038     * Static method to create (if necessary) and retrieve the single GetGCStatusLoop instance
00039     */
00040     static GetGCStatusLoop * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);
00041 
00042     /*
00043     * Static method to return the current instance, if it exists. If not, this function
00044     * will return NULL - it will *not* create a new instance
00045     */
00046     static GetGCStatusLoop * GetInstance(void);
00047 
00048     GuiConst_INT16U GetCurrentPage(void);
00049     void SetCurrentPage(GuiConst_INT16U newCurrentPage);
00050     
00051     void SetHomePageGCComponentStatusColorAreas(HomePageGCComponentStatusColorAreas* newColorAreas);
00052     
00053     void SetSingleGCComponentPageStatusColorAreas(SingleGCComponentPageStatusColorAreas* newColorAreas);
00054     
00055     void UpdateHomePageGCComponentStatusColorAreas(void);
00056     
00057     void UpdateSingleGCComponentPageStatusColorArea(GCComponent component);
00058     
00059     void UpdateAllGCComponentStatusColorAreas(void);
00060     
00061     void SetupAllEasyGUIVariables(void);
00062     
00063     void ExitedGCStandbyMode(void);
00064     
00065     void UpdateGCMethodRunningProfiles(void);
00066 
00067     // Need to call this from DisplayEasyGuiStructure function in main.cpp
00068     void DisplayInjectorTempProfilePageGraph(void);
00069 
00070     // Need to call this from DisplayEasyGuiStructure function in main.cpp
00071     void DisplayGasFlowProfilePageGraph(void);
00072 
00073     // Need to call this from DisplayEasyGuiStructure function in main.cpp
00074     void DisplayColumnTempProfilePageGraph(ColumnType columnType);
00075     
00076     void ForceUpdateOfGasCalibrationPage(void);
00077     
00078     void ForceUpdateOfColumnDHAutoCalibrationPage(void);
00079     void ForceUpdateOfColumnDHManualCalibrationPage(void);
00080     void ForceUpdateOfColumnDHSensorCalibrationPage(void);
00081     void ForceUpdateOfColumnDHPSUDACPage(void);
00082     
00083     void ForceUpdateOfGasBackPressureDACPage(void);
00084     void ForceUpdateOfGasChannelDACAndADCPage(void);
00085     
00086     void SetGCIsRunning(void);
00087     void ClearGCIsRunning(void);
00088     bool GetGCIsRunningFlag(void);
00089     
00090     bool UpdateMethodRunTimeEasyGUIVariables(bool runHasCompleted);
00091     void UpdateAndDisplayRunningPage1ProgressBar(bool runHasCompleted);
00092     void SetRunningPage1ProgressBarToZero(void);
00093     
00094     void UpdateColumnStatusEasyGUIVariable(void);
00095     void UpdateInjectorStatusEasyGUIVariable(void);
00096     
00097     static void TimerCallback(void const * argument);
00098     
00099     void ForceRestart(void);
00100     
00101     void RedisplayColumnCalibrationPage(void);
00102     
00103     void RedisplayColumnPage(void);
00104     
00105     static void DisplayColumnLockAndReleaseButtons(void);
00106     
00107     void SetQSPIBitmaps(QSPIBitmaps* ptrToQSPIBitmaps);
00108     
00109     void SetupTemperatureWhileRunningEasyGUIVariables(void);
00110     
00111     void SetupGCNotReadyStateEasyGUIVariable(void);
00112     
00113     void ShowColumnMethodPageScrollButtonsIfNecessary(void);
00114     void ScrollColumnMethodRampsUpIfPossible(void);
00115     void ScrollColumnMethodRampsDownIfPossible(void);
00116     
00117     void ShowInjectorMethodPageScrollButtonsIfNecessary(void);
00118     void ScrollInjectorMethodRampsUpIfPossible(void);
00119     void ScrollInjectorMethodRampsDownIfPossible(void);
00120     
00121     void ShowGasMethodPageScrollButtonsIfNecessary(void);
00122     void ScrollGasMethodRampsUpIfPossible(void);
00123     void ScrollGasMethodRampsDownIfPossible(void);
00124     
00125     static const char *GetDegCUnitsWithSpace(void);
00126     static const char *GetDegCUnitsWithoutSpace(void);
00127 
00128 
00129     /* ** This never returns ** */
00130     void MainLoopWithEthernet(DMBoard* board); 
00131     
00132 private:
00133     static GetGCStatusLoop * theGetGCStatusLoop;
00134 
00135     // singleton class -> constructor is private
00136     GetGCStatusLoop(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);    
00137     ~GetGCStatusLoop();
00138 
00139     USBDeviceConnected* usbDevice;
00140     USBHostGC* usbHostGC;
00141     
00142     GuiConst_INT16U currentPage; // This is the easyGUI 'Structure' value (see GuiStruct.h)
00143     
00144     ProgressBar* runningPage1ProgressBar;
00145     
00146     GuiLibGraph* runningColumnPageGraph; // Graph index 0
00147     GuiLibGraphDataSet* runningColumnPageGraphCompleteProfileDataSet; // Line representing the complete temperature profile from start to finish
00148     // We do not display the above data set in the graph - we use it to generate the data sets below. 
00149     // The data set numbers correspond with those set for the graph in easyGUI (as do the colours).
00150     GuiLibGraphDataSet* runningColumnPageGraphDataSet0; // Line representing the temperature profile from 'now' to finish (green)
00151     GuiLibGraphDataSet* runningColumnPageGraphDataSet1; // Bars representing the temperature profile from 'now' to finish (green)
00152     GuiLibGraphDataSet* runningColumnPageGraphDataSet2; // Line representing the temperature profile from start to 'now' (red)
00153     GuiLibGraphDataSet* runningColumnPageGraphDataSet3; // Bars representing the temperature profile from start to 'now' (red)
00154     GuiLibGraphDataSet* runningColumnPageGraphDataSet4; // Dot representing the temperature 'now' (red)
00155     float previousColumnMethodRunTime;
00156     bool columnMethodFinished;
00157     
00158     GuiLibGraph* runningGasPageGraph; // Graph index 1
00159     GuiLibGraphDataSet* runningGasPageGraphCompleteProfileDataSet; // Line representing the complete flow profile from start to finish
00160     // We do not display the above data set in the graph - we use it to generate the data sets below. 
00161     // The data set numbers correspond with those set for the graph in easyGUI.
00162     GuiLibGraphDataSet* runningGasPageGraphDataSet0; // Line representing the flow profile from 'now' to finish (green)
00163     GuiLibGraphDataSet* runningGasPageGraphDataSet1; // Bars representing the flow profile from 'now' to finish (green)
00164     GuiLibGraphDataSet* runningGasPageGraphDataSet2; // Line representing the flow profile from start to 'now' (blue)
00165     GuiLibGraphDataSet* runningGasPageGraphDataSet3; // Bars representing the flow profile from start to 'now' (blue)
00166     GuiLibGraphDataSet* runningGasPageGraphDataSet4; // Dot representing the temperature 'now' (blue)
00167     float previousGasMethodRunTime;
00168     bool gasMethodFinished;
00169     
00170     GuiLibGraph* injectorTempProfilePageGraph; // Graph index 2
00171     GuiLibGraphDataSet* injectorTempProfilePageGraphCompleteProfileDataSet; // Line representing the complete temperature profile from start to finish
00172     // We do not display the above data set in the graph - we use it to generate the data sets below. 
00173     // The data set numbers correspond with those set for the graph in easyGUI (as do the colours).
00174     GuiLibGraphDataSet* injectorTempProfilePageGraphDataSet0; // Line representing the temperature profile from 'now' to finish (green)
00175     GuiLibGraphDataSet* injectorTempProfilePageGraphDataSet1; // Bars representing the temperature profile from 'now' to finish (green)
00176     GuiLibGraphDataSet* injectorTempProfilePageGraphDataSet2; // Line representing the temperature profile from start to 'now' (red)
00177     GuiLibGraphDataSet* injectorTempProfilePageGraphDataSet3; // Bars representing the temperature profile from start to 'now' (red)
00178     GuiLibGraphDataSet* injectorTempProfilePageGraphDataSet4; // Dot representing the temperature 'now' (red)
00179     
00180     GuiLibGraph* gasFlowProfilePageGraph;  // Graph index 3
00181     GuiLibGraphDataSet* gasFlowProfilePageGraphCompleteProfileDataSet; // Line representing the complete flow profile from start to finish
00182     // We do not display the above data set in the graph - we use it to generate the data sets below. 
00183     // The data set numbers correspond with those set for the graph in easyGUI.
00184     GuiLibGraphDataSet* gasFlowProfilePageGraphDataSet0; // Line representing the flow profile from 'now' to finish (green)
00185     GuiLibGraphDataSet* gasFlowProfilePageGraphDataSet1; // Bars representing the flow profile from 'now' to finish (green)
00186     GuiLibGraphDataSet* gasFlowProfilePageGraphDataSet2; // Line representing the flow profile from start to 'now' (blue)
00187     GuiLibGraphDataSet* gasFlowProfilePageGraphDataSet3; // Bars representing the flow profile from start to 'now' (blue)
00188     GuiLibGraphDataSet* gasFlowProfilePageGraphDataSet4; // Dot representing the temperature 'now' (blue)
00189     
00190     GuiLibGraph* columnTempProfilePageGraph; // Graph index 4
00191     GuiLibGraphDataSet* columnTempProfilePageGraphCompleteProfileDataSet; // Line representing the complete temperature profile from start to finish
00192     // We do not display the above data set in the graph - we use it to generate the data sets below. 
00193     // The data set numbers correspond with those set for the graph in easyGUI (as do the colours).
00194     GuiLibGraphDataSet* columnTempProfilePageGraphDataSet0; // Line representing the temperature profile from 'now' to finish (green)
00195     GuiLibGraphDataSet* columnTempProfilePageGraphDataSet1; // Bars representing the temperature profile from 'now' to finish (green)
00196     GuiLibGraphDataSet* columnTempProfilePageGraphDataSet2; // Line representing the temperature profile from start to 'now' (red)
00197     GuiLibGraphDataSet* columnTempProfilePageGraphDataSet3; // Bars representing the temperature profile from start to 'now' (red)
00198     GuiLibGraphDataSet* columnTempProfilePageGraphDataSet4; // Dot representing the temperature 'now' (red)
00199     
00200     GuiLibGraph* runningInjectorPageGraph; // Graph index 6
00201     GuiLibGraphDataSet* runningInjectorPageGraphCompleteProfileDataSet; // Line representing the complete injector temperature profile from start to finish
00202     // We do not display the above data set in the graph - we use it to generate the data sets below. 
00203     // The data set numbers correspond with those set for the graph in easyGUI.
00204     GuiLibGraphDataSet* runningInjectorPageGraphDataSet0; // Line representing the injector temperature profile from 'now' to finish (green)
00205     GuiLibGraphDataSet* runningInjectorPageGraphDataSet1; // Bars representing the injector temperature profile from 'now' to finish (green)
00206     GuiLibGraphDataSet* runningInjectorPageGraphDataSet2; // Line representing the injector temperature profile from start to 'now' (yellow)
00207     GuiLibGraphDataSet* runningInjectorPageGraphDataSet3; // Bars representing the injector temperature profile from start to 'now' (yellow)
00208     GuiLibGraphDataSet* runningInjectorPageGraphDataSet4; // Dot representing the temperature 'now' (yellow)
00209     float previousInjectorMethodRunTime;
00210     bool injectorMethodFinished;
00211     
00212     void RedrawSingleEasyGUIVariableOnComponentPage(GuiConst_INT16S X, GuiConst_INT16S Y, void *varPtr, GuiConst_INT8U alignment, GCComponent gcComponent);
00213     void RedrawSingleEasyGUIVariableOnHomePage(GuiConst_INT16S X, GuiConst_INT16S Y, void *varPtr, GuiConst_INT8U alignment);
00214     
00215     void DrawColumnTemperatureVariableOnHomePage(void);
00216     void DrawInjectorTemperatureVariableOnHomePage(void);
00217     void DrawDetectorTemperatureVariableOnHomePage(void);
00218     void DrawColumnTargetTemperatureVariableOnHomePage(void);
00219     void DrawInjectorTargetTemperatureVariableOnHomePage(void);
00220     void DrawDetectorTargetTemperatureVariableOnHomePage(void);
00221     void DrawGasPressureVariableOnHomePage(void);
00222     void DrawGasTargetPressureVariableOnHomePage(void);
00223     void DrawGCRealTimeClockVariableOnHomePage(void);
00224     
00225     void DrawDetectorTemperatureVariableOnDetectorPage(void);
00226     void DrawDetectorTargetTemperatureVariableOnDetectorPage(void);
00227 
00228     void UpdateGasTargetPressuresOnHomePage(char *buffer);
00229 
00230     void DisplayHomePageData(bool mustUpdateDisplay);
00231     void DisplayColumnPageData(bool mustUpdateDisplay, ColumnType columnType, int pageNumber);
00232     void DisplayColumnInformationPageData(bool mustUpdateDisplay, ColumnType columnType, int pageNumber);
00233     void DisplayColumnMethodPageData(bool mustUpdateDisplay);
00234     void DisplayColumnTempProfilePageData(bool mustUpdateDisplay, ColumnType columnType, int pageNumber);
00235     void DisplayColumnDHAutoCalibrationPageData(bool mustUpdateDisplay);
00236     void DisplayColumnDHManualCalibrationPageData(bool mustUpdateDisplay);
00237     void DisplayColumnDHSensorCalibrationPageData(bool mustUpdateDisplay);
00238     void DisplayColumnDHPSUDACPageData(bool mustUpdateDisplay);
00239     void DisplayInjectorPageData(bool mustUpdateDisplay);
00240     void DisplayInjectorMethodPageData(bool mustUpdateDisplay);
00241     void DisplayInjectorTempProfilePageData(bool mustUpdateDisplay);
00242     void DisplayDetectorPageData(bool mustUpdateDisplay, DetectorType detectorType, int pageNumber);
00243     void DisplayGasInformationPageData(bool mustUpdateDisplay);
00244     void DisplayGasMethodPageData(bool mustUpdateDisplay);
00245     void DisplayGasFlowProfilePageData(bool mustUpdateDisplay);
00246     void DisplayGasCalibrationPageData(bool mustUpdateDisplay);
00247     void DisplayGasBackPressureDACPageData(bool mustUpdateDisplay);
00248     void DisplayGasChannelDACAndADCPageData(bool mustUpdateDisplay);
00249 
00250     void DisplaySimplePageData(int pageNumber, bool mustUpdateDisplay);
00251     void DisplayColumnOvenNudgeAndDampPageData(bool mustUpdateDisplay);
00252     void DisplayColumnDHNudgeAndDampPageData(bool mustUpdateDisplay);
00253     void DisplayInjectorNudgeAndDampPageData(bool mustUpdateDisplay);
00254     void DisplayDetectorNudgeAndDampPageData(bool mustUpdateDisplay);
00255     void DisplayAuxiliaryNudgeAndDampPageData(bool mustUpdateDisplay);
00256     void DisplayFanPowerPageData(bool mustUpdateDisplay);
00257     void DisplayDebugCommandsPageData(bool mustUpdateDisplay);
00258 
00259     void DisplayRunningPageData(bool mustUpdateDisplay, bool runHasCompleted);
00260     void DisplaySettingsPageData(bool mustUpdateDisplay);
00261     void DisplayRunningColumnPageData(bool mustUpdateDisplay, bool runHasCompleted);
00262     void DisplayRunningDetectorPageData(bool mustUpdateDisplay);
00263     void DisplayRunningGasPageData(bool mustUpdateDisplay, bool runHasCompleted);
00264     void DisplayRunningInjectorPageData(bool mustUpdateDisplay);
00265     void DisplayRunningInjectorProfilePageData(bool mustUpdateDisplay, bool runHasCompleted);
00266     
00267     void DisplayServicingRequiredPage(void);
00268     void DisplayServicingPage(void);
00269     
00270     void SetupServicingPageEasyGUIVariables(void);
00271     
00272     void DisplayCurrentPageData(bool mustUpdateDisplay);
00273     
00274     void DisplayEthernetConnectionPage(void);
00275     
00276     void DisplayFailedToFindBitmapsPage(void);
00277 
00278     void DisplayDownloadingMethodPage(void);
00279     void UndisplayDownloadingMethodPage(void);
00280     
00281     void CreateGuiLibGraphsAndDataSets(void);
00282 
00283     void SetupColumnAndInjectorAndGasProfileData(void);
00284 
00285     void SetupColumnTempProfilePageGraphDataFromGC(void);
00286     void SetupInjectorTempProfilePageGraphDataFromGC(void);
00287     void SetupGasFlowProfilePageGraphDataFromGC(void);
00288     
00289     void SetupColumnTempProfilePageXAxisLabel(TimeUnit timeUnit);
00290     void SetupInjectorTempProfilePageXAxisLabel(TimeUnit timeUnit);
00291     void SetupGasFlowProfilePageXAxisLabel(TimeUnit timeUnit);
00292 
00293     void SetupRunningColumnPageGraphCompleteProfileDataSetFromGC(void);
00294     bool SetupRunningColumnPageGraphPartialDataSetsToMatchCurrentRunTime(bool runHasCompleted);
00295     
00296     void SetupRunningGasPageGraphCompleteProfileDataSetFromGC(void);
00297     bool SetupRunningGasPageGraphPartialDataSetsToMatchCurrentRunTime(bool runHasCompleted);
00298     
00299     void SetupRunningInjectorPageGraphCompleteProfileDataSetFromGC(void);
00300     bool SetupRunningInjectorPageGraphPartialDataSetsToMatchCurrentRunTime(bool runHasCompleted);
00301     
00302     void GetComponentTemperature(char *cmd, char *temp, bool wantPrefix, bool wantDegSuffix, bool oneTenthDegree = true);
00303     void GetComponentTemperature(char *cmd, float *temp, bool oneTenthDegree = true);
00304     
00305     void GetColumnTemperature(char *temp, bool wantPrefix, bool wantSuffix);
00306     void GetColumnTemperature(char *temp, bool wantPrefix);
00307     void GetColumnTemperature(float *temp);
00308     
00309     void GetDirectlyHeatedColumnTemperature(char *temp, bool wantPrefix);
00310     void GetDirectlyHeatedColumnTemperature(float *temp);
00311     
00312     void GetColumnTargetTemperature(char *temp, const char *format);
00313     
00314     void GetDetectorTemperature(char *temp);
00315     void GetDetectorTemperature(float *temp);
00316     void GetDetectorTargetTemperature(char *temp, const char *format);
00317     
00318     void GetInjectorTemperature(char *temp, bool wantPrefix);
00319     void GetInjectorTemperature(float *temp);
00320     void GetInjectorTargetTemperature(char *temp, const char *format);
00321     
00322     void GetPressure(char *cmd, char *press, bool wantPrefix, bool wantUnits);
00323 
00324     void GetGasPressure(char *press, bool wantPrefix, bool wantUnits);
00325     void GetGasPressure(float *press);
00326     void GetGasPulsedPressure(char *pulsedPress);
00327     void GetCurrentGasPressure(char *press, bool wantPrefix, bool wantUnits);
00328     
00329     bool GetGasControlMode(char *mode, bool wantFullPrefix, bool wantAnyPrefix);
00330     void GetCarrierGasType(char *type);
00331     void GetGasFilterDateChanged(char *date);
00332     
00333     void GetColumnMaxTemperature(char *maxTemp, bool wantFullPrefix, bool wantAnyPrefix, bool wantUnits = false);
00334     void GetColumnMaxTemperature(float *temp);
00335     void GetColumnType(char *type);
00336     ColumnType GetColumnType(void);
00337     
00338     void GetInjectionMode(char *mode);
00339     void GetInjectorType(char *mode, bool wantPrefix);
00340     void GetInjectorSplitTime(char *splitTime);
00341     void GetInjectionCountSinceLinerChanged(char *injCount);
00342     void GetInjectionCountSinceSeptaChanged(char *injCount);
00343     void GetInjectionCountSinceOringChanged(char *injCount);
00344     
00345     void GetInjectionCountSinceColumnInstalled(char *injCount);
00346     void GetColumnLength(char *columnLengthBuffer);
00347     void GetColumnInnerDiameter(char *columnIDBuffer);
00348     void GetColumnOuterDiameter(char *columnODBuffer);
00349 
00350     void GetTotalFlow(char *totalFlow);
00351     void GetTotalFlow(float *totalFlow);
00352     void GetColumnFlow(char *columnFlow);
00353     void GetColumnFlow(float *columnFlow);
00354     
00355     void GetSplitFlow(float *splitFlow);
00356     void GetSplitFlow(char *splitFlow);
00357     void GetSplitRatio(float *splitRatio);
00358     void GetSplitRatio(char *splitRatio);
00359 
00360     void GetDetectorTypeOld(char *type, bool wantFullPrefix);
00361     void GetDetectorType(char *type, bool wantFullPrefix, bool wantPrefix);
00362     void GetDetectorRange(char *range);
00363     void GetDetectorIgnitionState(char *state);
00364     IgnitionState GetDetectorIgnitionState(void);
00365     
00366     void GetTCDDetectorFilamentPolarity(char *polarity);
00367     void GetTCDDetectorFilamentTemperature(char *temp);
00368     void GetTCDDetectorRange(char *range);
00369     
00370     void GetECDDetectorCurrent(char *current);
00371     
00372     void GetFPDDetectorRange(char *range);
00373     void GetFPDDetectorSensitivity(char *sensitivity);
00374     
00375     void GetFlowRate(char *cmd, char *rate);
00376     void GetFuelFlowRate(char *rate);
00377     void GetAirFlowRate(char *rate);
00378     
00379     bool ExecuteCommandWithDACKResponse(char *cmd);
00380 
00381     void GetGCSoftwareVersion(char *version);
00382     void GetActuatorSoftwareVersion(char *version);
00383     void GetRunTime(char *time);
00384     void GetRunTime(float *time);
00385     void GetSerialNumber(char *serialNumber);
00386     void GetGCRealTimeClockTime(char *clockTime);
00387     
00388     void GetInitialHoldTime(char *time);
00389     
00390     float GetColumnMethodTimeRemaining(void);
00391 
00392     bool pageJustChanged;
00393     bool displayingData;
00394     bool needToUpdateProfileGraphs;
00395     
00396     bool IsSendMethodCommand(char *gcCommand);
00397 
00398     bool sendingMethod;
00399     
00400     bool gcInStandbyMode;
00401     
00402     bool GCIsInStandbyMode(void);
00403     void DisplayStandbyModePage(void);
00404     bool ExitGCStandbyMode(void);
00405 
00406     bool ClearGCErrors(void);
00407     
00408     bool AbortGCRun(void);
00409 
00410     HomePageGCComponentStatusColorAreas* homePageGCComponentStatusColorAreas;
00411     SingleGCComponentPageStatusColorAreas* singleGCComponentPageStatusColorAreas;
00412         
00413     void SetGCDeviceReport(char *cmd, char *response);
00414     
00415     int GetGCStatusOrFaultCode(char *cmd);
00416     int GetGCStatus(void);
00417     int GetGCFaultCode(void);
00418     void GetGCStateAsInfoString(int gcStateCode, int gcFaultCode, char *statusString);
00419     bool GCHasFaulted(int gcStatus, char* statusString);
00420     bool GCHasFaulted(void);
00421     void DisplayGCInFaultStatePage(bool clearDisplay);    
00422     void DisplayRunCompletePage(void);
00423     void DisplayRunAbortedPage(void);
00424     
00425     bool IsHeatOn(void);
00426     
00427     int GetInstrumentStatus(void);
00428     bool GCIsRunning(void);
00429     bool realGCIsRunning;
00430     bool GCIsStabilising(void);
00431     
00432     GCComponentStatus GetComponentStatus(GCComponent component);
00433     void GetComponentStatusString(GCComponent component, char *buff);
00434     
00435     bool HomePageGCComponentStatusesHaveChanged(void);
00436 
00437     bool SinglePageGCComponentStatusHasChanged(GCComponent component);
00438     bool SinglePageGCComponentStatusHasChanged(GCComponent component, GCComponentStatus lastStatusDisplayed);
00439     
00440     GCComponentStatus lastColumnStatusDisplayedOnHomePage;
00441     GCComponentStatus lastInjectorStatusDisplayedOnHomePage;
00442     GCComponentStatus lastDetectorStatusDisplayedOnHomePage;
00443     GCComponentStatus lastGasStatusDisplayedOnHomePage;
00444 
00445     GCComponentStatus lastColumnStatusDisplayedOnColumnPage;
00446     GCComponentStatus lastInjectorStatusDisplayedOnInjectorPage;
00447     GCComponentStatus lastDetectorStatusDisplayedOnDetectorPage;
00448     GCComponentStatus lastGasStatusDisplayedOnGasInformationPage;
00449     
00450     bool SuccessfulRunCommand(char* gcCommand, char* gcResponse);
00451     bool SuccessfulAbortCommand(char* gcCommand, char* gcResponse);
00452 
00453     void ShortEthernetThreadWait(Thread* ethernetThread, int debugValue);
00454     void ShortTouchThreadWait(SimplifiedTouchListener* stl, int debugValue);
00455     void ShortThreadWait(SimplifiedTouchListener* stl, Thread* ethernetThread, int debugValue);
00456     
00457     void PollGC(SimplifiedTouchListener* stl, Thread* ethernetThread);
00458 
00459     void HandleEthernetMessage(Thread* ethernetThread, int debugValue);
00460     bool handlingEthernetMessage;
00461     
00462     void HandleTouchEvent(short touchX, short touchY, short touchZ, int debugValue);
00463     bool handlingTouchEvent;
00464     
00465     bool PageIncludesComponentStatus(int pageNumber);
00466     
00467     void HandleUserInterfaceAndEthernet(SimplifiedTouchListener* stl, Thread* ethernetThread);
00468     
00469     GCStateAndFaultCodes gcStateAndFaultCodes;
00470     
00471     bool gotAtLeastOneTimeout;
00472     
00473     bool runWasAborted;
00474     
00475     int  ethernetPort;
00476     char ethernetIP[20];
00477     char ethernetMask[20];
00478     char ethernetGateway[20];
00479     bool useDHCPForEthernet;
00480 
00481     bool restartRequired;
00482     
00483     GCStateSimplified lastSimplifiedGCState;
00484     
00485     Timer gcResponseTimer;
00486     Timer touchTimer;
00487     
00488     QSPIBitmaps* qspiBitmaps;
00489 
00490     ColumnType runningColumnType;
00491 
00492     // Same for all three easyGUI pages displaying method data - column, method and gas
00493     void ShowMethodPageScrollButtons(bool needToScrollRampData);
00494     void ShowMethodPageScrollButtonsIfNecessary(MethodRampData *methodRampData);
00495 
00496     ColumnMethodRampData* columnMethodRampData;
00497     void UpdateColumnMethodPageData(void);
00498     unsigned int columnMethodPageScrollIndex; // It would never be valid for this to be less than zero
00499     unsigned int previousColumnMethodPageScrollIndex;
00500     
00501     InjectorMethodRampData* injectorMethodRampData;
00502     void UpdateInjectorMethodPageData(void);
00503     unsigned int injectorMethodPageScrollIndex; // It would never be valid for this to be less than zero
00504     unsigned int previousInjectorMethodPageScrollIndex;
00505     
00506     GasMethodRampData* gasMethodRampData;
00507     void UpdateGasMethodPageData(void);
00508     unsigned int gasMethodPageScrollIndex; // It would never be valid for this to be less than zero
00509     unsigned int previousGasMethodPageScrollIndex;
00510     
00511     // RTosTimer stuff
00512     RtosTimer* rtosTimer;
00513     int lastTouchEventTickCount;
00514     short lastTouchEventX;
00515     short lastTouchEventY;
00516     static osThreadId timerCallbackThreadToSignal;
00517     static const int waitTimeMs;
00518     static const int shortWaitTimeMs;
00519     static int timerTickCount;
00520     static const uint32_t timerIntervalMilliSec;
00521     static const uint32_t minTimerTicksBetweenTouchEvents;
00522     
00523     static const float graphBarIntervalMinutes;
00524     static const float graphBarIntervalSeconds;
00525     
00526     static const float methodTimeUnitsThreshold;
00527     
00528     static const int   defaultEthernetPort;
00529     static const char* defaultEthernetIP;
00530     static const char* defaultEthernetMask;
00531     static const char* defaultEthernetGateway;
00532     
00533     static const char* startDHColumnCalibration;
00534     static const char* exitDHColumnCalibration;
00535 
00536     static const char degSymbol;
00537     static const char stringFormatdegCUnits[6];
00538         
00539     static void DisplayText(char *text, short X, short Y, GuiConst_INT8U alignment, GuiConst_INT16U fontNo, GuiConst_INTCOLOR foreColor);
00540 };
00541 
00542 #endif // GETGCSTATUSLOOP_H