00001 /* Copyright (c) 2010, Cedrus Corporation 00002 * All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are 00006 * met: 00007 * 00008 * Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 00011 * Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 00015 * Neither the name of Cedrus Corporation 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 00020 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00022 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00023 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00025 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00026 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00027 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00029 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 00032 #ifndef BASE_DEVICE_T_H 00033 #define BASE_DEVICE_T_H 00034 00035 #include <boost/shared_ptr.hpp> 00036 00037 namespace cedrus 00038 { 00039 class xid_con_t; 00040 class xid_device_config_t; 00041 00042 class base_device_t 00043 { 00044 public: 00050 base_device_t( 00051 boost::shared_ptr<xid_con_t> xid_con, 00052 const std::wstring &devconfig_path = L""); 00053 virtual ~base_device_t(); 00054 00060 std::string get_device_name(); 00061 00070 int get_product_id() const; 00071 00083 int get_model_id() const; 00084 00090 void reset_rt_timer(); 00091 00098 void reset_base_timer(); 00099 00103 int query_base_timer(); 00104 00117 int get_inquiry( 00118 const char in_command[], 00119 int expected_bytes_rec = 1, 00120 int timeout = 100, 00121 int delay = 0); 00122 00123 protected: 00124 boost::shared_ptr<xid_con_t> xid_con_; 00125 boost::shared_ptr<cedrus::xid_device_config_t> config_; 00126 00127 private: 00128 void init_device(const std::wstring &devconfig_path); 00129 std::string device_name_; 00130 int product_id_; 00131 int model_id_; 00132 00133 }; 00134 00135 } // namespace cedrus 00136 00137 #endif