John Mitchell / lpc4088_displaymodule_GC500_2_5inch

Dependencies:   DMBasicGUI DMSupport

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DetectorIgnitionHandler.h Source File

DetectorIgnitionHandler.h

00001 #ifndef DETECTORIGNITIONHANDLER_H
00002 #define DETECTORIGNITIONHANDLER_H
00003 
00004 #include "mbed.h"
00005 #include "DMBoard.h"
00006 
00007 #include "USBHostGC.h"
00008 #include "GCIgnitionStateEnum.h"
00009 
00010 #include "GuiLib.h"
00011 
00012 /*
00013     A class to handle the ignition of the detector, in response to the user
00014     pressing the 'Ignite' button on the easyGUI pages for the FID
00015     and FPD detector types.
00016 
00017     Note that (as with many other classes in this application) this class is a singleton - 
00018     we do not need or want there to be more than one instance of it (we do not want 
00019     multiple ignition attempts going on simultaneously, and nor will we show 
00020     more than one easyGUI Detector page to the user at the same time).
00021 */
00022 
00023 class DetectorIgnitionHandler {
00024 public:
00025     /**
00026     * Static method to create (if necessary) and retrieve the single DetectorIgnitionHandler instance
00027     */
00028     static DetectorIgnitionHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);
00029     
00030     /**
00031     * Version of the above that does not create the instance. Provided for callers that do not have 
00032     * the 'usbDevice' and 'usbHostGC' pointers, and that just want access to the instance
00033     */
00034     static DetectorIgnitionHandler * GetInstance(void);
00035     
00036     bool TouchAreaIsDetectorIgniteButton(int touchAreaIndex);
00037 
00038     bool DealWithTouch(int touchAreaIndex);
00039     
00040     static bool Igniting(void) { return igniting; }
00041 
00042 private:    
00043     static DetectorIgnitionHandler * theDetectorIgnitionHandlerInstance;
00044     
00045     USBDeviceConnected* usbDevice;
00046     USBHostGC* usbHostGC;
00047     
00048     // singleton class -> constructor is private
00049     DetectorIgnitionHandler(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);    
00050     ~DetectorIgnitionHandler();
00051     
00052     void PerformIgnitionSequence(void);
00053     
00054     void SendCommandToGCAndGetResponse(char* command, char* response);
00055     
00056     bool TellGCToIgniteDetector(void);
00057 
00058     IgnitionState GetDetectorIgnitionState(void);
00059     
00060     void DrawTextOnIgniteButton(char* text, GuiConst_INTCOLOR foreColor, GuiConst_INTCOLOR backColor);
00061     
00062     void DrawIgnitionLightingText(void);
00063     void DrawIgnitionLitText(void);
00064     void DrawIgnitionNotLitText(void);
00065     
00066     static bool igniting;
00067 };
00068 
00069 #endif // DETECTORIGNITIONHANDLER_H