sysstatemgmt/systemstatemgr/sus/src/ssmadaptationcli.cpp
changeset 0 4e1aa6a622a0
child 3 a811597961f0
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 //
       
    15 
       
    16 #include <ssm/ssmadaptationcli.h>
       
    17 #include <s32mem.h>
       
    18 #include <e32base.h>
       
    19 #include <e32cmn.h>
       
    20 #include "susadaptionclisrv.h"
       
    21 
       
    22 const TInt KAsyncMessageSlots = -1;
       
    23 
       
    24 
       
    25 /**
       
    26  Connect this session without pre-allocating any asynchronous message slots.
       
    27  
       
    28  @return KErrNone, if successful, otherwise one of the other system-wide
       
    29  			error codes.
       
    30  
       
    31  @publishedPartner
       
    32  @released
       
    33  */
       
    34 EXPORT_C TInt RSsmAdaptationBase::Connect()
       
    35 	{
       
    36 	const TInt err = DoConnect(KAsyncMessageSlots);
       
    37 	return err;
       
    38 	}
       
    39 
       
    40 /**
       
    41  Connect this session and pre-allocate the number of asynchronous message slots you will need.
       
    42  I.e. the max number of asynchronoud calls to this call you will ever need.
       
    43  
       
    44  Use this version of @c Connect if you want to be guarantee allocation of slots rather
       
    45  than relying on slots being allocated from the system wide pool.
       
    46 
       
    47  @return KErrNone, if successful, otherwise one of the other system-wide
       
    48  			error codes.
       
    49  
       
    50  @publishedPartner
       
    51  @released
       
    52  */
       
    53 EXPORT_C TInt RSsmAdaptationBase::Connect(TInt aAsyncMessageSlotCount)
       
    54 	{
       
    55 	const TInt err = DoConnect(aAsyncMessageSlotCount);
       
    56 	return err;
       
    57 	}
       
    58 
       
    59 TInt RSsmAdaptationBase::DoConnect(TInt aAsyncMessageSlotCount)
       
    60 	{
       
    61 	if(!Handle())
       
    62 		{
       
    63 		return CreateSession(KSusAdaptionServerName, Version(), aAsyncMessageSlotCount);
       
    64 		}
       
    65 	
       
    66 	return KErrAlreadyExists;
       
    67 	}
       
    68 
       
    69 /**
       
    70  @internalComponent
       
    71  @released
       
    72  */
       
    73 TVersion RSsmAdaptationBase::Version() const
       
    74 	{
       
    75 	return(TVersion(KSsmAdaptationMajorVersionNumber, KSsmAdaptationMinorVersionNumber, KSsmAdaptationBuildVersionNumber));
       
    76 	}
       
    77 
       
    78 /**
       
    79  Requests the cooperating system to perform a state change matching the current system state.
       
    80   
       
    81  @param aState		The requested system state to change to for the cooperating system.
       
    82  					After succesful execution of this API the Cooperating system will be
       
    83  					the state aState
       
    84  
       
    85  @param aStatus 	The request status.
       
    86 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
    87 					is not supported by the adaptation, KErrPermissionDenied if the current client
       
    88 					process does not have the SecureID of the System State Manager, otherwise one of
       
    89 					the other system-wide error codes.
       
    90 					
       
    91  @note The aStatus can be completed with a value other than KErrNone if the cooperating system
       
    92  		has rejected the requested state change.
       
    93  
       
    94  @note This API can only be called by processes with the SecureID of the System State Manager.
       
    95  
       
    96  @publishedPartner
       
    97  @released
       
    98  */
       
    99 EXPORT_C void RSsmStateAdaptation::RequestCoopSysStateChange(TSsmState aState, TRequestStatus& aStatus)
       
   100 	{
       
   101 	if(Handle())
       
   102 		{
       
   103 		SendReceive(ERequestCoopSysStateChange, TIpcArgs(aState.Int()), aStatus);
       
   104 		}
       
   105 	else
       
   106 		{
       
   107 		aStatus = KRequestPending;
       
   108 		TRequestStatus* clientStatus = &aStatus;
       
   109 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   110 		}
       
   111 	} //lint !e1746 Suppress parameter 'aState' could be made const reference
       
   112 
       
   113 /**
       
   114  Requests the cooperating system to perform self tests.
       
   115   
       
   116  @param aStatus 	The request status.
       
   117 					This is set to KErrNone on successful completion of self tests, KErrNotSupported
       
   118 					if this operations is not supported by the adaptation, KErrPermissionDenied
       
   119 					if the current process does not have the SecureID of the System State Manager,
       
   120 					otherwise one of the other system-wide error codes.
       
   121 
       
   122  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   123  
       
   124  @publishedPartner
       
   125  @released
       
   126  */
       
   127 EXPORT_C void RSsmStateAdaptation::RequestCoopSysSelfTest(TRequestStatus& aStatus)
       
   128 	{
       
   129 	if(Handle())
       
   130 		{
       
   131 		SendReceive(ERequestCoopSysSelfTest, aStatus);
       
   132 		}
       
   133 	else
       
   134 		{
       
   135 		aStatus = KRequestPending;
       
   136 		TRequestStatus* clientStatus = &aStatus;
       
   137 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   138 		}
       
   139 	}
       
   140 
       
   141 /**
       
   142  Requests the cooperating system to perform any actions necessary before the system is restarted.
       
   143  
       
   144  @param aReason		The reason for the system restart. The meaning of this value is specific to
       
   145  					the	cooperating system.
       
   146   
       
   147  @param aStatus 	The request status.
       
   148 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   149 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   150 					does not have the SecureID of the System State Manager, otherwise one of
       
   151 					the other system-wide error codes.
       
   152 
       
   153  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   154  
       
   155  @publishedPartner
       
   156  @released
       
   157  */
       
   158 EXPORT_C void RSsmStateAdaptation::RequestCoopSysPerformRestartActions(TInt aReason, TRequestStatus& aStatus)
       
   159 	{
       
   160 	if(Handle())
       
   161 		{
       
   162 		SendReceive(ERequestCoopSysPerformRestartActions, TIpcArgs(aReason), aStatus);
       
   163 		}
       
   164 	else
       
   165 		{
       
   166 		aStatus = KRequestPending;
       
   167 		TRequestStatus* clientStatus = &aStatus;
       
   168 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   169 		}
       
   170 	}
       
   171 
       
   172 /**
       
   173  Requests the cooperating system to perform any actions necessary before the system is shutdown.
       
   174  
       
   175  @param aReason		The reason for the system shutdown. The meaning of this value is specific to
       
   176  					the	cooperating system.
       
   177   
       
   178  @param aStatus 	The request status.
       
   179 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   180 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   181 					does not have the SecureID of the System State Manager, otherwise one of
       
   182 					the other system-wide error codes.
       
   183  
       
   184  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   185  
       
   186  @publishedPartner
       
   187  @released
       
   188  */
       
   189 EXPORT_C void RSsmStateAdaptation::RequestCoopSysPerformShutdownActions(TInt aReason, TRequestStatus& aStatus)
       
   190 	{
       
   191 	if(Handle())
       
   192 		{
       
   193 		SendReceive(ERequestCoopSysPerformShutdownActions, TIpcArgs(aReason), aStatus);
       
   194 		}
       
   195 	else
       
   196 		{
       
   197 		aStatus = KRequestPending;
       
   198 		TRequestStatus* clientStatus = &aStatus;
       
   199 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   200 		}
       
   201 	}
       
   202 
       
   203 /**
       
   204  Requests the cooperating system to perform any actions necessary for restoring settings to default values.
       
   205  
       
   206  @param aType		The level of restoring settings to default values to perform.
       
   207  
       
   208  @param aStatus 	The request status.
       
   209 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   210 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   211 					does not have the SecureID of the System State Manager, otherwise one of
       
   212 					the other system-wide error codes.
       
   213  
       
   214  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   215  
       
   216  @see TSsmRfsType
       
   217  
       
   218  @publishedPartner
       
   219  @released
       
   220  */
       
   221 EXPORT_C void RSsmStateAdaptation::RequestCoopSysPerformRfsActions(TSsmRfsType aType, TRequestStatus& aStatus)
       
   222 	{
       
   223 	if(Handle())
       
   224 		{
       
   225 		SendReceive(ERequestCoopSysPerformRfsActions, TIpcArgs(aType), aStatus);
       
   226 		}
       
   227 	else
       
   228 		{
       
   229 		aStatus = KRequestPending;
       
   230 		TRequestStatus* clientStatus = &aStatus;
       
   231 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   232 		}
       
   233 	}
       
   234 
       
   235 /** 
       
   236  Cancels the current outstanding request from the cooperating system.
       
   237  
       
   238  Calling this API does not cancel any outstanding notification request. Use @c NotifyCancel()
       
   239  to cancel outstanding notification requests.
       
   240  
       
   241  If the request is successfully cancelled then the TRequestStatus associated with that request
       
   242  will be completed with KErrCancel.
       
   243   
       
   244  @publishedPartner
       
   245  @released
       
   246  */
       
   247 EXPORT_C void RSsmStateAdaptation::RequestCancel()
       
   248 	{
       
   249 	if(Handle())
       
   250 		{
       
   251 		SendReceive(ERequestCoopSysCancel);
       
   252 		}
       
   253 	}
       
   254 
       
   255 /** 
       
   256  Returns the last event occured in the aTypePckg which is a package of TSsmCoopSysEventType 
       
   257  
       
   258  Calling this API will get the last notification received by Adaptation server.If the client
       
   259  needs to be notified about the notifications client has to register using NotifyCoopSysEvent
       
   260  But once the client receives a notification it has to register again using NotifyCoopSysEvent
       
   261  for  further notification.
       
   262  To get any events that are missed between two notification requests the API GetLastCoopSysEvent
       
   263  can be used.
       
   264  This API can also be used to just get the last notified State event from Adaptation server.
       
   265   
       
   266  @publishedPartner
       
   267  @released
       
   268  */
       
   269 
       
   270 
       
   271 EXPORT_C void RSsmStateAdaptation::GetLastCoopSysEvent(TDes8& aTypePckg)
       
   272 	{
       
   273 	if(Handle())
       
   274 		{
       
   275 		SendReceive(EGetLastCoopSysEvent, TIpcArgs(&aTypePckg));
       
   276 		}
       
   277 	}
       
   278 
       
   279 
       
   280 /**
       
   281  Requests notification of cooperating system events.
       
   282  
       
   283  @param aChangedPckg 	A descriptor packaging a TSsmCoopSysEventType object, such as TPckg<TSsmCoopSysEventType>.
       
   284  					The descriptor referenced should exist until aStatus is completed.
       
   285  					When aStatus is completed with KErrNone this descriptor will contain a valid value
       
   286  					describing the cooperating system event.
       
   287  
       
   288  @param aStatus 	The request status.
       
   289 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   290 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   291 					does not have the SecureID of the SSM Utility Server, otherwise one of
       
   292 					the other system-wide error codes.
       
   293  
       
   294  @note This API can only be called by processes with the SecureID of the SSM Utility Server.
       
   295  
       
   296  @see TSsmCoopSysEventType
       
   297  
       
   298  @publishedPartner
       
   299  @released
       
   300  */
       
   301 EXPORT_C void RSsmStateAdaptation::NotifyCoopSysEvent(TDes8& aTypePckg, TRequestStatus& aStatus)
       
   302 	{
       
   303 	if(Handle())
       
   304 		{
       
   305 		SendReceive(ENotifyCoopSysEvent, TIpcArgs(&aTypePckg), aStatus);
       
   306 		}
       
   307 	else
       
   308 		{
       
   309 		aStatus = KRequestPending;
       
   310 		TRequestStatus* clientStatus = &aStatus;
       
   311 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   312 		}
       
   313 	}
       
   314 
       
   315 /**
       
   316  Cancels the current outstanding request for notification of cooperating system events.
       
   317  
       
   318  Calling this API does not cancel any outstanding 'Request...' request. Use @c RequestCancel()
       
   319  to cancel outstanding 'Request...' requests.
       
   320  
       
   321  If the request is successfully cancelled then the TRequestStatus associated with the notification
       
   322  request will be completed with KErrCancel.
       
   323   
       
   324  @publishedPartner
       
   325  @released
       
   326  */
       
   327 EXPORT_C void RSsmStateAdaptation::NotifyCancel()
       
   328 	{
       
   329 	if(Handle())
       
   330 		{
       
   331 		SendReceive(ENotifyCoopSysCancel);
       
   332 		}
       
   333 	}
       
   334 
       
   335 /**
       
   336  Retrieve information about if the current SIM card, if any, is classed as owned.
       
   337  
       
   338  The conditions on a SIM card being classed as owned are dependent on the adaptation implementation.
       
   339  
       
   340  @param aOwnedPckg 	A descriptor packaging a TBool object, such as TPckg<TBool>. The descriptor
       
   341  					referenced should exist until aStatus is completed. When aStatus is completed
       
   342  					with KErrNone this descriptor will contain ETrue if the SIM card is owned, EFalse
       
   343  					otherwise.
       
   344  
       
   345  @param aStatus 	The request status.
       
   346 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   347 					is not supported by the adaptation, otherwise one of the other system-wide 
       
   348 					error codes.
       
   349  
       
   350  @publishedPartner
       
   351  @released
       
   352  */
       
   353 EXPORT_C void RSsmSimAdaptation::GetSimOwned(TDes8& aOwnedPckg, TRequestStatus& aStatus)
       
   354 	{
       
   355 	if(Handle())
       
   356 		{
       
   357 		SendReceive(EGetSimOwned, TIpcArgs(&aOwnedPckg), aStatus);
       
   358 		}
       
   359 	else
       
   360 		{
       
   361 		aStatus = KRequestPending;
       
   362 		TRequestStatus* clientStatus = &aStatus;
       
   363 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   364 		}
       
   365 	}
       
   366 
       
   367 /**
       
   368  Cancels the current outstanding request for either the SIM changed or SIM owned information.
       
   369  
       
   370  Calling this API does not cancel any outstanding notification request. Use @c NotifyCancel()
       
   371  to cancel outstanding notification requests.
       
   372  
       
   373  If the request is successfully cancelled then the TRequestStatus associated with that request
       
   374  will be completed with KErrCancel.
       
   375   
       
   376  @publishedPartner
       
   377  @released
       
   378  */
       
   379 EXPORT_C void RSsmSimAdaptation::GetCancel()
       
   380 	{
       
   381 	if(Handle())
       
   382 		{
       
   383 		SendReceive(EGetSimCancel);
       
   384 		}
       
   385 	}
       
   386 
       
   387 /** 
       
   388  Returns the last event occured in the aTypePckg which is a package of TSsmSimEventType 
       
   389  
       
   390  Calling this API will get the last notification received by Adaptation server.If the client
       
   391  needs to be notified about the notifications client has to register using NotifySimEvent
       
   392  But once the client receives a notification it has to register again using NotifySimEvent for 
       
   393  further notification.
       
   394  To get any events that are missed between two notification requests the API GetLastSimEvent
       
   395  can be used.
       
   396  This API can also be used to just get the last notified Sim event from Adaptation server.
       
   397   
       
   398  @publishedPartner
       
   399  @released
       
   400  */
       
   401 
       
   402 
       
   403 EXPORT_C void RSsmSimAdaptation::GetLastSimEvent(TDes8& aTypePckg)
       
   404 	{
       
   405 	if(Handle())
       
   406 		{
       
   407 		SendReceive(EGetLastSimEvent, TIpcArgs(&aTypePckg));
       
   408 		}
       
   409 	}
       
   410 
       
   411 
       
   412 
       
   413 
       
   414 /**
       
   415  Requests notification of SIM events.
       
   416  
       
   417  @param aChangedPckg 	A descriptor packaging a TSsmSimEventType object, such as TPckg<TSsmSimEventType>.
       
   418  					The descriptor referenced should exist until aStatus is completed. When
       
   419  					aStatus is completed with KErrNone this descriptor will contain a valid
       
   420  					value describing the SIM event.
       
   421  
       
   422  @param aStatus 	The request status.
       
   423 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   424 					is not supported by the adaptation, otherwise one of the other system-wide 
       
   425 					error codes.
       
   426  
       
   427  @see TSsmSimEventType
       
   428  
       
   429  @publishedPartner
       
   430  @released
       
   431  */
       
   432 EXPORT_C void RSsmSimAdaptation::NotifySimEvent(TDes8& aTypePckg, TRequestStatus& aStatus)
       
   433 	{
       
   434 	if(Handle())
       
   435 		{
       
   436 		SendReceive(ENotifySimEvent, TIpcArgs(&aTypePckg), aStatus);
       
   437 		}
       
   438 	else
       
   439 		{
       
   440 		aStatus = KRequestPending;
       
   441 		TRequestStatus* clientStatus = &aStatus;
       
   442 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   443 		}
       
   444 	}
       
   445 
       
   446 /**
       
   447  Cancels the current outstanding request for notification of SIM events.
       
   448  
       
   449  Calling this API does not cancel any outstanding 'Get...' request. Use @c GetCancel()
       
   450  to cancel outstanding 'Get...' requests.
       
   451  
       
   452  If the request is successfully cancelled then the TRequestStatus associated with the notification
       
   453  request will be completed with KErrCancel.
       
   454   
       
   455  @publishedPartner
       
   456  @released
       
   457  */
       
   458 EXPORT_C void RSsmSimAdaptation::NotifyCancel()
       
   459 	{
       
   460 	if(Handle())
       
   461 		{
       
   462 		SendReceive(ENotifySimCancel);
       
   463 		}
       
   464 	}
       
   465 
       
   466 /**
       
   467  Retrieve information about if the real time clock, if present, contains a valid time.
       
   468  
       
   469  @param aValidityPckg 	A descriptor packaging a TBool object, such as TPckg<TBool>. The descriptor
       
   470  					referenced should exist until aStatus is completed. When aStatus is completed
       
   471  					with KErrNone this descriptor will contain ETrue if the real time clock is valid,
       
   472  					EFalse otherwise.
       
   473  
       
   474  @param aStatus 	The request status.
       
   475 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   476 					is not supported by the adaptation, otherwise one of the other system-wide 
       
   477 					error codes.
       
   478  
       
   479  @publishedPartner
       
   480  @released
       
   481  */
       
   482 EXPORT_C void RSsmRtcAdaptation::ValidateRtc(TDes8& aValidityPckg, TRequestStatus& aStatus)
       
   483 	{
       
   484 	if(Handle())
       
   485 		{
       
   486 		SendReceive(EValidateRtc, TIpcArgs(&aValidityPckg), aStatus);
       
   487 		}
       
   488 	else
       
   489 		{
       
   490 		aStatus = KRequestPending;
       
   491 		TRequestStatus* clientStatus = &aStatus;
       
   492 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   493 		}	
       
   494 	}
       
   495 
       
   496 /**
       
   497  Request that the device wake-up at a certain time, even if the device is switched off.
       
   498  
       
   499  @param aAlarmTimePckg 	A descriptor packaging a TTime object, such as TPckgC<TTime>. The descriptor
       
   500  					referenced should exist until aStatus is completed. This descriptor should
       
   501  					contain a TTime object representing the UTC time that the device should wake-up.
       
   502  
       
   503  @param aStatus 	The request status.
       
   504 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   505 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   506 					does not have the SecureID of the Alarm Server, otherwise one of
       
   507 					the other system-wide error codes.
       
   508  
       
   509  @note This API can only be called by processes with the SecureID of the Alarm Server.
       
   510  
       
   511  @see TTime
       
   512  
       
   513  @publishedPartner
       
   514  @released
       
   515  */
       
   516 EXPORT_C void RSsmRtcAdaptation::SetWakeupAlarm(TDesC8& aAlarmTimePckg, TRequestStatus& aStatus)
       
   517 	{
       
   518 	if(Handle())
       
   519 		{
       
   520 		SendReceive(ESetWakeupAlarm, TIpcArgs(&aAlarmTimePckg), aStatus);
       
   521 		}
       
   522 	else
       
   523 		{
       
   524 		aStatus = KRequestPending;
       
   525 		TRequestStatus* clientStatus = &aStatus;
       
   526 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   527 		}
       
   528 	}
       
   529 
       
   530 /**
       
   531  Stops the device from waking-up at a time set by a previous call to @c SetWakeupAlarm().
       
   532   
       
   533  @param aStatus 	The request status.
       
   534 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   535 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   536 					does not have the SecureID of the Alarm Server, otherwise one of
       
   537 					the other system-wide error codes.
       
   538  
       
   539  @note This API can only be called by processes with the SecureID of the Alarm Server.
       
   540  
       
   541  @see RSsmRtcAdaptation::SetWakeupAlarm()
       
   542  
       
   543  @publishedPartner
       
   544  @released
       
   545  */
       
   546 EXPORT_C void RSsmRtcAdaptation::UnsetWakeupAlarm(TRequestStatus& aStatus)
       
   547 	{
       
   548 	if(Handle())
       
   549 		{
       
   550 		SendReceive(EUnsetWakeupAlarm, aStatus);
       
   551 		}
       
   552 	else
       
   553 		{
       
   554 		aStatus = KRequestPending;
       
   555 		TRequestStatus* clientStatus = &aStatus;
       
   556 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   557 		}
       
   558 	}
       
   559 
       
   560 /**
       
   561  Cancels the current outstanding request on this R class.
       
   562  
       
   563  Calling this API does not cancel any wake-up time that is set. Use @c UnsetWakeupAlarm() to do this.
       
   564  
       
   565  If the request is successfully cancelled then the TRequestStatus associated with that request
       
   566  will be completed with KErrCancel.
       
   567   
       
   568  @publishedPartner
       
   569  @released
       
   570 */
       
   571 EXPORT_C void RSsmRtcAdaptation::Cancel()
       
   572 	{
       
   573 	if(Handle())
       
   574 		{
       
   575 		SendReceive(ERtcCancel);
       
   576 		}
       
   577 	}
       
   578 
       
   579 /**
       
   580  Communicates a security state change with the adaptation.
       
   581  
       
   582  @param aState      The security state that has been changed to by the security state machine. The
       
   583  					meaning of this value is dependent on the adaptation.
       
   584  
       
   585  @param aResponsePckg	A descriptor packaging a TInt object, such as TPckg<TInt>. The descriptor
       
   586  					referenced should exist until aStatus is completed. This descriptor will contain
       
   587  					the response from the adaptation to this security state change. The meaning of this
       
   588  					value is dependent on the adaptation.
       
   589   
       
   590  @param aStatus 	The request status.
       
   591 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   592 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   593 					does not have the SecureID of the System State Manager, otherwise one of
       
   594 					the other system-wide error codes.
       
   595  
       
   596  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   597  
       
   598  @publishedPartner
       
   599  @released
       
   600 */
       
   601 EXPORT_C void RSsmMiscAdaptation::SecurityStateChange(TInt aState, TDes8& aResponsePckg, TRequestStatus& aStatus)
       
   602 	{
       
   603 	if(Handle())
       
   604 		{
       
   605 		SendReceive(ESecurityStateChange, TIpcArgs(aState, &aResponsePckg), aStatus);
       
   606 		}
       
   607 	else
       
   608 		{
       
   609 		aStatus = KRequestPending;
       
   610 		TRequestStatus* clientStatus = &aStatus;
       
   611 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   612 		}
       
   613 	}
       
   614 
       
   615 /**
       
   616  Retrieves the startup mode from the adaptation.
       
   617  
       
   618  @param aModePckg	A descriptor packaging a TInt object, such as TPckg<TInt>. The descriptor
       
   619  					referenced should exist until aStatus is completed. When aStatus is completed
       
   620  					with KErrNone this descriptor will contain the startup mode. The meaning of this
       
   621  					startup mode value is dependent on the adaptation.
       
   622  
       
   623  @param aStatus 	The request status.
       
   624 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   625 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   626 					does not have the SecureID of the System State Manager, otherwise one of
       
   627 					the other system-wide error codes.
       
   628  
       
   629  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   630  
       
   631  @publishedPartner
       
   632  @released
       
   633 */
       
   634 EXPORT_C void RSsmMiscAdaptation::GetGlobalStartupMode(TDes8& aModePckg, TRequestStatus& aStatus)
       
   635 	{
       
   636 	if(Handle())
       
   637 		{
       
   638 		SendReceive(EGetGlobalStartupMode, TIpcArgs(&aModePckg), aStatus);
       
   639 		}
       
   640 	else
       
   641 		{
       
   642 		aStatus = KRequestPending;
       
   643 		TRequestStatus* clientStatus = &aStatus;
       
   644 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   645 		}
       
   646 	}
       
   647 
       
   648 /**
       
   649   Retrieve information about Hidden reset.
       
   650 
       
   651  @param aHiddenResetPckg	A descriptor packaging a TBool object, such as TPckg<TBool>. The descriptor
       
   652  							referenced should exist until aStatus is completed. When aStatus is completed
       
   653  							with KErrNone this descriptor will contain ETrue if Hidden reset is to be done , EFalse
       
   654  							otherwise.
       
   655  
       
   656 @param aStatus 				The request status. This is set to KErrNone on successful completion, KErrNotSupported if this 
       
   657                             operations is not supported by the adaptation, KErrPermissionDenied if the current process
       
   658 							does not have the SecureID of the System State Manager, KErrDisconnected if there is no handle to
       
   659 							adaptation server, otherwise one of the other system-wide error codes.
       
   660  
       
   661  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   662   
       
   663  @publishedPartner
       
   664  @released
       
   665 */
       
   666 EXPORT_C void RSsmMiscAdaptation::GetHiddenReset(TDes8& aHiddenResetPckg, TRequestStatus& aStatus)
       
   667 	{
       
   668 	if(Handle())
       
   669 		{
       
   670 		SendReceive(EGetHiddenReset, TIpcArgs(&aHiddenResetPckg), aStatus);
       
   671 		}
       
   672 	else
       
   673 		{
       
   674 		aStatus = KRequestPending;
       
   675 		TRequestStatus* clientStatus = &aStatus;
       
   676 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   677 		}
       
   678 	}
       
   679 
       
   680 /**
       
   681  Prepares the SIM languages list for retrieval.
       
   682  
       
   683  @param aPriority  Specifies which languages list should be prepared for retrieval.
       
   684  
       
   685  @param aSizePckg   A descriptor packaging a TInt object, such as TPckg<TInt>. The descriptor
       
   686  					referenced should exist until aStatus is completed. When aStatus is completed
       
   687  					with KErrNone this descriptor will contain the number of elements in the
       
   688  					language list.
       
   689  
       
   690  @param aStatus 	The request status.
       
   691 					This is set to KErrNone on completion, KErrNotSupported if this operations 
       
   692 					is not supported by the adaptation, KErrPermissionDenied if the current process
       
   693 					does not have the SecureID of the System State Manager, otherwise one of
       
   694 					the other system-wide error codes.
       
   695  
       
   696  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   697  
       
   698  @see RSsmMiscAdaptation::SimLanguagesArrayL()
       
   699  
       
   700  @publishedPartner
       
   701  @released
       
   702 */
       
   703 EXPORT_C void RSsmMiscAdaptation::PrepareSimLanguages(TSsmLanguageListPriority aPriority, TDes8& aSizePckg, TRequestStatus& aStatus)
       
   704 	{
       
   705 	if(Handle())
       
   706 		{
       
   707 		SendReceive(EPrepareSimLanguages, TIpcArgs(aPriority, &aSizePckg), aStatus);
       
   708 		}
       
   709 	else
       
   710 		{
       
   711 		aStatus = KRequestPending;
       
   712 		TRequestStatus* clientStatus = &aStatus;
       
   713 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   714 		}
       
   715 	}
       
   716 
       
   717 /**
       
   718  Retrieves the SIM lanugages list.
       
   719  
       
   720  This will retrieve the SIM languages list in a dynamic array, the list was prepared by a previous successful call to @c PrepareSimLanguages().
       
   721  
       
   722  @param aSimLanguageCount   The count of the languages as prepared in a previous call to @c PrepareSimLanguages().
       
   723                             This count is used to allocate and expand the size of the flat buffer. 
       
   724                                                 
       
   725  @return A pointer to the fixed length array CArrayFix<TInt32> of language codes.
       
   726  
       
   727  @note This API can only be called by processes with the SecureID of the System State Manager.
       
   728  
       
   729  @see RSsmMiscAdaptation::PrepareSimLanguages
       
   730  
       
   731  @publishedPartner
       
   732  @released
       
   733 */
       
   734 EXPORT_C CArrayFix<TInt32>* RSsmMiscAdaptation::SimLanguagesArrayL(TInt aSimLanguageCount)
       
   735 	{
       
   736 	if(! Handle())
       
   737 		{
       
   738 		User::Leave(KErrDisconnected);
       
   739 		}
       
   740 	CArrayFix<TInt32>* clientArray = new (ELeave) CArrayFixFlat<TInt32>(2);
       
   741 	CleanupStack::PushL(clientArray);
       
   742 
       
   743 	CBufFlat* buffer=CBufFlat::NewL(aSimLanguageCount);
       
   744 	CleanupStack::PushL(buffer);
       
   745 	const TInt length = aSimLanguageCount * sizeof(TInt32);
       
   746 	buffer->ExpandL(0,length);
       
   747 	TPtr8 bufPtr = buffer->Ptr(0);
       
   748 	User::LeaveIfError(SendReceive(EGetSimLanguagesArray, TIpcArgs(&bufPtr, aSimLanguageCount)));
       
   749 
       
   750 	RBufReadStream readStream(*buffer);
       
   751 	CleanupClosePushL(readStream);
       
   752 	
       
   753 	TInt32 langId = 0; //Initialized with value 0 because this value is not a language id 
       
   754 	for (TInt i=0; i < aSimLanguageCount; ++i)
       
   755 		{
       
   756 		langId = readStream.ReadInt32L();
       
   757 		clientArray->AppendL(langId);  
       
   758 		}
       
   759 	
       
   760 	CleanupStack::PopAndDestroy(2); //readStream, buffer
       
   761 	CleanupStack::Pop(clientArray);
       
   762 	return clientArray;
       
   763 	}
       
   764 
       
   765 /**
       
   766  Cancels the current outstanding request on this R class.
       
   767  
       
   768  If the request is successfully cancelled then the TRequestStatus associated with that request
       
   769  will be completed with KErrCancel.
       
   770  
       
   771  @publishedPartner
       
   772  @released
       
   773 */
       
   774 EXPORT_C void RSsmMiscAdaptation::Cancel()
       
   775 	{
       
   776 	if(Handle())
       
   777 		{
       
   778 		SendReceive(EMiscCancel);
       
   779 		}
       
   780 	}
       
   781 
       
   782 
       
   783 /**
       
   784  Requests the adaptation to enable RF communication for emergency calls.
       
   785    
       
   786  @param aStatus 	The request status.
       
   787 					This is set to KErrNone on successful completion of self tests, KErrNotSupported
       
   788 					if this operations is not supported by the adaptation, KErrPermissionDenied
       
   789 					if the current process does not have sufficient capabilities, otherwise one
       
   790 					of the other system-wide error codes.
       
   791 
       
   792  @capability WriteDeviceData
       
   793  @capability PowerMgmt
       
   794  
       
   795  @publishedPartner
       
   796  @released
       
   797  */
       
   798 EXPORT_C void RSsmEmergencyCallRfAdaptation::ActivateRfForEmergencyCall(TRequestStatus& aStatus)
       
   799 	{
       
   800 	if(Handle())
       
   801 		{
       
   802 		SendReceive(EActivateRfForEmergencyCall, aStatus);
       
   803 		}
       
   804 	else
       
   805 		{
       
   806 		aStatus = KRequestPending;
       
   807 		TRequestStatus* clientStatus = &aStatus;
       
   808 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   809 		}
       
   810 	}
       
   811 
       
   812 /**
       
   813   Requests the adaptation to disable RF communication for emergency calls.
       
   814    
       
   815  @param aStatus 	The request status.
       
   816 					This is set to KErrNone on successful completion of self tests, KErrNotSupported
       
   817 					if this operations is not supported by the adaptation, KErrPermissionDenied
       
   818 					if the current process does not have sufficient capabilities, otherwise one
       
   819 					of the other system-wide error codes.
       
   820 					
       
   821  @capability WriteDeviceData
       
   822  @capability PowerMgmt
       
   823  
       
   824  @publishedPartner
       
   825  @released
       
   826  */
       
   827 EXPORT_C void RSsmEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall(TRequestStatus& aStatus)
       
   828 	{
       
   829 	if(Handle())
       
   830 		{
       
   831 		SendReceive(EDeactivateRfForEmergencyCall, aStatus);
       
   832 		}
       
   833 	else
       
   834 		{
       
   835 		aStatus = KRequestPending;
       
   836 		TRequestStatus* clientStatus = &aStatus;
       
   837 		User::RequestComplete(clientStatus, KErrDisconnected);
       
   838 		}
       
   839 	}
       
   840 
       
   841 /**
       
   842  Cancels the current outstanding request on this R class.
       
   843  
       
   844  If the request is successfully cancelled then the TRequestStatus associated with that request
       
   845  will be completed with KErrCancel.
       
   846  
       
   847  @publishedPartner
       
   848  @released
       
   849  */
       
   850 EXPORT_C void RSsmEmergencyCallRfAdaptation::Cancel()
       
   851 	{
       
   852 	if(Handle())
       
   853 		{
       
   854 		SendReceive(EEmergencyCallRfCancel);
       
   855 		}
       
   856 	}
       
   857 
       
   858 /**
       
   859  The Session calling this API will be set as priorityClient. 
       
   860  This has to be called after Connect() and before calling ActivateRfForEmergencyCall(). This will allow priority client to
       
   861  make emergency call during OOM condition.
       
   862  Session having Telephony SecureId can only be set as a PriorityClient by SSM.
       
   863  This API preloads the emergencyclient dll if it is not loaded and also allows to use reserved
       
   864  memory in OOM condition
       
   865  @return KErrNone, if successful, KErrAlreadyExists if there is already a priority client set, 
       
   866                    KErrDisconnected, if there is no handle, KErrNoMemory in case of OOM,otherwise one of the other system-wide error codes.
       
   867  @publishedPartner
       
   868  @released
       
   869  */
       
   870 EXPORT_C TInt RSsmEmergencyCallRfAdaptation::SetAsPriorityClient()
       
   871     {
       
   872     if(Handle()) 
       
   873         {        
       
   874         return(SendReceive(ESetAsPriorityClient));
       
   875         }
       
   876     return KErrDisconnected;
       
   877     }
       
   878