syncmlfw/dm/dmutils/inc/nsmldmcmdarghandler.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     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:  DM Utilities
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __NSMLDMCMDARGHANDLER_H
       
    21 #define __NSMLDMCMDARGHANDLER_H
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <smldmadapter.h>
       
    26 
       
    27 
       
    28 // ===========================================================================
       
    29 // struct TNSmlDmStatusElement
       
    30 // ===========================================================================
       
    31 /**
       
    32 * TNSmlDmStatusElement element contais plug-in adapter command status
       
    33 * information and information for mapping it to correct status element
       
    34 * in DM protocoll
       
    35 *
       
    36 *  @since
       
    37 */
       
    38 struct TNSmlDmStatusElement
       
    39 	{
       
    40 	
       
    41 	/**
       
    42 	* Reference to status element
       
    43 	*/
       
    44 	TInt32 iStatusRef;
       
    45 
       
    46 	/**
       
    47 	* Status enumeration from plug-in adapter
       
    48 	*/
       
    49 	MSmlDmAdapter::TError iStatus;
       
    50 	};
       
    51 
       
    52 // ===========================================================================
       
    53 // CNSmlDmResultElement
       
    54 // ===========================================================================
       
    55 /**
       
    56 * CNSmlDmResultElement is container class and contais information for
       
    57 * generating result element in DM protocoll
       
    58 *
       
    59 *  @since
       
    60 */
       
    61 class CNSmlDmResultElement : public CBase
       
    62 	{
       
    63 	public:
       
    64 	/**
       
    65 	* Destructor
       
    66 	*/
       
    67 	IMPORT_C virtual ~CNSmlDmResultElement();
       
    68 
       
    69 	/**
       
    70 	* Reference to result element
       
    71 	*/
       
    72 	TInt32 iResultRef;
       
    73 
       
    74 	/**
       
    75 	* Result data
       
    76 	*/
       
    77 	CBufBase* iResult;
       
    78 
       
    79 	/**
       
    80 	* Mime type of data
       
    81 	*/
       
    82 	HBufC8* iMimeType;
       
    83 
       
    84 	/**
       
    85 	* True if result is streamed large object
       
    86 	*/
       
    87 	TBool iStreamed;
       
    88 	};
       
    89 
       
    90 // ===========================================================================
       
    91 // NSmlDmCmdArgHandler
       
    92 // ===========================================================================
       
    93 /**
       
    94 * NSmlDmCmdArgHandler contains just static methods for packeting data to flat
       
    95 * flat stream and parsing back to separate descriptors for transferring data
       
    96 * between host client and server.
       
    97 *
       
    98 *  @since
       
    99 */
       
   100 class NSmlDmCmdArgHandler
       
   101 	{
       
   102 	public:
       
   103 
       
   104 	/**
       
   105 	* Packets command arguments to stream
       
   106 	* @param	aWriteStream	Stream to write following parameters
       
   107 	* @param	aLuid			Luid
       
   108 	* @param	aData			Data
       
   109 	* @param	aURI			Uri
       
   110 	* @param	aType 			Mime type
       
   111 	*/
       
   112 	IMPORT_C static void PacketDataL(RWriteStream& aWriteStream,
       
   113 		const TDesC8& aLuid,
       
   114 		const TDesC8& aData,
       
   115 		const TDesC8& aURI,
       
   116 		const TDesC8& aType);
       
   117 		
       
   118 	/**
       
   119 	* Parses command arguments from stream
       
   120 	* @param	aReadStream		Stream for reading following parameters
       
   121 	* @param	aLuid			Luid
       
   122 	* @param	aData			Data
       
   123 	* @param	aURI			Uri
       
   124 	* @param	aType 			Mime type
       
   125 	*/
       
   126 	IMPORT_C static void ParseDataL(RReadStream& aReadStream,
       
   127 		HBufC8*& aLuid,
       
   128 		HBufC8*& aData,
       
   129 		HBufC8*& aURI,
       
   130 		HBufC8*& aType);
       
   131 
       
   132 	/**
       
   133 	* Packets Get command arguments to stream
       
   134 	* @param	aWriteStream			Stream to write following parameters
       
   135 	* @param	aLuid					Luid
       
   136 	* @param	aURI					Uri
       
   137 	* @param	aType 					Mime type
       
   138 	* @param	aPreviousURISegementList List of earlier made mappings
       
   139 	*/
       
   140 	IMPORT_C static void PacketFetchArgumentsL(RWriteStream& aWriteStream,
       
   141 		const TDesC8& aLuid,
       
   142 		const TDesC8& aURI,
       
   143 		const TDesC8& aType,
       
   144 		const CArrayFixFlat<TSmlDmMappingInfo>& aPreviousURISegementList);
       
   145 		
       
   146 	/**
       
   147 	* Parses Get command arguments from stream
       
   148 	* @param	aReadStream				Stream for reading following parameters
       
   149 	* @param	aLuid					Luid
       
   150 	* @param	aURI					Uri
       
   151 	* @param	aType 					Mime type
       
   152 	* @param	aPreviousURISegementList List of earlier made mappings
       
   153 	* @param	aLuids					Temporary strorage for TPtrC8 type
       
   154 	*									obejcts in TSmlDmMappingInfo structs
       
   155 	*/
       
   156 	IMPORT_C static void ParseFetchArgumentsL(RReadStream& aReadStream,
       
   157 		HBufC8*& aLuid,
       
   158 		HBufC8*& aURI,
       
   159 		HBufC8*& aType,
       
   160 		CArrayFixFlat<TSmlDmMappingInfo>& aPreviousURISegementList,
       
   161 		RPointerArray<HBufC8>& aLuids);
       
   162 	
       
   163 	/**
       
   164 	* Packets mappings to stream
       
   165 	* @param	aWriteStream			Stream to write following parameters
       
   166 	* @param	aURIs					Array of Uris
       
   167 	* @param	aLuids					Array of luids
       
   168 	*/
       
   169 	IMPORT_C static void PacketMappingsL(RWriteStream& aWriteStream,
       
   170 		const CArrayPtrSeg<HBufC8>& aURIs,
       
   171 		const CArrayPtrSeg<HBufC8>& aLuids );
       
   172 		
       
   173 	/**
       
   174 	* Parse mappings from stream
       
   175 	* @param	aReadStream				Stream for reading following parameters
       
   176 	* @param	aURIs					Array of Uris
       
   177 	* @param	aLuids					Array of luids
       
   178 	*/
       
   179 	IMPORT_C static void ParseMappingsL(RReadStream& aReadStream,
       
   180 		CArrayPtrSeg<HBufC8>& aURIs,
       
   181 		CArrayPtrSeg<HBufC8>& aLuids );
       
   182 
       
   183 	/**
       
   184 	* Packets statuses to stream
       
   185 	* @param	aWriteStream			Stream to write following parameters
       
   186 	* @param	aStatusArray			Array of status elements
       
   187 	*/
       
   188 	IMPORT_C static void PacketStatusesL(RWriteStream& aWriteStream,
       
   189 		const RArray<TNSmlDmStatusElement>& aStatusArray);
       
   190 		
       
   191 	/**
       
   192 	* Parse statuses from stream
       
   193 	* @param	aReadStream				Stream for reading following parameters
       
   194 	* @param	aStatusArray			Array of status elements
       
   195 	*/
       
   196 	IMPORT_C static void ParseStatusesL(RReadStream& aReadStream,
       
   197 		RArray<TNSmlDmStatusElement>& aStatusArray );
       
   198 
       
   199 	/**
       
   200 	* Packets results to stream
       
   201 	* @param	aWriteStream			Stream to write following parameters
       
   202 	* @param	aResults				Array of result elements
       
   203 	*/
       
   204 	IMPORT_C static void PacketResultsL(RWriteStream& aWriteStream,
       
   205 		const RPointerArray<CNSmlDmResultElement>& aResults);
       
   206 		
       
   207 	/**
       
   208 	* Parse results from stream
       
   209 	* @param	aReadStream				Stream for reading following parameters
       
   210 	* @param	aResults				Array of result elements
       
   211 	*/
       
   212 	IMPORT_C static void ParseResultsL(RReadStream& aReadStream,
       
   213 		RPointerArray<CNSmlDmResultElement>& aResults);
       
   214 	
       
   215 	/**
       
   216 	* Packets Copy command arguments to stream
       
   217 	* @param	aWriteStream	Stream to write following parameters
       
   218 	* @param	aTargetLuid		Target luid
       
   219 	* @param	aTargetURI		Target uri
       
   220 	* @param	aSourceLuid		Source luid
       
   221 	* @param	aSourceURI		Source uri
       
   222 	* @param	aType 			Mime type
       
   223 	*/
       
   224 	IMPORT_C static void PacketCopyArgumentsL(RWriteStream& aWriteStream,
       
   225 		const TDesC8& aTargetLuid,
       
   226 		const TDesC8& aTargetURI,
       
   227 		const TDesC8& aSourceLuid,
       
   228 		const TDesC8& aSourceURI,
       
   229 		const TDesC8& aType);
       
   230 		
       
   231 	/**
       
   232 	* Parses Copy command arguments from stream
       
   233 	* @param	aReadStream		Stream for reading following parameters
       
   234 	* @param	aTargetLuid		Target luid
       
   235 	* @param	aTargetURI		Target uri
       
   236 	* @param	aSourceLuid		Source luid
       
   237 	* @param	aSourceURI		Source uri
       
   238 	* @param	aType 			Mime type
       
   239 	*/
       
   240 	IMPORT_C static void ParseCopyArgumentsL(RReadStream& aReadStream,
       
   241 		HBufC8*& aTargetLuid,
       
   242 		HBufC8*& aTargetURI,
       
   243 		HBufC8*& aSourceLuid,
       
   244 		HBufC8*& aSourceURI,
       
   245 		HBufC8*& aType);
       
   246 	};
       
   247 
       
   248 
       
   249 #endif // __NSMLDMCMDARGHANDLER_H