Recognizes all notification messages now.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2713 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -144,11 +144,30 @@ printf("TestApp::MessageReceived(%.4s)\n", (char*)&message->what);
|
|||||||
PartitionUnmounted(message);
|
PartitionUnmounted(message);
|
||||||
break;
|
break;
|
||||||
case B_DEVICE_PARTITION_CHANGED:
|
case B_DEVICE_PARTITION_CHANGED:
|
||||||
|
PartitionChanged(message);
|
||||||
|
break;
|
||||||
case B_DEVICE_PARTITION_ADDED:
|
case B_DEVICE_PARTITION_ADDED:
|
||||||
|
PartitionAdded(message);
|
||||||
|
break;
|
||||||
case B_DEVICE_PARTITION_REMOVED:
|
case B_DEVICE_PARTITION_REMOVED:
|
||||||
|
PartitionRemoved(message);
|
||||||
|
break;
|
||||||
|
case B_DEVICE_SESSION_ADDED:
|
||||||
|
SessionAdded(message);
|
||||||
|
break;
|
||||||
|
case B_DEVICE_SESSION_REMOVED:
|
||||||
|
SessionRemoved(message);
|
||||||
|
break;
|
||||||
case B_DEVICE_MEDIA_CHANGED:
|
case B_DEVICE_MEDIA_CHANGED:
|
||||||
|
MediaChanged(message);
|
||||||
|
break;
|
||||||
case B_DEVICE_ADDED:
|
case B_DEVICE_ADDED:
|
||||||
|
DeviceAdded(message);
|
||||||
|
break;
|
||||||
case B_DEVICE_REMOVED:
|
case B_DEVICE_REMOVED:
|
||||||
|
DeviceRemoved(message);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
printf("unhandled event\n");
|
printf("unhandled event\n");
|
||||||
message->PrintToStream();
|
message->PrintToStream();
|
||||||
break;
|
break;
|
||||||
@@ -191,6 +210,63 @@ printf("TestApp::MessageReceived(%.4s)\n", (char*)&message->what);
|
|||||||
PrintPartitionInfo(message);
|
PrintPartitionInfo(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PartitionChanged
|
||||||
|
void PartitionChanged(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::PartitionUnmounted()\n");
|
||||||
|
PrintPartitionInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PartitionAdded
|
||||||
|
void PartitionAdded(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::PartitionAdded()\n");
|
||||||
|
PrintPartitionInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PartitionRemoved
|
||||||
|
void PartitionRemoved(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::PartitionRemoved()\n");
|
||||||
|
PrintPartitionInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SessionAdded
|
||||||
|
void SessionAdded(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::SessionAdded()\n");
|
||||||
|
PrintSessionInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SessionRemoved
|
||||||
|
void SessionRemoved(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::SessionRemoved()\n");
|
||||||
|
PrintSessionInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// MediaChanged
|
||||||
|
void MediaChanged(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::MediaChanged()\n");
|
||||||
|
PrintDeviceInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeviceAdded
|
||||||
|
void DeviceAdded(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::DeviceAdded()\n");
|
||||||
|
PrintDeviceInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeviceRemoved
|
||||||
|
void DeviceRemoved(BMessage *message)
|
||||||
|
{
|
||||||
|
printf("TestApp::DeviceRemoved()\n");
|
||||||
|
PrintDeviceInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrintPartitionInfo
|
||||||
void PrintPartitionInfo(BMessage *message)
|
void PrintPartitionInfo(BMessage *message)
|
||||||
{
|
{
|
||||||
int32 deviceID;
|
int32 deviceID;
|
||||||
@@ -209,6 +285,35 @@ printf("TestApp::MessageReceived(%.4s)\n", (char*)&message->what);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrintSessionInfo
|
||||||
|
void PrintSessionInfo(BMessage *message)
|
||||||
|
{
|
||||||
|
int32 deviceID;
|
||||||
|
int32 sessionID;
|
||||||
|
if (message->FindInt32("device_id", &deviceID) == B_OK
|
||||||
|
&& message->FindInt32("session_id", &sessionID) == B_OK) {
|
||||||
|
BDiskDeviceRoster roster;
|
||||||
|
BDiskDevice device;
|
||||||
|
BSession *session;
|
||||||
|
if (roster.GetSessionWithID(sessionID, &device, &session)
|
||||||
|
== B_OK) {
|
||||||
|
DumpVisitor().Visit(session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrintDeviceInfo
|
||||||
|
void PrintDeviceInfo(BMessage *message)
|
||||||
|
{
|
||||||
|
int32 deviceID;
|
||||||
|
if (message->FindInt32("device_id", &deviceID) == B_OK) {
|
||||||
|
BDiskDeviceRoster roster;
|
||||||
|
BDiskDevice device;
|
||||||
|
if (roster.GetDeviceWithID(deviceID, &device) == B_OK)
|
||||||
|
DumpVisitor().Visit(&device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// main
|
// main
|
||||||
|
|||||||
Reference in New Issue
Block a user