YARP
Yet Another Robot Platform
Device.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_ROBOTINTERFACE_DEVICE_H
7 #define YARP_ROBOTINTERFACE_DEVICE_H
8 
12 
13 namespace yarp {
14 
15 namespace dev {
16 class PolyDriver;
17 class PolyDriverDescriptor;
18 class PolyDriverList;
19 } // namespace dev
20 
21 namespace robotinterface {
22 
24 {
25 public:
26  explicit Device();
27  Device(const std::string& name,
28  const std::string& type,
29  const ParamList& params = ParamList(),
30  const ActionList& actions = ActionList());
31  Device(const Device& other);
32  Device& operator=(const Device& other);
33 
34  virtual ~Device();
35 
36  std::string& name();
37  std::string& type();
38  ParamList& params();
39  ActionList& actions();
40 
41  const std::string& name() const;
42  const std::string& type() const;
43  const ParamList& params() const;
44  const ActionList& actions() const;
45 
46  bool hasParam(const std::string& name) const;
47  std::string findParam(const std::string& name) const;
48 
49  bool open();
50  bool close();
51 
52  yarp::dev::PolyDriver* driver() const;
53 
54  // thread handling methods
55  void registerThread(yarp::os::Thread* thread) const;
56  void joinThreads() const;
57  void stopThreads() const;
58 
59  // configure action
60  bool configure(const Device& target, const ParamList& params) const;
61 
62  // calibrate one device
63  bool calibrate(const yarp::dev::PolyDriverDescriptor& target) const;
64 
65  // attach a list of drivers to this wrapper
66  bool attach(const yarp::dev::PolyDriverList& drivers) const;
67 
68  // abort action
69  bool abort() const;
70 
71  // detach all drivers attached to this wrapper
72  bool detach() const;
73 
74  // park
75  bool park(const yarp::dev::PolyDriverDescriptor& target) const;
76 
77  // custom action
78  bool custom(const ParamList& params) const;
79 
80 
81 private:
82  class Private;
83  Private* const mPriv;
84 }; // class Device
85 
86 } // namespace robotinterface
87 } // namespace yarp
88 
90 
91 
92 #endif // YARP_ROBOTINTERFACE_DEVICE_H
yarp::os::LogStream operator<<(yarp::os::LogStream dbg, const yarp::robotinterface::Device &t)
Definition: Device.cpp:187
float t
A container for a device driver.
Definition: PolyDriver.h:24
An abstraction for a thread of execution.
Definition: Thread.h:22
bool configure(const Device &target, const ParamList &params) const
bool custom(const ParamList &params) const
yarp::robotinterface::Device Device
Definition: Device.h:31
std::vector< robotinterface::Action > ActionList
Definition: Types.h:31
bool hasParam(const robotinterface::ParamList &list, const std::string &name)
Definition: Types.cpp:16
std::vector< robotinterface::Param > ParamList
Definition: Types.h:28
std::string findParam(const robotinterface::ParamList &list, const std::string &name)
Definition: Types.cpp:26
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_robotinterface_API
Definition: api.h:18