Modbus SEI dev...
This commit is contained in:
parent
32ca136904
commit
9d02b34ad0
@ -61,7 +61,7 @@ MODBUS_CC_ETH_IF=eth2
|
||||
#Adresse modbus de la ZT
|
||||
MODBUS_SEI_DEVID=1
|
||||
#Port Modbus/TCP
|
||||
MODBUS_SEI_PORT=502
|
||||
MODBUS_SEI_PORT=503
|
||||
|
||||
|
||||
#----------------------------------
|
||||
|
||||
Binary file not shown.
@ -63,7 +63,7 @@
|
||||
#define FILESYSTEM_FORCED_SYNC_TIMEOUT (qint64)2400000 //2.4 million milliseconds = 40 minutes
|
||||
#define MAX_ENGINEERING_LOG_FILESIZE (qint32)1000000 //~1Mb
|
||||
#define SEI_CLIENT_RECONNECT_TIMEOUT 200 //ms
|
||||
#define SEI_CLIENT_CONNECTION_TIMEOUT 500 //ms
|
||||
#define SEI_CLIENT_CONNECTION_TIMEOUT 5000 //ms
|
||||
|
||||
#define USE_DAQNAVI_LIB
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ int CSEISettingsPage::SetActualSettings(QHostAddress CCHostAdd)
|
||||
void CSEISettingsPage::ModbusSEIConnected(qint32 LocalIP, qint32 RemoteIP)
|
||||
{
|
||||
mSEIConnectionLED->setPixmap(QPixmap("./Images/green-led-on-md.png").scaled(25,25));
|
||||
mModbusSEIConnectionState->setPlainText(QString("Connection NetTrac: Connectée. \nIP: Local[%1] - HPC[%2]").arg(QHostAddress(LocalIP).toString()).arg(QHostAddress(RemoteIP).toString()));
|
||||
mModbusSEIConnectionState->setPlainText(QString("Connection NetTrac: Connectée. \nIP: Local[%1] - NetTrac[%2]").arg(QHostAddress(LocalIP).toString()).arg(QHostAddress(RemoteIP).toString()));
|
||||
}
|
||||
|
||||
void CSEISettingsPage::ModbusSEIDisconnected()
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -620,6 +620,12 @@ unsigned int CZoneTest::InitZT()
|
||||
}
|
||||
mModbusSEIMgr->StartSEICommunication();
|
||||
|
||||
connect(mModbusSEIMgr,SIGNAL(ModbusMasterConnected(qint32,qint32)),panel.mSEISettingsPage,SLOT(ModbusSEIConnected(qint32,qint32)));
|
||||
connect(mModbusSEIMgr,SIGNAL(ModbusMasterDisconnected()),panel.mSEISettingsPage,SLOT(ModbusSEIDisconnected()));
|
||||
|
||||
panel.mZTMainPage->ModbusSEIDisconnected();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user