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