Repository for import to local machine

Dependencies:   DMBasicGUI DMSupport

GetGCStatusLoop.h

Committer:
jmitc91516
Date:
2016-01-13
Revision:
0:47c880c1463d
Child:
1:a5258871b33d

File content as of revision 0:47c880c1463d:

#ifndef GETGCSTATUSLOOP_H
#define GETGCSTATUSLOOP_H

#include "USBHostGC.h"
#include "GuiLib.h"

#include "GCComponentStatusEnums.h"
#include "GCComponentStatusColorArea.h"


// Note that GetGCStatusLoop is a singleton - we do not need or want there to be more than one instance of it
// (there is only one GC, and only one LPC4088)
class GetGCStatusLoop {
public:
    /**
    * Static method to create (if necessary) and retrieve the single GetGCStatusLoop instance
    */
    static GetGCStatusLoop * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);

    GuiConst_INT16U GetCurrentPage(void);
    void SetCurrentPage(GuiConst_INT16U newCurrentPage);
    
    void SetHomePageGCComponentStatusColorAreas(HomePageGCComponentStatusColorAreas* newColorAreas);
    
    void SetSingleGCComponentPageStatusColorAreas(SingleGCComponentPageStatusColorAreas* newColorAreas);
    
    void SetupAllEasyGUIVariables(void);
    
    void ExitedGCStandbyMode(void);

    /* ** These never return ** */
    void MainLoop(void); 
    void MainLoopWithEthernet(void); 
    
private:
    static GetGCStatusLoop * theGetGCStatusLoop;

    // singleton class -> constructor is private
    GetGCStatusLoop(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);    
    ~GetGCStatusLoop();

    USBDeviceConnected* usbDevice;
    USBHostGC* usbHostGC;
    
    GuiConst_INT16U currentPage; // This is the easyGUI 'Structure' value (see GuiStruct.h)
    
    void DisplayHomePageData(bool mustUpdateDisplay);
    void DisplayColumnPageData(bool mustUpdateDisplay);
    void DisplayInjectorPageData(bool mustUpdateDisplay);
    void DisplayDetectorPageData(bool mustUpdateDisplay);
    void DisplayGasPageData(bool mustUpdateDisplay);
    void DisplayRunningPageData(bool mustUpdateDisplay);
    void DisplayRunningSettingsPageData(bool mustUpdateDisplay);
    void DisplaySettingsPageData(bool mustUpdateDisplay);
    
    void DisplayCurrentPageData(bool mustUpdateDisplay);

    void GetComponentTemperature(char *cmd, char *temp);
    void GetComponentTemperature(char *cmd, float *temp);
    void GetColumnTemperature(char *temp);
    void GetColumnTemperature(float *temp);
    void GetDetectorTemperature(char *temp);
    void GetDetectorTemperature(float *temp);
    void GetInjectorTemperature(char *temp);
    void GetInjectorTemperature(float *temp);
    void GetGasPressure(char *press);
    void GetGasPressure(float *press);
    bool GetGasControlMode(char *mode, bool wantFullPrefix);
    void GetColumnMaxTemperature(char *maxTemp, bool wantFullPrefix);
    void GetColumnMaxTemperature(float *temp);
    void GetInjectionMode(char *mode, bool wantFullPrefix);
    void GetDetectorType(char *type, bool wantFullPrefix);
    void GetSoftwareVersion(char *version);
    void GetRunTime(char *time);

    bool pageJustChanged;
    bool displayingData;
    
    bool gcInStandbyMode;
    
    bool GCIsInStandbyMode(void);
    void DisplayStandbyModePage(void);

    HomePageGCComponentStatusColorAreas* homePageGCComponentStatusColorAreas;
    SingleGCComponentPageStatusColorAreas* singleGCComponentPageStatusColorAreas;
        
    void DisplayText(char *text, short X, short Y);
    
    void SetGCDeviceReport(char *cmd, char *response);
    
    int GetGCStatusOrFaultCode(char *cmd);
    int GetGCStatus(void);
    int GetGCFaultCode(void);
    void GetGCStateAsInfoString(int gcStateCode, int gcFaultCode, char *statusString);
    bool GCHasFaulted(char* statusString);
    void DisplayGCInFaultStatePage(void);    
    
    bool IsHeatOn(void);
    
    int GetInstrumentStatus(void);

    GCComponentStatus GetComponentStatus(GCComponent component);
    
    void UpdateHomePageGCComponentStatusColorAreas(void);
    
    void UpdateSingleGCComponentPageStatusColorArea(GCComponent component);
    
    static const int waitTimeMs;
    
    static const int ethernetPort;
    static const char* ethernetIP;
    static const char* ethernetMask;
    static const char* ethernetGateway;
};

#endif // GETGCSTATUSLOOP_H