mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackevent.cpp
branchRCL_3
changeset 19 0aa8cc770c8a
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
       
     1 // Copyright (c) 2010 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 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #include "cmtpplaybackevent.h"
       
    22 #include "mtpplaybackcontrolpanic.h"
       
    23 
       
    24 // Class constants.
       
    25 __FLOG_STMT(_LIT8(KComponent,"CMtpPbEvent");)
       
    26 
       
    27 CMTPPbEventParam* CMTPPbEventParam::NewL(TMTPPbCategory aCategory, const TDesC& aSuid)
       
    28     {
       
    29     CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aCategory, aSuid);
       
    30     CleanupStack::PushL(self);
       
    31     self->ConstructL(aCategory, aSuid);
       
    32     CleanupStack::Pop(self);
       
    33     return self;
       
    34     }
       
    35 
       
    36 CMTPPbEventParam* CMTPPbEventParam::NewL(TInt32 aValue)
       
    37     {
       
    38     CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aValue);
       
    39     CleanupStack::PushL(self);
       
    40     self->ConstructL(aValue);
       
    41     CleanupStack::Pop(self);
       
    42     return self;
       
    43     }
       
    44 
       
    45 CMTPPbEventParam* CMTPPbEventParam::NewL(TUint32 aValue)
       
    46     {
       
    47     CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aValue);
       
    48     CleanupStack::PushL(self);
       
    49     self->ConstructL(aValue);
       
    50     CleanupStack::Pop(self);
       
    51     return self;
       
    52     }
       
    53 
       
    54 CMTPPbEventParam::~CMTPPbEventParam()
       
    55     {
       
    56     
       
    57     }
       
    58 
       
    59 CMTPPbEventParam::CMTPPbEventParam(TMTPPbCategory aCategory, const TDesC& aSuid):
       
    60     CMTPPbParamBase(aCategory, aSuid)
       
    61     {
       
    62 
       
    63     }
       
    64 
       
    65 CMTPPbEventParam::CMTPPbEventParam(TInt32 aValue):
       
    66     CMTPPbParamBase(aValue)
       
    67     {
       
    68     
       
    69     }
       
    70 
       
    71 CMTPPbEventParam::CMTPPbEventParam(TUint32 aValue):
       
    72     CMTPPbParamBase(aValue)
       
    73     {
       
    74     
       
    75     }
       
    76 
       
    77 /**
       
    78 Two-phase constructor.
       
    79 */  
       
    80 CMTPPlaybackEvent* CMTPPlaybackEvent::NewL(TMTPPlaybackEvent aEvent, CMTPPbEventParam* aParam)
       
    81     {
       
    82     __ASSERT_DEBUG((aEvent > EPlaybackEventNone && aEvent < EPlaybackEventEnd), Panic(EMTPPBArgumentErr));
       
    83     __ASSERT_ALWAYS((aEvent > EPlaybackEventNone && aEvent < EPlaybackEventEnd), User::Leave(KErrArgument));
       
    84     
       
    85     CMTPPlaybackEvent* self = new (ELeave) CMTPPlaybackEvent(aEvent, aParam);
       
    86     CleanupStack::PushL(self);
       
    87     self->ConstructL();
       
    88     CleanupStack::Pop(self);
       
    89     return self;
       
    90     }
       
    91 
       
    92 /**
       
    93 Destructor.
       
    94 */    
       
    95 CMTPPlaybackEvent::~CMTPPlaybackEvent()
       
    96     {    
       
    97     __FLOG(_L8("~CMTPPlaybackEvent - Entry"));
       
    98     delete iParam;
       
    99     __FLOG(_L8("~CMTPPlaybackEvent - Exit"));
       
   100     __FLOG_CLOSE;
       
   101     }
       
   102 
       
   103 /**
       
   104 Constructor.
       
   105 */    
       
   106 CMTPPlaybackEvent::CMTPPlaybackEvent(TMTPPlaybackEvent aEvent,
       
   107                                      CMTPPbEventParam* aParam):
       
   108     iPbEvent(aEvent),iParam(aParam)
       
   109     {    
       
   110     }
       
   111     
       
   112 /**
       
   113 Second-phase constructor.
       
   114 */        
       
   115 void CMTPPlaybackEvent::ConstructL()
       
   116     {
       
   117     __FLOG_OPEN(KMTPSubsystem, KComponent);
       
   118     __FLOG(_L8("CMTPPlaybackEvent: ConstructL - Entry")); 
       
   119     __FLOG(_L8("CMTPPlaybackEvent: ConstructL - Exit")); 
       
   120     }
       
   121 
       
   122 void CMTPPlaybackEvent::SetParam(CMTPPbEventParam* aParam)
       
   123     {
       
   124     delete iParam;
       
   125     iParam = aParam;
       
   126     }
       
   127 
       
   128 TMTPPlaybackEvent CMTPPlaybackEvent::PlaybackEvent()
       
   129     {
       
   130     __ASSERT_DEBUG((iPbEvent > EPlaybackEventNone && iPbEvent < EPlaybackEventEnd), Panic(EMTPPBArgumentErr));
       
   131     return iPbEvent;
       
   132     }
       
   133 
       
   134 const CMTPPbEventParam& CMTPPlaybackEvent::ParamL()
       
   135     {
       
   136     __ASSERT_DEBUG((iParam != NULL), Panic(EMTPPBDataNullErr));
       
   137     __ASSERT_ALWAYS((iParam != NULL), User::Leave(KErrArgument));
       
   138 
       
   139     return *iParam;
       
   140     }