00001 /* 00002 * This file is part of the rc_genicam_api package. 00003 * 00004 * Copyright (c) 2017 Roboception GmbH 00005 * All rights reserved 00006 * 00007 * Author: Heiko Hirschmueller 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright notice, 00013 * this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 00019 * 3. Neither the name of the copyright holder nor the names of its contributors 00020 * may be used to endorse or promote products derived from this software without 00021 * specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00024 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00026 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00027 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00028 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00029 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00030 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00031 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00032 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 * POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 00036 #ifndef RC_GENICAM_API_DEVICE 00037 #define RC_GENICAM_API_DEVICE 00038 00039 #include "interface.h" 00040 00041 namespace rcg 00042 { 00043 00044 class Stream; 00045 00052 class Device : public std::enable_shared_from_this<Device> 00053 { 00054 public: 00055 00056 enum ACCESS {READONLY, CONTROL, EXCLUSIVE}; 00057 00063 Device(const std::shared_ptr<Interface> &parent, 00064 const std::shared_ptr<const GenTLWrapper> &gentl, const char *id); 00065 ~Device(); 00066 00073 std::shared_ptr<Interface> getParent() const; 00074 00081 const std::string &getID() const; 00082 00089 void open(ACCESS access); 00090 00096 void close(); 00097 00106 std::vector<std::shared_ptr<Stream> > getStreams(); 00107 00117 std::string getVendor() const; 00118 00128 std::string getModel() const; 00129 00139 std::string getTLType() const; 00140 00150 std::string getDisplayName() const; 00151 00161 std::string getAccessStatus() const; 00162 00172 std::string getUserDefinedName() const; 00173 00183 std::string getSerialNumber() const; 00184 00194 std::string getVersion() const; 00195 00205 uint64_t getTimestampFrequency() const; 00206 00216 std::shared_ptr<GenApi::CNodeMapRef> getNodeMap(); 00217 00229 std::shared_ptr<GenApi::CNodeMapRef> getRemoteNodeMap(const char *xml=0); 00230 00237 void *getHandle() const; 00238 00239 private: 00240 00241 Device(class Device &); // forbidden 00242 Device &operator=(const Device &); // forbidden 00243 00244 std::shared_ptr<Interface> parent; 00245 std::shared_ptr<const GenTLWrapper> gentl; 00246 std::string id; 00247 00248 int n_open; 00249 void *dev; 00250 void *rp; 00251 00252 std::shared_ptr<CPort> cport, rport; 00253 std::shared_ptr<GenApi::CNodeMapRef> nodemap, rnodemap; 00254 00255 std::vector<std::weak_ptr<Stream> > slist; 00256 }; 00257 00265 std::vector<std::shared_ptr<Device> > getDevices(); 00266 00277 std::shared_ptr<Device> getDevice(const char *devid); 00278 00279 } 00280 00281 #endif