xref: /haiku/src/add-ons/input_server/devices/wacom/PointingDeviceFactory.cpp (revision dc1bdabb92cf7b72403fc3f2a8eb9ef75d4926f2)
1 /*
2  * Copyright 2005-2008 Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  */
5 #include "PointingDeviceFactory.h"
6 
7 #include "DeviceReader.h"
8 #include "TabletDevice.h"
9 
10 
11 static const uint16 kVendorWacom = 0x056a;
12 
13 
14 /*static*/ PointingDevice*
DeviceFor(MasterServerDevice * parent,const char * path)15 PointingDeviceFactory::DeviceFor(MasterServerDevice* parent, const char* path)
16 {
17 	PointingDevice* device = NULL;
18 	DeviceReader* reader = new DeviceReader();
19 	if (reader->SetTo(path) >= B_OK) {
20 		switch (reader->VendorID()) {
21 			case kVendorWacom:
22 				device = new TabletDevice(parent, reader);
23 				break;
24 			default:
25 				delete reader;
26 				break;
27 		}
28 	} else {
29 		delete reader;
30 	}
31 	return device;
32 }
33 
34 // forbidden:
PointingDeviceFactory()35 PointingDeviceFactory::PointingDeviceFactory() {}
~PointingDeviceFactory()36 PointingDeviceFactory::~PointingDeviceFactory() {}
37 
38 
39