sl@0: /* sl@0: * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: Custom command utility implementation sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: class CConvertCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CConvertCustomCommandUtility(CMdaAudioConvertUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CMdaAudioConvertUtility& iUtility; sl@0: sl@0: }; sl@0: sl@0: class CPlayerCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CPlayerCustomCommandUtility(CMdaAudioPlayerUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: return iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CMdaAudioPlayerUtility& iUtility; sl@0: sl@0: }; sl@0: sl@0: class CRecorderCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CRecorderCustomCommandUtility(CMdaAudioRecorderUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: return iUtility.RecordControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: return iUtility.RecordControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.RecordControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.RecordControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CMdaAudioRecorderUtility& iUtility; sl@0: sl@0: }; sl@0: sl@0: class CRecorderPlayCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CRecorderPlayCustomCommandUtility(CMdaAudioRecorderUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: return iUtility.PlayControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: return iUtility.PlayControllerCustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.PlayControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.PlayControllerCustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CMdaAudioRecorderUtility& iUtility; sl@0: sl@0: }; sl@0: sl@0: class CMidiCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CMidiCustomCommandUtility(CMidiClientUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: iUtility.CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: iUtility.CustomCommandSyncL(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CMidiClientUtility& iUtility; sl@0: }; sl@0: sl@0: class CDrmCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CDrmCustomCommandUtility(CDrmPlayerUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CDrmPlayerUtility& iUtility; sl@0: }; sl@0: sl@0: class CVideoRecorderCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CVideoRecorderCustomCommandUtility(CVideoRecorderUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CVideoRecorderUtility& iUtility; sl@0: }; sl@0: sl@0: class CVideoPlayerCustomCommandUtility : public CCustomCommandUtility sl@0: { sl@0: public: sl@0: CVideoPlayerCustomCommandUtility(CVideoPlayerUtility& aUtility) : sl@0: iUtility(aUtility) sl@0: { sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom) sl@0: { sl@0: iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2) sl@0: { sl@0: iUtility.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); sl@0: return KErrNone; sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TDes8& aDataFrom, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); sl@0: } sl@0: sl@0: virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, sl@0: TInt aFunction, sl@0: const TDesC8& aDataTo1, sl@0: const TDesC8& aDataTo2, sl@0: TRequestStatus& aStatus) sl@0: { sl@0: iUtility.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); sl@0: } sl@0: sl@0: private: sl@0: CVideoPlayerUtility& iUtility; sl@0: }; sl@0: sl@0: sl@0: EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioConvertUtility& aUtility) sl@0: { sl@0: CCustomCommandUtility* customCommand; sl@0: sl@0: customCommand = new(ELeave) CConvertCustomCommandUtility(aUtility); sl@0: sl@0: return customCommand; sl@0: } sl@0: sl@0: EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioPlayerUtility& aUtility) sl@0: { sl@0: CCustomCommandUtility* customCommand; sl@0: sl@0: customCommand = new(ELeave) CPlayerCustomCommandUtility(aUtility); sl@0: sl@0: return customCommand; sl@0: } sl@0: sl@0: EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMdaAudioRecorderUtility& aUtility, sl@0: TBool aRecordStream) sl@0: { sl@0: CCustomCommandUtility* customCommand; sl@0: sl@0: if( !aRecordStream ) //Playing sl@0: { sl@0: customCommand = new(ELeave) CRecorderPlayCustomCommandUtility(aUtility); sl@0: } sl@0: else //Recording sl@0: { sl@0: customCommand = new(ELeave) CRecorderCustomCommandUtility(aUtility); sl@0: } sl@0: sl@0: return customCommand; sl@0: } sl@0: sl@0: EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CMidiClientUtility& aUtility) sl@0: { sl@0: CCustomCommandUtility* customCommand; sl@0: sl@0: customCommand = new(ELeave) CMidiCustomCommandUtility(aUtility); sl@0: sl@0: return customCommand; sl@0: } sl@0: sl@0: EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CDrmPlayerUtility& aUtility) sl@0: { sl@0: CCustomCommandUtility* customCommand; sl@0: sl@0: customCommand = new(ELeave) CDrmCustomCommandUtility(aUtility); sl@0: sl@0: return customCommand; sl@0: } sl@0: sl@0: EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CVideoPlayerUtility& aUtility) sl@0: { sl@0: CCustomCommandUtility* customCommand; sl@0: sl@0: customCommand = new(ELeave) CVideoPlayerCustomCommandUtility(aUtility); sl@0: sl@0: return customCommand; sl@0: } sl@0: sl@0: EXPORT_C CCustomCommandUtility* CCustomCommandUtility::NewL(CVideoRecorderUtility& aUtility) sl@0: { sl@0: CCustomCommandUtility* customCommand; sl@0: sl@0: customCommand = new(ELeave) CVideoRecorderCustomCommandUtility(aUtility); sl@0: sl@0: return customCommand; sl@0: } sl@0: // ========================== OTHER EXPORTED FUNCTIONS ========================= sl@0: sl@0: sl@0: sl@0: // End of File