haiku/src/servers/input/DeviceManager.h
Jérôme Duval ca75e4d057 Added a looper to handle devices related requests
Before it was deadlocking when an addon asks for a new keymap on a notification message


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9219 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-05 23:33:14 +00:00

55 lines
1.3 KiB
C++

/*
** Copyright 2004, the Haiku project. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Author : Jérôme Duval
** Original authors: Marcus Overhagen, Axel Dörfler
*/
#ifndef _DEVICE_MANAGER_H
#define _DEVICE_MANAGER_H
// Manager for devices monitoring
#include <Handler.h>
#include <Locker.h>
#include <InputServerDevice.h>
#include <InputServerFilter.h>
#include <InputServerMethod.h>
#include "TList.h"
class DeviceManager;
class IAHandler : public BHandler {
public:
IAHandler(DeviceManager * manager);
void MessageReceived(BMessage * msg);
status_t AddDirectory(const node_ref * nref, _BDeviceAddOn_ *addon);
status_t RemoveDirectory(const node_ref * nref, _BDeviceAddOn_ *addon);
private:
DeviceManager * fManager;
};
class DeviceManager : public BLooper {
public:
DeviceManager();
~DeviceManager();
void LoadState();
void SaveState();
status_t StartMonitoringDevice(_BDeviceAddOn_ *addon,
const char *device);
status_t StopMonitoringDevice(_BDeviceAddOn_ *addon,
const char *device);
_BDeviceAddOn_ *GetAddOn(int32 index) {
return (_BDeviceAddOn_*)fDeviceAddons.ItemAt(index);
}
private:
BList fDeviceAddons;
BLocker fLock;
IAHandler *fHandler;
};
#endif // _DEVICE_MANAGER_H