accessoryservices/accessoryserver/src/accpolaudiodevicetopology/accpolhdmilatency.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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:  Latency object
       
    15  *
       
    16  */
       
    17 
       
    18 #include <accpolhdmilatency.h>
       
    19 #include <accpolobjecttypes.h>
       
    20 
       
    21 #include "acc_debug.h"
       
    22 
       
    23 // -----------------------------------------------------------------------------
       
    24 // CAccPolHdmiLatency::CAccPolHdmiLatency()
       
    25 // C++ default constructor can NOT contain any code, that
       
    26 // might leave.
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CAccPolHdmiLatency::CAccPolHdmiLatency( CAccPolObjectCon* aObject ) :
       
    30     CAccPolObjectBase( EAccPolHdmiLatencyObject, aObject )
       
    31     {
       
    32     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::CAccPolHdmiLatency() - Enter" );
       
    33     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::CAccPolHdmiLatency() - Return" );
       
    34     }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CAccPolHdmiLatency::CAccPolHdmiLatency()
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CAccPolHdmiLatency::CAccPolHdmiLatency( const TUid aLatencyType,
       
    43     const TUint32 aAudioLatency,
       
    44     const TUint32 aVideoLatency ) :
       
    45         CAccPolObjectBase( EAccPolHdmiLatencyObject ),
       
    46         iLatencyType( aLatencyType ),
       
    47         iAudioLatency( aAudioLatency ),
       
    48         iVideoLatency( aVideoLatency )
       
    49     {
       
    50     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::CAccPolHdmiLatency() - Enter" );
       
    51     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::CAccPolHdmiLatency() - Return" );
       
    52     }
       
    53 // ---------------------------------------------------------------------------
       
    54 // CAccPolHdmiLatency::NewL()
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C CAccPolHdmiLatency* CAccPolHdmiLatency::NewL( CAccPolObjectCon* aObject )
       
    58     {
       
    59     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewL() - Enter" );
       
    60     CAccPolHdmiLatency* self = CAccPolHdmiLatency::NewLC( aObject );
       
    61     CleanupStack::Pop( self );
       
    62     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewL() - Return" );
       
    63     return self;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CAccPolHdmiLatency::NewLC()
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 EXPORT_C CAccPolHdmiLatency* CAccPolHdmiLatency::NewLC( CAccPolObjectCon* aObject )
       
    71     {
       
    72     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewLC() - Enter" );
       
    73     CAccPolHdmiLatency* self = new ( ELeave ) CAccPolHdmiLatency( aObject );
       
    74     CleanupStack::PushL( self );
       
    75     self->ConstructL();
       
    76     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewLC() - Return" );
       
    77     return self;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // CAccPolHdmiLatency::NewL()
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 EXPORT_C CAccPolHdmiLatency* CAccPolHdmiLatency::NewL( const TUid aLatencyType,
       
    85     const TUint32 aAudioLatency,
       
    86     const TUint32 aVideoLatency )
       
    87     {
       
    88     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewL() - Enter" );
       
    89     CAccPolHdmiLatency* self = CAccPolHdmiLatency::NewLC( aLatencyType,
       
    90         aAudioLatency,
       
    91         aVideoLatency );
       
    92     CleanupStack::Pop( self );
       
    93     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewL() - Return" );
       
    94     return self;
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CAccPolHdmiLatency::NewLC()
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 EXPORT_C CAccPolHdmiLatency* CAccPolHdmiLatency::NewLC( const TUid aLatencyType,
       
   102     const TUint32 aAudioLatency,
       
   103     const TUint32 aVideoLatency )
       
   104     {
       
   105     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewLC() - Enter" );
       
   106     CAccPolHdmiLatency* self = new ( ELeave ) CAccPolHdmiLatency( aLatencyType,
       
   107         aAudioLatency,
       
   108         aVideoLatency );
       
   109     CleanupStack::PushL( self );
       
   110     self->ConstructL();
       
   111     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::NewLC() - Return" );
       
   112     return self;
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // CAccPolHdmiLatency::ConstructL()
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CAccPolHdmiLatency::ConstructL()
       
   120     {
       
   121     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ConstructL() - Enter" );
       
   122     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ConstructL() - Return" );
       
   123     }
       
   124 
       
   125 // Destructor
       
   126 CAccPolHdmiLatency::~CAccPolHdmiLatency()
       
   127     {
       
   128     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::~CAccPolHdmiLatency() - Enter" );
       
   129     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::~CAccPolHdmiLatency() - Return" );
       
   130     }
       
   131 
       
   132 // ---------------------------------------------------------------------------
       
   133 // CAccPolHdmiLatency::operator()
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 EXPORT_C CAccPolHdmiLatency& CAccPolHdmiLatency::operator=( const CAccPolHdmiLatency& aStreamObject )
       
   137     {
       
   138     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::operator() - Enter" );
       
   139 
       
   140     CAccPolObjectBase::operator=( ( CAccPolObjectBase& )aStreamObject );
       
   141 
       
   142     iLatencyType = aStreamObject.LatencyType();
       
   143     iAudioLatency = aStreamObject.AudioLatency();
       
   144     iVideoLatency = aStreamObject.VideoLatency();
       
   145 
       
   146     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::operator() - Return" );
       
   147     return ( *this );
       
   148     }
       
   149 
       
   150 // ---------------------------------------------------------------------------
       
   151 // CAccPolHdmiLatency::SetLatencyType()
       
   152 // ---------------------------------------------------------------------------
       
   153 //
       
   154 EXPORT_C void CAccPolHdmiLatency::SetLatencyType( const TUid aLatencyType )
       
   155     {
       
   156     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetLatencyType() - Enter" );
       
   157     iLatencyType = aLatencyType;
       
   158     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetLatencyType() - Return" );
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // CAccPolHdmiLatency::SetAudioLatency()
       
   163 // ---------------------------------------------------------------------------
       
   164 //
       
   165 EXPORT_C void CAccPolHdmiLatency::SetAudioLatency( const TUint32 aAudioLatency )
       
   166     {
       
   167     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetAudioLatency() - Enter" );
       
   168     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetAudioLatency() - Latency=%d", aAudioLatency );
       
   169     iAudioLatency = aAudioLatency;
       
   170     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetAudioLatency() - Return" );
       
   171     }
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // CAccPolHdmiLatency::SetVideoLatency()
       
   175 // ---------------------------------------------------------------------------
       
   176 //
       
   177 EXPORT_C void CAccPolHdmiLatency::SetVideoLatency( const TUint32 aVideoLatency )
       
   178     {
       
   179     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetVideoLatency() - Enter" );
       
   180     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetVideoLatency() - Latency=%d", aVideoLatency );
       
   181     iVideoLatency = aVideoLatency;
       
   182     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::SetVideoLatency() - Return" );
       
   183     }
       
   184 
       
   185 // ---------------------------------------------------------------------------
       
   186 // CAccPolHdmiLatency::LatencyType()
       
   187 // ---------------------------------------------------------------------------
       
   188 //
       
   189 EXPORT_C const TUid CAccPolHdmiLatency::LatencyType() const
       
   190     {
       
   191     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::LatencyType() - Enter" );
       
   192     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::LatencyType() - Return" );
       
   193     return iLatencyType;
       
   194     }
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // CAccPolHdmiLatency::AudioLatency()
       
   198 // ---------------------------------------------------------------------------
       
   199 //
       
   200 EXPORT_C TUint32 CAccPolHdmiLatency::AudioLatency() const
       
   201     {
       
   202     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::AudioLatency() - Enter" );
       
   203     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::AudioLatency() - Latency=%d", iAudioLatency );
       
   204     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::AudioLatency() - Return" );
       
   205     return iAudioLatency;
       
   206     }
       
   207 
       
   208 // ---------------------------------------------------------------------------
       
   209 // CAccPolHdmiLatency::VideoLatency()
       
   210 // ---------------------------------------------------------------------------
       
   211 //
       
   212 EXPORT_C TUint32 CAccPolHdmiLatency::VideoLatency() const
       
   213     {
       
   214     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::VideoLatency() - Enter" );
       
   215     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::VideoLatency() - Latency=%d", iVideoLatency );
       
   216     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::VideoLatency() - Return" );
       
   217     return iVideoLatency;
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------------------------
       
   221 // CAccPolHdmiLatency::ExternalizeL()
       
   222 // ---------------------------------------------------------------------------
       
   223 //
       
   224 void CAccPolHdmiLatency::ExternalizeL( RWriteStream& aStream ) const
       
   225     {
       
   226     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ExternalizeL() - Enter" );
       
   227 
       
   228     //Add object type at the beginning
       
   229     aStream.WriteUint8L( ObjectType() );
       
   230 
       
   231     //Add data
       
   232     aStream.WriteInt32L( iLatencyType.iUid );
       
   233     aStream.WriteUint32L( iAudioLatency );
       
   234     aStream.WriteUint32L( iVideoLatency );
       
   235 
       
   236     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ExternalizeL - Object Type     = %d", ObjectType() );
       
   237     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ExternalizeL - LatencyType Uid = %d", iLatencyType.iUid );
       
   238     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ExternalizeL - Audio Latency   = %d", iAudioLatency );
       
   239     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ExternalizeL - Video Latency   = %d", iVideoLatency );
       
   240 
       
   241     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::ExternalizeL - Return" );
       
   242     }
       
   243 
       
   244 // ---------------------------------------------------------------------------
       
   245 // CAccPolHdmiLatency::InternalizeL()
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 void CAccPolHdmiLatency::InternalizeL( RReadStream& aStream )
       
   249     {
       
   250     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::InternalizeL() - Enter" );
       
   251 
       
   252     //Read data
       
   253     iLatencyType.iUid = aStream.ReadInt32L();
       
   254     iAudioLatency = aStream.ReadUint32L();
       
   255     iVideoLatency = aStream.ReadUint32L();
       
   256 
       
   257     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::InternalizeL - Object Type     = %d", ObjectType() );
       
   258     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::InternalizeL - LatencyType Uid = %d", iLatencyType.iUid );
       
   259     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::InternalizeL - Audio Latency   = %d", iAudioLatency );
       
   260     API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::InternalizeL - Video Latency   = %d", iVideoLatency );
       
   261 
       
   262     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::InternalizeL - Return" );
       
   263     }
       
   264 
       
   265 // ---------------------------------------------------------------------------
       
   266 // CAccPolHdmiLatency::DuplicateL()
       
   267 // ---------------------------------------------------------------------------
       
   268 //
       
   269 CAccPolObjectBase* CAccPolHdmiLatency::DuplicateLC( CAccPolObjectCon* aObject )
       
   270     {
       
   271     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::DuplicateL() - Enter" );
       
   272     CAccPolHdmiLatency* aStream = CAccPolHdmiLatency::NewLC( aObject );
       
   273     *aStream = ( CAccPolHdmiLatency& )*this;
       
   274     API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolHdmiLatency::DuplicateL() - Return" );
       
   275     return aStream;
       
   276     }