14#include <glibmm/dispatcher.h>
15#include <sigc++/sigc++.h>
16#include <udisks2cc/manager.h>
42 const char*
what()
const throw() {
43 return "No drive is present";
Abstracts the host's disc drive.
The Poller uses a separate thread to poll the host for the presence of an audio CD.
Poller(DriveManager &manager)
Poller constructor.
~Poller()
Poller destructor.
bool _exit
Stores a request to exist poll().
DriveManager & _manager
The parent DriveManager.
void poll()
The execution loop performed by the thread.
std::mutex _exit_lock
Provides mutually exclusive access to the _exit member between the the application thread and the Pol...
std::thread _thread
The thread used to run poll().
sigc::signal< void(Drive)> sig_drive
"Inserted" and "Ejected" shared signal type.
void on_removable_added(const std::string &path)
Called when a new filesystem appears.
Drive
The two drives supported.
sig_drive signal_inserted()
Getter for ::_signal_inserted.
~DriveManager()
DriveManager destructor.
sig_drive _sig_inserted
Emitted when a drive is inserted.
std::regex _acceptable_fs_pat
Filters the filesystems reported by UDisks2 to acceptable ones.
void on_cddrive_eject()
Called when the disc drive successfully ejects.
bool is_disc_present() const
Returns the (cached) property of disc presence.
void on_removable_removed(const std::string &path)
Called when a filesystem is removed.
Glib::Dispatcher _dispatcher
Used to samely emit _sig_inserted for the disc drive.
sig_drive _sig_ejected
Emitted when a drive is removed.
Poller * _poller
When running, checks for the presence of a disc in _drive.
void on_udisks2_init()
Called when UDisks2 initializes the list of preregisterd drives and filesystems.
DriveManager()
DriveManager constructor.
CDDrive & disc_drive()
Returns the CDDrive associated with the disc drive.
bool is_removable_present() const
Returns the (cached) property of iPod presence.
UDisks2::Filesystem * _removable_fs
The filesystem associated with the iPod.
void eject(const Drive drive)
Eject one of the drives.
UDisks2::Manager _udisks2
UDisks2 provides access to removable disks.
CDDrive _drive
The disc drive.
sig_drive signal_ejected()
Getter for ::_signal_ejected.
void on_removable_mounted(const std::string &)
Called when the removable drive is mounted.
void on_notification_from_poller()
Called when _dispatcher is notified.
void on_removable_unmounted()
Called when the removable drive is unmounted.
UDisks2::Filesystem & removable()
Returns the UDisks2::Filesystem cassociated with the iPod.
Thrown when the assumption of the presence of a drive is false.
const char * what() const