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
MediaMonitorUnix::CheckDeviceNotifications
void CheckDeviceNotifications(void) override
Checks the named pipe, kUDEV_FIFO, for hotplug events from the udev system.
Definition: mediamonitor-unix.cpp:845
MediaMonitorUnix::CheckMountable
bool CheckMountable(void)
Search /sys/block for valid removable media devices.
Definition: mediamonitor-unix.cpp:193
MediaMonitorUnix::CheckRemovable
bool CheckRemovable(const QString &dev)
Is /sys/block/dev a removable device?
Definition: mediamonitor-unix.cpp:299
MediaMonitorUnix::FindPartitions
bool FindPartitions(const QString &dev, bool checkPartitions)
Creates MythMedia instances for sysfs removable media devices.
Definition: mediamonitor-unix.cpp:777
MediaMonitorUnix::deleteLater
void deleteLater(void) override
Definition: mediamonitor-unix.cpp:129
mythmediamonitor.h
slots
unsigned int slots[4]
Definition: element.cpp:38
MediaMonitorUnix::GetCDROMBlockDevices
QStringList GetCDROMBlockDevices(void) override
Definition: mediamonitor-unix.cpp:425
MediaMonitorUnix::CheckFileSystemTable
bool CheckFileSystemTable(void)
Definition: mediamonitor-unix.cpp:143
MediaMonitorUnix::m_fifo
int m_fifo
Definition: mediamonitor-unix.h:54
MediaMonitorUnix::MediaMonitorUnix
MediaMonitorUnix(QObject *par, unsigned long interval, bool allowEject)
Definition: mediamonitor-unix.cpp:117
MediaMonitorUnix::kUDEV_FIFO
static const char * kUDEV_FIFO
Definition: mediamonitor-unix.h:55
MediaMonitor
Definition: mythmediamonitor.h:43
MediaMonitorUnix::AddDevice
bool AddDevice(MythMediaDevice *pDevice) override
Given a media device, add it to our collection.
Definition: mediamonitor-unix.cpp:559
MediaMonitorUnix::~MediaMonitorUnix
~MediaMonitorUnix() override=default
MythMediaDevice
Definition: mythmedia.h:48
MediaMonitorUnix
Definition: mediamonitor-unix.h:16
MediaMonitorUnix::GetDeviceFile
QString GetDeviceFile(const QString &sysfs)
Returns the device special file associated with the /sys/block node.
Definition: mediamonitor-unix.cpp:333