diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-EE07DF44-6B3B-5D9A-A794-C49863597721.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-EE07DF44-6B3B-5D9A-A794-C49863597721.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,81 @@ + + + + + +SUPL Push API TutorialThis topic describes how the Symbian SUPL WAP Push plug-in uses the SUPL Push API (deprecated). Device creators can use this information if they want to implement their own SUPL INIT push plug-in.

Read SUPL Protocol Module Overview and SUPL Push API before reading this document.

This document describes how the SUPL WAP Push plug-in uses the SUPL Push API.

Device creators only need to use the SUPL Push API to write their own SUPL INIT message handlers.

The Symbian WAP Push plug-in derives from CContentHandlerBase, the base class of push message handlers. It also implements MLbsSuplPushObserver to receive notification of SUPL INIT message delivery to the SUPL Protocol Module.

See <LBS_SOURCE_ROOT>/LbsSuplProtocolModule/SuplWapPush for the code for the WAP Push plug-in.

Define a SUPL INIT handler class The Symbian WAP Push plug-in derives from CContentHandlerBase to receive SUPL WAP Push messages. It implements MLbsSuplPushObserver to receive notification of successful message delivery to the SUPL Protocol Module. +NONSHARABLE_CLASS(CLbsSuplWapPush) : public CContentHandlerBase, public MLbsSuplPushObserver + { +public: + static CLbsSuplWapPush* NewL(); + virtual ~CLbsSuplWapPush(); + + virtual void OnSuplInitComplete(TLbsSuplPushChannel aChannel, TLbsSuplPushRequestId aReqId, + TInt aError, TInt aReserved); + + // From CPushHandlerBase + virtual void HandleMessageL(CPushMessage* aPushMsg); + + // Other methods of CContentHandlerBase omitted here... + +}; + The plug-in's ConstructL() creates a new instance of CLbsSuplPush. +// This handler uses the WAP channel +iSuplPush = CLbsSuplPush::NewL(ELbsSuplPushChannelWAP, *this); + Implement HandleMessageL() When the WAP Push plug-in receives a WAP Push message, it extracts the message body and calls CLbsSuplPush::SuplInit(). +void CLbsSuplWapPush::HandleMessageL(CPushMessage* aPushMsg) + { + LBSLOG(ELogP3, "SUPL WAP Push : CLbsSuplWapPush::HandleMessageL"); + if(aPushMsg) + { + TPtrC8 body; + TBool hasBody=aPushMsg->GetMessageBody(body); + if(hasBody) + { + TLbsSuplPushRequestId reqId; + TInt err=iSuplPush->SuplInit(reqId, body, 0); + if(KErrNone==err) + { + LBSLOG2(ELogP3,"SUPL WAP Push : Started to deliver the message, reqId=%d", reqId); + delete aPushMsg; + return; + } + else + { + LBSLOG2(ELogP3,"SUPL WAP Push : CLbsSuplPush::SuplInit failed, err=%d", err); + } + } + else + { + LBSLOG(ELogP3, "SUPL WAP Push : Empty message body, the message is skipped"); + } + delete aPushMsg; + } + else + { + LBSLOG(ELogP3, "SUPL WAP Push : Null message pointer, the message is skipped"); + } + iPluginKiller->KillPushPlugin(); + } + Implement MLbsSuplPushObserver::OnSuplInitComplete() When the SUPL Protocol Module processes the SUPL INIT message, the plug-in's MLbsSuplPushObserver::OnSuplInitComplete() method is called. The parameter aError may indicate a timeout or another error condition. The WAP Push plug-in is destroyed by the WAP Push Framework. Another instance of CLbsSuplWapPush is created by the framework to handle the next SUPL INIT received by WAP Push. +void CLbsSuplWapPush::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId aReqId, + TInt aError, TInt /*aReserved*/) + { + if(aError==KErrNone) + { + LBSLOG2(ELogP3,"SUPL WAP Push : Message delivered successfully, reqId=%d", aReqId); + } + else + { + LBSLOG3(ELogP3,"SUPL WAP Push : Message delivery failed, reqId=%d, err=%d", aReqId, aError); + } + iPluginKiller->KillPushPlugin(); + } +
SUPL Push + API
\ No newline at end of file