John Mitchell / lpc4088_displaymodule_GC500_2_5inch

Dependencies:   DMBasicGUI DMSupport

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DebugCommandsPageHandler.h Source File

DebugCommandsPageHandler.h

00001 #ifndef DEBUGCOMMANDSPAGEHANDLER_H
00002 #define DEBUGCOMMANDSPAGEHANDLER_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 Debug Commands page. 
00013     
00014     Note that this class is a singleton - we do not need or want there to be more than one instance of it
00015     (we will not show more than one Debug Commands page to the user at the same time).
00016 */
00017 
00018 class DebugCommandsPageHandler {
00019 public:
00020     /**
00021     * Static method to create (if necessary) and retrieve the single DebugCommandsPageHandler instance
00022     */
00023     static DebugCommandsPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);
00024     
00025     /**
00026     * Version of the above that does not create the instance. Provided for callers that do not have 
00027     * the 'usbDevice' and 'usbHostGC' pointers, and that just want access to the instance
00028     */
00029     static DebugCommandsPageHandler * GetInstance(void);
00030     
00031     bool TouchAreaIsOnDebugCommandsPage(int touchAreaIndex);
00032 
00033     bool DealWithTouch(int touchAreaIndex);
00034     
00035 private:    
00036     static DebugCommandsPageHandler * theDebugCommandsPageHandlerInstance;
00037     
00038     USBDeviceConnected* usbDevice;
00039     USBHostGC* usbHostGC;
00040     
00041     bool commandJustExecuted;
00042     
00043     // singleton class -> constructor is private
00044     DebugCommandsPageHandler (USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC);    
00045     ~DebugCommandsPageHandler();
00046     
00047     enum { MAX_COMMAND_LENGTH = 8 }; // i.e. the maximum number of characters in a command
00048 
00049     void SendCommandToGCAndDisplayResponse(void); // Command and response are always in the same easyGUI variables
00050     
00051     char GetCharCodeForTouchAreaIndex(int touchAreaIndex);
00052 
00053     void DisplayEasyGUIPage(void);
00054 };
00055 
00056 #endif // DEBUGCOMMANDSPAGEHANDLER_H