mmlibs/mmfw/src/ControllerFramework/MMFDurationInfoCustomCommands.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2004-2009 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 #include "mmfdurationinfocustomcommands.h"
       
    17 #include <mmf/common/mmfdurationinfocustomcommands.h>
       
    18 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    19 #include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
       
    20 #include <mmf/common/mmfdurationinfocustomcommandsenums.h>
       
    21 #include <mmf/common/mmfdrmcustomcommandsenum.h>
       
    22 #endif
       
    23 
       
    24 EXPORT_C CMMFDurationInfoCustomCommandParser* CMMFDurationInfoCustomCommandParser::NewL(MMMFDurationInfoCustomCommandImplementor& aImplementor)
       
    25 	{
       
    26 	return new(ELeave) CMMFDurationInfoCustomCommandParser(aImplementor);
       
    27 	}
       
    28 
       
    29 EXPORT_C CMMFDurationInfoCustomCommandParser::~CMMFDurationInfoCustomCommandParser()
       
    30 	{
       
    31 	}
       
    32 
       
    33 CMMFDurationInfoCustomCommandParser::CMMFDurationInfoCustomCommandParser(MMMFDurationInfoCustomCommandImplementor& aImplementor) 
       
    34 	: CMMFCustomCommandParserBase(KUidInterfaceMMFDurationInfoControl),
       
    35 	  iImplementor(aImplementor)
       
    36 	{
       
    37 	}
       
    38 
       
    39 void CMMFDurationInfoCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
       
    40 	{
       
    41 	TInt err = KErrNotSupported;
       
    42 	
       
    43 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFDurationInfoControl)
       
    44 		{
       
    45 		switch (aMessage.Function())
       
    46 			{
       
    47 		case EMMFGetDurationInfo:
       
    48 			err = GetDurationInfo(aMessage);
       
    49 			break;
       
    50 		default:
       
    51 			err = KErrNotSupported;
       
    52 			break;
       
    53 			}
       
    54 		}
       
    55 
       
    56 	aMessage.Complete(err);
       
    57 	}
       
    58 
       
    59 
       
    60 TInt CMMFDurationInfoCustomCommandParser::GetDurationInfo(TMMFMessage& aMessage)
       
    61 	{
       
    62 	TInt retRes = KErrNone;
       
    63 	TPckgBuf<TMMFDurationInfo> enumPckg;
       
    64 	iImplementor.GetDurationInfo( enumPckg() );
       
    65 	aMessage.WriteDataToClient(enumPckg);
       
    66 	return retRes;
       
    67 	}
       
    68 
       
    69 EXPORT_C CMMFDurationInfoCustomCommandParser2* CMMFDurationInfoCustomCommandParser2::NewL(MMMFDurationInfoCustomCommandImplementor2& aImplementor)
       
    70 	{
       
    71 	return new(ELeave) CMMFDurationInfoCustomCommandParser2(aImplementor);
       
    72 	}
       
    73 
       
    74 EXPORT_C CMMFDurationInfoCustomCommandParser2::~CMMFDurationInfoCustomCommandParser2()
       
    75 	{
       
    76 	}
       
    77 
       
    78 CMMFDurationInfoCustomCommandParser2::CMMFDurationInfoCustomCommandParser2(MMMFDurationInfoCustomCommandImplementor2& aImplementor) 
       
    79 	: CMMFCustomCommandParserBase(KUidInterfaceMMFDurationInfoControl2),
       
    80 	  iImplementor(aImplementor)
       
    81 	{
       
    82 	}
       
    83 
       
    84 void CMMFDurationInfoCustomCommandParser2::HandleRequest(TMMFMessage& aMessage)
       
    85 	{
       
    86 	TInt err = KErrNone;
       
    87 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFDurationInfoControl2)
       
    88 		{
       
    89 		switch (aMessage.Function())
       
    90 			{
       
    91 		case EMMFGetDurationInfo:
       
    92 			err = GetDurationInfo(aMessage);
       
    93 			break;
       
    94 		default:
       
    95 			err = KErrNotSupported;
       
    96 			break;
       
    97 			}
       
    98 		}
       
    99 	else
       
   100 		{
       
   101 		err = KErrNotSupported;
       
   102 		}	
       
   103 	aMessage.Complete(err);
       
   104 	}
       
   105 
       
   106 TInt CMMFDurationInfoCustomCommandParser2::GetDurationInfo(TMMFMessage& aMessage)
       
   107 	{
       
   108 	TInt err = KErrNone;
       
   109 	TPckgBuf<TMMFDurationInfo> enumPckg;
       
   110 	err = iImplementor.GetDurationInfo(enumPckg());
       
   111 	if(err==KErrNone)
       
   112 		{
       
   113 		err = aMessage.WriteDataToClient(enumPckg);
       
   114 		}
       
   115 	return err;
       
   116 	}
       
   117