RemoteGuiBase.cpp
Go to the documentation of this file.
1 #include "RemoteGuiBase.h"
2 
5 
6 
7 namespace armarx::RemoteGui
8 {
9 
10  RemoteGuiBase::RemoteGuiBase(const RemoteGuiInterfacePrx& remoteGui)
11  : remoteGui(remoteGui)
12  {
13  }
14 
15  void RemoteGuiBase::run()
16  {
17  constexpr int kCycleDurationMs = 100;
18 
19  CycleUtil c(kCycleDurationMs);
20  while (!runningTask->isStopped())
21  {
22  tab.receiveUpdates();
23 
24  handleEvents(tab);
25 
26  tab.sendUpdates();
27 
28  c.waitForCycleDuration();
29  }
30  }
31 
32  void 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 
44  {
45  if (!runningTask->isStopped())
46  {
47  runningTask->stop();
48  }
49 
50  ARMARX_DEBUG << "Removing tab: " << tabName();
51  remoteGui->removeTab(tabName());
52  }
53 
55  {
56  return tab;
57  }
58 
60  {
61  return tab;
62  }
63 
64  RemoteGuiInterfacePrx& RemoteGuiBase::getRemoteGui()
65  {
66  return remoteGui;
67  }
68 
69  const RemoteGuiInterfacePrx& RemoteGuiBase::getRemoteGui() const
70  {
71  return remoteGui;
72  }
73 
74 } // namespace armarx::RemoteGui
armarx::RemoteGui::RemoteGuiBase::createTab
void createTab(const WidgetPtr &widget)
Definition: RemoteGuiBase.cpp:32
armarx::RemoteGui
Definition: LightweightRemoteGuiComponentPlugin.h:30
armarx::CycleUtil
This util class helps with keeping a cycle time during a control cycle.
Definition: CycleUtil.h:40
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::RunningTask
Definition: ArmarXMultipleObjectsScheduler.h:35
armarx::RemoteGui::RemoteGuiBase::tabName
virtual const std::string & tabName() const =0
armarx::RemoteGui::TabProxy
Definition: WidgetProxy.h:17
RemoteGuiBase.h
armarx::RemoteGui::TabProxy::receiveUpdates
void receiveUpdates()
Definition: WidgetProxy.h:131
armarx::RemoteGui::RemoteGuiBase::shutdown
void shutdown()
Definition: RemoteGuiBase.cpp:43
armarx::RemoteGui::RemoteGuiBase::getTab
armarx::RemoteGui::TabProxy & getTab()
Definition: RemoteGuiBase.cpp:54
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
armarx::WidgetDescription::WidgetPtr
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
Definition: NJointControllerBase.h:66
CycleUtil.h
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::RemoteGui::RemoteGuiBase::handleEvents
virtual void handleEvents(armarx::RemoteGui::TabProxy &tab)=0
armarx::RemoteGui::TabProxy::sendUpdates
void sendUpdates()
Definition: WidgetProxy.h:146
Logging.h
armarx::RemoteGui::RemoteGuiBase::getRemoteGui
RemoteGuiInterfacePrx & getRemoteGui()
Definition: RemoteGuiBase.cpp:64
armarx::RemoteGui::RemoteGuiBase::RemoteGuiBase
RemoteGuiBase(const RemoteGuiInterfacePrx &remoteGui)
Definition: RemoteGuiBase.cpp:10