.\" -*- coding: utf-8 -*- .TH KySdkNetCard 3 "Wed Sep 20 2023" "1.0" "KySdk Network Card Library" .ad l .nh .SH NAME KySdkNetCard \- D-Bus signal class for generating network card information .SH SYNOPSIS .nf .B #include .fi .PP Inherits from QObject. .SH DESCRIPTION .PP .B 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. .SH "PUBLIC SLOTS" .PP .B "QStringList getNetCardList () const" .RS .PP Get the list of all network cards. .PP .B Return value: .RS .TP .B QStringList List of network card names .RE .RE .PP .B "QString getNetCardMacAddress (const QString cardName) const" .RS .PP Get the MAC address of the specified network card. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B QString MAC address of the network card .RE .RE .PP .B "QString getNetCardIpAddress (const QString cardName) const" .RS .PP Get the IP address of the specified network card. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B QString IP address of the network card .RE .RE .PP .B "QString getNetCardSubnetMask (const QString cardName) const" .RS .PP Get the subnet mask of the specified network card. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B QString Subnet mask of the network card .RE .RE .PP .B "QString getNetCardGateway (const QString cardName) const" .RS .PP Get the gateway of the specified network card. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B QString Gateway of the network card .RE .RE .PP .B "QStringList getNetCardDnsServers (const QString cardName) const" .RS .PP Get the DNS servers of the specified network card. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B QStringList DNS server addresses list .RE .RE .PP .B "bool isNetCardConnected (const QString cardName) const" .RS .PP Check if the specified network card is connected. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B bool Connection status (true if connected, false otherwise) .RE .RE .PP .B "int getNetCardSpeed (const QString cardName) const" .RS .PP Get the speed of the specified network card. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B int Speed of the network card in Mbps .RE .RE .PP .B "QString getNetCardDuplexMode (const QString cardName) const" .RS .PP Get the duplex mode of the specified network card. .PP .B Parameters: .RS .TP .B cardName Network card name .RE .PP .B Return value: .RS .TP .B QString Duplex mode ("full", "half", or "unknown") .RE .RE .SH "EXAMPLE USAGE" .PP .nf #include #include #include 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; } .fi .SH "NOTES" .PP .IP \(bu 2 IP address, subnet mask, and gateway are returned as string format .IP \(bu 2 DNS servers are returned as a list of string addresses .IP \(bu 2 Speed is returned in Mbps (Megabits per second) .IP \(bu 2 Duplex mode can be "full", "half", or "unknown" .IP \(bu 2 Connection status returns true if the network card is active and connected .SH "SEE ALSO" .BR QObject (3qt5), .BR D-Bus (1), .BR ifconfig (8), .BR ip (8), .BR nmcli (1) .SH AUTHOR Generated automatically by Doxygen for kysdkdbus.h from the source code.