Repository for import to local machine
Dependencies: DMBasicGUI DMSupport
DebugCommandsPageHandler.h@1:a5258871b33d, 2017-07-20 (annotated)
- Committer:
- jmitc91516
- Date:
- Thu Jul 20 08:42:29 2017 +0000
- Revision:
- 1:a5258871b33d
Version before re-layout (July 2017). Also for mbed CLI import to local machine.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmitc91516 | 1:a5258871b33d | 1 | #ifndef DEBUGCOMMANDSPAGEHANDLER_H |
jmitc91516 | 1:a5258871b33d | 2 | #define DEBUGCOMMANDSPAGEHANDLER_H |
jmitc91516 | 1:a5258871b33d | 3 | |
jmitc91516 | 1:a5258871b33d | 4 | #include "mbed.h" |
jmitc91516 | 1:a5258871b33d | 5 | #include "DMBoard.h" |
jmitc91516 | 1:a5258871b33d | 6 | |
jmitc91516 | 1:a5258871b33d | 7 | #include "USBHostGC.h" |
jmitc91516 | 1:a5258871b33d | 8 | |
jmitc91516 | 1:a5258871b33d | 9 | #include "GuiLib.h" |
jmitc91516 | 1:a5258871b33d | 10 | |
jmitc91516 | 1:a5258871b33d | 11 | /* |
jmitc91516 | 1:a5258871b33d | 12 | This class handles user interaction with the easyGUI Debug Commands page. |
jmitc91516 | 1:a5258871b33d | 13 | |
jmitc91516 | 1:a5258871b33d | 14 | Note that this class is a singleton - we do not need or want there to be more than one instance of it |
jmitc91516 | 1:a5258871b33d | 15 | (we will not show more than one Debug Commands page to the user at the same time). |
jmitc91516 | 1:a5258871b33d | 16 | */ |
jmitc91516 | 1:a5258871b33d | 17 | |
jmitc91516 | 1:a5258871b33d | 18 | class DebugCommandsPageHandler { |
jmitc91516 | 1:a5258871b33d | 19 | public: |
jmitc91516 | 1:a5258871b33d | 20 | /** |
jmitc91516 | 1:a5258871b33d | 21 | * Static method to create (if necessary) and retrieve the single DebugCommandsPageHandler instance |
jmitc91516 | 1:a5258871b33d | 22 | */ |
jmitc91516 | 1:a5258871b33d | 23 | static DebugCommandsPageHandler * GetInstance(USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 24 | |
jmitc91516 | 1:a5258871b33d | 25 | /** |
jmitc91516 | 1:a5258871b33d | 26 | * Version of the above that does not create the instance. Provided for callers that do not have |
jmitc91516 | 1:a5258871b33d | 27 | * the 'usbDevice' and 'usbHostGC' pointers, and that just want access to the instance |
jmitc91516 | 1:a5258871b33d | 28 | */ |
jmitc91516 | 1:a5258871b33d | 29 | static DebugCommandsPageHandler * GetInstance(void); |
jmitc91516 | 1:a5258871b33d | 30 | |
jmitc91516 | 1:a5258871b33d | 31 | bool TouchAreaIsOnDebugCommandsPage(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 32 | |
jmitc91516 | 1:a5258871b33d | 33 | bool DealWithTouch(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 34 | |
jmitc91516 | 1:a5258871b33d | 35 | private: |
jmitc91516 | 1:a5258871b33d | 36 | static DebugCommandsPageHandler * theDebugCommandsPageHandlerInstance; |
jmitc91516 | 1:a5258871b33d | 37 | |
jmitc91516 | 1:a5258871b33d | 38 | USBDeviceConnected* usbDevice; |
jmitc91516 | 1:a5258871b33d | 39 | USBHostGC* usbHostGC; |
jmitc91516 | 1:a5258871b33d | 40 | |
jmitc91516 | 1:a5258871b33d | 41 | bool commandJustExecuted; |
jmitc91516 | 1:a5258871b33d | 42 | |
jmitc91516 | 1:a5258871b33d | 43 | // singleton class -> constructor is private |
jmitc91516 | 1:a5258871b33d | 44 | DebugCommandsPageHandler (USBDeviceConnected* newUsbDevice, USBHostGC* newUsbHostGC); |
jmitc91516 | 1:a5258871b33d | 45 | ~DebugCommandsPageHandler(); |
jmitc91516 | 1:a5258871b33d | 46 | |
jmitc91516 | 1:a5258871b33d | 47 | enum { MAX_COMMAND_LENGTH = 8 }; // i.e. the maximum number of characters in a command |
jmitc91516 | 1:a5258871b33d | 48 | |
jmitc91516 | 1:a5258871b33d | 49 | void SendCommandToGCAndDisplayResponse(void); // Command and response are always in the same easyGUI variables |
jmitc91516 | 1:a5258871b33d | 50 | |
jmitc91516 | 1:a5258871b33d | 51 | char GetCharCodeForTouchAreaIndex(int touchAreaIndex); |
jmitc91516 | 1:a5258871b33d | 52 | |
jmitc91516 | 1:a5258871b33d | 53 | void DisplayEasyGUIPage(void); |
jmitc91516 | 1:a5258871b33d | 54 | }; |
jmitc91516 | 1:a5258871b33d | 55 | |
jmitc91516 | 1:a5258871b33d | 56 | #endif // DEBUGCOMMANDSPAGEHANDLER_H |