CyberGloveObserver.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI::ArmarXObjects::CyberGloveObserver
17  * @author JuliaStarke ( julia dot starke at kit dot edu )
18  * @date 2018
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 
26 #include <RobotAPI/interface/units/CyberGloveObserverInterface.h>
28 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
30 
31 #include <mutex>
32 
33 namespace armarx
34 {
35  /**
36  * @class CyberGloveObserverPropertyDefinitions
37  * @brief
38  */
41  {
42  public:
45  {
46  //defineRequiredProperty<std::string>("PropertyName", "Description");
47  defineOptionalProperty<std::string>("CyberGloveTopicName", "CyberGloveValues", "Name of the CyberGlove Topic");
48  }
49  };
50 
51  /**
52  * @defgroup Component-CyberGloveObserver CyberGloveObserver
53  * @ingroup RobotAPI-Components
54  * A description of the component CyberGloveObserver.
55  *
56  * @class CyberGloveObserver
57  * @ingroup Component-CyberGloveObserver
58  * @brief Brief description of class CyberGloveObserver.
59  *
60  * Detailed description of class CyberGloveObserver.
61  */
63  virtual public Observer,
64  virtual public CyberGloveObserverInterface
65  {
66  public:
68 
69  /**
70  * @see armarx::ManagedIceObject::getDefaultName()
71  */
72  std::string getDefaultName() const override
73  {
74  return "CyberGloveObserver";
75  }
76 
77  protected:
78  /**
79  * @see armarx::ManagedIceObject::onInitComponent()
80  */
81  void onInitObserver() override;
82 
83  /**
84  * @see armarx::ManagedIceObject::onConnectComponent()
85  */
86  void onConnectObserver() override;
87 
88  /**
89  * @see armarx::ManagedIceObject::onDisconnectComponent()
90  */
91  //void onDisconnectObserver() override;
92 
93  /**
94  * @see armarx::ManagedIceObject::onExitComponent()
95  */
96  void onExitObserver() override;
97 
98  /**
99  * @see PropertyUser::createPropertyDefinitions()
100  */
102 
103  private:
104 
105  std::mutex dataMutex;
106  CyberGloveValues latestValues;
107  IceUtil::Time lastUpdate;
108 
109  // CyberGloveListenerInterface interface
110  public:
111  void reportGloveValues(const CyberGloveValues& gloveValues, const Ice::Current&) override;
112  CyberGloveValues getLatestValues(const Ice::Current&) override;
113 
114  };
115 }
armarx::Observer
Baseclass for all ArmarX Observers.
Definition: Observer.h:80
armarx::CyberGloveObserver::getLatestValues
CyberGloveValues getLatestValues(const Ice::Current &) override
Definition: CyberGloveObserver.cpp:108
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
Observer.h
armarx::CyberGloveObserver::onExitObserver
void onExitObserver() override
Definition: CyberGloveObserver.cpp:46
armarx::CyberGloveObserver::reportGloveValues
void reportGloveValues(const CyberGloveValues &gloveValues, const Ice::Current &) override
Definition: CyberGloveObserver.cpp:57
armarx::CyberGloveObserver::onInitObserver
void onInitObserver() override
Definition: CyberGloveObserver.cpp:28
armarx::CyberGloveObserver::onConnectObserver
void onConnectObserver() override
Definition: CyberGloveObserver.cpp:34
armarx::CyberGloveObserver::CyberGloveObserver
CyberGloveObserver()
Definition: CyberGloveObserver.h:67
armarx::CyberGloveValues
Definition: CyberGloveInterface.ice:30
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
TimeUtil.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::CyberGloveObserver::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: CyberGloveObserver.cpp:51
armarx::CyberGloveObserver
Brief description of class CyberGloveObserver.
Definition: CyberGloveObserver.h:62
armarx::CyberGloveObserver::getDefaultName
std::string getDefaultName() const override
Definition: CyberGloveObserver.h:72
armarx::CyberGloveObserverPropertyDefinitions
Definition: CyberGloveObserver.h:39
armarx::ObserverPropertyDefinitions
Definition: Observer.h:50
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::CyberGloveObserverPropertyDefinitions::CyberGloveObserverPropertyDefinitions
CyberGloveObserverPropertyDefinitions(std::string prefix)
Definition: CyberGloveObserver.h:43