Skip to content

Wake on Lan (WOL) #25

Closed
Closed

Description

@volkansari

I have been user of Rabbit Remote Control and find its features very valuable. To further enhance its utility, I would like to suggest the addition of Wake-on-LAN (WoL) support. This feature would enable users to remotely wake up devices that are powered off or in sleep mode, making the tool even more versatile.

Activity

  1. KangLin commented on Sep 25, 2024

    @KangLin
    Owner

    WOL is supported by the operating system.

    I guess you want to wake up the computer with this program?

    Please describe your thoughts in detail.

  2. volkansari commented on Sep 25, 2024

    @volkansari
    Author

    To integrate this into Rabbit Remote Control, you could add a right-click context menu option labeled WAKE UP for each offline device in the UI. The MAC address of the device should be stored along with the connection information. When the WAKE UP option is selected, the program would call a function like sendWakeOnLanPacket() to wake up the device.

  3. volkansari commented on Sep 25, 2024

    @volkansari
    Author

    for example

    #include <QtNetwork/QUdpSocket>
    #include <QHostAddress>
    #include <QByteArray>
    #include <QNetworkDatagram>
    #include <QDebug>
    
    void sendWakeOnLanPacket(const QString &macAddress)
    {
        // Parse the MAC address
        QStringList macBytes = macAddress.split(":");
        if (macBytes.size() != 6) {
            qDebug() << "Invalid MAC address";
            return;
        }
    
        QByteArray macByteArray;
        foreach (const QString &byte, macBytes) {
            bool ok;
            macByteArray.append(byte.toUInt(&ok, 16));
            if (!ok) {
                qDebug() << "Invalid byte in MAC address";
                return;
            }
        }
    
        // Create the magic packet
        QByteArray magicPacket;
        magicPacket.fill(0xFF, 6);  // Start with 6 bytes of 0xFF
        for (int i = 0; i < 16; ++i) {
            magicPacket.append(macByteArray);  // Repeat MAC address 16 times
        }
    
        // Send the packet via UDP
        QUdpSocket udpSocket;
        QHostAddress broadcastAddress("255.255.255.255");  // Broadcast address
        udpSocket.writeDatagram(magicPacket, broadcastAddress, 9);  // Use port 9
    
        if (udpSocket.waitForBytesWritten(3000)) {
            qDebug() << "Magic packet sent successfully!";
        } else {
            qDebug() << "Failed to send magic packet!";
        }
    }
    
  4. KangLin commented on Sep 25, 2024

    @KangLin
    Owner

    There are two or more implementation methods to see which one is suitable.

    • To integrate connect dialog

    WakeOnLan

    • Make a separate WOL plug-in to manage all the devices that need wake on lan
  5. KangLin commented on Nov 22, 2024

    @KangLin
    Owner

    In the end, I chose the plugin.
    2024_11_22_14_55_38_791

  6. KangLin commented on Nov 22, 2024

    @KangLin
    Owner

    图片

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions