1 /*
2  * InputDeviceApp.h
3  *
4  * Copyright (C) 2003 J. "MUFTI" Scheurich
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #pragma once
23 
24 #include <string.h>
25 
26 #include "Array.h"
27 #include "TransformMode.h"
28 
29 class InputDevice;
30 #ifdef HAVE_AFLOCK
31 class AflockDevice;
32 #endif
33 
34 class InputDeviceApp {
35 public:
36 
InputDeviceApp()37                         InputDeviceApp()
38                            {
39                            m_dontCareFocus = false;
40                            m_maxNumberAxes=0;
41                            }
42 
43 
dontCareFocus(void)44     bool                dontCareFocus(void) { return m_dontCareFocus; }
setDontCareFocus(void)45     void                setDontCareFocus(void) { m_dontCareFocus = true; }
46 
47     InputDevice*        getInputDevice(int i);
getNumberInputDevices(void)48     int                 getNumberInputDevices(void)
49                            { return m_inputDevices.size(); }
50     int                 setInputDevice(InputDevice* inputdevice);
getMaxNumberAxesInputDevices(void)51     int                 getMaxNumberAxesInputDevices(void)
52                            { return m_maxNumberAxes; }
53     void                accoutMaxNumberAxesInputDevices(void);
54 
55                         // sort inputdevices, so inputdevices with a readdelay
56                         // can prepare the read, while other inputdevices
57                         // can use the time to read data
58     void                sortInputDevices(void);
59 
60     bool                hasInputDevices(void);
61     bool                has2AxesInputDevices(void);
62     bool                has3AxesInputDevices(void);
63     int                 searchInputDevice(const char *option,
64                                          const char *deviceName);
65     int                 replaceOrAddInputDevice(InputDevice* newDevice,
66                                                 const char *option,
67                                                 const char *deviceName);
68     void                setInputDeviceSetting(InputDevice *device,
69                                               const char *setting);
70     void                deleteInputDevice(InputDevice* device);
71 
72 
73 #ifdef HAVE_AFLOCK
74     AflockDevice*       getAflockDevice(int i);
getNumberAflockDevices(void)75     int                 getNumberAflockDevices(void)
76                            {return m_aflockDevices.size();}
77     int                 setAflockDevice(AflockDevice* aflockDevice);
78     int                 searchAflockDevice(const char *deviceName);
79     int                 replaceOrAddAflockDevice(AflockDevice* newDevice,
80                                                  const char *deviceName);
81     void                deleteAflockDevice(AflockDevice* device);
82     bool                returnTracker(void);
83 
84     void                stopTrackers(void);
85     void                restartTrackers(void);
86 #else
returnTracker(void)87     bool                returnTracker(void) { return false; }
88 #endif
89     void                calibrateInputDevices(void);
90 
91     void                increaseInputDevice(TransformMode* tm);
92     void                decreaseInputDevice(TransformMode* tm);
93 
94     void                InputDeviceLoadPreferences();
95     void                InputDeviceSavePreferences();
96 
97 
98 private:
99     bool                m_dontCareFocus;
100     int                 m_maxNumberAxes;
101     MyArray<InputDevice*> m_inputDevices;
102 #ifdef HAVE_AFLOCK
103     MyArray<AflockDevice*>m_aflockDevices;
104 #endif
105 };
106 
107 
108