sysstatemgmt/systemstatereferenceplugins/test/tclayer/src/adaptationcliwrapper.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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 // Contains wrapper helper functions for test code to control the test wrappers 
       
    15 // Adaptation client wrapper
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @test
       
    22  @internalComponent - Internal Symbian test code 
       
    23 */
       
    24 
       
    25 #include <ssm/ssmadaptationcli.h>
       
    26 #include "adaptationcliwrapper.h"
       
    27 
       
    28 TInt RSsmAdaptationBase::Connect()
       
    29 	{
       
    30 	return AdaptationCliWrapper::GetRSsmAdaptationBaseNextConnectReturn();
       
    31 	}
       
    32 
       
    33 void RSsmEmergencyCallRfAdaptation::ActivateRfForEmergencyCall(TRequestStatus& aStatus)
       
    34 	{
       
    35 	TRequestStatus* statusPtr = &aStatus;
       
    36 	User::RequestComplete(statusPtr, AdaptationCliWrapper::GetRSsmEmergencyCallReturnValue());
       
    37 	}
       
    38 
       
    39 void RSsmEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall(TRequestStatus& aStatus)
       
    40 	{
       
    41 	TRequestStatus* statusPtr = &aStatus;
       
    42 	User::RequestComplete(statusPtr, AdaptationCliWrapper::GetRSsmEmergencyCallReturnValue());
       
    43 	}
       
    44 
       
    45 void RSsmRtcAdaptation::ValidateRtc(TDes8& aValiditiyPckg, TRequestStatus& aStatus)
       
    46 	{
       
    47 	TBool ret = AdaptationCliWrapper::GetRSsmRtcAdaptationNextValidity();
       
    48 	// Package up the return value and copy it into the descriptor
       
    49 	TPckg<TBool> retPckg(ret);
       
    50 	aValiditiyPckg.Copy(retPckg);
       
    51 	// Complete the status
       
    52 	TRequestStatus* statusPtr = &aStatus;
       
    53 	User::RequestComplete(statusPtr, AdaptationCliWrapper::GetRSsmRtcAdaptationNextValidityReturn());
       
    54 	}
       
    55 
       
    56 void RSsmSimAdaptation::GetSimOwned(TDes8& aOwnedPckg, TRequestStatus& aStatus)
       
    57 	{
       
    58 	TRequestStatus* statusPtr = &aStatus;
       
    59 	User::RequestComplete(statusPtr, AdaptationCliWrapper::GetSimOwnedReturnValue());
       
    60 	if (AdaptationCliWrapper::GetSimOwnedReturnValue() == KErrNone)
       
    61 		{
       
    62 		TPckgBuf<TBool> boolPckg;
       
    63 		boolPckg() = AdaptationCliWrapper::GetSimOwned();
       
    64 		aOwnedPckg.Copy(boolPckg);
       
    65 		}
       
    66 	}
       
    67 
       
    68 void RSsmSimAdaptation::GetCancel()
       
    69 	{
       
    70 	// Do nothing
       
    71 	}
       
    72 
       
    73 void RSsmSimAdaptation::NotifySimEvent(TDes8& aTypePckg, TRequestStatus& aStatus)
       
    74 	{
       
    75 	aStatus = KRequestPending;
       
    76 	AdaptationCliWrapper::SetSimEventPckg(&aTypePckg);
       
    77 	AdaptationCliWrapper::SetSimNotifyStatus(&aStatus);
       
    78 	}
       
    79 
       
    80 void RSsmSimAdaptation::NotifyCancel()
       
    81 	{
       
    82 	TRequestStatus* simNotify = AdaptationCliWrapper::GetSimNotifyStatus();
       
    83 	if(simNotify != NULL)
       
    84 		{
       
    85 		User::RequestComplete(simNotify, KErrCancel);
       
    86 		AdaptationCliWrapper::SetSimNotifyStatus(NULL);
       
    87 		AdaptationCliWrapper::SetSimEventPckg(NULL);
       
    88 		}
       
    89 	}
       
    90 
       
    91 /**
       
    92  * Sets the value that should be returned by RSsmAdaptationBase::Connect()
       
    93  * 
       
    94  * @test
       
    95  * @internalComponent
       
    96  */
       
    97 void AdaptationCliWrapper::SetRSsmAdaptationBaseNextConnectReturn(TInt aRet)
       
    98 	{
       
    99 	iSsmAdaptationBaseNextConnect = aRet;
       
   100 	}
       
   101 
       
   102 /**
       
   103  * Gets the value that should be returned by RSsmAdaptationBase::Connect()
       
   104  * 
       
   105  * @test
       
   106  * @internalComponent
       
   107  */
       
   108 TInt AdaptationCliWrapper::GetRSsmAdaptationBaseNextConnectReturn()
       
   109 	{
       
   110 	return iSsmAdaptationBaseNextConnect;
       
   111 	}
       
   112 
       
   113 /**
       
   114  * Sets the validity that should be returned by RSsmRtcAdaptation::ValidateRtc()
       
   115  * 
       
   116  * @test
       
   117  * @internalComponent
       
   118  */
       
   119 void AdaptationCliWrapper::SetRSsmRtcAdaptationNextValidity(TBool aValidity)
       
   120 	{
       
   121 	iSsmRtcAdaptationNextValidity = aValidity;
       
   122 	}
       
   123 
       
   124 /**
       
   125  * Gets the validity that should be returned by RSsmRtcAdaptation::ValidateRtc()
       
   126  * 
       
   127  * @test
       
   128  * @internalComponent
       
   129  */
       
   130 
       
   131 TBool AdaptationCliWrapper::GetRSsmRtcAdaptationNextValidity()
       
   132 	{
       
   133 	return iSsmRtcAdaptationNextValidity;
       
   134 	}
       
   135 
       
   136 /**
       
   137  * Sets the completion status that should be returned by RSsmRtcAdaptation::ValidateRtc()
       
   138  * 
       
   139  * @test
       
   140  * @internalComponent
       
   141  */
       
   142 void AdaptationCliWrapper::SetRSsmRtcAdaptationNextValidityReturn(TInt aRet)
       
   143 	{
       
   144 	iSsmRtcAdaptationNextValidityReturn = aRet;
       
   145 	}
       
   146 
       
   147 /**
       
   148  * Gets the completion status that should be returned by RSsmRtcAdaptation::ValidateRtc()
       
   149  * 
       
   150  * @test
       
   151  * @internalComponent
       
   152  */
       
   153 TInt AdaptationCliWrapper::GetRSsmRtcAdaptationNextValidityReturn()
       
   154 	{
       
   155 	return iSsmRtcAdaptationNextValidityReturn;
       
   156 	}
       
   157 
       
   158 /**
       
   159  * Sets the completion status that should be returned by RSsmEmergencyCallRfAdaption::ActivateRfForEmergencyCall()
       
   160  * and RSsmEmergencyCallRfAdaption::DeactivateRfForEmergencyCall()
       
   161  * 
       
   162  * @test
       
   163  * @internalComponent
       
   164  */
       
   165 void AdaptationCliWrapper::SetRSsmEmergencyCallReturnValue(TInt aRet)
       
   166 	{
       
   167 	iSsmEmergencyCallReturnValue = aRet;
       
   168 	}
       
   169 
       
   170 /**
       
   171  * Gets the completion status that should be returned by RSsmEmergencyCallRfAdaption::ActivateRfForEmergencyCall()
       
   172  * and RSsmEmergencyCallRfAdaption::DeactivateRfForEmergencyCall()
       
   173  * 
       
   174  * @test
       
   175  * @internalComponent
       
   176  */
       
   177 TInt AdaptationCliWrapper::GetRSsmEmergencyCallReturnValue()
       
   178 	{
       
   179 	return iSsmEmergencyCallReturnValue;
       
   180 	}
       
   181 
       
   182 /**
       
   183  * Sets the completion status for calls to RSsmSimAdaptation::GetSimOwned() 
       
   184  * 
       
   185  * @test
       
   186  * @internalComponent
       
   187  */
       
   188 void AdaptationCliWrapper::SetSimOwnedReturnValue(TInt aRet)
       
   189 	{
       
   190 	iSimOwnedReturn = aRet;
       
   191 	}
       
   192 
       
   193 /**
       
   194  * Returns the completion status for calls to RSsmSimAdaptation::GetSimOwned() 
       
   195  * 
       
   196  * @test
       
   197  * @internalComponent
       
   198  */
       
   199 TInt AdaptationCliWrapper::GetSimOwnedReturnValue()
       
   200 	{
       
   201 	return iSimOwnedReturn;
       
   202 	}
       
   203 
       
   204 /**
       
   205  * Sets the owned status for calls to RSsmSimAdaptation::GetSimOwned() 
       
   206  * 
       
   207  * @test
       
   208  * @internalComponent
       
   209  */
       
   210 void AdaptationCliWrapper::SetSimOwned(TBool aOwned)
       
   211 	{
       
   212 	iSimOwned = aOwned;
       
   213 	}
       
   214 
       
   215 /**
       
   216  * Returns the owned status for calls to RSsmSimAdaptation::GetSimOwned() 
       
   217  * 
       
   218  * @test
       
   219  * @internalComponent
       
   220  */
       
   221 TBool AdaptationCliWrapper::GetSimOwned()
       
   222 	{
       
   223 	return iSimOwned;
       
   224 	}
       
   225 	
       
   226 /**
       
   227  * Sets the completion status for calls to RSsmSimAdaptation::GetSimChanged() 
       
   228  * 
       
   229  * @test
       
   230  * @internalComponent
       
   231  */
       
   232 void AdaptationCliWrapper::SetSimChangedReturnValue(TInt aRet)
       
   233 	{
       
   234 	iSimChangedReturn = aRet;
       
   235 	}
       
   236 
       
   237 /**
       
   238  * Returns the completion status for calls to RSsmSimAdaptation::GetSimChanged() 
       
   239  * 
       
   240  * @test
       
   241  * @internalComponent
       
   242  */
       
   243 TInt AdaptationCliWrapper::GetSimChangedReturnValue()
       
   244 	{
       
   245 	return iSimChangedReturn;
       
   246 	}
       
   247 
       
   248 /**
       
   249  * Sets the changed status for calls to RSsmSimAdaptation::GetSimChanged() 
       
   250  * 
       
   251  * @test
       
   252  * @internalComponent
       
   253  */
       
   254 void AdaptationCliWrapper::SetSimChanged(TBool aChanged)
       
   255 	{
       
   256 	iSimChanged = aChanged;
       
   257 	}
       
   258 
       
   259 /**
       
   260  * Sets the pointer to the status for calls to RSsmSimAdaptation::NotifySimEvent() 
       
   261  * 
       
   262  * @test
       
   263  * @internalComponent
       
   264  */
       
   265 void AdaptationCliWrapper::SetSimNotifyStatus(TRequestStatus* aStatus)
       
   266 	{
       
   267 	iSimNotifyStatus = aStatus;
       
   268 	}
       
   269 
       
   270 /**
       
   271  * Returns the pointer to the status for calls to RSsmSimAdaptation::NotifySimEvent() 
       
   272  * 
       
   273  * @test
       
   274  * @internalComponent
       
   275  */
       
   276 TRequestStatus* AdaptationCliWrapper::GetSimNotifyStatus()
       
   277 	{
       
   278 	return iSimNotifyStatus;
       
   279 	}
       
   280 	
       
   281 /**
       
   282  * Sets the pointer to the pckg for calls to RSsmSimAdaptation::NotifySimEvent() 
       
   283  * 
       
   284  * @test
       
   285  * @internalComponent
       
   286  */
       
   287 void AdaptationCliWrapper::SetSimEventPckg(TDes8* aPckg)
       
   288 	{
       
   289 	iSimEventPckg = aPckg;
       
   290 	}
       
   291 
       
   292 /**
       
   293  * Returns the pointer to the pckg for calls to RSsmSimAdaptation::NotifySimEvent() 
       
   294  * 
       
   295  * @test
       
   296  * @internalComponent
       
   297  */
       
   298 TDes8* AdaptationCliWrapper::GetSimEventPckg()
       
   299 	{
       
   300 	return iSimEventPckg;
       
   301 	}
       
   302 	
       
   303 /**
       
   304  * Holds the value to be returned by calls to RSsmAdaptionBase::Connect()
       
   305  * 
       
   306  * @test
       
   307  * @internalComponent
       
   308  */
       
   309 TInt AdaptationCliWrapper::iSimChangedReturn = KErrNone;
       
   310 
       
   311 /**
       
   312  * Holds the value to be returned by calls to RSsmAdaptionBase::Connect()
       
   313  * 
       
   314  * @test
       
   315  * @internalComponent
       
   316  */
       
   317 TInt AdaptationCliWrapper::iSimOwnedReturn = KErrNone;
       
   318 
       
   319 /**
       
   320  * Holds a pointer to the TRequestStatus give to RSsmSimAdaption::NotifySimEvent()
       
   321  * 
       
   322  * @test
       
   323  * @internalComponent
       
   324  */
       
   325 TRequestStatus* AdaptationCliWrapper::iSimNotifyStatus = NULL;
       
   326 
       
   327 /**
       
   328  * Holds the value to be returned by calls to RSsmSimAdaption::GetSimChanged()
       
   329  * 
       
   330  * @test
       
   331  * @internalComponent
       
   332  */
       
   333 TBool AdaptationCliWrapper::iSimChanged = EFalse;
       
   334 
       
   335 /**
       
   336  * Holds the value to be returned by calls to RSsmSimAdaption::GetSimOwned()
       
   337  * 
       
   338  * @test
       
   339  * @internalComponent
       
   340  */
       
   341 TBool AdaptationCliWrapper::iSimOwned = EFalse;
       
   342 
       
   343 /**
       
   344  * Holds a pointer to the package given to RSsmSimAdaption::NotifySimEvent()
       
   345  * 
       
   346  * @test
       
   347  * @internalComponent
       
   348  */
       
   349 TDes8* AdaptationCliWrapper::iSimEventPckg = NULL;
       
   350 
       
   351 /**
       
   352  * Holds the value to be returned by calls to RSsmAdaptionBase::Connect()
       
   353  * 
       
   354  * @test
       
   355  * @internalComponent
       
   356  */
       
   357 TInt AdaptationCliWrapper::iSsmAdaptationBaseNextConnect = KErrNone;
       
   358 
       
   359 
       
   360 /**
       
   361  * Holds the validity value to be returned by calls to RSsmRtcAdaption::ValidateRtc()
       
   362  * 
       
   363  * @test
       
   364  * @internalComponent
       
   365  */
       
   366 TBool AdaptationCliWrapper::iSsmRtcAdaptationNextValidity = EFalse;
       
   367 
       
   368 /**
       
   369  * Holds the value for completion of aStatus by calls to RSsmRtcAdaption::ValidateRtc()
       
   370  * 
       
   371  * @test
       
   372  * @internalComponent
       
   373  */
       
   374 TInt AdaptationCliWrapper::iSsmRtcAdaptationNextValidityReturn = KErrNone;
       
   375 
       
   376 /**
       
   377  * Holds the value for completion of aStatus by calls to RSsmEmergencyCallRfAdaption::ActivateRfForEmergencyCall()
       
   378  * and RSsmEmergencyCallRfAdaption::DeactivateRfForEmergencyCall()
       
   379  * 
       
   380  * @test
       
   381  * @internalComponent
       
   382  */
       
   383 TInt AdaptationCliWrapper::iSsmEmergencyCallReturnValue = KErrNone;