Beaucoup de dev... début de LoraModuleInterface

This commit is contained in:
jfmartel 2022-12-11 13:17:19 -05:00
parent 3f28be7793
commit 49cd147334
27 changed files with 686 additions and 95 deletions

Binary file not shown.

View File

@ -53,7 +53,9 @@ HEADERS += \
Sources/Chalet/ChaletModbusServer.h \ Sources/Chalet/ChaletModbusServer.h \
Sources/Ispindel/IspindelDevice.h \ Sources/Ispindel/IspindelDevice.h \
Sources/Ispindel/IspindelDataLogger.h \ Sources/Ispindel/IspindelDataLogger.h \
Sources/Ispindel/IspindelInterface.h Sources/Ispindel/IspindelInterface.h \
Sources/Gui/LoraSettingsGui.h \
Sources/LoraModuleInterface/LoraModuleInterface.h
SOURCES += \ SOURCES += \
Sources/Chalet/ChaletData.cpp \ Sources/Chalet/ChaletData.cpp \
@ -99,7 +101,9 @@ SOURCES += \
Sources/Chalet/ChaletModbusServer.cpp \ Sources/Chalet/ChaletModbusServer.cpp \
Sources/Ispindel/IspindelDevice.cpp \ Sources/Ispindel/IspindelDevice.cpp \
Sources/Ispindel/IspindelDataLogger.cpp \ Sources/Ispindel/IspindelDataLogger.cpp \
Sources/Ispindel/IspindelInterface.cpp Sources/Ispindel/IspindelInterface.cpp \
Sources/Gui/LoraSettingsGui.cpp \
Sources/LoraModuleInterface/LoraModuleInterface.cpp
DEFINES -= Q_OS_UNIX DEFINES -= Q_OS_UNIX
@ -123,3 +127,6 @@ INCLUDEPATH += $$PWD/ \
# $$PWD/Lib/QtHTTPServer/include/ \ # $$PWD/Lib/QtHTTPServer/include/ \
LIBS += -L$$PWD/Lib/QtHTTPServer/ -lQt5HttpServer LIBS += -L$$PWD/Lib/QtHTTPServer/ -lQt5HttpServer
FORMS += \
Sources/Gui/LoraSettingsGui.ui

View File

@ -1,6 +1,7 @@
#include "AVReceiverDevice.h" #include "AVReceiverDevice.h"
#include "GlobalDefine.h" #include "GlobalDefine.h"
#include "ProtocolDefs.h" #include "ProtocolDefs.h"
#include <QDataStream>
/** /**
@ -46,7 +47,8 @@ CAVReceiverDevice::CAVReceiverDevice()
CAVReceiverDevice::~CAVReceiverDevice() CAVReceiverDevice::~CAVReceiverDevice()
{ {
mReceiverSocket->disconnectFromHost(); mReceiverSocket->disconnectFromHost();
mReceiverSocket->waitForDisconnected(); mReceiverSocket->waitForDisconnected(100);
delete mReceiverSocket; delete mReceiverSocket;
delete mDisconnectTimer; delete mDisconnectTimer;
delete mStateRequestTimer; delete mStateRequestTimer;
@ -113,27 +115,36 @@ int CAVReceiverDevice::AnalyseRxData(QByteArray data)
int CAVReceiverDevice::UpdateReceiverStateParam(QString SubUnit, QString Fcn, QString Param) int CAVReceiverDevice::UpdateReceiverStateParam(QString SubUnit, QString Fcn, QString Param)
{ {
static bool AllValid = false; static bool AllValid = false;
CAvReceiverMainStatus *UnitStatus = 0;
if(SubUnit == "MAIN") if(SubUnit == "MAIN")
{
UnitStatus = &mReceiverStatus;
}
else if(SubUnit == "ZONE2")
{
UnitStatus = &mZone2Status;
}
if(UnitStatus != 0)
{ {
if(Fcn == "PWR") if(Fcn == "PWR")
{ {
if(Param == "On") if(Param == "On")
{ {
mReceiverStatus.mMainPwrStatus = true; UnitStatus->mMainPwrStatus = true;
} }
else else
mReceiverStatus.mMainPwrStatus = false; UnitStatus->mMainPwrStatus = false;
} }
if(Fcn == "SLEEP") if(Fcn == "SLEEP")
{ {
if(Param == "On") if(Param == "On")
{ {
mReceiverStatus.mMainSleepStatus = true; UnitStatus->mMainSleepStatus = true;
} }
else else
{ {
mReceiverStatus.mMainSleepStatus = false; UnitStatus->mMainSleepStatus = false;
} }
} }
else if(Fcn == "VOL") else if(Fcn == "VOL")
@ -142,53 +153,31 @@ int CAVReceiverDevice::UpdateReceiverStateParam(QString SubUnit, QString Fcn, QS
float Vol = Param.toFloat(&OK); float Vol = Param.toFloat(&OK);
if(OK) if(OK)
{ {
mReceiverStatus.mMainVolume = Vol; UnitStatus->mMainVolume = Vol;
} }
else else
{ {
mReceiverStatus.mMainPwrStatus = 0xDEADBEEF; UnitStatus->mMainPwrStatus = 0xDEADBEEF;
} }
} }
else if(Fcn == "MUTE") else if(Fcn == "MUTE")
{ {
if(Param == "On") if(Param == "On")
{ {
mReceiverStatus.mIsMute = true; UnitStatus->mIsMute = true;
} }
else else
{ {
mReceiverStatus.mIsMute = false; UnitStatus->mIsMute = false;
} }
} }
else if (Fcn == "INP") else if (Fcn == "INP")
{ {
mReceiverStatus.mInput = Param; UnitStatus->mInput = Param;
} }
else if (Fcn == "SOUNDPRG") else if (Fcn == "SOUNDPRG")
{ {
mReceiverStatus.mProgram = Param; UnitStatus->mProgram = Param;
}
else if(Fcn == "SPEAKERA")
{
if(Param == "On")
{
mReceiverStatus.mSpeakerAState = true;
}
else
{
mReceiverStatus.mSpeakerAState = false;
}
}
else if(Fcn == "SPEAKERB")
{
if(Param == "On")
{
mReceiverStatus.mSpeakerBState = true;
}
else
{
mReceiverStatus.mSpeakerBState = false;
}
} }
} }
return RET_OK; return RET_OK;
@ -197,9 +186,10 @@ int CAVReceiverDevice::UpdateReceiverStateParam(QString SubUnit, QString Fcn, QS
int CAVReceiverDevice::SendReceiverCommand(QString Command) int CAVReceiverDevice::SendReceiverCommand(QString Command)
{ {
//Make sure the escape sequence is correct. //Make sure the escape sequence is correct.
Command.remove("\r"); // Command.remove("\r");
Command.remove("\n"); // Command.remove("\n");
Command.append("\r\n"); // Command.append("\r\n");
if(mReceiverSocket->state() == QAbstractSocket::ConnectedState) if(mReceiverSocket->state() == QAbstractSocket::ConnectedState)
{ {
@ -265,7 +255,7 @@ void CAVReceiverDevice::StateRequestTimerExpired()
{ {
if(mReceiverSocket->state() != QAbstractSocket::ConnectedState) if(mReceiverSocket->state() != QAbstractSocket::ConnectedState)
{ {
SendReceiverCommand("@MAIN:BASIC=?"); SendReceiverCommand("@MAIN:BASIC=?\r\n@ZONE2:BASIC=?\r\n");
mStateRequestTimer->start(RECEIVER_STATE_UPDATE_TIMEOUT); mStateRequestTimer->start(RECEIVER_STATE_UPDATE_TIMEOUT);
DisconnectReceiverDelayed(1000); DisconnectReceiverDelayed(1000);
} }
@ -278,30 +268,30 @@ void CAVReceiverDevice::StateRequestTimerExpired()
////// Network Interface Implementation ////// Network Interface Implementation
int CAVReceiverDevice::SetSpeakerB(bool OnOff) int CAVReceiverDevice::SetZone2(bool OnOff)
{ {
QString Cmd = "@MAIN:SPEAKERB="; QString Cmd = "@ZONE2:PWR=";
if(OnOff) if(OnOff)
{ {
Cmd += "On"; Cmd += "On\r\n";
} }
else else
Cmd += "Off"; Cmd += "Standby\r\n";
SendReceiverCommand(Cmd); SendReceiverCommand(Cmd);
DisconnectReceiverDelayed(); DisconnectReceiverDelayed();
return RET_OK; return RET_OK;
} }
int CAVReceiverDevice::SetSpeakerA(bool OnOff) int CAVReceiverDevice::SetMainZone(bool OnOff)
{ {
QString Cmd = "@MAIN:SPEAKERA="; QString Cmd = "@MAIN:PWR=";
if(OnOff) if(OnOff)
{ {
Cmd += "On"; Cmd += "On\r\n";
} }
else else
Cmd += "Off"; Cmd += "Standby\r\n";
SendReceiverCommand(Cmd); SendReceiverCommand(Cmd);
DisconnectReceiverDelayed(); DisconnectReceiverDelayed();
@ -315,22 +305,22 @@ int CAVReceiverDevice::SetSpeakers(int SpeakerA, int SpeakerB)
QString Cmd = "@MAIN:SPEAKERA="; QString Cmd = "@MAIN:SPEAKERA=";
if(SpeakerA == RECEIVER_SET_SPK_ON) if(SpeakerA == RECEIVER_SET_SPK_ON)
{ {
Cmd += "On"; Cmd += "On\r\n";
} }
else if(SpeakerA == RECEIVER_SET_SPK_OFF) else if(SpeakerA == RECEIVER_SET_SPK_OFF)
{ {
Cmd += "Off"; Cmd += "Off\r\n";
} }
else if(SpeakerA == RECEVIVER_TOGGLE_SPK) else if(SpeakerA == RECEVIVER_TOGGLE_SPK)
{ {
if(mReceiverStatus.mSpeakerAState == true) // if(mReceiverStatus.mSpeakerAState == true)
{ // {
Cmd += "Off"; // Cmd += "Off";
} // }
else // else
{ // {
Cmd += "On"; // Cmd += "On";
} // }
} }
else else
{ {
@ -354,14 +344,14 @@ int CAVReceiverDevice::SetSpeakers(int SpeakerA, int SpeakerB)
} }
else if(SpeakerB == RECEVIVER_TOGGLE_SPK) else if(SpeakerB == RECEVIVER_TOGGLE_SPK)
{ {
if(mReceiverStatus.mSpeakerAState == true) // if(mReceiverStatus.mSpeakerAState == true)
{ // {
Cmd += "Off"; // Cmd += "Off";
} // }
else // else
{ // {
Cmd += "On"; // Cmd += "On";
} // }
} }
else else
{ {
@ -382,3 +372,16 @@ int CAVReceiverDevice::SendRawCommand(QString Cmd)
} }
QByteArray CAVReceiverDevice::GetReceiverStatus()
{
QByteArray StatusArray;
QDataStream Strm(&StatusArray,QIODevice::WriteOnly | QIODevice::Unbuffered);
Strm.device()->seek(0);
Strm << mReceiverStatus
<< mZone2Status ;
return StatusArray;
}

View File

@ -67,17 +67,18 @@ private:
public: public:
//Network Interface Implementation //Network Interface Implementation
int SetSpeakerB(bool OnOff); int SetZone2(bool OnOff);
int SetSpeakerA(bool OnOff); int SetMainZone(bool OnOff);
int SetSpeakers(int SpeakerA, int SpeakerB); int SetSpeakers(int SpeakerA, int SpeakerB);
int SendRawCommand(QString Cmd); int SendRawCommand(QString Cmd);
CAvReceiverMainStatus GetReceiverStatus(){return mReceiverStatus;} QByteArray GetReceiverStatus();
private: private:
QTcpSocket *mReceiverSocket; QTcpSocket *mReceiverSocket;
int AnalyseRxData(QByteArray data); int AnalyseRxData(QByteArray data);
QTimer *mDisconnectTimer, *mStateRequestTimer; QTimer *mDisconnectTimer, *mStateRequestTimer;
CAvReceiverMainStatus mReceiverStatus; CAvReceiverMainStatus mReceiverStatus;
CAvReceiverMainStatus mZone2Status;
bool mIsConnected; bool mIsConnected;
QString mPendingCommand; QString mPendingCommand;

View File

@ -20,8 +20,6 @@ QByteArray CAvReceiverMainStatus::ToByteArray()
Strm << mIsMute; Strm << mIsMute;
Strm << mInput; Strm << mInput;
Strm << mProgram; Strm << mProgram;
Strm << mSpeakerAState;
Strm << mSpeakerBState;
Strm << mDataValid; Strm << mDataValid;
Strm << mReceiverOnline; Strm << mReceiverOnline;
@ -41,8 +39,6 @@ int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
Strm >> mIsMute; Strm >> mIsMute;
Strm >> mInput; Strm >> mInput;
Strm >> mProgram; Strm >> mProgram;
Strm >> mSpeakerAState;
Strm >> mSpeakerBState;
Strm >> mDataValid; Strm >> mDataValid;
Strm >> mReceiverOnline; Strm >> mReceiverOnline;
@ -50,3 +46,29 @@ int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
return RET_OK; return RET_OK;
} }
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source)
{
out << source.mMainPwrStatus
<< source.mMainSleepStatus
<< source.mMainVolume
<< source.mIsMute
<< source.mInput
<< source.mProgram
<< source.mDataValid
<< source.mReceiverOnline;
return out;
}
QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest)
{
in >> dest.mMainPwrStatus
>> dest.mMainSleepStatus
>> dest.mMainVolume
>> dest.mIsMute
>> dest.mInput
>> dest.mProgram
>> dest.mDataValid
>> dest.mReceiverOnline;
return in;
}

View File

@ -19,12 +19,13 @@ public:
bool mIsMute; bool mIsMute;
QString mInput; QString mInput;
QString mProgram; QString mProgram;
bool mSpeakerAState;
bool mSpeakerBState;
bool mDataValid; bool mDataValid;
bool mReceiverOnline; bool mReceiverOnline;
}; };
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source);
QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest);
#endif // AVRECEIVERDATA_H #endif // AVRECEIVERDATA_H

View File

@ -23,7 +23,7 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
} }
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_REQUEST: case AV_RECEIVER_INTERFACE_GENERAL_STATUS_REQUEST:
{ {
QByteArray data = mAvReceiverDevice->GetReceiverStatus().ToByteArray(); QByteArray data = mAvReceiverDevice->GetReceiverStatus();
mNetworkInterfacePtr->SendNetworkMessage(ID_AVRECEIVER_INTERFACE,mDeviceAddress,AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,data.size(),&data); mNetworkInterfacePtr->SendNetworkMessage(ID_AVRECEIVER_INTERFACE,mDeviceAddress,AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,data.size(),&data);
break; break;
} }
@ -32,16 +32,16 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
{ {
break; break;
} }
case AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST: case AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST:
{ {
bool SpkStatus = (bool)Data[0]; bool SpkStatus = (bool)Data[0];
mAvReceiverDevice->SetSpeakerB(SpkStatus); mAvReceiverDevice->SetZone2(SpkStatus);
break; break;
} }
case AV_RECEIVER_INTERFACE_SET_SPEAKERA_REQUEST: case AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_REQUEST:
{ {
bool SpkStatus = (bool)Data[0]; bool SpkStatus = (bool)Data[0];
mAvReceiverDevice->SetSpeakerA(SpkStatus); mAvReceiverDevice->SetMainZone(SpkStatus);
break; break;
} }
@ -55,10 +55,10 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
} }
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE: case AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE: case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE: case AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE:
case AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE: case AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE: case AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_SPEAKERA_RESPONSE: case AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_RESPONSE:
default: default:
{ {
qDebug("Received invalid msg from Sprinkler Interface"); qDebug("Received invalid msg from Sprinkler Interface");

View File

@ -9,6 +9,7 @@ CChaletInterface::CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkI
connect(mChaletLoraDevice,SIGNAL(DeviceWifiStoredParamsReceived()),this,SLOT(DeviceWiFiDataReceived())); connect(mChaletLoraDevice,SIGNAL(DeviceWifiStoredParamsReceived()),this,SLOT(DeviceWiFiDataReceived()));
connect(mChaletLoraDevice,SIGNAL(DeviceFirmwareVersionReceived()),this,SLOT(DeviceFirmwareVersionReceived())); connect(mChaletLoraDevice,SIGNAL(DeviceFirmwareVersionReceived()),this,SLOT(DeviceFirmwareVersionReceived()));
connect(mChaletLoraDevice,SIGNAL(DeviceWifiStatusReceived(QByteArray)),this,SLOT(DeviceWifiStatusReceived(QByteArray)));
} }
@ -119,6 +120,11 @@ int CChaletInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, in
// mChaletLoraDevice->ResetCommStats(); // mChaletLoraDevice->ResetCommStats();
break; break;
} }
case CHALET_INTERFACE_GET_WIFI_STATUS_REQUEST:
{
mChaletLoraDevice->SendGetWifiStatusRequest();
break;
}
case CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_RESPONSE: case CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_RESPONSE:
case CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_RESPONSE: case CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_RESPONSE:
case CHALET_INTERFACE_GET_DATA_LOG_RESPONSE: case CHALET_INTERFACE_GET_DATA_LOG_RESPONSE:
@ -129,6 +135,7 @@ int CChaletInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, in
case CHALET_INTERFACE_BATTERY_VOLTAGE_RESPONSE: case CHALET_INTERFACE_BATTERY_VOLTAGE_RESPONSE:
case CHALET_INTERFACE_WIFI_SET_STATE_RESPONSE: case CHALET_INTERFACE_WIFI_SET_STATE_RESPONSE:
case CHALET_INTERFACE_CLEAR_COMMS_STATS_RESPONSE: case CHALET_INTERFACE_CLEAR_COMMS_STATS_RESPONSE:
case CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE:
{ {
break; break;
@ -160,3 +167,8 @@ void CChaletInterface::DeviceFirmwareVersionReceived()
QByteArray Data = mChaletLoraDevice->GetDeviceFirmwareVersion(); QByteArray Data = mChaletLoraDevice->GetDeviceFirmwareVersion();
mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_INTERFACE,mDeviceAddress,CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE,Data.size(),&Data); mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_INTERFACE,mDeviceAddress,CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE,Data.size(),&Data);
} }
void CChaletInterface::DeviceWifiStatusReceived(QByteArray Data)
{
mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_INTERFACE,mDeviceAddress,CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE,Data.size(),&Data);
}

View File

@ -21,6 +21,7 @@ private:
public slots: public slots:
void DeviceWiFiDataReceived(); void DeviceWiFiDataReceived();
void DeviceFirmwareVersionReceived(); void DeviceFirmwareVersionReceived();
void DeviceWifiStatusReceived(QByteArray Data);
}; };

View File

@ -169,8 +169,8 @@ int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, i
} }
case CHALET_WIFI_STATUS_RESPONSE: case CHALET_WIFI_STATUS_RESPONSE:
{ {
mChaletMainStatus.mWiFiModuleStatus = Data[0];
CmdResponseReceived(CHALET_WIFI_STATUS_REQUEST); CmdResponseReceived(CHALET_WIFI_STATUS_REQUEST);
emit DeviceWifiStatusReceived(Data);
break; break;
} }
case CHALET_WIFI_SET_STATE_RESPONSE: case CHALET_WIFI_SET_STATE_RESPONSE:
@ -211,7 +211,7 @@ int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, i
{ {
CmdResponseReceived(CHALET_GET_STORED_WIFI_SETTINGS_REQUEST); CmdResponseReceived(CHALET_GET_STORED_WIFI_SETTINGS_REQUEST);
mDeviceWiFiParameters = Data.left(8); mDeviceWiFiParameters = Data.left(DataSize);
emit DeviceWifiStoredParamsReceived(); emit DeviceWifiStoredParamsReceived();
break; break;
} }
@ -370,6 +370,11 @@ int CChaletLoraDevice::SendClearCommStatsRequest()
return ScheduleChaletCommand(CHALET_CLEAR_COMMS_STATISTICS_REQUEST,QByteArray()); return ScheduleChaletCommand(CHALET_CLEAR_COMMS_STATISTICS_REQUEST,QByteArray());
} }
int CChaletLoraDevice::SendGetWifiStatusRequest()
{
return ScheduleChaletCommand(CHALET_WIFI_STATUS_REQUEST,QByteArray());
}
int CChaletLoraDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Data) int CChaletLoraDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Data)
{ {
mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_DEVICE,mDeviceAddress,CmdID,DataSize,&Data); mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_DEVICE,mDeviceAddress,CmdID,DataSize,&Data);
@ -416,6 +421,8 @@ int CChaletLoraDevice::CmdResponseReceived(int CmdID)
return RET_OK; return RET_OK;
} }
int CChaletLoraDevice::ScheduleChaletStatusRequest() int CChaletLoraDevice::ScheduleChaletStatusRequest()
{ {
return ScheduleChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray()); return ScheduleChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray());

View File

@ -73,6 +73,7 @@ public:
int SendSetWifiParams(QByteArray Data); int SendSetWifiParams(QByteArray Data);
int SendGetFirmwareVersion(); int SendGetFirmwareVersion();
int SendClearCommStatsRequest(); int SendClearCommStatsRequest();
int SendGetWifiStatusRequest();
int CmdResponseReceived(int CmdID); int CmdResponseReceived(int CmdID);
int ScheduleChaletStatusRequest(); int ScheduleChaletStatusRequest();
@ -85,6 +86,7 @@ signals:
void DeviceWifiStoredParamsReceived(); void DeviceWifiStoredParamsReceived();
void DeviceWifiSetParamsResult(char); void DeviceWifiSetParamsResult(char);
void DeviceFirmwareVersionReceived(); void DeviceFirmwareVersionReceived();
void DeviceWifiStatusReceived(QByteArray);
public slots: public slots:
void CommTimerExpired(); void CommTimerExpired();

View File

@ -0,0 +1,38 @@
#include "LoraSettingsGui.h"
#include "ui_LoraSettingsGui.h"
#include "ProgramSettings.h"
CLoraSettingsGui::CLoraSettingsGui(QWidget *parent) :
QWidget(parent),
ui(new Ui::CLoraSettingsGui)
{
ui->setupUi(this);
}
CLoraSettingsGui::~CLoraSettingsGui()
{
delete ui;
}
CLoraSettingsGui::SetSettings(CSettings *settings)
{
ui->mLoraAddressSpinBx->setValue(settings->mChaletLoraAddress);
ui->mComportComboBox->setCurrentText(settings->mChaletComPort);
return RET_OK;
}
quint16 CLoraSettingsGui::GetChaletLoraAddress()
{
quint16 Add = ui->mLoraAddressSpinBx->value();
return Add;
}
quint8 CLoraSettingsGui::GetChaletLoraChannel()
{
return 4;
}
QString CLoraSettingsGui::GetChaletLoraComPort()
{
return ui->mComportComboBox->currentText();
}

View File

@ -0,0 +1,28 @@
#ifndef LORASETTINGSGUI_H
#define LORASETTINGSGUI_H
#include <QWidget>
class CSettings;
namespace Ui {
class CLoraSettingsGui;
}
class CLoraSettingsGui : public QWidget
{
Q_OBJECT
public:
explicit CLoraSettingsGui(QWidget *parent = 0);
~CLoraSettingsGui();
int SetSettings(CSettings* settings);
QString GetChaletLoraComPort();
quint8 GetChaletLoraChannel();
quint16 GetChaletLoraAddress();
private:
Ui::CLoraSettingsGui *ui;
};
#endif // LORASETTINGSGUI_H

View File

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CLoraSettingsGui</class>
<widget class="QWidget" name="CLoraSettingsGui">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>553</width>
<height>413</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>151</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Lora Settings</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>50</x>
<y>120</y>
<width>221</width>
<height>191</height>
</rect>
</property>
<property name="title">
<string>Chalet</string>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Lora Address:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Lora Channel:</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
<widget class="QSpinBox" name="mLoraAddressSpinBx">
<property name="geometry">
<rect>
<x>90</x>
<y>40</y>
<width>71</width>
<height>22</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>6</number>
</property>
</widget>
<widget class="QComboBox" name="mComportComboBox">
<property name="geometry">
<rect>
<x>80</x>
<y>80</y>
<width>69</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>COM1</string>
</property>
</item>
<item>
<property name="text">
<string>COM2</string>
</property>
</item>
<item>
<property name="text">
<string>COM3</string>
</property>
</item>
<item>
<property name="text">
<string>COM4</string>
</property>
</item>
<item>
<property name="text">
<string>COM5</string>
</property>
</item>
<item>
<property name="text">
<string>COM6</string>
</property>
</item>
<item>
<property name="text">
<string>COM7</string>
</property>
</item>
<item>
<property name="text">
<string>COM8</string>
</property>
</item>
<item>
<property name="text">
<string>COM9</string>
</property>
</item>
<item>
<property name="text">
<string>COM10</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Com Port:</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Chalet = 7
Chaloupe = 8</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -14,10 +14,13 @@ CSettingsWindow::CSettingsWindow()
QVBoxLayout *MainLayout = new QVBoxLayout; QVBoxLayout *MainLayout = new QVBoxLayout;
QWidget *mPagesContainer = new QWidget(this); QWidget *mPagesContainer = new QWidget(this);
mLoraSettingsPage = new CLoraSettingsGui(mPagesContainer);
mOptionsTabBar = new QTabBar(); mOptionsTabBar = new QTabBar();
mOptionsTabBar->addTab("SMS"); mOptionsTabBar->addTab("SMS");
mOptionsTabBar->addTab("Network"); mOptionsTabBar->addTab("Network");
mOptionsTabBar->addTab("Contacts"); mOptionsTabBar->addTab("Contacts");
mOptionsTabBar->addTab("Lora");
mOptionsTabBar->resize(this->geometry().width(),mOptionsTabBar->height()); mOptionsTabBar->resize(this->geometry().width(),mOptionsTabBar->height());
MainLayout->addWidget(mOptionsTabBar); MainLayout->addWidget(mOptionsTabBar);
@ -160,14 +163,22 @@ void CSettingsWindow::TabBarClicked(int TabIndex)
{ {
mSMSPage->hide(); mSMSPage->hide();
mContactsPage->hide(); mContactsPage->hide();
mLoraSettingsPage->hide();
} }
else if(TabIndex == 2)//Contacts else if(TabIndex == 2)//Contacts
{ {
mSMSPage->hide(); mSMSPage->hide();
mLoraSettingsPage->hide();
mContactsPage->show(); mContactsPage->show();
} }
else if(TabIndex == 3) //Lora
{
mSMSPage->hide();
mContactsPage->hide();
mLoraSettingsPage->show();
}
} }
void CSettingsWindow::RetreiveDIDButtonClicked(bool checked) void CSettingsWindow::RetreiveDIDButtonClicked(bool checked)
@ -207,6 +218,8 @@ unsigned int CSettingsWindow::SetSettingsData(CSettings *SettingsData)
mDIDSelectionDropList->clear(); mDIDSelectionDropList->clear();
mDIDSelectionDropList->addItem(SettingsData->mVoipMSSettings.mDefaultDID); mDIDSelectionDropList->addItem(SettingsData->mVoipMSSettings.mDefaultDID);
mVoipMSCalendar->setSelectedDate(SettingsData->mVoipMSSettings.mStartDate); mVoipMSCalendar->setSelectedDate(SettingsData->mVoipMSSettings.mStartDate);
mLoraSettingsPage->SetSettings(SettingsData);
return RET_OK; return RET_OK;
} }
@ -219,6 +232,9 @@ void CSettingsWindow::DoneButtonClicked(bool checked)
Settings->mVoipMSSettings.mPassword = mVoipMSPassword->text(); Settings->mVoipMSSettings.mPassword = mVoipMSPassword->text();
Settings->mVoipMSSettings.mStartDate = mVoipMSCalendar->selectedDate(); Settings->mVoipMSSettings.mStartDate = mVoipMSCalendar->selectedDate();
Settings->mVoipMSSettings.mUsername = mVoipMSUsername->text(); Settings->mVoipMSSettings.mUsername = mVoipMSUsername->text();
Settings->mChaletComPort = mLoraSettingsPage->GetChaletLoraComPort();
Settings->mChaletLoraAddress = mLoraSettingsPage->GetChaletLoraAddress();
Settings->mChaletLoraChannel = mLoraSettingsPage->GetChaletLoraChannel();
mProgramHandle->SaveSettings(Settings); mProgramHandle->SaveSettings(Settings);
mProgramHandle->SettingsWindowClosed(); mProgramHandle->SettingsWindowClosed();

View File

@ -11,6 +11,7 @@
#include "ProgramSettings.h" #include "ProgramSettings.h"
#include "QTableWidget" #include "QTableWidget"
#include <QLabel> #include <QLabel>
#include "LoraSettingsGui.h"
class CMasterCtrl; class CMasterCtrl;
@ -28,6 +29,7 @@ public:
QWidget *mSMSPage; QWidget *mSMSPage;
QWidget *mContactsPage; QWidget *mContactsPage;
QTabBar *mOptionsTabBar; QTabBar *mOptionsTabBar;
CLoraSettingsGui *mLoraSettingsPage;
//SMS Page //SMS Page
QLineEdit *mVoipMSUsername; QLineEdit *mVoipMSUsername;

View File

@ -135,7 +135,7 @@ bool CIspindelDevice::DeleteSampleRequest(int SampleIndex)
} }
mIspindelLog.removeAt(SampleIndex); mIspindelLog.removeAt(SampleIndex);
mDataLogger.WriteLogToFile(&mIspindelLog); mDataLogger.WriteLogToFile(&mIspindelLog,false);
return true; return true;

View File

@ -0,0 +1,16 @@
#include "LoraModuleInterface.h"
CLoraModuleInterface::CLoraModuleInterface()
{
}
int CLoraModuleInterface::NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
{
return RET_OK;
}
int CLoraModuleInterface::SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data)
{
return RET_OK;
}

View File

@ -0,0 +1,27 @@
#ifndef LORAMODULEINTERFACE_H
#define LORAMODULEINTERFACE_H
#include <QByteArray>
#include <QObject>
#include <QSerialPort>
#include "NetworkProtocol.h"
#include "AbstractNetworkInterface.h"
#include "NetworkDevice.h"
class CLoraModuleInterface : public QObject, public CNetworkProtocol, public CAbstractNetworkCommIF
{
Q_OBJECT
public:
CLoraModuleInterface();
//NetworkProtocol implementation
virtual int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
//NetworkCommIF implementation
virtual int SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data);
};
#endif // LORAMODULEINTERFACE_H

View File

@ -10,6 +10,9 @@ CLoraNetworkCommIF::CLoraNetworkCommIF()
mLoraMagicResponse.append(0xAD); mLoraMagicResponse.append(0xAD);
mLoraMagicResponse.append(0xBE); mLoraMagicResponse.append(0xBE);
mLoraMagicResponse.append(0xEF); mLoraMagicResponse.append(0xEF);
mDestLoraAddress = 6;
mDestLoraChannel = 4;
} }
QByteArray CLoraNetworkCommIF::GetLoraFrame(unsigned short DestAddress, unsigned char DestChannel, QByteArray Payload) QByteArray CLoraNetworkCommIF::GetLoraFrame(unsigned short DestAddress, unsigned char DestChannel, QByteArray Payload)
@ -63,6 +66,7 @@ int CLoraNetworkCommIF::SendLoraFrame(unsigned short DestAddress, unsigned char
{ {
mLoraDeviceSerialPort.write(GetLoraFrame(DestAddress,DestChannel,Payload)); mLoraDeviceSerialPort.write(GetLoraFrame(DestAddress,DestChannel,Payload));
mLoraDeviceSerialPort.write(Payload);
mLoraDeviceSerialPort.waitForBytesWritten(500); mLoraDeviceSerialPort.waitForBytesWritten(500);
return RET_OK; return RET_OK;
@ -73,7 +77,7 @@ void CLoraNetworkCommIF::LoraDeviceNewDataReady()
{ {
QByteArray NewData = mLoraDeviceSerialPort.readAll(); QByteArray NewData = mLoraDeviceSerialPort.readAll();
// QString Printf = "New Lora Data: "; QString Printf = "New Lora Data: ";
AnalyzeRxBuffer(NewData); AnalyzeRxBuffer(NewData);
@ -108,7 +112,15 @@ int CLoraNetworkCommIF::NewFrameReceived(int DeviceID, int DeviceAddress, int Me
int CLoraNetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data) int CLoraNetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data)
{ {
QByteArray Packet = GetTxPacket(MessageID,0,Data->data(),DataSize,DeviceAddress,DeviceID); QByteArray Packet = GetTxPacket(MessageID,0,Data->data(),DataSize,DeviceAddress,DeviceID);
SendLoraFrame(6,4,Packet); //channel 6 = chalet //SendLoraFrame(6,4,Packet); //channel 6 = chalet
//SendLoraFrame(7,4,Packet); //channel 7 = chaloupe //SendLoraFrame(7,4,Packet); //channel 7 = chaloupe
SendLoraFrame(mDestLoraAddress,mDestLoraChannel,Packet);
return RET_OK;
}
int CLoraNetworkCommIF::SetLoraDestinationAddress(quint16 Address, quint8 Channel)
{
mDestLoraAddress = Address;
mDestLoraChannel = Channel;
return RET_OK; return RET_OK;
} }

View File

@ -22,10 +22,13 @@ public:
unsigned short mMyLoraAddress; unsigned short mMyLoraAddress;
unsigned char mMyLoraChannel; unsigned char mMyLoraChannel;
unsigned short mDestLoraAddress;
unsigned char mDestLoraChannel;
QSerialPort mLoraDeviceSerialPort; QSerialPort mLoraDeviceSerialPort;
int SendLoraFrame(unsigned short DestAddress,unsigned char DestChannel,QByteArray Payload); int SendLoraFrame(unsigned short DestAddress,unsigned char DestChannel,QByteArray Payload);
int SetLoraSerialPortSettings(QString PortName, qint32 BaudRate); int SetLoraSerialPortSettings(QString PortName, qint32 BaudRate);
int SetLoraDestinationAddress(quint16 Address, quint8 Channel);
//NetworkProtocol implementation //NetworkProtocol implementation
int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data); int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);

View File

@ -16,8 +16,7 @@ CMasterCtrl::CMasterCtrl()
mSettingsWindow->mProgramHandle = this; mSettingsWindow->mProgramHandle = this;
mChaletLoraNetworkCommInterface = new CLoraNetworkCommIF(); mChaletLoraNetworkCommInterface = new CLoraNetworkCommIF();
mChaletLoraNetworkCommInterface->mMyLoraAddress = 5;
mChaletLoraNetworkCommInterface->mMyLoraChannel = 4;
mChaletLoraDevice = new CChaletLoraDevice(1,mChaletLoraNetworkCommInterface); mChaletLoraDevice = new CChaletLoraDevice(1,mChaletLoraNetworkCommInterface);
// mChaletLoraInterface = new CChaletLoraInterface(mRooftopTowerLoraDevice); // mChaletLoraInterface = new CChaletLoraInterface(mRooftopTowerLoraDevice);
@ -95,7 +94,10 @@ void CMasterCtrl::Start()
mAVReceiverDevice->Start(); mAVReceiverDevice->Start();
mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings("COM3",QSerialPort::Baud9600); mChaletLoraNetworkCommInterface->mMyLoraAddress = 5;
mChaletLoraNetworkCommInterface->mMyLoraChannel = 4;
mChaletLoraNetworkCommInterface->SetLoraDestinationAddress(mMasterCtrlSettings.mChaletLoraAddress,mMasterCtrlSettings.mChaletLoraChannel);
mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings(mMasterCtrlSettings.mChaletComPort,QSerialPort::Baud9600);
// mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings("COM5",QSerialPort::Baud9600); // mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings("COM5",QSerialPort::Baud9600);
mChaletLoraDevice->Start(); mChaletLoraDevice->Start();
@ -110,7 +112,8 @@ void CMasterCtrl::Start()
unsigned int CMasterCtrl::QuitApplicationRequest() unsigned int CMasterCtrl::QuitApplicationRequest()
{ {
QApplication::exit(69); // QApplication::exit(69);
QCoreApplication::quit();
return RET_OK; return RET_OK;
} }
@ -141,6 +144,8 @@ unsigned int CMasterCtrl::SettingsWindowClosed()
{ {
mVoipMsSMSClient->SetVOIPMsSettings(&mMasterCtrlSettings.mVoipMSSettings); mVoipMsSMSClient->SetVOIPMsSettings(&mMasterCtrlSettings.mVoipMSSettings);
mVoipMsSMSClient->DownloadSMSFromServer(); mVoipMsSMSClient->DownloadSMSFromServer();
mChaletLoraNetworkCommInterface->SetLoraDestinationAddress(mMasterCtrlSettings.mChaletLoraAddress,mMasterCtrlSettings.mChaletLoraChannel);
mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings(mMasterCtrlSettings.mChaletComPort,QSerialPort::Baud9600);
return RET_OK; return RET_OK;
} }

View File

@ -304,6 +304,7 @@ int CNetworkProtocol::RxStateMachine(unsigned char Data)
{ {
ResetRxStateMachine(); ResetRxStateMachine();
ret = PROTOCOL_RET_ERROR_BAD_CRC; ret = PROTOCOL_RET_ERROR_BAD_CRC;
qDebug("LORA: Bad CRC");
break; break;
} }

View File

@ -51,6 +51,9 @@ void CProgramSettings::LoadDefaultSettings(CSettings *Settings)
Settings->mVoipMSSettings.mPassword = "Voip.ms Password"; Settings->mVoipMSSettings.mPassword = "Voip.ms Password";
Settings->mVoipMSSettings.mUsername = "Voip.ms Username"; Settings->mVoipMSSettings.mUsername = "Voip.ms Username";
Settings->mVoipMSSettings.mStartDate = QDate::currentDate(); Settings->mVoipMSSettings.mStartDate = QDate::currentDate();
Settings->mChaletComPort = "COM3";
Settings->mChaletLoraAddress = 6;
Settings->mChaletLoraChannel = 4;
} }
unsigned int CProgramSettings::SaveSettings(CSettings *SettingsData) unsigned int CProgramSettings::SaveSettings(CSettings *SettingsData)
@ -89,6 +92,9 @@ unsigned int CProgramSettings::SaveSettings(CSettings *SettingsData)
QDataStream &operator<<(QDataStream &out, const CSettings &source) QDataStream &operator<<(QDataStream &out, const CSettings &source)
{ {
out << source.mVoipMSSettings; out << source.mVoipMSSettings;
out << source.mChaletComPort;
out << source.mChaletLoraAddress;
out << source.mChaletLoraChannel;
return out; return out;
} }
@ -96,6 +102,9 @@ QDataStream &operator<<(QDataStream &out, const CSettings &source)
QDataStream &operator>>(QDataStream &in, CSettings &dest) QDataStream &operator>>(QDataStream &in, CSettings &dest)
{ {
in >> dest.mVoipMSSettings; in >> dest.mVoipMSSettings;
in >> dest.mChaletComPort;
in >> dest.mChaletLoraAddress;
in >> dest.mChaletLoraChannel;
return in; return in;
} }
@ -142,5 +151,8 @@ CSettings& CSettings::operator =(const CSettings &source)
return *this; return *this;
} }
this->mVoipMSSettings = source.mVoipMSSettings; this->mVoipMSSettings = source.mVoipMSSettings;
this->mChaletComPort = source.mChaletComPort;
this->mChaletLoraAddress = source.mChaletLoraAddress;
this->mChaletLoraChannel = source.mChaletLoraChannel;
return *this; return *this;
} }

View File

@ -27,6 +27,10 @@ class CSettings
{ {
public: public:
CVoipMSSMSSettings mVoipMSSettings; CVoipMSSMSSettings mVoipMSSettings;
QString mChaletComPort;
quint16 mChaletLoraAddress;
quint8 mChaletLoraChannel;
CSettings &operator=(const CSettings &source); CSettings &operator=(const CSettings &source);
}; };

View File

@ -61,6 +61,7 @@ enum DEVICES_IDS
ID_CHALET_INTERFACE, ID_CHALET_INTERFACE,
ID_CHALET_DEVICE, ID_CHALET_DEVICE,
ID_ISPINDEL_INTERFACE, ID_ISPINDEL_INTERFACE,
ID_LORA_INTERFACE,
ID_NB_DEVICE_ID ID_NB_DEVICE_ID
}; };
@ -236,10 +237,10 @@ enum AV_RECEIVER_INTERFACE_CMDS
AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE, AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST, AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST,
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE, AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE,
AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST, AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST,
AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE, AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE,
AV_RECEIVER_INTERFACE_SET_SPEAKERA_REQUEST, AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_REQUEST,
AV_RECEIVER_INTERFACE_SET_SPEAKERA_RESPONSE, AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_RESPONSE,
AV_RECEIVER_INTERFACE_SET_SPEAKERS_REQUEST, AV_RECEIVER_INTERFACE_SET_SPEAKERS_REQUEST,
AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE, AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE,
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST, AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST,
@ -279,6 +280,8 @@ enum CHALET_INTERFACE_CMDS
CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE, CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE,
CHALET_INTERFACE_CLEAR_COMMS_STATS_REQUEST, CHALET_INTERFACE_CLEAR_COMMS_STATS_REQUEST,
CHALET_INTERFACE_CLEAR_COMMS_STATS_RESPONSE, CHALET_INTERFACE_CLEAR_COMMS_STATS_RESPONSE,
CHALET_INTERFACE_GET_WIFI_STATUS_REQUEST,
CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE,
@ -319,6 +322,40 @@ enum CHALET_CMDS
MAX_CHALET_CMD MAX_CHALET_CMD
}; };
enum BOOTLOADER_CMDS
{
BOOTLOADER_ACK = 1,
BOOTLOADER_HEARTBEAT_REQUEST,
BOOTLOADER_HEARTBEAT_RESPONSE,
BOOTLOADER_ERASE_BOOTLOADER_FLASH_REQUEST,
BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESPONSE,
BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESULT_RESPONSE,
BOOTLOADER_INIT_UPLOAD_REQUEST,
BOOTLOADER_INIT_UPLOAD_RESPONSE,
BOOTLOADER_GET_STATE_REQUEST,
BOOTLOADER_GET_STATE_RESPONSE,
BOOTLOADER_READY_FOR_DATA_RESPONSE,
BOOTLOADER_SEND_DATA_CHUNK_REQUEST,
BOOTLOADER_SEND_DATA_CHUNK_RESPONSE,
BOOTLOADER_UPLOAD_FINISHED_REQUEST,
BOOTLOADER_UPLOAD_FINISHED_RESPONSE,
BOOTLOADER_EXECUTE_UPGRAGE_REQUEST,
BOOTLOADER_EXECUTE_UPGRADE_RESPONSE,
BOOTLOADER_ABORT_OPERATION_REQUEST,
BOOTLOADER_ABORT_OPERATION_RESPONSE,
BOOTLOADER_SEND_FLASH_DATA_REQUEST,
BOOTLOADER_SEND_FLASH_DATA_RESPONSE,
BOOTLOADER_SEND_FLASH_DATA_CHUNK,
BOOTLOADER_SEND_FLASH_DATA_CHUNK_RESPONSE,
BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_REQUEST,
BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_RESPONSE,
BOOTLOADER_GET_STORED_FIRMWARE_INFO_REQUEST,
BOOTLOADER_GET_STORED_FIRMWARE_INFO_RESPONSE,
MAX_BOOTLOADER_CMD
};
enum ISPINDLE_CMDS enum ISPINDLE_CMDS
{ {
ISPINDLE_ACK = 1, ISPINDLE_ACK = 1,
@ -332,4 +369,22 @@ enum ISPINDLE_CMDS
MAX_ISPINDLE_CMDS MAX_ISPINDLE_CMDS
}; };
enum LORA_INTERFACE_CMDS
{
LORA_IF_ACK = 1,
LORA_IF_GET_STATUS_REQUEST,
LORA_IF_GET_STATUS_RESPONSE,
LORA_IF_SEND_FRAME_REQUEST,
LORA_IF_SEND_FRAME_RESPONSE,
LORA_IF_NEW_FRAME_RESPONSE,
LORA_IF_GET_MODULE_CONFIG_REQUEST,
LORA_IF_GET_MODULE_CONFIG_RESPONSE,
LORA_IF_GET_RSSI_REQUEST,
LORA_IF_GET_RSSI_RESPONSE,
LORA_IF_SET_MODULE_CONFIG_REQUEST,
LORA_IF_SET_MODULE_CONFIG_RESPONSE,
MAX_LORA_IF_CMD
};
#endif #endif

121
ui_LoraSettingsGui.h Normal file
View File

@ -0,0 +1,121 @@
/********************************************************************************
** Form generated from reading UI file 'LoraSettingsGui.ui'
**
** Created by: Qt User Interface Compiler version 5.14.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_LORASETTINGSGUI_H
#define UI_LORASETTINGSGUI_H
#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QLabel>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_CLoraSettingsGui
{
public:
QLabel *label;
QGroupBox *groupBox;
QLabel *label_2;
QLabel *label_3;
QLabel *label_4;
QSpinBox *mLoraAddressSpinBx;
QComboBox *mComportComboBox;
QLabel *label_5;
QLabel *label_6;
void setupUi(QWidget *CLoraSettingsGui)
{
if (CLoraSettingsGui->objectName().isEmpty())
CLoraSettingsGui->setObjectName(QString::fromUtf8("CLoraSettingsGui"));
CLoraSettingsGui->resize(553, 413);
label = new QLabel(CLoraSettingsGui);
label->setObjectName(QString::fromUtf8("label"));
label->setGeometry(QRect(100, 10, 151, 16));
QFont font;
font.setPointSize(12);
label->setFont(font);
groupBox = new QGroupBox(CLoraSettingsGui);
groupBox->setObjectName(QString::fromUtf8("groupBox"));
groupBox->setGeometry(QRect(50, 120, 221, 191));
label_2 = new QLabel(groupBox);
label_2->setObjectName(QString::fromUtf8("label_2"));
label_2->setGeometry(QRect(10, 40, 71, 16));
label_3 = new QLabel(groupBox);
label_3->setObjectName(QString::fromUtf8("label_3"));
label_3->setGeometry(QRect(10, 20, 71, 16));
label_4 = new QLabel(groupBox);
label_4->setObjectName(QString::fromUtf8("label_4"));
label_4->setGeometry(QRect(90, 20, 71, 16));
mLoraAddressSpinBx = new QSpinBox(groupBox);
mLoraAddressSpinBx->setObjectName(QString::fromUtf8("mLoraAddressSpinBx"));
mLoraAddressSpinBx->setGeometry(QRect(90, 40, 71, 22));
mLoraAddressSpinBx->setMinimum(1);
mLoraAddressSpinBx->setMaximum(65535);
mLoraAddressSpinBx->setValue(6);
mComportComboBox = new QComboBox(groupBox);
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->addItem(QString());
mComportComboBox->setObjectName(QString::fromUtf8("mComportComboBox"));
mComportComboBox->setGeometry(QRect(80, 80, 69, 22));
label_5 = new QLabel(groupBox);
label_5->setObjectName(QString::fromUtf8("label_5"));
label_5->setGeometry(QRect(20, 80, 51, 16));
label_6 = new QLabel(groupBox);
label_6->setObjectName(QString::fromUtf8("label_6"));
label_6->setGeometry(QRect(20, 110, 91, 31));
retranslateUi(CLoraSettingsGui);
QMetaObject::connectSlotsByName(CLoraSettingsGui);
} // setupUi
void retranslateUi(QWidget *CLoraSettingsGui)
{
CLoraSettingsGui->setWindowTitle(QCoreApplication::translate("CLoraSettingsGui", "Form", nullptr));
label->setText(QCoreApplication::translate("CLoraSettingsGui", "Lora Settings", nullptr));
groupBox->setTitle(QCoreApplication::translate("CLoraSettingsGui", "Chalet", nullptr));
label_2->setText(QCoreApplication::translate("CLoraSettingsGui", "Lora Address:", nullptr));
label_3->setText(QCoreApplication::translate("CLoraSettingsGui", "Lora Channel:", nullptr));
label_4->setText(QCoreApplication::translate("CLoraSettingsGui", "4", nullptr));
mComportComboBox->setItemText(0, QCoreApplication::translate("CLoraSettingsGui", "COM1", nullptr));
mComportComboBox->setItemText(1, QCoreApplication::translate("CLoraSettingsGui", "COM2", nullptr));
mComportComboBox->setItemText(2, QCoreApplication::translate("CLoraSettingsGui", "COM3", nullptr));
mComportComboBox->setItemText(3, QCoreApplication::translate("CLoraSettingsGui", "COM4", nullptr));
mComportComboBox->setItemText(4, QCoreApplication::translate("CLoraSettingsGui", "COM5", nullptr));
mComportComboBox->setItemText(5, QCoreApplication::translate("CLoraSettingsGui", "COM6", nullptr));
mComportComboBox->setItemText(6, QCoreApplication::translate("CLoraSettingsGui", "COM7", nullptr));
mComportComboBox->setItemText(7, QCoreApplication::translate("CLoraSettingsGui", "COM8", nullptr));
mComportComboBox->setItemText(8, QCoreApplication::translate("CLoraSettingsGui", "COM9", nullptr));
mComportComboBox->setItemText(9, QCoreApplication::translate("CLoraSettingsGui", "COM10", nullptr));
label_5->setText(QCoreApplication::translate("CLoraSettingsGui", "Com Port:", nullptr));
label_6->setText(QCoreApplication::translate("CLoraSettingsGui", "Chalet = 7\n"
"Chaloupe = 8", nullptr));
} // retranslateUi
};
namespace Ui {
class CLoraSettingsGui: public Ui_CLoraSettingsGui {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_LORASETTINGSGUI_H