sysstatemgmt/systemstatereferenceplugins/clayer/src/saaemergencycallrfadaptation.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "saaemergencycallrfadaptation.h"
       
    17 
       
    18 #include "startupadaptationadapter.h"
       
    19 #include "ssmdebug.h"
       
    20 #include "clayerpanic.h"
       
    21 /*
       
    22  * Creates a new object associated with the passed in CStartupAdaptationAdapter
       
    23  * 
       
    24  * @internalComponent
       
    25  */
       
    26 CSaaEmergencyCallRfAdaptation* CSaaEmergencyCallRfAdaptation::NewL(CStartupAdaptationAdapter* aAdapter)
       
    27 	{
       
    28 	CSaaEmergencyCallRfAdaptation* self = new (ELeave) CSaaEmergencyCallRfAdaptation(aAdapter);
       
    29 	return self;
       
    30 	}
       
    31 
       
    32 /*
       
    33  * Destructor for this object
       
    34  * 
       
    35  * @internalComponent
       
    36  */
       
    37 CSaaEmergencyCallRfAdaptation::~CSaaEmergencyCallRfAdaptation()
       
    38 	{
       
    39 	
       
    40 	}
       
    41 	
       
    42 /*
       
    43  * Decrements the reference count for this object, deleting it if necessary
       
    44  * 
       
    45  * @internalComponent
       
    46  */
       
    47 void CSaaEmergencyCallRfAdaptation::Release()
       
    48 	{
       
    49 	// This MClass is owned by the singleton CStartupAdaptationAdapter class so
       
    50 	// release should do nothing.
       
    51 	}
       
    52 
       
    53 /*
       
    54  * 
       
    55  * 
       
    56  * @internalComponent
       
    57  */
       
    58 void CSaaEmergencyCallRfAdaptation::ActivateRfForEmergencyCall(TRequestStatus& aStatus)
       
    59 	{
       
    60 	// If this adaptation is busy then complete with KErrInUse
       
    61 	if(Busy())
       
    62 		{
       
    63 		TRequestStatus* statusPtr = &aStatus;
       
    64 		User::RequestComplete(statusPtr, KErrInUse);
       
    65 		return;
       
    66 		}
       
    67 	// Set this request status
       
    68 	SetRequestStatus(&aStatus);
       
    69 	aStatus = KRequestPending;
       
    70 	// No outstand requests so set up command id
       
    71 	SetCommandId(StartupAdaptation::EActivateRfForEmergencyCall);
       
    72 	// No parameters to set to pass in
       
    73 	
       
    74 	// Pass this to the adapter
       
    75 	TRAPD(err, iAdapter->QueueDispatchL(this));
       
    76 	if(err != KErrNone)
       
    77 		{
       
    78 		// Failed to queue adaptation, complete with error
       
    79 		SetRequestStatus(NULL);
       
    80 		TRequestStatus* statusPtr = &aStatus;
       
    81 		User::RequestComplete(statusPtr, err);
       
    82 		}
       
    83 	}
       
    84 
       
    85 /*
       
    86  * 
       
    87  * 
       
    88  * @internalComponent
       
    89  */
       
    90 void CSaaEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall(TRequestStatus& aStatus)
       
    91 	{
       
    92 	// If this adaptation is busy then complete with KErrInUse
       
    93 	if(Busy())
       
    94 		{
       
    95 		TRequestStatus* statusPtr = &aStatus;
       
    96 		User::RequestComplete(statusPtr, KErrInUse);
       
    97 		return;
       
    98 		}
       
    99 	// Set this request status
       
   100 	SetRequestStatus(&aStatus);
       
   101 	aStatus = KRequestPending;
       
   102 	// No outstand requests so set up command id
       
   103 	SetCommandId(StartupAdaptation::EDeactivateRfAfterEmergencyCall);
       
   104 	// No parameters to set to pass in
       
   105 	
       
   106 	// Pass this to the adapter
       
   107 	TRAPD(err, iAdapter->QueueDispatchL(this));
       
   108 	if(err != KErrNone)
       
   109 		{
       
   110 		// Failed to queue adaptation, complete with error
       
   111 		SetRequestStatus(NULL);
       
   112 		TRequestStatus* statusPtr = &aStatus;
       
   113 		User::RequestComplete(statusPtr, err);
       
   114 		}
       
   115 	}
       
   116 
       
   117 /*
       
   118  * 
       
   119  * 
       
   120  * @internalComponent
       
   121  */
       
   122 void CSaaEmergencyCallRfAdaptation::Cancel()
       
   123 	{
       
   124 	CancelRequest();
       
   125 	}
       
   126 
       
   127 	
       
   128 /*
       
   129  * Constructs a new state adaptation object and associates it with aAdapter
       
   130  * 
       
   131  * @internalComponent
       
   132  */
       
   133 CSaaEmergencyCallRfAdaptation::CSaaEmergencyCallRfAdaptation(CStartupAdaptationAdapter* aAdapter)
       
   134 : CAdaptationBase(aAdapter)
       
   135 	{
       
   136 	
       
   137 	}
       
   138 
       
   139 /**
       
   140  * See CAdaptationBase for description of method.
       
   141  *  
       
   142  * @internalComponent
       
   143  */
       
   144 void CSaaEmergencyCallRfAdaptation::RequestComplete(const StartupAdaptation::TCommand __DEBUG_ONLY(aCommandId), TDesC8& aRetPckg)
       
   145 	{
       
   146 	DEBUGPRINT3A("SAA - Response received from adaptation with commandId: %d, expecting %d", aCommandId, CommandId());
       
   147 	__ASSERT_DEBUG(aCommandId == CommandId(), CLAYER_PANIC(ECLayerUnexpectedCommandResponse));
       
   148 	switch(CommandId())
       
   149 		{
       
   150 		case StartupAdaptation::EActivateRfForEmergencyCall: // Fall-through
       
   151 		case StartupAdaptation::EDeactivateRfAfterEmergencyCall:
       
   152 			{
       
   153 			StartupAdaptation::TResponsePckg responsePckg;
       
   154 			responsePckg.Copy(aRetPckg);
       
   155 			CompleteRequestStatus(responsePckg());
       
   156 			break;
       
   157 			}
       
   158 		default:
       
   159 			CLAYER_PANIC(ECLayerUnknownCommandResponse);
       
   160 			break;
       
   161 		}
       
   162 	}
       
   163 
       
   164 /**
       
   165  * See CAdaptationBase for description of method.
       
   166  *  
       
   167  * @internalComponent
       
   168  */
       
   169 TDesC8* CSaaEmergencyCallRfAdaptation::ParameterPckg()
       
   170 	{
       
   171 	// No methods in this adaptation have any parameters so return an empty descriptor
       
   172 	return &iNullBuf; //lint !e1536 Suppress exposing low access member
       
   173 	}