📄 datagramservice.h
字号:
// DatagramService.h
//
// Copyright (c) 2003 Symbian Ltd. All rights reserved.
//
#ifndef __DATAGRAMSERVICE_H__
#define __DATAGRAMSERVICE_H__
#include <e32base.h>
#include <e32std.h>
/** DatagramService ECOM UID */
const TUid KDatagramServiceInterfaceUID = {0x101FA9C1};
// Forward Declarations
class CDatagram;
/* class CDatagramService
*/
class CDatagramService : public CBase
/**
@publishedAll
Creates an appropriate CDatagramService derived object via ECOM
Comments : A generic Datagram Service API. Users of CDatagramService derived
classes must use an active scheduler/active object when using asynchronous
versions of the Send and Receieve functions.
*/
{
public:
// ECOM Specific
IMPORT_C static CDatagramService* NewL(const TUid aImplementationUid);
inline TUid Uid() const {return iDtor_ID_Key;};
IMPORT_C virtual void SendL(CDatagram* aDatagram, TRequestStatus& aStatus)=0;
/**
Send a Datagram asynchronously. Requires an active scheduler
@param aDatagram CDatagram to be sent via the CDatagramService
@param aStatus TRequestStatus notified of Send completion
@capability NetworkServices (for SMS datagrams)
@capability ReadUserData (for SMS datagrams)
*/
IMPORT_C virtual void ReceiveL(CDatagram* aDatagram, const TDesC8& aRecvParams, TRequestStatus& aStatus)=0;
/**
Receive a Datagram asynchronously. Requires an active scheduler
@param aDatagram CDatagram which will be populated by CDatagramService
@param aRecvParams Paramaters required for identification of incoming messages.
Specific to each Datagram Service
@param aStatus TRequestStatus notified of Receive completion
@capability NetworkServices (for SMS datagrams)
@capability ReadUserData (for SMS datagrams)
*/
protected:
IMPORT_C CDatagramService();
/** ECOM Instance key idenfifier*/
TUid iDtor_ID_Key;
private:
IMPORT_C CDatagramService(const CDatagramService& );
};
/* class CDatagram
Send and Receive data storage
*/
class CDatagram : public CBase
/**
@publishedAll
Comments : The API for a single datagram to be sent via a Datagram Service, or as a receptical
for an incoming datagram. .
*/
{
public:
IMPORT_C static CDatagram* NewL(TDesC& aBuf);
IMPORT_C static CDatagram* NewL(const TDesC& aBuf, const TDesC8& aAddress);
IMPORT_C virtual ~CDatagram();
// Accessors/mutators
IMPORT_C virtual const TDesC8& GetAddress();
IMPORT_C virtual void SetAddressL(const TDesC8& aAddress);
IMPORT_C virtual const TDesC& GetData();
IMPORT_C virtual void SetDataL(const TDesC& aData);
private:
void ConstructL(const TDesC& aBuf);
private:
/** Buffer for the incoming outgoing message */
HBufC* iData;
/** Buffer for the outgoing address */
HBufC8* iAddress;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -