2 #include <QtCore/QStringList>
4 #include <CoreServices/CoreServices.h>
5 #include <IOKit/storage/IOCDMedia.h>
6 #include <IOKit/storage/IODVDMedia.h>
12 QString disk_name = DADiskGetBSDName(disk);
22 QString disk_name = DADiskGetBSDName(disk);
44 DAUnregisterCallback(mSession, (
void*)
onDiskAppear,
this);
56 mSession = DASessionCreate(kCFAllocatorDefault);
58 DARegisterDiskAppearedCallback(mSession,
nullptr,
onDiskAppear,
this);
59 DARegisterDiskDisappearedCallback(mSession,
nullptr,
onDiskDisappear,
this);
62 void QDeviceWatcherPrivate::run()
66 DASessionScheduleWithRunLoop(mSession, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
69 result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1,
true);
70 }
while (!mStop && result);
72 DASessionUnscheduleFromRunLoop(mSession, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
#define TTKStaticCast(x, y)
static void onDiskDisappear(DADiskRef disk, void *context)
void emitDeviceAdded(const QString &dev)
static QStringList sDevices
static void onDiskAppear(DADiskRef disk, void *context)
void emitDeviceRemoved(const QString &dev)
The class of the device watcher private.