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