xref: /haiku/src/add-ons/input_server/devices/tablet/TabletInputDevice.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*****************************************************************************/
2 // Tablet input server device addon
3 // Adapted by Jerome Duval, written by Stefano Ceccherini
4 //
5 // TabletInputDevice.h
6 //
7 // Copyright (c) 2005 Haiku Project
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a
10 // copy of this software and associated documentation files (the "Software"),
11 // to deal in the Software without restriction, including without limitation
12 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 // and/or sell copies of the Software, and to permit persons to whom the
14 // Software is furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included
17 // in all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
26 /*****************************************************************************/
27 #ifndef __TABLETINPUTDEVICE_H
28 #define __TABLETINPUTDEVICE_H
29 
30 #include <InputServerDevice.h>
31 #include <InterfaceDefs.h>
32 #include <List.h>
33 #include <stdio.h>
34 
35 #define DEBUG 1
36 
37 class TabletInputDevice : public BInputServerDevice {
38 public:
39 	TabletInputDevice();
40 	~TabletInputDevice();
41 
42 	virtual status_t InitCheck();
43 
44 	virtual status_t Start(const char *name, void *cookie);
45 	virtual status_t Stop(const char *name, void *cookie);
46 
47 	virtual status_t Control(const char *name, void *cookie,
48 							 uint32 command, BMessage *message);
49 private:
50 	status_t HandleMonitor(BMessage *message);
51 	status_t InitFromSettings(void *cookie, uint32 opcode = 0);
52 	void RecursiveScan(const char *directory);
53 
54 	status_t AddDevice(const char *path);
55 	status_t RemoveDevice(const char *path);
56 
57 	static int32 DeviceWatcher(void *arg);
58 
59 	BList fDevices;
60 #ifdef DEBUG
61 public:
62 	static FILE *sLogFile;
63 #endif
64 };
65 
66 extern "C" BInputServerDevice *instantiate_input_device();
67 
68 #endif
69 
70