RemoteGuiBase.cpp
Go to the documentation of this file.
1#include "RemoteGuiBase.h"
2
5
6namespace armarx::RemoteGui
7{
8
9 RemoteGuiBase::RemoteGuiBase(const RemoteGuiInterfacePrx& remoteGui) : remoteGui(remoteGui)
10 {
11 }
12
13 void
14 RemoteGuiBase::run()
15 {
16 constexpr int kCycleDurationMs = 100;
17
18 CycleUtil c(kCycleDurationMs);
19 while (!runningTask->isStopped())
20 {
21 tab.receiveUpdates();
22
23 handleEvents(tab);
24
25 tab.sendUpdates();
26
27 c.waitForCycleDuration();
28 }
29 }
30
31 void
32 RemoteGuiBase::createTab(const WidgetPtr& widget)
33 {
34 ARMARX_INFO << "RemoteGui: creating tab " << tabName();
35 remoteGui->createTab(tabName(), widget);
36 tab = TabProxy(remoteGui, tabName());
37
38 runningTask = new RunningTask<RemoteGuiBase>(this, &RemoteGuiBase::run),
39 runningTask->start();
40 }
41
42 void
44 {
45 if (!runningTask->isStopped())
46 {
47 runningTask->stop();
48 }
49
50 ARMARX_DEBUG << "Removing tab: " << tabName();
51 remoteGui->removeTab(tabName());
52 }
53
56 {
57 return tab;
58 }
59
62 {
63 return tab;
64 }
65
66 RemoteGuiInterfacePrx&
68 {
69 return remoteGui;
70 }
71
72 const RemoteGuiInterfacePrx&
74 {
75 return remoteGui;
76 }
77
78} // namespace armarx::RemoteGui
constexpr T c
This util class helps with keeping a cycle time during a control cycle.
Definition CycleUtil.h:41
armarx::RemoteGui::TabProxy & getTab()
virtual void handleEvents(armarx::RemoteGui::TabProxy &tab)=0
RemoteGuiBase(const RemoteGuiInterfacePrx &remoteGui)
void createTab(const WidgetPtr &widget)
virtual const std::string & tabName() const =0
RemoteGuiInterfacePrx & getRemoteGui()
void start()
Starts the thread.
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
Definition Logging.h:184