upnpavcontroller/upnpxmlparser/src/upnpavtevent.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
       
     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 // INCLUDES
       
    19 #include "upnpavtevent.h"
       
    20 
       
    21 // --------------------------------------------------------------------------
       
    22 // CUPnPAVTEvent::CUPnPAVTEvent
       
    23 // See upnpavevent.h for description
       
    24 // --------------------------------------------------------------------------
       
    25 CUPnPAVTEvent::CUPnPAVTEvent()
       
    26     {
       
    27     // No implementation required
       
    28     }
       
    29 
       
    30 // --------------------------------------------------------------------------
       
    31 // CUPnPAVTEvent::ConstructL
       
    32 // See upnpavevent.h for description
       
    33 // --------------------------------------------------------------------------
       
    34 void CUPnPAVTEvent::ConstructL()
       
    35     {
       
    36     // No implementation required
       
    37     }
       
    38 
       
    39 // --------------------------------------------------------------------------
       
    40 // CUPnPAVTEvent::NewL
       
    41 // See upnpavevent.h for description
       
    42 // --------------------------------------------------------------------------
       
    43 CUPnPAVTEvent* CUPnPAVTEvent::NewL()
       
    44     {
       
    45     CUPnPAVTEvent* self = new (ELeave) CUPnPAVTEvent;
       
    46     CleanupStack::PushL( self );
       
    47     self->ConstructL();
       
    48     CleanupStack::Pop( self );
       
    49     return self;
       
    50     }
       
    51 
       
    52 // --------------------------------------------------------------------------
       
    53 // CUPnPAVTEvent::~CUPnPAVTEvent
       
    54 // See upnpavevent.h for description
       
    55 // --------------------------------------------------------------------------
       
    56 CUPnPAVTEvent::~CUPnPAVTEvent()
       
    57     {
       
    58     delete iTransportURI;
       
    59     }
       
    60 
       
    61 // --------------------------------------------------------------------------
       
    62 // CUPnPAVTEvent::CloneL
       
    63 // See upnpavevent.h for description
       
    64 // --------------------------------------------------------------------------
       
    65 CUPnPAVTEvent* CUPnPAVTEvent::CloneL( const CUPnPAVTEvent& event )
       
    66     {
       
    67     CUPnPAVTEvent* tmp = CUPnPAVTEvent::NewL();
       
    68     tmp->SetInstanceID( event.InstanceID() );
       
    69     tmp->SetMute( event.Mute() );
       
    70     tmp->SetTransportState( event.TransportState() );
       
    71     tmp->SetTransportURIL( event.TransportURI() );
       
    72     tmp->SetVolume( event.Volume() );    
       
    73     return tmp;
       
    74     }
       
    75 
       
    76 // --------------------------------------------------------------------------
       
    77 // CUPnPAVTEvent::InstanceID
       
    78 // See upnpavevent.h for description
       
    79 // --------------------------------------------------------------------------
       
    80 EXPORT_C TInt CUPnPAVTEvent::InstanceID() const
       
    81     {
       
    82     return iInstanceID;
       
    83     }
       
    84     
       
    85 // --------------------------------------------------------------------------
       
    86 // CUPnPAVTEvent::Mute
       
    87 // See upnpavevent.h for description
       
    88 // --------------------------------------------------------------------------
       
    89 EXPORT_C TInt CUPnPAVTEvent::Mute() const
       
    90     {
       
    91     return iMute;
       
    92     }
       
    93 
       
    94 // --------------------------------------------------------------------------
       
    95 // CUPnPAVTEvent::Volume
       
    96 // See upnpavevent.h for description
       
    97 // --------------------------------------------------------------------------
       
    98 EXPORT_C TInt CUPnPAVTEvent::Volume() const
       
    99     {
       
   100     return iVolume;
       
   101     }
       
   102 
       
   103 // --------------------------------------------------------------------------
       
   104 // CUPnPAVTEvent::TransportState
       
   105 // See upnpavevent.h for description
       
   106 // --------------------------------------------------------------------------
       
   107 EXPORT_C CUPnPAVTEvent::TTransportState
       
   108     CUPnPAVTEvent::TransportState() const
       
   109     {
       
   110     return iTransportState;
       
   111     }
       
   112 
       
   113 // --------------------------------------------------------------------------
       
   114 // CUPnPAVTEvent::TransportURI
       
   115 // See upnpavevent.h for description
       
   116 // --------------------------------------------------------------------------
       
   117 EXPORT_C const TDesC8& CUPnPAVTEvent::TransportURI() const
       
   118     {
       
   119     if( iTransportURI )
       
   120         {
       
   121         return *iTransportURI;
       
   122         }
       
   123     else
       
   124         {
       
   125         return KNullDesC8;
       
   126         }
       
   127     }
       
   128 
       
   129 // --------------------------------------------------------------------------
       
   130 // CUPnPAVTEvent::SetInstanceID
       
   131 // See upnpavevent.h for description
       
   132 // --------------------------------------------------------------------------
       
   133 void CUPnPAVTEvent::SetInstanceID( TInt aInstanceID )
       
   134     {
       
   135     iInstanceID = aInstanceID;
       
   136     }
       
   137     
       
   138 // --------------------------------------------------------------------------
       
   139 // CUPnPAVTEvent::SetMute
       
   140 // See upnpavevent.h for description
       
   141 // --------------------------------------------------------------------------
       
   142 void CUPnPAVTEvent::SetMute( TInt aMute )
       
   143     {
       
   144     iMute = aMute;
       
   145     }
       
   146 
       
   147 // --------------------------------------------------------------------------
       
   148 // CUPnPAVTEvent::SetVolume
       
   149 // See upnpavevent.h for description
       
   150 // --------------------------------------------------------------------------
       
   151 void CUPnPAVTEvent::SetVolume( TInt aVolume )
       
   152     {
       
   153     iVolume = aVolume;
       
   154     }
       
   155 
       
   156 // --------------------------------------------------------------------------
       
   157 // CUPnPAVTEvent::SetTransportState
       
   158 // See upnpavevent.h for description
       
   159 // --------------------------------------------------------------------------
       
   160 void CUPnPAVTEvent::SetTransportState( TTransportState aTransportState )
       
   161     {
       
   162     iTransportState = aTransportState;
       
   163     }
       
   164     
       
   165 // --------------------------------------------------------------------------
       
   166 // CUPnPAVTEvent::SetTransportState
       
   167 // See upnpavevent.h for description
       
   168 // --------------------------------------------------------------------------
       
   169 void CUPnPAVTEvent::SetTransportState( const TDesC8& aData )
       
   170     {
       
   171     // Define AV Transport States
       
   172     _LIT8( KStopped,           "STOPPED"           );        
       
   173     _LIT8( KPlaying,           "PLAYING"           );
       
   174     _LIT8( KTransitioning,     "TRANSITIONING"     );
       
   175     _LIT8( KPausedPlayback,    "PAUSED_PLAYBACK"   );
       
   176     _LIT8( KPausedRecording,   "PAUSED_RECORDING"  );
       
   177     _LIT8( KRecording,         "RECORDING"         );
       
   178     _LIT8( KNoMediaPresent,    "NO_MEDIA_PRESENT"  );
       
   179 
       
   180     if( !aData.CompareF( KStopped ) )
       
   181         {
       
   182         iTransportState = EStopped;
       
   183         }
       
   184     else if( !aData.CompareF( KPlaying ) )
       
   185         {
       
   186         iTransportState = EPlaying;
       
   187         }
       
   188     else if( !aData.CompareF( KTransitioning ) )
       
   189         {
       
   190         iTransportState = ETransitioning;
       
   191         }
       
   192     else if( !aData.CompareF( KPausedPlayback ) )
       
   193         {
       
   194         iTransportState = EPausedPlayback;
       
   195         }
       
   196     else if( !aData.CompareF( KPausedRecording ) )
       
   197         {
       
   198         iTransportState = EPausedRecording;
       
   199         }
       
   200     else if( !aData.CompareF( KRecording ) )
       
   201         {
       
   202         iTransportState = ERecording;
       
   203         }
       
   204     else if( !aData.CompareF( KNoMediaPresent ) )
       
   205         {
       
   206         iTransportState = ENoMediaPresent;
       
   207         }
       
   208     else
       
   209         {
       
   210         iTransportState = EIdle;
       
   211         }
       
   212     }
       
   213 
       
   214 // --------------------------------------------------------------------------
       
   215 // CUPnPAVTEvent::SetTransportURIL
       
   216 // See upnpavevent.h for description
       
   217 // --------------------------------------------------------------------------
       
   218 void CUPnPAVTEvent::SetTransportURIL( const TDesC8& aTransportURI )
       
   219     {
       
   220     HBufC8* tmp = aTransportURI.AllocL();
       
   221     iTransportURI = tmp;
       
   222     }
       
   223 
       
   224 // --------------------------------------------------------------------------
       
   225 // CUPnPAVTEvent::Reset
       
   226 // See upnpavevent.h for description
       
   227 // --------------------------------------------------------------------------
       
   228 void CUPnPAVTEvent::Reset()
       
   229     {
       
   230     iInstanceID = KErrNotFound;
       
   231     iMute = KErrNotFound;
       
   232     iVolume = KErrNotFound;
       
   233     iTransportState = EIdle;
       
   234     delete iTransportURI; iTransportURI = NULL;
       
   235     }
       
   236 
       
   237 // End of File