diff -r 000000000000 -r b497e44ab2fc syncmlfw/dm/dmutils/inc/nsmldmcmdarghandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syncmlfw/dm/dmutils/inc/nsmldmcmdarghandler.h Thu Dec 17 09:07:52 2009 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DM Utilities +* +*/ + + + +#ifndef __NSMLDMCMDARGHANDLER_H +#define __NSMLDMCMDARGHANDLER_H + +#include +#include +#include + + +// =========================================================================== +// struct TNSmlDmStatusElement +// =========================================================================== +/** +* TNSmlDmStatusElement element contais plug-in adapter command status +* information and information for mapping it to correct status element +* in DM protocoll +* +* @since +*/ +struct TNSmlDmStatusElement + { + + /** + * Reference to status element + */ + TInt32 iStatusRef; + + /** + * Status enumeration from plug-in adapter + */ + MSmlDmAdapter::TError iStatus; + }; + +// =========================================================================== +// CNSmlDmResultElement +// =========================================================================== +/** +* CNSmlDmResultElement is container class and contais information for +* generating result element in DM protocoll +* +* @since +*/ +class CNSmlDmResultElement : public CBase + { + public: + /** + * Destructor + */ + IMPORT_C virtual ~CNSmlDmResultElement(); + + /** + * Reference to result element + */ + TInt32 iResultRef; + + /** + * Result data + */ + CBufBase* iResult; + + /** + * Mime type of data + */ + HBufC8* iMimeType; + + /** + * True if result is streamed large object + */ + TBool iStreamed; + }; + +// =========================================================================== +// NSmlDmCmdArgHandler +// =========================================================================== +/** +* NSmlDmCmdArgHandler contains just static methods for packeting data to flat +* flat stream and parsing back to separate descriptors for transferring data +* between host client and server. +* +* @since +*/ +class NSmlDmCmdArgHandler + { + public: + + /** + * Packets command arguments to stream + * @param aWriteStream Stream to write following parameters + * @param aLuid Luid + * @param aData Data + * @param aURI Uri + * @param aType Mime type + */ + IMPORT_C static void PacketDataL(RWriteStream& aWriteStream, + const TDesC8& aLuid, + const TDesC8& aData, + const TDesC8& aURI, + const TDesC8& aType); + + /** + * Parses command arguments from stream + * @param aReadStream Stream for reading following parameters + * @param aLuid Luid + * @param aData Data + * @param aURI Uri + * @param aType Mime type + */ + IMPORT_C static void ParseDataL(RReadStream& aReadStream, + HBufC8*& aLuid, + HBufC8*& aData, + HBufC8*& aURI, + HBufC8*& aType); + + /** + * Packets Get command arguments to stream + * @param aWriteStream Stream to write following parameters + * @param aLuid Luid + * @param aURI Uri + * @param aType Mime type + * @param aPreviousURISegementList List of earlier made mappings + */ + IMPORT_C static void PacketFetchArgumentsL(RWriteStream& aWriteStream, + const TDesC8& aLuid, + const TDesC8& aURI, + const TDesC8& aType, + const CArrayFixFlat& aPreviousURISegementList); + + /** + * Parses Get command arguments from stream + * @param aReadStream Stream for reading following parameters + * @param aLuid Luid + * @param aURI Uri + * @param aType Mime type + * @param aPreviousURISegementList List of earlier made mappings + * @param aLuids Temporary strorage for TPtrC8 type + * obejcts in TSmlDmMappingInfo structs + */ + IMPORT_C static void ParseFetchArgumentsL(RReadStream& aReadStream, + HBufC8*& aLuid, + HBufC8*& aURI, + HBufC8*& aType, + CArrayFixFlat& aPreviousURISegementList, + RPointerArray& aLuids); + + /** + * Packets mappings to stream + * @param aWriteStream Stream to write following parameters + * @param aURIs Array of Uris + * @param aLuids Array of luids + */ + IMPORT_C static void PacketMappingsL(RWriteStream& aWriteStream, + const CArrayPtrSeg& aURIs, + const CArrayPtrSeg& aLuids ); + + /** + * Parse mappings from stream + * @param aReadStream Stream for reading following parameters + * @param aURIs Array of Uris + * @param aLuids Array of luids + */ + IMPORT_C static void ParseMappingsL(RReadStream& aReadStream, + CArrayPtrSeg& aURIs, + CArrayPtrSeg& aLuids ); + + /** + * Packets statuses to stream + * @param aWriteStream Stream to write following parameters + * @param aStatusArray Array of status elements + */ + IMPORT_C static void PacketStatusesL(RWriteStream& aWriteStream, + const RArray& aStatusArray); + + /** + * Parse statuses from stream + * @param aReadStream Stream for reading following parameters + * @param aStatusArray Array of status elements + */ + IMPORT_C static void ParseStatusesL(RReadStream& aReadStream, + RArray& aStatusArray ); + + /** + * Packets results to stream + * @param aWriteStream Stream to write following parameters + * @param aResults Array of result elements + */ + IMPORT_C static void PacketResultsL(RWriteStream& aWriteStream, + const RPointerArray& aResults); + + /** + * Parse results from stream + * @param aReadStream Stream for reading following parameters + * @param aResults Array of result elements + */ + IMPORT_C static void ParseResultsL(RReadStream& aReadStream, + RPointerArray& aResults); + + /** + * Packets Copy command arguments to stream + * @param aWriteStream Stream to write following parameters + * @param aTargetLuid Target luid + * @param aTargetURI Target uri + * @param aSourceLuid Source luid + * @param aSourceURI Source uri + * @param aType Mime type + */ + IMPORT_C static void PacketCopyArgumentsL(RWriteStream& aWriteStream, + const TDesC8& aTargetLuid, + const TDesC8& aTargetURI, + const TDesC8& aSourceLuid, + const TDesC8& aSourceURI, + const TDesC8& aType); + + /** + * Parses Copy command arguments from stream + * @param aReadStream Stream for reading following parameters + * @param aTargetLuid Target luid + * @param aTargetURI Target uri + * @param aSourceLuid Source luid + * @param aSourceURI Source uri + * @param aType Mime type + */ + IMPORT_C static void ParseCopyArgumentsL(RReadStream& aReadStream, + HBufC8*& aTargetLuid, + HBufC8*& aTargetURI, + HBufC8*& aSourceLuid, + HBufC8*& aSourceURI, + HBufC8*& aType); + }; + + +#endif // __NSMLDMCMDARGHANDLER_H \ No newline at end of file