#include "AvReceiverData.h"
#include <QDataStream>

CAvReceiverMainStatus::CAvReceiverMainStatus()
{
   mDataValid = false;
   mReceiverOnline = false;
}

QByteArray CAvReceiverMainStatus::ToByteArray()
{

    QByteArray Output;
    Output.clear();
    QDataStream Strm(&Output,QIODevice::WriteOnly);

    Strm << mMainPwrStatus;
    Strm <<  mMainSleepStatus;
    Strm <<  mMainVolume;
    Strm <<  mIsMute;
    Strm <<  mInput;
    Strm <<  mProgram;
    Strm <<  mSpeakerAState;
    Strm <<  mSpeakerBState;

    Strm <<  mDataValid;
    Strm <<  mReceiverOnline;

   return Output;

}

int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
{
    QDataStream Strm(Data);
    Strm.device()->seek(0);

    Strm >> mMainPwrStatus;
    Strm >>  mMainSleepStatus;
    Strm >>  mMainVolume;
    Strm >>  mIsMute;
    Strm >>  mInput;
    Strm >>  mProgram;
    Strm >>  mSpeakerAState;
    Strm >>  mSpeakerBState;

    Strm >>  mDataValid;
    Strm >>  mReceiverOnline;

    return RET_OK;

}
