aboutsummaryrefslogtreecommitdiff
path: root/src/UdpTasks/BeaconServer/udplisten.cpp
blob: da09a74737532a45fe087f2a4c2d8c1f2b10aba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "beaconserver.h"

bool BeaconServer::listen()
{
    // connect socket, timer with events
    connect(&_udpSocket, &QUdpSocket::readyRead, this, &BeaconServer::onUdpRead);
    connect(&_sweepTimer, &QTimer::timeout, this, &BeaconServer::onUdpTimedOut);

    // bind socket and timeout
    _udpSocket.bind(QHostAddress::Any, _coreObject->Settings.BeaconServerSettings.beaconPort);
    _sweepTimer.start( _timeOutTime_ms );

    // complete startup
    _coreObject->Log.logEvent("info", QStringLiteral("start listening for UDP beacons on port %1")
                            .arg(_coreObject->Settings.BeaconServerSettings.beaconPort));

    return true;
}