syncmlfw/common/syncagent/inc/NSmlStatusContainer.h
changeset 0 b497e44ab2fc
child 24 13d7c31c74e0
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Client's Status command buffering
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __NSMLSTATUSCONTAINER_H
       
    22 #define __NSMLSTATUSCONTAINER_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "smldtd.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CNSmlFutureReservation;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 class CNSmlStatusContainer : public CBase 
       
    33 	{
       
    34 	//  
       
    35 	public:  // constructors and destructor 
       
    36 	static CNSmlStatusContainer* NewL( TBool aClearText = EFalse); 
       
    37 	static CNSmlStatusContainer* NewLC( TBool aClearText = EFalse);
       
    38 	 ~CNSmlStatusContainer();    //from CBase
       
    39 	
       
    40 	public: // new functions 
       
    41 	// Initiate MsgRef element
       
    42 	void InitMsgRefL( const SmlPcdata_t* aMsgRef );
       
    43 	// Create New Status element, returns entry ID to created element
       
    44 	IMPORT_C TInt CreateNewStatusElementL();
       
    45 	// Set values to Status element
       
    46 	void SetCmdIDL( TInt aEntryID, const SmlPcdata_t* aCmdID );
       
    47 	void SetMsgRefL( TInt aEntryID, const SmlPcdata_t* aMsgRef );
       
    48 	IMPORT_C void SetCmdRefL( TInt aEntryID, const SmlPcdata_t* aCmdRef );
       
    49 	IMPORT_C void SetCmdL( TInt aEntryID, const TDesC8& aCmd );
       
    50 	IMPORT_C void SetStatusCodeL( TInt aEntryID, TInt aStatusCode, TBool aFixStatus = EFalse );
       
    51 	void SetChalL( TInt aEntryID, const TDesC8& aNonce );  
       
    52 	IMPORT_C void SetNoResponse( TInt aEntryID , TBool aNoResponce );
       
    53 	
       
    54 	IMPORT_C void SetAtomicOrSequenceId( TInt aEntryID, TInt aAtomicOrSequenceID );
       
    55     IMPORT_C void SetPerformedInAtomic( TInt aEntryID );
       
    56 	IMPORT_C void SetStatusCodeToAtomicOrSequenceCmdL( TInt aAtomicOrSequenceID, TInt aStatusCode, const TDesC8& aCmd );
       
    57 	IMPORT_C void SetStatusCodesInAtomicL( TInt aAtomicID, TInt aStatusCode, TBool aOnlyForPerformed );
       
    58 	// Add values to Status element
       
    59 	IMPORT_C void AddTargetRefL( TInt aEntryID, const SmlTarget_t* aTarget ); 
       
    60 	IMPORT_C void AddSourceRefL( TInt aEntryID, const SmlSource_t* aSource ); 
       
    61 	IMPORT_C void AddItemDataL (TInt aEntryID, const SmlPcdata_t* aData );
       
    62 	void RemoveWritten (TInt aEntryID );
       
    63 	// Get Status Elements
       
    64 	IMPORT_C void Begin();
       
    65 	IMPORT_C TBool NextStatusElement( SmlStatus_t*& aStatus, TBool aOnlyIfResponse = ETrue );
       
    66 	// Get ID of the current element
       
    67 	TInt CurrentEntryID() const;	
       
    68 	// Get ID of the last element
       
    69 	IMPORT_C TInt LastEntryID() const;	
       
    70 	//  
       
    71 	TBool AnyOtherThanOkSyncHdrStatus() const;
       
    72 	
       
    73 	private:
       
    74 	void ConstructL( TBool aClearText);
       
    75 	CNSmlStatusContainer();
       
    76 	CNSmlStatusContainer( const CNSmlStatusContainer& aOther );
       
    77 	CNSmlStatusContainer& operator=( const CNSmlStatusContainer& aOther );
       
    78 	void CreatePcdataL ( SmlPcdata_t*& aPcdata, const TDesC8& aContent ) const;
       
    79 	void CopyPcdataL( const SmlPcdata_t* aFromPcdata, SmlPcdata_t*& aToPcdata ) const;	
       
    80 	void CopyMetInfL ( const void* aFromMetInf, void*& aToMetInf ) const; 
       
    81 	void CreateTargetRefL( const SmlTarget_t* aTarget, SmlPcdata_t*& aTargetRef ) const;
       
    82 	void CreateSourceRefL( const SmlSource_t* aSource, SmlPcdata_t*& aSourceRef ) const;
       
    83 	void RemoveAllWrittenOnes();
       
    84 	void FreeResources( TInt aI );
       
    85 	TBool StatusCodeVal ( SmlPcdata_t*& aStatusCode, TInt& aVal ) const;
       
    86 	
       
    87 	private:  //Data
       
    88 	struct TStatusData
       
    89 		{
       
    90 		SmlStatus_t* status;
       
    91 		TBool noResponse;
       
    92 		TBool wasWritten;
       
    93 		TInt atomicOrSequenceID;
       
    94 		TBool performedInAtomic;
       
    95 		TBool statusIsFixed;
       
    96 		};
       
    97 	TInt iArrayInd;
       
    98 	SmlPcdata_t* iMsgRef;
       
    99 	CArrayFixFlat<TStatusData>* iStatusArray;
       
   100 	TBool iClearText; 
       
   101 	// Reserved to maintain binary compability
       
   102 	CNSmlFutureReservation* iReserved;
       
   103 	};
       
   104 
       
   105 #endif // __NSMLSTATUSCONTAINER_H