mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcgetdevicepropdesc.cpp
changeset 49 c20dd21d1eb4
parent 29 3ae5cb0b4c02
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    25 #include "cmtpplaybackcontroldp.h"
    25 #include "cmtpplaybackcontroldp.h"
    26 #include "cmtpplaybackproperty.h"
    26 #include "cmtpplaybackproperty.h"
    27 #include "cmtpplaybackmap.h"
    27 #include "cmtpplaybackmap.h"
    28 #include "cmtpplaybackcommand.h"
    28 #include "cmtpplaybackcommand.h"
    29 #include "mtpplaybackcontrolpanic.h"
    29 #include "mtpplaybackcontrolpanic.h"
    30 
    30 #include "OstTraceDefinitions.h"
    31 // Class constants.
    31 #ifdef OST_TRACE_COMPILER_IN_USE
    32 __FLOG_STMT(_LIT8(KComponent,"GetPlaybackDevicePropDesc");)
    32 #include "cmtppbcgetdevicepropdescTraces.h"
       
    33 #endif
       
    34 
    33 
    35 
    34 /**
    36 /**
    35 Two-phase constructor.
    37 Two-phase constructor.
    36 @param aPlugin The data provider plugin
    38 @param aPlugin The data provider plugin
    37 @param aFramework The data provider framework
    39 @param aFramework The data provider framework
    40 */  
    42 */  
    41 MMTPRequestProcessor* CMTPPbcGetDevicePropDesc::NewL(MMTPDataProviderFramework& aFramework,
    43 MMTPRequestProcessor* CMTPPbcGetDevicePropDesc::NewL(MMTPDataProviderFramework& aFramework,
    42                                                 MMTPConnection& aConnection, 
    44                                                 MMTPConnection& aConnection, 
    43                                                 CMTPPlaybackControlDataProvider& aDataProvider)
    45                                                 CMTPPlaybackControlDataProvider& aDataProvider)
    44     {
    46     {
       
    47     OstTraceFunctionEntry0( CMTPPBCGETDEVICEPROPDESC_NEWL_ENTRY );
    45     CMTPPbcGetDevicePropDesc* self = new (ELeave) CMTPPbcGetDevicePropDesc(aFramework, aConnection, aDataProvider);
    48     CMTPPbcGetDevicePropDesc* self = new (ELeave) CMTPPbcGetDevicePropDesc(aFramework, aConnection, aDataProvider);
       
    49     OstTraceFunctionExit0( CMTPPBCGETDEVICEPROPDESC_NEWL_EXIT );
    46     return self;
    50     return self;
    47     }
    51     }
    48 
    52 
    49 /**
    53 /**
    50 Destructor.
    54 Destructor.
    51 */    
    55 */    
    52 CMTPPbcGetDevicePropDesc::~CMTPPbcGetDevicePropDesc()
    56 CMTPPbcGetDevicePropDesc::~CMTPPbcGetDevicePropDesc()
    53     {    
    57     {    
    54     __FLOG(_L8("~CMTPPbcGetDevicePropDesc - Entry"));
    58     OstTraceFunctionEntry0( CMTPPBCGETDEVICEPROPDESC_CMTPPBCGETDEVICEPROPDESC_ENTRY );
    55     delete iPropDesc;
    59     delete iPropDesc;
    56     delete iPbCmd;
    60     delete iPbCmd;
    57     __FLOG(_L8("~CMTPPbcGetDevicePropDesc - Exit"));
    61     OstTraceFunctionExit0( CMTPPBCGETDEVICEPROPDESC_CMTPPBCGETDEVICEPROPDESC_EXIT );
    58     __FLOG_CLOSE;
       
    59     }
    62     }
    60 
    63 
    61 /**
    64 /**
    62 Constructor.
    65 Constructor.
    63 */    
    66 */    
    65                                             MMTPConnection& aConnection, 
    68                                             MMTPConnection& aConnection, 
    66                                             CMTPPlaybackControlDataProvider& aDataProvider) :
    69                                             CMTPPlaybackControlDataProvider& aDataProvider) :
    67     CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    70     CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    68     iPlaybackControlDp(aDataProvider)
    71     iPlaybackControlDp(aDataProvider)
    69     {
    72     {
    70     //Open the log system
    73     OstTraceFunctionEntry0( DUP1_CMTPPBCGETDEVICEPROPDESC_CMTPPBCGETDEVICEPROPDESC_ENTRY );
    71     __FLOG_OPEN(KMTPSubsystem, KComponent);
    74     OstTraceFunctionExit0( DUP1_CMTPPBCGETDEVICEPROPDESC_CMTPPBCGETDEVICEPROPDESC_EXIT );
    72     }
    75     }
    73     
    76     
    74 /**
    77 /**
    75 GetDevicePropDesc request validator.
    78 GetDevicePropDesc request validator.
    76 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
    79 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
    77 */
    80 */
    78 TMTPResponseCode CMTPPbcGetDevicePropDesc::CheckRequestL()
    81 TMTPResponseCode CMTPPbcGetDevicePropDesc::CheckRequestL()
    79     {
    82     {
    80     __FLOG(_L8("CheckRequestL - Entry"));
    83     OstTraceFunctionEntry0( CMTPPBCGETDEVICEPROPDESC_CHECKREQUESTL_ENTRY );
    81     TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
    84     TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
    82     if(respCode == EMTPRespCodeOK)
    85     if(respCode == EMTPRespCodeOK)
    83         {
    86         {
    84         respCode = EMTPRespCodeDevicePropNotSupported;
    87         respCode = EMTPRespCodeDevicePropNotSupported;
    85         TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    88         TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    92                 break;
    95                 break;
    93                 }
    96                 }
    94             }
    97             }
    95         }
    98         }
    96 
    99 
    97     __FLOG(_L8("CheckRequestL - Exit"));
   100     OstTraceFunctionExit0( CMTPPBCGETDEVICEPROPDESC_CHECKREQUESTL_EXIT );
    98     return respCode;
   101     return respCode;
    99     }
   102     }
   100 
   103 
   101 /**
   104 /**
   102 GetDevicePropDesc request handler.
   105 GetDevicePropDesc request handler.
   103 */    
   106 */    
   104 void CMTPPbcGetDevicePropDesc::ServiceL()
   107 void CMTPPbcGetDevicePropDesc::ServiceL()
   105     {
   108     {
   106     __FLOG(_L8("ServiceL - Entry"));
   109     OstTraceFunctionEntry0( CMTPPBCGETDEVICEPROPDESC_SERVICEL_ENTRY );
   107     //Destroy the previous playback command.
   110     //Destroy the previous playback command.
   108     delete iPbCmd;
   111     delete iPbCmd;
   109     iPbCmd = NULL;
   112     iPbCmd = NULL;
   110     
   113     
   111     //Get the device property code
   114     //Get the device property code
   133     else
   136     else
   134         {
   137         {
   135         SendResponseL(EMTPRespCodeParameterNotSupported);
   138         SendResponseL(EMTPRespCodeParameterNotSupported);
   136         }
   139         }
   137 
   140 
   138     __FLOG(_L8("ServiceL - Exit"));
   141     OstTraceFunctionExit0( CMTPPBCGETDEVICEPROPDESC_SERVICEL_EXIT );
   139     }
   142     }
   140 
   143 
   141 void CMTPPbcGetDevicePropDesc::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
   144 void CMTPPbcGetDevicePropDesc::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
   142     {
   145     {
   143     __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
   146     OstTraceFunctionEntry0( CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL_ENTRY );
   144     __FLOG_1(_L8("aErr %d"), aErr);
   147     OstTrace1( TRACE_NORMAL, CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL, "aErr %d", aErr );
       
   148     
   145 
   149 
   146     TBool useDefault = EFalse;
   150     TBool useDefault = EFalse;
   147     switch(aErr)
   151     switch(aErr)
   148         {
   152         {
   149         case KPlaybackErrNone:
   153         case KPlaybackErrNone:
   150             {
   154             {
   151             __ASSERT_DEBUG((aCmd != NULL), Panic(EMTPPBDataNullErr));
   155             __ASSERT_DEBUG((aCmd != NULL), Panic(EMTPPBDataNullErr));
   152             __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
   156             __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
   153             __ASSERT_ALWAYS((aCmd != NULL), User::Leave(KErrArgument));
   157             __ASSERT_ALWAYS_OST((aCmd != NULL), OstTrace0( TRACE_ERROR, DUP2_CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL, "Error argument" ), User::Leave(KErrArgument));
   154             __ASSERT_ALWAYS((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), User::Leave(KErrArgument));
   158             __ASSERT_ALWAYS_OST((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), OstTrace0( TRACE_ERROR, DUP3_CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL, "Error argument" ), User::Leave(KErrArgument));
   155             __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
   159             OstTrace1( TRACE_NORMAL, DUP1_CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL, "aCmd %d", aCmd->PlaybackCommand());
   156             }
   160             }
   157             break;
   161             break;
   158         case KPlaybackErrContextInvalid:
   162         case KPlaybackErrContextInvalid:
   159             {
   163             {
   160             useDefault = ETrue;
   164             useDefault = ETrue;
   163         case KPlaybackErrDeviceUnavailable:
   167         case KPlaybackErrDeviceUnavailable:
   164             {
   168             {
   165             iPlaybackControlDp.RequestToResetPbCtrl();
   169             iPlaybackControlDp.RequestToResetPbCtrl();
   166             SendResponseL(EMTPRespCodeDeviceBusy);
   170             SendResponseL(EMTPRespCodeDeviceBusy);
   167             }
   171             }
       
   172             OstTraceFunctionExit0( CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL_EXIT );
   168             return;
   173             return;
   169 
   174 
   170         default:
   175         default:
   171             {
   176             {
   172             SendResponseL(EMTPRespCodeDeviceBusy);
   177             SendResponseL(EMTPRespCodeDeviceBusy);
   173             }
   178             }
       
   179             OstTraceFunctionExit0( DUP1_CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL_EXIT );
   174             return;
   180             return;
   175         }
   181         }
   176 
   182 
   177     delete iPropDesc;
   183     delete iPropDesc;
   178     iPropDesc = NULL;
   184     iPropDesc = NULL;
   301             }
   307             }
   302             break;
   308             break;
   303         
   309         
   304         default:
   310         default:
   305             {
   311             {
   306             User::Leave(KErrArgument);
   312             LEAVEIFERROR( KErrArgument, 
       
   313                                     OstTrace0( TRACE_ERROR, DUP4_CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL, "Error argument" ));
   307             } 
   314             } 
   308             break;
   315             break;
   309         }
   316         }
   310 
   317 
   311     __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
   318     OstTraceFunctionExit0( DUP2_CMTPPBCGETDEVICEPROPDESC_HANDLEPLAYBACKCOMMANDCOMPLETEL_EXIT );
   312     }
   319     }