r2000_driver.h
Go to the documentation of this file.
00001 // Copyright (c) 2014, Pepperl+Fuchs GmbH, Mannheim
00002 // Copyright (c) 2014, Denis Dillenberger
00003 // All rights reserved.
00004 //
00005 // Redistribution and use in source and binary forms, with or without modification,
00006 // are permitted provided that the following conditions are met:
00007 //
00008 // * Redistributions of source code must retain the above copyright notice, this
00009 //   list of conditions and the following disclaimer.
00010 //
00011 // * Redistributions in binary form must reproduce the above copyright notice, this
00012 //   list of conditions and the following disclaimer in the documentation and/or
00013 //   other materials provided with the distribution.
00014 //
00015 // * Neither the name of Pepperl+Fuchs nor the names of its
00016 //   contributors may be used to endorse or promote products derived from
00017 //   this software without specific prior written permission.
00018 //
00019 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00020 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00023 // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00026 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 
00030 #ifndef R2000_DRIVER_H
00031 #define R2000_DRIVER_H
00032 
00033 #include <string>
00034 #include <vector>
00035 #include <map>
00036 #include <boost/optional.hpp>
00037 #include <pepperl_fuchs_r2000/protocol_info.h>
00038 #include <pepperl_fuchs_r2000/packet_structure.h>
00039 
00040 namespace pepperl_fuchs {
00041 
00042 class HttpCommandInterface;
00043 class ScanDataReceiver;
00044 
00047 class R2000Driver
00048 {
00049 public:
00051     R2000Driver();
00052 
00054     ~R2000Driver();
00055 
00059     bool connect(const std::string hostname, int port=80);
00060 
00062     void disconnect();
00063 
00065     bool isConnected() {return is_connected_; }
00066 
00069     bool startCapturingTCP();
00070 
00073     bool startCapturingUDP();
00074 
00077     bool stopCapturing();
00078 
00081     bool isCapturing();
00082 
00085     bool checkConnection();
00086 
00089     const ProtocolInfo& getProtocolInfo() { return protocol_info_; }
00090 
00093     const std::map< std::string, std::string >& getParameters();
00094 
00097     const std::map< std::string, std::string >& getParametersCached() const {return parameters_;}
00098 
00103     ScanData getScan();
00104 
00108     ScanData getFullScan();
00109 
00111     std::size_t getScansAvailable() const;
00112 
00114     std::size_t getFullScansAvailable() const;
00115 
00118     bool setScanFrequency( unsigned int frequency );
00119 
00123     bool setSamplesPerScan( unsigned int samples );
00124 
00127     bool rebootDevice();
00128 
00132     bool resetParameters( const std::vector<std::string>& names );
00133 
00136     bool setParameter( const std::string& name, const std::string& value );
00137 
00139     void feedWatchdog(bool feed_always = false);
00140 
00141 private:
00143     HttpCommandInterface* command_interface_;
00144 
00146     ScanDataReceiver* data_receiver_;
00147 
00149     bool is_connected_;
00150 
00152     bool is_capturing_;
00153 
00155     double watchdog_feed_time_;
00156 
00158     double food_timeout_;
00159 
00161     boost::optional<HandleInfo> handle_info_;
00162 
00164     ProtocolInfo protocol_info_;
00165 
00167     std::map< std::string, std::string > parameters_;
00168 };
00169 
00170 } // NS pepperl_fuchs
00171 
00172 #endif // R2000_DRIVER_H


pepperl_fuchs_r2000
Author(s): Denis Dillenberger
autogenerated on Thu Jun 6 2019 19:34:11