3#include "WakeOnLanQt.h"
5#include <QLoggingCategory>
8static Q_LOGGING_CATEGORY(log,
"WOL")
10 : QObject(parent),
CWakeOnLan(szBroadcastAddress.toStdString())
13void CWakeOnLanQt::SetBroadcastAddress(
const QString &szBroadcastAddress)
15 CWakeOnLan::SetBroadcastAddress(szBroadcastAddress.toStdString());
18QString CWakeOnLanQt::SetBroadcastAddress(
19 const QString &szIP,
const QString &szMask)
21 return CWakeOnLan::SetBroadcastAddress(
22 szIP.toStdString(), szMask.toStdString()).c_str();
30 const QString &szPassword,
32 if(szPassword.length() < 6) {
33 qCritical(log) <<
"The password must be 6. current length:"
34 << szPassword.length();
38 if(szPassword.length() == 6) {
39 QByteArray data = szPassword.toLocal8Bit().toHex(
':');
41 data.data(), portNum);
45 szPassword.toStdString(), portNum);
48int CWakeOnLanQt::SendPacket(
const char *data, int64_t size,
49 std::string addr, uint16_t port)
53 int nRet = udpSocket.writeDatagram(data, size,
54 QHostAddress(addr.c_str()), port);
bool SendMagicPacket(const QString &szMac, uint16_t portNum=9)
SendMagicPacket.
bool SendSecureMagicPacket(const QString &szMac, const QString &szPassword, uint16_t portNum=9)
SendSecureMagicPacket.
bool SendSecureMagicPacket(const std::string &szMac, const std::string szPassword, uint16_t portNum=9)
SendSecureMagicPacket.
bool SendMagicPacket(const std::string &szMac, uint16_t portNum=9)
SendMagicPacket.