os/mm/mmlibs/mmfw/src/ControllerFramework/MMFDurationInfoCustomCommands.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "mmfdurationinfocustomcommands.h"
sl@0
    17
#include <mmf/common/mmfdurationinfocustomcommands.h>
sl@0
    18
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    19
#include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
sl@0
    20
#include <mmf/common/mmfdurationinfocustomcommandsenums.h>
sl@0
    21
#include <mmf/common/mmfdrmcustomcommandsenum.h>
sl@0
    22
#endif
sl@0
    23
sl@0
    24
EXPORT_C CMMFDurationInfoCustomCommandParser* CMMFDurationInfoCustomCommandParser::NewL(MMMFDurationInfoCustomCommandImplementor& aImplementor)
sl@0
    25
	{
sl@0
    26
	return new(ELeave) CMMFDurationInfoCustomCommandParser(aImplementor);
sl@0
    27
	}
sl@0
    28
sl@0
    29
EXPORT_C CMMFDurationInfoCustomCommandParser::~CMMFDurationInfoCustomCommandParser()
sl@0
    30
	{
sl@0
    31
	}
sl@0
    32
sl@0
    33
CMMFDurationInfoCustomCommandParser::CMMFDurationInfoCustomCommandParser(MMMFDurationInfoCustomCommandImplementor& aImplementor) 
sl@0
    34
	: CMMFCustomCommandParserBase(KUidInterfaceMMFDurationInfoControl),
sl@0
    35
	  iImplementor(aImplementor)
sl@0
    36
	{
sl@0
    37
	}
sl@0
    38
sl@0
    39
void CMMFDurationInfoCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
    40
	{
sl@0
    41
	TInt err = KErrNotSupported;
sl@0
    42
	
sl@0
    43
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFDurationInfoControl)
sl@0
    44
		{
sl@0
    45
		switch (aMessage.Function())
sl@0
    46
			{
sl@0
    47
		case EMMFGetDurationInfo:
sl@0
    48
			err = GetDurationInfo(aMessage);
sl@0
    49
			break;
sl@0
    50
		default:
sl@0
    51
			err = KErrNotSupported;
sl@0
    52
			break;
sl@0
    53
			}
sl@0
    54
		}
sl@0
    55
sl@0
    56
	aMessage.Complete(err);
sl@0
    57
	}
sl@0
    58
sl@0
    59
sl@0
    60
TInt CMMFDurationInfoCustomCommandParser::GetDurationInfo(TMMFMessage& aMessage)
sl@0
    61
	{
sl@0
    62
	TInt retRes = KErrNone;
sl@0
    63
	TPckgBuf<TMMFDurationInfo> enumPckg;
sl@0
    64
	iImplementor.GetDurationInfo( enumPckg() );
sl@0
    65
	aMessage.WriteDataToClient(enumPckg);
sl@0
    66
	return retRes;
sl@0
    67
	}
sl@0
    68
sl@0
    69
EXPORT_C CMMFDurationInfoCustomCommandParser2* CMMFDurationInfoCustomCommandParser2::NewL(MMMFDurationInfoCustomCommandImplementor2& aImplementor)
sl@0
    70
	{
sl@0
    71
	return new(ELeave) CMMFDurationInfoCustomCommandParser2(aImplementor);
sl@0
    72
	}
sl@0
    73
sl@0
    74
EXPORT_C CMMFDurationInfoCustomCommandParser2::~CMMFDurationInfoCustomCommandParser2()
sl@0
    75
	{
sl@0
    76
	}
sl@0
    77
sl@0
    78
CMMFDurationInfoCustomCommandParser2::CMMFDurationInfoCustomCommandParser2(MMMFDurationInfoCustomCommandImplementor2& aImplementor) 
sl@0
    79
	: CMMFCustomCommandParserBase(KUidInterfaceMMFDurationInfoControl2),
sl@0
    80
	  iImplementor(aImplementor)
sl@0
    81
	{
sl@0
    82
	}
sl@0
    83
sl@0
    84
void CMMFDurationInfoCustomCommandParser2::HandleRequest(TMMFMessage& aMessage)
sl@0
    85
	{
sl@0
    86
	TInt err = KErrNone;
sl@0
    87
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFDurationInfoControl2)
sl@0
    88
		{
sl@0
    89
		switch (aMessage.Function())
sl@0
    90
			{
sl@0
    91
		case EMMFGetDurationInfo:
sl@0
    92
			err = GetDurationInfo(aMessage);
sl@0
    93
			break;
sl@0
    94
		default:
sl@0
    95
			err = KErrNotSupported;
sl@0
    96
			break;
sl@0
    97
			}
sl@0
    98
		}
sl@0
    99
	else
sl@0
   100
		{
sl@0
   101
		err = KErrNotSupported;
sl@0
   102
		}	
sl@0
   103
	aMessage.Complete(err);
sl@0
   104
	}
sl@0
   105
sl@0
   106
TInt CMMFDurationInfoCustomCommandParser2::GetDurationInfo(TMMFMessage& aMessage)
sl@0
   107
	{
sl@0
   108
	TInt err = KErrNone;
sl@0
   109
	TPckgBuf<TMMFDurationInfo> enumPckg;
sl@0
   110
	err = iImplementor.GetDurationInfo(enumPckg());
sl@0
   111
	if(err==KErrNone)
sl@0
   112
		{
sl@0
   113
		err = aMessage.WriteDataToClient(enumPckg);
sl@0
   114
		}
sl@0
   115
	return err;
sl@0
   116
	}
sl@0
   117