telephonyserverplugins/simatktsy/utility/src/ttlv.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 //
    19 //
    20 
    20 
    21 
    21 
    22 
    22 
    23 //  Include Files  
    23 //  Include Files  
       
    24 
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "ttlvTraces.h"
       
    28 #endif
       
    29 
    24 #include "TTlv.h"				    // Header of this class
    30 #include "TTlv.h"				    // Header of this class
    25 #include "tflogger.h"				// For logging
       
    26 
    31 
    27 //  External Data Structures  
    32 //  External Data Structures  
    28 //    none
    33 //    none
    29 
    34 
    30 //  External Function Prototypes  
    35 //  External Function Prototypes  
    73 EXPORT_C void TTlvBase::Begin
    78 EXPORT_C void TTlvBase::Begin
    74         ( 
    79         ( 
    75         TUint8 aTag 
    80         TUint8 aTag 
    76         )
    81         )
    77     {
    82     {
    78     TFLOGSTRING("UTILITY: TTlvBase::Begin"); 
    83     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TTLVBASE_BEGIN_1, "UTILITY: TTlvBase::Begin");
    79     iData.Zero();
    84     iData.Zero();
    80     iData.Append( aTag );
    85     iData.Append( aTag );
    81     iData.Append( 0 );
    86     iData.Append( 0 );
    82     }
    87     }
    83 
    88 
    89 EXPORT_C void TTlvBase::AddTag
    94 EXPORT_C void TTlvBase::AddTag
    90         ( 
    95         ( 
    91         TUint8 aTag 
    96         TUint8 aTag 
    92         )
    97         )
    93     {
    98     {
    94     TFLOGSTRING("UTILITY: TTlvBase::AddTag");
    99     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TTLVBASE_ADDTAG_1, "UTILITY: TTlvBase::AddTag");
    95     iData.Append( aTag );           // tag
   100     iData.Append( aTag );           // tag
    96     iData.Append( 0 );              // length
   101     iData.Append( 0 );              // length
    97     iLenIndex = iData.Length() - 1; // index to tag length
   102     iLenIndex = iData.Length() - 1; // index to tag length
    98     }
   103     }
    99 
   104 
   105 EXPORT_C void TTlvBase::AddByte
   110 EXPORT_C void TTlvBase::AddByte
   106         ( 
   111         ( 
   107         TUint8 aValue  
   112         TUint8 aValue  
   108         )
   113         )
   109     {
   114     {
   110     TFLOGSTRING("UTILITY: TTlvBase::AddByte");
   115     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TTLVBASE_ADDBYTE_1, "UTILITY: TTlvBase::AddByte");
   111     iData.Append( aValue );
   116     iData.Append( aValue );
   112     iData[iLenIndex]++;
   117     iData[iLenIndex]++;
   113     }
   118     }
   114 
   119 
   115 // -----------------------------------------------------------------------------
   120 // -----------------------------------------------------------------------------
   120 EXPORT_C void TTlvBase::AddData
   125 EXPORT_C void TTlvBase::AddData
   121         ( 
   126         ( 
   122         const TDesC8& aValue 
   127         const TDesC8& aValue 
   123         )
   128         )
   124     {
   129     {
   125     TFLOGSTRING("UTILITY: TTlvBase::AddData");
   130     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TTLVBASE_ADDDATA_1, "UTILITY: TTlvBase::AddData");
   126     iData.Append( aValue );
   131     iData.Append( aValue );
   127     iData[ iLenIndex ] = static_cast<TUint8>( iData[ iLenIndex ] + 
   132     iData[ iLenIndex ] = static_cast<TUint8>( iData[ iLenIndex ] + 
   128         aValue.Length() );
   133         aValue.Length() );
   129     }
   134     }
   130 
   135 
   138 EXPORT_C const TDesC8& TTlvBase::End
   143 EXPORT_C const TDesC8& TTlvBase::End
   139         (
   144         (
   140         // None
   145         // None
   141         )
   146         )
   142     {
   147     {
   143     TFLOGSTRING("UTILITY: TTlvBase::End");
   148     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TTLVBASE_END_1, "UTILITY: TTlvBase::End");
   144     _LIT8( KLenTag, "\x81" );
   149     _LIT8( KLenTag, "\x81" );
   145 
   150 
   146     TInt i( 3 ); // Index to tag length
   151     TInt i( 3 ); // Index to tag length
   147 
   152 
   148     // Scan through all lenghts and insert 'length tag'
   153     // Scan through all lenghts and insert 'length tag'
   179 EXPORT_C const TDesC8& TTlvBase::GetDataWithoutTopLevelTag
   184 EXPORT_C const TDesC8& TTlvBase::GetDataWithoutTopLevelTag
   180         (
   185         (
   181         // None
   186         // None
   182         )
   187         )
   183     {
   188     {
   184     TFLOGSTRING("UTILITY: TTlvBase::GetDataWithoutTopLevelTag");
   189     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, TTLVBASE_GETDATAWITHOUTTOPLEVELTAG_1, "UTILITY: TTlvBase::GetDataWithoutTopLevelTag");
   185     _LIT8( KLenTag, "\x81" );
   190     _LIT8( KLenTag, "\x81" );
   186 
   191 
   187     TInt i( 1 ); // Index to tag length
   192     TInt i( 1 ); // Index to tag length
   188 
   193 
   189     // Scan through all lenghts and insert 'length tag'
   194     // Scan through all lenghts and insert 'length tag'