EEROS  0.4.1.0
API for the EEROS Real-Time Robotics Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CursesUI.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_UI_TUI_HPP_
2 #define ORG_EEROS_UI_TUI_HPP_
3 
4 #include <atomic>
5 #include <deque>
6 
8 #include <eeros/core/Thread.hpp>
9 
10 #define INPUT_TIMEOUT 50
11 #define MAX_NOF_COMMANDS 6
12 #define HEADER_LINES 3
13 #define FOOTER_LINES 2
14 #define STATUS_LINES 4
15 #define MESSAGE_LINES 6
16 #define MESSAGE_LINE_MAX_LENGTH 100
17 
18 namespace eeros {
19  namespace ui {
20 
21  class CursesUI : public eeros::Thread {
22 
23  public:
25 
27  virtual ~CursesUI();
28 
29  virtual void dispay();
30  virtual void exit();
31 
32  virtual void addMessage(std::string message);
33 
34  protected:
35  virtual void run();
36 
37  private:
38  eeros::sequencer::Sequencer& sequencer;
41  std::atomic<bool> messageListUpdated;
42  std::atomic<State> state;
43  unsigned int headerStart;
44  unsigned int sequenceListStart;
45  unsigned int messageListStart;
46  unsigned int statusStart;
47  unsigned int commandListStart;
48  unsigned int footerStart;
49  std::deque<std::string> messageList;
50 
51  void initScreen();
52  void updateScreen();
53  void printTitle(std::string text, unsigned int line);
54  void printHeader();
55  void printFooter(std::string msg);
56  void printSequenceList(unsigned int first);
57  void printMessageList();
58  void printMessage(std::string msg, unsigned int index);
59  void printStatus();
60  void printCommandList();
61  void printCommand(std::string cmd, std::string description, bool active, unsigned int index);
62  int promptForInt(std::string message);
63 // double promptForDouble(std::string message);
64 // bool promptConfirm(std::string message);
65 
66  bool checkCmdToggleIsActive();
67  bool checkCmdAbortIsActive();
68  bool checkCmdProceedIsActive();
69  bool checkCmdChooseSeqIsActive();
70 
71  static unsigned int instanceCounter;
72 
73  }; // class TUI
74  }; // namespace ui
75 }; // namespace eeros
76 
77 #endif // ORG_EEROS_UI_TUI_HPP_
type
Definition: Sequencer.hpp:19
virtual void addMessage(std::string message)
Definition: CursesUI.cpp:282
virtual ~CursesUI()
Definition: CursesUI.cpp:29
Definition: CursesUI.hpp:24
Definition: CursesUI.hpp:24
CursesUI(eeros::sequencer::Sequencer &sequencer)
Definition: CursesUI.cpp:23
State
Definition: CursesUI.hpp:24
virtual void exit()
Definition: CursesUI.cpp:40
Definition: Sequencer.hpp:26
type
Definition: Sequencer.hpp:15
Definition: CursesUI.hpp:21
Definition: Thread.hpp:13
virtual void run()
Definition: CursesUI.cpp:212
Definition: CursesUI.hpp:24
virtual void dispay()
Definition: CursesUI.cpp:33
Definition: CursesUI.hpp:24