KySdkDisk(3)

πŸ“¦ version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

πŸ’Ύ KySdkDisk β€” the disk-info D-Bus signal girly ✨

okay bestie, welcome to KySdkDisk, a manual page from the Disk Information D-Bus Library section of your friendly neighborhood kysdkdbus.h docs. She's a class, she's a whole vibe, and she's about to tell you literally everything about your disks 🫢


✨ NAME ✨

KySdkDisk β€” the class that generates D-Bus signals for disk information, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <kysdkdbus.h>

that's it. that's the include. one line. iconic πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, the KySdkDisk class is mainly used to generate D-Bus signals for a whole shopping list of disk stuff: the disk list, number of sectors, bytes per sector, capacity, model, serial number, number of sub-partitions, type, and firmware version information. she does it all, fr fr πŸ‘‘

and the family tree? this class inherits from QObject. so she's got Qt blood in her veins πŸ’œ


πŸ‘‘ PUBLIC SLOTS πŸ‘‘

these are the slots, bestie. nine of them. every single one is const, because she's not about to change anything, she's just here to report the tea πŸ“


🌈 QStringList getDiskList () const

Get the list of all disks. the whole roster. the full lineup ✨

Return value:

  • QStringList β€” list of disks, where each string represents the absolute path of a disk. yes, absolute. the full path. no shortcuts.

🌈 unsigned int getDiskSectorSize (const QString diskname) const

Get the number of bytes per sector of the disk. tiny units, big importance πŸ’«

Parameters:

  • diskname β€” specify the disk name, and it 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. how much room she's got πŸ’–

Parameters:

  • diskname β€” specify the disk name, and it 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. who is she. what's her name πŸŽ€

Parameters:

  • diskname β€” specify the disk name, and it 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. her government name, basically πŸ™ˆ

Parameters:

  • diskname β€” specify the disk name, and it 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. yes, partitions can have partitions, it's giving nesting dolls πŸͺ†

Parameters:

  • diskname β€” specify the disk name, and it 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. is she a vibe or is she a vibe 🌸

Parameters:

  • diskname β€” specify the disk name, and it 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. the software inside the hardware, very meta ⭐

Parameters:

  • diskname β€” specify the disk name, and it 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. huge number energy, she's a unsigned long long for a reason πŸ”₯

Parameters:

  • diskname β€” specify the disk name, and it should be an absolute path such as /dev/sda

Return value:

  • unsigned long long β€” number of sectors

πŸ’… EXAMPLE USAGE πŸ’…

here's the moment you've been waiting for, bestie. a whole working main() that just uses the thing:

#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 how she grabs the list, checks it's not empty, then pulls the model and the size off the first disk? clean. simple. ate and left no crumbs 😌✨


🫢 SEE ALSO 🫢

go read those too, iykyk πŸ“š


πŸ’œ AUTHOR πŸ’œ

Generated automatically by Doxygen for kysdkdbus.h from the source code. so like, no human author to thank here, it's just Doxygen doing Doxygen things, and honestly? respect the hustle πŸ€–βœ¨


and that's the whole page, bestie!! version 1.0, dated Wed Sep 20 2023, from the Disk Information D-Bus Library. go forth and query your disks, you absolute main character πŸ‘‘πŸ’–

πŸ“¦ where this page comes from