fixed connect overloading
This commit is contained in:
parent
8d60bbb719
commit
ab62972540
@ -43,7 +43,7 @@ AvrConnection::~AvrConnection()
|
|||||||
m_socket->close();
|
m_socket->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvrConnection::connect()
|
void AvrConnection::connectDevice()
|
||||||
{
|
{
|
||||||
if (m_socket->state() == QAbstractSocket::ConnectingState) {
|
if (m_socket->state() == QAbstractSocket::ConnectingState) {
|
||||||
return;
|
return;
|
||||||
@ -51,7 +51,7 @@ void AvrConnection::connect()
|
|||||||
m_socket->connectToHost(m_hostAddress, m_port);
|
m_socket->connectToHost(m_hostAddress, m_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvrConnection::disconnect()
|
void AvrConnection::disconnectDevice()
|
||||||
{
|
{
|
||||||
m_socket->close();
|
m_socket->close();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,8 +35,8 @@ public:
|
|||||||
explicit AvrConnection(const QHostAddress &hostAddress, const int &port = 23, QObject *parent = nullptr);
|
explicit AvrConnection(const QHostAddress &hostAddress, const int &port = 23, QObject *parent = nullptr);
|
||||||
~AvrConnection();
|
~AvrConnection();
|
||||||
|
|
||||||
void connect();
|
void connectDevice();
|
||||||
void disconnect();
|
void disconnectDevice();
|
||||||
|
|
||||||
QHostAddress hostAddress() const;
|
QHostAddress hostAddress() const;
|
||||||
int port() const;
|
int port() const;
|
||||||
|
|||||||
@ -111,7 +111,7 @@ Device::DeviceSetupStatus DevicePluginDenon::setupDevice(Device *device)
|
|||||||
connect(denonConnection, &AvrConnection::muteChanged, this, &DevicePluginDenon::onAvrMuteChanged);
|
connect(denonConnection, &AvrConnection::muteChanged, this, &DevicePluginDenon::onAvrMuteChanged);
|
||||||
|
|
||||||
m_asyncSetups.append(denonConnection);
|
m_asyncSetups.append(denonConnection);
|
||||||
denonConnection->connect();
|
denonConnection->connectDevice();
|
||||||
m_avrConnections.insert(device, denonConnection);
|
m_avrConnections.insert(device, denonConnection);
|
||||||
return Device::DeviceSetupStatusAsync;
|
return Device::DeviceSetupStatusAsync;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ void DevicePluginDenon::deviceRemoved(Device *device)
|
|||||||
if (device->deviceClassId() == AVRX1000DeviceClassId) {
|
if (device->deviceClassId() == AVRX1000DeviceClassId) {
|
||||||
AvrConnection *denonConnection = m_avrConnections.value(device);
|
AvrConnection *denonConnection = m_avrConnections.value(device);
|
||||||
m_avrConnections.remove(device);
|
m_avrConnections.remove(device);
|
||||||
denonConnection->disconnect();
|
denonConnection->disconnectDevice();
|
||||||
denonConnection->deleteLater();
|
denonConnection->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ void DevicePluginDenon::deviceRemoved(Device *device)
|
|||||||
if (m_avrConnections.contains(device)) {
|
if (m_avrConnections.contains(device)) {
|
||||||
AvrConnection *denonConnection = m_avrConnections.value(device);
|
AvrConnection *denonConnection = m_avrConnections.value(device);
|
||||||
m_avrConnections.remove(device);
|
m_avrConnections.remove(device);
|
||||||
denonConnection->disconnect();
|
denonConnection->disconnectDevice();
|
||||||
denonConnection->deleteLater();
|
denonConnection->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ void DevicePluginDenon::onPluginTimer()
|
|||||||
{
|
{
|
||||||
foreach(AvrConnection *denonConnection, m_avrConnections.values()) {
|
foreach(AvrConnection *denonConnection, m_avrConnections.values()) {
|
||||||
if (!denonConnection->connected()) {
|
if (!denonConnection->connected()) {
|
||||||
denonConnection->connect();
|
denonConnection->connectDevice();
|
||||||
}
|
}
|
||||||
Device *device = m_avrConnections.key(denonConnection);
|
Device *device = m_avrConnections.key(denonConnection);
|
||||||
if (device->deviceClassId() == AVRX1000DeviceClassId) {
|
if (device->deviceClassId() == AVRX1000DeviceClassId) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user