localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp
changeset 54 4dc88a4ac6f4
parent 52 866b4af7ffbe
equal deleted inserted replaced
52:866b4af7ffbe 54:4dc88a4ac6f4
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    82 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
    83 //
    83 //
    84 TInt CDunAtUrcHandler::IssueRequest()
    84 TInt CDunAtUrcHandler::IssueRequest()
    85     {
    85     {
    86     FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest()") ));
    86     FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest()") ));
    87     if ( iUrcHandleState != EDunStateIdle )
    87     if ( IsActive() )
    88         {
    88         {
    89         FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest() (not ready) complete") ));
    89         FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest() (not ready) complete") ));
    90         return KErrNotReady;
    90         return KErrNotReady;
    91         }
    91         }
    92     iStatus = KRequestPending;
       
    93     iUrcHandleState = EDunStateAtUrcHandling;
       
    94     iAtCmdExt->ReceiveUnsolicitedResult( iStatus, iRecvBuffer, iOwnerUidPckg );
    92     iAtCmdExt->ReceiveUnsolicitedResult( iStatus, iRecvBuffer, iOwnerUidPckg );
    95     SetActive();
    93     SetActive();
    96     // Next mark ownership
    94     // Next mark ownership
    97     if ( !iStarted )
    95     if ( !iStarted )
    98         {
    96         {
   110 
   108 
   111 // ---------------------------------------------------------------------------
   109 // ---------------------------------------------------------------------------
   112 // Stops waiting for an incoming URC message
   110 // Stops waiting for an incoming URC message
   113 // ---------------------------------------------------------------------------
   111 // ---------------------------------------------------------------------------
   114 //
   112 //
   115 TInt CDunAtUrcHandler::Stop()
   113 void CDunAtUrcHandler::Stop()
   116     {
   114     {
   117     FTRACE(FPrint( _L("CDunAtUrcHandler::Stop()") ));
   115     FTRACE(FPrint( _L("CDunAtUrcHandler::Stop()") ));
   118     if ( iUrcHandleState != EDunStateAtUrcHandling )
       
   119         {
       
   120         FTRACE(FPrint( _L("CDunAtUrcHandler::Stop() (not ready) complete" )));
       
   121         return KErrNotReady;
       
   122         }
       
   123     iAtCmdExt->CancelReceiveUnsolicitedResult( iOwnerUid );
       
   124     Cancel();
   116     Cancel();
   125     iUrcHandleState = EDunStateIdle;
       
   126     FTRACE(FPrint( _L("CDunAtUrcHandler::Stop() complete") ));
   117     FTRACE(FPrint( _L("CDunAtUrcHandler::Stop() complete") ));
   127     // Note: Don't mark iStarted to EFalse here as it is used to get the UID
   118     // Note: Don't mark iStarted to EFalse here as it is used to get the UID
   128     return KErrNone;
       
   129     }
   119     }
   130 
   120 
   131 // ---------------------------------------------------------------------------
   121 // ---------------------------------------------------------------------------
   132 // UID of the owning plugin
   122 // UID of the owning plugin
   133 // ---------------------------------------------------------------------------
   123 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   161 // ---------------------------------------------------------------------------
   172 //
   162 //
   173 void CDunAtUrcHandler::Initialize()
   163 void CDunAtUrcHandler::Initialize()
   174     {
   164     {
   175     // Don't initialize iStreamCallback here (it is set through NewL)
   165     // Don't initialize iStreamCallback here (it is set through NewL)
   176     iUrcHandleState = EDunStateIdle;
       
   177     iOwnerUid = TUid::Null();
   166     iOwnerUid = TUid::Null();
   178     iStarted = EFalse;
   167     iStarted = EFalse;
   179     }
   168     }
   180 
   169 
   181 // ---------------------------------------------------------------------------
   170 // ---------------------------------------------------------------------------
   184 // ---------------------------------------------------------------------------
   173 // ---------------------------------------------------------------------------
   185 //
   174 //
   186 void CDunAtUrcHandler::RunL()
   175 void CDunAtUrcHandler::RunL()
   187     {
   176     {
   188     FTRACE(FPrint( _L("CDunAtUrcHandler::RunL()") ));
   177     FTRACE(FPrint( _L("CDunAtUrcHandler::RunL()") ));
   189     iUrcHandleState = EDunStateIdle;
       
   190     TInt retTemp = iStatus.Int();
   178     TInt retTemp = iStatus.Int();
   191     if ( retTemp != KErrNone )
   179     if ( retTemp != KErrNone )
   192         {
   180         {
   193         FTRACE(FPrint( _L("CDunAtUrcHandler::RunL() (ERROR) complete (%d)"), retTemp));
   181         FTRACE(FPrint( _L("CDunAtUrcHandler::RunL() (ERROR) complete (%d)"), retTemp));
   194         return;
   182         return;
   212 // ---------------------------------------------------------------------------
   200 // ---------------------------------------------------------------------------
   213 //
   201 //
   214 void CDunAtUrcHandler::DoCancel()
   202 void CDunAtUrcHandler::DoCancel()
   215     {
   203     {
   216     FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel()") ));
   204     FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel()") ));
       
   205     iAtCmdExt->CancelReceiveUnsolicitedResult( iOwnerUid );
   217     FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel() complete") ));
   206     FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel() complete") ));
   218     }
   207     }
   219 
   208 
   220 // ---------------------------------------------------------------------------
   209 // ---------------------------------------------------------------------------
   221 // From class MDunCompletionReporter.
   210 // From class MDunCompletionReporter.