Brought the public methods in declaration order.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39735 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-12-05 11:54:38 +00:00
parent 509c3229cd
commit 1f1db8cf7e
2 changed files with 104 additions and 103 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2009, Haiku, Inc. All rights reserved.
* Copyright 2004-2010, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -122,7 +122,8 @@ instantiate_add_on(image_id image, const char* path, const char* type)
AddOnManager::AddOnManager(bool safeMode)
: BLooper("add-on manager"),
:
BLooper("add-on manager"),
fSafeMode(safeMode)
{
}
@ -133,6 +134,55 @@ AddOnManager::~AddOnManager()
}
void
AddOnManager::MessageReceived(BMessage* message)
{
CALLED();
BMessage reply;
status_t status;
ERROR("%s what: %.4s\n", __PRETTY_FUNCTION__, (char*)&message->what);
switch (message->what) {
case IS_FIND_DEVICES:
status = _HandleFindDevices(message, &reply);
break;
case IS_WATCH_DEVICES:
status = _HandleWatchDevices(message, &reply);
break;
case IS_IS_DEVICE_RUNNING:
status = _HandleIsDeviceRunning(message, &reply);
break;
case IS_START_DEVICE:
status = _HandleStartStopDevices(message, &reply);
break;
case IS_STOP_DEVICE:
status = _HandleStartStopDevices(message, &reply);
break;
case IS_CONTROL_DEVICES:
status = _HandleControlDevices(message, &reply);
break;
case SYSTEM_SHUTTING_DOWN:
status = _HandleSystemShuttingDown(message, &reply);
break;
case IS_METHOD_REGISTER:
status = _HandleMethodReplicant(message, &reply);
break;
case B_PATH_MONITOR:
_HandleDeviceMonitor(message);
return;
default:
return;
}
reply.AddInt32("status", status);
message->SendReply(&reply);
}
void
AddOnManager::LoadState()
{
@ -148,6 +198,55 @@ AddOnManager::SaveState()
}
status_t
AddOnManager::StartMonitoringDevice(DeviceAddOn* addOn, const char* device)
{
CALLED();
BString path;
if (device[0] != '/')
path = "/dev/";
path += device;
TRACE("AddOnMonitor::StartMonitoringDevice(%s)\n", path.String());
bool newPath;
status_t status = _AddDevicePath(addOn, path.String(), newPath);
if (status == B_OK && newPath) {
status = BPathMonitor::StartWatching(path.String(), B_ENTRY_CREATED
| B_ENTRY_REMOVED | B_ENTRY_MOVED | B_WATCH_FILES_ONLY
| B_WATCH_RECURSIVELY, this);
if (status != B_OK) {
bool lastPath;
_RemoveDevicePath(addOn, path.String(), lastPath);
}
}
return status;
}
status_t
AddOnManager::StopMonitoringDevice(DeviceAddOn* addOn, const char *device)
{
CALLED();
BString path;
if (device[0] != '/')
path = "/dev/";
path += device;
TRACE("AddOnMonitor::StopMonitoringDevice(%s)\n", path.String());
bool lastPath;
status_t status = _RemoveDevicePath(addOn, path.String(), lastPath);
if (status == B_OK && lastPath)
BPathMonitor::StopWatching(path.String(), this);
return status;
}
// #pragma mark -
@ -656,55 +755,6 @@ AddOnManager::_GetReplicantView(BMessenger target, int32 uid,
}
void
AddOnManager::MessageReceived(BMessage* message)
{
CALLED();
BMessage reply;
status_t status;
ERROR("%s what: %.4s\n", __PRETTY_FUNCTION__, (char*)&message->what);
switch (message->what) {
case IS_FIND_DEVICES:
status = _HandleFindDevices(message, &reply);
break;
case IS_WATCH_DEVICES:
status = _HandleWatchDevices(message, &reply);
break;
case IS_IS_DEVICE_RUNNING:
status = _HandleIsDeviceRunning(message, &reply);
break;
case IS_START_DEVICE:
status = _HandleStartStopDevices(message, &reply);
break;
case IS_STOP_DEVICE:
status = _HandleStartStopDevices(message, &reply);
break;
case IS_CONTROL_DEVICES:
status = _HandleControlDevices(message, &reply);
break;
case SYSTEM_SHUTTING_DOWN:
status = _HandleSystemShuttingDown(message, &reply);
break;
case IS_METHOD_REGISTER:
status = _HandleMethodReplicant(message, &reply);
break;
case B_PATH_MONITOR:
_HandleDeviceMonitor(message);
return;
default:
return;
}
reply.AddInt32("status", status);
message->SendReply(&reply);
}
status_t
AddOnManager::_HandleStartStopDevices(BMessage* message, BMessage* reply)
{
@ -907,52 +957,3 @@ AddOnManager::_RemoveDevicePath(DeviceAddOn* addOn, const char* path,
return B_OK;
}
status_t
AddOnManager::StartMonitoringDevice(DeviceAddOn* addOn, const char* device)
{
CALLED();
BString path;
if (device[0] != '/')
path = "/dev/";
path += device;
TRACE("AddOnMonitor::StartMonitoringDevice(%s)\n", path.String());
bool newPath;
status_t status = _AddDevicePath(addOn, path.String(), newPath);
if (status == B_OK && newPath) {
status = BPathMonitor::StartWatching(path.String(), B_ENTRY_CREATED
| B_ENTRY_REMOVED | B_ENTRY_MOVED | B_WATCH_FILES_ONLY
| B_WATCH_RECURSIVELY, this);
if (status != B_OK) {
bool lastPath;
_RemoveDevicePath(addOn, path.String(), lastPath);
}
}
return status;
}
status_t
AddOnManager::StopMonitoringDevice(DeviceAddOn* addOn, const char *device)
{
CALLED();
BString path;
if (device[0] != '/')
path = "/dev/";
path += device;
TRACE("AddOnMonitor::StopMonitoringDevice(%s)\n", path.String());
bool lastPath;
status_t status = _RemoveDevicePath(addOn, path.String(), lastPath);
if (status == B_OK && lastPath)
BPathMonitor::StopWatching(path.String(), this);
return status;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2008, Haiku, Inc. All rights reserved.
* Copyright 2004-2010, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -30,11 +30,11 @@ public:
AddOnManager(bool safeMode);
~AddOnManager();
virtual void MessageReceived(BMessage* message);
void LoadState();
void SaveState();
void MessageReceived(BMessage* message);
status_t StartMonitoringDevice(DeviceAddOn* addOn,
const char* device);
status_t StopMonitoringDevice(DeviceAddOn* addOn,