File indexing completed on 2024-05-12 04:01:52

0001 /*
0002     SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_IFACES_STORAGEDRIVE_H
0008 #define SOLID_IFACES_STORAGEDRIVE_H
0009 
0010 #include <QDateTime>
0011 
0012 #include <solid/devices/ifaces/block.h>
0013 #include <solid/storagedrive.h>
0014 
0015 namespace Solid
0016 {
0017 namespace Ifaces
0018 {
0019 /**
0020  * This device interface is available on storage devices.
0021  *
0022  * A storage is anything that can contain a set of volumes (card reader,
0023  * hard disk, cdrom drive...). It's a particular kind of block device.
0024  */
0025 class StorageDrive : virtual public Block
0026 {
0027 public:
0028     /**
0029      * Destroys a StorageDrive object.
0030      */
0031     ~StorageDrive() override;
0032 
0033     /**
0034      * Retrieves the type of physical interface this storage device is
0035      * connected to.
0036      *
0037      * @return the bus type
0038      * @see Solid::StorageDrive::Bus
0039      */
0040     virtual Solid::StorageDrive::Bus bus() const = 0;
0041 
0042     /**
0043      * Retrieves the type of this storage drive.
0044      *
0045      * @return the drive type
0046      * @see Solid::StorageDrive::DriveType
0047      */
0048     virtual Solid::StorageDrive::DriveType driveType() const = 0;
0049 
0050     /**
0051      * Indicates if the media contained by this drive can be removed.
0052      *
0053      * For example memory card can be removed from the drive by the user,
0054      * while partitions can't be removed from hard disks.
0055      *
0056      * @return true if media can be removed, false otherwise.
0057      */
0058     virtual bool isRemovable() const = 0;
0059 
0060     /**
0061      * Indicates if this storage device can be plugged or unplugged while
0062      * the computer is running.
0063      *
0064      * @return true if this storage supports hotplug, false otherwise
0065      */
0066     virtual bool isHotpluggable() const = 0;
0067 
0068     /**
0069      * Retrieves this drives size in bytes.
0070      *
0071      * @return the size of this drive
0072      */
0073     virtual qulonglong size() const = 0;
0074 
0075     /**
0076      * Retrieves the time the drive was detected
0077      */
0078     virtual QDateTime timeDetected() const;
0079 
0080     /**
0081      * Retrieves the time media in the drive was detected
0082      */
0083     virtual QDateTime timeMediaDetected() const;
0084 };
0085 }
0086 }
0087 
0088 Q_DECLARE_INTERFACE(Solid::Ifaces::StorageDrive, "org.kde.Solid.Ifaces.StorageDrive/0.1")
0089 
0090 #endif // SOLID_IFACES_STORAGEDRIVE_H