mmserv/radioutility/radioserver/Session/Src/RadioEventHandler.cpp
changeset 20 b67dd1fc57c5
parent 0 71ca22bcf22a
child 46 0ac9a5310753
equal deleted inserted replaced
19:4a629bc82c5e 20:b67dd1fc57c5
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include    "RadioEventHandler.h"
    22 #include    "RadioEventHandler.h"
    23 #include    "RadioClientServer.h"
    23 #include    "RadioClientServer.h"
    24 #include    "RadioDebug.h"
    24 #include    "RadioDebug.h"
       
    25 #include    "trace.h"
       
    26 
       
    27 // This has to be the last include. 
       
    28 #ifdef STUB_CONSTELLATION
       
    29 #   include "RadioStubManager.h"
       
    30 #   define KRadioServerPropertyCategory KStub_KRadioServerPropertyCategory
       
    31 #endif //STUB_CONSTELLATION
    25 
    32 
    26 // ============================ MEMBER FUNCTIONS ===============================
    33 // ============================ MEMBER FUNCTIONS ===============================
    27 
    34 
    28 // -----------------------------------------------------------------------------
    35 // -----------------------------------------------------------------------------
    29 // CRadioEventHandler::CRadioEventHandler
    36 // CRadioEventHandler::CRadioEventHandler
    38 	:	CActive(EPriorityStandard),
    45 	:	CActive(EPriorityStandard),
    39 		iSession(aSession),
    46 		iSession(aSession),
    40 		iKey(aKey),
    47 		iKey(aKey),
    41 		iObserver(aObserver)
    48 		iObserver(aObserver)
    42     {
    49     {
       
    50     FUNC_LOG;
    43     if ( iKey == ERadioServPsAfSearchEnd )
    51     if ( iKey == ERadioServPsAfSearchEnd )
    44     	{
    52     	{
    45 		// This is necessary to make sure AfSearchEnd comes in before FrequencyChanged event.
    53 		// This is necessary to make sure AfSearchEnd comes in before FrequencyChanged event.
    46 		// Because the AO for FrequencyChanged is added to the scheduler first, AfSearchEnd
    54 		// Because the AO for FrequencyChanged is added to the scheduler first, AfSearchEnd
    47 		// must have slightly higer priority to come in first.
    55 		// must have slightly higer priority to come in first.
    54 // Symbian 2nd phase constructor can leave.
    62 // Symbian 2nd phase constructor can leave.
    55 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    56 //
    64 //
    57 void CRadioEventHandler::ConstructL()
    65 void CRadioEventHandler::ConstructL()
    58     {
    66     {
    59 	RADIO_RDEBUG(_L("[RADIO-SESS] CRadioEventHandler::ConstructL()"));
    67     FUNC_LOG;
    60 	CActiveScheduler::Add(this);
    68 	CActiveScheduler::Add(this);
    61 	User::LeaveIfError( iProperty.Attach(KRadioServerPropertyCategory, iKey) );
    69 	User::LeaveIfError( iProperty.Attach(KRadioServerPropertyCategory, iKey) );
    62 	iProperty.Subscribe(iStatus);
    70 	iProperty.Subscribe(iStatus);
    63 	SetActive();
    71 	SetActive();
    64     }
    72     }
    71 CRadioEventHandler* CRadioEventHandler::NewLC(
    79 CRadioEventHandler* CRadioEventHandler::NewLC(
    72 	MRadioObserver& aObserver,
    80 	MRadioObserver& aObserver,
    73 	RRadioSession& aSession,
    81 	RRadioSession& aSession,
    74 	TUint aKey )
    82 	TUint aKey )
    75     {
    83     {
       
    84     FUNC_LOG;
    76     CRadioEventHandler* self = new( ELeave ) CRadioEventHandler(aObserver,aSession, aKey);
    85     CRadioEventHandler* self = new( ELeave ) CRadioEventHandler(aObserver,aSession, aKey);
    77     CleanupStack::PushL( self );
    86     CleanupStack::PushL( self );
    78     self->ConstructL();
    87     self->ConstructL();
    79     return self;
    88     return self;
    80     }
    89     }
    81 
    90 
    82 // Destructor
    91 // Destructor
    83 CRadioEventHandler::~CRadioEventHandler()
    92 CRadioEventHandler::~CRadioEventHandler()
    84     {
    93     {
       
    94     FUNC_LOG;
    85 	if ( IsActive() )
    95 	if ( IsActive() )
    86 		{
    96 		{
    87 		Cancel();
    97 		Cancel();
    88 		}
    98 		}
    89 	iProperty.Close();
    99 	iProperty.Close();
    93 // CRadioEventHandler::DoCancel
   103 // CRadioEventHandler::DoCancel
    94 // -----------------------------------------------------------------------------
   104 // -----------------------------------------------------------------------------
    95 //
   105 //
    96 void CRadioEventHandler::DoCancel()
   106 void CRadioEventHandler::DoCancel()
    97     {
   107     {
       
   108     FUNC_LOG;
    98 	iProperty.Cancel();
   109 	iProperty.Cancel();
    99     }
   110     }
   100 
   111 
   101 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
   102 // CRadioEventHandler::RunL
   113 // CRadioEventHandler::RunL
   103 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   104 //
   115 //
   105 void CRadioEventHandler::RunL()
   116 void CRadioEventHandler::RunL()
   106     {
   117     {
       
   118     FUNC_LOG;
   107     // Subscribe immediately before analyzing the notification to ensure that we
   119     // Subscribe immediately before analyzing the notification to ensure that we
   108     // don't miss further updates.
   120     // don't miss further updates.
   109 	iProperty.Subscribe(iStatus);
   121 	iProperty.Subscribe(iStatus);
   110 	SetActive();
   122 	SetActive();
   111 
   123 
   278 				                     afData().iData1);	// Frequency
   290 				                     afData().iData1);	// Frequency
   279 			}
   291 			}
   280 			break;
   292 			break;
   281 		default:
   293 		default:
   282 			{
   294 			{
   283 			RADIO_RDEBUG(_L("[RADIO-SESS] CRadioEventHandler::RunL(): ERROR case default !!!"));
   295 			INFO("ERROR case default !!!");
   284 			User::Panic(_L("RadioServer"), KErrGeneral );
   296 			User::Panic(_L("RadioServer"), KErrGeneral );
   285 			}
   297 			}
   286 			break;
   298 			break;
   287 		}
   299 		}
   288 	}
   300 	}