sysstatemgmt/systemstateplugins/adptplugin/src/emergencycallrfadaptationref.cpp
branchRCL_3
changeset 22 8cb079868133
parent 21 ccb4f6b3db21
equal deleted inserted replaced
21:ccb4f6b3db21 22:8cb079868133
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description: This adaptation plugin implementation is for test/reference purposes.   
    13 // Description:
    14 // The loading of this plugin is controlled through test macro defined in the iby file "ssmcompatibility.iby".
       
    15 // If the macro "TEST_SSM_MACRO" is not defined, original plugins are loaded and this plugin is not loaded.
       
    16 // If the test P & S key is set in the test code, the calls are routed to the reference or dummy implementations.
       
    17 // Else the actual plugins are loaded and the calls are routed to the actual implementations.
       
    18 // The test P & S key which it looks for is KEmergencyCallRfAdaptationPluginPropertyKey(0x2000E657)
       
    19 //
    14 //
    20 
    15 
    21 #include "ssmdebug.h"
       
    22 #include <e32property.h>
       
    23 #include "emergencycallrfadaptationref.h"
    16 #include "emergencycallrfadaptationref.h"
    24 
       
    25 const TUint32 KEmergencyCallRfAdaptationPluginPropertyKey = 0x2000E657;
       
    26 const TUid KPropertyCategory={0x2000D75B};
       
    27 
    17 
    28 /**
    18 /**
    29  Function to create new Emergency Call RF Adaptation Plugin.
    19  Function to create new Emergency Call RF Adaptation Plugin.
    30 
    20 
    31  @return	new instance of MEmergencyCallRfAdaptation for Emergency Call RF Adaptations.
    21  @return	new instance of MEmergencyCallRfAdaptation for Emergency Call RF Adaptations.
    40 	}
    30 	}
    41 
    31 
    42 CEmergencyCallRfAdaptationRef* CEmergencyCallRfAdaptationRef::NewL()
    32 CEmergencyCallRfAdaptationRef* CEmergencyCallRfAdaptationRef::NewL()
    43 	{
    33 	{
    44 	CEmergencyCallRfAdaptationRef* self = new(ELeave) CEmergencyCallRfAdaptationRef;
    34 	CEmergencyCallRfAdaptationRef* self = new(ELeave) CEmergencyCallRfAdaptationRef;
    45 	
       
    46 	CleanupStack::PushL(self);
       
    47 	self->ConstructL();
       
    48 	CleanupStack::Pop();
       
    49 	
       
    50 	return self;
    35 	return self;
    51 	}
    36 	}
    52 
    37 
    53 void CEmergencyCallRfAdaptationRef::ConstructL()
       
    54     {
       
    55     DEBUGPRINT1A("Loading Actual plugins");
       
    56     _LIT(KSaaEmergencyCallRfAdaptationDLL, "saaemergencycallrfadaptation.dll");
       
    57     User::LeaveIfError(iSaaEmergencyCallRfAdaptationLib.Load(KSaaEmergencyCallRfAdaptationDLL));
       
    58     iSaaEmergencyCallRfAdaptationDll = (MEmergencyCallRfAdaptation *)(iSaaEmergencyCallRfAdaptationLib.Lookup(1)());
       
    59     }
       
    60 
       
    61 CEmergencyCallRfAdaptationRef::~CEmergencyCallRfAdaptationRef()
    38 CEmergencyCallRfAdaptationRef::~CEmergencyCallRfAdaptationRef()
    62 	{
    39 	{
    63 	iSaaEmergencyCallRfAdaptationLib.Close();
       
    64 	}
    40 	}
    65 
    41 
    66 CEmergencyCallRfAdaptationRef::CEmergencyCallRfAdaptationRef()
    42 CEmergencyCallRfAdaptationRef::CEmergencyCallRfAdaptationRef()
    67 	{
    43 	{
    68 	}
    44 	}
    70 /**
    46 /**
    71  Deletes and frees memory allocated.
    47  Deletes and frees memory allocated.
    72 */
    48 */
    73 void CEmergencyCallRfAdaptationRef::Release()
    49 void CEmergencyCallRfAdaptationRef::Release()
    74 	{
    50 	{
    75     if(!IsTestPsKeyDefined())
    51 	delete this;
    76         {
       
    77         DEBUGPRINT1A("Release:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)");
       
    78         iSaaEmergencyCallRfAdaptationDll->Release();
       
    79         }
       
    80     else
       
    81         {
       
    82         DEBUGPRINT1A("Release:: Calling Reference plugins functions (emergencycallrfadaptationref.dll)");
       
    83         }
       
    84     delete this;
       
    85 	}
    52 	}
    86 
    53 
    87 /**
    54 /**
    88  Request RF activation so that an emergency call can be made.
    55  Request RF activation so that an emergency call can be made.
    89  Reference implementation completes the request with KErrNone. This is required for automated testing.
    56  Reference implementation completes the request with KErrNone as support for RF activation is not available on Techview/H4 hrp.
    90  Actual plugins return expected values and this can be verified by manual testing
       
    91 
    57 
    92  @param aStatus to complete when the operation has finished
    58  @param aStatus to complete when the operation has finished
    93  @see TRequestStatus 
    59  @see TRequestStatus 
    94 */
    60 */
    95 void CEmergencyCallRfAdaptationRef::ActivateRfForEmergencyCall(TRequestStatus& aStatus)
    61 void CEmergencyCallRfAdaptationRef::ActivateRfForEmergencyCall(TRequestStatus& aStatus)
    96 	{
    62 	{
    97 	if(!IsTestPsKeyDefined())
    63 	aStatus = KRequestPending;
    98         {
    64 	TRequestStatus* status = &aStatus;
    99         DEBUGPRINT1A("ActivateRfForEmergencyCall:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)");
    65 	User::RequestComplete(status, KErrNone);
   100         iSaaEmergencyCallRfAdaptationDll->ActivateRfForEmergencyCall(aStatus);
       
   101         }
       
   102     else
       
   103         {
       
   104         DEBUGPRINT1A("ActivateRfForEmergencyCall:: Calling Reference plugins functions (emergencycallrfadaptationref.dll)");
       
   105         aStatus = KRequestPending;
       
   106         TRequestStatus* status = &aStatus;
       
   107         User::RequestComplete(status, KErrNone);
       
   108         }
       
   109 	}
    66 	}
   110 
    67 
   111 /**
    68 /**
   112  Request RF deactivation after an emergency call have been made.
    69  Request RF deactivation after an emergency call have been made.
   113  Reference implementation completes the request with KErrNone. This is required for automated testing.
    70  Reference implementation completes the request with KErrNone as support for RF deactivation is not available on Techview/H4 hrp.
   114  Actual plugins return expected values and this can be verified by manual testing
    71 
   115  
       
   116  @param aStatus to complete when the operation has finished
    72  @param aStatus to complete when the operation has finished
   117  @see TRequestStatus 
    73  @see TRequestStatus 
   118 */
    74 */
   119 void CEmergencyCallRfAdaptationRef::DeactivateRfForEmergencyCall(TRequestStatus& aStatus)
    75 void CEmergencyCallRfAdaptationRef::DeactivateRfForEmergencyCall(TRequestStatus& aStatus)
   120 	{
    76 	{
   121 	if(!IsTestPsKeyDefined())
    77 	aStatus = KRequestPending;
   122         {
    78 	TRequestStatus* status = &aStatus;
   123         DEBUGPRINT1A("DeactivateRfForEmergencyCall:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)");
    79 	User::RequestComplete(status, KErrNone);	
   124         iSaaEmergencyCallRfAdaptationDll->DeactivateRfForEmergencyCall(aStatus);
    80 	}
   125         }
       
   126     else
       
   127         {
       
   128         DEBUGPRINT1A("DeactivateRfForEmergencyCall:: Calling Reference plugins functions (emergencycallrfadaptationref.dll)");
       
   129         aStatus = KRequestPending;
       
   130         TRequestStatus* status = &aStatus;
       
   131         User::RequestComplete(status, KErrNone);
       
   132         }
       
   133  	}
       
   134 
    81 
   135 /**
    82 /**
   136   Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to cancel.
    83   Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to cancel.
   137   On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled.
    84   On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled.
   138 */
    85 */
   139 void CEmergencyCallRfAdaptationRef::Cancel()
    86 void CEmergencyCallRfAdaptationRef::Cancel()
   140 	{
    87 	{
   141 	if(!IsTestPsKeyDefined())
       
   142         {
       
   143         DEBUGPRINT1A("Cancel:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)");
       
   144         iSaaEmergencyCallRfAdaptationDll->Cancel();
       
   145         }
       
   146 	}
    88 	}
   147 
       
   148 /**
       
   149     Helper function to check for P&S Key
       
   150 */
       
   151 TBool CEmergencyCallRfAdaptationRef::IsTestPsKeyDefined()
       
   152     {
       
   153     TBool testPsKeyDefined = EFalse;
       
   154     TInt result = RProperty::Get(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey, testPsKeyDefined);
       
   155     DEBUGPRINT3(_L("KEmergencyCallRfAdaptationPluginPropertyKey %d Error %d"), testPsKeyDefined, result);
       
   156     if ((KErrNone != result) && (KErrNotFound != result))
       
   157         {
       
   158         //Could not retrieve property value. Tests might fail 
       
   159         DEBUGPRINT1A("IsTestPsKeyDefined ERROR :: Could not retrieve property value)");
       
   160         }
       
   161     return testPsKeyDefined;
       
   162     }
       
   163