Modbus SEI dev...
This commit is contained in:
@@ -73,7 +73,7 @@ int CModbusSEIMgr::DisconnectFromSlave()
|
||||
|
||||
void CModbusSEIMgr::SocketConnected()
|
||||
{
|
||||
emit ModbusMasterConnected(this);
|
||||
emit ModbusMasterConnected(mModbusTCPSocketHandle->localAddress().toIPv4Address(),mModbusTCPSocketHandle->peerAddress().toIPv4Address());
|
||||
qDebug("Master: Connection established with NetTrac");
|
||||
mConnectionTimer->stop();
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void CModbusSEIMgr::SocketConnected()
|
||||
void CModbusSEIMgr::SocketDisconnected()
|
||||
{
|
||||
ModbusLinkDisconnected();
|
||||
emit ModbusMasterDisconnected(this);
|
||||
emit ModbusMasterDisconnected();
|
||||
mConnectionTimer->start();
|
||||
qDebug("Disconnected from NetTrac");
|
||||
}
|
||||
@@ -100,16 +100,16 @@ void CModbusSEIMgr::ConnectionTimerExpired()
|
||||
ConnectToSlave(mSEIIPAddress,mModbusPort);
|
||||
mConnectionTimeout.restart();
|
||||
}
|
||||
else if(mModbusTCPSocketHandle->state() == QAbstractSocket::ConnectingState)
|
||||
{
|
||||
//Default connection timeout is 1s for sockets. We want this to be shorter.
|
||||
//if connection timeout is reached, disconnect and retry.
|
||||
if(mConnectionTimeout.hasExpired(SEI_CLIENT_CONNECTION_TIMEOUT))
|
||||
{
|
||||
mModbusTCPSocketHandle->disconnectFromHost();
|
||||
qDebug("Connection timeout expired... disconnecting");
|
||||
}
|
||||
}
|
||||
// else if(mModbusTCPSocketHandle->state() == QAbstractSocket::ConnectingState)
|
||||
// {
|
||||
// //Default connection timeout is 1s for sockets. We want this to be shorter.
|
||||
// //if connection timeout is reached, disconnect and retry.
|
||||
// if(mConnectionTimeout.hasExpired(SEI_CLIENT_CONNECTION_TIMEOUT))
|
||||
// {
|
||||
// mModbusTCPSocketHandle->disconnectFromHost();
|
||||
// qDebug("Connection timeout expired... disconnecting");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
int CModbusSEIMgr::SEISettingsChanged(QHostAddress ServerIP, int ModbusPort, int DevID)
|
||||
|
||||
@@ -37,8 +37,8 @@ private:
|
||||
QHostAddress mSEIIPAddress;
|
||||
|
||||
signals:
|
||||
void ModbusMasterConnected(CModbusSEIMgr *);
|
||||
void ModbusMasterDisconnected(CModbusSEIMgr *);
|
||||
void ModbusMasterConnected(qint32 LocalIP, qint32 RemoteIP);
|
||||
void ModbusMasterDisconnected();
|
||||
void ModbusMasterRepositoryUpdated();
|
||||
|
||||
public slots:
|
||||
|
||||
Reference in New Issue
Block a user