xref: /haiku/src/servers/input/InputServerDevice.cpp (revision 8195a5a835117ab2da405e0d477153570b75d921)
1 /*
2  * Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "InputServer.h"
8 
9 #include <InputServerDevice.h>
10 
11 #include <new>
12 
13 BInputServerDevice::BInputServerDevice()
14 {
15 	fOwner = new (std::nothrow) _BDeviceAddOn_(this);
16 }
17 
18 
19 BInputServerDevice::~BInputServerDevice()
20 {
21 	CALLED();
22 
23 	gInputServer->UnregisterDevices(*this);
24 	delete fOwner;
25 }
26 
27 
28 status_t
29 BInputServerDevice::InitCheck()
30 {
31 	if (fOwner == NULL)
32 		return B_NO_MEMORY;
33 	return B_OK;
34 }
35 
36 
37 status_t
38 BInputServerDevice::SystemShuttingDown()
39 {
40 	return B_OK;
41 }
42 
43 
44 status_t
45 BInputServerDevice::Start(const char* device, void* cookie)
46 {
47 	return B_OK;
48 }
49 
50 
51 status_t
52 BInputServerDevice::Stop(const char* device, void* cookie)
53 {
54 	return B_OK;
55 }
56 
57 
58 status_t
59 BInputServerDevice::Control(const char* device, void* cookie,
60 	uint32 code, BMessage* message)
61 {
62 	return B_OK;
63 }
64 
65 
66 status_t
67 BInputServerDevice::RegisterDevices(input_device_ref** devices)
68 {
69 	CALLED();
70 	return gInputServer->RegisterDevices(*this, devices);
71 }
72 
73 
74 status_t
75 BInputServerDevice::UnregisterDevices(input_device_ref** devices)
76 {
77     CALLED();
78     // TODO: is this function supposed to remove devices that do not belong to this object?
79     //	(at least that's what the previous implementation allowed for)
80 	return gInputServer->UnregisterDevices(*this, devices);
81 }
82 
83 
84 status_t
85 BInputServerDevice::EnqueueMessage(BMessage* message)
86 {
87 	return gInputServer->EnqueueDeviceMessage(message);
88 }
89 
90 
91 status_t
92 BInputServerDevice::StartMonitoringDevice(const char* device)
93 {
94 	CALLED();
95 	PRINT(("StartMonitoringDevice %s\n", device));
96 
97 	return InputServer::gDeviceManager.StartMonitoringDevice(fOwner, device);
98 }
99 
100 
101 status_t
102 BInputServerDevice::StopMonitoringDevice(const char* device)
103 {
104 	CALLED();
105 	return InputServer::gDeviceManager.StopMonitoringDevice(fOwner, device);
106 }
107 
108 
109 void BInputServerDevice::_ReservedInputServerDevice1() {}
110 void BInputServerDevice::_ReservedInputServerDevice2() {}
111 void BInputServerDevice::_ReservedInputServerDevice3() {}
112 void BInputServerDevice::_ReservedInputServerDevice4() {}
113 
114