Réglé le problème de VOIP.ms Client.
Il a fallu que j'ajoute les DLL d'OPENSSL...
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#include "ChaletLoraDevice.h"
|
||||
#include <QSerialPortInfo>
|
||||
#include <QObject>
|
||||
|
||||
CChaletLoraDevice::CChaletLoraDevice()
|
||||
{
|
||||
mMyLoraAddress = 5;
|
||||
mMyLoraChannel = 4;
|
||||
|
||||
QByteArray Test;
|
||||
Test.resize(4);
|
||||
Test[0] = 0xDE;
|
||||
Test[1] = 0xAD;
|
||||
Test[2] = 0xBE;
|
||||
Test[3] = 0xEF;
|
||||
|
||||
GetLoraFrame(4,4,Test);
|
||||
|
||||
mLoraStatusRefreshTimer = new QTimer;
|
||||
mLoraStatusRefreshTimer->setInterval(1000);
|
||||
mLoraStatusRefreshTimer->setSingleShot(false);
|
||||
connect(mLoraStatusRefreshTimer,SIGNAL(timeout()),this,SLOT(LoraStatusRefreshTimerExpired()));
|
||||
|
||||
mLoraStatusRefreshTimer->start();
|
||||
|
||||
}
|
||||
|
||||
CChaletLoraDevice::~CChaletLoraDevice()
|
||||
{
|
||||
mLoraStatusRefreshTimer->stop();
|
||||
delete mLoraStatusRefreshTimer;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::Init()
|
||||
{
|
||||
QList<QSerialPortInfo> PortsList = QSerialPortInfo::availablePorts();
|
||||
|
||||
for(int i = 0; i < PortsList.size(); i++)
|
||||
{
|
||||
qDebug("Port found: %s - %s",qPrintable(PortsList.at(i).portName()),qPrintable(PortsList.at(i).description()));
|
||||
|
||||
}
|
||||
|
||||
mLoraModuleSerialPort.setPortName("COM3");
|
||||
mLoraModuleSerialPort.setBaudRate(QSerialPort::Baud9600);
|
||||
mLoraModuleSerialPort.setDataBits(QSerialPort::Data8);
|
||||
mLoraModuleSerialPort.setParity(QSerialPort::NoParity);
|
||||
mLoraModuleSerialPort.setFlowControl(QSerialPort::NoFlowControl);
|
||||
if(mLoraModuleSerialPort.open(QIODevice::ReadWrite) == false)
|
||||
{
|
||||
qDebug("Could not open Chalet Lora serial port");
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
QByteArray Test;
|
||||
Test.resize(5);
|
||||
Test[0] = 0xDE;
|
||||
Test[1] = 0xAD;
|
||||
Test[2] = 0xBE;
|
||||
Test[3] = 0xEF;
|
||||
Test[4] = '\r';
|
||||
|
||||
GetLoraFrame(4,4,Test);
|
||||
|
||||
mLoraModuleSerialPort.write(GetLoraFrame(4,4,Test));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CChaletLoraDevice::LoraStatusRefreshTimerExpired()
|
||||
{
|
||||
QByteArray Test;
|
||||
Test.resize(4);
|
||||
Test[0] = 0xBA;
|
||||
Test[1] = 0xAD;
|
||||
Test[2] = 0xCA;
|
||||
Test[3] = 0xFE;
|
||||
// Test[4] = '\r';
|
||||
|
||||
GetLoraFrame(4,4,Test);
|
||||
|
||||
mLoraModuleSerialPort.write(GetLoraFrame(4,4,Test));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef CCHALETLORADEVICE_H
|
||||
#define CCHALETLORADEVICE_H
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include "LoraDevice.h"
|
||||
#include <QSerialPort>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
class CChaletLoraDevice : public QObject, public CLoraDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CChaletLoraDevice();
|
||||
~CChaletLoraDevice();
|
||||
int Init();
|
||||
QTimer *mLoraStatusRefreshTimer;
|
||||
|
||||
|
||||
private:
|
||||
QSerialPort mLoraModuleSerialPort;
|
||||
|
||||
public slots:
|
||||
void LoraStatusRefreshTimerExpired();
|
||||
};
|
||||
|
||||
#endif // CCHALETLORADEVICE_H
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "LoraDevice.h"
|
||||
|
||||
CLoraDevice::CLoraDevice()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QByteArray CLoraDevice::GetLoraFrame(unsigned short DestAddress, unsigned char DestChannel, QByteArray Payload)
|
||||
{
|
||||
QByteArray OutputFrame;
|
||||
OutputFrame.clear();
|
||||
|
||||
//E32 modules frame is [Address_MSB][Address_LSB][Channel][Payload]
|
||||
|
||||
|
||||
|
||||
char AddressByte = (char)((DestAddress >> 8) & 0x00FF);
|
||||
OutputFrame.append(AddressByte);
|
||||
AddressByte = (char)(DestAddress & 0x00FF);
|
||||
OutputFrame.append(AddressByte);
|
||||
OutputFrame.append(DestChannel);
|
||||
OutputFrame.append(Payload);
|
||||
|
||||
return OutputFrame;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef CLORADEVICE_H
|
||||
#define CLORADEVICE_H
|
||||
#include <QByteArray>
|
||||
|
||||
class CLoraDevice
|
||||
{
|
||||
public:
|
||||
CLoraDevice();
|
||||
|
||||
unsigned short mMyLoraAddress;
|
||||
unsigned char mMyLoraChannel;
|
||||
|
||||
QByteArray GetLoraFrame(unsigned short DestAddress,unsigned char DestChannel,QByteArray Payload);
|
||||
};
|
||||
|
||||
#endif // CLORADEVICE_H
|
||||
Reference in New Issue
Block a user