--- a/accessoryservices/accessoryserver/src/Server/AccSrvWiredConnectionPublisher.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/accessoryservices/accessoryserver/src/Server/AccSrvWiredConnectionPublisher.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -78,7 +78,7 @@
COM_TRACE_2( "[AccFW:AccServer] CAccSrvWiredConnectionPublisher::HandleConnectL: physConnCaps=0x%x, iConnectionCount=%d",
physConnCaps, iConnectionCount );
- if ( physConnCaps & KPCWired )
+ if ( physConnCaps & (KPCWired | KPCHDMI) )
{
if ( !iConnectionCount++ )
{
@@ -102,7 +102,7 @@
COM_TRACE_2( "[AccFW:AccServer] CAccSrvWiredConnectionPublisher::HandleDisconnectL: physConnCaps=0x%x, iConnectionCount=%d",
physConnCaps, iConnectionCount );
- if ( (physConnCaps & KPCWired) && iConnectionCount )
+ if ( (physConnCaps & (KPCWired | KPCHDMI)) && iConnectionCount )
{
if ( !(--iConnectionCount) )
{
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/compositecablestateconnected.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/compositecablestateconnected.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -359,7 +359,12 @@
if ( EPDEIfCentralRepositoryWatchEventKeyChanged == aEvent )
{
INFO( "Event: EPDEIfCentralRepositoryWatchEventKeyChanged" );
- iResettingInput = ETrue;
+ iCRWatchForFlickerFilter->Cancel();
+ iCRWatchForAspectRatio->Cancel();
+ iCRWatchForTvSystem->Cancel();
+ ClearAvailableTvOutConfig();
+ iTVOutConfigForComposite.Disable();
+ iResettingInput = ETrue;
Enter();
}
else
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1367,7 +1367,7 @@
{
TInt availableIndex = 0;
TBool found( EFalse );
- TBool defaultCEAmode( EFalse );
+ TBool defaultCEAmode( EFalse ), ceaMode( EFalse );
supportedCount = supportedModes.Count();
INFO_1( "HDMI CONFIGS --- From HW -- Total : %d", supportedCount );
@@ -1383,6 +1383,7 @@
(TSupportedHdmiDviMode::ECea == supportedModes[ supportedIndex ].iStandardModeType) &&
(aHdmiConfigs[ availableIndex ].iCeaMode == supportedModes[ supportedIndex ].iStandardMode) )
{
+ ceaMode = ETrue;
found = ETrue;
if( aHdmiConfigs[ availableIndex].iCeaMode == KDefaultCEAMode )
{
@@ -1441,15 +1442,20 @@
{
TInt modecount = aHdmiConfigs.Count();
- INFO( "<<<<<<<<<<<<<<It is DVI connector>>>>>>>>>>>>>>" );
while( modecount-- )
{
- // Change it to DVI mode as it is existing in both Supported and available configurations
- aHdmiConfigs[ modecount ].iConnector = TTvSettings::EDVI;
+
+ if( aHdmiConfigs[ modecount ].iDmtMode && (EFalse == ceaMode) )
+ {
+ INFO( "<<<<<<<<<<<<<<It is DVI connector>>>>>>>>>>>>>>" );
+
+ // Change it to DVI mode as it is existing in both Supported and available configurations
+ aHdmiConfigs[ modecount ].iConnector = TTvSettings::EDVI;
- // Version should be zeroed for non-HDMI
- aHdmiConfigs[ modecount ].iTvHdmiVersion = 0;
- aHdmiConfigs[ modecount ].iTvHdmiRevision = 0;
+ // Version should be zeroed for non-HDMI
+ aHdmiConfigs[ modecount ].iTvHdmiVersion = 0;
+ aHdmiConfigs[ modecount ].iTvHdmiRevision = 0;
+ }
}
}
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/data/20021204.rss Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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: Haptics effect data getter plugin ECom resource file
-*
-*/
-
-#include <ecom/registryinfo.rh>
-
-RESOURCE REGISTRY_INFO theInfo
- {
- dll_uid = 0x20021204;
- interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = 0x20021202;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = 0x20021203;
- version_no = 1;
- display_name = "";
- default_data = "";
- opaque_data = "";
- }
- };
- }
- };
- }
-
-// End of file
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/group/bld.inf Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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: Build file for effect data getter ECom plugin.
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-../rom/hwrmhapticsivtgetterplugin.iby CORE_OS_LAYER_IBY_EXPORT_PATH(hwrmhapticsivtgetterplugin.iby)
-
-PRJ_MMPFILES
-hwrmhapticsivtgetterplugin.mmp
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/group/hwrmhapticsivtgetterplugin.mmp Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* 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: Project definition file for effect data getter ECom plugin.
-*
-*/
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET hwrmhapticsivtgetterplugin.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D 0x20021204
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE hwrmhapticsivtgetter.cpp
-SOURCE basisivtgetters.cpp
-SOURCE ivthelper.cpp
-SOURCE timelineivtgetters.cpp
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../../inc
-
-// Default system include paths for osext layer modules.
-OS_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE /epoc32/include/stdapis
-
-SOURCEPATH ../data
-START RESOURCE 20021204.rss
-TARGETPATH ECOM_RESOURCE_DIR
-TARGET hwrmhapticsivtgetterplugin.rsc
-END
-
-LIBRARY euser.lib
-LIBRARY efsrv.lib
-LIBRARY estlib.lib
-LIBRARY ecom.lib
-LIBRARY hwrmhapticseffectdatagetterfw.lib
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/inc/basisivtgetters.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* 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: Basis effect internal getters header file.
-*
-*/
-
-#ifndef BASISIVTGETTERS_H
-#define BASISIVTGETTERS_H
-
-
-#include "ivtinternal.h"
-
-
-/**
- * Utility class for getting various basis effect specific information
- * from data buffer.
- */
-class BasisIVTGetters
- {
-public:
-
- /**
- * Method for getting basis effect properties.
- *
- * @param aMsg Pointer to the data buffer containing the
- * effect definition.
- * @param aDuration Duration of the effect (out param).
- * @param aStartDelay Start delay of the effect (out param).
- * @param aMagnitude Magnitude of the effect (out param).
- * @param aStartFlag Start flag of the effect (out param).
- * @param aType Type of the effect (out param).
- * @param aFreqPer Period of the effect (out param).
- * @param aControlMode Control mode of the effect (out param).
- */
- static void VibeIVTGetPeriodic(
- const TUint8* aMsg,
- TVibeIVTMessageTime* aDuration,
- TVibeIVTMessageTime* aStartDelay,
- TVibeIVTMagnitude* aMagnitude,
- TInt* aStartFlag,
- TInt* aType,
- TVibeIVTFreqPer* aFreqPer,
- TInt* aControlMode );
-
- /**
- * Method for getting basis effect modifier (envelope) properties.
- *
- * @param aMsg Pointer to the data buffer containing the
- * effect definition.
- * @param aImpulseTime Impulse (attack) time of the effect
- * (out param).
- * @param aFadeTime Fade time of the effect (out param).
- * @param aImpulseLevel Impulse (attack) level of the effect
- * (out param).
- * @param aFadeLevel Fade level of the effect (out param).
- */
- static void VibeIVTGetPeriodicModifier(
- const TUint8* aMsg,
- TVibeIVTMessageTime* aImpulseTime,
- TVibeIVTMessageTime* aFadeTime,
- TVibeIVTMagnitude* aImpulseLevel,
- TVibeIVTMagnitude* aFadeLevel );
-
-};
-
-#endif /* BASISIVTGETTERS_H */
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/inc/hwrmhapticsivtgetter.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-* 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: Plugin for reading effect information from IVT effect data.
-*
-*/
-
-#ifndef C_HWRMHAPTICSIVTGETTER_H
-#define C_HWRMHAPTICSIVTGETTER_H
-
-#include <e32base.h>
-
-#include <hwrmhapticseffectdatagetter.h>
-#include "ivtinternal.h"
-
-/**
- * Ecom plugin for getting haptics ivt data.
- *
- * @lib hapticsivtgetterplugin.lib
- * @since S60 5.1
- */
-NONSHARABLE_CLASS( CHWRMHapticsIVTGetter ): public CHWRMHapticsEffectDataGetter
- {
-public:
-
- /**
- * 2-phased constructor.
- * @return An instance of haptics ivt getter.
- */
- static CHWRMHapticsIVTGetter* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CHWRMHapticsIVTGetter();
-
-public: // From CHWRMHapticsEffectDataGetter
-
- /**
- * @see CHWRMHapticsEffectDataGetter
- */
- TInt GetEffectCount( const TDesC8& aData, TInt& aCount );
-
- /**
- * @see CHWRMHapticsEffectDataGetter
- */
- TInt GetEffectName( const TDesC8& aData,
- TInt aEffectIndex,
- TDes8& aEffectName );
-
- /**
- * @see CHWRMHapticsEffectDataGetter
- */
- TInt GetEffectIndexFromName( const TDesC8& aData,
- const TDesC8& aEffectName,
- TInt& aEffectIndex );
-
- /**
- * @see CHWRMHapticsEffectDataGetter
- */
- TInt GetEffectType( const TDesC8& aData,
- TInt aEffectIndex,
- TInt& aEffectType );
-
- /**
- * @see CHWRMHapticsEffectDataGetter
- */
- TInt GetMagSweepEffectDefinition(
- const TDesC8& aData,
- TInt aEffectIndex,
- CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect );
-
- /**
- * @see CHWRMHapticsEffectDataGetter
- */
- TInt GetPeriodicEffectDefinition(
- const TDesC8& aData,
- TInt aEffectIndex,
- CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect );
-
- /**
- * @see CHWRMHapticsEffectDataGetter
- */
- TInt GetEffectDuration( const TDesC8& aData,
- TInt aEffectIndex,
- TInt& aEffectDuration );
-
-private:
-
- /**
- * Constructor.
- */
- CHWRMHapticsIVTGetter();
-
- /**
- * 2nd phase constructor.
- */
- void ConstructL();
-
-private:
-
- /**
- * Utility method for fetching the effect definition using effect data
- * and index.
- */
- TInt GetEffectByIndex( const TDesC8& aData,
- TInt aEffectIndex,
- TVibeEffectDefinition* aEffectDefinition );
-
- };
-
-
-#endif // C_HWRMHAPTICSIVTGETTER_H
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/inc/ivtconstants.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* 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: VibeTonz related const definitions header file
-*
-*/
-
-#ifndef _HWRMHAPTICSIVTCONSTANTS_H
-#define _HWRMHAPTICSIVTCONSTANTS_H
-
-#include <e32def.h>
-#include <limits.h>
-
-/**
- * Invalid index constant
- */
-const TInt KVibeInvalidIndex = -1;
-
-/**
- * Maximum effect name length constant
- */
-const TInt KVibeMaxEffectNameLength = 128; // Maximum effect name length
-
-/**
- * 'Infinite' time
- */
-const TInt KVibeTimeInfinite = INT_MAX;
-
-/**
- * 'Infinite' repeat count value
- */
-const TUint8 KVibeRepeatCountInfinite = 255;
-
-
-
-#endif // _HWRMHAPTICSIVTCONSTANTS_H
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/inc/ivthelper.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/*
-* 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: IVT effect getter methods high level helper functions header file.
-*
-*/
-
-#ifndef IVTHELPER_H
-#define IVTHELPER_H
-
-#include "ivtinternal.h"
-
-/**
- * Utility class for parsing various information from effect data buffer.
- */
-class IVTHelper
- {
-public:
- /**
- * Method for checking that the IVT header is correctly formatted.
- * (This includes also version number check).
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return ETrue if header is correctly formatted, EFalse otherwise.
- */
- static TBool IsValidIVTAddress( const TUint8* aIVT );
-
- /**
- * Method for getting number of effects within an effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Number (count) of effects contained within the effect data
- * buffer.
- */
- static TUint16 GetNumEffects( const TUint8* aIVT );
-
- /**
- * Method for getting the start address of the sub-buffer (from the
- * effect data buffer containing possibly several effect definitions)
- * that contains effect definition of the given effect.
- *
- * @param aIVT Pointer to the effect data buffer.
- * @param aEffectIndex Index of the effect (within the effect data
- * buffer).
- *
- * @return Pointer to the effect definition sub-buffer. In case of
- * any error, NULL is returned.
- */
- static TUint8* GetEffectStorage( const TUint8* aIVT, TInt aEffectIndex );
-
- /**
- * Method for extracting envelope (attack and fade times and levels) from
- * a buffer of effect-specific data. I.e., this is given an address to the
- * effect specific part in effect data buffer, not the whole effect data
- * buffer. The aPacket param can be obtained e.g. by first calling the
- * above GetEffectStorage method.
- *
- * @param aPacket Pointer to effect specific data (sub-)buffer.
- * @param aEnvelope Pointer to a TVibeEnvelopeParams structure to which
- * the envelope params are read.
- *
- * @return ETrue on success, EFalse otherwise.
- */
- static TBool ExtractEnvelopeFromPacket(
- const TUint8* aPacket,
- TVibeEnvelopeParams* aEnvelope );
-
- /**
- * Method for extracting effect definition from a buffer of effect-
- * specific data. I.e., this is given an address to the effect-specific
- * part in effect data buffer, not the whole effect data
- * buffer. The aPacket param can be obtained e.g. by first calling the
- * above GetEffectStorage method.
- *
- * @param aPacket Pointer to effect specific data (sub-)buffer.
- * @param aEffectDefinition Pointer to a TVibeEffectDefinition structure
- * to which the effect definition params are
- * read.
- * @param aPeriodicType The type of the effect (basis vs timeline) is
- * written to the TInt located in this address.
- *
- * @return ETrue on success, EFalse otherwise.
- */
- static TBool ExtractEffectDefinitionFromPacket(
- const TUint8* aPacket,
- TVibeEffectDefinition* aEffectDefinition,
- TInt* aPeriodicType );
-
- /**
- * Method for getting the effect name data sub-buffer address.
- *
- * @param aIVT Pointer to the effect data buffer.
- * @param aEffectIndex Index of the effect (within the effect data
- * buffer) which name data is queried.
- *
- * @return Pointer to the (sub-)buffer containing the effect name data.
- * In case of error, returns NULL pointer.
- */
- static TUint8* GetEffectNameData( const TUint8* aIVT, TInt aEffectIndex );
-
- /**
- * Method for getting the effect duration.
- *
- * @param aIVT Pointer to the effect data buffer.
- * @param aEffectIndex Index of the effect (within the effect data
- * buffer) which duration is queried.
- *
- * @return Duration of the effect.
- * In case of error, one of Vibe error codes.
- */
- static TInt GetIVTEffectDuration( const TUint8* aIVT, TInt aEffectIndex );
-
-private:
-
- /**
- * Internal structure for repeat bar.
- * iEvent not owned.
- */
- struct TVibeRepeatBar
- {
- TInt iTimeOffsetEnd;
- TInt iTimeDuration;
- TVibeIVTCount iCount;
- const TUint8* iEvent;
- };
-
- /**
- * Structure for timeline effect information
- * None of the pointer members are owned.
- */
- struct TVibeTimeLineInfo
- {
- TVibeRepeatBar iRepeatBarStack[KRepeatBarStackMaxSize];
- TInt iRepeatBarStackTop;
- TUint8* iOffsetSubBlock;
- TUint8* iDataSubBlock;
- const TUint8* iNextEvent;
- TInt iTimeAllEffectsEnd;
- // all events times offest are relative to this time
- // when computing effect end time
- TInt iTimeOffsetZero;
- TInt iTimeRepeat;
- TInt iTimeEvent;
- };
-
- /**
- * Method for getting the IVT header from effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Pointer to the IVT header.
- */
- static TVibeIVTHeader* GetIVTHeader( const TUint8* aIVT );
-
- /**
- * Method for checking if the given effect data buffer contains any effect
- * definitions or not.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return ETrue if the buffer contains effect definition, EFalse otherwise.
- */
- static TBool IsEmpty( const TUint8* aIVT);
-
- /**
- * Method for getting storage block size from effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Storage block size.
- */
- static TUint16 GetStorageBlockSize( const TUint8* aIVT );
-
- /**
- * Method for getting name block size from effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Name block size.
- */
- static TUint16 GetNameBlockSize( const TUint8* aIVT );
-
- /**
- * Method for checking if the given effect data buffer contains any effect
- * name block(s) or not.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return ETrue if the buffer contains effect name block(s), EFalse otherwise.
- */
- static TBool HasNameBlock( const TUint8* aIVT );
-
- /**
- * Method for getting the start address of the storage block within the
- * effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Pointer to the start of the storage block. In case of error
- * returns NULL.
- */
- static TUint8* GetStorageBlock( const TUint8* aIVT );
-
- /**
- * Method for getting the start address of the storage offset subblock
- * within the effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Pointer to the start of the storage offset subblock.
- * In case of error returns NULL.
- */
- static TUint8* GetStorageOffsetSubBlock( const TUint8* aIVT );
-
- /**
- * Method for getting the start address of the storage data subblock
- * within the effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Pointer to the start of the storage data subblock.
- * In case of error returns NULL.
- */
- static TUint8* GetStorageDataSubBlock( const TUint8* aIVT );
-
- /**
- * Method for getting the start address of the name block within the
- * effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Pointer to the start of the name block. In case of error
- * returns NULL.
- */
- static TUint8* GetNameBlock( const TUint8* aIVT );
-
- /**
- * Method for getting the start address of the name offset subblock
- * within the effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Pointer to the start of the name offset subblock.
- * In case of error returns NULL.
- */
- static TUint8* GetNameOffsetSubBlock( const TUint8* aIVT );
-
- /**
- * Method for getting the start address of the name data subblock
- * within the effect data buffer.
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Pointer to the start of the name data subblock.
- * In case of error returns NULL.
- */
- static TUint8* GetNameDataSubBlock( const TUint8* aIVT );
-
- /**
- * Method for getting size of the effect data buffer (as calculated
- * from the header fields).
- *
- * @param aIVT Pointer to the effect data buffer.
- *
- * @return Size of the effect data buffer.
- */
- static TUint GetIVTSize( const TUint8* aIVT );
-
- /**
- * Method for converting firmware representation of magnitude to the
- * one used in user interface (i.e., returned by various magnitude
- * getters).
- *
- * @param aFwMagnitude Magnitude in firmware representation.
- *
- * @return Magnitude as seen by users.
- */
- static TInt ConvertToUserMagnitude( TInt aFwMagnitude );
-
- /**
- * Method for converting firmware representation of duration to the
- * one used in user interface (i.e., returned by various duration
- * getters).
- *
- * @param aFwDuration Duration in firmware representation.
- *
- * @return Duration as seen by users.
- */
- static TInt ConvertToUserDuration( TVibeIVTMessageTime aFwDuration );
-
- /**
- * Method for converting firmware representation of frequency period to
- * the one used in user interface (i.e., returned by various frequency
- * period getters).
- *
- * @param aFwFrequency Frequency period in firmware representation.
- *
- * @return Frequency period as seen by users.
- */
- static TInt ConvertToUserFrequency( TVibeIVTFreqPer aFwFrequency );
-
- /**
- * Helper method for processing Launch Playback events when calculating
- * timeline effect's duration.
- *
- * @param Pointer to a timeline info structure which is to be processed.
- *
- * @return KVibeStatusSuccess in case of successful processing, otherwise
- * one of Vibe error statuses.
- */
- static TInt TimelineDurationProcessEvent(
- TVibeTimeLineInfo* aTimelineInfo );
-
- /**
- * Helper method for processing Repeat Bar events when calculating
- * timeline effect's duration.
- *
- * @param Pointer to a timeline info structure which is to be processed.
- *
- * @return KVibeStatusSuccess in case of successful processing, otherwise
- * one of Vibe error statuses.
- */
- static TInt TimelineDurationProcessRepeatInStack(
- TVibeTimeLineInfo* aTimelineInfo );
- };
-
-#endif /* IVTHELPER_H */
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/inc/ivtinternal.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-/*
-* 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: Basis and timeline effects related constant, macro and function
-* prototype definition header file.
-*/
-
-#ifndef _HWRMHAPTICSVIBEIVTINTERNAL_H
-#define _HWRMHAPTICSVIBEIVTINTERNAL_H
-
-
-#include "ivtconstants.h"
-
-/**
- * A few typedefs for internal Vibe (integer) types
- */
-
-typedef TUint16 TVibeIVTMessageTime;
-typedef TUint16 TVibeIVTEffectID;
-typedef TUint8 TVibeIVTOverrideFlags;
-typedef TInt8 TVibeIVTMagnitude;
-typedef TUint16 TVibeIVTFreqPer;
-typedef TUint8 TVibeIVTCount;
-
-/**
- * Number of bytes in a basis effect message
- */
-const TInt KVibeIvtMessageSize = 8;
-
-/**
- * Basis effect message types
- */
-const TUint8 KVibeMessageTypeSetPeriodic = 2;
-const TUint8 KVibeMessageTypeSetPeriodicModifier = 3;
-
-/**
- * Periodic type constants. MagSweep effects use KVibePeriodicTypeConstant
- * and Periodic effects KVibePeriodicTypeSquare.
- * Others are reserved for future developement.
- */
-const TInt KVibePeriodicTypeConstant = 0;
-const TInt KVibePeriodicTypeSquare = 1;
-const TInt KVibePeriodicTypeTriangle = 2; // For future dev
-const TInt KVibePeriodicTypeSine = 3; // For future dev
-const TInt KVibePeriodicTypeSawtooth = 4; // For future dev
-const TInt KVibePeriodicTypeInvertedSawtooth = 5; // For future dev
-
-/**
- * Timeline effect message property types
- */
-const TUint8 KVibeIvtPropertyTypeLaunchPlayback = 0xf1;
-const TUint8 KVibeIvtPropertyTypeRepeatBar = 0xf2;
-const TUint8 KVibeIvtPropertyTypeEndOfList = 0xff;
-const TUint8 KVibeIvtPropertyTypeEffectIdU8 = 0xe0;
-const TUint8 KVibeIvtPropertyTypeEffectIdU16 = 0xe1;
-const TUint8 KVibeIvtPropertyTypeTimeOffsetU16 = 0xe2;
-const TUint8 KVibeIvtPropertyTypeTimeOffsetU24 = 0xe3;
-const TUint8 KVibeIvtPropertyTypeTimeOffsetU32 = 0xe4;
-const TUint8 KVibeIvtPropertyTypeCountU8 = 0xe5;
-const TUint8 KVibeIvtPropertyTypeDurationMsU16 = 0xd0;
-const TUint8 KVibeIvtPropertyTypeMagnitudeS8 = 0xd1;
-const TUint8 KVibeIvtPropertyTypeFreqPeriodU16 = 0xd2;
-
-/**
- * Override flags
- */
-const TUint8 KVibeIvtOverrideFlagDuration = ( 1 << 0 );
-const TUint8 KVibeIvtOverrideFlagMagnitude = ( 1 << 1 );
-const TUint8 KVibeIvtOverrideFlagFreqPeriod = ( 1 << 2 );
-
-/**
- * Style mask
- */
-// #define VIBE_STYLE_MASK 0x0F
-const TInt KVibeStyleMask = 0x0f;
-
-/**
- * Wave type bit shift value and mask
- */
-const TInt KVibeWavetypeShift = 4;
-const TInt KVibeWavetypeMask = 0xf0;
-
-/**
- * Const for repeat bar stack size
- */
-const TInt KRepeatBarStackMaxSize = 4;
-
-/**
- * Couple of firmware (IVT player) specific constants
- */
-const TInt KVibeFirmwareTimeInfinite = 0xFFFF;
-const TInt KVibeMaxFirmwareMagnitude = 127;
-/**
- * General macro for extracting bits from buffer (pointed by p) with mask (m)
- * and then shifting right with given shift (s) value
- */
-#define VIBE_GET_BIT_FIELD(p,m,s) \
- ( ( *( p ) & ( m ) ) >> ( s ) )
-
-/**
- * Basis effect macros for extracting values from IVT buffer
- */
-#define VIBE_IVT_GET_MESSAGE_TYPE(p) \
- VIBE_GET_BIT_FIELD(p, 0xf0, 4)
-
-#define VIBE_IVT_GET_PERIODIC_DURATION(p) \
- ( ( ( ( VIBE_GET_BIT_FIELD( ( p ) + 1, 0xff, 0 ) ) | \
- ( VIBE_GET_BIT_FIELD( ( p ) + 2, 0x0f, 0 ) << 8 ) ) << 4 ) | \
- ( VIBE_GET_BIT_FIELD( ( p ) + 7, 0xf0, 4 ) ) )
-
-#define VIBE_IVT_GET_PERIODIC_START_DELAY(p) \
- ( VIBE_GET_BIT_FIELD( ( p ) + 2, 0xf0, 0 ) | \
- ( VIBE_GET_BIT_FIELD( ( p ) + 3, 0xff, 0 ) << 4 ) )
-
-#define VIBE_IVT_GET_PERIODIC_MAGNITUDE(p) \
- VIBE_GET_BIT_FIELD( ( p ) + 4, 0x7f, 0 )
-
-#define VIBE_IVT_GET_PERIODIC_START_FLAG(p) \
- VIBE_GET_BIT_FIELD( ( p ) + 4, 0x80, 7 )
-
-#define VIBE_IVT_GET_PERIODIC_TYPE(p) \
- VIBE_GET_BIT_FIELD( ( p ) + 5, 0x0f, 0 )
-
-#define VIBE_IVT_GET_PERIODIC_CONTROLMODE(p) \
- VIBE_GET_BIT_FIELD( ( p ) + 7, 0x0f, 0 )
-
-#define VIBE_IVT_GET_PERIODIC_FREQPER(p) \
- ( VIBE_GET_BIT_FIELD( ( p ) + 5, 0xf0, 4 ) | \
- ( VIBE_GET_BIT_FIELD( ( p ) + 6, 0xff, 0 ) << 4 ) )
-
-#define VIBE_IVT_GET_PERIODIC_MODIFIER_IMPULSE_TIME(p) \
- ( VIBE_GET_BIT_FIELD( ( p ) + 1, 0xff, 0 ) | \
- ( VIBE_GET_BIT_FIELD( (p ) + 2, 0x3f, 0 ) << 8 ) )
-
-#define VIBE_IVT_GET_PERIODIC_MODIFIER_FADE_TIME(p) \
- ( VIBE_GET_BIT_FIELD( ( p ) + 3, 0xff, 0 ) | \
- ( VIBE_GET_BIT_FIELD( ( p ) + 4, 0x3f, 0 ) << 8 ) )
-
-#define VIBE_IVT_GET_PERIODIC_MODIFIER_IMPULSE_LEVEL(p) \
- VIBE_GET_BIT_FIELD( ( p ) + 5, 0x7f, 0 )
-
-#define VIBE_IVT_GET_PERIODIC_MODIFIER_FADE_LEVEL(p) \
- VIBE_GET_BIT_FIELD( ( p ) + 6, 0x7f, 0 )
-
-/**
- * Timeline effect specific macro
- */
-#define VIBE_IVT_IS_OVERRIDE(p) \
- ( 0xd0 == ( *( p ) & 0xf0 ) )
-
-/**
- * Macros to determine effect type macros */
-#define VIBE_IVT_IS_BASIS_EFFECT(p) \
- ( 0 == ( 0x0f & *( p ) ) )
-
-#define VIBE_IVT_IS_TIMELINE_EFFECT(p) \
- ( 0xf0 == ( 0xf0 & *( p ) ) )
-
-/**
- * Structure for IVT header
- */
-struct TVibeIVTHeader
- {
- /**
- * IVT file format major version. (In current version: 0x1)
- */
- TUint8 iVersionMajor;
-
- /**
- * IVT file format major version. (In current version: 0x0)
- */
- TUint8 iVersionMinor;
-
- /**
- * Lower byte of Number of effects (within the IVT data)
- */
- TUint8 iEffects_0_7;
-
- /**
- * Upper byte of Number of effects (within the IVT data)
- */
- TUint8 iEffects_8_15;
-
- /**
- * Lower byte of effect storage block size
- */
- TUint8 iEffectStorageBlockSize_0_7;
-
- /**
- * Upper byte of effect storage block size
- */
- TUint8 iEffectStorageBlockSize_8_15;
-
- /**
- * Lower byte of effect name block size
- */
- TUint8 iEffectNameBlockSize_0_7;
-
- /**
- * Upper byte of effect name block size
- */
- TUint8 iEffectNameBlockSize_8_15;
- };
-
-/**
- * Structure for effect's envelope parameters (attack and fade params)
- */
-struct TVibeEnvelopeParams
- {
- /**
- * Magnitude at the start of the envelope
- */
- TInt iAttackLevel;
-
- /**
- * Time to reach the sustain level, in milliseconds
- */
- TInt iAttackTime;
-
- /**
- * Magnitude at the end of the envelope
- */
- TInt iFadeLevel;
-
- /**
- * Time to reach the fade level, in milliseonds
- */
- TInt iFadeTime;
- };
-
-/**
- * Stucture for Periodic effect definition.
- */
-struct TVibePeriodicEffectDefinition
- {
- /**
- * Type (bitmasked Wave Type) of the effect
- */
- TInt iType;
-
- /**
- * Magnitude of the effect
- */
- TInt iMagnitude;
-
- /**
- * Period of the effect
- */
- TInt iPeriod;
-
- /**
- * Envelope params of the effect
- */
- TVibeEnvelopeParams iEnvelope;
- };
-
-/**
- * Stucture for MagSweep effect definition.
- */
-struct TVibeMagSweepEffectDefinition
- {
- /**
- * Magnitude of the effect
- */
- TInt iMagnitude;
-
- /**
- * Envelope params of the effect
- */
- TVibeEnvelopeParams iEnvelope;
- };
-
-/**
- * Union that contains either Periodic or MagSweep effect definition
- */
-union TVibeEffectDefTypeParams
- {
- /**
- * Periodic effect definition
- */
- TVibePeriodicEffectDefinition iPeriodicEffectDefinition;
-
- /**
- * MagSweep effect definition
- */
- TVibeMagSweepEffectDefinition iMagSweepEffectDefinition;
- };
-
-/**
- * Structure for common effect parameters
- */
-struct TVibeEffectCommonParams
- {
- /**
- * Type of the effect
- */
- TInt iEffectType;
-
- /**
- * Playing duration of the effect in milliseconds
- */
- TInt iDuration;
-
- /**
- * Control mode (a.k.a. Style) of the effect
- */
- TInt iControlMode;
- };
-
-/**
- * Structure for complete effect definition
- */
-struct TVibeEffectDefinition
- {
- /**
- * Common effect parameters (a structure)
- */
- TVibeEffectCommonParams iEffectCommonParams;
-
- /**
- * Effect type specific parameters (an union)
- */
- TVibeEffectDefTypeParams iEffectTypeParams;
- };
-
-#endif /* _HWRMHAPTICSVIBEIVTINTERNAL_H */
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/inc/timelineivtgetters.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
-* 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: Timeline effect internal getters header file.
-*
-*/
-
-#ifndef TIMELINEIVTGETTERS_H
-#define TIMELINEIVTGETTERS_H
-
-
-#include "ivtinternal.h"
-
-/**
- * Utility class for getting various timeline effect specific information
- * from data buffer.
- */
-class TimelineIVTGetters
- {
-public:
- /**
- * Method for getting the effect Id from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the Id is read) and sets the pointer to next
- * position.
- *
- * @param aProp Pointer to the current position in effect data buffer
- * @param aPProp Double pointer to which new position in effect data
- * buffer is written (out param).
- *
- * @return Id of the effect (that is in current position of the effect
- * data buffer).
- */
- static TVibeIVTEffectID VibeIVTGetEffectID( const TUint8* aProp,
- const TUint8** aPProp );
-
- /**
- * Method for getting the effect time offset from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the time offset is read) and sets the pointer
- * to next position.
- *
- * @param aProp Pointer to the current position in effect data buffer
- * @param aPProp Double pointer to which new position in effect data
- * buffer is written (out param).
- *
- * @return Time offset of the effect (that is in current position of
- * the effect data buffer).
- */
- static TInt VibeIVTGetTimeOffset( const TUint8* aProp,
- const TUint8** aPProp );
-
- /**
- * Method for getting the count value from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the count is read) and sets the pointer to next
- * position.
- *
- * @param aProp Pointer to the current position in effect data buffer
- * @param aPProp Double pointer to which new position in effect data
- * buffer is written (out param).
- *
- * @return Count value (that is in current position of the effect
- * data buffer).
- */
- static TVibeIVTCount VibeIVTGetCount( const TUint8* aProp,
- const TUint8** aPProp );
-
- /**
- * Method for getting the effect duration from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the duration is read) and sets the pointer to next
- * position.
- *
- * @param aProp Pointer to the current position in effect data buffer
- * @param aPProp Double pointer to which new position in effect data
- * buffer is written (out param).
- *
- * @return Duration of the effect (that is in current position of the
- * effect data buffer).
- */
- static TVibeIVTMessageTime VibeIVTGetDuration( const TUint8* aProp,
- const TUint8** aPProp );
-
- /**
- * Method for getting the effect magnitude from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the magnitude is read) and sets the pointer to next
- * position.
- *
- * @param aProp Pointer to the current position in effect data buffer
- * @param aPProp Double pointer to which new position in effect data
- * buffer is written (out param).
- *
- * @return Magnitude of the effect (that is in current position of the
- * effect data buffer).
- */
- static TVibeIVTMagnitude VibeIVTGetMagnitude(
- const TUint8* aProp,
- const TUint8** aPProp );
-
- /**
- * Method for getting the effect frequency period from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the frequency period is read) and sets the pointer
- * to nextposition.
- *
- * @param aProp Pointer to the current position in effect data buffer.
- * @param aPProp Double pointer to which new position in effect data
- * buffer is written (out param).
- *
- * @return Frequency period of the effect (that is in current position of
- * the effect data buffer).
- */
- static TVibeIVTFreqPer VibeIVTGetFreqPer( const TUint8* aProp,
- const TUint8** aPProp );
-
- /**
- * Method for getting the event time offset from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the event offset is read).
- *
- * @param aProp Pointer to the current position in effect data buffer
- *
- * @return Time offset of the event (that is in current position of
- * the effect data buffer). Time unit depends on the given data.
- */
- static TInt VibeIVTGetEventTimeOffset( const TUint8* aProp );
-
-private:
-
- /**
- * Method for getting the override values from effect data buffer.
- * Takes pointer to the current position in effect data buffer (i.e.,
- * position from which the overrides are read) and sets the pointer
- * to next position.
- *
- * @param aProp Pointer to the current position in effect data
- * buffer.
- * @param aOverrideFlags Override flags are read into this (out) param.
- * @param aDuration Override duration is read into this (out) param.
- * @param aMagnitude Override magnitude is read into this (out) param.
- * @param aFreqPer Override frequency period is read into this (out)
- * param.
- * @param aPProp Double pointer to which new position in effect
- * data buffer is written (out param).
- *
- */
- static void VibeIVTGetOverrides( const TUint8* aProp,
- TVibeIVTOverrideFlags* aOverrideFlags,
- TVibeIVTMessageTime* aDuration,
- TVibeIVTMagnitude* aMagnitude,
- TVibeIVTFreqPer* aFreqPer,
- const TUint8** aPProp );
-
- /**
- * Method for getting the launch playback event time offset from effect
- * data buffer.
- *
- * @param aProp Pointer to the current position in effect data buffer.
- *
- * @return The time offset of the launch playback event. Time unit
- * depends on the given data.
- */
- static TInt VibeIVTGetLaunchPlaybackEventTimeOffset(
- const TUint8* aProp );
-
- /**
- * Method for getting the repeat bar event time offset from effect
- * data buffer.
- *
- * @param aProp Pointer to the current position in effect data buffer.
- *
- * @return The time offset of the repeat bar event. Time unit
- * depends on the given data.
- */
- static TInt VibeIVTGetRepeatBarEventTimeOffset( const TUint8* aProp );
- };
-
-#endif /* TIMELINEIVTGETTERS_H*/
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/rom/hwrmhapticsivtgetterplugin.iby Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* 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: IBY file for effect data getter ECom plugin.
-*
-*/
-
-#ifndef HAPTICSIVTGETTERPLUGIN_IBY
-#define HAPTICSIVTGETTERPLUGIN_IBY
-
-#include <data_caging_paths_for_iby.hrh>
-
-ECOM_PLUGIN(hwrmhapticsivtgetterplugin.dll, hwrmhapticsivtgetterplugin.rsc)
-
-#endif // HAPTICSIVTGETTERPLUGIN_IBY
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/src/basisivtgetters.cpp Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-* 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: IVT effect get functions' high level helper functions
-* (for basis effects) implementation file.
-*/
-
-#include "basisivtgetters.h"
-
-// ---------------------------------------------------------------------------
-// Gets the periodic effect data from the effect data buffer to which pointer
-// is given as argument.
-// ---------------------------------------------------------------------------
-//
-void BasisIVTGetters::VibeIVTGetPeriodic(
- const TUint8* aMsg,
- TVibeIVTMessageTime* aDuration,
- TVibeIVTMessageTime* aStartDelay,
- TVibeIVTMagnitude* aMagnitude,
- TInt* aStartFlag,
- TInt* aType,
- TVibeIVTFreqPer* aFreqPer,
- TInt* aControlMode )
- {
- if ( aMsg )
- {
- if ( aDuration )
- {
- *aDuration = VIBE_IVT_GET_PERIODIC_DURATION( aMsg );
- }
- if ( aStartDelay )
- {
- *aStartDelay = VIBE_IVT_GET_PERIODIC_START_DELAY( aMsg );
- }
- if ( aMagnitude )
- {
- *aMagnitude = VIBE_IVT_GET_PERIODIC_MAGNITUDE( aMsg );
- }
- if ( aStartFlag )
- {
- *aStartFlag = VIBE_IVT_GET_PERIODIC_START_FLAG( aMsg );
- }
- if ( aType )
- {
- *aType = VIBE_IVT_GET_PERIODIC_TYPE( aMsg );
- }
- if ( aFreqPer )
- {
- *aFreqPer = VIBE_IVT_GET_PERIODIC_FREQPER( aMsg );
- }
- if ( aControlMode )
- {
- *aControlMode = VIBE_IVT_GET_PERIODIC_CONTROLMODE( aMsg );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Gets the periodic modifier data from the effect data buffer to which
-// pointer is given as argument.
-// ---------------------------------------------------------------------------
-//
-void BasisIVTGetters::VibeIVTGetPeriodicModifier(
- const TUint8* aMsg,
- TVibeIVTMessageTime* aImpulseTime,
- TVibeIVTMessageTime* aFadeTime,
- TVibeIVTMagnitude* aImpulseLevel,
- TVibeIVTMagnitude* aFadeLevel )
- {
- if ( aMsg )
- {
- if ( aImpulseTime )
- {
- *aImpulseTime =
- VIBE_IVT_GET_PERIODIC_MODIFIER_IMPULSE_TIME( aMsg );
- }
- if ( aFadeTime )
- {
- *aFadeTime = VIBE_IVT_GET_PERIODIC_MODIFIER_FADE_TIME( aMsg );
- }
- if ( aImpulseLevel )
- {
- *aImpulseLevel =
- VIBE_IVT_GET_PERIODIC_MODIFIER_IMPULSE_LEVEL( aMsg );
- }
- if ( aFadeLevel )
- {
- *aFadeLevel = VIBE_IVT_GET_PERIODIC_MODIFIER_FADE_LEVEL( aMsg );
- }
- }
- }
-
-// end of file
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/src/hwrmhapticsivtgetter.cpp Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,560 +0,0 @@
-/*
-* 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: Plugin for reading effect information from IVT effect data.
-*
-*/
-
-#include <ecom/implementationproxy.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <hwrmhaptics.h>
-
-#include "hwrmhapticsivtgetter.h"
-#include "hwrmhapticstrace.h"
-#include "ivtinternal.h"
-#include "ivthelper.h"
-
-// ---------------------------------------------------------------------------
-// Constructor.
-// ---------------------------------------------------------------------------
-//
-CHWRMHapticsIVTGetter::CHWRMHapticsIVTGetter()
- {
- }
-
-// ---------------------------------------------------------------------------
-// 2nd phase constructor.
-// ---------------------------------------------------------------------------
-//
-void CHWRMHapticsIVTGetter::ConstructL()
- {
- }
-
-// ---------------------------------------------------------------------------
-// 2-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CHWRMHapticsIVTGetter* CHWRMHapticsIVTGetter::NewL()
- {
- CHWRMHapticsIVTGetter* self = new ( ELeave ) CHWRMHapticsIVTGetter();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CHWRMHapticsIVTGetter::~CHWRMHapticsIVTGetter()
- {
- }
-
-//---------------------------------------------------------------------------
-//
-//---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetEffectCount( const TDesC8& aData,
- TInt& aCount )
- {
- TInt status( KErrArgument );
- if ( IVTHelper::IsValidIVTAddress( aData.Ptr() ) )
- {
- aCount = IVTHelper::GetNumEffects( aData.Ptr() );
- status = KErrNone;
- }
- return status;
- }
-
-//---------------------------------------------------------------------------
-//
-//---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetEffectName( const TDesC8& aData,
- TInt aEffectIndex,
- TDes8& aEffectName )
- {
- TUint8* effectNameData( 0 );
- char effectNameTemp[KVibeMaxEffectNameLength];
- memset( effectNameTemp, 0,
- KVibeMaxEffectNameLength * sizeof( char ) );
- TInt status( KErrNone );
-
- if ( IVTHelper::IsValidIVTAddress( aData.Ptr() ) &&
- 0 <= aEffectIndex &&
- aEffectIndex < IVTHelper::GetNumEffects( aData.Ptr() ) )
- {
- effectNameData = IVTHelper::GetEffectNameData( aData.Ptr(), aEffectIndex );
- if ( effectNameData )
- {
- // Convert the name from wchar (VibeWChar) into the
- // temporary char format buffer first
- TInt stringSize =
- wcstombs( effectNameTemp,
- reinterpret_cast<const wchar_t*>( effectNameData ),
- KVibeMaxEffectNameLength );
- if ( aData.Size() < stringSize )
- {
- status = KErrArgument;
- }
- else
- {
- aEffectName.Copy( reinterpret_cast<TUint8*>( effectNameTemp ),
- stringSize );
- }
- }
- else
- {
- // IVT data doesn't contain effect name block
- // so return empty string
- aEffectName.Copy( KNullDesC );
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTEffectName: invalid args.") );
- status = KErrArgument;
- }
- return status;
- }
-
-//---------------------------------------------------------------------------
-//
-//---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetEffectIndexFromName( const TDesC8& aData,
- const TDesC8& aEffectName,
- TInt& aEffectIndex )
- {
- TInt i( 0 );
- TInt numEffects( 0 );
- TInt status( KErrGeneral );
-
- if ( IVTHelper::IsValidIVTAddress( aData.Ptr() ) )
- {
- HBufC8* temp = HBufC8::New( aEffectName.Size() + 1 );
- if ( temp )
- {
- TPtr8 effectName = temp->Des();
- effectName.Copy( aEffectName );
- effectName.ZeroTerminate();
-
- aEffectIndex = KVibeInvalidIndex;
- numEffects = IVTHelper::GetNumEffects( aData.Ptr() );
- for (i = 0; i < numEffects; i++)
- {
- TUint8 *effectNameData = IVTHelper::GetEffectNameData( aData.Ptr(), i );
- if ( effectNameData )
- {
- // Convert the name from wchar (VibeWChar) into char format
- char effectNameFromIVT[KVibeMaxEffectNameLength];
- memset( effectNameFromIVT, 0,
- KVibeMaxEffectNameLength * sizeof( char ) );
- wcstombs( effectNameFromIVT,
- reinterpret_cast<const wchar_t*>( effectNameData ),
- KVibeMaxEffectNameLength );
-
- if ( !strcmp( reinterpret_cast<const char*>
- ( effectName.Ptr() ), effectNameFromIVT ) )
- {
- // Match found, break from the for loop
- aEffectIndex = i;
- i = numEffects;
- status = KErrNone;
- }
- }
- }
- delete temp;
- temp = NULL;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTEffectIndexFromName: invalid args.") );
- status = KErrArgument;
- }
- return status;
- }
-
-//---------------------------------------------------------------------------
-//
-//---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetEffectType( const TDesC8& aData,
- TInt aEffectIndex,
- TInt& aEffectType )
- {
- TUint8 *effectPtr( 0 );
- TInt status( KErrNone );
-
- if ( IVTHelper::IsValidIVTAddress( aData.Ptr() ) &&
- 0 <= aEffectIndex &&
- aEffectIndex < IVTHelper::GetNumEffects( aData.Ptr() ) )
- {
- aEffectType = 0;
- effectPtr = IVTHelper::GetEffectStorage( aData.Ptr(), aEffectIndex );
- if ( effectPtr )
- {
- // Skip over periodic modifier, if any
- if ( KVibeMessageTypeSetPeriodicModifier ==
- VIBE_IVT_GET_MESSAGE_TYPE( effectPtr ) )
- {
- effectPtr += KVibeIvtMessageSize;
- }
- if ( KVibeMessageTypeSetPeriodic ==
- VIBE_IVT_GET_MESSAGE_TYPE( effectPtr ) )
- {
- // It is either MagSweep or Periodic effect
- aEffectType = KVibePeriodicTypeConstant ==
- VIBE_IVT_GET_PERIODIC_TYPE( effectPtr ) ?
- CHWRMHaptics::EHWRMHapticsTypeMagSweep :
- CHWRMHaptics::EHWRMHapticsTypePeriodic;
- }
- else
- {
- // It has to be timeline effect
- aEffectType = CHWRMHaptics::EHWRMHapticsTypeTimeline;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTEffectType: GetEffectStorage failed.") );
- status = KErrGeneral;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTEffectType: invalid args.") );
- status = KErrArgument;
- }
-
- return status;
- }
-
-//---------------------------------------------------------------------------
-//
-//---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetMagSweepEffectDefinition(
- const TDesC8& aData,
- TInt aEffectIndex,
- CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect )
- {
- TVibeEffectDefinition effectDefinition;
- TInt effectType( 0 );
- TInt status ( KErrNone );
-
- memset( &effectDefinition, 0, sizeof( effectDefinition ) );
-
- // Validity of aEffectIndex is already done in ImmVibeGetIVTEffectType
- // For params NULL values just mean "not to be returned"
- if ( IVTHelper::IsValidIVTAddress( aData.Ptr() ) )
- {
- status = GetEffectType( aData, aEffectIndex, effectType );
- if ( KErrNone == status )
- {
- if ( CHWRMHaptics::EHWRMHapticsTypeMagSweep == effectType )
- {
- status =
- GetEffectByIndex( aData,
- aEffectIndex,
- &effectDefinition );
- if ( KErrNone == status )
- {
- aEffect.iDuration =
- effectDefinition.iEffectCommonParams.iDuration;
-
- aEffect.iMagnitude =
- effectDefinition.iEffectTypeParams.
- iMagSweepEffectDefinition.iMagnitude;
-
- aEffect.iStyle =
- effectDefinition.iEffectCommonParams.iControlMode;
-
- aEffect.iAttackTime =
- effectDefinition.iEffectTypeParams.
- iMagSweepEffectDefinition.iEnvelope.
- iAttackTime;
-
- aEffect.iAttackLevel =
- effectDefinition.iEffectTypeParams.
- iMagSweepEffectDefinition.iEnvelope.
- iAttackLevel;
-
- aEffect.iFadeTime =
- effectDefinition.iEffectTypeParams.
- iMagSweepEffectDefinition.iEnvelope.iFadeTime;
-
- aEffect.iFadeLevel =
- effectDefinition.iEffectTypeParams.
- iMagSweepEffectDefinition.iEnvelope.
- iFadeLevel;
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTMagSweepEffectDefinition: VibeAPIInternalGetIVTEffectByIndex failed.") );
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTMagSweepEffectDefinition: EffectType invalid.") );
- status = KErrNotSupported;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTMagSweepEffectDefinition: ImmVibeGetIVTEffectType failed.") );
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTMagSweepEffectDefinition: invalid data buffer.") );
- status = KErrArgument;
- }
- return status;
- }
-
-//---------------------------------------------------------------------------
-//
-//---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetPeriodicEffectDefinition(
- const TDesC8& aData,
- TInt aEffectIndex,
- CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect )
- {
- TVibeEffectDefinition effectDefinition;
- TInt effectType( 0 );
- TInt status( KErrNone );
-
- memset( &effectDefinition, 0, sizeof( effectDefinition ) );
-
- // Validity of aEffectIndex is already done in ImmVibeGetIVTEffectType
- // For params NULL values just mean "not to be returned"
- if ( IVTHelper::IsValidIVTAddress( aData.Ptr() ) )
- {
- status = GetEffectType( aData, aEffectIndex, effectType );
- if ( KErrNone == status )
- {
- if ( CHWRMHaptics::EHWRMHapticsTypePeriodic == effectType )
- {
- status =
- GetEffectByIndex( aData,
- aEffectIndex,
- &effectDefinition );
- if ( KErrNone == status )
- {
- aEffect.iDuration =
- effectDefinition.iEffectCommonParams.iDuration;
-
- aEffect.iMagnitude =
- effectDefinition.iEffectTypeParams.
- iPeriodicEffectDefinition.iMagnitude;
-
- aEffect.iPeriod =
- effectDefinition.iEffectTypeParams.
- iPeriodicEffectDefinition.iPeriod;
-
- aEffect.iStyle =
- (effectDefinition.iEffectCommonParams.iControlMode
- & KVibeStyleMask) |
- ( ( effectDefinition.iEffectTypeParams.
- iPeriodicEffectDefinition.iType
- << KVibeWavetypeShift ) & KVibeWavetypeMask );
-
- aEffect.iAttackTime =
- effectDefinition.iEffectTypeParams.
- iPeriodicEffectDefinition.iEnvelope.
- iAttackTime;
-
- aEffect.iAttackLevel =
- effectDefinition.iEffectTypeParams.
- iPeriodicEffectDefinition.iEnvelope.
- iAttackLevel;
-
- aEffect.iFadeTime =
- effectDefinition.iEffectTypeParams.
- iPeriodicEffectDefinition.iEnvelope.iFadeTime;
-
- aEffect.iFadeLevel =
- effectDefinition.iEffectTypeParams.
- iPeriodicEffectDefinition.iEnvelope.
- iFadeLevel;
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTPeriodicEffectDefinition: VibeAPIInternalGetIVTEffectByIndex failed.") );
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTPeriodicEffectDefinition: EffectType invalid.") );
- status = KErrNotSupported;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTPeriodicEffectDefinition: ImmVibeGetIVTEffectType failed.") );
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTPeriodicEffectDefinition: pIVT invalid.") );
- status = KErrArgument;
- }
- return status;
- }
-
-//---------------------------------------------------------------------------
-//
-//---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetEffectDuration( const TDesC8& aData,
- TInt aEffectIndex,
- TInt& aEffectDuration )
- {
- TInt status( KErrNone );
-
- if ( IVTHelper::IsValidIVTAddress( aData.Ptr() ) &&
- 0 <= aEffectIndex &&
- aEffectIndex < IVTHelper::GetNumEffects( aData.Ptr() ) )
- {
- aEffectDuration = 0;
- TInt effectCount =
- IVTHelper::GetIVTEffectDuration( aData.Ptr(), aEffectIndex );
- if ( effectCount < 0 )
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTEffectDuration failed.") );
- aEffectDuration = 0;
- status = effectCount;
- }
- else
- {
- // On success, GetIVTEffectDuration returns the duration
- aEffectDuration = effectCount;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("ImmVibeGetIVTEffectDuration: invalid args.") );
- status = KErrArgument;
- }
-
- return status;
- }
-
-
-// ---------------------------------------------------------------------------
-// Internal helper method for getting effect definition by its index
-// from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsIVTGetter::GetEffectByIndex(
- const TDesC8& aData,
- TInt aEffectIndex,
- TVibeEffectDefinition* aEffectDefinition )
- {
- TInt periodicType;
- TUint8* effectPtr;
- TVibeEnvelopeParams envelope;
- TInt status( KErrNone );
-
- memset( &envelope, 0, sizeof( envelope ) );
-
- if ( aEffectDefinition && IVTHelper::IsValidIVTAddress( aData.Ptr() ) &&
- 0 <= aEffectIndex &&
- aEffectIndex < IVTHelper::GetNumEffects( aData.Ptr() ) )
- {
- memset( reinterpret_cast<void*>( aEffectDefinition ),
- 0,
- sizeof( TVibeEffectDefinition ) );
- effectPtr = IVTHelper::GetEffectStorage( aData.Ptr(), aEffectIndex );
- if ( effectPtr )
- {
- // Get IVT basis effect envelope
- if ( KVibeMessageTypeSetPeriodicModifier ==
- VIBE_IVT_GET_MESSAGE_TYPE( effectPtr ) )
- {
- IVTHelper::ExtractEnvelopeFromPacket( effectPtr, &envelope );
- effectPtr += KVibeIvtMessageSize;
- }
- if ( KVibeMessageTypeSetPeriodic ==
- VIBE_IVT_GET_MESSAGE_TYPE( effectPtr ) )
- {
- // Get IVT basis effect definition excluding envelope
- IVTHelper::ExtractEffectDefinitionFromPacket(
- effectPtr,
- aEffectDefinition,
- &periodicType );
- if ( KVibePeriodicTypeConstant == periodicType )
- {
- memcpy( &( aEffectDefinition->iEffectTypeParams.
- iMagSweepEffectDefinition.iEnvelope ),
- &envelope, sizeof( envelope ) );
- }
- else
- {
- memcpy( &( aEffectDefinition->iEffectTypeParams.
- iPeriodicEffectDefinition.iEnvelope ),
- &envelope, sizeof( envelope ) );
-
- }
- }
- else
- {
- COMPONENT_TRACE( _L("VibeAPIInternalGetIVTEffectByIndex: Invalid vibe message type.") );
- status = KErrGeneral;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("VibeAPIInternalGetIVTEffectByIndex: GetEffectStorage failed.") );
- status = KErrGeneral;
- }
- }
- else
- {
- COMPONENT_TRACE( _L("VibeAPIInternalGetIVTEffectByIndex: invalid arguments.") );
- status = KErrArgument;
- }
-
- return status;
- }
-
-
-
-//---------------------------------------------------------------------------
-// ImplementationTable[]
-//
-//---------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( 0x20021203, CHWRMHapticsIVTGetter::NewL )
- };
-
-//---------------------------------------------------------------------------
-// TImplementationProxy* ImplementationGroupProxy()
-//
-//---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
- {
- aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
- return ImplementationTable;
- }
-
-// End of file
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/src/ivthelper.cpp Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,774 +0,0 @@
-/*
-* 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: IVT effect get functions' high level helper functions
-* implementation file.
-*/
-
-#include <string.h>
-#include <hwrmhaptics.h>
-
-#include "ivtinternal.h"
-#include "ivthelper.h"
-#include "timelineivtgetters.h"
-#include "basisivtgetters.h"
-
-// ---------------------------------------------------------------------------
-// Checks the validity of IVT header. I.e., basic sanity check.
-// ---------------------------------------------------------------------------
-//
-TBool IVTHelper::IsValidIVTAddress( const TUint8* aIVT )
- {
- TBool validity( EFalse );
- // For now, all IVT have the following version number:
- // major version number = 1,
- // minor version number = 0
- if ( aIVT &&
- 1 == GetIVTHeader( aIVT )->iVersionMajor &&
- 0 == GetIVTHeader( aIVT )->iVersionMinor )
- {
- if ( IsEmpty ( aIVT ) )
- {
- // IVT containing zero effects is considered valid.
- validity = ETrue;
- }
- else
- {
- // For Non empty IVT, StorageDataSubBlock must start with
- // basic effect or timeline definition.
- if ( VIBE_IVT_IS_BASIS_EFFECT(
- GetStorageDataSubBlock( aIVT ) ) ||
- VIBE_IVT_IS_TIMELINE_EFFECT(
- GetStorageDataSubBlock( aIVT ) ) )
- {
- validity = ETrue;
- }
- }
- }
- return validity;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the number of contained effect definitions from the effect data buffer.
-// For empty data buffer returns 0.
-// ---------------------------------------------------------------------------
-//
-TUint16 IVTHelper::GetNumEffects( const TUint8* aIVT )
- {
- return aIVT ?
- GetIVTHeader( aIVT )->iEffects_0_7 +
- ( GetIVTHeader( aIVT )->iEffects_8_15 << 8 ) : 0;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the effect storage of the given effect (as indicated by index
-// argument) from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetEffectStorage( const TUint8* aIVT, TInt aEffectIndex )
- {
- // First get the storage data subblock pointer, and then advance that
- // according to correct effect's storage offset.
- // The offset is stored in two bytes (corresponding to the index of the
- // effect) of the storage offset subblock data area.
- return ( IsEmpty( aIVT ) || aEffectIndex >= GetNumEffects( aIVT ) ) ? 0 :
- GetStorageDataSubBlock( aIVT )
- + GetStorageOffsetSubBlock( aIVT )[2 * aEffectIndex]
- + ( GetStorageOffsetSubBlock( aIVT )[2 * aEffectIndex + 1] << 8 );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the the envelope params (attack and fade params) from the effect data.
-// The effect data pointer must point to a specific effect data, not the
-// whole effect data buffer as in above functions.
-// ---------------------------------------------------------------------------
-//
-TBool IVTHelper::ExtractEnvelopeFromPacket( const TUint8* aPacket,
- TVibeEnvelopeParams* aEnvelope )
- {
- TBool status( ETrue );
- if ( aPacket && aEnvelope )
- {
- TVibeIVTMessageTime attackTime( 0 );
- TVibeIVTMessageTime fadeTime( 0 );
- TVibeIVTMagnitude attackLevel( 0 );
- TVibeIVTMagnitude fadeLevel( 0 );
-
- BasisIVTGetters::VibeIVTGetPeriodicModifier( aPacket,
- &attackTime,
- &fadeTime,
- &attackLevel,
- &fadeLevel );
-
- aEnvelope->iAttackTime = attackTime;
- aEnvelope->iFadeTime = fadeTime;
- aEnvelope->iAttackLevel = ConvertToUserMagnitude( attackLevel );
- aEnvelope->iFadeLevel = ConvertToUserMagnitude( fadeLevel );
- }
- else
- {
- status = EFalse;
- }
- return status;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the the effect definition from the effect data.
-// The effect data pointer must point to a specific effect data, not the
-// whole effect data buffer as in above functions.
-// ---------------------------------------------------------------------------
-//
-TBool IVTHelper::ExtractEffectDefinitionFromPacket(
- const TUint8* aPacket,
- TVibeEffectDefinition* aEffectDefinition,
- TInt* aPeriodicType )
- {
- TBool status( ETrue );
- if ( aPacket && aEffectDefinition && aPeriodicType )
- {
- TVibeIVTMessageTime duration( 0 );
- TVibeIVTMessageTime startDelay( 0 );
- TVibeIVTMagnitude magnitude( 0 );
- TInt type( 0 );
- TVibeIVTFreqPer freqPer( 0 );
- TInt controlMode( 0 );
-
- BasisIVTGetters::VibeIVTGetPeriodic( aPacket,
- &duration,
- &startDelay,
- &magnitude,
- 0,
- &type,
- &freqPer,
- &controlMode );
-
- *aPeriodicType = VIBE_IVT_GET_PERIODIC_TYPE( aPacket );
-
- if ( KVibePeriodicTypeSquare == *aPeriodicType )
- {
- // Fill the Periodic specific definition data
- aEffectDefinition->iEffectCommonParams.iEffectType =
- CHWRMHaptics::EHWRMHapticsTypePeriodic;
- aEffectDefinition->iEffectCommonParams.iDuration =
- ConvertToUserDuration( duration );
- aEffectDefinition->iEffectCommonParams.iControlMode =
- controlMode;
- aEffectDefinition->iEffectTypeParams.
- iPeriodicEffectDefinition.iType = type;
- aEffectDefinition->iEffectTypeParams.
- iPeriodicEffectDefinition.iPeriod =
- ConvertToUserFrequency( freqPer );
- aEffectDefinition->iEffectTypeParams.
- iPeriodicEffectDefinition.iMagnitude =
- ConvertToUserMagnitude( magnitude );
- }
- else if ( KVibePeriodicTypeConstant == *aPeriodicType )
- {
- // Fill the MagSweep specific definition data
- aEffectDefinition->iEffectCommonParams.iEffectType =
- CHWRMHaptics::EHWRMHapticsTypeMagSweep;
- aEffectDefinition->iEffectCommonParams.iDuration =
- ConvertToUserDuration( duration );
- aEffectDefinition->iEffectCommonParams.iControlMode =
- controlMode;
- aEffectDefinition->iEffectTypeParams.
- iMagSweepEffectDefinition.iMagnitude =
- ConvertToUserMagnitude( magnitude );
- }
- else
- {
- status = EFalse;
- }
- }
- else
- {
- status = EFalse;
- }
- return status;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the effect name data of the given effect (as indicated by index
-// argument) from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetEffectNameData( const TUint8* aIVT, TInt aEffectIndex )
- {
- // First get the name data subblock pointer, and then advance that
- // according to effect's name offset.
- // The offset is stored in two bytes (corresponding to the index of the
- // effect) of the name offset subblock data area.
- return HasNameBlock( aIVT ) ?
- ( GetNameDataSubBlock( aIVT )
- + GetNameOffsetSubBlock( aIVT )[2 * aEffectIndex]
- + ( GetNameOffsetSubBlock( aIVT )[2 * aEffectIndex + 1] << 8 ) ) :
- 0;
- }
-
-// ---------------------------------------------------------------------------
-// GetIVTEffectDuration()
-//
-// IVT effect duration computation:
-// - For Basis effect: this function extracts duration from the BasicEffect
-// definition
-// - For Timeline effects, this function loops trough all the timeline events
-// and compute each basic effects's end time and keep the biggest value of
-// them.
-//
-// The formula:
-// BasicEffect's End time = ZeroOffsetTime + EventOffsetTime +
-// EffectDuration (Effect definition's duration or override duration)
-//
-// Every time the end of repeat event is reached, "ZeroOffsetTime" is always
-// adjusted (ZeroOffsetTime = ZeroOffsetTime + Repeat duration) and this ´
-// function goes back to the next event following the current repeat event.
-//
-// Return values:
-// -negative values: errors
-// -Positive values: duration
-// ---------------------------------------------------------------------------
-//
-TInt IVTHelper::GetIVTEffectDuration( const TUint8* aIVT, TInt aEffectIndex )
- {
- TInt status( KErrNone );
- TInt duration( 0 );
-
- if ( aIVT && 0 <= aEffectIndex && aEffectIndex < GetNumEffects( aIVT ) )
- {
- TUint8* effectPtr( 0 );
- TVibeTimeLineInfo timelineInfo;
- memset( &timelineInfo, 0, sizeof( timelineInfo ) );
-
- timelineInfo.iOffsetSubBlock =
- reinterpret_cast<TUint8*>( GetIVTHeader( aIVT ) + 1 );
- timelineInfo.iDataSubBlock =
- timelineInfo.iOffsetSubBlock
- + 2*( GetIVTHeader( aIVT )->iEffects_0_7
- + ( GetIVTHeader( aIVT )->iEffects_8_15 << 8 ) );
- effectPtr =
- timelineInfo.iDataSubBlock
- + timelineInfo.iOffsetSubBlock[2*aEffectIndex]
- + ( timelineInfo.iOffsetSubBlock[2*aEffectIndex+1] << 8 );
-
- // Effect type specific handling
- if ( VIBE_IVT_IS_BASIS_EFFECT( effectPtr ) )
- {
- // Basis effect
- // Skip any messages preceding the SetPeriodic message
- while ( KVibeMessageTypeSetPeriodic !=
- VIBE_IVT_GET_MESSAGE_TYPE( effectPtr ) )
- {
- effectPtr += KVibeIvtMessageSize;
- }
- duration = ConvertToUserDuration(
- VIBE_IVT_GET_PERIODIC_DURATION( effectPtr ) );
- }
- else if ( VIBE_IVT_IS_TIMELINE_EFFECT( effectPtr ) )
- {
- // Timeline effect
- timelineInfo.iNextEvent = effectPtr;
- timelineInfo.iTimeRepeat = KVibeTimeInfinite;
- timelineInfo.iRepeatBarStackTop = -1;
-
- // Process the timeline effect
- // The looping stops either:
- // - due to processing error (e.g. invalid effect data)
- // - when it has been determined that effect is 'infinite'
- // - when the whole effect has been processed
- do
- {
- // Process next event or next closing of repeat bar,
- // whichever comes first, provided that its time is up
- if ( timelineInfo.iTimeEvent < timelineInfo.iTimeRepeat )
- {
- status = TimelineDurationProcessEvent( &timelineInfo );
- }
- else
- {
- status =
- TimelineDurationProcessRepeatInStack( &timelineInfo );
- }
-
- // Only continue loop if the above succeeded and didn't result
- // in infinite all effects end value
- if ( KErrNone == status &&
- KVibeTimeInfinite != timelineInfo.iTimeAllEffectsEnd )
- {
-
- // Check whether there are more events
- if ( timelineInfo.iNextEvent )
- {
- // Update times for the next event handling round
- timelineInfo.iTimeEvent =
- TimelineIVTGetters::VibeIVTGetEventTimeOffset(
- timelineInfo.iNextEvent );
- }
- else
- {
- timelineInfo.iTimeEvent = KVibeTimeInfinite;
- }
-
- // Check whether there are more repeat bars in stack
- if ( 0 <= timelineInfo.iRepeatBarStackTop )
- {
- // Update repeat time value for next repeat bar
- // handling round
- timelineInfo.iTimeRepeat =
- timelineInfo.iRepeatBarStack
- [timelineInfo.iRepeatBarStackTop].iTimeOffsetEnd;
- }
- else
- {
- timelineInfo.iTimeRepeat = KVibeTimeInfinite;
- }
- }
- } while( KErrNone == status &&
- KVibeTimeInfinite != timelineInfo.iTimeAllEffectsEnd &&
- ! ( KVibeTimeInfinite == timelineInfo.iTimeEvent &&
- KVibeTimeInfinite == timelineInfo.iTimeRepeat ) );
-
- duration = timelineInfo.iTimeAllEffectsEnd;
- }
- else
- {
- // Invalid effect type
- status = KErrGeneral;
- }
- }
- else
- {
- status = KErrGeneral;
- }
- // return either duration or error status
- return KErrNone == status ? duration : status;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the TVibeIVTHeader from the effect data buffer. Basically just a cast
-// ---------------------------------------------------------------------------
-//
-TVibeIVTHeader* IVTHelper::GetIVTHeader( const TUint8* aIVT )
- {
- return reinterpret_cast<TVibeIVTHeader*>( const_cast<TUint8*>( aIVT ) );
- }
-
-// ---------------------------------------------------------------------------
-// Returns ETrue if data buffer is either empty or contains zero effects.
-// ---------------------------------------------------------------------------
-//
-TBool IVTHelper::IsEmpty( const TUint8* aIVT )
- {
- // If aIVT is NULL, the GetNumEffects returns 0, i.e., no need
- // to check for NULL here.
- return 0 == GetNumEffects( aIVT ) ? ETrue : EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the effect storage block size from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint16 IVTHelper::GetStorageBlockSize( const TUint8* aIVT )
- {
- return IsEmpty( aIVT ) ? 0 :
- GetIVTHeader( aIVT )->iEffectStorageBlockSize_0_7 +
- ( GetIVTHeader( aIVT )->iEffectStorageBlockSize_8_15 << 8 );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the effect storage block size from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint16 IVTHelper::GetNameBlockSize( const TUint8* aIVT )
- {
- return IsEmpty( aIVT ) ? 0 :
- GetIVTHeader( aIVT )->iEffectNameBlockSize_0_7 +
- ( GetIVTHeader( aIVT )->iEffectNameBlockSize_8_15 << 8 );
- }
-
-// ---------------------------------------------------------------------------
-// Returns ETrue if data buffer contains name block.
-// ---------------------------------------------------------------------------
-//
-TBool IVTHelper::HasNameBlock( const TUint8* aIVT )
- {
- return 0 != GetNameBlockSize( aIVT ) ? ETrue : EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the storage block from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetStorageBlock( const TUint8* aIVT )
- {
- // Storage block starts after the IVT header
- return IsEmpty( aIVT ) ? 0 :
- reinterpret_cast<TUint8*>( GetIVTHeader( aIVT ) + 1 );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the storage offset subblock from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetStorageOffsetSubBlock( const TUint8* aIVT )
- {
- // The storage offset subblock is in the beginning of the storage block
- return GetStorageBlock( aIVT );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the storage data subblock from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetStorageDataSubBlock( const TUint8* aIVT )
- {
- // First get the storage offset subblock start point and then advance
- // over the offsets (there are 2 bytes of offset value per effect)
- return IsEmpty( aIVT ) ? 0 :
- GetStorageOffsetSubBlock( aIVT ) + 2* GetNumEffects( aIVT );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the name block from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetNameBlock( const TUint8* aIVT )
- {
- // Name block starts right after the storage block
- return IsEmpty( aIVT ) ? 0 :
- GetStorageBlock( aIVT ) + GetStorageBlockSize( aIVT );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the name offset subblock from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetNameOffsetSubBlock( const TUint8* aIVT )
- {
- // Name offset subblock is in the beginning of the name block
- return GetNameBlock( aIVT );
- }
-
-// ---------------------------------------------------------------------------
-// Gets the name data subblock from the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint8* IVTHelper::GetNameDataSubBlock( const TUint8* aIVT )
- {
- // First get the name offset subblock start point and then advance
- // over the offsets (there are 2 bytes of offset value per effect)
- return IsEmpty( aIVT ) ? 0 :
- GetNameOffsetSubBlock( aIVT ) + 2 * GetNumEffects( aIVT );
- }
-
-
-// ---------------------------------------------------------------------------
-// Calculates the size of the effect data buffer.
-// ---------------------------------------------------------------------------
-//
-TUint IVTHelper::GetIVTSize( const TUint8* aIVT)
- {
- TUint size( 0 );
- if ( aIVT )
- {
- size = sizeof( TVibeIVTHeader )
- + GetIVTHeader( aIVT )->iEffectNameBlockSize_0_7
- + ( GetIVTHeader( aIVT )->iEffectNameBlockSize_8_15 << 8 )
- + GetIVTHeader( aIVT )->iEffectStorageBlockSize_0_7
- + ( GetIVTHeader( aIVT )->iEffectStorageBlockSize_8_15 << 8 );
- }
- return size;
- }
-
-// ---------------------------------------------------------------------------
-// Converts magnitude from firmware to user interface representation
-// ---------------------------------------------------------------------------
-//
-TInt IVTHelper::ConvertToUserMagnitude( TInt aFwMagnitude )
- {
- return ( aFwMagnitude * KHWRMHapticsMaxMagnitude ) / KVibeMaxFirmwareMagnitude;
- };
-
-// ---------------------------------------------------------------------------
-// Converts duration from firmware to user interface representation
-// ---------------------------------------------------------------------------
-//
-TInt IVTHelper::ConvertToUserDuration( TVibeIVTMessageTime aFwDuration )
- {
- return KVibeFirmwareTimeInfinite == aFwDuration ? KVibeTimeInfinite :
- static_cast<TInt>( aFwDuration );
- };
-
-// ---------------------------------------------------------------------------
-// Converts frequency from firmware to user interface representation
-// ---------------------------------------------------------------------------
-//
-TInt IVTHelper::ConvertToUserFrequency( TVibeIVTFreqPer aFwFrequency )
- {
- // map received value to a value between 100 and 1000000
- TInt tmpFreq = aFwFrequency >= 2900 ?
- 1000000 :
- aFwFrequency >= 2000 ?
- static_cast<TInt>( ( aFwFrequency - 1900 ) * 1000 ) :
- aFwFrequency >= 1000 ?
- static_cast<TInt>( ( aFwFrequency - 900 ) * 100 ) :
- aFwFrequency > 0 ?
- static_cast<TInt>( ( aFwFrequency + 10 ) * 10 ) :
- 100;
-
- return 1000000 / tmpFreq ;
- };
-
-// ---------------------------------------------------------------------------
-// Helper function to process timeline events (substructures within timeline
-// effects).
-// Used by GetIVTEffectDuration in case it is called for timeline effect.
-// ---------------------------------------------------------------------------
-//
-TInt IVTHelper::TimelineDurationProcessEvent( TVibeTimeLineInfo* aTimelineInfo )
- {
- TInt status( KErrNone );
-
- if ( aTimelineInfo && aTimelineInfo->iNextEvent )
- {
- // pointer for propagating through the timeline info
- const TUint8* propPtr = aTimelineInfo->iNextEvent;
-
- // event specific handling
- switch ( *propPtr )
- {
- case KVibeIvtPropertyTypeLaunchPlayback:
- // Process launch playback event
- {
- TVibeIVTMessageTime timeLaunchEventDuration( 0 );
- TBool overrides( EFalse );
- TInt effectID = TimelineIVTGetters::VibeIVTGetEffectID(
- propPtr + 1, &propPtr );
- TInt timeOffset = TimelineIVTGetters::VibeIVTGetTimeOffset(
- propPtr, &propPtr );
-
- // loop through overrides and save override duration if found
- while ( VIBE_IVT_IS_OVERRIDE( propPtr ) )
- {
- // override-type specific handling
- switch ( *propPtr )
- {
- case KVibeIvtPropertyTypeDurationMsU16:
- {
- overrides = ETrue;
- timeLaunchEventDuration =
- TimelineIVTGetters::VibeIVTGetDuration(
- propPtr, &propPtr );
- if ( KVibeFirmwareTimeInfinite ==
- timeLaunchEventDuration )
- {
- aTimelineInfo->iTimeAllEffectsEnd =
- KVibeTimeInfinite;
- }
- break;
- }
- case KVibeIvtPropertyTypeMagnitudeS8:
- {
- // skip this, following updates propPtr correctly
- TimelineIVTGetters::VibeIVTGetMagnitude(
- propPtr, &propPtr );
- break;
- }
- case KVibeIvtPropertyTypeFreqPeriodU16:
- {
- // skip this, following updates propPtr correctly
- TimelineIVTGetters::VibeIVTGetFreqPer(
- propPtr, &propPtr );
- break;
- }
- }
- } // override looping
-
- // We only need to continue if there was no override
- // for duration
- if ( !overrides )
- {
- // No override for duration. Get the basis effect
- // duration instead.
- // First, get a pointer to the beginning of the effect
- // definition of the corresponding effect.
- TUint8* timelineBasisEffect =
- aTimelineInfo->iDataSubBlock
- + aTimelineInfo->iOffsetSubBlock[2*effectID]
- + ( aTimelineInfo->iOffsetSubBlock[2*effectID+1]
- << 8 );
-
- // Skip any (possible) preceding messages before the
- // SetPeriodic message
- while ( KVibeMessageTypeSetPeriodic !=
- VIBE_IVT_GET_MESSAGE_TYPE( timelineBasisEffect ) )
- {
- timelineBasisEffect += KVibeIvtMessageSize;
- }
-
- timeLaunchEventDuration =
- VIBE_IVT_GET_PERIODIC_DURATION( timelineBasisEffect );
-
- if ( KVibeFirmwareTimeInfinite ==
- timeLaunchEventDuration )
- {
- // Set the all effects end to infinite value
- aTimelineInfo->iTimeAllEffectsEnd = KVibeTimeInfinite;
- }
- }
-
- if ( KVibeTimeInfinite != aTimelineInfo->iTimeAllEffectsEnd )
- {
- // If the all effects end value is not 'infinite',
- // we need to set that value to current effects end
- // value (but only if its later than the current all
- // effects end value)
- TInt timeEffectEnd =
- aTimelineInfo->iTimeOffsetZero
- + ConvertToUserDuration( timeLaunchEventDuration )
- + timeOffset;
- if ( timeEffectEnd > aTimelineInfo->iTimeAllEffectsEnd )
- {
- aTimelineInfo->iTimeAllEffectsEnd = timeEffectEnd;
- }
-
- // also update the iNextEvent pointer (note this too has
- // only meaning if the all effects end value is not
- // 'infinite'
- aTimelineInfo->iNextEvent = propPtr;
- }
- break;
- }
- case KVibeIvtPropertyTypeRepeatBar:
- {
- // Process repeat playback event
- TInt timeOffsetStart =
- TimelineIVTGetters::VibeIVTGetTimeOffset(
- propPtr + 1, &propPtr );
- TInt timeOffsetEnd =
- TimelineIVTGetters::VibeIVTGetTimeOffset( propPtr, &propPtr );
- TInt count =
- TimelineIVTGetters::VibeIVTGetCount( propPtr, &propPtr );
-
- if ( KVibeRepeatCountInfinite == count )
- {
- aTimelineInfo->iTimeAllEffectsEnd = KVibeTimeInfinite;
- }
- else if ( KRepeatBarStackMaxSize >
- aTimelineInfo->iRepeatBarStackTop + 1 )
- {
- // Push repeat bar to repeat bar stack
- ++aTimelineInfo->iRepeatBarStackTop;
- TVibeRepeatBar& tmp =
- aTimelineInfo->iRepeatBarStack
- [aTimelineInfo->iRepeatBarStackTop];
- tmp.iTimeOffsetEnd = timeOffsetEnd;
- tmp.iTimeDuration = timeOffsetEnd - timeOffsetStart;
- tmp.iCount = count;
- tmp.iEvent = propPtr; // First event following this repeat
- // event, could be outside the
- // repeat bar
-
- // update the iNextEvent pointer
- aTimelineInfo->iNextEvent = propPtr;
- }
- else
- {
- // More than KHpeRepeatBarStackNum repeat bars in
- // the timeline. Bail out.
- status = KErrGeneral;
- }
- break;
- }
- case KVibeIvtPropertyTypeEndOfList:
- {
- // End of event list
- aTimelineInfo->iNextEvent = 0;
- break;
- }
- default:
- {
- status = KErrGeneral;
- break;
- }
- }
- }
- else
- {
- status = KErrGeneral;
- }
- return status;
- }
-
-// ---------------------------------------------------------------------------
-// Helper function to process timeline repeat bars that are closing.
-// Used by GetIVTEffectDuration in case it is called for timeline effect.
-// ---------------------------------------------------------------------------
-//
-TInt IVTHelper::TimelineDurationProcessRepeatInStack(
- TVibeTimeLineInfo* aTimelineInfo )
- {
- TInt status( KErrNone );
-
- // sanity check
- if ( aTimelineInfo &&
- 0 <= aTimelineInfo->iRepeatBarStackTop &&
- KVibeRepeatCountInfinite !=
- aTimelineInfo->
- iRepeatBarStack[aTimelineInfo->iRepeatBarStackTop].iCount )
- {
- // Processing needed only if count isn't already zero
- if ( 0 <
- aTimelineInfo->
- iRepeatBarStack[aTimelineInfo->iRepeatBarStackTop].iCount-- )
- {
- // update iNextEvent pointer
- aTimelineInfo->iNextEvent =
- aTimelineInfo->iRepeatBarStack
- [aTimelineInfo->iRepeatBarStackTop].iEvent;
-
- // Update the all effects end value if the end of repeat
- // is later than the current value
- TInt timeRepeat =
- aTimelineInfo->iTimeOffsetZero
- + aTimelineInfo->
- iRepeatBarStack[aTimelineInfo->iRepeatBarStackTop].
- iTimeOffsetEnd;
- if ( timeRepeat > aTimelineInfo->iTimeAllEffectsEnd )
- {
- aTimelineInfo->iTimeAllEffectsEnd = timeRepeat;
- }
-
- // Add the repeat bar duration to the effect start time:
- // repeating the last T time is like adding T to the ZeroTime
- aTimelineInfo->iTimeOffsetZero +=
- aTimelineInfo->iRepeatBarStack
- [aTimelineInfo->iRepeatBarStackTop].iTimeDuration;
-
- // If count has reached zero, update the repeat bar stack
- // top value (the current top has now been handled)
- if (0 == aTimelineInfo->iRepeatBarStack
- [aTimelineInfo->iRepeatBarStackTop].iCount)
- {
- --aTimelineInfo->iRepeatBarStackTop;
- }
- }
- }
- else
- {
- status = KErrGeneral;
- }
- return status;
- }
-
-// end of file
-
--- a/hwrmhaptics/hapticseffectdatagetterfw/plugins/hapticsivtgetterplugin/src/timelineivtgetters.cpp Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,342 +0,0 @@
-/*
-* 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: IVT effect get functions' high level helper functions
-* (for timeline effects) implementation file.
-*/
-
-#include "timelineivtgetters.h"
-
-// ---------------------------------------------------------------------------
-// Gets the effectID from the current location of the data as pointed by the
-// aProp pointer argument and advances the aPProp argument's pointer value to
-// the next data location
-// ---------------------------------------------------------------------------
-//
-TVibeIVTEffectID TimelineIVTGetters::VibeIVTGetEffectID(
- const TUint8* aProp,
- const TUint8** aPProp )
- {
- TVibeIVTEffectID effectID( 0 );
-
- // aPProp can be NULL if the caller doesn't want to retrieve it
- if ( aProp )
- {
- switch ( *( aProp++ ) )
- {
- case KVibeIvtPropertyTypeEffectIdU16:
- effectID |= *( aProp++ ) << 8;
- // fall through
- case KVibeIvtPropertyTypeEffectIdU8:
- effectID |= *( aProp++ );
- break;
- default:
- {
- // We shouldn't come here
- break;
- }
- }
- if ( aPProp )
- {
- *aPProp = aProp;
- }
- }
- return effectID;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the time offset from the current location of the data as pointed by
-// the aProp pointer argument and advances the aPProp argument's pointer value
-// to the next data location
-// ---------------------------------------------------------------------------
-//
-TInt TimelineIVTGetters::VibeIVTGetTimeOffset( const TUint8* aProp,
- const TUint8** aPProp )
- {
- TInt time( 0 );
-
- // aPProp can be NULL if the caller doesn't want to retrieve it
- if ( aProp )
- {
- switch ( *( aProp++ ) )
- {
- case KVibeIvtPropertyTypeTimeOffsetU32:
- time |= *( aProp++ ) << 24;
- // fall through
- case KVibeIvtPropertyTypeTimeOffsetU24:
- time |= *( aProp++ ) << 16;
- // fall through
- case KVibeIvtPropertyTypeTimeOffsetU16:
- time |= *( aProp++ ) << 8;
- time |= *( aProp++ );
- break;
- default:
- {
- // We should never come here.
- break;
- }
- }
- if ( aPProp )
- {
- *aPProp = aProp;
- }
- }
- return time;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the count value from the current location of the data as pointed by
-// the aProp pointer argument and advances the aPProp argument's pointer value
-// to the next data location
-// ---------------------------------------------------------------------------
-//
-TVibeIVTCount TimelineIVTGetters::VibeIVTGetCount( const TUint8* aProp,
- const TUint8** aPProp )
- {
- TVibeIVTCount count( 0 );
-
- // aPProp can be NULL if the caller doesn't want to retrieve it
- if ( aProp )
- {
- switch ( *( aProp++ ) )
- {
- case KVibeIvtPropertyTypeCountU8:
- count |= *( aProp++ );
- break;
- default:
- {
- // We should never come here.
- break;
- }
- }
- if ( aPProp )
- {
- *aPProp = aProp;
- }
- }
- return count;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the duration value from the current location of the data as pointed by
-// the aProp pointer argument and advances the aPProp argument's pointer value
-// to the next data location
-// ---------------------------------------------------------------------------
-//
-TVibeIVTMessageTime TimelineIVTGetters::VibeIVTGetDuration(
- const TUint8* aProp,
- const TUint8** aPProp )
- {
- TVibeIVTMessageTime duration( 0 );
-
- // aPProp can be NULL if the caller doesn't want to retrieve it
- if ( aProp )
- {
- switch ( *( aProp++ ) )
- {
- case KVibeIvtPropertyTypeDurationMsU16:
- duration |= *( aProp++ ) << 8;
- duration |= *( aProp++ );
- break;
- default:
- {
- // We should never come here.
- break;
- }
- }
- if ( aPProp )
- {
- *aPProp = aProp;
- }
- }
- return duration;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the magnitude from the current location of the data as pointed by the
-// aProp pointer argument and advances the aPProp argument's pointer value to
-// the next data location
-// ---------------------------------------------------------------------------
-//
-TVibeIVTMagnitude TimelineIVTGetters::VibeIVTGetMagnitude(
- const TUint8* aProp,
- const TUint8** aPProp )
- {
- TVibeIVTMagnitude magnitude( 0 );
-
- // aPProp can be NULL if the caller doesn't want to retrieve it
- if ( aProp )
- {
- switch ( *( aProp++ ) )
- {
- case KVibeIvtPropertyTypeMagnitudeS8:
- magnitude |= *( aProp++ );
- break;
- default:
- {
- // We should never come here.
- break;
- }
- }
- if ( aPProp )
- {
- *aPProp = aProp;
- }
- }
- return magnitude;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the frequency value from the current location of the data as pointed
-// by the aProp pointer argument and advances the aPProp argument's pointer
-// value to the next data location
-// ---------------------------------------------------------------------------
-//
-TVibeIVTFreqPer TimelineIVTGetters::VibeIVTGetFreqPer(
- const TUint8* aProp,
- const TUint8** aPProp )
- {
- TVibeIVTFreqPer freqper( 0 );
-
- // aPProp can be NULL if the caller doesn't want to retrieve it
- if ( aProp )
- {
- switch ( *( aProp++ ) )
- {
- case KVibeIvtPropertyTypeFreqPeriodU16:
- freqper |= *( aProp++ ) << 8;
- freqper |= *( aProp++ );
- break;
- default:
- {
- // We should never come here.
- break;
- }
- }
- if ( aPProp )
- {
- *aPProp = aProp;
- }
- }
- return freqper;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the event offset time from the current location of the
-// data as pointed by the aProp pointer argument.
-// This is the generic version that usually is called and that in turn uses
-// the above more specific getters.
-// ---------------------------------------------------------------------------
-//
-TInt TimelineIVTGetters::VibeIVTGetEventTimeOffset( const TUint8* aProp )
- {
- // Default return value a time that's guaranteed to never play
- TInt offset( KVibeTimeInfinite );
- if ( aProp )
- {
- // Return the start time depending on the event type
- switch ( *aProp )
- {
- case KVibeIvtPropertyTypeLaunchPlayback:
- offset = VibeIVTGetLaunchPlaybackEventTimeOffset( aProp );
- break;
- case KVibeIvtPropertyTypeRepeatBar:
- offset = VibeIVTGetRepeatBarEventTimeOffset( aProp );
- break;
- default:
- {
- // We should never come here.
- break;
- }
- }
- }
- return offset;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the override value(s) from the current location of the data as pointed
-// by the aProp pointer argument and advances the aPProp argument's pointer
-// value to the next data location
-// ---------------------------------------------------------------------------
-//
-void TimelineIVTGetters::VibeIVTGetOverrides(
- const TUint8* aProp,
- TVibeIVTOverrideFlags* aOverrideFlags,
- TVibeIVTMessageTime* aDuration,
- TVibeIVTMagnitude* aMagnitude,
- TVibeIVTFreqPer* aFreqPer,
- const TUint8** aPProp )
- {
- // aPProp can be NULL if the caller doesn't want to retrieve it
- if ( aProp && aOverrideFlags && aDuration && aMagnitude && aFreqPer )
- {
- *aOverrideFlags = 0;
- while ( VIBE_IVT_IS_OVERRIDE( aProp ) )
- {
- switch ( *aProp )
- {
- case KVibeIvtPropertyTypeDurationMsU16:
- *aOverrideFlags |= KVibeIvtOverrideFlagDuration;
- *aDuration = VibeIVTGetDuration( aProp, &aProp );
- break;
- case KVibeIvtPropertyTypeMagnitudeS8:
- *aOverrideFlags |= KVibeIvtOverrideFlagMagnitude;
- *aMagnitude = VibeIVTGetMagnitude( aProp, &aProp );
- break;
- case KVibeIvtPropertyTypeFreqPeriodU16:
- *aOverrideFlags |= KVibeIvtOverrideFlagFreqPeriod;
- *aFreqPer = VibeIVTGetFreqPer( aProp, &aProp );
- break;
- default:
- {
- // We should never come here.
- break;
- }
- }
- }
- if ( aPProp )
- {
- *aPProp = aProp;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Gets the launch playback event offset time from the current location of the
-// data as pointed by the aProp pointer argument
-// ---------------------------------------------------------------------------
-//
-TInt TimelineIVTGetters::VibeIVTGetLaunchPlaybackEventTimeOffset(
- const TUint8* aProp )
- {
- TInt offset( 0 );
- if ( aProp )
- {
- VibeIVTGetEffectID( aProp + 1, &aProp ); // skip the return value
- offset = VibeIVTGetTimeOffset( aProp, 0 );
- }
- return offset;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the repeat event offset time from the current location of the
-// data as pointed by the aProp pointer argument
-// ---------------------------------------------------------------------------
-//
-TInt TimelineIVTGetters::VibeIVTGetRepeatBarEventTimeOffset(
- const TUint8* aProp )
- {
- return aProp ? VibeIVTGetTimeOffset( aProp + 1, 0 ) : 0;
- }
-
-// end of file
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/data/20021206.rss Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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: Vibe packetizer plugin's ECom resource file.
-*
-*/
-
-#include <ecom/registryinfo.rh>
-
-RESOURCE REGISTRY_INFO theInfo
- {
- dll_uid = 0x20021206;
- interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = 0x20021205;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = 0x20021207;
- version_no = 1;
- display_name = "";
- default_data = "";
- opaque_data = "";
- }
- };
- }
- };
- }
-
-// End of file
\ No newline at end of file
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/group/bld.inf Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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: Plugin for VibeTonz Haptics command packetizer.
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-../rom/hwrmhapticsvibepacketizerplugin.iby CORE_OS_LAYER_IBY_EXPORT_PATH(hwrmhapticsvibepacketizerplugin.iby)
-
-PRJ_MMPFILES
-hwrmhapticsvibepacketizerplugin.mmp
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/group/hwrmhapticsvibepacketizerplugin.mmp Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* 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: Project definition file for Vibe Packetizer ECom plugin.
-*
-*/
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET hwrmhapticsvibepacketizerplugin.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D 0x20021206
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE hwrmhapticsvibepacketizer.cpp
-
-USERINCLUDE ../inc
-
-// Default system include paths for osext layer modules.
-OS_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE /epoc32/include/stdapis
-
-SOURCEPATH ../data
-START RESOURCE 20021206.rss
-TARGETPATH ECOM_RESOURCE_DIR
-TARGET hwrmhapticsvibepacketizerplugin.rsc
-END
-
-LIBRARY euser.lib
-LIBRARY bafl.lib
-LIBRARY ecom.lib
-LIBRARY hwrmhapticspacketizer.lib
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/inc/hwrmhapticsvibeconstants.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* 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: VibeTonz related const definitions header file
-*
-*/
-
-#ifndef _HWRMHAPTICSVIBECONSTANTS_H
-#define _HWRMHAPTICSVIBECONSTANTS_H
-
-#include <e32def.h>
-#include <limits.h>
-
-/**
- * Invalid index constant
- */
-const TInt KVibeInvalidIndex = -1;
-
-/**
- * String maximum length constants
- */
-const TInt KVibeMaxEffectNameLength = 128; // Maximum effect name length
-const TInt KVibeMaxDeviceNameLength = 64; // Maximum device name length
-const TInt KVibeMaxCapabilityStringLength = 64; // Maximum capability string length
-const TInt KVibeMaxPropertyStringLength = 64; // Maximum property string length
-
-/**
- * 'Infinite' time
- */
-const TInt KVibeTimeInfinite = INT_MAX;
-
-/**
- * Device Default priority value
- */
-const TInt KVibeDevicePriorityDefault = 0;
-
-/**
- * 'Infinite' repeat count value
- */
-const TUint8 KVibeRepeatCountInfinite = 255;
-
-/**
- * Maximum size of streaming sample (in bytes)
- */
-const TInt KVibeMaxStreamingSampleSize = 255;
-
-/**
- * Data value types (used as property and capability data value type)
- */
-const TUint8 KVibeValuetypeUnspecified = 0;
-const TUint8 KVibeValuetypeInt32 = 1;
-const TUint8 KVibeValuetypeBool = 2;
-const TUint8 KVibeValuetypeString = 3;
-
-/**
- * Error and Return value codes.
- */
-// Success
-const TInt KVibeStatusSuccess = 0;
-
-// Effect is not playing
-const TInt KVibeWarningNotPlaying = 1;
-
-// Effect doesn't have enough priority to play,
-// higher priority effect is playing on the device
-const TInt KVibeWarningInsufficientPriority = 2;
-
-// Effects are disabled on the device
-const TInt KVibeWarningEffectsDisabled = 3;
-
-// Trying to resume an effect that is not paused
-const TInt KVibeWarningNotPaused = 4;
-
-// The API is already initialized (this code is obsolete)
-const TInt KVibeErrAlreadyInitialized = -1;
-
-// The API is not initialized
-const TInt KVibeErrNotInitialized = -2;
-
-// Invalid argument was used in a API function call
-const TInt KVibeErrInvalidArgument = -3;
-
-// Generic error
-const TInt KVibeErrFail = -4;
-
-// Incompatible Effect type has been passed into an API call
-const TInt KVibeErrIncompatibleEffectType = -5;
-
-// Incompatible Capability type was used in one of the following API call:
-// -ImmVibeGetDeviceCapabilityString
-// -ImmVibeSetDeviceCapabilityString
-// -ImmVibeGetDeviceCapabilityInt32
-// -ImmVibeGetDeviceCapabilityInt32
-const TInt KVibeErrIncompatibleCapabilityType = -6;
-
-// Incompatible Property type was used in on of the following API calls:
-// -ImmVibeGetDevicePropertyString
-// -ImmVibeSetDevicePropertyString
-// -ImmVibeGetDevicePropertyBool
-// -ImmVibeGetDevicePropertyInt32
-// -ImmVibeSetDevicePropertyInt32
-const TInt KVibeErrIncompatiblePropertyType = -7;
-
-// Access to the instance of haptics is locked until a valid license key is provided.
-// Use ImmVibeSetDevicePropertyString to set the license key.
-// The following API functions may return this error
-// -ImmVibeGetDevicePropertyBool
-// -ImmVibeSetDevicePropertyBool
-// -ImmVibeGetDevicePropertyInt32
-// -ImmVibeSetDevicePropertyInt32
-// -ImmVibeGetDevicePropertyString
-// -ImmVibeSetDevicePropertyString (except for setting the license key)
-// -ImmVibePlayIVTEffect
-// -ImmVibePlayIVTEffectRepeat
-// -ImmVibeStopPlayingEffect
-// -ImmVibePlayMagSweepEffect
-// -ImmVibePlayPeriodicEffect
-// -ImmVibeModifyPlayingMagSweepEffect
-// -ImmVibeModifyPlayingPeriodicEffect
-// -ImmVibeStopAllPlayingEffects
-const TInt KVibeErrDeviceNeedsLicense = -8;
-
-// Cannot allocate memory to complete the request
-const TInt KVibeErrNotEnoughMemory = -9;
-
-// ImmVibe service is not running
-const TInt KVibeErrServiceNotRunning = -10;
-
-// Insufficient priority to complete the request (insufficient license key priority)
-const TInt KVibeErrInsufficientPriority = -11;
-
-// ImmVibe service is busy and failed to complete the request
-const TInt KVibeErrServiceBusy = -12;
-
-#endif // _HWRMHAPTICSVIBECONSTANTS_H
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/inc/hwrmhapticsvibepacketizer.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,377 +0,0 @@
-/*
-* 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: Plugin for handling vibe command packages.
-*
-*/
-
-#ifndef C_HWRMHAPTICSVIBEPACKETIZER_H
-#define C_HWRMHAPTICSVIBEPACKETIZER_H
-
-#include <e32base.h>
-#include <hwrmhapticspacketizer.h>
-
-class CDesC8ArraySeg;
-
-/**
- * ECom plugin for handling vibe command packages.
- *
- * @lib hwrmhapticsvibepacketizerplugin.lib
- * @since S60 v5.1
- */
-NONSHARABLE_CLASS( CHWRMHapticsVibePacketizer ): public CHWRMHapticsPacketizer
- {
-public:
-
- /**
- * Two phased constructor.
- *
- * @return An instance of haptics vibe packetizer.
- */
- static CHWRMHapticsVibePacketizer* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CHWRMHapticsVibePacketizer();
-
-public: // From CHWRMHapticsPacketizer
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncOpenDeviceReq( THWRMLogicalActuators aLogicalActuator,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncCloseDeviceReq( TInt aDeviceHandle, RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayMagSweepEffectReq(
- TInt aDeviceHandle,
- CHWRMHaptics::THWRMHapticsMagSweepEffect aEffect,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayPeriodicEffectReq(
- TInt aDeviceHandle,
- CHWRMHaptics::THWRMHapticsPeriodicEffect aEffect,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncModifyPlayingMagSweepEffectReq(
- TInt aDeviceHandle,
- TInt aEffectHandle,
- CHWRMHaptics::THWRMHapticsMagSweepEffect aEffect,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncModifyPlayingPeriodicEffectReq(
- TInt aDeviceHandle,
- TInt aEffectHandle,
- CHWRMHaptics::THWRMHapticsPeriodicEffect aEffect,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPausePlayingEffectReq( TInt aDeviceHandle,
- TInt aEffectHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncResumePausedEffectReq( TInt aDeviceHandle,
- TInt aEffectHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncStopPlayingEffectReq( TInt aDeviceHandle,
- TInt aEffectHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncStopAllPlayingEffectsReq( TInt aDeviceHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayEffectIncludeEffectDataReq( TInt aDeviceHandle,
- const TDesC8& aData,
- TInt aEffectIndex,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayEffectRepeatIncludeEffectDataReq( TInt aDeviceHandle,
- const TDesC8& aData,
- TInt aEffectIndex,
- TUint8 aRepeat,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayEffectRepeatNoDataReq( TInt aDeviceHandle,
- TInt aEffectIndex,
- TUint8 aRepeat,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayEffectNoDataReq( TInt aDeviceHandle,
- TInt aEffectIndex,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncCreateStreamingEffectReq( TInt aDeviceHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncDestroyStreamingEffectReq( TInt aDeviceHandle,
- TInt aEffectHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayStreamingSampleReq( TInt aDeviceHandle,
- const TDesC8& aStreamingSample,
- TInt aEffectHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncPlayStreamingSampleWithOffsetReq(
- TInt aDeviceHandle,
- const TDesC8& aStreamingSample,
- TInt aOffsetTime,
- TInt aEffectHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncGetEffectStateReq( TInt aDeviceHandle,
- TInt aEffectHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncSetDevicePropertyBoolReq( TInt aDeviceHandle,
- TBool aDevPropValue,
- TInt aDevPropType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncSetDevicePropertyIntReq( TInt aDeviceHandle,
- TInt aDevPropValue,
- TInt aDevPropType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncSetDevicePropertyStringReq( TInt aDeviceHandle,
- const TDesC8& aDevPropValue,
- TInt aDevPropType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncSetPlatformLicenseKeyReq( TInt aDeviceHandle,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncGetDevicePropertyBoolReq( TInt aDeviceHandle,
- TInt aDevPropType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncGetDevicePropertyIntReq( TInt aDeviceHandle,
- TInt aDevPropType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncGetDevicePropertyStringReq( TInt aDeviceHandle,
- TInt aDevPropType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncGetDeviceCapabilityIntReq( TInt aDeviceHandle,
- TInt aDevCapType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt EncGetDeviceCapabilityStringReq( TInt aDeviceHandle,
- TInt aDevCapType,
- RBuf8& aBuffer );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual CDesC8ArraySeg* DecodeMessageL( const TDesC8& aData,
- TInt& aStatus );
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt DeviceHandle();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt InfiniteRepeat();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt InfiniteDuration();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt MaxEffectNameLength();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt MaxDeviceNameLength();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt MaxCapabilityStringLength();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt MaxPropertyStringLength();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt MaxStreamingSampleSize();
-
- /**
- * @see MHWRMHapticsPacketizer
- */
- virtual TInt DefaultDevicePriority();
-
-private:
-
- /**
- * Constructor.
- */
- CHWRMHapticsVibePacketizer();
-
- /**
- * 2nd phase constructor.
- */
- void ConstructL();
-
- /**
- * Internal helper method. Fills Get Device Capability request data.
- */
- TInt EncGetDeviceCapabilityReqInternal( TInt aValueType,
- TInt aDeviceHandle,
- TInt aDevCapType,
- RBuf8& aBuffer );
-
- /**
- * Internal helper method. Fills Get Device Property request data.
- */
- TInt EncGetDevicePropertyReqInternal( TInt aValueType,
- TInt aDeviceHandle,
- TInt aDevPropType,
- RBuf8& aBuffer );
-
- /**
- * Internal helper method. Fills Play Streaming Sample request data.
- */
- TInt EncPlayStreamingSampleInternal( TInt aDeviceHandle,
- TInt aEffectHandle,
- const TDesC8& aStreamingSample,
- TInt aOffsetTime,
- RBuf8& aBuffer );
-
- /**
- * Maps Vibe error code to Symbian error code.
- *
- * @param aVibeError Vibe error code.
- * @return Symbian system wide error code.
- */
- TInt MapError( TInt aVibeError );
-
-private: // data
-
- /**
- * Buffer for request data.
- */
- RBuf8 iReqBuf;
-
- /**
- * Buffer for streaming or IVT data.
- */
- RBuf8 iDataBuf;
-
- /**
- * Array used for decoded values in DecodeMessageL. Owned.
- */
- CDesC8ArraySeg* iReturnArray;
-
- /**
- * Stores the latest value of opened device handle. Initiated
- * to KErrNotFound.
- */
- TInt iDeviceHandle;
- };
-
-#endif // C_HWRMHAPTICSVIBEPACKETIZER_H
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/inc/hwrmhapticsvibepackets.h Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,735 +0,0 @@
-/*
-* 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: VibeTonz API protocol packet definition header file
-*
-*/
-
-#ifndef _HWRMHAPTICSVIBEPACKETS_H_
-#define _HWRMHAPTICSVIBEPACKETS_H_
-
-/**
- * Byte alignment is set to 1 byte boundary with this pragma.
- */
-#pragma pack( push, 1 )
-
-/**
- * Const for largest allowable packet size. It is used
- * by packetizer functions that piggyback IVT or streaming
- * data in their packets.
- */
-const TInt KVibePacketMaxSize = 0xFFFF;
-
-/**
- * Haptics command codes (VibeTonz API command codes)
- */
-const TUint16 KVibeCmdProtocolVersion = 0xFF;
-const TUint16 KVibeCmdApiVersion = 0x00;
-const TUint16 KVibeCmdInitialize = 0x01;
-const TUint16 KVibeCmdTerminate = 0x02;
-const TUint16 KVibeCmdPlayBasisEffect = 0x03;
-const TUint16 KVibeCmdPlayIVTEffectIncludeData = 0x04;
-const TUint16 KVibeCmdPlayIVTEffectNoData = 0x05;
-const TUint16 KVibeCmdModifyBasisEffect = 0x06;
-const TUint16 KVibeCmdStopEffect = 0x07;
-const TUint16 KVibeCmdStopAllEffects = 0x08;
-const TUint16 KVibeCmdGetDeviceCapabilities = 0x09;
-const TUint16 KVibeCmdDebugBuffer = 0x0A;
-const TUint16 KVibeCmdResetDebugBuffer = 0x0B;
-const TUint16 KVibeCmdStopDesignedBridge = 0x0C;
-const TUint16 KVibeCmdGetDeviceState = 0x0D;
-const TUint16 KVibeCmdSetKernelParameter = 0x0E;
-const TUint16 KVibeCmdGetKernelParameter = 0x0F;
-const TUint16 KVibeCmdSetDeviceProperty = 0x10;
-const TUint16 KVibeCmdGetDeviceProperty = 0x11;
-const TUint16 KVibeCmdOpenDevice = 0x12;
-const TUint16 KVibeCmdCloseDevice = 0x13;
-const TUint16 KVibeCmdStartDesignerBridge = 0x14;
-const TUint16 KVibeCmdDeviceCount = 0x15;
-const TUint16 KVibeCmdPlayStreamingSample = 0x16;
-const TUint16 KVibeCmdCreateStreamingEffect = 0x17;
-const TUint16 KVibeCmdDestroyStreamingEffect = 0x18;
-const TUint16 KVibeCmdPausePlayingEffect = 0x19;
-const TUint16 KVibeCmdResumePausedEffect = 0x1A;
-const TUint16 KVibeCmdGetEffectState = 0x1B;
-const TUint16 KVibeCmdPlayMagSweepEffect = 0x1C;
-const TUint16 KVibeCmdPlayPeriodicEffect = 0x1D;
-const TUint16 KVibeCmdModifyPlayingMagSweepEffect = 0x1E;
-const TUint16 KVibeCmdModifyPlayingPeriodicEffect = 0x1F;
-const TUint16 KVibeCmdSetLicense = 0x20;
-
-/**
- * Simple request struct contains just command code
- */
-struct TVibePacketSimpleRequest
- {
- TUint16 iCmdCode;
- };
-
-/**
- * Simple response struct contains just command code and status.
- */
-struct TVibePacketSimpleResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- };
-
-/**
- * Packet structures for Protocol Version request and response
- * (Implemented since Mobile 2.0 protocol)
- */
-typedef TVibePacketSimpleRequest TVibePacketProtocolVersionRequest;
-
-struct TVibePacketProtocolVersionResponse
- {
- TUint16 iCmdCode;
- TUint8 iVersionMinor;
- TUint8 iVersionMajor;
- };
-
-
-/**
- * Packet structures for API Version request and response
- */
-typedef TVibePacketSimpleRequest TVibePacketApiVersionRequest;
-
-struct TVibePacketApiVersionResponse
- {
- TUint16 iCmdCode;
- TUint8 iVersionMajor;
- TUint8 iVersionMinor;
- TUint8 iVersionBuild_7_0;
- TUint8 iVersionBuild_15_8;
- };
-
-/**
- * Packet structures for Initialize request and response
- */
-struct TVibePacketInitializeRequest
- {
- TUint16 iCmdCode;
- TUint8 iVersionMajor;
- TUint8 iVersionMinor;
- TUint8 iVersionBuild_7_0;
- TUint8 iVersionBuild_15_8;
- };
-
-typedef TVibePacketSimpleResponse TVibePacketInitializeResponse;
-
-/**
- * Packet structures for Terminate request and response
- */
-typedef TVibePacketSimpleRequest TVibePacketTerminateRequest;
-
-typedef TVibePacketSimpleResponse TVibePacketTerminateResponse;
-
-/**
- * Packet structures for PlayBasisEffect request and response.
- * Used with following commands:
- * - KVibeCmdPlayBasisEffect
- * - KVibeCmdPlayMagSweepEffect
- * - KVibeCmdPlayPeriodicEffect
- */
-struct TVibePacketPlayBasisEffectRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- TUint8 iDuration_7_0;
- TUint8 iDuration_15_8;
- TUint8 iDuration_23_16;
- TUint8 iDuration_31_24;
- TUint8 iMagnitude_7_0;
- TUint8 iMagnitude_15_8;
- TUint8 iMagnitude_23_16;
- TUint8 iMagnitude_31_24;
- TUint8 iEffectTypeStyle;
- TUint8 iPeriod_7_0;
- TUint8 iPeriod_15_8;
- TUint8 iPeriod_23_16;
- TUint8 iPeriod_31_24;
- TUint8 iImpulseTime_7_0;
- TUint8 iImpulseTime_15_8;
- TUint8 iImpulseTime_23_16;
- TUint8 iImpulseTime_31_24;
- TUint8 iImpulseLevel_7_0;
- TUint8 iImpulseLevel_15_8;
- TUint8 iImpulseLevel_23_16;
- TUint8 iImpulseLevel_31_24;
- TUint8 iFadeTime_7_0;
- TUint8 iFadeTime_15_8;
- TUint8 iFadeTime_23_16;
- TUint8 iFadeTime_31_24;
- TUint8 iFadeLevel_7_0;
- TUint8 iFadeLevel_15_8;
- TUint8 iFadeLevel_23_16;
- TUint8 iFadeLevel_31_24;
- };
-
-struct TVibePacketPlayBasisEffectResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- };
-
-/**
- * Packet structures for PlayIVTEffect requests and responses.
- * Used with following commands:
- * - KVibeCmdPlayIVTEffectIncludeData
- * - KVibeCmdPlayIVTEffectNoData
- */
-struct TVibePacketPlayIVTEffectRequest
- {
- TUint16 iCmdCode;
- TUint16 iIvtDataSize;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- TUint8 iIvtIndex_7_0;
- TUint8 iIvtIndex_15_8;
- TUint8 iRepeat;
- TUint8 iIvtData[1];
- };
-
-struct TVibePacketPlayIVTEffectResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- };
-
-/**
- * Packet structures for ModifyBasisEffect request and response.
- * Used with following commands:
- * - KVibeCmdModifyBasisEffect
- * - KVibeCmdModifyPlayingMagSweepEffect
- * - KVibeCmdModifyPlayingPeriodicEffect
- */
-struct TVibePacketModifyBasisEffectRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- TUint8 iDuration_7_0;
- TUint8 iDuration_15_8;
- TUint8 iDuration_23_16;
- TUint8 iDuration_31_24;
- TUint8 iMagnitude_7_0;
- TUint8 iMagnitude_15_8;
- TUint8 iMagnitude_23_16;
- TUint8 iMagnitude_31_24;
- TUint8 iEffectTypeStyle;
- TUint8 iPeriod_7_0;
- TUint8 iPeriod_15_8;
- TUint8 iPeriod_23_16;
- TUint8 iPeriod_31_24;
- TUint8 iImpulseTime_7_0;
- TUint8 iImpulseTime_15_8;
- TUint8 iImpulseTime_23_16;
- TUint8 iImpulseTime_31_24;
- TUint8 iImpulseLevel_7_0;
- TUint8 iImpulseLevel_15_8;
- TUint8 iImpulseLevel_23_16;
- TUint8 iImpulseLevel_31_24;
- TUint8 iFadeTime_7_0;
- TUint8 iFadeTime_15_8;
- TUint8 iFadeTime_23_16;
- TUint8 iFadeTime_31_24;
- TUint8 iFadeLevel_7_0;
- TUint8 iFadeLevel_15_8;
- TUint8 iFadeLevel_23_16;
- TUint8 iFadeLevel_31_24;
- };
-
-typedef TVibePacketSimpleResponse TVibePacketModifyBasisEffectResponse;
-
-/**
- * Packet structures for StopEffect request and response
- */
-struct TVibePacketStopEffectRequest
- {
- TUint16 iCmdCode;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-typedef TVibePacketSimpleResponse TVibePacketStopEffectResponse;
-
-/**
- * Packet structures for StopAllEffects request and response
- */
-struct TVibePacketStopAllEffectsRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-typedef TVibePacketSimpleResponse TVibePacketStopAllEffectsResponse;
-
-/**
- * Packet structures for GetDeviceCapabilities request and response
- */
-struct TVibePacketGetDeviceCapabilitiesRequest
- {
- TUint16 iCmdCode;
- TUint8 iCapabilityValueType;
- TUint8 iDeviceIndex_7_0;
- TUint8 iDeviceIndex_15_8;
- TUint8 iDeviceIndex_23_16;
- TUint8 iDeviceIndex_31_24;
- TUint8 iCapabilityType_7_0;
- TUint8 iCapabilityType_15_8;
- TUint8 iCapabilityType_23_16;
- TUint8 iCapabilityType_31_24;
- };
-
-struct TVibePacketGetDeviceCapabilitiesResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iCapabilityType_7_0;
- TUint8 iCapabilityType_15_8;
- TUint8 iCapabilityType_23_16;
- TUint8 iCapabilityType_31_24;
- TUint8 iCapabilityValueType;
- TUint8 iSize;
- TUint8 iCapabilityValue[1];
- };
-
-/**
- * Packet structures for Get DebugBuffer request and response
- */
-typedef TVibePacketSimpleRequest TVibePacketGetDebugBufferRequest;
-
-struct TVibePacketGetDebugBufferResponse
- {
- TUint16 iCmdCode;
- TUint8 iBufferSize_7_0;
- TUint8 iBufferSize_15_8;
- TUint8 iBuffer[1];
- };
-
-/**
- * Packet structures for ResetDebugBuffer request and response
- */
-typedef TVibePacketSimpleRequest TVibePacketResetDebugBufferRequest;
-
-typedef TVibePacketSimpleResponse TVibePacketResetDebugBufferResponse;
-
-/**
- * Packet structures for Stop designer Bridge request and response
- */
-typedef TVibePacketSimpleRequest TVibePacketStopDesignerBridgeRequest;
-
-typedef TVibePacketSimpleResponse TVibePacketStopDesignerBridgeResponse;
-
-/**
- * Packet structures for GetDeviceState request and response
- */
-struct TVibePacketGetDeviceStateRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceIndex_7_0;
- TUint8 iDeviceIndex_15_8;
- TUint8 iDeviceIndex_23_16;
- TUint8 iDeviceIndex_31_24;
- };
-
-struct TVibePacketGetDeviceStateResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iDeviceState_7_0;
- TUint8 iDeviceState_15_8;
- TUint8 iDeviceState_23_16;
- TUint8 iDeviceState_31_24;
- };
-
-/**
- * Packet structures for Set Device Kernel Parameter request and response
- */
-struct TVibePacketSetKernelParameterRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceIndex_7_0;
- TUint8 iDeviceIndex_15_8;
- TUint8 iDeviceIndex_23_16;
- TUint8 iDeviceIndex_31_24;
- TUint8 iKernelParameterID_7_0;
- TUint8 iKernelParameterID_15_8;
- TUint8 iKernelParameterValue_7_0;
- TUint8 iKernelParameterValue_15_8;
- };
-
-struct TVibePacketSetKernelParameterResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iKernelParameterID_7_0;
- TUint8 iKernelParameterID_15_8;
- };
-
-/**
- * Get Device Kernel Parameter request and response
- */
- struct TVibePacketGetKernelParameterRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceIndex_7_0;
- TUint8 iDeviceIndex_15_8;
- TUint8 iDeviceIndex_23_16;
- TUint8 iDeviceIndex_31_24;
- TUint8 iKernelParameterID_7_0;
- TUint8 iKernelParameterID_15_8;
- };
-
-struct TVibePacketGetKernelParameterResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iKernelParameterID_7_0;
- TUint8 iKernelParameterID_15_8;
- TUint8 iKernelParameterValue_7_0;
- TUint8 iKernelParameterValue_15_8;
- };
-
-/**
- * Packet structures for SetDeviceProperty request and response
- */
-struct TVibePacketSetDevicePropertyRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- TUint8 iPropertyType_7_0;
- TUint8 iPropertyType_15_8;
- TUint8 iPropertyType_23_16;
- TUint8 iPropertyType_31_24;
- TUint8 iPropertyValueType;
- TUint8 iSize;
- TUint8 iPropertyValue[1];
- };
-
-struct TVibePacketSetDevicePropertyResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iPropertyType_7_0;
- TUint8 iPropertyType_15_8;
- TUint8 iPropertyType_23_16;
- TUint8 iPropertyType_31_24;
- TUint8 iPropertyValueType;
- };
-
-/**
- * Packet structures for GetDeviceProperty request and response
- */
-struct TVibePacketGetDevicePropertyRequest
- {
- TUint16 iCmdCode;
- TUint8 iPropertyValueType;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- TUint8 iPropertyType_7_0;
- TUint8 iPropertyType_15_8;
- TUint8 iPropertyType_23_16;
- TUint8 iPropertyType_31_24;
- };
-
-struct TVibePacketGetDevicePropertyResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iPropertyType_7_0;
- TUint8 iPropertyType_15_8;
- TUint8 iPropertyType_23_16;
- TUint8 iPropertyType_31_24;
- TUint8 iPropertyValueType;
- TUint8 iSize;
- TUint8 iPropertyValue[1];
- };
-
-/**
- * Packet structures for OpenDevice
- */
-struct TVibePacketOpenDeviceRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceIndex_7_0;
- TUint8 iDeviceIndex_15_8;
- TUint8 iDeviceIndex_23_16;
- TUint8 iDeviceIndex_31_24;
- };
-
-struct TVibePacketOpenDeviceResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-/**
- * Packet structures for CloseDevice request and response
- */
-struct TVibePacketCloseDeviceRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-typedef TVibePacketSimpleResponse TVibePacketCloseDeviceResponse;
-
-/**
- * Packet structures for Start designer Bridge request and response
- */
-typedef TVibePacketSimpleRequest TVibePacketStartDesignedBridgeRequest;
-
-typedef TVibePacketSimpleResponse TVibePacketStartDesignedBridgeResponse;
-
-/**
- * Packet structures for DeviceCount request and response
- */
-typedef TVibePacketSimpleRequest TVibePacketDeviceCountRequest;
-
-// Uses simple response packet struct where vibe_status contains
-// the device count (or negative error value)
-typedef TVibePacketSimpleResponse TVibePacketDeviceCountResponse;
-
-/**
- * Packet structures for Upload SPE data request and response
- */
-struct TVibePacketPlayStreamingSampleRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- TUint8 iSize;
- TUint8 iEffectOffsetTime_7_0;
- TUint8 iEffectOffsetTime_15_8;
- TUint8 iStreamingData[1];
- };
-
-typedef TVibePacketSimpleResponse TVibePacketPlayStreamingSampleResponse;
-
-/**
- * Packet structures for Create streaming effect request and response
- */
-struct TVibePacketCreateStreamingEffectRequest
- {
- TUint16 iCmdCode;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-struct TVibePacketCreateStreamingEffectResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- };
-
-/**
- * Packet structures for Destroy streaming effect request and response
- */
-struct TVibePacketDestroyStreamingEffectRequest
- {
- TUint16 iCmdCode;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-typedef TVibePacketSimpleResponse TVibePacketDestroyStreamingEffectResponse;
-
-/**
- * Packet structures for Pause Playing Effect request and response
- */
-struct TVibePacketPausePlayingEffectRequest
- {
- TUint16 iCmdCode;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-typedef TVibePacketSimpleResponse TVibePacketPausePlayingEffectResponse;
-
-/**
- * Packet structures for Resume Paused Effect request and response
- */
-typedef TVibePacketPausePlayingEffectRequest TVibePacketResumePlayingEffectRequest;
-
-typedef TVibePacketSimpleResponse TVibePacketResumePlayingEffectResponse;
-
-/**
- * Packet structures for Get effect state request and response
- */
-struct TVibePacketGetEffectStateRequest
- {
- TUint16 iCmdCode;
- TUint8 iEffectHandle_7_0;
- TUint8 iEffectHandle_15_8;
- TUint8 iEffectHandle_23_16;
- TUint8 iEffectHandle_31_24;
- TUint8 iDeviceHandle_7_0;
- TUint8 iDeviceHandle_15_8;
- TUint8 iDeviceHandle_23_16;
- TUint8 iDeviceHandle_31_24;
- };
-
-struct TVibePacketGetEffectStateResponse
- {
- TUint16 iCmdCode;
- TInt8 iVibeStatus;
- TInt8 iEffectState;
- };
-
-/**
- * Packet structures for license request and response
- * (Uses currently same packet structs as SetProperty)
- */
-typedef TVibePacketSetDevicePropertyRequest TVibePacketSetLicenseRequest;
-
-typedef TVibePacketSetDevicePropertyResponse TVibePacketSetLicenseResponse;
-
-/**
- * Packet union definition, useful for decoder function
- */
-union TVibePacket
- {
- TVibePacketSimpleRequest iSimpleReq;
- TVibePacketSimpleResponse iSimpleRsp;
- TVibePacketProtocolVersionRequest iProtocolVersionReq;
- TVibePacketProtocolVersionResponse iProtocolVersionRsp;
- TVibePacketApiVersionRequest iAPIVersionReq;
- TVibePacketApiVersionResponse iAPIVersionRsp;
- TVibePacketInitializeRequest iInitializeReq;
- TVibePacketInitializeResponse iInitializeRsp;
- TVibePacketTerminateRequest iTerminateReq;
- TVibePacketTerminateResponse iTerminateRsp;
- TVibePacketPlayBasisEffectRequest iPlayBasisEffectReq;
- TVibePacketPlayBasisEffectResponse iPlayBasisEffectRsp;
- TVibePacketPlayIVTEffectRequest iPlayIVTEffectReq;
- TVibePacketPlayIVTEffectResponse iPlayIVTEffectRsp;
- TVibePacketModifyBasisEffectRequest iModifyBasisEffectReq;
- TVibePacketModifyBasisEffectResponse iModifyBasisEffectRsp;
- TVibePacketStopEffectRequest iStopEffectReq;
- TVibePacketStopEffectResponse iStopEffectRsp;
- TVibePacketStopAllEffectsRequest iStopAllEffectsReq;
- TVibePacketStopAllEffectsResponse iStopAllEffectsRsp;
- TVibePacketGetDeviceCapabilitiesRequest iGetDeviceCapsReq;
- TVibePacketGetDeviceCapabilitiesResponse iGetDeviceCapsRsp;
- TVibePacketGetDebugBufferRequest iDebugBufferReq;
- TVibePacketGetDebugBufferResponse iDebugBufferRsp;
- TVibePacketResetDebugBufferRequest iResetDebugBufferReq;
- TVibePacketResetDebugBufferResponse iResetDebugBufferRsp;
- TVibePacketStopDesignerBridgeRequest iStopDesignerBridgeReq;
- TVibePacketStopDesignerBridgeResponse iStopDesignerBridgeRsp;
- TVibePacketGetDeviceStateRequest iGetDeviceStateReq;
- TVibePacketGetDeviceStateResponse iGetDeviceStateRsp;
- TVibePacketSetKernelParameterRequest iSetKernelParamsReq;
- TVibePacketSetKernelParameterResponse iSetKernelParamsRsp;
- TVibePacketGetKernelParameterRequest iGetKernelParamsReq;
- TVibePacketGetKernelParameterResponse iGetKernelParamsRsp;
- TVibePacketOpenDeviceRequest iOpenDeviceReq;
- TVibePacketOpenDeviceResponse iOpenDeviceRsp;
- TVibePacketCloseDeviceRequest iCloseDeviceReq;
- TVibePacketCloseDeviceResponse iCloseDeviceRsp;
- TVibePacketSetDevicePropertyRequest iSetDevicePropertyReq;
- TVibePacketSetDevicePropertyResponse iSetDevicePropertyRsp;
- TVibePacketGetDevicePropertyRequest iGetDevicePropertyReq;
- TVibePacketGetDevicePropertyResponse iGetDevicePropertyRsp;
- TVibePacketDeviceCountRequest iGetDeviceCountReq;
- TVibePacketDeviceCountResponse iGetDeviceCountRsp;
- TVibePacketStartDesignedBridgeRequest iStartDesignerBridgeReq;
- TVibePacketStartDesignedBridgeResponse iStartDesignerBridgeRsp;
- TVibePacketPlayStreamingSampleRequest iPlayStreamingSampleReq;
- TVibePacketPlayStreamingSampleResponse iPlayStreamingSampleRsp;
- TVibePacketCreateStreamingEffectRequest iCreateStreamingEffectReq;
- TVibePacketCreateStreamingEffectResponse iCreateStreamingEffectRsp;
- TVibePacketDestroyStreamingEffectRequest iDestroyStreamingEffectReq;
- TVibePacketDestroyStreamingEffectResponse iDestroyStreamingEffectRsp;
- TVibePacketPausePlayingEffectRequest iPausePlayingEffectReq;
- TVibePacketPausePlayingEffectResponse iPausePlayingEffectRsp;
- TVibePacketResumePlayingEffectRequest iResumePausedEffectReq;
- TVibePacketResumePlayingEffectResponse iResumePausedEffectRsp;
- TVibePacketGetEffectStateRequest iGetEffectStateReq;
- TVibePacketGetEffectStateResponse iGetEffectStateRsp;
- TVibePacketSetLicenseRequest iSetLicenseReq;
- TVibePacketSetLicenseResponse iSetLicenseRsp;
- };
-
-/**
- * The 1-byte alignment pack pragma definitions pop'ed out of stack.
- */
-#pragma pack( pop )
-
-#endif /* _HWRMHAPTICSVIBEPACKETS_H_ */
-
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/rom/hwrmhapticsvibepacketizerplugin.iby Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* 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: IBY file for the Vibe Packetizer plugin.
-*
-*/
-
-#ifndef HWRMHAPTICSVIBEPACKETIZERPLUGIN_IBY
-#define HWRMHAPTICSVIBEPACKETIZERPLUGIN_IBY
-
-#include <data_caging_paths_for_iby.hrh>
-
-ECOM_PLUGIN(hwrmhapticsvibepacketizerplugin.dll, hwrmhapticsvibepacketizerplugin.rsc)
-
-#endif // HWRMHAPTICSVIBEPACKETIZERPLUGIN_IBY
--- a/hwrmhaptics/hapticspacketizer/plugins/hapticsvibepacketizerplugin/src/hwrmhapticsvibepacketizer.cpp Mon Mar 15 12:45:37 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1905 +0,0 @@
-/*
-* 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: Plugin for handling vibe command packages.
-*
-*/
-
-#include <ecom/implementationproxy.h>
-#include <badesca.h>
-#include <hwrmhaptics.h>
-
-#include "hwrmhapticsvibepacketizer.h"
-#include "hwrmhapticsvibepackets.h"
-#include "hwrmhapticsvibeconstants.h"
-
-// Default request message size (enough for any request message)
-const TInt KMsgDefaultSize = 80;
-
-// const for shifts
-const TInt KShiftByte = 8;
-const TInt KShift2Bytes = 16;
-const TInt KShift3Bytes = 24;
-
-const TInt KArrayElements = 10;
-
-// ---------------------------------------------------------------------------
-// Two phased constructor.
-// ---------------------------------------------------------------------------
-//
-CHWRMHapticsVibePacketizer* CHWRMHapticsVibePacketizer::NewL()
- {
- CHWRMHapticsVibePacketizer* self =
- new ( ELeave ) CHWRMHapticsVibePacketizer();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CHWRMHapticsVibePacketizer::~CHWRMHapticsVibePacketizer()
- {
- iReqBuf.Close();
- iDataBuf.Close();
-
- if( iReturnArray )
- {
- delete iReturnArray;
- iReturnArray = NULL;
- }
- }
-
-// ---------------------------------------------------------------------------
-// Constructor.
-// ---------------------------------------------------------------------------
-//
-CHWRMHapticsVibePacketizer::CHWRMHapticsVibePacketizer()
- : iDeviceHandle( KErrNotFound )
- {
- }
-
-// ---------------------------------------------------------------------------
-// 2nd phase constructor.
-// ---------------------------------------------------------------------------
-//
-void CHWRMHapticsVibePacketizer::ConstructL()
- {
- User::LeaveIfError( iReqBuf.CreateMax( KMsgDefaultSize ) );
- User::LeaveIfError( iDataBuf.CreateMax( KMsgDefaultSize ) );
-
- iReturnArray = new (ELeave) CDesC8ArraySeg( KArrayElements );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncOpenDeviceReq(
- THWRMLogicalActuators aLogicalActuator, RBuf8& aBuffer )
- {
- TVibePacketOpenDeviceRequest* pReq =
- reinterpret_cast<TVibePacketOpenDeviceRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdOpenDevice;
- pReq->iDeviceIndex_7_0 =
- static_cast<TUint8>( aLogicalActuator & 0xFF );
- pReq->iDeviceIndex_15_8 =
- static_cast<TUint8>( ( aLogicalActuator >> KShiftByte ) & 0xFF );
- pReq->iDeviceIndex_23_16 =
- static_cast<TUint8>(
- ( aLogicalActuator >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceIndex_31_24 =
- static_cast<TUint8>(
- ( aLogicalActuator >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof ( TVibePacketOpenDeviceRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncCloseDeviceReq( TInt aDeviceHandle,
- RBuf8& aBuffer )
- {
- TVibePacketCloseDeviceRequest* pReq =
- reinterpret_cast<TVibePacketCloseDeviceRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdCloseDevice;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketCloseDeviceRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayMagSweepEffectReq(
- TInt aDeviceHandle, CHWRMHaptics::THWRMHapticsMagSweepEffect aEffect,
- RBuf8& aBuffer )
- {
- TVibePacketPlayBasisEffectRequest* pReq =
- reinterpret_cast<TVibePacketPlayBasisEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdPlayMagSweepEffect;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDuration_7_0 =
- static_cast<TUint8>( aEffect.iDuration & 0xFF );
- pReq->iDuration_15_8 =
- static_cast<TUint8>( ( aEffect.iDuration >> KShiftByte ) & 0xFF );
- pReq->iDuration_23_16 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift2Bytes ) & 0xFF );
- pReq->iDuration_31_24 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift3Bytes ) & 0xFF );
- pReq->iMagnitude_7_0 =
- static_cast<TUint8>( aEffect.iMagnitude & 0xFF );
- pReq->iMagnitude_15_8 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShiftByte ) & 0xFF );
- pReq->iMagnitude_23_16 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift2Bytes ) & 0xFF );
- pReq->iMagnitude_31_24 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift3Bytes ) & 0xFF );
- pReq->iEffectTypeStyle =
- static_cast<TUint8>( ( aEffect.iStyle << 4 ) & 0xF0 );
- pReq->iPeriod_7_0 = 0x0;
- pReq->iPeriod_15_8 = 0x0;
- pReq->iPeriod_23_16 = 0x0;
- pReq->iPeriod_31_24 = 0x0;
- pReq->iImpulseTime_7_0 =
- static_cast<TUint8>( aEffect.iAttackTime & 0xFF );
- pReq->iImpulseTime_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShiftByte ) & 0xFF );
- pReq->iImpulseTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift3Bytes ) & 0xFF );
- pReq->iImpulseLevel_7_0 =
- static_cast<TUint8>( aEffect.iAttackLevel & 0xFF );
- pReq->iImpulseLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShiftByte ) & 0xFF );
- pReq->iImpulseLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift3Bytes ) & 0xFF );
- pReq->iFadeTime_7_0 =
- static_cast<TUint8>( aEffect.iFadeTime & 0xFF );
- pReq->iFadeTime_15_8 =
- static_cast<TUint8>( ( aEffect.iFadeTime >> KShiftByte ) & 0xFF );
- pReq->iFadeTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift2Bytes ) & 0xFF );
- pReq->iFadeTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift3Bytes ) & 0xFF );
- pReq->iFadeLevel_7_0 =
- static_cast<TUint8>( aEffect.iFadeLevel & 0xFF );
- pReq->iFadeLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShiftByte ) & 0xFF );
- pReq->iFadeLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift2Bytes ) & 0xFF );
- pReq->iFadeLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketPlayBasisEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayPeriodicEffectReq( TInt aDeviceHandle,
- CHWRMHaptics::THWRMHapticsPeriodicEffect aEffect, RBuf8& aBuffer )
- {
- TVibePacketPlayBasisEffectRequest* pReq =
- reinterpret_cast<TVibePacketPlayBasisEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdPlayPeriodicEffect;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDuration_7_0 =
- static_cast<TUint8>( aEffect.iDuration & 0xFF );
- pReq->iDuration_15_8 =
- static_cast<TUint8>( ( aEffect.iDuration >> KShiftByte ) & 0xFF );
- pReq->iDuration_23_16 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift2Bytes ) & 0xFF );
- pReq->iDuration_31_24 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift3Bytes ) & 0xFF );
- pReq->iMagnitude_7_0 =
- static_cast<TUint8>( aEffect.iMagnitude & 0xFF );
- pReq->iMagnitude_15_8 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShiftByte ) & 0xFF );
- pReq->iMagnitude_23_16 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift2Bytes ) & 0xFF );
- pReq->iMagnitude_31_24 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift3Bytes ) & 0xFF );
- pReq->iEffectTypeStyle =
- static_cast<TUint8>( ( ( aEffect.iStyle << 4 ) & 0xF0 ) | 0x01 );
- pReq->iPeriod_7_0 =
- static_cast<TUint8>( aEffect.iPeriod & 0xFF );
- pReq->iPeriod_15_8 =
- static_cast<TUint8>( ( aEffect.iPeriod >> KShiftByte ) & 0xFF );
- pReq->iPeriod_23_16 =
- static_cast<TUint8>( ( aEffect.iPeriod >> KShift2Bytes ) & 0xFF );
- pReq->iPeriod_31_24 =
- static_cast<TUint8>( ( aEffect.iPeriod >> KShift3Bytes ) & 0xFF );
- pReq->iImpulseTime_7_0 =
- static_cast<TUint8>( aEffect.iAttackTime & 0xFF );
- pReq->iImpulseTime_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShiftByte ) & 0xFF );
- pReq->iImpulseTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift3Bytes ) & 0xFF );
- pReq->iImpulseLevel_7_0 =
- static_cast<TUint8>( aEffect.iAttackLevel & 0xFF );
- pReq->iImpulseLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShiftByte ) & 0xFF );
- pReq->iImpulseLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift3Bytes ) & 0xFF );
- pReq->iFadeTime_7_0 =
- static_cast<TUint8>( aEffect.iFadeTime & 0xFF );
- pReq->iFadeTime_15_8 =
- static_cast<TUint8>( ( aEffect.iFadeTime >> KShiftByte ) & 0xFF );
- pReq->iFadeTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift2Bytes ) & 0xFF );
- pReq->iFadeTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift3Bytes ) & 0xFF );
- pReq->iFadeLevel_7_0 =
- static_cast<TUint8>( aEffect.iFadeLevel & 0xFF );
- pReq->iFadeLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShiftByte ) & 0xFF );
- pReq->iFadeLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift2Bytes ) & 0xFF );
- pReq->iFadeLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketPlayBasisEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncModifyPlayingMagSweepEffectReq(
- TInt aDeviceHandle, TInt aEffectHandle,
- CHWRMHaptics::THWRMHapticsMagSweepEffect aEffect, RBuf8& aBuffer )
- {
- TVibePacketModifyBasisEffectRequest* pReq =
- reinterpret_cast<TVibePacketModifyBasisEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdModifyPlayingMagSweepEffect;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDuration_7_0 =
- static_cast<TUint8>( aEffect.iDuration & 0xFF );
- pReq->iDuration_15_8 =
- static_cast<TUint8>( ( aEffect.iDuration >> KShiftByte ) & 0xFF );
- pReq->iDuration_23_16 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift2Bytes ) & 0xFF );
- pReq->iDuration_31_24 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift3Bytes ) & 0xFF );
- pReq->iMagnitude_7_0 =
- static_cast<TUint8>( aEffect.iMagnitude & 0xFF );
- pReq->iMagnitude_15_8 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShiftByte ) & 0xFF );
- pReq->iMagnitude_23_16 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift2Bytes ) & 0xFF );
- pReq->iMagnitude_31_24 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift3Bytes ) & 0xFF );
- pReq->iEffectTypeStyle =
- static_cast<TUint8>( ( aEffect.iStyle << 4 ) & 0xF0 );
- pReq->iPeriod_7_0 = 0x0;
- pReq->iPeriod_15_8 = 0x0;
- pReq->iPeriod_23_16 = 0x0;
- pReq->iPeriod_31_24 = 0x0;
- pReq->iImpulseTime_7_0 =
- static_cast<TUint8>( aEffect.iAttackTime & 0xFF );
- pReq->iImpulseTime_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShiftByte ) & 0xFF );
- pReq->iImpulseTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift3Bytes ) & 0xFF );
- pReq->iImpulseLevel_7_0 =
- static_cast<TUint8>( aEffect.iAttackLevel & 0xFF );
- pReq->iImpulseLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShiftByte ) & 0xFF );
- pReq->iImpulseLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift3Bytes ) & 0xFF );
- pReq->iFadeTime_7_0 =
- static_cast<TUint8>( aEffect.iFadeTime & 0xFF );
- pReq->iFadeTime_15_8 =
- static_cast<TUint8>( ( aEffect.iFadeTime >> KShiftByte ) & 0xFF );
- pReq->iFadeTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift2Bytes ) & 0xFF );
- pReq->iFadeTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift3Bytes ) & 0xFF );
- pReq->iFadeLevel_7_0 =
- static_cast<TUint8>( aEffect.iFadeLevel & 0xFF );
- pReq->iFadeLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShiftByte ) & 0xFF );
- pReq->iFadeLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift2Bytes ) & 0xFF );
- pReq->iFadeLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketModifyBasisEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncModifyPlayingPeriodicEffectReq(
- TInt aDeviceHandle, TInt aEffectHandle,
- CHWRMHaptics::THWRMHapticsPeriodicEffect aEffect, RBuf8& aBuffer )
- {
- TVibePacketModifyBasisEffectRequest* pReq =
- reinterpret_cast<TVibePacketModifyBasisEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdModifyPlayingPeriodicEffect;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDuration_7_0 =
- static_cast<TUint8>( aEffect.iDuration & 0xFF );
- pReq->iDuration_15_8 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShiftByte ) & 0xFF );
- pReq->iDuration_23_16 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift2Bytes ) & 0xFF );
- pReq->iDuration_31_24 =
- static_cast<TUint8>(
- ( aEffect.iDuration >> KShift3Bytes ) & 0xFF );
- pReq->iMagnitude_7_0 =
- static_cast<TUint8>( aEffect.iMagnitude & 0xFF );
- pReq->iMagnitude_15_8 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShiftByte ) & 0xFF );
- pReq->iMagnitude_23_16 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift2Bytes ) & 0xFF );
- pReq->iMagnitude_31_24 =
- static_cast<TUint8>(
- ( aEffect.iMagnitude >> KShift3Bytes ) & 0xFF );
- pReq->iEffectTypeStyle =
- static_cast<TUint8>( ( ( aEffect.iStyle << 4 ) & 0xF0 ) | 0x01 );
- pReq->iPeriod_7_0 =
- static_cast<TUint8>( aEffect.iPeriod & 0xFF );
- pReq->iPeriod_15_8 =
- static_cast<TUint8>( ( aEffect.iPeriod >> KShiftByte ) & 0xFF );
- pReq->iPeriod_23_16 =
- static_cast<TUint8>( ( aEffect.iPeriod >> KShift2Bytes ) & 0xFF );
- pReq->iPeriod_31_24 =
- static_cast<TUint8>( ( aEffect.iPeriod >> KShift3Bytes ) & 0xFF );
- pReq->iImpulseTime_7_0 =
- static_cast<TUint8>( aEffect.iAttackTime & 0xFF );
- pReq->iImpulseTime_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShiftByte ) & 0xFF );
- pReq->iImpulseTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackTime >> KShift3Bytes ) & 0xFF );
- pReq->iImpulseLevel_7_0 =
- static_cast<TUint8>( aEffect.iAttackLevel & 0xFF );
- pReq->iImpulseLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShiftByte ) & 0xFF );
- pReq->iImpulseLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift2Bytes ) & 0xFF );
- pReq->iImpulseLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iAttackLevel >> KShift3Bytes ) & 0xFF );
- pReq->iFadeTime_7_0 =
- static_cast<TUint8>( aEffect.iFadeTime & 0xFF );
- pReq->iFadeTime_15_8 =
- static_cast<TUint8>( ( aEffect.iFadeTime >> KShiftByte ) & 0xFF );
- pReq->iFadeTime_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift2Bytes ) & 0xFF );
- pReq->iFadeTime_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeTime >> KShift3Bytes ) & 0xFF );
- pReq->iFadeLevel_7_0 =
- static_cast<TUint8>( aEffect.iFadeLevel & 0xFF );
- pReq->iFadeLevel_15_8 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShiftByte ) & 0xFF );
- pReq->iFadeLevel_23_16 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift2Bytes ) & 0xFF );
- pReq->iFadeLevel_31_24 =
- static_cast<TUint8>(
- ( aEffect.iFadeLevel >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketModifyBasisEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPausePlayingEffectReq(
- TInt aDeviceHandle, TInt aEffectHandle, RBuf8& aBuffer )
- {
- TVibePacketPausePlayingEffectRequest* pReq =
- reinterpret_cast<TVibePacketPausePlayingEffectRequest*>
- (const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdPausePlayingEffect;
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketPausePlayingEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncResumePausedEffectReq(
- TInt aDeviceHandle, TInt aEffectHandle, RBuf8& aBuffer )
- {
- TVibePacketResumePlayingEffectRequest* pReq =
- reinterpret_cast<TVibePacketResumePlayingEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdResumePausedEffect;
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketResumePlayingEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncStopPlayingEffectReq(
- TInt aDeviceHandle, TInt aEffectHandle, RBuf8& aBuffer )
- {
- TVibePacketStopEffectRequest* pReq =
- reinterpret_cast<TVibePacketStopEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdStopEffect;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketStopEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncStopAllPlayingEffectsReq(
- TInt aDeviceHandle, RBuf8& aBuffer )
- {
- TVibePacketStopAllEffectsRequest* pReq =
- reinterpret_cast<TVibePacketStopAllEffectsRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdStopAllEffects;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketStopAllEffectsRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayEffectIncludeEffectDataReq(
- TInt aDeviceHandle, const TDesC8& aData, TInt aEffectIndex,
- RBuf8& aBuffer )
- {
- iDataBuf.Close();
- TInt err = iDataBuf.Create( aData.Size() + KMsgDefaultSize );
-
- TVibePacketPlayIVTEffectRequest* pReq =
- reinterpret_cast<TVibePacketPlayIVTEffectRequest*>
- ( const_cast<TUint8*>( iDataBuf.Ptr() ) );
-
- if ( !err && pReq &&
- ( ( aData.Size() + KMsgDefaultSize ) <= KVibePacketMaxSize ) )
- {
- pReq->iCmdCode = KVibeCmdPlayIVTEffectIncludeData;
- pReq->iIvtDataSize = aData.Size();
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iIvtIndex_7_0 =
- static_cast<TUint8>( aEffectIndex & 0xFF );
- pReq->iIvtIndex_15_8 =
- static_cast<TUint8>( ( aEffectIndex >> KShiftByte ) & 0xFF );
- pReq->iRepeat = 0x0;
-
- memcpy( pReq->iIvtData, aData.Ptr(), aData.Size() );
-
- // the data buffer length is set to the size of the request packet
- // plus size of the data minus 1 (minus 1, because first byte of the
- // data is already calculated as part of the request packet size).
- iDataBuf.SetLength(
- sizeof( TVibePacketPlayIVTEffectRequest ) + aData.Size() -1 );
- }
- else
- {
- iDataBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iDataBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayEffectRepeatIncludeEffectDataReq(
- TInt aDeviceHandle, const TDesC8& aData, TInt aEffectIndex,
- TUint8 aRepeat, RBuf8& aBuffer )
- {
- iDataBuf.Close();
- TInt err = iDataBuf.Create( aData.Size() + KMsgDefaultSize );
-
- TVibePacketPlayIVTEffectRequest* pReq =
- reinterpret_cast<TVibePacketPlayIVTEffectRequest*>
- ( const_cast<TUint8*>( iDataBuf.Ptr() ) );
-
- if ( !err && pReq &&
- ( ( aData.Size() + KMsgDefaultSize ) <= KVibePacketMaxSize ) )
- {
- pReq->iCmdCode = KVibeCmdPlayIVTEffectIncludeData;
- pReq->iIvtDataSize = aData.Size();
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iIvtIndex_7_0 =
- static_cast<TUint8>( aEffectIndex & 0xFF );
- pReq->iIvtIndex_15_8 =
- static_cast<TUint8>( ( aEffectIndex >> KShiftByte ) & 0xFF );
- pReq->iRepeat = aRepeat;
-
- memcpy( pReq->iIvtData, aData.Ptr(), aData.Size() );
-
- // the data buffer length is set to the size of the request packet
- // plus size of the data minus 1 (minus 1, because first byte of the
- // data is already calculated as part of the request packet size).
- iDataBuf.SetLength(
- sizeof( TVibePacketPlayIVTEffectRequest ) + aData.Size() -1 );
- }
- else
- {
- iDataBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iDataBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayEffectRepeatNoDataReq(
- TInt aDeviceHandle, TInt aEffectIndex, TUint8 aRepeat, RBuf8& aBuffer )
- {
- TVibePacketPlayIVTEffectRequest* pReq =
- reinterpret_cast<TVibePacketPlayIVTEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdPlayIVTEffectNoData;
- pReq->iIvtDataSize = 0x0;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iIvtIndex_7_0 =
- static_cast<TUint8>( aEffectIndex & 0xFF );
- pReq->iIvtIndex_15_8 =
- static_cast<TUint8>( ( aEffectIndex >> KShiftByte ) & 0xFF );
- pReq->iRepeat = aRepeat;
- iReqBuf.SetLength( sizeof( TVibePacketPlayIVTEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayEffectNoDataReq(
- TInt aDeviceHandle, TInt aEffectIndex, RBuf8& aBuffer )
- {
- TVibePacketPlayIVTEffectRequest* pReq =
- reinterpret_cast<TVibePacketPlayIVTEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdPlayIVTEffectNoData;
- pReq->iIvtDataSize = 0x0;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iIvtIndex_7_0 =
- static_cast<TUint8>( aEffectIndex & 0xFF );
- pReq->iIvtIndex_15_8 =
- static_cast<TUint8>( ( aEffectIndex >> KShiftByte ) & 0xFF );
- pReq->iRepeat = 0x0;
- iReqBuf.SetLength( sizeof( TVibePacketPlayIVTEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncCreateStreamingEffectReq(
- TInt aDeviceHandle, RBuf8& aBuffer )
- {
- TVibePacketCreateStreamingEffectRequest* pReq =
- reinterpret_cast<TVibePacketCreateStreamingEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdCreateStreamingEffect;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength(
- sizeof( TVibePacketCreateStreamingEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncDestroyStreamingEffectReq(
- TInt aDeviceHandle, TInt aEffectHandle, RBuf8& aBuffer )
- {
- TVibePacketDestroyStreamingEffectRequest* pReq =
- reinterpret_cast<TVibePacketDestroyStreamingEffectRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdDestroyStreamingEffect;
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength(
- sizeof( TVibePacketDestroyStreamingEffectRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayStreamingSampleReq(
- TInt aDeviceHandle, const TDesC8& aStreamingSample, TInt aEffectHandle,
- RBuf8& aBuffer )
- {
- return EncPlayStreamingSampleInternal( aDeviceHandle,
- aEffectHandle,
- aStreamingSample,
- 0, aBuffer );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayStreamingSampleWithOffsetReq(
- TInt aDeviceHandle, const TDesC8& aStreamingSample, TInt aOffsetTime,
- TInt aEffectHandle, RBuf8& aBuffer )
- {
- return EncPlayStreamingSampleInternal( aDeviceHandle,
- aEffectHandle,
- aStreamingSample,
- aOffsetTime,
- aBuffer );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetEffectStateReq(
- TInt aDeviceHandle, TInt aEffectHandle, RBuf8& aBuffer )
- {
- TVibePacketGetEffectStateRequest* pReq =
- reinterpret_cast<TVibePacketGetEffectStateRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdGetEffectState;
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof( TVibePacketGetEffectStateRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncSetDevicePropertyBoolReq(
- TInt aDeviceHandle, TBool aDevPropValue, TInt aDevPropType,
- RBuf8& aBuffer )
- {
- TVibePacketSetDevicePropertyRequest* pReq =
- reinterpret_cast<TVibePacketSetDevicePropertyRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdSetDeviceProperty;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iPropertyType_7_0 =
- static_cast<TUint8>( aDevPropType & 0xFF );
- pReq->iPropertyType_15_8 =
- static_cast<TUint8>( ( aDevPropType >> KShiftByte ) & 0xFF );
- pReq->iPropertyType_23_16 =
- static_cast<TUint8>( ( aDevPropType >> KShift2Bytes ) & 0xFF );
- pReq->iPropertyType_31_24 =
- static_cast<TUint8>( ( aDevPropType >> KShift3Bytes ) & 0xFF );
- pReq->iPropertyValueType =
- static_cast<TUint8>( KVibeValuetypeBool );
- pReq->iSize = 1; // size of bool data is 1 byte
- pReq->iPropertyValue[0] =
- static_cast<TUint8>( aDevPropValue );
- iReqBuf.SetLength( sizeof( TVibePacketSetDevicePropertyRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncSetDevicePropertyIntReq(
- TInt aDeviceHandle, TInt aDevPropValue, TInt aDevPropType,
- RBuf8& aBuffer )
- {
- TVibePacketSetDevicePropertyRequest* pReq =
- reinterpret_cast<TVibePacketSetDevicePropertyRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdSetDeviceProperty;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iPropertyType_7_0 =
- static_cast<TUint8>( aDevPropType & 0xFF );
- pReq->iPropertyType_15_8 =
- static_cast<TUint8>( ( aDevPropType >> KShiftByte ) & 0xFF );
- pReq->iPropertyType_23_16 =
- static_cast<TUint8>( ( aDevPropType >> KShift2Bytes ) & 0xFF );
- pReq->iPropertyType_31_24 =
- static_cast<TUint8>( ( aDevPropType >> KShift3Bytes ) & 0xFF );
- pReq->iPropertyValueType =
- static_cast<TUint8>( KVibeValuetypeInt32 );
- pReq->iSize = 4; // Size of int32 value is 4 bytes
- pReq->iPropertyValue[0] =
- static_cast<TUint8>( aDevPropValue & 0xFF );
- pReq->iPropertyValue[1] =
- static_cast<TUint8>( ( aDevPropValue >> KShiftByte ) & 0xFF );
- pReq->iPropertyValue[2] =
- static_cast<TUint8>( ( aDevPropValue >> KShift2Bytes ) & 0xFF );
- pReq->iPropertyValue[3] =
- static_cast<TUint8>( ( aDevPropValue >> KShift3Bytes ) & 0xFF );
- // the data buffer length is set to the size of the request packet
- // plus size of the data minus 1. Since int32 type data is always
- // 4 bytes, the extra size needed for data is 3 bytes (4-1).
- iReqBuf.SetLength(
- sizeof( TVibePacketSetDevicePropertyRequest ) +3 );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncSetDevicePropertyStringReq(
- TInt aDeviceHandle, const TDesC8& aDevPropValue, TInt aDevPropType,
- RBuf8& aBuffer )
- {
- iDataBuf.Close();
- TInt err = iDataBuf.Create( aDevPropValue.Size() + KMsgDefaultSize );
-
- TVibePacketSetDevicePropertyRequest* pReq =
- reinterpret_cast<TVibePacketSetDevicePropertyRequest*>
- ( const_cast<TUint8*>( iDataBuf.Ptr() ) );
-
- if ( !err && pReq &&
- ( ( aDevPropValue.Size() + KMsgDefaultSize ) <= KVibePacketMaxSize ) )
- {
- pReq->iCmdCode = KVibeCmdSetDeviceProperty;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iPropertyType_7_0 =
- static_cast<TUint8>( aDevPropType & 0xFF );
- pReq->iPropertyType_15_8 =
- static_cast<TUint8>( ( aDevPropType >> KShiftByte ) & 0xFF );
- pReq->iPropertyType_23_16 =
- static_cast<TUint8>( ( aDevPropType >> KShift2Bytes ) & 0xFF );
- pReq->iPropertyType_31_24 =
- static_cast<TUint8>( ( aDevPropType >> KShift3Bytes ) & 0xFF );
- pReq->iPropertyValueType =
- static_cast<TUint8>( KVibeValuetypeString );
- pReq->iSize =
- static_cast<TUint8>( aDevPropValue.Size() );
-
- memcpy ( pReq->iPropertyValue,
- reinterpret_cast<TUint8*>(
- const_cast<TUint8*>( aDevPropValue.Ptr() ) ),
- aDevPropValue.Size() );
-
- // the data buffer length is set to the size of the request packet
- // plus size of the data minus 1 (minus 1, because first byte of the
- // data is already calculated as part of the request packet size).
- iDataBuf.SetLength(
- sizeof( TVibePacketSetDevicePropertyRequest ) + pReq->iSize -1 );
- }
- else
- {
- iDataBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iDataBuf );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncSetPlatformLicenseKeyReq(
- TInt aDeviceHandle, RBuf8& aBuffer )
- {
- TInt ret = EncSetDevicePropertyStringReq( aDeviceHandle, KNullDesC8,
- CHWRMHaptics::EHWRMHapticsLicensekey,
- aBuffer );
-
- // change the command id from general device property to setting
- // license key
- if ( ret == KErrNone )
- {
- TVibePacketSetDevicePropertyRequest* tmpReq =
- reinterpret_cast<TVibePacketSetDevicePropertyRequest*>
- ( const_cast<TUint8*>( aBuffer.Ptr() ) );
-
- if ( tmpReq )
- {
- tmpReq->iCmdCode = KVibeCmdSetLicense;
- }
- }
-
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetDevicePropertyBoolReq(
- TInt aDeviceHandle, TInt aDevPropType, RBuf8& aBuffer )
- {
- return EncGetDevicePropertyReqInternal(
- KVibeValuetypeBool, aDeviceHandle, aDevPropType, aBuffer );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetDevicePropertyIntReq(
- TInt aDeviceHandle, TInt aDevPropType, RBuf8& aBuffer )
- {
- return EncGetDevicePropertyReqInternal(
- KVibeValuetypeInt32, aDeviceHandle, aDevPropType, aBuffer );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetDevicePropertyStringReq(
- TInt aDeviceHandle, TInt aDevPropType, RBuf8& aBuffer )
- {
- return EncGetDevicePropertyReqInternal(
- KVibeValuetypeString, aDeviceHandle, aDevPropType, aBuffer );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetDeviceCapabilityIntReq(
- TInt aDeviceHandle, TInt aDevCapType, RBuf8& aBuffer )
- {
- return EncGetDeviceCapabilityReqInternal( KVibeValuetypeInt32,
- aDeviceHandle,
- aDevCapType,
- aBuffer );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetDeviceCapabilityStringReq(
- TInt aDeviceHandle, TInt aDevCapType, RBuf8& aBuffer )
- {
- return EncGetDeviceCapabilityReqInternal( KVibeValuetypeString,
- aDeviceHandle,
- aDevCapType,
- aBuffer );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDesC8ArraySeg* CHWRMHapticsVibePacketizer::DecodeMessageL(
- const TDesC8& aData, TInt& aStatus )
- {
- // Clear Array before use
- iReturnArray->Reset();
-
- TVibePacket* pRsp =
- reinterpret_cast<TVibePacket*>( const_cast<TUint8*>( aData.Ptr() ) );
-
- switch( pRsp->iSimpleRsp.iCmdCode )
- {
- case KVibeCmdOpenDevice:
- {
- aStatus = pRsp->iOpenDeviceRsp.iVibeStatus;
- iDeviceHandle =
- pRsp->iOpenDeviceRsp.iDeviceHandle_7_0 |
- pRsp->iOpenDeviceRsp.iDeviceHandle_15_8 << KShiftByte |
- pRsp->iOpenDeviceRsp.iDeviceHandle_23_16 << KShift2Bytes |
- pRsp->iOpenDeviceRsp.iDeviceHandle_31_24 << KShift3Bytes;
-
- TPckg<TInt> deviceHandlePckg( iDeviceHandle );
-
- iReturnArray->AppendL( deviceHandlePckg );
- break;
- }
-
- case KVibeCmdCloseDevice:
- {
- aStatus = pRsp->iCloseDeviceRsp.iVibeStatus;
- iDeviceHandle = KErrNotFound;
- break;
- }
-
- case KVibeCmdSetDeviceProperty: // flow through
- case KVibeCmdSetLicense:
- {
- aStatus = pRsp->iSetDevicePropertyRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdGetDeviceProperty:
- {
- TInt propertyValueType =
- pRsp->iGetDevicePropertyRsp.iPropertyValueType;
-
- switch( propertyValueType )
- {
- case KVibeValuetypeBool:
- {
- aStatus = pRsp->iGetDevicePropertyRsp.iVibeStatus;
-
- TUint8* intArr =
- pRsp->iGetDevicePropertyRsp.iPropertyValue;
-
- TUint value = ( TUint( intArr[0] ) );
- TPckg<TBool> devicePropertyValuePckg( value );
-
- iReturnArray->AppendL( devicePropertyValuePckg );
- break;
- }
- case KVibeValuetypeInt32:
- {
- aStatus = pRsp->iGetDevicePropertyRsp.iVibeStatus;
-
- TUint8* intArr =
- pRsp->iGetDevicePropertyRsp.iPropertyValue;
-
- TUint value = ( TUint( intArr[0] ) )
- | ( TUint( intArr[1] ) << KShiftByte )
- | ( TUint( intArr[2] ) << KShift2Bytes )
- | ( TUint( intArr[3] ) << KShift3Bytes );
- TPckg<TInt> devicePropertyValuePckg( value );
-
- iReturnArray->AppendL( devicePropertyValuePckg );
- break;
- }
-
- case KVibeValuetypeString:
- {
- aStatus = pRsp->iGetDevicePropertyRsp.iVibeStatus;
- TInt stringSize = pRsp->iGetDevicePropertyRsp.iSize;
-
- if( stringSize > MaxPropertyStringLength() )
- {
- // truncate string if too long
- stringSize = MaxPropertyStringLength();
- }
-
- TUint8* text = reinterpret_cast<TUint8*>(
- pRsp->iGetDevicePropertyRsp.iPropertyValue );
- TPtrC8 ptr( text, stringSize );
-
- iReturnArray->AppendL( ptr );
- break;
- }
- default:
- break;
- }// switch
- break;
- }
-
- case KVibeCmdPlayMagSweepEffect: // flow through
- case KVibeCmdPlayPeriodicEffect:
- {
- aStatus = pRsp->iPlayBasisEffectRsp.iVibeStatus;
- TInt effectHandle =
- pRsp->iPlayBasisEffectRsp.iEffectHandle_7_0 |
- pRsp->iPlayBasisEffectRsp.iEffectHandle_15_8 << KShiftByte |
- pRsp->iPlayBasisEffectRsp.iEffectHandle_23_16 << KShift2Bytes |
- pRsp->iPlayBasisEffectRsp.iEffectHandle_31_24 << KShift3Bytes;
-
- TPckg<TInt> effectHandlePckg( effectHandle );
- iReturnArray->AppendL( effectHandlePckg );
- break;
- }
-
- case KVibeCmdPlayIVTEffectIncludeData: // flow through
- case KVibeCmdPlayIVTEffectNoData:
- {
- aStatus = pRsp->iPlayIVTEffectRsp.iVibeStatus;
- TInt effectHandle =
- pRsp->iPlayIVTEffectRsp.iEffectHandle_7_0 |
- pRsp->iPlayIVTEffectRsp.iEffectHandle_15_8 << KShiftByte |
- pRsp->iPlayIVTEffectRsp.iEffectHandle_23_16 << KShift2Bytes |
- pRsp->iPlayIVTEffectRsp.iEffectHandle_31_24 << KShift3Bytes;
-
- TPckg<TInt> effectHandlePckg( effectHandle );
- iReturnArray->AppendL( effectHandlePckg );
- break;
- }
-
- case KVibeCmdModifyPlayingMagSweepEffect: // flow through
- case KVibeCmdModifyPlayingPeriodicEffect:
- {
- aStatus = pRsp->iModifyBasisEffectRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdStopEffect:
- {
- aStatus = pRsp->iStopEffectRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdStopAllEffects:
- {
- aStatus = pRsp->iStopAllEffectsRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdGetDeviceCapabilities:
- {
- TInt capabilityValueType =
- pRsp->iGetDeviceCapsRsp.iCapabilityValueType;
-
- switch( capabilityValueType )
- {
- case KVibeValuetypeInt32:
- {
- aStatus = pRsp->iGetDeviceCapsRsp.iVibeStatus;
- TUint8* intArr =
- pRsp->iGetDeviceCapsRsp.iCapabilityValue;
-
- TUint value = ( TUint( intArr[0] ) )
- | ( TUint( intArr[1] ) << KShiftByte )
- | ( TUint( intArr[2] ) << KShift2Bytes )
- | ( TUint( intArr[3] ) << KShift3Bytes );
-
- TPckg<TInt> deviceCapabilityValuePckg( value );
- iReturnArray->AppendL( deviceCapabilityValuePckg );
- break;
- }
-
- case KVibeValuetypeString:
- {
- aStatus = pRsp->iGetDeviceCapsRsp.iVibeStatus;
- TUint8* text =
- reinterpret_cast<TUint8*>(
- pRsp->iGetDeviceCapsRsp.iCapabilityValue );
- TInt stringSize ( pRsp->iGetDeviceCapsRsp.iSize );
-
- if( stringSize > MaxCapabilityStringLength() )
- {
- // truncate string if too long
- stringSize = MaxCapabilityStringLength();
- }
- TPtrC8 ptr( text, stringSize );
-
- iReturnArray->AppendL( ptr );
- break;
- }
- default:
- break;
- }// switch
- break;
- }
-
- case KVibeCmdPlayStreamingSample:
- {
- aStatus = pRsp->iPlayStreamingSampleRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdCreateStreamingEffect:
- {
- aStatus = pRsp->iCreateStreamingEffectRsp.iVibeStatus;
-
- TInt effectHandle =
- pRsp->iCreateStreamingEffectRsp.iEffectHandle_7_0 |
- pRsp->iCreateStreamingEffectRsp.iEffectHandle_15_8
- << KShiftByte |
- pRsp->iCreateStreamingEffectRsp.iEffectHandle_23_16
- << KShift2Bytes |
- pRsp->iCreateStreamingEffectRsp.iEffectHandle_31_24
- << KShift3Bytes;
-
- TPckg<TInt> effectHandlePckg( effectHandle );
- iReturnArray->AppendL( effectHandlePckg );
- break;
- }
-
- case KVibeCmdDestroyStreamingEffect:
- {
- aStatus = pRsp->iDestroyStreamingEffectRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdPausePlayingEffect:
- {
- aStatus = pRsp->iPausePlayingEffectRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdResumePausedEffect:
- {
- aStatus = pRsp->iResumePausedEffectRsp.iVibeStatus;
- break;
- }
-
- case KVibeCmdGetEffectState:
- {
- aStatus = pRsp->iGetEffectStateRsp.iVibeStatus;
- TInt effectState = pRsp->iGetEffectStateRsp.iEffectState;
-
- TPckg<TInt> effectStatePckg( effectState );
- iReturnArray->AppendL( effectStatePckg );
- break;
- }
-
- default:
- User::Leave( KErrGeneral );
- }
-
- // convert vibe error code to Symbian error code
- aStatus = MapError( aStatus );
-
- return iReturnArray;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::DeviceHandle()
- {
- return iDeviceHandle;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::InfiniteRepeat()
- {
- return static_cast<TInt>( KVibeRepeatCountInfinite );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::InfiniteDuration()
- {
- return KVibeTimeInfinite;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::MaxEffectNameLength()
- {
- return KVibeMaxEffectNameLength;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::MaxDeviceNameLength()
- {
- return KVibeMaxDeviceNameLength;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::MaxCapabilityStringLength()
- {
- return KVibeMaxCapabilityStringLength;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::MaxPropertyStringLength()
- {
- return KVibeMaxPropertyStringLength;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::MaxStreamingSampleSize()
- {
- return KVibeMaxStreamingSampleSize;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::DefaultDevicePriority()
- {
- return KVibeDevicePriorityDefault;
- }
-
-// ---------------------------------------------------------------------------
-// Internal helper method. Fills Get Device Capability request data.
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetDeviceCapabilityReqInternal(
- TInt aValueType, TInt aDeviceHandle, TInt aDevCapType, RBuf8& aBuffer )
- {
- TVibePacketGetDeviceCapabilitiesRequest* pReq =
- reinterpret_cast<TVibePacketGetDeviceCapabilitiesRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdGetDeviceCapabilities;
- pReq->iCapabilityValueType =
- static_cast<TUint8>( aValueType );
- pReq->iDeviceIndex_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceIndex_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceIndex_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceIndex_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iCapabilityType_7_0 =
- static_cast<TUint8>( aDevCapType & 0xFF );
- pReq->iCapabilityType_15_8 =
- static_cast<TUint8>( ( aDevCapType >> KShiftByte ) & 0xFF );
- pReq->iCapabilityType_23_16 =
- static_cast<TUint8>( ( aDevCapType >> KShift2Bytes ) & 0xFF );
- pReq->iCapabilityType_31_24 =
- static_cast<TUint8>( ( aDevCapType >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength(
- sizeof ( TVibePacketGetDeviceCapabilitiesRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-// Internal helper method. Fills Get Device Property request data.
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncGetDevicePropertyReqInternal(
- TInt aValueType, TInt aDeviceHandle, TInt aDevPropType, RBuf8& aBuffer )
- {
- TVibePacketGetDevicePropertyRequest* pReq =
- reinterpret_cast<TVibePacketGetDevicePropertyRequest*>
- ( const_cast<TUint8*>( iReqBuf.Ptr() ) );
-
- if ( pReq )
- {
- pReq->iCmdCode = KVibeCmdGetDeviceProperty;
- pReq->iPropertyValueType =
- static_cast<TUint8>( aValueType );
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iPropertyType_7_0 =
- static_cast<TUint8>( aDevPropType & 0xFF );
- pReq->iPropertyType_15_8 =
- static_cast<TUint8>( ( aDevPropType >> KShiftByte ) & 0xFF );
- pReq->iPropertyType_23_16 =
- static_cast<TUint8>( ( aDevPropType >> KShift2Bytes ) & 0xFF );
- pReq->iPropertyType_31_24 =
- static_cast<TUint8>( ( aDevPropType >> KShift3Bytes ) & 0xFF );
- iReqBuf.SetLength( sizeof ( TVibePacketGetDevicePropertyRequest ) );
- }
- else
- {
- iReqBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iReqBuf );
- }
-
-// ---------------------------------------------------------------------------
-// Internal helper method. Fills Play Streaming Sample request data.
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::EncPlayStreamingSampleInternal(
- TInt aDeviceHandle, TInt aEffectHandle, const TDesC8& aStreamingSample,
- TInt aOffsetTime, RBuf8& aBuffer )
- {
- iDataBuf.Close();
- TInt err = iDataBuf.Create( aStreamingSample.Size() + KMsgDefaultSize );
-
- TVibePacketPlayStreamingSampleRequest* pReq =
- reinterpret_cast<TVibePacketPlayStreamingSampleRequest*>
- ( const_cast<TUint8*>( iDataBuf.Ptr() ) );
-
- if ( !err && pReq &&
- ( ( aStreamingSample.Size() + KMsgDefaultSize ) <=
- KVibePacketMaxSize ) )
- {
- pReq->iCmdCode = KVibeCmdPlayStreamingSample;
- pReq->iDeviceHandle_7_0 =
- static_cast<TUint8>( aDeviceHandle & 0xFF );
- pReq->iDeviceHandle_15_8 =
- static_cast<TUint8>( ( aDeviceHandle >> KShiftByte ) & 0xFF );
- pReq->iDeviceHandle_23_16 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift2Bytes ) & 0xFF );
- pReq->iDeviceHandle_31_24 =
- static_cast<TUint8>( ( aDeviceHandle >> KShift3Bytes ) & 0xFF );
- pReq->iEffectHandle_7_0 =
- static_cast<TUint8>( aEffectHandle & 0xFF );
- pReq->iEffectHandle_15_8 =
- static_cast<TUint8>( ( aEffectHandle >> KShiftByte ) & 0xFF );
- pReq->iEffectHandle_23_16 =
- static_cast<TUint8>( ( aEffectHandle >> KShift2Bytes ) & 0xFF );
- pReq->iEffectHandle_31_24 =
- static_cast<TUint8>( ( aEffectHandle >> KShift3Bytes ) & 0xFF );
- pReq->iSize = static_cast<TUint8>( aStreamingSample.Size() );
- pReq->iEffectOffsetTime_7_0 =
- static_cast<TUint8>( aOffsetTime & 0xFF );
- pReq->iEffectOffsetTime_15_8 =
- static_cast<TUint8>( ( aOffsetTime >> KShiftByte ) & 0xFF );
-
- memcpy( pReq->iStreamingData,
- reinterpret_cast<TUint8*>(
- const_cast<TUint8*>( aStreamingSample.Ptr() ) ),
- aStreamingSample.Size() );
-
- iDataBuf.SetLength(
- sizeof ( TVibePacketPlayStreamingSampleRequest )
- + aStreamingSample.Size() -1 );
- }
- else
- {
- iDataBuf.SetLength( 0 );
- }
-
- return aBuffer.Create( iDataBuf );
- }
-
-// ---------------------------------------------------------------------------
-// Maps Vibe error code to Symbian error code.
-// ---------------------------------------------------------------------------
-//
-TInt CHWRMHapticsVibePacketizer::MapError( TInt aVibeError )
- {
- TInt error = KErrNone;
-
- switch ( aVibeError )
- {
- case KVibeErrAlreadyInitialized:
- {
- error = KErrAlreadyExists;
- break;
- }
-
- case KVibeErrNotInitialized:
- {
- error = KErrNotReady;
- break;
- }
-
- case KVibeWarningNotPlaying: // flow through
- case KVibeErrInvalidArgument:
- {
- error = KErrArgument;
- break;
- }
-
- case KVibeErrFail:
- {
- error = KErrGeneral;
- break;
- }
-
- case KVibeErrIncompatibleEffectType: // flow through
- case KVibeErrIncompatibleCapabilityType: // flow through
- case KVibeErrIncompatiblePropertyType:
- {
- error = KErrNotSupported;
- break;
- }
-
- case KVibeErrDeviceNeedsLicense:
- {
- error = KErrAccessDenied;
- break;
- }
-
- case KVibeErrNotEnoughMemory:
- {
- error = KErrNoMemory;
- break;
- }
-
- case KVibeErrServiceNotRunning:
- {
- error = KErrNotReady;
- break;
- }
-
- case KVibeErrInsufficientPriority:
- {
- error = KErrAccessDenied;
- break;
- }
-
- case KVibeErrServiceBusy:
- {
- error = KErrInUse;
- break;
- }
-
- case KVibeStatusSuccess:
- {
- error = KErrNone;
- break;
- }
-
- default:
- {
- // All the warning codes, except KVibeWarningNotPlaying
- // are handled here. Thus they are converted to KErrNone.
- break;
- }
- }
-
- return error;
- }
-
-// ---------------------------------------------------------------------------
-// ImplementationTable[]
-// ---------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( 0x20021207, CHWRMHapticsVibePacketizer::NewL )
- };
-
-// ---------------------------------------------------------------------------
-// TImplementationProxy* ImplementationGroupProxy()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
- {
- aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
- return ImplementationTable;
- }
-
-// End of file
--- a/mediator/inc/Client/MediatorCommandInitiatorBody.h Mon Mar 15 12:45:37 2010 +0200
+++ b/mediator/inc/Client/MediatorCommandInitiatorBody.h Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 - 2010 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"
@@ -93,6 +93,11 @@
* From CActive::DoCancel()
*/
void DoCancel();
+
+ /**
+ * From CActive::RunError()
+ */
+ TInt RunError( TInt aError );
private: // new functions
/**
--- a/mediator/inc/Client/MediatorCommandResponderBody.h Mon Mar 15 12:45:37 2010 +0200
+++ b/mediator/inc/Client/MediatorCommandResponderBody.h Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 - 2010 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"
@@ -153,6 +153,11 @@
* From CActive::DoCancel()
*/
void DoCancel();
+
+ /**
+ * From CActive::RunError()
+ */
+ TInt RunError( TInt aError );
private: // new functions
--- a/mediator/inc/Client/MediatorEventConsumerBody.h Mon Mar 15 12:45:37 2010 +0200
+++ b/mediator/inc/Client/MediatorEventConsumerBody.h Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 - 2010 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"
@@ -121,6 +121,11 @@
* From CActive::DoCancel()
*/
void DoCancel();
+
+ /**
+ * From CActive::RunError()
+ */
+ TInt RunError( TInt aError );
private: // New functions
--- a/mediator/src/Client/MediatorCommandInitiatorBody.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/mediator/src/Client/MediatorCommandInitiatorBody.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 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"
@@ -172,6 +172,23 @@
}
// -----------------------------------------------------------------------------
+// CMediatorCommandInitiatorBody::RunError
+// This will be called when there is a leave from ResetDataBufferL() or CommandResponseL() from RunL
+//
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CMediatorCommandInitiatorBody::RunError( TInt aError )
+#else
+TInt CMediatorCommandInitiatorBody::RunError( TInt /*aError*/ )
+#endif //_DEBUG
+ {
+ ERROR_TRACE(Print(_L("[Mediator Server]\t CMediatorCommandInitiatorBody::RunError called with Error %d\n"), aError ));
+ //Ignore the error.
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
// CMediatorCommandInitiatorBody::WaitForCommandResponse
//
// (other items were commented in a header).
--- a/mediator/src/Client/MediatorCommandResponderBody.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/mediator/src/Client/MediatorCommandResponderBody.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 - 2010 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"
@@ -162,6 +162,23 @@
StartCommandReceiving();
}
+
+// -----------------------------------------------------------------------------
+// CMediatorCommandResponderBody::RunError
+// This will be called when there is a leave from ResetDataBufferL()
+//
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CMediatorCommandResponderBody::RunError( TInt aError )
+#else
+TInt CMediatorCommandResponderBody::RunError( TInt /*aError*/ )
+#endif //_DEBUG
+ {
+ ERROR_TRACE(Print(_L("[Mediator Server]\t CMediatorCommandResponderBody::RunError called with Error %d\n"), aError ));
+ //Ignore the error
+ return KErrNone;
+ }
// -----------------------------------------------------------------------------
// CMediatorCommandResponderBody::RegisterCommandL
--- a/mediator/src/Client/MediatorEventConsumerBody.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/mediator/src/Client/MediatorEventConsumerBody.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 - 2010 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"
@@ -120,7 +120,24 @@
}
StartEventReceiving();
}
-
+
+// -----------------------------------------------------------------------------
+// CMediatorEventConsumerBody::RunError
+// This will be called when there is a leave from ResetDataBufferL() and MediatorEventL() of RunL()
+//
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CMediatorEventConsumerBody::RunError( TInt aError )
+#else
+TInt CMediatorEventConsumerBody::RunError( TInt /*aError*/ )
+#endif //_DEBUG
+ {
+ ERROR_TRACE(Print(_L("[Mediator Server]\t CMediatorEventConsumerBody::RunError called with Error %d\n"), aError ));
+ //Ignore the error
+ return KErrNone;
+ }
+
// -----------------------------------------------------------------------------
// CMediatorEventConsumerBody::DoCancel
//
--- a/resourcemgmt/hwrmfmtxwatcherplugin/src/hwrmfmtxusbobserver.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/resourcemgmt/hwrmfmtxwatcherplugin/src/hwrmfmtxusbobserver.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -33,7 +33,7 @@
INFO_LOG1( "UsbConnected - %d", aDeviceState);
if ( aDeviceState == EUsbDeviceStateAttached || aDeviceState == EUsbDeviceStatePowered ||
- aDeviceState == EUsbDeviceStateUndefined)
+ aDeviceState == EUsbDeviceStateUndefined || aDeviceState == EUsbDeviceStateSuspended )
{
RDebug::Print(_L("return false "));
return EFalse;
--- a/sensorservices/sensorserver/src/server/sensrvpluginproxy.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/sensorservices/sensorserver/src/server/sensrvpluginproxy.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -30,6 +30,10 @@
#include "sensrvclientserver.h"
#include "sensrvthreadmonitor.h"
#include "sensrvchanneldatareader.h"
+#include <e32std.h>
+#include <e32cmn.h>
+
+
// ---------------------------------------------------------------------------
// 2-phase constructor
@@ -251,14 +255,13 @@
{
buf->Des().AppendNum(iProxyManager.GenerateUniqueId());
+
err = iSsyThread.Create(*buf,
SsyThreadFunction,
ProxyManager().SsyStackSize(),
- KSensrvSsyHeapInitialSize,
- ProxyManager().SsyHeapMaxSize(),
+ NULL,
(TAny*)this);
-
if (err == KErrAlreadyExists)
{
COMPONENT_TRACE( ( _L( "Sensor Server - CSensrvPluginProxy::InitializePluginL - Thread name is already in use, recreating..." ) ) );
Binary file sensorservices/sensorserver/tsrc/sensorsrvtest/SensorTestModule/cenrepsample/1020507E.txt has changed
Binary file sensorservices/sensorserver/tsrc/sensorsrvtest/SensorTestModule/cenrepsample/10282DEE.txt has changed
--- a/sysstatemgmt/ssmpolicyplugins/ssmshutdownpolicy/group/ssmshutdownpolicy.mmp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/ssmpolicyplugins/ssmshutdownpolicy/group/ssmshutdownpolicy.mmp Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 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"
@@ -45,6 +45,7 @@
LIBRARY ssmpolicybase.lib
LIBRARY ssmstatepolicybase.lib
LIBRARY ssmmapperutility.lib
+LIBRARY ssmuiproviderdll.lib
// >>> uncomment to enable function-level tracing
// MACRO __SSM_FUNC_TRACE__
--- a/sysstatemgmt/ssmpolicyplugins/ssmshutdownpolicy/src/ssmshutdownpolicy.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/ssmpolicyplugins/ssmshutdownpolicy/src/ssmshutdownpolicy.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 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"
@@ -21,6 +21,7 @@
#include <ssm/ssmstatetransition.h>
#include <ssm/starterclient.h>
#include <ssm/starterdomaincrkeys.h>
+#include <ssm/ssmuiproviderdll.h>
#include "ssmsubstateext.hrh"
#include "ssmmapperutility.h"
@@ -215,6 +216,22 @@
CRepository::NewLC( iUtil->CrUid( KCRUidStartup ) );
TInt errorCode = repository->Set( KStartupReason, aReasonCode );
ERROR( errorCode, "Failed to set KStartupReason CenRep key" );
+
+ if( KErrDiskFull == errorCode )
+ {
+ //Need not to put on CleanupStack, it's not calling any leaving function and
+ //it's handled by reference count
+ CSsmUiSpecific* ssmUiSpecific = CSsmUiSpecific::InstanceL();
+ //Free complete reserve space
+ errorCode = ssmUiSpecific->FreeReservedPhoneMemorySpace( 0 );
+ if( KErrNone == errorCode )
+ {
+ errorCode = repository->Set( KStartupReason, aReasonCode );
+ ERROR( errorCode, "Failed to set KStartupReason CenRep key after freeing the memory" );
+ }
+ CSsmUiSpecific::Release();
+ }
+
CleanupStack::PopAndDestroy( repository );
User::LeaveIfError( errorCode );
}
--- a/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereaderimpl.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereaderimpl.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -801,6 +801,12 @@
inProgress = EFalse;
break;
}
+ else if((iCommandIndexInRssFile[iCurrentCommandListInMapping] == 0))
+ {
+ //The current commandlist is empty
+ //go to the next commandlist in the mapping.
+ continue;
+ }
else
{
//open the next resource id and read the commands
--- a/sysstatemgmt/systemstatemgr/ssm/group/ssmserver.mmp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/ssm/group/ssmserver.mmp Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -59,6 +59,7 @@
LIBRARY estor.lib //used by ssmclecli.lib
LIBRARY ssmcmd.lib //used by ssmclecli.lib
LIBRARY ssmcmn.lib
+LIBRARY ssmuiproviderdll.lib
STATICLIBRARY ssmclecli.lib
STATICLIBRARY ssmclesrv.lib //used by ssmclecli.lib
--- a/sysstatemgmt/systemstatemgr/ssm/inc/ssmserver.h Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/ssm/inc/ssmserver.h Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -25,6 +25,7 @@
class CSsmSwpRequestHandler;
class CSsmSwpPolicyResolver;
class CCleSessionProxy;
+class CSsmUiSpecific;
/**
Implements the API used to request changes to the
@@ -78,6 +79,7 @@
CSsmSwpRequestHandler* iSwpRequestHandler;
CSsmSwpPolicyResolver* iSwpResolver;
CCleSessionProxy* iSwpCleSession;
+ CSsmUiSpecific* iSsmUiSpecific;
};
#endif
--- a/sysstatemgmt/systemstatemgr/ssm/src/ssmserver.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/ssm/src/ssmserver.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 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"
@@ -16,6 +16,7 @@
#include <ssm/ssmstates.hrh>
#include <ssm/ssmstatetransition.h>
#include <ssm/ssmstatepolicy.h>
+#include <ssm/ssmuiproviderdll.h>
#include "ssmserverpanic.h"
#include "ssmserver.h"
@@ -29,6 +30,7 @@
#include "ssmstatepolicyframe.h"
#include "ssmswppolicyresolver.h"
#include "ssmswprequesthandler.h"
+#include "ssmdebug.h"
// ------------------- Policy Server Security Setup ----------------------
@@ -86,7 +88,11 @@
{
iSwpCleSession->ReleaseCle();
}
-
+
+ if(iSsmUiSpecific)
+ {
+ iSsmUiSpecific->Release();
+ }
} //lint !e529 not subsequently referenced
/**
@@ -134,6 +140,10 @@
__ASSERT_ALWAYS( KErrNone == User::SetCritical(User::ESystemCritical), PanicNow(KPanicSysStateMgr,ESsmServerError1));
__ASSERT_ALWAYS( KErrNone == User::RenameThread(KSsmServerName), PanicNow(KPanicSysStateMgr,ESsmServerError2));
+ iSsmUiSpecific = CSsmUiSpecific::InstanceL();
+ //Reserve memory for critical operation especially when phone memory will be full
+ TInt err = iSsmUiSpecific->ReservePhoneMemorySpace();
+ DEBUGPRINT2(_L("CSsmUiSpecific::ReservePhoneMemorySpace returned with = %d"), err);
// --- Instantiate the "System State" handling classes ---
// Create a state policy resolver and load the initial policy
CSsmStatePolicyResolver* stateResolver = CSsmStatePolicyResolver::NewLC();
--- a/sysstatemgmt/systemstatemgr/test/tssm/group/tssm_server.mmp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/test/tssm/group/tssm_server.mmp Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -138,6 +138,7 @@
LIBRARY featmgr.lib
LIBRARY centralrepository.lib
LIBRARY conditionevaluator.lib
+LIBRARY ssmuiproviderdll.lib
STATICLIBRARY ssmclecli.lib
STATICLIBRARY ssmclesrv.lib //used by ssmclecli.lib
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/bwins/ssmuiproviderdllswitchu.def Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/bwins/ssmuiproviderdllswitchu.def Wed Mar 31 23:31:40 2010 +0300
@@ -26,3 +26,5 @@
call_vector_25 @ 25 NONAME
call_vector_26 @ 26 NONAME
call_vector_27 @ 27 NONAME
+ call_vector_28 @ 28 NONAME
+ call_vector_29 @ 29 NONAME
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/bwins/ssmuiproviderdllu.def Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/bwins/ssmuiproviderdllu.def Wed Mar 31 23:31:40 2010 +0300
@@ -26,3 +26,5 @@
?ValidateRTCPropertyKey@CSsmUiSpecific@@SAIXZ @ 25 NONAME ; unsigned int CSsmUiSpecific::ValidateRTCPropertyKey(void)
?ValidateRTCPropertyCategory@CSsmUiSpecific@@SA?AVTUid@@XZ @ 26 NONAME ; class TUid CSsmUiSpecific::ValidateRTCPropertyCategory(void)
?PhoneMemoryRootDriveId@CSsmUiSpecific@@SAHXZ @ 27 NONAME ; int CSsmUiSpecific::PhoneMemoryRootDriveId(void)
+ ?ReservePhoneMemorySpace@CSsmUiSpecific@@QAEHXZ @ 28 NONAME ; int CSsmUiSpecific::ReservePhoneMemorySpace(void)
+ ?FreeReservedPhoneMemorySpace@CSsmUiSpecific@@QAEHH@Z @ 29 NONAME ; int CSsmUiSpecific::FreeReservedPhoneMemorySpace(int)
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/eabi/ssmuiproviderdllu.def Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/eabi/ssmuiproviderdllu.def Wed Mar 31 23:31:40 2010 +0300
@@ -28,3 +28,5 @@
_ZN14CSsmUiSpecific22ValidateRTCPropertyKeyEv @ 27 NONAME
_ZN14CSsmUiSpecific27ValidateRTCPropertyCategoryEv @ 28 NONAME
_ZN14CSsmUiSpecific22PhoneMemoryRootDriveIdEv @ 29 NONAME
+ _ZN14CSsmUiSpecific23ReservePhoneMemorySpaceEv @ 30 NONAME
+ _ZN14CSsmUiSpecific28FreeReservedPhoneMemorySpaceEi @ 31 NONAME
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/group/ssmuiproviderdlldefault.mmp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/group/ssmuiproviderdlldefault.mmp Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -44,5 +44,6 @@
OS_LAYER_SYSTEMINCLUDE_SYMBIAN
LIBRARY euser.lib
+LIBRARY efsrv.lib
SMPSAFE
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/inc/ssmuiproviderdll.h Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/inc/ssmuiproviderdll.h Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -25,6 +25,7 @@
#include <e32def.h>
#include <e32cmn.h>
#include <e32base.h>
+#include <f32file.h>
class CSsmUiSpecific : public CBase
{
@@ -56,12 +57,17 @@
IMPORT_C static TUint ValidateRTCPropertyKey();
IMPORT_C static TUid ValidateRTCPropertyCategory();
IMPORT_C static TInt PhoneMemoryRootDriveId();
+ IMPORT_C TInt ReservePhoneMemorySpace();
+ IMPORT_C TInt FreeReservedPhoneMemorySpace(const TInt aSpaceToFree);
private:
CSsmUiSpecific();
+ void ConstructL();
private:
TStrtSecurityStatus iStrtSecurityStatus;
TInt iReferenceCount;
+ RFs iReservedPhoneMemoryFs;
+ TInt iReservedPhoneMemory;
};
#endif // __SSMUIPROVIDERDLL_H__
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/inc/ssmuiproviderdllswitch_stubs.h Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/inc/ssmuiproviderdllswitch_stubs.h Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -266,7 +266,25 @@
_asm mov eax, 27
_asm jmp common_dispatch
}
+
+__declspec(dllexport)
+__declspec(naked)
+void call_vector_28 ()
+ {
+ //TInt ReservePhoneMemorySpace()
+ _asm mov eax, 28
+ _asm jmp common_dispatch
+ }
+
+__declspec(dllexport)
+__declspec(naked)
+void call_vector_29 ()
+ {
+ //TInt FreeReservedPhoneMemorySpace(const TInt aSpaceToFree)
+ _asm mov eax, 29
+ _asm jmp common_dispatch
+ }
}
-#define MAX_ORDINAL 27
+#define MAX_ORDINAL 29
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/src/ssmuiproviderdlldefault.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/src/ssmuiproviderdlldefault.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -21,7 +21,7 @@
#include "ssmuiproviderdll.h"
#include "ssmpanic.h"
#include <e32property.h>
-#include <f32file.h>
+#include "ssmdebug.h"
const TUid KPSStartupUid = {0x2000E65E};
const TUid KSecurityPinNotifierUid = {0x2000E667};
@@ -37,17 +37,20 @@
const TUint KRFStatusPropertyKey = 0x2001D2A9;
const TUid KValidateRTCPropertyCategory = {0x2000D75B};
const TUint KValidateRTCPropertyKey = 0x2001D2AB;
+//Number of clusterSize to be reserve for phone memory space
+const TInt KNumberOfCluster = 2;
_LIT(KTsyModuleName, "mm.tsy");
_LIT(KTsyPhoneName, "GsmPhone1");
CSsmUiSpecific::CSsmUiSpecific()
-: iReferenceCount(1)
+: iReferenceCount(1), iReservedPhoneMemory(0)
{
}
EXPORT_C CSsmUiSpecific::~CSsmUiSpecific()
{
+ iReservedPhoneMemoryFs.Close();
}
EXPORT_C TUid CSsmUiSpecific::StartupPSUid()
@@ -95,7 +98,7 @@
//Instantiate CSsmUiSpecific if TLS is null
self = new (ELeave) CSsmUiSpecific();
CleanupStack::PushL(self);
-
+ self->ConstructL();
//Copy CSsmUiSpecific pointer in TLS
User::LeaveIfError(Dll::SetTls(self));
CleanupStack::Pop(self);
@@ -203,3 +206,73 @@
return EDriveC;
}
+/**
+Leaving construction inside ConstructL
+*/
+void CSsmUiSpecific::ConstructL()
+ {
+ User::LeaveIfError( iReservedPhoneMemoryFs.Connect() );
+ }
+
+/**
+Reserve two ClusterSize in Phone Memory Space on H/W
+and 512 bytes for __WINS__
+@return KErrNone if successful or systemwide error
+*/
+EXPORT_C TInt CSsmUiSpecific::ReservePhoneMemorySpace()
+ {
+ TVolumeIOParamInfo volumeParamInfo;
+ const TInt phoneMemoryDriveID = PhoneMemoryRootDriveId();
+ TInt errorCode = iReservedPhoneMemoryFs.VolumeIOParam(phoneMemoryDriveID, volumeParamInfo);
+ if( KErrNone == errorCode )
+ {
+#ifdef __WINS__
+ //512 bytes for __WINS__
+ const TInt reservedMemory = 512;
+#else
+ //Reserving two clusterSize Phone memory
+ const TInt reservedMemory = KNumberOfCluster * (volumeParamInfo.iClusterSize);
+#endif //__WINS__
+ errorCode = iReservedPhoneMemoryFs.ReserveDriveSpace(phoneMemoryDriveID, reservedMemory);
+
+ if ( KErrNone == errorCode )
+ {
+ iReservedPhoneMemory = reservedMemory;
+ }
+ }
+ return errorCode;
+ }
+
+/**
+Free reserved bytes from Phone Memory Space. If aSpaceToFree is 0 bytes
+then free complete reserved memory
+@param aSpaceToFree request to free memory
+@return KErrNone if successful or systemwide error
+*/
+EXPORT_C TInt CSsmUiSpecific::FreeReservedPhoneMemorySpace(const TInt aSpaceToFree)
+ {
+ TInt errorCode(KErrGeneral);
+ DEBUGPRINT3A("Reserved memory is = %d bytes, Request to free memory is = %d bytes", iReservedPhoneMemory, aSpaceToFree);
+ if(0 < iReservedPhoneMemory)
+ {
+ if(0 == aSpaceToFree)
+ {
+ //Free complete reserved phone memory
+ errorCode = iReservedPhoneMemoryFs.ReserveDriveSpace( PhoneMemoryRootDriveId(), 0 );
+ DEBUGPRINT2A("Freeing memory completed with = %d", errorCode);
+ iReservedPhoneMemory = 0;
+ }
+ else
+ {
+ TInt newReserveSize = iReservedPhoneMemory - aSpaceToFree;
+ newReserveSize = newReserveSize >= 0 ? newReserveSize : 0;
+ errorCode = iReservedPhoneMemoryFs.ReserveDriveSpace( PhoneMemoryRootDriveId(), newReserveSize );
+ DEBUGPRINT2A("Freeing partial phone memory completed with = %d", errorCode);
+ if(KErrNone == errorCode)
+ {
+ iReservedPhoneMemory = newReserveSize;
+ }
+ }
+ }
+ return errorCode;
+ }
--- a/sysstatemgmt/sysuiprovider/inc/ssmuispecific.h Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/sysuiprovider/inc/ssmuispecific.h Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 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"
@@ -168,18 +168,36 @@
*/
IMPORT_C static TInt PhoneMemoryRootDriveId();
+ /**
+ Reserve two ClusterSize in Phone Memory Space on H/W
+ and 512 bytes for __WINS__
+ @return KErrNone if successful or systemwide error
+ */
+ IMPORT_C TInt ReservePhoneMemorySpace();
+
+ /**
+ Free reserved bytes from Phone Memory Space. If aSpaceToFree is 0 bytes
+ then free complete reserved memory
+ @param aSpaceToFree request to free memory
+ @return KErrNone if successful or systemwide error
+ */
+ IMPORT_C TInt FreeReservedPhoneMemorySpace(const TInt aSpaceToFree);
+
private:
/**
* Constructor.
*/
CSsmUiSpecific();
+
+ void ConstructL();
private: // data
TStrtSecurityStatus iStrtSecurityStatus;
TInt iReferenceCount;
-
+ RFs iReservedPhoneMemoryFs;
+ TInt iReservedPhoneMemory;
};
#endif // SSMUISPECIFIC_H
--- a/sysstatemgmt/sysuiprovider/src/ssmuispecific.cpp Mon Mar 15 12:45:37 2010 +0200
+++ b/sysstatemgmt/sysuiprovider/src/ssmuispecific.cpp Wed Mar 31 23:31:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 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"
@@ -36,6 +36,8 @@
// Type definitions for a buffer containing a drive id (drive letter + :).
const TInt KDriveIdLength = 2;
+//Number of clusterSize to be reserve for phone memory space
+const TInt KNumberOfCluster = 2;
typedef TBuf<KDriveIdLength> TDriveId;
// ======== MEMBER FUNCTIONS ========
@@ -47,6 +49,7 @@
EXPORT_C CSsmUiSpecific::~CSsmUiSpecific()
{
FUNC_LOG;
+ iReservedPhoneMemoryFs.Close();
}
@@ -68,6 +71,7 @@
{
self = new ( ELeave ) CSsmUiSpecific;
CleanupStack::PushL( self );
+ self->ConstructL();
User::LeaveIfError( Dll::SetTls( self ) );
CleanupStack::Pop( self );
}
@@ -431,7 +435,76 @@
// CSsmUiSpecific::CSsmUiSpecific
// ---------------------------------------------------------------------------
//
-CSsmUiSpecific::CSsmUiSpecific() : iReferenceCount( 1 )
+CSsmUiSpecific::CSsmUiSpecific() : iReferenceCount(1), iReservedPhoneMemory(0)
{
FUNC_LOG;
+ }
+/**
+Leaving construction inside ConstructL
+*/
+void CSsmUiSpecific::ConstructL()
+ {
+ FUNC_LOG;
+
+ User::LeaveIfError( iReservedPhoneMemoryFs.Connect() );
}
+
+/**
+ReservePhoneMemorySpace
+*/
+EXPORT_C TInt CSsmUiSpecific::ReservePhoneMemorySpace()
+ {
+ FUNC_LOG;
+ TVolumeIOParamInfo volumeParamInfo;
+ const TInt phoneMemoryDriveID = PhoneMemoryRootDriveId();
+ TInt errorCode = iReservedPhoneMemoryFs.VolumeIOParam(phoneMemoryDriveID, volumeParamInfo);
+ if( KErrNone == errorCode )
+ {
+#ifdef __WINS__
+ //512 bytes for __WINS__
+ const TInt reservedMemory = 512;
+#else
+ //Reserving two clusterSize Phone memory
+ const TInt reservedMemory = KNumberOfCluster * (volumeParamInfo.iClusterSize);
+#endif //__WINS__
+ errorCode = iReservedPhoneMemoryFs.ReserveDriveSpace(phoneMemoryDriveID, reservedMemory);
+
+ if ( KErrNone == errorCode )
+ {
+ iReservedPhoneMemory = reservedMemory;
+ }
+ }
+ return errorCode;
+ }
+
+/**
+FreeReservedPhoneMemorySpace
+*/
+EXPORT_C TInt CSsmUiSpecific::FreeReservedPhoneMemorySpace(const TInt aSpaceToFree)
+ {
+ FUNC_LOG;
+ TInt errorCode(KErrGeneral);
+ INFO_2("Reserved memory is = %d bytes, Request to free memory is = %d bytes", iReservedPhoneMemory, aSpaceToFree);
+ if(0 < iReservedPhoneMemory)
+ {
+ if(0 == aSpaceToFree)
+ {
+ //Free complete reserved phone memory
+ errorCode = iReservedPhoneMemoryFs.ReserveDriveSpace( PhoneMemoryRootDriveId(), 0 );
+ INFO_1("Freeing memory completed with = %d", errorCode);
+ iReservedPhoneMemory = 0;
+ }
+ else
+ {
+ TInt newReserveSize = iReservedPhoneMemory - aSpaceToFree;
+ newReserveSize = newReserveSize >= 0 ? newReserveSize : 0;
+ errorCode = iReservedPhoneMemoryFs.ReserveDriveSpace( PhoneMemoryRootDriveId(), newReserveSize );
+ INFO_1("Freeing partial phone memory completed with = %d", errorCode);
+ if(KErrNone == errorCode)
+ {
+ iReservedPhoneMemory = newReserveSize;
+ }
+ }
+ }
+ return errorCode;
+ }