?? gdpqueue.cpp
字號:
// gdpqueue.cpp
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
//
#include "gdpqueue.h"
#include <ImplementationProxy.h>
#include <ecom.h>
// game datagram protocol - loopback with queuing
class CSendTimer : public CTimer
{
public:
static CSendTimer* NewL(CGdpQueue* aQ);
CSendTimer(CGdpQueue* aQ) : CTimer(0), iQ(aQ) {CActiveScheduler::Add(this);};
void RunL() {iQ->FinishSend();};
CGdpQueue* iQ;
};
CSendTimer* CSendTimer::NewL(CGdpQueue* aQ)
{
CSendTimer* self = new (ELeave) CSendTimer(aQ);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
CGdpQueue::CGdpQueue()
{
}
CGdpQueue::~CGdpQueue()
{
delete iTimer;
REComSession::DestroyedImplementation(iDtor_ID_Key);
}
void CGdpQueue::OpenL(MGdpPacketHandler* aHandler) // start up, and set handler for packets received
{
iHandler=aHandler;
}
void CGdpQueue::SendL(const TDesC8& aToAddress, const TDesC8& aData) // send packet
{
iAddress = aToAddress;
iData = aData;
iTimer->After(1000000); // 1sec
}
void CGdpQueue::FinishSend()
{
iHandler->GdpHandleL(iAddress, iData); // loop back to handler
}
TInt CGdpQueue::ReceiveAll() // do a pull if necessary
{
return KErrNone;
}
TInt CGdpQueue::GetMaxPacketLength() const
{
return 255;
}
TInt CGdpQueue::IsNetworked() const
{
return EFalse;
}
void CGdpQueue::ConstructL()
{
iTimer = CSendTimer::NewL(this);
}
CGdpSession* CGdpQueue::NewL()
{
CGdpQueue* self=new (ELeave) CGdpQueue();
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
// Define the interface UIDs
const TImplementationProxy ImplementationTable[] =
{
{{0x101f8b5a}, CGdpQueue::NewL},
};
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
{
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
return ImplementationTable;
}
TInt E32Dll(TDllReason)
{
return KErrNone;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -