tactilefeedback/tactilefeedbackresolver/src/tactileplayer.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:23:25 +0100
branchRCL_3
changeset 37 09b094b73eb8
parent 36 39d4c97df8cb
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2008 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:  Interface class for tactile feedback players.
* Part of:      Tactile Feedback.
*
*/

#include "tactileplayer.h"

const TUid KTactilePlayerIFUid   = {0x2001CBA7};

_LIT8( KTactileHaptics, "Haptics" );
_LIT8( KTactileAudio,   "Audio"   );

// ======== LOCAL FUNCTIONS ========

// ---------------------------------------------------------------------------
// Constructor.
// ---------------------------------------------------------------------------
//
CTactilePlayer* CTactilePlayer::NewL( TUid aImplementationUid, 
                                      CRepository& aRepository )
    {
    return static_cast<CTactilePlayer*> ( REComSession::CreateImplementationL( 
            aImplementationUid, 
            _FOFF(CTactilePlayer, iDtor_ID_Key ), 
            &aRepository ) );
    }

// ---------------------------------------------------------------------------
// Lists the available plugin implementations for this interface.
// ---------------------------------------------------------------------------
// 
void CTactilePlayer::ListImplementationsL( TTactilePlayerType aType,
                                           RImplInfoPtrArray& aImplInfoArray )
    {
    if ( aType == ETactilePlayerAny )
        {
        REComSession::ListImplementationsL( KTactilePlayerIFUid, 
                                            aImplInfoArray );
        }
    else
        {
        RImplInfoPtrArray implInfoArray;
        CleanupClosePushL( implInfoArray );
        REComSession::ListImplementationsL( KTactilePlayerIFUid, 
                                            implInfoArray );
        for( TInt i(0) ; i < implInfoArray.Count() ; i++ )
            {
            switch( aType )
                {
                case ETactilePlayerHaptics:
                    if ( !implInfoArray[i]->DataType().Compare( KTactileHaptics ) )
                        {
                        aImplInfoArray.AppendL( implInfoArray[i] );
                        }
                    break;
                case ETactilePlayerAudio:
                    if ( !implInfoArray[i]->DataType().Compare( KTactileAudio ) )
                        {
                        aImplInfoArray.AppendL( implInfoArray[i] );
                        } 
                    break;
                default:
                    break;                       
                }
            }
        CleanupStack::PopAndDestroy( &implInfoArray );
        }
    }

// ---------------------------------------------------------------------------
// Destructor.
// ---------------------------------------------------------------------------
// 
EXPORT_C CTactilePlayer::~CTactilePlayer()
    {
    REComSession::DestroyedImplementation( iDtor_ID_Key );
    }

// ---------------------------------------------------------------------------
// Start feedback.
// ---------------------------------------------------------------------------
//   
EXPORT_C TInt CTactilePlayer::StartFeedback( TTouchContinuousFeedback /*aFeedback*/,
                                             TInt /*aIntensity*/ )
    {
    // Empty implementation for plugins, which don't support 
    // continuous feedback.
    return KErrNotSupported;
    }
        
// ---------------------------------------------------------------------------
// Modify feedback.
// ---------------------------------------------------------------------------
//                        
EXPORT_C TInt CTactilePlayer::ModifyFeedback( TInt /*aIntensity*/ )
    {
    // Empty implementation for plugins, which don't support 
    // continuous feedback.
    return KErrNotSupported;    
    }
    
// ---------------------------------------------------------------------------
// Stop feedback.
// ---------------------------------------------------------------------------
//    
EXPORT_C void CTactilePlayer::StopFeedback()
    {
    // Empty implementation for plugins, which needn't stop 
    // playing feedback.
    }
    
// ---------------------------------------------------------------------------
// Maximum level.
// ---------------------------------------------------------------------------
// 
EXPORT_C TInt CTactilePlayer::MaxLevel()
    {
    // Default implementation returns 1 as maximum level, which means that
    // player has only one level.
    return 1; 
    }

// ---------------------------------------------------------------------------
// Play preview.
// ---------------------------------------------------------------------------
// 
EXPORT_C TInt CTactilePlayer::PlayPreviewFeedback( TInt /*aLevel*/,
                                         TTouchLogicalFeedback /*aFeedback*/ )
    {
    return KErrNotSupported;
    }

// ---------------------------------------------------------------------------
// Start preview.
// ---------------------------------------------------------------------------
// 
EXPORT_C TInt CTactilePlayer::StartPreviewFeedback( TInt /*aLevel*/,
                                       TTouchContinuousFeedback /*aFeedback*/,
                                       TInt /*aIntensity*/ )
    {
    return KErrNotSupported;
    }

// ---------------------------------------------------------------------------
// Stop preview.
// ---------------------------------------------------------------------------
// 
EXPORT_C void CTactilePlayer::StopPreviewFeedback()
    {    
    }