MythTV  master
mediamonitor-unix.h
Go to the documentation of this file.
1 #ifndef MYTH_MEDIA_MONITOR_UNIX_H
2 #define MYTH_MEDIA_MONITOR_UNIX_H
3 
4 #define DEFAULT_DVD "/dev/dvd"
5 #define DEFAULT_CD "/dev/cdrom"
6 
7 #include "config.h"
8 
9 #include <QString>
10 #if CONFIG_QTDBUS
11 #include <QtDBus>
12 #endif
13 
14 #include "mythmediamonitor.h"
15 
17 {
18 #if CONFIG_QTDBUS
19  Q_OBJECT
20  public slots:
21  Q_NOREPLY void deviceAdded(const QDBusObjectPath& o);
22  Q_NOREPLY void deviceRemoved(const QDBusObjectPath& o);
23 #endif
24 
25  public:
26  MediaMonitorUnix(QObject *par, unsigned long interval, bool allowEject);
27 #if !CONFIG_QTDBUS
28  void deleteLater(void) override; // MediaMonitor
29 #endif
30 
31  protected:
32  ~MediaMonitorUnix() override = default;
33 
34 #if !CONFIG_QTDBUS
35  void CheckDeviceNotifications(void) override; // MediaMonitor
36 #endif
37  bool CheckFileSystemTable(void);
38  bool CheckMountable(void);
39 #if !CONFIG_QTDBUS
40  bool CheckRemovable(const QString &dev);
41  bool FindPartitions(const QString &dev, bool checkPartitions);
42 #endif
43 
44  bool AddDevice(MythMediaDevice* pDevice) override; // MediaMonitor
45  bool AddDevice(struct fstab* mep);
46 
47 #if !CONFIG_QTDBUS
48  QString GetDeviceFile(const QString &sysfs);
49 #endif
50 
51  QStringList GetCDROMBlockDevices(void) override; // MediaMonitor
52 
53  protected:
54  int m_fifo {-1};
55  static const char *kUDEV_FIFO;
56 };
57 
58 #endif // MYTH_MEDIA_MONITOR_H
unsigned int slots[4]
Definition: element.c:38
QString GetDeviceFile(const QString &sysfs)
Returns the device special file associated with the /sys/block node.
~MediaMonitorUnix() override=default
bool AddDevice(MythMediaDevice *pDevice) override
Given a media device, add it to our collection.
bool FindPartitions(const QString &dev, bool checkPartitions)
Creates MythMedia instances for sysfs removable media devices.
void deleteLater(void) override
bool CheckMountable(void)
Search /sys/block for valid removable media devices.
bool CheckRemovable(const QString &dev)
Is /sys/block/dev a removable device?
bool CheckFileSystemTable(void)
void CheckDeviceNotifications(void) override
Checks the named pipe, kUDEV_FIFO, for hotplug events from the udev system.
MediaMonitorUnix(QObject *par, unsigned long interval, bool allowEject)
QStringList GetCDROMBlockDevices(void) override
static const char * kUDEV_FIFO