messagingappbase/smsmtm/clientmtm/inc/smutsimparam.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     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 "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 // smutsimparam.h
       
    15 //
       
    16 /**
       
    17  * @file 
       
    18  * @publishedAll
       
    19  * @released
       
    20  */
       
    21 #ifndef __SMUTSIMPARAM_H__
       
    22 #define __SMUTSIMPARAM_H__
       
    23 
       
    24 #include <msvapi.h>
       
    25 #include <smcmmain.h>
       
    26 
       
    27 class CMobilePhoneSmspList;
       
    28 class TSmsProgress;
       
    29 
       
    30 /**
       
    31 A packaged TInt value.
       
    32 
       
    33 This is used by CSmsSimParamOperation.
       
    34 
       
    35 @see CSmsSimParamOperation::ProgressL()
       
    36 
       
    37 @publishedAll
       
    38 @released
       
    39 */
       
    40 typedef TPckgBuf<TInt> TIntBuf;
       
    41 
       
    42 /**
       
    43 Encapsulates an operation to read/write an array of SMS parameters from a SIM.
       
    44 
       
    45 An operation of this type if returned by the SMS client MTM for the read and
       
    46 write SIM parameter operations.
       
    47 
       
    48 These operations are generated from calling the SMS client MTM APIs 
       
    49 CSmsClientMtm::ReadSimParamsL and CSmsClientMtm::WriteSimParamsL. The 
       
    50 CSmsClientMtm::InvokeAsyncFunctionL API should not be used for these operations.
       
    51 
       
    52 @see	CSmsClientMtm::ReadSimParamsL
       
    53 @see	CSmsClientMtm::WriteSimParamsL
       
    54 
       
    55 @publishedAll
       
    56 @released
       
    57 */
       
    58 NONSHARABLE_CLASS (CSmsSimParamOperation) : public CMsvOperation
       
    59 	{
       
    60 public:
       
    61 
       
    62 	static CSmsSimParamOperation* ReadSimParamsL(TUid aMtm, TMsvId aService, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    63 	static CSmsSimParamOperation* WriteSimParamsL(const CMobilePhoneSmspList& aList, TUid aMtm, TMsvId aService, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    64 	virtual ~CSmsSimParamOperation();
       
    65 
       
    66 	inline const CMobilePhoneSmspList& SmspList() const;
       
    67 
       
    68 	IMPORT_C CMobilePhoneSmspList* ServiceCentersLC() const;
       
    69 	IMPORT_C const TDesC8& ProgressL();
       
    70 
       
    71 	IMPORT_C static void RestoreSimParamsL(CMsvStore& aStore, CMobilePhoneSmspList& aList);
       
    72 	IMPORT_C static void StoreSimParamsL(CMsvStore& aStore, const CMobilePhoneSmspList& aList);
       
    73 
       
    74 private:	// methods from CActive
       
    75 
       
    76 	virtual void RunL();
       
    77 	virtual void DoCancel();
       
    78 	virtual TInt RunError(TInt aError);
       
    79 
       
    80 private:
       
    81 
       
    82 	CSmsSimParamOperation(TUid aMtm, TMsvId aService, CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus);
       
    83 
       
    84 	void DoReadSimParamsL();
       
    85 	void DoRunReadSimParamsL(/*TSmsProgress aProgress*/);
       
    86 	void DoWriteSimParamsL(const CMobilePhoneSmspList& aList);
       
    87 
       
    88 	void TransferCommandL(TInt aCommandId);
       
    89 	void Complete();
       
    90 
       
    91 private:
       
    92 
       
    93 /**
       
    94 This defines the state machine.
       
    95 */
       
    96 	enum TReadSimParamsState
       
    97 		{
       
    98 /**
       
    99 Specifies waiting state
       
   100 */
       
   101 		EStateWaiting,
       
   102 /**
       
   103 Specifies reading state
       
   104 */
       
   105 		EStateReadingSimParams,	 
       
   106 /**
       
   107 Specifies writing state
       
   108 */
       
   109 		EStateWritingSimParams
       
   110 		} iState;
       
   111 
       
   112 /**
       
   113 A list containing the SMS parameters
       
   114 */
       
   115 	CMobilePhoneSmspList* iSimParams;	
       
   116 	TInt iError;
       
   117 	TIntBuf iProgressBuf;
       
   118 	CMsvOperation* iOperation;
       
   119 	};
       
   120 
       
   121 /**
       
   122 Gets the list of SMS parameters on the SIM, after a successfully completed 
       
   123 read operation.
       
   124 
       
   125 If the operation has not successfully completed, this function returns an 
       
   126 empty list.
       
   127 
       
   128 This function should ot be used with a write SIM parameters operation.
       
   129 
       
   130 @return
       
   131 The list of SMS parameters read from the SIM.
       
   132 
       
   133 @panic	SMCM	3
       
   134 This operation was not reading the SIM parameters. The operation was not returned
       
   135 from CSmsClientMtm::ReadSimParamsL (debug only).
       
   136 */
       
   137 inline const CMobilePhoneSmspList& CSmsSimParamOperation::SmspList() const
       
   138 	{
       
   139 	__ASSERT_DEBUG(iState == EStateReadingSimParams, Panic(ESmscPanicUnexpectedCommand));
       
   140 	return *iSimParams;
       
   141 	}
       
   142 
       
   143 #endif // __SMUTSIMPARAM_H__