localconnectivityservice/dun/utils/src/DunSignalNotify.cpp
changeset 54 4dc88a4ac6f4
parent 52 866b4af7ffbe
equal deleted inserted replaced
52:866b4af7ffbe 54:4dc88a4ac6f4
   134 // ---------------------------------------------------------------------------
   134 // ---------------------------------------------------------------------------
   135 //
   135 //
   136 TInt CDunSignalNotify::IssueRequest()
   136 TInt CDunSignalNotify::IssueRequest()
   137     {
   137     {
   138     FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest()" )));
   138     FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest()" )));
   139     if ( iSignalNotifyState != EDunStateIdle )
   139     if ( IsActive() )
   140         {
   140         {
   141         FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() (not ready) complete" )));
   141         FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() (not ready) complete" )));
   142         return KErrNotReady;
   142         return KErrNotReady;
   143         }
   143         }
   144     if ( !iNetwork )
   144     if ( !iNetwork )
   162         ManageSignalChange();
   162         ManageSignalChange();
   163         }
   163         }
   164     else
   164     else
   165         {
   165         {
   166         FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() start waiting for change..." ) ));
   166         FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() start waiting for change..." ) ));
   167         iStatus = KRequestPending;
       
   168         iSignalNotifyState = EDunStateSignalNotify;
       
   169         iNetwork->NotifySignalChange( iStatus, iSignals, iListenSignals );
   167         iNetwork->NotifySignalChange( iStatus, iSignals, iListenSignals );
   170         SetActive();
   168         SetActive();
   171         }
   169         }
   172     FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() complete" )));
   170     FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() complete" )));
   173     return KErrNone;
   171     return KErrNone;
   175 
   173 
   176 // ---------------------------------------------------------------------------
   174 // ---------------------------------------------------------------------------
   177 // Stops monitoring the endpoint for line status change
   175 // Stops monitoring the endpoint for line status change
   178 // ---------------------------------------------------------------------------
   176 // ---------------------------------------------------------------------------
   179 //
   177 //
   180 TInt CDunSignalNotify::Stop()
   178 void CDunSignalNotify::Stop()
   181     {
   179     {
   182     FTRACE(FPrint( _L("CDunSignalNotify::Stop()" )));
   180     FTRACE(FPrint( _L("CDunSignalNotify::Stop()" )));
   183     if ( iSignalNotifyState != EDunStateSignalNotify )
       
   184         {
       
   185         FTRACE(FPrint( _L("CDunSignalNotify::Stop() (not ready) complete" )));
       
   186         return KErrNotReady;
       
   187         }
       
   188     if ( !iNetwork )
       
   189         {
       
   190         FTRACE(FPrint( _L("CDunSignalNotify::Stop() (iNetwork) not initialized!" )));
       
   191         return KErrGeneral;
       
   192         }
       
   193     iNetwork->NotifySignalChangeCancel();
       
   194     Cancel();
   181     Cancel();
   195     iSignalNotifyState = EDunStateIdle;
       
   196     FTRACE(FPrint( _L("CDunSignalNotify::Stop() complete" )));
   182     FTRACE(FPrint( _L("CDunSignalNotify::Stop() complete" )));
   197     return KErrNone;
       
   198     }
   183     }
   199 
   184 
   200 // ---------------------------------------------------------------------------
   185 // ---------------------------------------------------------------------------
   201 // CDunSignalNotify::CDunSignalNotify
   186 // CDunSignalNotify::CDunSignalNotify
   202 // ---------------------------------------------------------------------------
   187 // ---------------------------------------------------------------------------
   229 //
   214 //
   230 void CDunSignalNotify::Initialize()
   215 void CDunSignalNotify::Initialize()
   231     {
   216     {
   232     FTRACE(FPrint( _L("CDunSignalNotify::Initialize()" ) ));
   217     FTRACE(FPrint( _L("CDunSignalNotify::Initialize()" ) ));
   233     // Don't initialize iUtility here (it is set through NewL)
   218     // Don't initialize iUtility here (it is set through NewL)
   234     iSignalNotifyState = EDunStateIdle;
       
   235     iListenSignals = 0;
   219     iListenSignals = 0;
   236     iSignals = 0;
   220     iSignals = 0;
   237     iNetwork = NULL;
   221     iNetwork = NULL;
   238     FTRACE(FPrint( _L("CDunSignalNotify::Initialize() complete" ) ));
   222     FTRACE(FPrint( _L("CDunSignalNotify::Initialize() complete" ) ));
   239     }
   223     }
   347 // ---------------------------------------------------------------------------
   331 // ---------------------------------------------------------------------------
   348 //
   332 //
   349 void CDunSignalNotify::RunL()
   333 void CDunSignalNotify::RunL()
   350     {
   334     {
   351     FTRACE(FPrint( _L("CDunSignalNotify::RunL()" ) ));
   335     FTRACE(FPrint( _L("CDunSignalNotify::RunL()" ) ));
   352     iSignalNotifyState = EDunStateIdle;
       
   353     TInt retTemp = iStatus.Int();
   336     TInt retTemp = iStatus.Int();
   354     if ( retTemp != KErrNone )
   337     if ( retTemp != KErrNone )
   355         {
   338         {
   356         TInt i;
   339         TInt i;
   357         TInt count = iCallbacks.Count();
   340         TInt count = iCallbacks.Count();
   381 // ---------------------------------------------------------------------------
   364 // ---------------------------------------------------------------------------
   382 //
   365 //
   383 void CDunSignalNotify::DoCancel()
   366 void CDunSignalNotify::DoCancel()
   384     {
   367     {
   385     FTRACE(FPrint( _L("CDunSignalNotify::DoCancel()" ) ));
   368     FTRACE(FPrint( _L("CDunSignalNotify::DoCancel()" ) ));
       
   369     iNetwork->NotifySignalChangeCancel();
   386     FTRACE(FPrint( _L("CDunSignalNotify::DoCancel() complete" ) ));
   370     FTRACE(FPrint( _L("CDunSignalNotify::DoCancel() complete" ) ));
   387     }
   371     }