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 XID_DEVICE_CONFIG_T_H 00033 #define XID_DEVICE_CONFIG_T_H 00034 00035 #include <map> 00036 #include <string> 00037 #include <boost/shared_ptr.hpp> 00038 00039 namespace cedrus 00040 { 00046 class xid_device_config_t 00047 { 00048 public: 00069 static boost::shared_ptr<xid_device_config_t> config_for_device( 00070 int product_id, int model_id, const std::wstring &devconfig_location); 00071 00072 ~xid_device_config_t(void); 00073 00080 int get_mapped_key(int key) const; 00081 00085 int number_of_lines() const; 00086 00090 bool needs_interbyte_delay() const; 00091 00095 char digital_out_prefix() const; 00096 00097 private: 00098 xid_device_config_t(const std::wstring &devconfig_location); 00099 void load_devconfig(int product_id, int model_id); 00100 00101 std::wstring config_file_location_; 00102 bool needs_interbyte_delay_; 00103 int number_of_lines_; 00104 char digital_out_prefix_; 00105 00106 std::map<int,int> key_map_; 00107 }; 00108 } // namespace cedrus 00109 00110 #endif // XID_DEVICE_CONFIG_T