mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp
branchRCL_3
changeset 17 3570217d8c21
parent 11 03a293c97d5c
child 18 2eb3b066cc7d
--- a/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp	Tue Apr 27 17:11:02 2010 +0300
+++ b/mmserv/radioutility/radioserver/Server/Src/RadioServer.cpp	Tue May 11 16:42:02 2010 +0300
@@ -491,6 +491,8 @@
     {
     RADIO_RDEBUG_INT3(_L("[RADIO-SVR] TunerOnComplete(%d) State[%d] Trigger[%d]"), aError, iState, iTunerOnTrigger);
     TFourCC radioFourCC;
+    // TBool antennaStatus = iSettings->IsAntennaAttached();
+    
     switch ( iTunerOnTrigger )
         {
         case ETriggerTunerControl:
@@ -559,10 +561,13 @@
             if ( aError == KErrNone )
                 {
                 iState = EStateTunerOn;
-                // AK - begin: to cause publishing (CPHU-73YTQW)
-                iSettings->SetAntennaStatus(EFalse, EFalse);
-                // - end
-                iSettings->SetAntennaStatus(ETrue);
+                if ( iSettings->IsAntennaAttached() )
+                    {
+                    // AK - begin: to cause publishing (CPHU-73YTQW)
+                    iSettings->SetAntennaStatus(EFalse, EFalse);
+                    // - end
+                    iSettings->SetAntennaStatus(ETrue);
+                    }
                 }
             // else
                 // Unable to turn the tuner back on. It's possible that after TunerOn request
@@ -594,6 +599,14 @@
         default:
             break;
         }
+    
+    if ( iSettings->IsAntennaAttached() == EFalse )
+        {
+        // antenna removed during TunerOn sequence, request TunerOff
+        // can not shutdown totally in TunerOffComplete thus set iState to EStateTunerOff
+        iState = EStateTunerOff;
+        iTunerControl->TunerOff();    
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -648,13 +661,14 @@
                     CompleteAsyncRequest(aError);
                     }
                 }
+            else if( aError == KRadioServErrDuplicateRequest )
+                {
+                // tuner off and duplicate request going on, trace it out
+                RADIO_RDEBUG(_L("[RADIO-SVR] TunerOffComplete() - EStateTunerOff - KRadioServErrDuplicateRequest"));
+                }
             else
                 {
-                if( aError == KRadioServErrDuplicateRequest )
-                    {
-                    // tuner off and duplicate request going on, trace it out
-                    RADIO_RDEBUG(_L("[RADIO-SVR] TunerOffComplete() - EStateTunerOff - KRadioServErrDuplicateRequest"));
-                    }
+                RADIO_RDEBUG(_L("[RADIO-SVR] TunerOffComplete() - iState = EStateTunerOff;"));
                 }
             break;
         default: