crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianETMLib/Common/State/Implementations/ETMDecodeStateUnsynchronized.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 using System;
       
    19 using System.Collections.Generic;
       
    20 using System.Text;
       
    21 using SymbianUtils.BasicTypes;
       
    22 using SymbianETMLib.Common.Types;
       
    23 
       
    24 namespace SymbianETMLib.Common.State
       
    25 {
       
    26     public class ETMDecodeStateUnsynchronized : ETMDecodeState
       
    27     {
       
    28         #region Constructors
       
    29         public ETMDecodeStateUnsynchronized( ETMStateData aManager )
       
    30             : base( aManager )
       
    31         {
       
    32         }
       
    33         #endregion
       
    34 
       
    35         #region API
       
    36         public override ETMDecodeState HandleByte( SymByte aByte )
       
    37         {
       
    38             ETMDecodeState nextState = this;
       
    39             //
       
    40             if ( aByte == 0 )
       
    41             {
       
    42                 ++iASyncConsecutiveNullByteCount;
       
    43             }
       
    44             else if ( aByte == 0x80 && iASyncConsecutiveNullByteCount == 5 )
       
    45             {
       
    46                 // That's the start of the a-sync packet
       
    47                 iASyncConsecutiveNullByteCount = 0;
       
    48                 base.StateData.SetSynchronized();
       
    49                 nextState = new ETMDecodeStateSynchronized( base.StateData );
       
    50                 Trace();
       
    51             }
       
    52             else
       
    53             {
       
    54                 iASyncConsecutiveNullByteCount = 0;
       
    55                 base.StateData.SetUnsynchronized();
       
    56             }
       
    57             //
       
    58             return nextState;
       
    59         }
       
    60         #endregion
       
    61 
       
    62         #region Properties
       
    63         #endregion
       
    64 
       
    65         #region Internal methods
       
    66         private void Trace()
       
    67         {
       
    68             base.DbgTrace( "A-SYNC" );
       
    69         }
       
    70         #endregion
       
    71 
       
    72         #region From System.Object
       
    73         #endregion
       
    74 
       
    75         #region Data members
       
    76         private int iASyncConsecutiveNullByteCount = 0;
       
    77         #endregion
       
    78     }
       
    79 }