preparations for waking server on received packets
This commit is contained in:
parent
136fe90d4d
commit
f981fd466a
5 changed files with 35 additions and 5 deletions
|
@ -111,6 +111,7 @@ typedef unsigned int _MESSAGE_IDENT;
|
|||
#define MS_SOUND_OUT 2
|
||||
#define MS_JIT_BUF_PUT 3
|
||||
#define MS_JIT_BUF_GET 4
|
||||
#define MS_PACKET_RECEIVED 5
|
||||
|
||||
#define MUL_COL_LED_RED 0
|
||||
#define MUL_COL_LED_YELLOW 1
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
|
||||
/* Implementation *************************************************************/
|
||||
CServer::CServer () : Socket ( &ChannelSet )
|
||||
CServer::CServer () : Socket ( &ChannelSet, this )
|
||||
{
|
||||
vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES );
|
||||
|
||||
|
@ -155,3 +155,20 @@ bool CServer::GetTimingStdDev ( double& dCurTiStdDev )
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void CServer::customEvent(QCustomEvent* Event)
|
||||
{
|
||||
if (Event->type() == QEvent::User + 11)
|
||||
{
|
||||
const int iMessType = ((CLlconEvent*) Event)->iMessType;
|
||||
|
||||
switch(iMessType)
|
||||
{
|
||||
case MS_PACKET_RECEIVED:
|
||||
|
||||
printf("packet received\n");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ public:
|
|||
CChannelSet* GetChannelSet () { return &ChannelSet; }
|
||||
|
||||
protected:
|
||||
CVector<short> ProcessData ( CVector<CVector<double> >& vecvecdData );
|
||||
CVector<short> ProcessData ( CVector<CVector<double> >& vecvecdData );
|
||||
virtual void customEvent ( QCustomEvent* Event );
|
||||
|
||||
QTimer Timer;
|
||||
CVector<short> vecsSendData;
|
||||
|
|
|
@ -126,6 +126,15 @@ void CSocket::OnDataReceived ()
|
|||
else
|
||||
{
|
||||
/* server */
|
||||
// a packet was received, tell the server object to wake up if it
|
||||
// is in sleep mode
|
||||
CLlconEvent* LlconEv =
|
||||
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 );
|
||||
|
||||
/* Qt will delete the event object when done */
|
||||
QThread::postEvent ( pServer, LlconEv );
|
||||
|
||||
|
||||
pChannelSet->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,8 @@ public:
|
|||
CSocket::CSocket(CChannel* pNewChannel) : pChannel(pNewChannel),
|
||||
SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(true)
|
||||
{Init();}
|
||||
CSocket::CSocket(CChannelSet* pNewChannelSet) : pChannelSet(pNewChannelSet),
|
||||
CSocket::CSocket(CChannelSet* pNewChannelSet, QObject* pNServP) :
|
||||
pChannelSet(pNewChannelSet), pServer ( pNServP ),
|
||||
SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(false)
|
||||
{Init();}
|
||||
virtual ~CSocket() {}
|
||||
|
@ -68,6 +69,7 @@ protected:
|
|||
|
||||
CChannel* pChannel; /* for client */
|
||||
CChannelSet* pChannelSet; /* for server */
|
||||
QObject* pServer;
|
||||
bool bIsClient;
|
||||
|
||||
public slots:
|
||||
|
|
Loading…
Reference in a new issue