summaryrefslogtreecommitdiffstats
path: root/tests/auto/core/ifcodegen/backends/server_qtro/echoservice.cpp
blob: 0473a6f000bf3bcefdf09b2e6d851944247633c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "echoservice.h"
#include <QtIfRemoteObjectsHelper/QIfRemoteObjectsPendingResult>
#include <QTimer>

EchoService::EchoService()
    : m_testCombo(Contact(QStringLiteral("Antti"), 34, true, QVariant()), Echomodule::Friday)
    , m_testId(QStringLiteral("id123"))
{
    setTestEnum(Echomodule::FirstEnumValue);
}

void EchoService::setLastMessage(QString lastMessage)
{
    EchoSimpleSource::setLastMessage(lastMessage);
}

QVariant EchoService::echo(const QString &msg)
{
    emit echoSlotCalled(msg);
    return msg;
}

QVariant EchoService::id()
{
    emit idSlotCalled();
    return m_testId;
}

QVariant EchoService::getCombo()
{
    emit getComboSlotCalled();
    return QVariant::fromValue(m_testCombo);
}

QVariant EchoService::voidSlot()
{
    emit voidSlotCalled();
    return QVariant();
}

QVariant EchoService::voidSlot2(int param)
{
    emit voidSlot2Called(param);
    return QVariant();
}

QVariant EchoService::timer(int interval)
{
    static quint64 counter = 0;
    QIfRemoteObjectsPendingResult pendingResult(counter++, false);
    QTimer::singleShot(interval, this, [this, pendingResult](){
        emit pendingResultAvailable(pendingResult.id(), true, QVariant());
    });
    return QVariant::fromValue(pendingResult);
}

QVariant EchoService::flagMethod(Echomodule::AirflowDirections direction)
{
    emit flagMethodCalled(direction);
    return QVariant::fromValue(direction);
}

QVariant EchoService::enumMethod(Echomodule::TestEnum testEnum)
{
    emit enumMethodCalled(testEnum);
    return QVariant::fromValue(testEnum);
}

#include "moc_echoservice.cpp"