KySdkNetCard(3)

NAME
KySdkNetCard - D-Bus signal class for generating network card information

SYNOPSIS
#include <kysdkdbus.h>

Inherits from QObject.

DESCRIPTION

KySdkNetCard class is mainly used to generate D-Bus signals for network card information, including getting network card list, MAC address, IP address, subnet mask, gateway, DNS servers, connection status, speed, duplex mode, and other network interface information.

PUBLIC SLOTS

QStringList getNetCardList () const

    Get the list of all network cards.

    Return value:

        QStringList
            List of network card names

QString getNetCardMacAddress (const QString cardName) const

    Get the MAC address of the specified network card.

    Parameters:

        cardName
            Network card name

    Return value:

        QString
            MAC address of the network card

QString getNetCardIpAddress (const QString cardName) const

    Get the IP address of the specified network card.

    Parameters:

        cardName
            Network card name

    Return value:

        QString
            IP address of the network card

QString getNetCardSubnetMask (const QString cardName) const

    Get the subnet mask of the specified network card.

    Parameters:

        cardName
            Network card name

    Return value:

        QString
            Subnet mask of the network card

QString getNetCardGateway (const QString cardName) const

    Get the gateway of the specified network card.

    Parameters:

        cardName
            Network card name

    Return value:

        QString
            Gateway of the network card

QStringList getNetCardDnsServers (const QString cardName) const

    Get the DNS servers of the specified network card.

    Parameters:

        cardName
            Network card name

    Return value:

        QStringList
            DNS server addresses list

bool isNetCardConnected (const QString cardName) const

    Check if the specified network card is connected.

    Parameters:

        cardName
            Network card name

    Return value:

        bool
            Connection status (true if connected, false otherwise)

int getNetCardSpeed (const QString cardName) const

    Get the speed of the specified network card.

    Parameters:

        cardName
            Network card name

    Return value:

        int Speed of the network card in Mbps

QString getNetCardDuplexMode (const QString cardName) const

    Get the duplex mode of the specified network card.

    Parameters:

        cardName
            Network card name

    Return value:

        QString
            Duplex mode ("full", "half", or "unknown")

EXAMPLE USAGE

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

    KySdkNetCard netCardInfo;

    // Get network card list
    QStringList netCards = netCardInfo.getNetCardList();
    qDebug() << "Network cards:" << netCards;

    // Get information of the first network card
    if (!netCards.isEmpty()) {
        QString cardName = netCards.first();

        QString macAddr = netCardInfo.getNetCardMacAddress(cardName);
        QString ipAddr = netCardInfo.getNetCardIpAddress(cardName);
        QString subnetMask = netCardInfo.getNetCardSubnetMask(cardName);
        QString gateway = netCardInfo.getNetCardGateway(cardName);
        QStringList dnsServers = netCardInfo.getNetCardDnsServers(cardName);
        bool isConnected = netCardInfo.isNetCardConnected(cardName);
        int speed = netCardInfo.getNetCardSpeed(cardName);
        QString duplexMode = netCardInfo.getNetCardDuplexMode(cardName);

        qDebug() << "Network card:" << cardName;
        qDebug() << "  MAC Address:" << macAddr;
        qDebug() << "  IP Address:" << ipAddr;
        qDebug() << "  Subnet Mask:" << subnetMask;
        qDebug() << "  Gateway:" << gateway;
        qDebug() << "  DNS Servers:" << dnsServers;
        qDebug() << "  Connected:" << isConnected;
        qDebug() << "  Speed:" << speed << "Mbps";
        qDebug() << "  Duplex Mode:" << duplexMode;
    }

    return 0;
}

NOTES

•   IP address, subnet mask, and gateway are returned as string format

•   DNS servers are returned as a list of string addresses

•   Speed is returned in Mbps (Megabits per second)

•   Duplex mode can be "full", "half", or "unknown"

•   Connection status returns true if the network card is active and connected

SEE ALSO
QObject(3qt5), D-Bus(1), ifconfig(8), ip(8), nmcli(1)

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