From c947b11347d89b42f109aae6a2ea36c63632a670 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 10 Feb 2003 00:21:42 +0000 Subject: [PATCH] Implemented {Start,Stop}Watching(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2679 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/storage/DiskDeviceRoster.cpp | 40 +++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/kits/storage/DiskDeviceRoster.cpp b/src/kits/storage/DiskDeviceRoster.cpp index d7c6a17b26..362e042db7 100644 --- a/src/kits/storage/DiskDeviceRoster.cpp +++ b/src/kits/storage/DiskDeviceRoster.cpp @@ -447,7 +447,26 @@ BDiskDeviceRoster::GetPartitionWithID(int32 id, BDiskDevice *device, status_t BDiskDeviceRoster::StartWatching(BMessenger target, uint32 eventMask) { - return B_ERROR; // not implemented + status_t error = B_OK; + // compose request message + BMessage request(B_REG_DEVICE_START_WATCHING); + if (error == B_OK) + error = request.AddMessenger("target", target); + if (error == B_OK) + error = request.AddInt32("events", (int32)eventMask); + // send request + BMessage reply; + if (error == B_OK) + error = fManager.SendMessage(&request, &reply); + // analyze reply + if (error == B_OK) { + // result + status_t result = B_OK; + error = reply.FindInt32("result", &result); + if (error == B_OK) + error = result; + } + return error; } // StopWatching @@ -460,7 +479,24 @@ BDiskDeviceRoster::StartWatching(BMessenger target, uint32 eventMask) status_t BDiskDeviceRoster::StopWatching(BMessenger target) { - return B_ERROR; // not implemented + status_t error = B_OK; + // compose request message + BMessage request(B_REG_DEVICE_STOP_WATCHING); + if (error == B_OK) + error = request.AddMessenger("target", target); + // send request + BMessage reply; + if (error == B_OK) + error = fManager.SendMessage(&request, &reply); + // analyze reply + if (error == B_OK) { + // result + status_t result = B_OK; + error = reply.FindInt32("result", &result); + if (error == B_OK) + error = result; + } + return error; } // _GetObjectWithID