MediaMonitorUnix Class Reference

#include <mediamonitor-unix.h>

Inheritance diagram for MediaMonitorUnix:
MediaMonitor

List of all members.

Public Slots

Q_NOREPLY void deviceAdded (QDBusObjectPath)
Q_NOREPLY void deviceRemoved (QDBusObjectPath)

Public Member Functions

 MediaMonitorUnix (QObject *par, unsigned long interval, bool allowEject)
virtual void deleteLater (void)

Protected Member Functions

 ~MediaMonitorUnix ()
virtual void CheckDeviceNotifications (void)
 Checks the named pipe, kUDEV_FIFO, for hotplug events from the udev system.
bool CheckFileSystemTable (void)
bool CheckMountable (void)
 Search /sys/block for valid removable media devices.
bool CheckRemovable (const QString &dev)
 Is /sys/block/dev a removable device?
bool FindPartitions (const QString &dev, bool checkPartitions)
 Creates MythMedia instances for sysfs removable media devices.
virtual bool AddDevice (MythMediaDevice *pDevice)
 Given a media device, add it to our collection.
bool AddDevice (struct fstab *mep)
QString GetDeviceFile (const QString &sysfs)
 Returns the device special file associated with the /sys/block node.
virtual QStringList GetCDROMBlockDevices (void)

Protected Attributes

int m_fifo

Static Protected Attributes

static const char * kUDEV_FIFO = "/tmp/mythtv_media"

Detailed Description

Definition at line 16 of file mediamonitor-unix.h.


Constructor & Destructor Documentation

MediaMonitorUnix::MediaMonitorUnix ( QObject *  par,
unsigned long  interval,
bool  allowEject 
)

Definition at line 110 of file mediamonitor-unix.cpp.

MediaMonitorUnix::~MediaMonitorUnix (  )  [inline, protected]

Definition at line 32 of file mediamonitor-unix.h.


Member Function Documentation

void MediaMonitorUnix::deviceAdded ( QDBusObjectPath  o  )  [slot]

Definition at line 709 of file mediamonitor-unix.cpp.

Referenced by CheckMountable().

void MediaMonitorUnix::deviceRemoved ( QDBusObjectPath  o  )  [slot]

Definition at line 732 of file mediamonitor-unix.cpp.

Referenced by CheckMountable().

void MediaMonitorUnix::deleteLater ( void   )  [virtual]

Reimplemented from MediaMonitor.

Definition at line 122 of file mediamonitor-unix.cpp.

void MediaMonitorUnix::CheckDeviceNotifications ( void   )  [protected, virtual]

Checks the named pipe, kUDEV_FIFO, for hotplug events from the udev system.

NOTE: Currently only Linux w/udev 0.71+ provides these events.

Reimplemented from MediaMonitor.

Definition at line 836 of file mediamonitor-unix.cpp.

bool MediaMonitorUnix::CheckFileSystemTable ( void   )  [protected]

Definition at line 136 of file mediamonitor-unix.cpp.

Referenced by MediaMonitorUnix().

bool MediaMonitorUnix::CheckMountable ( void   )  [protected]

Search /sys/block for valid removable media devices.

This function creates MediaDevice instances for valid removable media devices found under the /sys/block filesystem in Linux. CD and DVD devices are created as MythCDROM instances. MythHDD instances will be created for each partition on removable hard disk devices, if they exist. Otherwise a single MythHDD instance will be created for the entire disc.

NOTE: Floppy disks are ignored.

Definition at line 185 of file mediamonitor-unix.cpp.

Referenced by MediaMonitorUnix().

bool MediaMonitorUnix::CheckRemovable ( const QString &  dev  )  [protected]

Is /sys/block/dev a removable device?

Definition at line 288 of file mediamonitor-unix.cpp.

Referenced by CheckDeviceNotifications(), and CheckMountable().

bool MediaMonitorUnix::FindPartitions ( const QString &  dev,
bool  checkPartitions 
) [protected]

Creates MythMedia instances for sysfs removable media devices.

Block devices are represented as directories in sysfs with directories for each partition underneath the parent device directory.

This function recursively calls itself to find all partitions on a block device and creates a MythHDD instance for each partition found. If no partitions are found and the device is a CD or DVD device a MythCDROM instance is created. Otherwise a MythHDD instance is created for the entire block device.

Parameters:
dev path to sysfs block device.
checkPartitions check for partitions on block device.
Returns:
true if MythMedia instances are created.

Definition at line 764 of file mediamonitor-unix.cpp.

Referenced by CheckDeviceNotifications(), and CheckMountable().

bool MediaMonitorUnix::AddDevice ( MythMediaDevice pDevice  )  [protected, virtual]

Given a media device, add it to our collection.

Implements MediaMonitor.

Definition at line 545 of file mediamonitor-unix.cpp.

Referenced by AddDevice(), CheckFileSystemTable(), CheckMountable(), deviceAdded(), and FindPartitions().

bool MediaMonitorUnix::AddDevice ( struct fstab *  mep  )  [protected]

Definition at line 612 of file mediamonitor-unix.cpp.

QString MediaMonitorUnix::GetDeviceFile ( const QString &  sysfs  )  [protected]

Returns the device special file associated with the /sys/block node.

Parameters:
sysfs system filesystem path of removable block device.
Returns:
path to the device special file

Definition at line 322 of file mediamonitor-unix.cpp.

Referenced by FindPartitions().

QStringList MediaMonitorUnix::GetCDROMBlockDevices ( void   )  [protected, virtual]

Implements MediaMonitor.

Definition at line 414 of file mediamonitor-unix.cpp.

Referenced by FindPartitions().


Member Data Documentation

int MediaMonitorUnix::m_fifo [protected]

Definition at line 54 of file mediamonitor-unix.h.

Referenced by CheckDeviceNotifications(), CheckMountable(), and deleteLater().

const char * MediaMonitorUnix::kUDEV_FIFO = "/tmp/mythtv_media" [static, protected]

Definition at line 55 of file mediamonitor-unix.h.

Referenced by CheckMountable(), and deleteLater().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Fri May 25 06:42:07 2012 for MythTV by  doxygen 1.6.3