epoc32/include/smutsimparam.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 smutsimparam.h
     1 // Copyright (c) 1999-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __SMUTSIMPARAM_H__
       
    17 #define __SMUTSIMPARAM_H__
       
    18 
       
    19 #include <msvapi.h>
       
    20 #include <smcmmain.h>
       
    21 
       
    22 /**
       
    23 The UID for the stream into which the SIM parameters are stored.
       
    24 
       
    25 @internalComponent
       
    26 @deprecated
       
    27 Should be moved to the cpp file for this class.
       
    28 */
       
    29 const TUid KUidMsvSimSmsParams = {0x100081BC};
       
    30 
       
    31 class CMobilePhoneSmspList;
       
    32 class TSmsProgress;
       
    33 
       
    34 /**
       
    35 A packaged TInt value.
       
    36 
       
    37 This is used by CSmsSimParamOperation.
       
    38 
       
    39 @see CSmsSimParamOperation::ProgressL()
       
    40 
       
    41 @internalComponent
       
    42 @released
       
    43 */
       
    44 typedef TPckgBuf<TInt> TIntBuf;
       
    45 
       
    46 /**
       
    47 Encapsulates an operation to read/write an array of SMS parameters from a SIM.
       
    48 
       
    49 An operation of this type if returned by the SMS client MTM for the read and
       
    50 write SIM paramter operations.
       
    51 
       
    52 These operations are generated from calling the SMS client MTM APIs 
       
    53 CSmsClientMtm::ReadSimParamsL and CSmsClientMtm::WriteSimParamsL. The 
       
    54 CSmsClientMtm::InvokeAsyncFunctionL API should not be used for these operations.
       
    55 
       
    56 @see	CSmsClientMtm::ReadSimParamsL
       
    57 @see	CSmsClientMtm::WriteSimParamsL
       
    58 
       
    59 @publishedAll
       
    60 @released
       
    61 */
       
    62 class CSmsSimParamOperation : public CMsvOperation
       
    63 	{
       
    64 public:
       
    65 
       
    66 	static CSmsSimParamOperation* ReadSimParamsL(TUid aMtm, TMsvId aService, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    67 	static CSmsSimParamOperation* WriteSimParamsL(const CMobilePhoneSmspList& aList, TUid aMtm, TMsvId aService, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    68 	virtual ~CSmsSimParamOperation();
       
    69 
       
    70 	inline const CMobilePhoneSmspList& SmspList() const;
       
    71 
       
    72 	IMPORT_C CMobilePhoneSmspList* ServiceCentersLC() const;
       
    73 	IMPORT_C const TDesC8& ProgressL();
       
    74 
       
    75 	IMPORT_C static void RestoreSimParamsL(CMsvStore& aStore, CMobilePhoneSmspList& aList);
       
    76 	IMPORT_C static void StoreSimParamsL(CMsvStore& aStore, const CMobilePhoneSmspList& aList);
       
    77 
       
    78 private:	// methods from CActive
       
    79 
       
    80 	virtual void RunL();
       
    81 	virtual void DoCancel();
       
    82 	virtual TInt RunError(TInt aError);
       
    83 
       
    84 private:
       
    85 
       
    86 	CSmsSimParamOperation(TUid aMtm, TMsvId aService, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    87 
       
    88 	void DoReadSimParamsL();
       
    89 	void DoRunReadSimParamsL(/*TSmsProgress aProgress*/);
       
    90 	void DoWriteSimParamsL(const CMobilePhoneSmspList& aList);
       
    91 
       
    92 	void TransferCommandL(TInt aCommandId);
       
    93 	void Complete();
       
    94 
       
    95 private:
       
    96 
       
    97 /**
       
    98 This defines the state machine.
       
    99 */
       
   100 	enum TReadSimParamsState
       
   101 		{
       
   102 /**
       
   103 Specifies waiting state
       
   104 */
       
   105 		EStateWaiting,
       
   106 /**
       
   107 Specifies reading state
       
   108 */
       
   109 		EStateReadingSimParams,	 
       
   110 /**
       
   111 Specifies writing state
       
   112 */
       
   113 		EStateWritingSimParams
       
   114 		} iState;
       
   115 
       
   116 /**
       
   117 A list containing the SMS parameters
       
   118 */
       
   119 	CMobilePhoneSmspList* iSimParams;	
       
   120 	TInt iError;
       
   121 	TIntBuf iProgressBuf;
       
   122 	CMsvOperation* iOperation;
       
   123 	};
       
   124 
       
   125 /**
       
   126 Gets the list of SMS parameters on the SIM, after a successfully completed 
       
   127 read operation.
       
   128 
       
   129 If the operation has not successfully completed, this function returns an 
       
   130 empty list.
       
   131 
       
   132 This function should ot be used with a write SIM parameters operation.
       
   133 
       
   134 @return
       
   135 The list of SMS parameters read from the SIM.
       
   136 
       
   137 @panic	SMCM	3
       
   138 This operation was not reading the SIM parameters. The operation was not returned
       
   139 from CSmsClientMtm::ReadSimParamsL (debug only).
       
   140 */
       
   141 inline const CMobilePhoneSmspList& CSmsSimParamOperation::SmspList() const
       
   142 	{
       
   143 	__ASSERT_DEBUG(iState == EStateReadingSimParams, Panic(ESmscPanicUnexpectedCommand));
       
   144 	return *iSimParams;
       
   145 	}
       
   146 
       
   147 #endif // __SMUTSIMPARAM_H__