Transfert de gestion du Z2 lock au MasterCtrl
This commit is contained in:
parent
074d72f030
commit
5418af7ddc
Binary file not shown.
@ -26,6 +26,7 @@ CAVReceiverDevice::CAVReceiverDevice()
|
||||
mReceiverSocket = new QTcpSocket;
|
||||
mDisconnectTimer = new QTimer;
|
||||
mStateRequestTimer = new QTimer;
|
||||
// mSyncDelayTimer = new QTimer;
|
||||
|
||||
mDisconnectTimer->setSingleShot(true);
|
||||
mDisconnectTimer->stop();
|
||||
@ -33,6 +34,9 @@ CAVReceiverDevice::CAVReceiverDevice()
|
||||
mStateRequestTimer->setSingleShot(true);
|
||||
mStateRequestTimer->setInterval(RECEIVER_STATE_UPDATE_TIMEOUT);
|
||||
|
||||
// mSyncDelayTimer->setSingleShot(true);
|
||||
// mSyncDelayTimer->setInterval(500);
|
||||
|
||||
|
||||
connect(mDisconnectTimer,SIGNAL(timeout()),this,SLOT(DisconnectTimerExpired()));
|
||||
|
||||
@ -41,6 +45,8 @@ CAVReceiverDevice::CAVReceiverDevice()
|
||||
connect(mReceiverSocket,SIGNAL(readyRead()),this,SLOT(SocketRX()));
|
||||
|
||||
connect(mStateRequestTimer,SIGNAL(timeout()),this,SLOT(StateRequestTimerExpired()));
|
||||
|
||||
// connect(mSyncDelayTimer,&QTimer::timeout,this,&CAVReceiverDevice::SyncTimerExpired);
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +58,7 @@ CAVReceiverDevice::~CAVReceiverDevice()
|
||||
delete mReceiverSocket;
|
||||
delete mDisconnectTimer;
|
||||
delete mStateRequestTimer;
|
||||
delete mSyncDelayTimer;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::Start()
|
||||
@ -279,6 +286,7 @@ int CAVReceiverDevice::SetZone2(bool OnOff)
|
||||
Cmd += "Standby\r\n";
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
|
||||
DisconnectReceiverDelayed();
|
||||
return RET_OK;
|
||||
}
|
||||
@ -381,7 +389,14 @@ QByteArray CAVReceiverDevice::GetReceiverStatus()
|
||||
Strm << mReceiverStatus
|
||||
<< mZone2Status ;
|
||||
|
||||
if(mReceiverStatus.mSyncZonesVolumes == true &&
|
||||
( (mReceiverStatus.mMainVolume != mLastMainZoneVolume) ||
|
||||
(mReceiverStatus.mMainVolume != mZone2Status.mMainVolume)))
|
||||
{
|
||||
SetZone2Volume(mReceiverStatus.mMainVolume);
|
||||
}
|
||||
|
||||
mLastMainZoneVolume = mReceiverStatus.mMainVolume;
|
||||
return StatusArray;
|
||||
}
|
||||
|
||||
@ -418,6 +433,11 @@ int CAVReceiverDevice::SetMainVolume(float Volume)
|
||||
SendReceiverCommand(Cmd);
|
||||
// DisconnectReceiverDelayed();
|
||||
|
||||
if(mReceiverStatus.mSyncZonesVolumes == true)
|
||||
{
|
||||
SetZone2Volume(Volume);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -430,3 +450,23 @@ int CAVReceiverDevice::SetZone2Volume(float Volume)
|
||||
// DisconnectReceiverDelayed();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SetZone2Input(QString InputString)
|
||||
{
|
||||
QString Cmd;
|
||||
Cmd = QString("@ZONE2:INP=%1\r\n").arg(InputString);
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SetSyncZ2withZ1(bool Sync)
|
||||
{
|
||||
mReceiverStatus.mSyncZonesVolumes = Sync;
|
||||
if(Sync == true)
|
||||
{
|
||||
SetZone2Volume(mReceiverStatus.mMainVolume);
|
||||
}
|
||||
// qDebug("Sync Z2 with Z1: %d",Sync);
|
||||
}
|
||||
|
||||
@ -48,7 +48,20 @@ enum eReceiverSubUnits
|
||||
IPODUSB
|
||||
};
|
||||
|
||||
class CAVReceiverDevice : QObject
|
||||
enum eReceiverZone2Inputs
|
||||
{
|
||||
AUDIO1,
|
||||
AUDIO2,
|
||||
AUDIO3,
|
||||
AUDIO4,
|
||||
AUDIO5,
|
||||
PHONO,
|
||||
TUNER,
|
||||
SERVER,
|
||||
MAIN_ZONE_SYNC
|
||||
};
|
||||
|
||||
class CAVReceiverDevice :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -74,17 +87,20 @@ public:
|
||||
int SelectScene(char Zone, char Scene);
|
||||
int SetMainVolume(float Volume);
|
||||
int SetZone2Volume(float Volume);
|
||||
int SetZone2Input(QString InputString);
|
||||
int SetSyncZ2withZ1(bool Sync);
|
||||
QByteArray GetReceiverStatus();
|
||||
|
||||
private:
|
||||
QTcpSocket *mReceiverSocket;
|
||||
int AnalyseRxData(QByteArray data);
|
||||
QTimer *mDisconnectTimer, *mStateRequestTimer;
|
||||
QTimer *mDisconnectTimer, *mStateRequestTimer, *mSyncDelayTimer;
|
||||
CAvReceiverMainStatus mReceiverStatus;
|
||||
CAvReceiverMainStatus mZone2Status;
|
||||
|
||||
bool mIsConnected;
|
||||
QString mPendingCommand;
|
||||
float mLastMainZoneVolume;
|
||||
|
||||
|
||||
public slots:
|
||||
@ -93,6 +109,7 @@ public slots:
|
||||
void SocketRX();
|
||||
void DisconnectTimerExpired();
|
||||
void StateRequestTimerExpired();
|
||||
// void SyncTimerExpired();
|
||||
};
|
||||
|
||||
#endif // AVRECEIVERDEVICE_H
|
||||
|
||||
@ -5,6 +5,7 @@ CAvReceiverMainStatus::CAvReceiverMainStatus()
|
||||
{
|
||||
mDataValid = false;
|
||||
mReceiverOnline = false;
|
||||
mSyncZonesVolumes = true;
|
||||
}
|
||||
|
||||
QByteArray CAvReceiverMainStatus::ToByteArray()
|
||||
@ -23,6 +24,7 @@ QByteArray CAvReceiverMainStatus::ToByteArray()
|
||||
|
||||
Strm << mDataValid;
|
||||
Strm << mReceiverOnline;
|
||||
Strm << mSyncZonesVolumes;
|
||||
|
||||
return Output;
|
||||
|
||||
@ -42,6 +44,7 @@ int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
|
||||
|
||||
Strm >> mDataValid;
|
||||
Strm >> mReceiverOnline;
|
||||
Strm >> mSyncZonesVolumes;
|
||||
|
||||
return RET_OK;
|
||||
|
||||
@ -55,7 +58,8 @@ QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source)
|
||||
<< source.mInput
|
||||
<< source.mProgram
|
||||
<< source.mDataValid
|
||||
<< source.mReceiverOnline;
|
||||
<< source.mReceiverOnline
|
||||
<< source.mSyncZonesVolumes;
|
||||
|
||||
return out;
|
||||
}
|
||||
@ -69,6 +73,7 @@ QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest)
|
||||
>> dest.mInput
|
||||
>> dest.mProgram
|
||||
>> dest.mDataValid
|
||||
>> dest.mReceiverOnline;
|
||||
>> dest.mReceiverOnline
|
||||
>> dest.mSyncZonesVolumes;
|
||||
return in;
|
||||
}
|
||||
|
||||
@ -26,10 +26,10 @@ public:
|
||||
bool mIsMute;
|
||||
QString mInput;
|
||||
QString mProgram;
|
||||
bool mSyncZonesVolumes;
|
||||
|
||||
bool mDataValid;
|
||||
bool mReceiverOnline;
|
||||
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source);
|
||||
|
||||
@ -77,6 +77,24 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
|
||||
mAvReceiverDevice->SetZone2Volume(VolumeData);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST:
|
||||
{
|
||||
QString Source;
|
||||
QDataStream Strm(&Data,QIODevice::ReadOnly);
|
||||
Strm >> Source;
|
||||
|
||||
mAvReceiverDevice->SetZone2Input(Source);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_REQUEST:
|
||||
{
|
||||
bool Sync;
|
||||
QDataStream Strm(&Data,QIODevice::ReadOnly);
|
||||
Strm >> Sync;
|
||||
|
||||
mAvReceiverDevice->SetSyncZ2withZ1(Sync);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE:
|
||||
@ -86,6 +104,8 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
|
||||
case AV_RECEIVER_INTERFACE_SELECT_SCENE_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_RESPONSE:
|
||||
default:
|
||||
{
|
||||
qDebug("Received invalid msg from Sprinkler Interface");
|
||||
|
||||
@ -257,7 +257,7 @@ void CChaletLoraDevice::CommTimerExpired()
|
||||
if(mPendingNetworkMsgList.first().PendingResponse == true)
|
||||
{
|
||||
//The current command is still waiting for a response. Check how many times we tried to send it
|
||||
qDebug("Cmd 0x%x timetout... retrying",mPendingNetworkMsgList.first().mMessageID);
|
||||
// qDebug("Cmd 0x%x timetout... retrying",mPendingNetworkMsgList.first().mMessageID);
|
||||
if(mPendingNetworkMsgList.first().ResendCounter >= 2)
|
||||
{
|
||||
//After 2 retries, declare module offline, clear the send buffer and start sending status requests...
|
||||
|
||||
@ -6,7 +6,7 @@ CIspindelDevice::CIspindelDevice()
|
||||
{
|
||||
mISpindelServer = new QTcpServer;
|
||||
connect(mISpindelServer,SIGNAL(newConnection()),this,SLOT(IspindelClientConnected()));
|
||||
mISpindelServer->listen(QHostAddress::Any,90);
|
||||
mISpindelServer->listen(QHostAddress::Any,95);
|
||||
|
||||
mIspindelLog.clear();
|
||||
mDataLogger.LoadLogData(&mIspindelLog);
|
||||
@ -80,7 +80,7 @@ void CIspindelDevice::IspindelClientDataAvail()
|
||||
|
||||
void CIspindelDevice::IspindelClientDisconnected()
|
||||
{
|
||||
|
||||
qDebug("Ispindel disconnected");
|
||||
}
|
||||
|
||||
CIspindelDevice::~CIspindelDevice()
|
||||
|
||||
@ -252,6 +252,10 @@ enum AV_RECEIVER_INTERFACE_CMDS
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_RESPONSE,
|
||||
|
||||
|
||||
MAX_AV_RECEIVER_INTERFACE_CMD
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user