syncmlfw/ds/wappushalert/src/nsmldswappushalert.cpp
changeset 0 b497e44ab2fc
child 1 a9c0ce913924
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Ecom plug-in for x-wap-application:push.syncml application ID
       
    15 *                          
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDES
       
    21 //
       
    22 #include <e32base.h>
       
    23 #include <pushlog.h>
       
    24 #include <pushmessage.h>
       
    25 #include <pluginkiller.h>
       
    26 #include <pushdispatcher.h>
       
    27 #include <ccontenthandlerbase.h>
       
    28 #include <implementationproxy.h> // For TImplementationProxy definition
       
    29 
       
    30 #include <nsmlconstants.h>
       
    31 #include <nsmldebug.h>
       
    32 #include <nsmlsyncalerthandlerif.h>
       
    33 #include "nsmldswappushalert.h"
       
    34 
       
    35 // -----------------------------------------------------------
       
    36 // Constants
       
    37 // -----------------------------------------------------------
       
    38 const TUint KNSmlDSAlertImplUid = 0x101F99EC;
       
    39 
       
    40 
       
    41 // ------------------------------------------------------------------------------------------------
       
    42 // CNSmlDSWapPushAlert* CNSmlDSWapPushAlert::NewL()
       
    43 // ------------------------------------------------------------------------------------------------
       
    44 CNSmlDSWapPushAlert* CNSmlDSWapPushAlert::NewL()
       
    45 	{
       
    46 	CNSmlDSWapPushAlert* self = new (ELeave) CNSmlDSWapPushAlert;
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 // ------------------------------------------------------------------------------------------------
       
    51 // CNSmlDSWapPushAlert::~CNSmlDSWapPushAlert()
       
    52 // ------------------------------------------------------------------------------------------------
       
    53 CNSmlDSWapPushAlert::~CNSmlDSWapPushAlert()
       
    54 	{
       
    55 	}
       
    56 
       
    57 // ------------------------------------------------------------------------------------------------
       
    58 // CNSmlDSWapPushAlert::CNSmlDSWapPushAlert()
       
    59 // ------------------------------------------------------------------------------------------------
       
    60 CNSmlDSWapPushAlert::CNSmlDSWapPushAlert()
       
    61 : CPushHandlerBase()
       
    62 	{
       
    63 	CActiveScheduler::Add(this);
       
    64 	}
       
    65 // ------------------------------------------------------------------------------------------------
       
    66 // CNSmlDSWapPushAlert::ProcessMessageL()
       
    67 // ------------------------------------------------------------------------------------------------
       
    68 void CNSmlDSWapPushAlert::ProcessMessageL(const CPushMessage& aPushMsg) 
       
    69 	{
       
    70 	TPtrC8 messageBody;
       
    71 	if ( aPushMsg.GetMessageBody( messageBody ) )
       
    72 		{
       
    73 		CNSmlSyncAlertHandler* alert;
       
    74 		TUid uid;
       
    75 		uid.iUid = KNSmlDSAlertImplUid;
       
    76 		alert = CNSmlSyncAlertHandler::NewL( uid );
       
    77 		if ( alert )
       
    78 			{
       
    79 			CleanupStack::PushL( alert );
       
    80 			// Only first and second parameter means in StartSyncL call
       
    81 			alert->StartSyncL( messageBody, KUidNSmlMediumTypeInternet.iUid, TBTDevAddr(), KNullDesC16, 0 );
       
    82 			CleanupStack::PopAndDestroy( alert );
       
    83 			}
       
    84 		}
       
    85 	}
       
    86 // ------------------------------------------------------------------------------------------------
       
    87 // CNSmlDSWapPushAlert::HandleMessageL()
       
    88 // ------------------------------------------------------------------------------------------------
       
    89 void CNSmlDSWapPushAlert::HandleMessageL(CPushMessage* aPushMsg, TRequestStatus& aStatus)
       
    90 	{
       
    91 	 _DBG_FILE("CNSmlDSWapPushAlert::HandleMessageL() Async Func begins"); 	
       
    92 
       
    93 	SetConfirmationStatus(aStatus);
       
    94 	
       
    95 	ProcessMessageL( *aPushMsg );
       
    96 	
       
    97 	SetActive();
       
    98 	}
       
    99 
       
   100 // ------------------------------------------------------------------------------------------------
       
   101 // CNSmlDSWapPushAlert::CancelHandleMessage()
       
   102 // ------------------------------------------------------------------------------------------------
       
   103 void CNSmlDSWapPushAlert::CancelHandleMessage()
       
   104 	{
       
   105 	}
       
   106 
       
   107 // ------------------------------------------------------------------------------------------------
       
   108 // CNSmlDSWapPushAlert::HandleMessageL()
       
   109 // ------------------------------------------------------------------------------------------------
       
   110 void CNSmlDSWapPushAlert::HandleMessageL(CPushMessage* aPushMsg)
       
   111 	{
       
   112 	 _DBG_FILE("CNSmlDSWapPushAlert::HandleMessageL() Sync Func begins"); 	
       
   113 	
       
   114 	ProcessMessageL( *aPushMsg );
       
   115 	
       
   116 	iPluginKiller->KillPushPlugin();
       
   117 	}
       
   118 
       
   119 // ------------------------------------------------------------------------------------------------
       
   120 // CNSmlDSWapPushAlert::CPushHandlerBase_Reserved1()
       
   121 // ------------------------------------------------------------------------------------------------
       
   122 void CNSmlDSWapPushAlert::CPushHandlerBase_Reserved1()
       
   123 	{
       
   124 	}
       
   125 
       
   126 // ------------------------------------------------------------------------------------------------
       
   127 // CNSmlDSWapPushAlert::CPushHandlerBase_Reserved2()
       
   128 // ------------------------------------------------------------------------------------------------
       
   129 void CNSmlDSWapPushAlert::CPushHandlerBase_Reserved2()
       
   130 	{
       
   131 	}
       
   132 
       
   133 // ------------------------------------------------------------------------------------------------
       
   134 // CNSmlDSWapPushAlert::DoCancel()
       
   135 // ------------------------------------------------------------------------------------------------
       
   136 void CNSmlDSWapPushAlert::DoCancel()
       
   137 	{
       
   138 	}
       
   139 
       
   140 // ------------------------------------------------------------------------------------------------
       
   141 // CNSmlDSWapPushAlert::RunL()
       
   142 // ------------------------------------------------------------------------------------------------
       
   143 void CNSmlDSWapPushAlert::RunL()
       
   144 	{
       
   145 	_DBG_FILE("CNSmlDSWapPushAlert:: RunL Called");
       
   146 	SignalConfirmationStatus(KErrNone);
       
   147 	iPluginKiller->KillPushPlugin();
       
   148 	}
       
   149 
       
   150 // ------------------------------------------------------------------------------------------------
       
   151 //
       
   152 // ------------------------------------------------------------------------------------------------
       
   153 
       
   154 #ifndef IMPLEMENTATION_PROXY_ENTRY
       
   155 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr)	{{aUid},(aFuncPtr)}
       
   156 #endif
       
   157 
       
   158 const TImplementationProxy ImplementationTable[] = 
       
   159     {
       
   160 		IMPLEMENTATION_PROXY_ENTRY(KNSmlDSWapPushAlertImplUid, CNSmlDSWapPushAlert::NewL)
       
   161     };
       
   162 
       
   163 // ------------------------------------------------------------------------------------------------
       
   164 //
       
   165 // ------------------------------------------------------------------------------------------------
       
   166 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   167     {
       
   168 	_DBG_FILE("ImplementationGroupProxy() for CNSmlDSWapPushAlert: begin");
       
   169     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   170 	_DBG_FILE("ImplementationGroupProxy() for CNSmlDSWapPushAlert: end");
       
   171     return ImplementationTable;
       
   172 	}
       
   173 
       
   174 //End of File
       
   175