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
|
@ -110,7 +110,8 @@ typedef unsigned int _MESSAGE_IDENT;
|
||||||
#define MS_SOUND_IN 1
|
#define MS_SOUND_IN 1
|
||||||
#define MS_SOUND_OUT 2
|
#define MS_SOUND_OUT 2
|
||||||
#define MS_JIT_BUF_PUT 3
|
#define MS_JIT_BUF_PUT 3
|
||||||
#define MS_JIT_BUF_GET 4
|
#define MS_JIT_BUF_GET 4
|
||||||
|
#define MS_PACKET_RECEIVED 5
|
||||||
|
|
||||||
#define MUL_COL_LED_RED 0
|
#define MUL_COL_LED_RED 0
|
||||||
#define MUL_COL_LED_YELLOW 1
|
#define MUL_COL_LED_YELLOW 1
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CServer::CServer () : Socket ( &ChannelSet )
|
CServer::CServer () : Socket ( &ChannelSet, this )
|
||||||
{
|
{
|
||||||
vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES );
|
vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES );
|
||||||
|
|
||||||
|
@ -155,3 +155,20 @@ bool CServer::GetTimingStdDev ( double& dCurTiStdDev )
|
||||||
return false;
|
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; }
|
CChannelSet* GetChannelSet () { return &ChannelSet; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CVector<short> ProcessData ( CVector<CVector<double> >& vecvecdData );
|
CVector<short> ProcessData ( CVector<CVector<double> >& vecvecdData );
|
||||||
|
virtual void customEvent ( QCustomEvent* Event );
|
||||||
|
|
||||||
QTimer Timer;
|
QTimer Timer;
|
||||||
CVector<short> vecsSendData;
|
CVector<short> vecsSendData;
|
||||||
|
|
|
@ -126,6 +126,15 @@ void CSocket::OnDataReceived ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* server */
|
/* 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 );
|
pChannelSet->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,8 @@ public:
|
||||||
CSocket::CSocket(CChannel* pNewChannel) : pChannel(pNewChannel),
|
CSocket::CSocket(CChannel* pNewChannel) : pChannel(pNewChannel),
|
||||||
SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(true)
|
SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(true)
|
||||||
{Init();}
|
{Init();}
|
||||||
CSocket::CSocket(CChannelSet* pNewChannelSet) : pChannelSet(pNewChannelSet),
|
CSocket::CSocket(CChannelSet* pNewChannelSet, QObject* pNServP) :
|
||||||
|
pChannelSet(pNewChannelSet), pServer ( pNServP ),
|
||||||
SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(false)
|
SocketDevice(QSocketDevice::Datagram /* UDP */), bIsClient(false)
|
||||||
{Init();}
|
{Init();}
|
||||||
virtual ~CSocket() {}
|
virtual ~CSocket() {}
|
||||||
|
@ -67,7 +68,8 @@ protected:
|
||||||
CHostAddress RecHostAddr;
|
CHostAddress RecHostAddr;
|
||||||
|
|
||||||
CChannel* pChannel; /* for client */
|
CChannel* pChannel; /* for client */
|
||||||
CChannelSet* pChannelSet; /* for server */
|
CChannelSet* pChannelSet; /* for server */
|
||||||
|
QObject* pServer;
|
||||||
bool bIsClient;
|
bool bIsClient;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Reference in a new issue