localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp
changeset 60 841f70763fbe
parent 52 866b4af7ffbe
equal deleted inserted replaced
52:866b4af7ffbe 60:841f70763fbe
     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".
    78 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
    79 //
    79 //
    80 TInt CDunAtEcomListen::IssueRequest()
    80 TInt CDunAtEcomListen::IssueRequest()
    81     {
    81     {
    82     FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest()") ));
    82     FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest()") ));
    83     if ( iEcomListenState != EDunStateIdle )
    83     if ( IsActive() )
    84         {
    84         {
    85         FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() (not ready) complete") ));
    85         FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() (not ready) complete") ));
    86         return KErrNotReady;
    86         return KErrNotReady;
    87         }
    87         }
    88     iStatus = KRequestPending;
       
    89     iEcomListenState = EDunStateEcomListening;
       
    90     iAtCmdExt->ReceiveEcomPluginChange( iStatus, iPluginUidPckg, iEcomTypePckg );
    88     iAtCmdExt->ReceiveEcomPluginChange( iStatus, iPluginUidPckg, iEcomTypePckg );
    91     SetActive();
    89     SetActive();
    92     FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() complete") ));
    90     FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() complete") ));
    93     return KErrNone;
    91     return KErrNone;
    94     }
    92     }
    95 
    93 
    96 // ---------------------------------------------------------------------------
    94 // ---------------------------------------------------------------------------
    97 // Stops waiting for Ecom plugin install/uninstall/version status changes
    95 // Stops waiting for Ecom plugin install/uninstall/version status changes
    98 // ---------------------------------------------------------------------------
    96 // ---------------------------------------------------------------------------
    99 //
    97 //
   100 TInt CDunAtEcomListen::Stop()
    98 void CDunAtEcomListen::Stop()
   101     {
    99     {
   102     FTRACE(FPrint( _L("CDunAtEcomListen::Stop()") ));
   100     FTRACE(FPrint( _L("CDunAtEcomListen::Stop()") ));
   103     if ( iEcomListenState != EDunStateEcomListening )
       
   104         {
       
   105         FTRACE(FPrint( _L("CDunAtEcomListen::Stop() (not ready) complete" )));
       
   106         return KErrNotReady;
       
   107         }
       
   108     iAtCmdExt->CancelReceiveEcomPluginChange();
       
   109     Cancel();
   101     Cancel();
   110     iEcomListenState = EDunStateIdle;
       
   111     FTRACE(FPrint( _L("CDunAtEcomListen::Stop() complete") ));
   102     FTRACE(FPrint( _L("CDunAtEcomListen::Stop() complete") ));
   112     return KErrNone;
       
   113     }
   103     }
   114 
   104 
   115 // ---------------------------------------------------------------------------
   105 // ---------------------------------------------------------------------------
   116 // CDunAtEcomListen::CDunAtEcomListen
   106 // CDunAtEcomListen::CDunAtEcomListen
   117 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
   148 //
   138 //
   149 void CDunAtEcomListen::Initialize()
   139 void CDunAtEcomListen::Initialize()
   150     {
   140     {
   151     // Don't initialize iAtCmdExt here (it is set through NewL)
   141     // Don't initialize iAtCmdExt here (it is set through NewL)
   152     // Don't initialize iCallback here (it is set through NewL)
   142     // Don't initialize iCallback here (it is set through NewL)
   153     iEcomListenState = EDunStateIdle;
       
   154     iPluginUid = TUid::Null();
   143     iPluginUid = TUid::Null();
   155     }
   144     }
   156 
   145 
   157 // ---------------------------------------------------------------------------
   146 // ---------------------------------------------------------------------------
   158 // From class CActive.
   147 // From class CActive.
   160 // ---------------------------------------------------------------------------
   149 // ---------------------------------------------------------------------------
   161 //
   150 //
   162 void CDunAtEcomListen::RunL()
   151 void CDunAtEcomListen::RunL()
   163     {
   152     {
   164     FTRACE(FPrint( _L("CDunAtEcomListen::RunL()") ));
   153     FTRACE(FPrint( _L("CDunAtEcomListen::RunL()") ));
   165     iEcomListenState = EDunStateIdle;
       
   166     TInt retTemp = iStatus.Int();
   154     TInt retTemp = iStatus.Int();
   167     if ( retTemp != KErrNone )
   155     if ( retTemp != KErrNone )
   168         {
   156         {
   169         FTRACE(FPrint( _L("CDunAtEcomListen::RunL() (ERROR) complete (%d)"), retTemp ));
   157         FTRACE(FPrint( _L("CDunAtEcomListen::RunL() (ERROR) complete (%d)"), retTemp ));
   170         return;
   158         return;
   193 // ---------------------------------------------------------------------------
   181 // ---------------------------------------------------------------------------
   194 //
   182 //
   195 void CDunAtEcomListen::DoCancel()
   183 void CDunAtEcomListen::DoCancel()
   196     {
   184     {
   197     FTRACE(FPrint( _L("CDunAtEcomListen::DoCancel()") ));
   185     FTRACE(FPrint( _L("CDunAtEcomListen::DoCancel()") ));
       
   186     iAtCmdExt->CancelReceiveEcomPluginChange();
   198     FTRACE(FPrint( _L("CDunAtEcomListen::DoCancel() complete") ));
   187     FTRACE(FPrint( _L("CDunAtEcomListen::DoCancel() complete") ));
   199     }
   188     }