xref: /haiku/src/servers/midi/DeviceWatcher.h (revision 50a1d8a4f552dc570af4704f340ab606bc9f7fc5)
1 /*
2  * Copyright 2004-2009, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Matthijs Hollemans
7  *		Jerome Leveque
8  *		Philippe Houdoin
9  */
10 #ifndef DEVICE_WATCHER_H
11 #define DEVICE_WATCHER_H
12 
13 #include <Looper.h>
14 
15 #include "HashMap.h"
16 #include "HashString.h"
17 
18 class BBitmap;
19 class BMidiEndpoint;
20 class DeviceEndpoints;
21 
22 class DeviceWatcher : public BLooper {
23 public:
24 				DeviceWatcher();
25 				~DeviceWatcher();
26 
27 	void		MessageReceived(BMessage* message);
28 
29 	status_t 	Start();
30 	status_t	Stop();
31 
32 private:
33 	static int32 _InitialDevicesScanThread(void* data);
34 	void _ScanDevices(const char* path);
35 	void _AddDevice(const char* path);
36 	void _RemoveDevice(const char* path);
37 	void _SetIcons(BMidiEndpoint* endp);
38 
39 	typedef HashMap<HashString, DeviceEndpoints*> DeviceEndpointsMap;
40 	DeviceEndpointsMap		fDeviceEndpointsMap;
41 
42 	uint8* fVectorIconData;
43 	size_t fVectorIconDataSize;
44 	BBitmap* fLargeIcon;
45 	BBitmap* fMiniIcon;
46 };
47 
48 #endif // DEVICE_WATCHER_H
49