• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xid_device_t.h

Go to the documentation of this file.
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_T_H
00033 #define XID_DEVICE_T_H
00034 
00035 #include <Windows.h>
00036 #include <queue>
00037 #include <string>
00038 #include "port_settings_t.h"
00039 #include "constants.h"
00040 #include <boost/shared_ptr.hpp>
00041 #include "base_device_t.h"
00042 
00043 namespace cedrus
00044 {
00045     class xid_con_t;
00046     class xid_device_config_t;
00047     
00053     struct response
00054     {
00058         int port; 
00059 
00063         int button;
00064 
00068         bool pressed;
00069 
00073         int reaction_time; 
00074         
00078         cedrus::key_state key_state;
00079     };
00080 
00081 
00087     class xid_device_t : public base_device_t
00088     {
00089     public:
00099         xid_device_t(
00100             boost::shared_ptr<xid_con_t> xid_con,
00101             const std::wstring &devconfig_path = L""
00102             );
00103         virtual ~xid_device_t(void);
00104         
00105 
00106 
00113         void poll_for_response();
00114 
00120         std::size_t response_queue_size() const;
00121         
00125         bool has_queued_responses() const;
00126 
00130         void clear_response_queue();
00131 
00135         response get_next_response();
00136 
00142         int get_button_count() const;
00143 
00150         std::wstring input_name_prefix() const;
00151 
00152     private:
00153         void init_response_device();
00154         std::queue<response> response_queue_;
00155 
00156         int button_count_;
00157         std::wstring input_name_prefix_;
00158     };
00159 } // namespace cedrus
00160 
00161 #endif // XID_DEVICE_T_H

Generated on Wed Dec 15 2010 13:17:12 for XID device library by  doxygen 1.7.2