sl@0: // Copyright (c) 2007-2009 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: sl@0: // Example implementation of RDvbhReceiver sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: @prototype sl@0: */ sl@0: sl@0: #include "dvbhreceiver.h" sl@0: #include "dvbhreceiverbody.h" sl@0: #include sl@0: sl@0: sl@0: EXPORT_C RDvbhReceiver::RDvbhReceiver() sl@0: : iBody(NULL) //Not a C-class so no free initialisation sl@0: { sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::GetSupportedReceiverTypes( RArray& aReceiverTypes ) sl@0: { sl@0: //RBody::GetSupportedReceiverTypes is static. sl@0: return RBody::GetSupportedReceiverTypes(aReceiverTypes); sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::GetDriverVersion( TVersion& aVersion ) sl@0: { sl@0: //RBody::GetDriverVersion is static. sl@0: return RBody::GetDriverVersion(aVersion); sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::Open( const TDvbhReceiverType aReceiverType ) sl@0: { sl@0: //Delegate to OpenL sl@0: TRAPD(err, OpenL( aReceiverType )); sl@0: return err; sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::Close() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->Close(); sl@0: delete iBody; sl@0: iBody = NULL; sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::PowerOn( TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->PowerOn(aStatus); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelPowerOn() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->CancelPowerOn(); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::PowerOff( TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->PowerOff(aStatus); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelPowerOff() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->CancelPowerOff(); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::SetDisabled( TBool aDisable, TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->SetDisabled(aDisable, aStatus); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelSetDisabled() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->CancelSetDisabled(); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::SetScanConfiguration( const TDvbhScanConfiguration& aScanConfiguration ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->SetScanConfiguration(aScanConfiguration); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::GetScanConfiguration( TDvbhScanConfiguration& aScanConfiguration ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->GetScanConfiguration(aScanConfiguration); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::GetDvbhVersion( TVersion& aVersion ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->GetDvbhVersion(aVersion); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::GetHardwareInfo( TDvbhHardwareInfo& aHardwareInfo ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->GetHardwareInfo(aHardwareInfo); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::Scan( MDvbhScanObserver& aObserver, TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->Scan(aObserver, aStatus); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelScan() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->CancelScan(); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::SetPlatform( const TDvbhNetwork& aNetwork, const TDvbhPlatform& aPlatform, TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->SetPlatform(aNetwork, aPlatform, aStatus); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelSetPlatform() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->CancelSetPlatform(); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::CreateFilter( const TIp6Addr& aDestAddress, TInt& aFilterId, TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->CreateFilter(aDestAddress, aFilterId, aStatus); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::CancelFilter( TInt aFilterId ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->CancelFilter(aFilterId); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::ReceiveIPData( MDvbhDataObserver& aObserver ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->ReceiveIPData(aObserver); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelReceiveIPData() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->CancelReceiveIPData(); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::UpdateNetworkTime( TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->UpdateNetworkTime(aStatus); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelUpdateNetworkTime() sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->CancelUpdateNetworkTime(); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::CustomCommand( sl@0: TInt aCommand, sl@0: const TDesC8& aInputData, sl@0: TDes8& aOutputBuffer, sl@0: TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->CustomCommand(aCommand, aInputData, aOutputBuffer, aStatus); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C void RDvbhReceiver::CancelCustomCommand( TRequestStatus& aStatus ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: iBody->CancelCustomCommand(aStatus); sl@0: } sl@0: else sl@0: { sl@0: ASSERT(EFalse); //Generate a panic in debug builds to help developers detect this situation. sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TInt RDvbhReceiver::CustomCommand( TInt aCommand, const TDesC8& aInputData ) sl@0: { sl@0: if (iBody != NULL) sl@0: { sl@0: return iBody->CustomCommand(aCommand, aInputData); sl@0: } sl@0: else sl@0: { sl@0: return KErrNotReady; sl@0: } sl@0: } sl@0: sl@0: void RDvbhReceiver::OpenL( const TDvbhReceiverType aReceiverType ) sl@0: { sl@0: if (iBody == NULL) sl@0: { sl@0: iBody = new (ELeave) RBody; sl@0: } sl@0: User::LeaveIfError(iBody->Open( aReceiverType )); sl@0: } sl@0: