device.h
Go to the documentation of this file.
1 /*
2  * This file is part of the rc_genicam_api package.
3  *
4  * Copyright (c) 2017 Roboception GmbH
5  * All rights reserved
6  *
7  * Author: Heiko Hirschmueller
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef RC_GENICAM_API_DEVICE
37 #define RC_GENICAM_API_DEVICE
38 
39 #include "interface.h"
40 
41 #include <mutex>
42 
43 namespace rcg
44 {
45 
46 class Stream;
47 
54 class Device : public std::enable_shared_from_this<Device>
55 {
56  public:
57 
59 
65  Device(const std::shared_ptr<Interface> &parent,
66  const std::shared_ptr<const GenTLWrapper> &gentl, const char *id);
67  ~Device();
68 
75  std::shared_ptr<Interface> getParent() const;
76 
83  const std::string &getID() const;
84 
91  void open(ACCESS access);
92 
98  void close();
99 
109  std::vector<std::shared_ptr<Stream> > getStreams();
110 
121  std::string getVendor();
122 
133  std::string getModel();
134 
145  std::string getTLType();
146 
157  std::string getDisplayName();
158 
169  std::string getAccessStatus();
170 
181  std::string getUserDefinedName();
182 
193  std::string getSerialNumber();
194 
205  std::string getVersion();
206 
217  uint64_t getTimestampFrequency();
218 
228  std::shared_ptr<GenApi::CNodeMapRef> getNodeMap();
229 
241  std::shared_ptr<GenApi::CNodeMapRef> getRemoteNodeMap(const char *xml=0);
242 
249  void *getHandle() const;
250 
251  private:
252 
253  Device(class Device &); // forbidden
254  Device &operator=(const Device &); // forbidden
255 
256  std::shared_ptr<Interface> parent;
257  std::shared_ptr<const GenTLWrapper> gentl;
258  std::string id;
259 
260  std::mutex mtx;
261 
262  int n_open;
263  void *dev;
264  void *rp;
265 
266  std::shared_ptr<CPort> cport, rport;
267  std::shared_ptr<GenApi::CNodeMapRef> nodemap, rnodemap;
268 
269  std::vector<std::weak_ptr<Stream> > slist;
270 };
271 
279 std::vector<std::shared_ptr<Device> > getDevices();
280 
291 std::shared_ptr<Device> getDevice(const char *devid);
292 
293 }
294 
295 #endif
std::vector< std::shared_ptr< Stream > > getStreams()
Returns the currently available streams of this device.
Definition: device.cc:180
std::shared_ptr< Device > getDevice(const char *id)
Searches across all transport layers and interfaces for a device.
Definition: device.cc:469
std::string getDisplayName()
Returns the display name of the device.
Definition: device.cc:299
void open(ACCESS access)
Opens the device for working with it.
Definition: device.cc:85
const std::string & getID() const
Get the internal ID of this device.
Definition: device.cc:80
std::shared_ptr< CPort > rport
Definition: device.h:266
void * getHandle() const
Get internal interface handle.
Definition: device.cc:432
void * rp
Definition: device.h:264
std::string getVendor()
Returns the vendor of the device.
Definition: device.cc:281
std::string getUserDefinedName()
Returns the user defined name of the device.
Definition: device.cc:365
std::shared_ptr< GenApi::CNodeMapRef > rnodemap
Definition: device.h:267
std::shared_ptr< const GenTLWrapper > gentl
Definition: device.h:257
std::mutex mtx
Definition: device.h:260
std::string getSerialNumber()
Returns the serial number of the device.
Definition: device.cc:371
std::shared_ptr< GenApi::CNodeMapRef > getRemoteNodeMap(const char *xml=0)
Returns the node map of the remote device.
Definition: device.cc:416
Device(const std::shared_ptr< Interface > &parent, const std::shared_ptr< const GenTLWrapper > &gentl, const char *id)
Constructs a device class.
Definition: device.cc:48
Device & operator=(const Device &)
std::shared_ptr< Interface > getParent() const
Returns the pointer to the parent interface object.
Definition: device.cc:75
std::shared_ptr< CPort > cport
Definition: device.h:266
std::shared_ptr< GenApi::CNodeMapRef > getNodeMap()
Returns the node map of this object.
Definition: device.cc:403
int n_open
Definition: device.h:262
void * dev
Definition: device.h:263
std::string getTLType()
Returns the transport layer type of the device.
Definition: device.cc:293
Definition: buffer.cc:47
std::string getModel()
Returns the model of the device.
Definition: device.cc:287
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: device.h:267
std::vector< std::shared_ptr< Device > > getDevices()
Returns a list of all devices that are available across all transport layers and interfaces.
Definition: device.cc:437
std::string id
Definition: device.h:258
uint64_t getTimestampFrequency()
Returns the timestamp frequency of the device.
Definition: device.cc:383
std::string getVersion()
Returns the version of the device.
Definition: device.cc:377
std::vector< std::weak_ptr< Stream > > slist
Definition: device.h:269
std::shared_ptr< Interface > parent
Definition: device.h:256
The device class encapsulates a Genicam device.
Definition: device.h:54
std::string getAccessStatus()
Returns the access status of the device.
Definition: device.cc:305
void close()
Closes the device.
Definition: device.cc:137


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 17 2021 02:48:40