telephonyserver/etelmultimode/INC/mpbutil.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 #ifndef __MPBUTIL_H__
       
    17 #define	__MPBUTIL_H__
       
    18 
       
    19 #include <etelmm.h>		// for RMobilePhoneBookStore
       
    20 /**
       
    21 @publishedPartner
       
    22 */
       
    23 const TInt KFieldEntrySize = 8;
       
    24 const TInt KErrStartOfNewEntry = -1;
       
    25 const TInt KMaxUint16Val = 0xFFFF;
       
    26 
       
    27 class CPhoneBookBuffer : public CBase
       
    28 /**
       
    29 This class enables the conversion from integer or descriptor data type into 
       
    30 the TLV (Tag-Length-Value) format and vice versa.
       
    31 
       
    32 It is a library class available for use by clients and TSYs to enable 
       
    33 them to manage the encoding and decoding of phonebook data to/from the TLV 
       
    34 format required by the Multimode ETel API. 
       
    35 
       
    36 @publishedPartner
       
    37 @released
       
    38 */
       
    39 	{
       
    40 public:
       
    41 	IMPORT_C CPhoneBookBuffer();
       
    42 	IMPORT_C void Set(TDes8* aData);
       
    43 	IMPORT_C TInt AddNewEntryTag();
       
    44 	IMPORT_C TInt AddNewNumberTag();
       
    45 	IMPORT_C TInt PutTagAndValue(TUint8 aTagValue, TUint8 aInteger);
       
    46 	IMPORT_C TInt PutTagAndValue(TUint8 aTagValue, TUint16 aInteger);
       
    47 	IMPORT_C TInt PutTagAndValue(TUint8 aTagValue, TUint32 aInteger);
       
    48 	IMPORT_C TInt PutTagAndValue(TUint8 aTagValue, const TDesC8 &aData);
       
    49 	IMPORT_C TInt PutTagAndValue(TUint8 aTagValue, const TDesC16 &aData);
       
    50 	IMPORT_C TInt RemovePartialEntry();
       
    51 	IMPORT_C void StartRead();
       
    52 
       
    53 /** phone Book Tag Type. */
       
    54 	enum TPhBkTagType
       
    55 		{
       
    56 	/** No Data. */
       
    57 		EPhBkTypeNoData,
       
    58 	/** Data is in Int8 format. */
       
    59 		EPhBkTypeInt8,
       
    60 	/** Data is in Int16 format. */
       
    61 		EPhBkTypeInt16,
       
    62 	/** Data is in Int32 format. */
       
    63 		EPhBkTypeInt32,
       
    64 	/** Data is in Des8 format. */
       
    65 		EPhBkTypeDes8,
       
    66 	/** Data is in Des16 format. */
       
    67 		EPhBkTypeDes16,
       
    68 		};
       
    69 
       
    70 	IMPORT_C TInt GetTagAndType(TUint8 &aTagValue, TPhBkTagType &aDataType);
       
    71 	IMPORT_C TInt GetValue(TUint8 &aInteger);
       
    72 	IMPORT_C TInt GetValue(TUint16 &aInteger);
       
    73 	IMPORT_C TInt GetValue(TUint32 &aInteger);
       
    74 	IMPORT_C TInt GetValue(TPtrC8 &aData);
       
    75 	IMPORT_C TInt GetValue(TPtrC16 &aData);
       
    76 	IMPORT_C void SkipValue(TPhBkTagType aDataType);
       
    77 	IMPORT_C TInt BufferLength();
       
    78 	IMPORT_C TInt RemainingReadLength();
       
    79 
       
    80 private:
       
    81 	TInt AppendInt8(TUint8 aInteger);
       
    82 	TInt AppendInt16(TUint16 aInteger);
       
    83 	TInt AppendInt32(TUint32 aInteger);
       
    84 
       
    85 private:
       
    86 	TDes8*  iPtr;   // Points to supplied Data buffer
       
    87 	TPtrC8 iRead;   // Points to populated TLV buffer
       
    88 	TPtr8 iMonitor; // Used to remove partially populated entries from TLV buffer
       
    89 	};
       
    90 
       
    91 #endif