Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <mmf/common/mmfdrmcustomcommands.h>
17 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
18 #include <mmf/common/mmfdrmcustomcommandsenum.h>
21 EXPORT_C CMMFDRMCustomCommandParser* CMMFDRMCustomCommandParser::NewL(MMMFDRMCustomCommandImplementor& aImplementor)
23 return new(ELeave) CMMFDRMCustomCommandParser(aImplementor);
26 EXPORT_C CMMFDRMCustomCommandParser::~CMMFDRMCustomCommandParser()
30 CMMFDRMCustomCommandParser::CMMFDRMCustomCommandParser(MMMFDRMCustomCommandImplementor& aImplementor)
31 : CMMFCustomCommandParserBase(KUidInterfaceMMFDRMControl),
32 iImplementor(aImplementor)
36 void CMMFDRMCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
39 DoHandleRequestL(aMessage);
41 aMessage.Complete(err);
44 void CMMFDRMCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
46 if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFDRMControl)
48 switch (aMessage.Function())
50 case EMMFDRMControlEvaluateIntent:
51 DoEvaluateIntentL(aMessage);
54 case EMMFDRMControlExecuteIntent:
55 DoExecuteIntentL(aMessage);
58 case EMMFDRMControlDisableAutomaticIntent:
59 DoDisableAutomaticIntentL(aMessage);
62 case EMMFDRMControlSetAgentProperty:
63 DoSetAgentPropertyL(aMessage);
65 case EMMFDRMControlIsSupported:
66 // we just complete the message with KErrNone
69 User::Leave(KErrNotSupported);
75 User::Leave(KErrNotSupported);
79 void CMMFDRMCustomCommandParser::DoExecuteIntentL(TMMFMessage& aMessage)
81 TPckgBuf<ContentAccess::TIntent> intentPckg;
82 aMessage.ReadData1FromClientL(intentPckg);
83 User::LeaveIfError(iImplementor.MdcExecuteIntent( intentPckg()));
86 void CMMFDRMCustomCommandParser::DoEvaluateIntentL(TMMFMessage& aMessage)
88 TPckgBuf<ContentAccess::TIntent> intentPckg;
89 aMessage.ReadData1FromClientL(intentPckg);
90 User::LeaveIfError(iImplementor.MdcEvaluateIntent( intentPckg()));
93 void CMMFDRMCustomCommandParser::DoDisableAutomaticIntentL(TMMFMessage& aMessage)
95 TPckgBuf<TBool> boolPckg;
96 aMessage.ReadData1FromClientL(boolPckg);
97 iImplementor.MdcDisableAutomaticIntent( boolPckg());
100 void CMMFDRMCustomCommandParser::DoSetAgentPropertyL(TMMFMessage& aMessage)
102 TPckgBuf<ContentAccess::TAgentProperty> propertyPckg;
103 TPckgBuf<TInt> valuePckg;
104 aMessage.ReadData1FromClientL(propertyPckg);
105 aMessage.ReadData2FromClientL(valuePckg);
106 User::LeaveIfError(iImplementor.MdcSetAgentProperty( propertyPckg(), valuePckg()));
110 EXPORT_C RMMFDRMCustomCommands::RMMFDRMCustomCommands(RMMFController& aController) :
111 RMMFCustomCommandsBase(aController, KUidInterfaceMMFDRMControl)
115 EXPORT_C TInt RMMFDRMCustomCommands::ExecuteIntent(ContentAccess::TIntent aIntent)
117 TPckgBuf<ContentAccess::TIntent> intentPckg(aIntent);
119 return iController.CustomCommandSync(iDestinationPckg,
120 EMMFDRMControlExecuteIntent,
125 EXPORT_C TInt RMMFDRMCustomCommands::EvaluateIntent(ContentAccess::TIntent aIntent)
127 TPckgBuf<ContentAccess::TIntent> intentPckg(aIntent);
129 return iController.CustomCommandSync(iDestinationPckg,
130 EMMFDRMControlEvaluateIntent,
135 EXPORT_C TInt RMMFDRMCustomCommands::DisableAutomaticIntent(TBool aBool)
137 TPckgBuf<TBool> boolPckg(aBool);
139 return iController.CustomCommandSync(iDestinationPckg,
140 EMMFDRMControlDisableAutomaticIntent,
145 EXPORT_C TInt RMMFDRMCustomCommands::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue)
147 TPckgBuf<ContentAccess::TAgentProperty> propertyPckg(aProperty);
148 TPckgBuf<TInt> valuePckg(aValue);
150 return iController.CustomCommandSync(iDestinationPckg,
151 EMMFDRMControlSetAgentProperty,
157 EXPORT_C TInt RMMFDRMCustomCommands::IsSupported()
159 TInt err = iController.CustomCommandSync(iDestinationPckg,
160 EMMFDRMControlIsSupported,
164 return (err == KErrNone)?ETrue : EFalse;