Interface chalet LTE fonctionnelle

This commit is contained in:
jfmartel 2025-01-02 09:04:49 -05:00
parent 3fb8de2ea7
commit bf31303763
16 changed files with 97 additions and 50 deletions

Binary file not shown.

View File

@ -8,7 +8,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
HEADERS += \ HEADERS += \
Sources/Chalet/ChaletData.h \ Sources/Chalet/ChaletData.h \
Sources/Chalet/ChaletInterface.h \ Sources/Chalet/ChaletInterface.h \
Sources/Chalet/ChaletLoraDevice.h \
Sources/Ispindel/IspindelData.h \ Sources/Ispindel/IspindelData.h \
Sources/LoraNetworkCommIF.h \ Sources/LoraNetworkCommIF.h \
Sources/MasterCtrl.h \ Sources/MasterCtrl.h \
@ -58,12 +57,12 @@ HEADERS += \
Sources/LoraModuleInterface/LoraModuleInterface.h \ Sources/LoraModuleInterface/LoraModuleInterface.h \
Sources/NetworkCommIFSurrogate.h \ Sources/NetworkCommIFSurrogate.h \
Sources/LoraModuleInterface/LoraModuleInterfaceData.h \ Sources/LoraModuleInterface/LoraModuleInterfaceData.h \
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.h Sources/LoraModuleInterface/LoraModuleInterfaceInterface.h \
Sources/Chalet/ChaletDevice.h
SOURCES += \ SOURCES += \
Sources/Chalet/ChaletData.cpp \ Sources/Chalet/ChaletData.cpp \
Sources/Chalet/ChaletInterface.cpp \ Sources/Chalet/ChaletInterface.cpp \
Sources/Chalet/ChaletLoraDevice.cpp \
Sources/Ispindel/IspindelData.cpp \ Sources/Ispindel/IspindelData.cpp \
Sources/LoraNetworkCommIF.cpp \ Sources/LoraNetworkCommIF.cpp \
Sources/main.cpp \ Sources/main.cpp \
@ -109,7 +108,8 @@ SOURCES += \
Sources/LoraModuleInterface/LoraModuleInterface.cpp \ Sources/LoraModuleInterface/LoraModuleInterface.cpp \
Sources/NetworkCommIFSurrogate.cpp \ Sources/NetworkCommIFSurrogate.cpp \
Sources/LoraModuleInterface/LoraModuleInterfaceData.cpp \ Sources/LoraModuleInterface/LoraModuleInterfaceData.cpp \
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.cpp Sources/LoraModuleInterface/LoraModuleInterfaceInterface.cpp \
Sources/Chalet/ChaletDevice.cpp
DEFINES -= Q_OS_UNIX DEFINES -= Q_OS_UNIX

View File

@ -1,8 +1,8 @@
#include "ChaletLoraDevice.h" #include "ChaletDevice.h"
#include "GlobalDefine.h" #include "GlobalDefine.h"
CChaletLoraDevice::CChaletLoraDevice(int Address, CAbstractNetworkCommIF *NetworkInterface): CChaletDevice::CChaletDevice(int Address, CAbstractNetworkCommIF *NetworkInterface):
CNetworkDevice(ID_CHALET_DEVICE,Address,NetworkInterface) CNetworkDevice(ID_CHALET_DEVICE,Address,NetworkInterface)
{ {
NetworkInterface->mDevicePtr = this; NetworkInterface->mDevicePtr = this;
@ -27,12 +27,12 @@ CChaletLoraDevice::CChaletLoraDevice(int Address, CAbstractNetworkCommIF *Networ
ResetCommStats(); ResetCommStats();
} }
CChaletLoraDevice::~CChaletLoraDevice() CChaletDevice::~CChaletDevice()
{ {
delete mChaletStatusTimer; delete mChaletStatusTimer;
} }
int CChaletLoraDevice::Start() int CChaletDevice::Start()
{ {
ScheduleChaletStatusRequest(); ScheduleChaletStatusRequest();
mChaletStatusTimer->start(1000); mChaletStatusTimer->start(1000);
@ -40,7 +40,7 @@ int CChaletLoraDevice::Start()
return RET_OK; return RET_OK;
} }
int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data) int CChaletDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
{ {
Q_UNUSED(DeviceID) Q_UNUSED(DeviceID)
Q_UNUSED(DeviceAddress) Q_UNUSED(DeviceAddress)
@ -245,7 +245,7 @@ int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, i
return RET_OK; return RET_OK;
} }
void CChaletLoraDevice::CommTimerExpired() void CChaletDevice::CommTimerExpired()
{ {
if(mPendingNetworkMsgList.isEmpty()) if(mPendingNetworkMsgList.isEmpty())
{ {
@ -295,7 +295,7 @@ void CChaletLoraDevice::CommTimerExpired()
// SendChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray()); // SendChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray());
} }
int CChaletLoraDevice::SendWiFiModuleSetState(bool State) int CChaletDevice::SendWiFiModuleSetState(bool State)
{ {
QByteArray Data; QByteArray Data;
Data.resize(1); Data.resize(1);
@ -311,7 +311,7 @@ int CChaletLoraDevice::SendWiFiModuleSetState(bool State)
return ScheduleChaletCommand(CHALET_WIFI_SET_STATE_REQUEST,1,Data); return ScheduleChaletCommand(CHALET_WIFI_SET_STATE_REQUEST,1,Data);
} }
int CChaletLoraDevice::SendInverterPowerRelayState(bool State) int CChaletDevice::SendInverterPowerRelayState(bool State)
{ {
QByteArray Data; QByteArray Data;
Data.resize(1); Data.resize(1);
@ -327,7 +327,7 @@ int CChaletLoraDevice::SendInverterPowerRelayState(bool State)
return ScheduleChaletCommand(CHALET_AC_POWER_SET_STATE_REQUEST,Data); return ScheduleChaletCommand(CHALET_AC_POWER_SET_STATE_REQUEST,Data);
} }
int CChaletLoraDevice::SendDOHarakiri() int CChaletDevice::SendDOHarakiri()
{ {
QByteArray Data; //Magic word... QByteArray Data; //Magic word...
Data.clear(); Data.clear();
@ -339,7 +339,7 @@ int CChaletLoraDevice::SendDOHarakiri()
return ScheduleChaletCommand(CHALET_DO_HARAKIRI_REQUEST,Data); return ScheduleChaletCommand(CHALET_DO_HARAKIRI_REQUEST,Data);
} }
int CChaletLoraDevice::SendRebootCmd() int CChaletDevice::SendRebootCmd()
{ {
QByteArray Data; //Magic word... QByteArray Data; //Magic word...
Data.clear(); Data.clear();
@ -350,33 +350,38 @@ int CChaletLoraDevice::SendRebootCmd()
return ScheduleChaletCommand(CHALET_REBOOT_CPU_REQUEST,Data); return ScheduleChaletCommand(CHALET_REBOOT_CPU_REQUEST,Data);
} }
int CChaletLoraDevice::SendGetWifiParams() int CChaletDevice::SendGetWifiParams()
{ {
return ScheduleChaletCommand(CHALET_GET_STORED_WIFI_SETTINGS_REQUEST,QByteArray()); return ScheduleChaletCommand(CHALET_GET_STORED_WIFI_SETTINGS_REQUEST,QByteArray());
} }
int CChaletLoraDevice::SendSetWifiParams(QByteArray Data) int CChaletDevice::SendSetWifiParams(QByteArray Data)
{ {
return ScheduleChaletCommand(CHALET_SET_STORED_WIFI_SETTINGS_REQUEST,Data); return ScheduleChaletCommand(CHALET_SET_STORED_WIFI_SETTINGS_REQUEST,Data);
} }
int CChaletLoraDevice::SendGetFirmwareVersion() int CChaletDevice::SendGetFirmwareVersion()
{ {
return ScheduleChaletCommand(CHALET_GET_FIRMWARE_VERSION_REQUEST,QByteArray()); return ScheduleChaletCommand(CHALET_GET_FIRMWARE_VERSION_REQUEST,QByteArray());
} }
int CChaletLoraDevice::SendClearCommStatsRequest() int CChaletDevice::SendClearCommStatsRequest()
{ {
return ScheduleChaletCommand(CHALET_CLEAR_COMMS_STATISTICS_REQUEST,QByteArray()); return ScheduleChaletCommand(CHALET_CLEAR_COMMS_STATISTICS_REQUEST,QByteArray());
} }
int CChaletLoraDevice::SendGetWifiStatusRequest() int CChaletDevice::SendGetWifiStatusRequest()
{ {
return ScheduleChaletCommand(CHALET_WIFI_STATUS_REQUEST,QByteArray()); return ScheduleChaletCommand(CHALET_WIFI_STATUS_REQUEST,QByteArray());
} }
int CChaletLoraDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Data) int CChaletDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Data)
{ {
if(mNetworkInterfacePtr == 0)
{
return RET_ERROR;
}
mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_DEVICE,mDeviceAddress,CmdID,DataSize,&Data); mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_DEVICE,mDeviceAddress,CmdID,DataSize,&Data);
mTotalNbRequest++; mTotalNbRequest++;
mChaletMainStatus.mTotalNbMasterTxCmds++; mChaletMainStatus.mTotalNbMasterTxCmds++;
@ -384,7 +389,7 @@ int CChaletLoraDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Dat
return RET_OK; return RET_OK;
} }
int CChaletLoraDevice::CmdResponseReceived(int CmdID) int CChaletDevice::CmdResponseReceived(int CmdID)
{ {
Q_UNUSED(CmdID) Q_UNUSED(CmdID)
@ -423,12 +428,12 @@ int CChaletLoraDevice::CmdResponseReceived(int CmdID)
int CChaletLoraDevice::ScheduleChaletStatusRequest() int CChaletDevice::ScheduleChaletStatusRequest()
{ {
return ScheduleChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray()); return ScheduleChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray());
} }
int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, int DataSize, QByteArray Data) int CChaletDevice::ScheduleChaletCommand(int CmdID, int DataSize, QByteArray Data)
{ {
Q_UNUSED(DataSize) Q_UNUSED(DataSize)
@ -445,7 +450,7 @@ int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, int DataSize, QByteArray
return RET_OK; return RET_OK;
} }
int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, QByteArray Data) int CChaletDevice::ScheduleChaletCommand(int CmdID, QByteArray Data)
{ {
// if(mChaletMainStatus.mIsOnline == false) // if(mChaletMainStatus.mIsOnline == false)
// { // {
@ -471,7 +476,7 @@ int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, QByteArray Data)
return RET_OK; return RET_OK;
} }
int CChaletLoraDevice::ResetCommStats() int CChaletDevice::ResetCommStats()
{ {
mLostRequestPercentage = 0.0; mLostRequestPercentage = 0.0;
mTotalNbRequest = 0; mTotalNbRequest = 0;
@ -482,7 +487,7 @@ int CChaletLoraDevice::ResetCommStats()
return RET_OK; return RET_OK;
} }
int CChaletLoraDevice::ComputeCommStats() int CChaletDevice::ComputeCommStats()
{ {
mLostRequestPercentage = ((float)mNbLostRequest/(float)mTotalNbRequest)*100; mLostRequestPercentage = ((float)mNbLostRequest/(float)mTotalNbRequest)*100;
mChaletMainStatus.mLostRequestPercentage = mLostRequestPercentage; mChaletMainStatus.mLostRequestPercentage = mLostRequestPercentage;

View File

@ -1,9 +1,9 @@
#ifndef CCHALETLORADEVICE_H #ifndef CCHALETDEVICE_H
#define CCHALETLORADEVICE_H #define CCHALETDEVICE_H
#include <QByteArray> #include <QByteArray>
#include <QObject> #include <QObject>
#include <QSerialPort> #include <QSerialPort>
#include "LoraNetworkCommIF.h" #include "NetworkProtocol.h"
#include "NetworkDevice.h" #include "NetworkDevice.h"
#include <QTimer> #include <QTimer>
#include "ChaletData.h" #include "ChaletData.h"
@ -26,16 +26,17 @@
#define LORA_CHALET_STATUS_POWER_RELAY_MASK 0x01 #define LORA_CHALET_STATUS_POWER_RELAY_MASK 0x01
#define LORA_CHALET_STATUS_CUR_SENSOR_MASK 0x02 #define LORA_CHALET_STATUS_CUR_SENSOR_MASK 0x02
class CChaletLoraDevice : public QObject, public CNetworkDevice class CChaletDevice : public QObject, public CNetworkDevice
{ {
Q_OBJECT Q_OBJECT
public: public:
CChaletLoraDevice(int Address,CAbstractNetworkCommIF *NetworkInterface); CChaletDevice(int Address,CAbstractNetworkCommIF *NetworkInterface);
~CChaletLoraDevice(); ~CChaletDevice();
virtual int NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data); virtual int NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
QString mChaletName;
QTimer *mChaletStatusTimer; QTimer *mChaletStatusTimer;
int Start(); int Start();
@ -93,4 +94,4 @@ public slots:
}; };
#endif // CCHALETLORADEVICE_H #endif // CCHALETDEVICE_H

View File

@ -1,7 +1,7 @@
#include "ChaletInterface.h" #include "ChaletInterface.h"
#include "ChaletDataLogger.h" #include "ChaletDataLogger.h"
CChaletInterface::CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletLoraDevice *DevicePtr): CChaletInterface::CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletDevice *DevicePtr):
CNetworkDevice(ID_CHALET_INTERFACE,Address,NetworkInterface) CNetworkDevice(ID_CHALET_INTERFACE,Address,NetworkInterface)
{ {
mChaletLoraDevice = DevicePtr; mChaletLoraDevice = DevicePtr;

View File

@ -3,19 +3,19 @@
#include "NetworkDevice.h" #include "NetworkDevice.h"
#include "ChaletLoraDevice.h" #include "ChaletDevice.h"
class CChaletInterface: public QObject, public CNetworkDevice class CChaletInterface: public QObject, public CNetworkDevice
{ {
Q_OBJECT Q_OBJECT
public: public:
CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletLoraDevice *DevicePtr); CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletDevice *DevicePtr);
virtual int NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data); virtual int NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
void SendChaletCommActivityBeacon(); void SendChaletCommActivityBeacon();
private: private:
CChaletLoraDevice *mChaletLoraDevice; CChaletDevice *mChaletLoraDevice;
CChaletDataLogger *mChaletDataLogger; CChaletDataLogger *mChaletDataLogger;
public slots: public slots:

View File

@ -4,7 +4,7 @@
#include <QObject> #include <QObject>
#include <ModbusBackend.h> #include <ModbusBackend.h>
class CChaletLoraDevice; class CChaletDevice;
class CChaletModbusServer : public CModbusBackend class CChaletModbusServer : public CModbusBackend
{ {

View File

@ -2,7 +2,7 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include "ChaletLoraDevice.h" #include "ChaletDevice.h"
CThingsBoardInterface::CThingsBoardInterface() CThingsBoardInterface::CThingsBoardInterface()

View File

@ -1,7 +1,7 @@
#ifndef THINGSBOARDINTERFACE_H #ifndef THINGSBOARDINTERFACE_H
#define THINGSBOARDINTERFACE_H #define THINGSBOARDINTERFACE_H
class CChaletLoraDevice; class CChaletDevice;
#include <QObject> #include <QObject>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
@ -14,7 +14,7 @@ public:
CThingsBoardInterface(); CThingsBoardInterface();
~CThingsBoardInterface(); ~CThingsBoardInterface();
CChaletLoraDevice *mChaletLoraDevice; CChaletDevice *mChaletLoraDevice;
int RegisterThingsboardRPC(); int RegisterThingsboardRPC();
void UpdateChaletVoltage(float Voltage); void UpdateChaletVoltage(float Voltage);

View File

@ -24,6 +24,8 @@ int CEthernetNetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress,
// Q_UNUSED(MessageID) // Q_UNUSED(MessageID)
// Q_UNUSED(DataSize) // Q_UNUSED(DataSize)
// Q_UNUSED(Data) // Q_UNUSED(Data)
if(mTCPSocket == 0)
return RET_ERROR;
QByteArray Packet; QByteArray Packet;
if(Data != 0) if(Data != 0)
@ -34,6 +36,7 @@ int CEthernetNetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress,
{ {
Packet = GetTxPacket(MessageID,0,0,0,DeviceAddress,DeviceID); Packet = GetTxPacket(MessageID,0,0,0,DeviceAddress,DeviceID);
} }
mTCPSocket->write(Packet); mTCPSocket->write(Packet);
return RET_OK; return RET_OK;

View File

@ -222,6 +222,20 @@ void CEthernetNetworkServer::DeviceSocketDataAvail()
} }
break; break;
} }
case ID_CHALET_DEVICE:
{
if(mDevicesMgrHandle->BindNetworkChaletDevice(DeviceAddress,(CAbstractNetworkCommIF*)NetworkIF) == RET_OK)
{
Result = RES_CREATION_SUCCESS;
qDebug("Created new Ethernet (LTE) Chalet Device in ethernet server");
}
else
{
Result = RES_CREATION_FAILED;
qDebug("Could not create Ethernet (LTE) Chalet Device in ethernet server");
}
break;
}
default: default:
{ {
Result = RES_CREATION_UNKNOWN_DEVICE; Result = RES_CREATION_UNKNOWN_DEVICE;

View File

@ -1,5 +1,6 @@
#include "MasterCtrl.h" #include "MasterCtrl.h"
#include <QApplication> #include <QApplication>
#include "EthernetNetworkCommIF.h"
// #include <QByteArray> // #include <QByteArray>
//#include <QBuffer> //#include <QBuffer>
@ -28,14 +29,17 @@ CMasterCtrl::CMasterCtrl()
if(mMasterCtrlSettings.mChaletUseLoraIF == true) if(mMasterCtrlSettings.mChaletUseLoraIF == true)
{ {
mChaletLoraModuleInterface = new CLoraModuleInterface(); //JFM LoraInterface Dev mChaletLoraModuleInterface = new CLoraModuleInterface(); //JFM LoraInterface Dev
mChaletLoraDevice = new CChaletLoraDevice(1,mChaletLoraModuleInterface); //JFM LoraInterface Dev mChaletLoraDevice = new CChaletDevice(1,mChaletLoraModuleInterface); //JFM LoraInterface Dev
} }
else else
{ {
mChaletLoraNetworkCommInterface = new CLoraNetworkCommIF();//JFM LoraInterface Dev mChaletLoraNetworkCommInterface = new CLoraNetworkCommIF();//JFM LoraInterface Dev
mChaletLoraDevice = new CChaletLoraDevice(1,mChaletLoraNetworkCommInterface);//JFM LoraInterface Dev mChaletLoraDevice = new CChaletDevice(1,mChaletLoraNetworkCommInterface);//JFM LoraInterface Dev
} }
CEthernetNetworkCommIF *Dummy = new CEthernetNetworkCommIF(NULL); //No memory leak here.. object will be deleted on reasignment.
mChaletLTEDevice = new CChaletDevice(1,(CAbstractNetworkCommIF*)Dummy);
// mChaletLoraInterface = new CChaletLoraInterface(mRooftopTowerLoraDevice); // mChaletLoraInterface = new CChaletLoraInterface(mRooftopTowerLoraDevice);
@ -96,6 +100,7 @@ void CMasterCtrl::Start()
mNetworkDevicesManager->mChaletLoraDevice = mChaletLoraDevice; mNetworkDevicesManager->mChaletLoraDevice = mChaletLoraDevice;
mNetworkDevicesManager->mIspindelDevice = mIspindelDevice; mNetworkDevicesManager->mIspindelDevice = mIspindelDevice;
mNetworkDevicesManager->mLoraModuleInterfaceDevice = mChaletLoraModuleInterface; mNetworkDevicesManager->mLoraModuleInterfaceDevice = mChaletLoraModuleInterface;
mNetworkDevicesManager->mChaletLTEDevice = mChaletLTEDevice;
mEthernetNetworkServer->mDevicesMgrHandle = mNetworkDevicesManager; mEthernetNetworkServer->mDevicesMgrHandle = mNetworkDevicesManager;
@ -137,9 +142,14 @@ void CMasterCtrl::Start()
// mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings("COM5",QSerialPort::Baud9600); // mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings("COM5",QSerialPort::Baud9600);
mChaletLoraDevice->mChaletName = "Chalet Lora";
mChaletLoraDevice->Start(); mChaletLoraDevice->Start();
mChaletLTEDevice->mChaletName = "Chalet LTE";
mChaletLTEDevice->Start();

View File

@ -12,7 +12,7 @@
#include "EthernetNetworkServer.h" #include "EthernetNetworkServer.h"
#include "ContactRepository.h" #include "ContactRepository.h"
#include "SprinklerMgr.h" #include "SprinklerMgr.h"
#include "ChaletLoraDevice.h" #include "ChaletDevice.h"
//#include "ChaletLoraInterface.h" //#include "ChaletLoraInterface.h"
#include "LoraNetworkCommIF.h" #include "LoraNetworkCommIF.h"
#include "HttpServer.h" #include "HttpServer.h"
@ -41,7 +41,8 @@ public:
CContactRepository *mContactsRepository; CContactRepository *mContactsRepository;
CSprinklerMgr *mSprinklerManager; CSprinklerMgr *mSprinklerManager;
CChaletLoraDevice *mChaletLoraDevice; CChaletDevice *mChaletLoraDevice;
CChaletDevice *mChaletLTEDevice;
// CChaletLoraInterface *mChaletLoraInterface; // CChaletLoraInterface *mChaletLoraInterface;
CLoraNetworkCommIF *mChaletLoraNetworkCommInterface; CLoraNetworkCommIF *mChaletLoraNetworkCommInterface;
CLoraModuleInterface *mChaletLoraModuleInterface; CLoraModuleInterface *mChaletLoraModuleInterface;

View File

@ -5,8 +5,9 @@ CNetworkDevice::CNetworkDevice(int DeviceID, int DeviceAddress, CAbstractNetwork
{ {
mDeviceAddress = DeviceAddress; mDeviceAddress = DeviceAddress;
mDeviceID = DeviceID; mDeviceID = DeviceID;
SetNetworkInterface(Interface);
mIsOnline = false; mIsOnline = false;
mNetworkInterfacePtr = 0;
SetNetworkInterface(Interface);
} }
CNetworkDevice::~CNetworkDevice() CNetworkDevice::~CNetworkDevice()
@ -19,7 +20,9 @@ CNetworkDevice::~CNetworkDevice()
void CNetworkDevice::SetNetworkInterface(CAbstractNetworkCommIF *Interface) void CNetworkDevice::SetNetworkInterface(CAbstractNetworkCommIF *Interface)
{ {
mNetworkInterfacePtr = Interface; if(mNetworkInterfacePtr != 0)
delete mNetworkInterfacePtr;
mNetworkInterfacePtr = Interface;
if(Interface != 0) if(Interface != 0)
{ {
mNetworkInterfacePtr->mDevicePtr = this; mNetworkInterfacePtr->mDevicePtr = this;

View File

@ -102,7 +102,8 @@ int CNetworkDevicesMgr::CreateNewChaletInterface(int Address, CAbstractNetworkCo
{ {
return RET_ERROR; return RET_ERROR;
} }
CChaletInterface *ChaletInterface = new CChaletInterface(Address, NetworkIF,mChaletLoraDevice); // CChaletInterface *ChaletInterface = new CChaletInterface(Address, NetworkIF,mChaletLoraDevice);
CChaletInterface *ChaletInterface = new CChaletInterface(Address, NetworkIF,mChaletLTEDevice);
mNetworkDevicesList.append((CNetworkDevice*)ChaletInterface); mNetworkDevicesList.append((CNetworkDevice*)ChaletInterface);
return RET_OK; return RET_OK;
} }
@ -130,6 +131,13 @@ int CNetworkDevicesMgr::CreateNewLoraInterfaceInterface(int Address, CAbstractNe
return RET_OK; return RET_OK;
} }
int CNetworkDevicesMgr::BindNetworkChaletDevice(int Address, CAbstractNetworkCommIF *NetworkIF)
{
mChaletLTEDevice->mDeviceAddress = Address;
mChaletLTEDevice->SetNetworkInterface(NetworkIF);
return RET_OK;
}
void CNetworkDevicesMgr::EthernetNetworkDeviceDisconnected(CNetworkDevice *Device) void CNetworkDevicesMgr::EthernetNetworkDeviceDisconnected(CNetworkDevice *Device)
{ {
qDebug("Device disconnected. ID: %d, Address: %d",Device->GetDeviceID(),Device->GetDeviceAddress()); qDebug("Device disconnected. ID: %d, Address: %d",Device->GetDeviceID(),Device->GetDeviceAddress());

View File

@ -19,7 +19,7 @@ class CMasterCtrl;
class CContactRepository; class CContactRepository;
class CSprinklerMgr; class CSprinklerMgr;
class CAVReceiverDevice; class CAVReceiverDevice;
class CChaletLoraDevice; class CChaletDevice;
class CIspindelDevice; class CIspindelDevice;
class CLoraModuleInterface; class CLoraModuleInterface;
@ -40,19 +40,21 @@ public:
int CreateNewChaletInterface(int Address, CAbstractNetworkCommIF *NetworkIF); int CreateNewChaletInterface(int Address, CAbstractNetworkCommIF *NetworkIF);
int CreateNewIspindleInterface(int Address, CAbstractNetworkCommIF *NetworkIF); int CreateNewIspindleInterface(int Address, CAbstractNetworkCommIF *NetworkIF);
int CreateNewLoraInterfaceInterface(int Address, CAbstractNetworkCommIF *NetworkIF); int CreateNewLoraInterfaceInterface(int Address, CAbstractNetworkCommIF *NetworkIF);
int BindNetworkChaletDevice(int Address, CAbstractNetworkCommIF *NetworkIF);
int FindDeviceByPtr(CNetworkDevice *Device); int FindDeviceByPtr(CNetworkDevice *Device);
CNetworkDevice *GetDevice(int DeviceID, int Address); CNetworkDevice *GetDevice(int DeviceID, int Address);
QList<CNetworkDevice*> GetDevices(int DeviceID); QList<CNetworkDevice*> GetDevices(int DeviceID);
CAVReceiverDevice *mAvReceiverDevice; CAVReceiverDevice *mAvReceiverDevice;
CChaletLoraDevice *mChaletLoraDevice; CChaletDevice *mChaletLoraDevice;
CIspindelDevice *mIspindelDevice; CIspindelDevice *mIspindelDevice;
CVoipMsSMSClient *mVoipMSInterfaceHandle; CVoipMsSMSClient *mVoipMSInterfaceHandle;
CContactRepository *mContactRepositoryHandle; CContactRepository *mContactRepositoryHandle;
CMasterCtrl *mProgramHandle; CMasterCtrl *mProgramHandle;
CSprinklerMgr *mSprinklerMgrHandle; CSprinklerMgr *mSprinklerMgrHandle;
CLoraModuleInterface *mLoraModuleInterfaceDevice; CLoraModuleInterface *mLoraModuleInterfaceDevice;
CChaletDevice *mChaletLTEDevice;
int NewSMSMessagesReceived(QList<CSMSMessage> NewMessages); int NewSMSMessagesReceived(QList<CSMSMessage> NewMessages);