mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcresetdevicepropvalue.cpp
changeset 49 c20dd21d1eb4
parent 29 3ae5cb0b4c02
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    22 #include "mtpplaybackcontroldpconst.h"
    22 #include "mtpplaybackcontroldpconst.h"
    23 #include "cmtpplaybackcontroldp.h"
    23 #include "cmtpplaybackcontroldp.h"
    24 #include "cmtpplaybackproperty.h"
    24 #include "cmtpplaybackproperty.h"
    25 #include "cmtpplaybackcommand.h"
    25 #include "cmtpplaybackcommand.h"
    26 #include "mtpplaybackcontrolpanic.h"
    26 #include "mtpplaybackcontrolpanic.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "cmtppbcresetdevicepropvalueTraces.h"
       
    30 #endif
    27 
    31 
    28 // Class constants.
       
    29 __FLOG_STMT(_LIT8(KComponent,"ResetPlaybackDevicePropValue");)
       
    30 
    32 
    31 /**
    33 /**
    32 Two-phase constructor.
    34 Two-phase constructor.
    33 @param aPlugin  The data provider plugin
    35 @param aPlugin  The data provider plugin
    34 @param aFramework The data provider framework
    36 @param aFramework The data provider framework
    37 */  
    39 */  
    38 MMTPRequestProcessor* CMTPPbcResetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework, 
    40 MMTPRequestProcessor* CMTPPbcResetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework, 
    39                                                     MMTPConnection& aConnection, 
    41                                                     MMTPConnection& aConnection, 
    40                                                     CMTPPlaybackControlDataProvider& aDataProvider)
    42                                                     CMTPPlaybackControlDataProvider& aDataProvider)
    41     {
    43     {
       
    44     OstTraceFunctionEntry0( CMTPPBCRESETDEVICEPROPVALUE_NEWL_ENTRY );
    42     CMTPPbcResetDevicePropValue* self = new (ELeave) CMTPPbcResetDevicePropValue(aFramework, aConnection, aDataProvider);
    45     CMTPPbcResetDevicePropValue* self = new (ELeave) CMTPPbcResetDevicePropValue(aFramework, aConnection, aDataProvider);
       
    46     OstTraceFunctionExit0( CMTPPBCRESETDEVICEPROPVALUE_NEWL_EXIT );
    43     return self;
    47     return self;
    44     }
    48     }
    45 
    49 
    46 /**
    50 /**
    47 Destructor
    51 Destructor
    48 */    
    52 */    
    49 CMTPPbcResetDevicePropValue::~CMTPPbcResetDevicePropValue()
    53 CMTPPbcResetDevicePropValue::~CMTPPbcResetDevicePropValue()
    50     {    
    54     {    
    51     __FLOG(_L8("~CMTPPbcResetDevicePropValue - Entry"));
    55     OstTraceFunctionEntry0( CMTPPBCRESETDEVICEPROPVALUE_CMTPPBCRESETDEVICEPROPVALUE_ENTRY );
    52     delete iPbCmd;
    56     delete iPbCmd;
    53     __FLOG(_L8("~CMTPPbcResetDevicePropValue - Exit"));
    57     OstTraceFunctionExit0( CMTPPBCRESETDEVICEPROPVALUE_CMTPPBCRESETDEVICEPROPVALUE_EXIT );
    54     __FLOG_CLOSE;
       
    55     }
    58     }
    56 
    59 
    57 /**
    60 /**
    58 Standard c++ constructor
    61 Standard c++ constructor
    59 */    
    62 */    
    61                                                     MMTPConnection& aConnection,
    64                                                     MMTPConnection& aConnection,
    62                                                     CMTPPlaybackControlDataProvider& aDataProvider):
    65                                                     CMTPPlaybackControlDataProvider& aDataProvider):
    63                                                     CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    66                                                     CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    64                                                     iPlaybackControlDp(aDataProvider)
    67                                                     iPlaybackControlDp(aDataProvider)
    65     {
    68     {
    66     //Open the log system
    69     OstTraceFunctionEntry0( DUP1_CMTPPBCRESETDEVICEPROPVALUE_CMTPPBCRESETDEVICEPROPVALUE_ENTRY );
    67     __FLOG_OPEN(KMTPSubsystem, KComponent);
    70     OstTraceFunctionExit0( DUP1_CMTPPBCRESETDEVICEPROPVALUE_CMTPPBCRESETDEVICEPROPVALUE_EXIT );
    68     }
    71     }
    69 
    72 
    70 /**
    73 /**
    71 SetDevicePropValue request validator.
    74 SetDevicePropValue request validator.
    72 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
    75 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
    73 */
    76 */
    74 TMTPResponseCode CMTPPbcResetDevicePropValue::CheckRequestL()
    77 TMTPResponseCode CMTPPbcResetDevicePropValue::CheckRequestL()
    75     {
    78     {
    76     __FLOG(_L8("CheckRequestL - Entry"));
    79     OstTraceFunctionEntry0( CMTPPBCRESETDEVICEPROPVALUE_CHECKREQUESTL_ENTRY );
    77     TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
    80     TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
    78     if(respCode == EMTPRespCodeOK)
    81     if(respCode == EMTPRespCodeOK)
    79         {
    82         {
    80         respCode = EMTPRespCodeDevicePropNotSupported;
    83         respCode = EMTPRespCodeDevicePropNotSupported;
    81         TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    84         TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    87                 respCode = EMTPRespCodeOK;
    90                 respCode = EMTPRespCodeOK;
    88                 break;
    91                 break;
    89                 }
    92                 }
    90             }
    93             }
    91         }
    94         }
    92 
    95     OstTraceFunctionExit0( CMTPPBCRESETDEVICEPROPVALUE_CHECKREQUESTL_EXIT );
    93     __FLOG(_L8("CheckRequestL - Exit"));
       
    94     return respCode;
    96     return respCode;
    95     }
    97     }
    96 /**
    98 /**
    97 ResetDevicePropValue request handler.
    99 ResetDevicePropValue request handler.
    98 */ 	
   100 */ 	
    99 void CMTPPbcResetDevicePropValue::ServiceL()
   101 void CMTPPbcResetDevicePropValue::ServiceL()
   100     {
   102     {
   101     __FLOG(_L8("ServiceL - Entry"));
   103     OstTraceFunctionEntry0( CMTPPBCRESETDEVICEPROPVALUE_SERVICEL_ENTRY );
   102 
   104 
   103     CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
   105     CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
   104     //Destroy the previous playback command.
   106     //Destroy the previous playback command.
   105     delete iPbCmd;
   107     delete iPbCmd;
   106     iPbCmd = NULL;
   108     iPbCmd = NULL;
   127         }
   129         }
   128     else
   130     else
   129         {
   131         {
   130         SendResponseL(EMTPRespCodeParameterNotSupported);
   132         SendResponseL(EMTPRespCodeParameterNotSupported);
   131         }
   133         }
   132     
   134     OstTraceFunctionExit0( CMTPPBCRESETDEVICEPROPVALUE_SERVICEL_EXIT );
   133     __FLOG(_L8("ServiceL - Exit")); 
       
   134     }
   135     }
   135 
   136 
   136 void CMTPPbcResetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
   137 void CMTPPbcResetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
   137     {
   138     {
   138     __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
   139     OstTraceFunctionEntry0( CMTPPBCRESETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL_ENTRY );
   139     __FLOG_1(_L8("aErr %d"), aErr);
   140     OstTrace1( TRACE_NORMAL, CMTPPBCRESETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL, "aErr %d", aErr );
   140 
   141 
   141     //Handle error response.
   142     //Handle error response.
   142     TMTPResponseCode response;
   143     TMTPResponseCode response;
   143     switch(aErr)
   144     switch(aErr)
   144         {
   145         {
   168     SendResponseL(response);
   169     SendResponseL(response);
   169     
   170     
   170     if(aCmd != NULL)
   171     if(aCmd != NULL)
   171         {
   172         {
   172         __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
   173         __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
   173         __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
   174         OstTrace1( TRACE_NORMAL, DUP1_CMTPPBCRESETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL, "aCmd %d", aCmd->PlaybackCommand() );
   174         }
   175         }
   175 
   176 
   176     __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
   177     OstTraceFunctionExit0( CMTPPBCRESETDEVICEPROPVALUE_HANDLEPLAYBACKCOMMANDCOMPLETEL_EXIT );
   177     }
   178     }