PECengine/AttributeLibrary2/Src/PEngAttributeRequestCodec.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Codec to code attribute requests.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PENGATTRIBUTEREQUESTCODEC_H
       
    19 #define PENGATTRIBUTEREQUESTCODEC_H
       
    20 
       
    21 
       
    22 //  INCLUDES
       
    23 #include "MPEngPresenceAttrModel2.h"
       
    24 #include "MPEngPresenceAttrManager.h"
       
    25 
       
    26 
       
    27 #include <E32Std.h>
       
    28 
       
    29 
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class RWriteStream;
       
    33 class RReadStream;
       
    34 
       
    35 
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 
       
    40 /**
       
    41  * Codec to code attribute requests.
       
    42  *
       
    43  * @since 3.0
       
    44  */
       
    45 NONSHARABLE_CLASS( PEngAttributeRequestCodec )
       
    46     {
       
    47 public: // New encode / decode functions
       
    48 
       
    49 
       
    50 
       
    51     /**
       
    52      * Packs a attribute model array to buffer.
       
    53      *
       
    54      * @since 3.0
       
    55      * @param aModels Models to pack.
       
    56      * @return Heap buffer containing models data.
       
    57      * Buffer ownership is returned to caller.
       
    58      */
       
    59     static HBufC16* PackModelArrayL( const RPointerArray<MPEngPresenceAttrModel2>& aModels );
       
    60 
       
    61 
       
    62     /**
       
    63      * Extracts models from package.
       
    64      *
       
    65      * @since 3.0
       
    66      * @param aModelPkg Model package to extract.
       
    67      * @param aInstanceOptions Instance options
       
    68      * for instantiated attribute models.
       
    69      * @param aModels On the return contains extracted attribute models.
       
    70      * Models are appended to array.
       
    71      * @param  aAttributeManager The attribute manger to
       
    72      * use in attribute model instantiation.
       
    73      */
       
    74     static void UnpackModelArrayL( const TDesC16& aModelPkg,
       
    75                                    TInt aInstanceOptions,
       
    76                                    RPointerArray<MPEngPresenceAttrModel2>& aModels,
       
    77                                    MPEngPresenceAttrManager& aAttributeManager );
       
    78 
       
    79 
       
    80     /**
       
    81      * Packs a attribute fetch request.
       
    82      *
       
    83      * @since 3.0
       
    84      * @param aPresenceIDs Presence ID's to pack.
       
    85      * @param aTypes Attribute types to pack.
       
    86      * @return Heap buffer containing fetch request data.
       
    87      * Buffer ownership is returned to caller.
       
    88      */
       
    89     static HBufC16* PackFetchRequestL( const MDesCArray& aPresenceIDs,
       
    90                                        const TArray<TUint32>& aTypes );
       
    91 
       
    92 
       
    93     /**
       
    94      * Extracts a attribute fetch request from package.
       
    95      *
       
    96      * @since 3.0
       
    97      * @param aFetchRequestPkg Attribute fetch request package to extract.
       
    98      * @param aPresenceIDs On the return contains extracted Presence IDs.
       
    99      * Presence IDs are appended to the end of array.
       
   100      * @param aTypes On the return contains extracted attribute type IDs.
       
   101      * Attribute types are appended to the end of array.
       
   102      */
       
   103     static void UnpackFetchRequestL( const TDesC16& aFetchRequestPkg,
       
   104                                      CDesCArray& aPresenceIDs,
       
   105                                      RArray<TUint32>& aTypes );
       
   106 
       
   107 
       
   108     /**
       
   109      * Copies one attribute model data from source model
       
   110      * to destination model.
       
   111      *
       
   112      * @since 3.0
       
   113      * @param aSource Source model copy from.
       
   114      * @param aDest The destination model to copy to.
       
   115      */
       
   116     static void CopyModelDataL( const MPEngPresenceAttrModel2& aSource,
       
   117                                 MPEngPresenceAttrModel2& aDest );
       
   118 
       
   119 
       
   120 
       
   121 
       
   122 
       
   123 private: //Helpers
       
   124     static void WritePresenceIdL( RWriteStream& aWStream, const TDesC& aPresenceId );
       
   125     static HBufC* ReadPresenceIdLC( RReadStream& aRStream );
       
   126 
       
   127 
       
   128 private: //protected constructor & destructor
       
   129 
       
   130     PEngAttributeRequestCodec();
       
   131     ~PEngAttributeRequestCodec();
       
   132     };
       
   133 
       
   134 #endif      //PENGATTRIBUTEREQUESTCODEC_H
       
   135 
       
   136 
       
   137 // End of File