Nouvel Ampli

Lora Interface
This commit is contained in:
2022-12-20 13:00:16 -05:00
parent a98f292e65
commit ac4e5aeb93
11 changed files with 183 additions and 7 deletions
+45
View File
@@ -385,3 +385,48 @@ QByteArray CAVReceiverDevice::GetReceiverStatus()
return StatusArray;
}
int CAVReceiverDevice::SelectScene(char Zone, char Scene)
{
QString Cmd;
if(Zone == AV_RECEIVER_MAIN_ZONE)
{
Cmd = QString("@MAIN:SCENE=Scene %1\r\n").arg((int)Scene,1);
}
else if(Zone == AV_RECEIVER_ZONE_2)
{
Cmd = QString("@ZONE2:SCENE=Scene %1\r\n").arg((int)Scene,1);
}
else
{
return RET_ERROR;
}
SendReceiverCommand(Cmd);
DisconnectReceiverDelayed(2000);
return RET_OK;
}
int CAVReceiverDevice::SetMainVolume(float Volume)
{
QString Cmd;
Cmd = QString("@MAIN:VOL=%1\r\n").arg(Volume,1,'f',1);
// qDebug("%s",qPrintable(Cmd));
SendReceiverCommand(Cmd);
// DisconnectReceiverDelayed();
return RET_OK;
}
int CAVReceiverDevice::SetZone2Volume(float Volume)
{
QString Cmd;
Cmd = QString("@ZONE2:VOL=%1\r\n").arg(Volume,1,'f',1);
SendReceiverCommand(Cmd);
// DisconnectReceiverDelayed();
return RET_OK;
}
+3
View File
@@ -71,6 +71,9 @@ public:
int SetMainZone(bool OnOff);
int SetSpeakers(int SpeakerA, int SpeakerB);
int SendRawCommand(QString Cmd);
int SelectScene(char Zone, char Scene);
int SetMainVolume(float Volume);
int SetZone2Volume(float Volume);
QByteArray GetReceiverStatus();
private:
+7
View File
@@ -3,6 +3,13 @@
#include <QString>
#include "GlobalDefine.h"
enum eAVReceiverZones
{
AV_RECEIVER_MAIN_ZONE = 1,
AV_RECEIVER_ZONE_2,
AV_RECEIVER_MAX_ZONE
};
class CAvReceiverMainStatus
{
@@ -1,6 +1,7 @@
#include "AvReceiverInterface.h"
#include "ProtocolDefs.h"
#include "AVReceiverDevice.h"
#include <QDataStream>
CAvReceiverInterface::CAvReceiverInterface(int Address, CAbstractNetworkCommIF *NetworkInterface , CAVReceiverDevice *DevicePtr):
CNetworkDevice(ID_AVRECEIVER_INTERFACE,Address,NetworkInterface)
@@ -53,12 +54,38 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
{
break;
}
case AV_RECEIVER_INTERFACE_SELECT_SCENE_REQUEST:
{
mAvReceiverDevice->SelectScene(Data[0],Data[1]);
break;
}
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST:
{
float VolumeData;
QDataStream Strm(&Data,QIODevice::ReadOnly);
Strm >> VolumeData;
mAvReceiverDevice->SetMainVolume(VolumeData);
break;
}
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST:
{
float VolumeData;
QDataStream Strm(&Data,QIODevice::ReadOnly);
Strm >> VolumeData;
mAvReceiverDevice->SetZone2Volume(VolumeData);
break;
}
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE:
case AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_RESPONSE:
case AV_RECEIVER_INTERFACE_SELECT_SCENE_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE:
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE:
default:
{
qDebug("Received invalid msg from Sprinkler Interface");