KySdkDisk(3)

KySdkDisk.3

NAME
KySdkDisk - Class for generating D-Bus signals for disk information

SYNOPSIS
#include <kysdkdbus.h>

DESCRIPTION

The KySdkDisk class is mainly used to generate D-Bus signals for disk list, number of sectors, bytes per sector, capacity, model, serial number, number of sub-partitions, type, and firmware version information.

This class inherits from QObject.

PUBLIC SLOTS

QStringList getDiskList () const

    Get the list of all disks.

    Return value:

        QStringList
            List of disks, each string represents the absolute path of a disk

unsigned int getDiskSectorSize (const QString diskname) const

    Get the number of bytes per sector of the disk.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        unsigned int
            Number of bytes per sector

double getDiskTotalSizeMiB (const QString diskname) const

    Get the disk capacity.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        double
            Disk capacity in MiB

QString getDiskModel (const QString diskname) const

    Get the disk model.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        QString
            Disk model

QString getDiskSerial (const QString diskname) const

    Get the disk serial number.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        QString
            Disk serial number

unsigned int getDiskPartitionNums (const QString diskname) const

    Get the number of sub-partitions under the disk/partition.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        unsigned int
            Number of sub-partitions under this disk/partition

QString getDiskType (const QString diskname) const

    Get the disk type.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        QString
            Disk type, SSD or HDD or Hybrid

QString getDiskVersion (const QString diskname) const

    Get the disk firmware version information.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        QString
            Firmware version information

unsigned long long getDiskSectorNum (const QString diskname) const

    Get the number of disk sectors.

    Parameters:

        diskname
            Specify the disk name, should be an absolute path such as /dev/sda

    Return value:

        unsigned long long
            Number of sectors

EXAMPLE USAGE

#include <kysdkdbus.h>
#include <QCoreApplication>
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    KySdkDisk diskInfo;

    // Get disk list
    QStringList disks = diskInfo.getDiskList();

    // Get information of the first disk
    if (!disks.isEmpty()) {
        QString diskName = disks.first();
        QString model = diskInfo.getDiskModel(diskName);
        double size = diskInfo.getDiskTotalSizeMiB(diskName);
        // ... use other methods
    }

    return 0;
}

SEE ALSO
QObject(3qt5), D-Bus(1), libkyfilewatcher(3)

AUTHOR
Generated automatically by Doxygen for kysdkdbus.h from the source code.