bluetooth/btsdp/database/DataEncoder.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2000-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 //
       
    15 
       
    16 
       
    17 #ifndef DATAENCODER_H
       
    18 #define DATAENCODER_H
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <btsdp.h>
       
    22 #include "sdpconsts.h"
       
    23 
       
    24 
       
    25 NONSHARABLE_CLASS(TElementEncoder)
       
    26 	{
       
    27 public:
       
    28 	IMPORT_C TElementEncoder(TDes8& aWriteBuffer);
       
    29 	IMPORT_C TInt WriteNil();
       
    30 	IMPORT_C TInt WriteUint(const TDesC8& aUint);
       
    31 	IMPORT_C TInt WriteUint(TUint aVal, TInt aNumberOfBytes=4);
       
    32 	IMPORT_C TInt WriteInt(const TDesC8& aInt);
       
    33 	IMPORT_C TInt WriteInt(TInt aVal, TInt aNumberOfBytes=4);
       
    34 	IMPORT_C TInt WriteUUID(const TUUID& aUUID);
       
    35 	IMPORT_C TInt WriteString(const TDesC8& aString);
       
    36 	IMPORT_C TInt WriteBoolean(TBool aBoolean);
       
    37 	IMPORT_C TInt WriteDES(TUint aDataSize);
       
    38 	IMPORT_C TInt WriteDEA(TUint aDataSize);
       
    39 	IMPORT_C TInt WriteURL(const TDesC8& aUrl);
       
    40 
       
    41 	IMPORT_C TInt WriteElement(TSdpElementType aType, const TDesC8& aData);
       
    42 	IMPORT_C TInt WriteHeader(TSdpElementType aType, TUint aDataSize);
       
    43 	IMPORT_C TInt WriteDesc(const TDesC8& aDesc);
       
    44 
       
    45 	// Static Util functions
       
    46 	IMPORT_C static void PutUint(TUint8* aPtr, TUint aUint, TInt aNumberOfBytes);
       
    47 	IMPORT_C static TSdpElementSizeDesc SizeDescriptor(TSdpElementType aType, TUint aDataSize);
       
    48 	IMPORT_C static TInt HeaderSize(TSdpElementType aType, TUint aDataSize);
       
    49 	IMPORT_C static TInt EncodedSize(TSdpElementType aType, TUint aDataSize);
       
    50 
       
    51 private:
       
    52 	TDes8& iWriteBuf;
       
    53 	};
       
    54 
       
    55 
       
    56 #endif