phoneclientserver/phoneserver/Src/Ussd/CPhSrvUssdNotifyNWRelease.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002 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:  Ussd Handler Receive.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cphsrvussdnotifynwrelease.h" 
       
    22 #include "mphsrvussdnetworkobserver.h" 
       
    23 #include "phsrvdebuginfo.h" 
       
    24 
       
    25 // CONSTANTS
       
    26 const TInt KPhSrvUssdReceiverPriority = CActive::EPriorityLow + 2;
       
    27 
       
    28 
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CPhSrvUssdNotifyNWRelease::CPhSrvUssdNotifyNWRelease
       
    34 // 
       
    35 // C++ constructor
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 /*****************************************************
       
    39 *   Series 60 Customer / ETel
       
    40 *   Series 60  ETel API
       
    41 *****************************************************/
       
    42 CPhSrvUssdNotifyNWRelease::CPhSrvUssdNotifyNWRelease(
       
    43     MPhSrvUssdNetworkObserver& aObserver,
       
    44     RMobileUssdMessaging& aUssdMessaging)
       
    45     :    CActive(KPhSrvUssdReceiverPriority), 
       
    46       
       
    47          iObserver( aObserver ),
       
    48          iUssdMessaging( aUssdMessaging ),
       
    49          iReturnResultPckg ( iReturnResult )
       
    50          
       
    51     {
       
    52     CActiveScheduler::Add( this );
       
    53     
       
    54     }
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CPhSrvUssdNotifyNWRelease::~CPhSrvUssdNotifyNWRelease
       
    59 // 
       
    60 // C++ Destructor
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CPhSrvUssdNotifyNWRelease::~CPhSrvUssdNotifyNWRelease()
       
    64     {
       
    65     Cancel();
       
    66     }
       
    67 
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CPhSrvUssdNotifyNWRelease::ConstructL
       
    71 // 
       
    72 // Symbian OS 2nd phase constructor
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 void CPhSrvUssdNotifyNWRelease::ConstructL()
       
    76     {
       
    77     // Start notify a client of a MT USSD release message to the mobile device
       
    78     NotifyNetworkRelease();
       
    79     }
       
    80 
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CPhSrvUssdNotifyNWRelease::StartReceiving
       
    84 // 
       
    85 // Start receiving a message
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 /*****************************************************
       
    89 *   Series 60 Customer / ETel
       
    90 *   Series 60  ETel API
       
    91 *****************************************************/
       
    92 TInt CPhSrvUssdNotifyNWRelease::NotifyNetworkRelease()
       
    93     {
       
    94     if ( IsActive() )
       
    95         {
       
    96         return KErrInUse;
       
    97         } 
       
    98     _DPRINT( 4, "PhSrv.NotifyNetworkRelease" );
       
    99     iUssdMessaging.NotifyNetworkRelease( iStatus, iReturnResultPckg );
       
   100     SetActive();
       
   101     return KErrNone;
       
   102     }
       
   103 
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CPhSrvUssdNotifyNWRelease::RunL
       
   107 // 
       
   108 // Called when a message is received
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CPhSrvUssdNotifyNWRelease::RunL()
       
   112     {
       
   113     TInt error = iStatus.Int();
       
   114     if ( error == KErrCancel )
       
   115         {
       
   116         return;
       
   117         }
       
   118     _DPRINT( 4, "PhSrv.NotifyNetworkRelease:RunL" );
       
   119     iObserver.UssdNetworkObserverHandleNotifyNWReleaseL( 
       
   120         iReturnResult,
       
   121         error ); 
       
   122     NotifyNetworkRelease();      
       
   123     }
       
   124 
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CPhSrvUssdNotifyNWRelease::DoCancel
       
   128 // 
       
   129 // Cancel a pending request
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 /*****************************************************
       
   133 *   Series 60 Customer / ETel
       
   134 *   Series 60  ETel API
       
   135 *****************************************************/
       
   136 void CPhSrvUssdNotifyNWRelease::DoCancel()
       
   137     {
       
   138     iUssdMessaging.CancelAsyncRequest( EMobileUssdMessagingNotifyNetworkRelease );
       
   139     }
       
   140 
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CPhSrvUssdNotifyNWRelease::RunError
       
   144 // 
       
   145 // Called when RunL leaves
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 TInt CPhSrvUssdNotifyNWRelease::RunError( TInt aError )
       
   149     {
       
   150     
       
   151     TRAP_IGNORE( iObserver.UssdNetworkObserverHandleNotifyNWReleaseL( 
       
   152          iReturnResult, aError ) );
       
   153         
       
   154     return KErrNone;
       
   155     }
       
   156 
       
   157 
       
   158 //  End of File