telephonyserverplugins/common_tsy/systemstateplugin/ssmadaptationstub/ssmadaptationcli.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 #ifndef SYMBIAN_SYSTEM_STATE_MANAGEMENT
       
    17 	#include "ssmadaptationcli.h"
       
    18 #else
       
    19 	#include <ssm/ssmadaptationcli.h>
       
    20 #endif
       
    21 
       
    22 // for keys definition. These keys are  used to manage SSM_Stub behaviour
       
    23 #include "../../test/component/inc/ssmstub_properties.h"
       
    24 
       
    25 #include "e32property.h"
       
    26 
       
    27 const TUid KComponentTestUID = {0x101F777C};
       
    28 
       
    29 
       
    30 EXPORT_C void RSsmEmergencyCallRfAdaptation::InitializeLibL()
       
    31 	{			
       
    32 	}
       
    33 
       
    34 EXPORT_C void RSsmEmergencyCallRfAdaptation::UnInitializeLib()
       
    35 	{
       
    36 	}
       
    37 
       
    38 /**
       
    39  Connect this session without pre-allocating any asynchronous message slots.
       
    40  
       
    41  @return KErrNone, if successful, otherwise one of the other system-wide
       
    42  			error codes.
       
    43  
       
    44  @publishedPartner
       
    45  @released
       
    46  */
       
    47 EXPORT_C TInt RSsmEmergencyCallRfAdaptation::Connect()
       
    48 	{
       
    49 	TInt error(KErrNone);	
       
    50 	if (KErrNone != RProperty::Get (KComponentTestUID, EErrorForConnect, error))
       
    51 		{
       
    52 		error = KErrNone;
       
    53 		}
       
    54 	return error;
       
    55 	}
       
    56 
       
    57 /**
       
    58  Connect this session and pre-allocate the number of asynchronous message slots you will need.
       
    59  I.e. the max number of asynchronoud calls to this call you will ever need.
       
    60  
       
    61  Use this version of @c Connect if you want to be guarantee allocation of slots rather
       
    62  than relying on slots being allocated from the system wide pool.
       
    63 
       
    64  @return KErrNone, if successful, otherwise one of the other system-wide
       
    65  			error codes.
       
    66  
       
    67  @publishedPartner
       
    68  @released
       
    69  */
       
    70 EXPORT_C TInt RSsmEmergencyCallRfAdaptation::Connect(TInt /*aAsyncMessageSlotCount*/)
       
    71 	{
       
    72 	TInt error(KErrNone);	
       
    73 	if (KErrNone != RProperty::Get (KComponentTestUID, EErrorForConnect, error))
       
    74 		{
       
    75 		error = KErrNone;
       
    76 		}
       
    77 	return error;	
       
    78 	}
       
    79 
       
    80 
       
    81 /**
       
    82  Requests the adaptation to enable RF communication for emergency calls.
       
    83    
       
    84  @param aStatus 	The request status.
       
    85 					This is set to KErrNone on successful completion of self tests, KErrNotSupported
       
    86 					if this operations is not supported by the adaptation, KErrPermissionDenied
       
    87 					if the current process does not have sufficient capabilities, otherwise one
       
    88 					of the other system-wide error codes.
       
    89 
       
    90  @capability WriteDeviceData
       
    91  @capability PowerMgmt
       
    92  
       
    93  @publishedPartner
       
    94  @released
       
    95  */
       
    96 EXPORT_C void RSsmEmergencyCallRfAdaptation::ActivateRfForEmergencyCall(TRequestStatus& aStatus)
       
    97 	{	
       
    98 	// check if we should complete Activate
       
    99 	TBool complete(ETrue);	
       
   100 	
       
   101 	// store request status 
       
   102 	iRequestStatus = aStatus;
       
   103 	
       
   104 	if (KErrNone == RProperty::Get (KComponentTestUID, ECompleteActivate, complete))
       
   105 		{
       
   106 		// if we shouldn't complete this request
       
   107 		if (!complete)
       
   108 			{
       
   109 			// do nothing
       
   110 			return;
       
   111 			}
       
   112 		}
       
   113 	
       
   114 	TRequestStatus* ptrStatus = &aStatus;
       
   115 	TInt error(KErrNone);
       
   116 	
       
   117 	if (KErrNone != RProperty::Get (KComponentTestUID, EErrorForActivate, error))
       
   118 		{
       
   119 		error = KErrNone;
       
   120 		}
       
   121 		
       
   122 	User::RequestComplete(ptrStatus, error);
       
   123 	}
       
   124 
       
   125 /**
       
   126   Requests the adaptation to disable RF communication for emergency calls.
       
   127    
       
   128  @param aStatus 	The request status.
       
   129 					This is set to KErrNone on successful completion of self tests, KErrNotSupported
       
   130 					if this operations is not supported by the adaptation, KErrPermissionDenied
       
   131 					if the current process does not have sufficient capabilities, otherwise one
       
   132 					of the other system-wide error codes.
       
   133 					
       
   134  @capability WriteDeviceData
       
   135  @capability PowerMgmt
       
   136  
       
   137  @publishedPartner
       
   138  @released
       
   139  */
       
   140 EXPORT_C void RSsmEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall(TRequestStatus& aStatus)
       
   141 	{	
       
   142 	// check if we should complete Activate
       
   143 	TBool complete(ETrue);	
       
   144 	
       
   145 	// store request status 
       
   146 	iRequestStatus = aStatus;
       
   147 	
       
   148 	if (KErrNone == RProperty::Get (KComponentTestUID, ECompleteDeactivate, complete))
       
   149 		{
       
   150 		// if we shouldn't complete this request
       
   151 		if (!complete)
       
   152 			{
       
   153 			// do nothing
       
   154 			return;
       
   155 			}
       
   156 		}
       
   157 	
       
   158 	TRequestStatus* ptrStatus = &aStatus;
       
   159 	TInt error(KErrNone);
       
   160 	
       
   161 	if (KErrNone != RProperty::Get (KComponentTestUID, EErrorForDeactivate, error))
       
   162 		{
       
   163 		error = KErrNone;
       
   164 		}
       
   165 		
       
   166 	User::RequestComplete(ptrStatus, error);
       
   167 	}
       
   168 
       
   169 
       
   170 
       
   171 EXPORT_C void RSsmEmergencyCallRfAdaptation::Close()
       
   172 	{
       
   173 	
       
   174 	}
       
   175 	
       
   176 EXPORT_C void RSsmEmergencyCallRfAdaptation::Cancel()
       
   177 	{
       
   178 	TRequestStatus* ptrStatus = &iRequestStatus;
       
   179 	User::RequestComplete(ptrStatus, KErrCancel);
       
   180 	}
       
   181