xref: /haiku/headers/os/add-ons/input_server/InputServerDevice.h (revision 95c9effd68127df2dce202d5e254a7c86560010a)
1 /*
2  * Copyright 2008, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _INPUTSERVERDEVICE_H
6 #define _INPUTSERVERDEVICE_H
7 
8 
9 #include <Input.h>
10 #include <SupportDefs.h>
11 
12 
13 // Register your actual devices using this one - you can subclass
14 // this to suit your needs
15 struct input_device_ref {
16 	char*				name;
17 	input_device_type	type;	// see Input.h
18 	void*				cookie;
19 };
20 
21 // BInputServerDevice::Control() codes
22 enum {
23 	// B_KEYBOARD_DEVICE notifications
24 	B_KEY_MAP_CHANGED		= 1,
25 	B_KEY_LOCKS_CHANGED,
26 	B_KEY_REPEAT_DELAY_CHANGED,
27 	B_KEY_REPEAT_RATE_CHANGED,
28 
29 	// B_POINTING_DEVICE notifications
30 	B_MOUSE_TYPE_CHANGED,
31 	B_MOUSE_MAP_CHANGED,
32 	B_MOUSE_SPEED_CHANGED,
33 	B_CLICK_SPEED_CHANGED,
34 	B_MOUSE_ACCELERATION_CHANGED,
35 };
36 
37 namespace BPrivate {
38 	class DeviceAddOn;
39 }
40 
41 class BInputServerDevice {
42 public:
43 						BInputServerDevice();
44 	virtual				~BInputServerDevice();
45 
46 	virtual status_t	InitCheck();
47 	virtual status_t	SystemShuttingDown();
48 
49 	virtual status_t	Start(const char* device, void* cookie);
50 	virtual	status_t	Stop(const char* device, void* cookie);
51 	virtual status_t	Control(const char* device, void* cookie, uint32 code,
52 							BMessage* message);
53 
54 			status_t	RegisterDevices(input_device_ref** devices);
55 			status_t	UnregisterDevices(input_device_ref** devices);
56 
57 			status_t	EnqueueMessage(BMessage* message);
58 
59 			status_t	StartMonitoringDevice(const char* device);
60 			status_t	StopMonitoringDevice(const char* device);
61 			status_t	AddDevices(const char* path);
62 
63 private:
64 	virtual void		_ReservedInputServerDevice1();
65 	virtual void		_ReservedInputServerDevice2();
66 	virtual void		_ReservedInputServerDevice3();
67 	virtual void		_ReservedInputServerDevice4();
68 
69 	BPrivate::DeviceAddOn* fOwner;
70 	uint32				_reserved[4];
71 };
72 
73 #endif	// _INPUTSERVERDEVICE_H
74