20
20
* SPDX-License-Identifier: GPL-3.0-or-later
21
21
*****************************************************************************/
22
22
23
- #include " integrationproxy .h"
23
+ #include " integration_threadadapter .h"
24
24
25
25
// FIXME quick and dirty workaround until logging integration is fixed
26
26
static Q_LOGGING_CATEGORY (CLASS_LC, " integration.threadAdapter" );
27
27
28
- IntegrationProxy::IntegrationProxy (Integration& integration, Plugin* plugin)
28
+ IntegrationThreadAdapter::IntegrationThreadAdapter (Integration& integration, Plugin* plugin)
29
29
: // Integration(plugin),
30
30
m_integration(integration) {
31
31
setFriendlyName (integration.friendlyName ());
@@ -36,53 +36,53 @@ IntegrationProxy::IntegrationProxy(Integration& integration, Plugin* plugin)
36
36
// connect signals and slots
37
37
QObject::connect (&m_thread, &QThread::finished, &integration, &QObject::deleteLater);
38
38
39
- QObject::connect (this , &IntegrationProxy ::connectSignal, &integration, &Integration::connect);
40
- QObject::connect (this , &IntegrationProxy ::disconnectSignal, &integration, &Integration::disconnect);
41
- QObject::connect (this , &IntegrationProxy ::enterStandbySignal, &integration, &Integration::enterStandby);
42
- QObject::connect (this , &IntegrationProxy ::leaveStandbySignal, &integration, &Integration::leaveStandby);
43
- QObject::connect (this , &IntegrationProxy ::sendCommandSignal, &integration, &Integration::sendCommand);
39
+ QObject::connect (this , &IntegrationThreadAdapter ::connectSignal, &integration, &Integration::connect);
40
+ QObject::connect (this , &IntegrationThreadAdapter ::disconnectSignal, &integration, &Integration::disconnect);
41
+ QObject::connect (this , &IntegrationThreadAdapter ::enterStandbySignal, &integration, &Integration::enterStandby);
42
+ QObject::connect (this , &IntegrationThreadAdapter ::leaveStandbySignal, &integration, &Integration::leaveStandby);
43
+ QObject::connect (this , &IntegrationThreadAdapter ::sendCommandSignal, &integration, &Integration::sendCommand);
44
44
45
- QObject::connect (&integration, &Integration::stateChanged, this , &IntegrationProxy ::onStateChanged);
45
+ QObject::connect (&integration, &Integration::stateChanged, this , &IntegrationThreadAdapter ::onStateChanged);
46
46
47
47
m_thread.start ();
48
48
}
49
49
50
- IntegrationProxy ::~IntegrationProxy () {
50
+ IntegrationThreadAdapter ::~IntegrationThreadAdapter () {
51
51
if (m_thread.isRunning ()) {
52
52
m_thread.exit ();
53
53
m_thread.wait (5000 );
54
54
}
55
55
}
56
56
57
- void IntegrationProxy ::connect () {
58
- qCDebug (CLASS_LC) << " Proxy connect" ;
57
+ void IntegrationThreadAdapter ::connect () {
58
+ qCDebug (CLASS_LC) << " ThreadAdapter connect" ;
59
59
emit connectSignal ();
60
60
}
61
61
62
- void IntegrationProxy ::disconnect () {
63
- qCDebug (CLASS_LC) << " Proxy disconnect" ;
62
+ void IntegrationThreadAdapter ::disconnect () {
63
+ qCDebug (CLASS_LC) << " ThreadAdapter disconnect" ;
64
64
emit disconnectSignal ();
65
65
}
66
66
67
- void IntegrationProxy ::enterStandby () {
68
- qCDebug (CLASS_LC) << " Proxy enterStandby " ;
67
+ void IntegrationThreadAdapter ::enterStandby () {
68
+ qCDebug (CLASS_LC) << " ThreadAdapter entering standby " ;
69
69
emit enterStandbySignal ();
70
70
}
71
71
72
- void IntegrationProxy ::leaveStandby () {
73
- qCDebug (CLASS_LC) << " Proxy leaveStandby " ;
72
+ void IntegrationThreadAdapter ::leaveStandby () {
73
+ qCDebug (CLASS_LC) << " ThreadAdapter leaving standby " ;
74
74
emit leaveStandbySignal ();
75
75
}
76
76
77
- void IntegrationProxy::sendCommand (const QString& type, const QString& entity_id, int command, const QVariant& param) {
78
- qCDebug (CLASS_LC) << " Proxy sendCommand" << type << entity_id << command << param;
77
+ void IntegrationThreadAdapter::sendCommand (const QString& type, const QString& entity_id, int command,
78
+ const QVariant& param) {
79
+ qCDebug (CLASS_LC) << " ThreadAdapter sendCommand" << type << entity_id << command << param;
79
80
emit sendCommandSignal (type, entity_id, command, param);
80
81
}
81
82
82
- // set the state
83
- void IntegrationProxy::onStateChanged () {
83
+ void IntegrationThreadAdapter::onStateChanged () {
84
84
m_state = m_integration.state ();
85
- // qCDebug(CLASS_LC) << "Proxy state changed" << static_cast<States>(m_state);
85
+ qCDebug (CLASS_LC) << " ThreadAdapter state changed" << static_cast <States>(m_state);
86
86
emit stateChanged ();
87
87
switch (m_state) {
88
88
case CONNECTING:
0 commit comments