Commit suite au Fuck-Up de Windows

This commit is contained in:
2023-03-06 08:17:08 -05:00
parent ac4e5aeb93
commit 526f4f76d8
16 changed files with 471 additions and 29 deletions
@@ -21,12 +21,71 @@ CLoraModuleInterface::~CLoraModuleInterface()
//This the handling of the Microcontroller (LoraModuleInterface)
int CLoraModuleInterface::NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
{
switch(MessageID)
{
case LORA_IF_GET_STATUS_RESPONSE:
{
unsigned char model = Data.at(0);
qDebug("LoraModuleInterface status received : %d",model);
break;
}
case LORA_IF_SEND_FRAME_RESPONSE:
{
qDebug("LoraModuleInterface sent frame to end Lora device");
break;
}
case LORA_IF_NEW_FRAME_RESPONSE: //LoraInterface received a message from the Lora end point (chalet for example). Let's decode it and send it to the destination device
{
CNetworkProtocol *mTempProtocol = new CNetworkProtocol; //Let's instanciate a temp protocol class to avoid messing with our own derived class...
int FwdDeviceID;
int FwdDeviceAddress;
int FwdMessageID;
int FwdDataSize;
QByteArray FwdData;
if(mTempProtocol->ProtocolAnalyseBufferStatically(Data,FwdDeviceID,FwdDeviceAddress,FwdMessageID,FwdDataSize,FwdData) == PROTOCOL_RET_OK_PACKET_COMPLETE)
{
mDevicePtr->NewDeviceFrameReceived(FwdDeviceID,FwdDeviceAddress,FwdMessageID,FwdDataSize,FwdData);
}
else
{
qDebug("LoraModuleInterface received an invalid packet from end Lora device in NewFrameReceived");
}
delete mTempProtocol;
break;
}
case LORA_IF_GET_MODULE_CONFIG_RESPONSE:
{
break;
}
case LORA_IF_GET_RSSI_RESPONSE:
{
break;
}
case LORA_IF_SET_MODULE_CONFIG_RESPONSE:
{
break;
}
case LORA_IF_GET_STATUS_REQUEST:
case LORA_IF_SEND_FRAME_REQUEST:
case LORA_IF_GET_MODULE_CONFIG_REQUEST:
case LORA_IF_GET_RSSI_REQUEST:
case LORA_IF_SET_MODULE_CONFIG_REQUEST:
default:
{
qDebug("CLoraModuleInterface: Received invalid response from LoraModule: %d",MessageID);
break;
}
}
return RET_OK;
}
//This is to answer to CChaletDevice requests
//This is the CAbstractNetworkCommIF class implementation (to answer to CChaletDevice requests).
int CLoraModuleInterface::SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data)
{
qDebug("LoraInterfce: New frame received from MasterCtrl class");
return RET_OK;
}
@@ -34,7 +93,9 @@ int CLoraModuleInterface::SendNetworkMessage(int DeviceID, int DeviceAddress, in
void CLoraModuleInterface::LoraModuleStatusTimerExpired()
{
QByteArray Packet = GetTxPacket(LORA_IF_GET_STATUS_REQUEST,0,0,0,1,ID_LORA_INTERFACE);
mLoraModuleIFSerialPort.write(Packet);
mLoraModuleIFSerialPort.waitForBytesWritten(500);
}
int CLoraModuleInterface::SetLoraModuleInterfaceParameters(QString ComPort, qint32 BaudRate)
@@ -61,7 +122,7 @@ int CLoraModuleInterface::SetLoraModuleInterfaceParameters(QString ComPort, qint
return RET_ERROR;
}
qDebug("Lora serial port opened");
qDebug("LoraModuleInterface serial port opened");
return RET_OK;
@@ -9,6 +9,7 @@
#include "NetworkDevice.h"
#include <QTimer>
#include <QSerialPort>
#include <QByteArrayList>
class CLoraModuleInterface : public QObject, public CNetworkProtocol, public CAbstractNetworkCommIF
{
@@ -16,7 +17,7 @@ class CLoraModuleInterface : public QObject, public CNetworkProtocol, public CAb
public:
CLoraModuleInterface();
~CLoraModuleInterface();
virtual ~CLoraModuleInterface();
int SetLoraModuleInterfaceParameters(QString ComPort,qint32 BaudRate);