--- a/radioengine/utils/src/cradiopropertyobserver.cpp Fri May 14 15:52:32 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "cradioenginelogger.h"
-
-#include "cradiopropertyobserver.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CRadioPropertyObserver::CRadioPropertyObserver( MRadioPropertyChangeObserver& aObserver,
- const TUid& aCategory,
- const TUint aKey,
- const TRadioPropertyType aPropertyType )
- : CActive( CActive::EPriorityStandard )
- , iObserver( aObserver )
- , iCategory( aCategory )
- , iKey( aKey )
- , iPropertyType( aPropertyType )
- {
- }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CRadioPropertyObserver::ConstructL()
- {
- switch ( iPropertyType )
- {
- case ERadioPropertyInt:
- {
- break;
- }
- case ERadioPropertyByteArray:
- {
- iValueByteArray = HBufC8::NewL( RProperty::KMaxPropertySize );
- break;
- }
- case ERadioPropertyText:
- {
- // Max size in bytes, length is size / 2
- iValueText = HBufC::NewL( RProperty::KMaxPropertySize / 2 );
- break;
- }
- default:
- {
- break;
- }
- }
-
- User::LeaveIfError( iProperty.Attach( iCategory, iKey ) );
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CRadioPropertyObserver* CRadioPropertyObserver::NewL( MRadioPropertyChangeObserver& aObserver,
- const TUid& aCategory,
- const TUint aKey,
- const TRadioPropertyType aPropertyType )
- {
- CRadioPropertyObserver* self = new( ELeave )CRadioPropertyObserver( aObserver,
- aCategory, aKey, aPropertyType );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CRadioPropertyObserver::~CRadioPropertyObserver()
- {
- Cancel();
- iProperty.Close();
- delete iValueByteArray;
- delete iValueText;
- }
-
-// ---------------------------------------------------------------------------
-// Subscribes to a property and reads the value, if not already active.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CRadioPropertyObserver::ActivateL()
- {
- if ( !IsActive() )
- {
- RunL();
- }
- }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CRadioPropertyObserver::RunL()
- {
- LOG_METHOD_AUTO;
-
- iProperty.Subscribe( iStatus );
- SetActive();
-
- TInt err( KErrNone );
-
- switch ( iPropertyType )
- {
- case ERadioPropertyInt:
- {
- err = iProperty.Get( iValueInt );
- if ( !err )
- {
- iObserver.HandlePropertyChangeL( iCategory, iKey, iValueInt );
- }
- break;
- }
- case ERadioPropertyByteArray:
- {
- TPtr8 ptr8( iValueByteArray->Des() );
- err = iProperty.Get( ptr8 );
- if ( !err )
- {
- iObserver.HandlePropertyChangeL( iCategory, iKey, *iValueByteArray );
- }
- break;
- }
- case ERadioPropertyText:
- {
- TPtr ptr( iValueText->Des() );
- err = iProperty.Get( ptr );
- if ( !err )
- {
- iObserver.HandlePropertyChangeL( iCategory, iKey, *iValueText );
- }
- break;
- }
- default:
- {
- break;
- }
- }
-
- if ( err )
- {
- iObserver.HandlePropertyChangeErrorL( iCategory, iKey, err );
- }
- }
-
-// -----------------------------------------------------------------------------
-// Cancels an outstanding active request
-// -----------------------------------------------------------------------------
-//
-void CRadioPropertyObserver::DoCancel()
- {
- iProperty.Cancel();
- }
-
-// -----------------------------------------------------------------------------
-// Getter for integer value
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CRadioPropertyObserver::ValueInt() const
- {
- return iValueInt;
- }
-
-// -----------------------------------------------------------------------------
-// Getter for byte array value
-// -----------------------------------------------------------------------------
-//
-EXPORT_C const TDesC8& CRadioPropertyObserver::ValueDes8() const
- {
- return *iValueByteArray;
- }
-
-// -----------------------------------------------------------------------------
-// Getter for text value
-// -----------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CRadioPropertyObserver::ValueDes() const
- {
- return *iValueText;
- }