# HG changeset patch # User Sampo Huttunen # Date 1288777509 -7200 # Node ID 08b5eae9f9ffc7175cfa4a2065a396e59873a13b # Parent 6369bfd1b60de0b3421dcf12a82621e4d8f7a158 merge from Nokia's internal development branch diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/dlnasrv_exampleapp.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/dlnasrv_exampleapp.pro Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,44 @@ +# Copyright (c) 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" +# 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: Dlna test app +TEMPLATE = app +TARGET = dlnasrv_exampleapp +LIBS += -lupnpavcontrollerclient \ + -lupnpsettingsengine \ + -linetprotutil \ + -lesocksvr \ + -lesock \ + -lupnpavcontrollerhelper \ + -lupnprenderingstatemachine \ + -lupnpconnmon +DEFINES += __FUNC_TRACE__ +VPATH += ./inc \ + ./src +INCLUDEPATH += ../inc \ + $$MW_LAYER_SYSTEMINCLUDE \ + /epoc32/include +HEADERS = inc/tracedefs.h \ + inc/trace.h \ + inc/traceconfiguration.hrh \ + inc/exampleappengine_p.h \ + inc/exampleappengine.h \ + inc/exampleappui.h +SOURCES += src/exampleappengine_p.cpp \ + src/exampleappengine.cpp \ + src/exampleappui.cpp \ + main.cpp +symbian { + TARGET.CAPABILITY = \ +# User Capabilities: + NetworkServices ReadUserData WriteUserData \ +# System Capabilities: + ReadDeviceData WriteDeviceData + TARGET.UID3 = 0xE0000000 +} diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/inc/exampleappengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/inc/exampleappengine.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 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" +* 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: +* +*/ +#ifndef EXAMPLEAPPENGINE_H +#define EXAMPLEAPPENGINE_H + +#include + +class QFile; +class ExampleAppEnginePrivate; + +class ExampleAppEngine : public QObject +{ + Q_OBJECT + +public: + enum + { + PlaybackStateStopped, + PlaybackStatePaused, + PlaybackStateBuffering, + PlaybackStatePlaying + }; + +public: + ExampleAppEngine(); + ~ExampleAppEngine(); + +public: + void construct(); + int getIap() const; + QString getIapName() const; + bool isPauseSupported() const; + bool isSeekSupported() const; + int getPlaybackState() const; + +public slots: + void searchRenderingDevices(); + void prepareRenderingDevice(const QString &uuid); + int initFile(const QString& file); + void play(); + void pause(); + void stop(); + void volumeUp(); + void volumeDown(); + void rew(); + void ff(); + +signals: + void initComplete(int); + void stateChanged(int); + void renderingDeviceSearchStarted(); + void renderingDeviceFound(const QString &, const QString &); + void renderingDeviceDisappeared(const QString &, const QString &); + void iapUpdated(const QString &); + void iapUpdated(int); + +private: // data + ExampleAppEnginePrivate* const d_ptr; + Q_DECLARE_PRIVATE_D(d_ptr, ExampleAppEngine) + Q_DISABLE_COPY(ExampleAppEngine) +}; + +#endif // EXAMPLEAPPENGINE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/inc/exampleappengine_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/inc/exampleappengine_p.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 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" +* 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: Dlna private interface definitions +* +*/ + +#ifndef EXAMPLEAPPENGINE_P_H +#define EXAMPLEAPPENGINE_P_H + +#include +#include +#include +#include +#include +#include +#include + +#include "exampleappengine.h" + +class CUPnPSettingsEngine; +class MUPnPAVRenderingSession; +class CUpnpRenderingStateMachine; +class CUpnpVolumeStateMachine; +class MUPnPAVController; +class CUpnpAVDeviceList; +class CUPnPConnectionMonitor; + +class ExampleAppEnginePrivate : public QObject, +public MUPnPAVDeviceObserver, +public MUPnPAVRenderingSessionObserver, +public MUpnpRenderingStateMachineObserver, +public MUpnpVolumeStateMachineObserver, +public MUPnPItemResolverObserver, +public MUPnPConnectionMonitorObserver +{ + Q_OBJECT + Q_DECLARE_PUBLIC(ExampleAppEngine) + +public: + ExampleAppEnginePrivate(); + virtual ~ExampleAppEnginePrivate(); + +public: + void construct(); + int getConnectedIap() const; + QString getConnectedIapName() const; + int getPlaybackState() const; + bool isSeekSupported() const; + bool isPauseSupported() const; + void searchRenderingDevices(); + void prepareRenderingDevice(const QString &uuid); + int initFile(const QString& file); + void play(); + void pause(); + void stop(); + void volumeUp(); + void volumeDown(); + void rew(); + void ff(); + +protected: + // from MUPnPAVDeviceObserver + void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice); + void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice); + void WLANConnectionLost(); + + // from MUPnPAVRenderingSessionObserver + void VolumeResult(TInt aError, TInt aVolumeLevel, TBool aActionResponse); + void MuteResult(TInt aError, TBool aMute, TBool aActionResponse); + void InteractOperationComplete(TInt aError, TUPnPAVInteractOperation aOperation); + void PositionInfoResult(TInt aError, const TDesC8& aTrackPosition, const TDesC8& aTrackLength); + void SetURIResult(TInt aError); + void SetNextURIResult(TInt aError); + void MediaRendererDisappeared(TUPnPDeviceDisconnectedReason aReason); + + // from MUpnpRenderingStateMachineObserver + void RendererSyncReady(TInt aError, Upnp::TState aState); + void RenderingStateChanged(TInt aError, Upnp::TState aState, TBool aUserOriented, TInt aStateParam); + void PositionSync(TInt aError, Upnp::TPositionMode aMode, TInt aDuration, TInt aPosition); + + // from MUpnpVolumeStateMachineObserver + void VolumeSyncReady(TInt aError); + void VolumeChanged(TInt aError, TInt aVolume, TBool aUserOriented); + void MuteChanged(TInt aError, TBool aMuteState, TBool aUserOriented); + + // from MUPnPItemResolverObserver + void ResolveComplete(const MUPnPItemResolver& aResolver, TInt aError); + + // from MUPnPConnectionMonitorObserver + void ConnectionLost(TBool aUserOriented); + void ConnectionCreated(TInt aConnectionId); + +private: + void searchRenderingDevicesL(); + void upnpDeviceDiscoveredL(const CUpnpAVDevice& aDevice); + void prepareRenderingDeviceL(const QString &uuid); + void startRenderingSessionL(const CUpnpAVDevice &device); + void stopRenderingSession(); + void initFileL(const QString& file); + bool isReadyForPlayback() const; + void playL(); + void pauseL(); + void stopL(); + void resolveIapL(); + void resolveIapNameL(); + + QString asString(const TDesC &desc) const; + QString asString8(const TDesC8 &desc) const; + +private: + ExampleAppEngine *q_ptr; + CUPnPSettingsEngine *mSettingsEngine; + MUPnPAVRenderingSession *mAVRenderingSession; + CUpnpRenderingStateMachine *mRenderingStateMachine; + CUpnpVolumeStateMachine *mVolumeStateMachine; + MUPnPAVController *mAVController; + int mIap; + QString mIapName; + CUpnpAVDeviceList *mDevices; + CUpnpAVDevice *mDevice; + int mPlaybackState; + MUPnPItemResolver *mItemResolver; + CUPnPConnectionMonitor *mConnectionMonitor; +}; + +#endif // EXAMPLEAPPENGINE_P_H diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/inc/exampleappui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/inc/exampleappui.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 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" +* 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: +* +*/ + + +#ifndef EXAMPLEAPPUI_H_ +#define EXAMPLEAPPUI_H_ + +#include + +class QGroupBox; +class QLabel; +class QPushButton; +class QComboBox; +class ExampleAppEngine; + +class ExampleAppUi : public QMainWindow +{ + Q_OBJECT + +public: + ExampleAppUi(); + virtual ~ExampleAppUi(); + + void construct(); + +private: + void createUi(); + QLayout *createApSelectionUi(); + QLayout *createRendererSelectionUi(); + QLayout *createFileSelectionUi(); + QLayout *createPlaybackUi(); + void createEngine(); + +private slots: + void updateState(int newState); + void selectFile(); + void deviceSearchStarted(); + void addRenderingDevice(const QString &name, const QString &uuid); + void removeRenderingDevice(const QString &name, const QString &uuid); + void selectRenderingDevice(int index); + void enablePlayback(int result = 0); + void disablePlayback(); + void enableFileSelection(); + void disableFileSelection(); + void enableRenderingDeviceSelection(int iap = 0); + void disableRenderingDeviceSelection(); + +private: + enum + { + RewButton, + PlayButton, + PauseButton, + StopButton, + FfButton + }; + +private: + // owned + ExampleAppEngine *mEngine; + + // not owned + QLabel *mSelectedRenderer; + QLabel *mSelectedFileLabel; + QLabel *mPlaybackStatus; + QComboBox *mRenderingDevices; + QPushButton *mPlayButton; + QPushButton *mPauseButton; + QPushButton *mStopButton; + QPushButton *mRewButton; + QPushButton *mFfButton; + QPushButton *mSelectFileButton; + QPushButton *mSearchDevicesButton; + QString mSelectedFile; +}; + +#endif /* EXAMPLEAPPUI_H_ */ diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/inc/trace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/inc/trace.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,972 @@ +/* +* Copyright (c) 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" +* 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: +* Tracing macros +*/ + +#ifndef TRACE_H +#define TRACE_H + +#include "traceconfiguration.hrh" +#include "tracedefs.h" +#include // RDebug +#if defined TRACE_INTO_FILE || defined LOG_INTO_FILE + #include // RFileLogger +#endif + + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- +// + +/** +* Prefix error trace +*/ +#define _PREFIX_ERROR( aMsg ) _PREFIX_TRACE( "[ERROR: %d]: " L##aMsg ) + +/** +* Prefix info trace. +*/ +#define _PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[INFO]: " L##aMsg ) + +/** +* Helper for using _LIT with macros. +*/ +#define _CREATE_LIT(a,b) _LIT(a,b) + +/** +* Define needed if TRACE_INTO_FILE macro in use +*/ +#ifdef TRACE_INTO_FILE + _CREATE_LIT( KTraceFile, TRACE_FILE ); +#endif + +/** +* Define needed directories if LOG_INTO_FILE macro in use +*/ +#ifdef LOG_INTO_FILE + _CREATE_LIT( KLogFile, LOG_FILE ); +#endif + +/** +* Helpers for tracing into file. +*/ +#if defined TRACE_INTO_FILE || defined LOG_INTO_FILE + +const TText KBackSlash = '\\'; + +static TPtrC DriveAndPath( const TDesC& aFullPath ) + { + TInt pos( aFullPath.LocateReverse( KBackSlash ) ); + return ( pos >= 0 && pos < aFullPath.Length() ? aFullPath.Left( pos ) : KNullDesC() ); + } + +static TPtrC NameAndExt( const TDesC& aFullPath ) + { + TInt pos( aFullPath.LocateReverse( KBackSlash ) ); + return ( pos >= 0 && pos < aFullPath.Length() ? aFullPath.Mid( pos + 1 ) : KNullDesC() ); + } + +static void EnableFileTrace() + { + RFs fs; + TInt err = fs.Connect(); + if (err == KErrNone) + { + TParsePtrC parse(KTraceFile); + TEntry entry; + err = fs.Entry(parse.DriveAndPath(), entry); + if (err == KErrNotFound) + { + // folder not found, create it + err = fs.MkDirAll(parse.DriveAndPath()); + } + + // create trace file + err = fs.Entry(KTraceFile, entry); + if (err == KErrNotFound) + { + RFile file; + err = file.Create(fs, KTraceFile, EFileWrite); + + // cleanup + file.Close(); + } + + // cleanup + fs.Close(); + } + } + +#endif + +/** + * Helper macro to create trace folder and file + */ +#ifdef TRACE_INTO_FILE + #define ENABLE_FILE_TRACE\ + {\ + EnableFileTrace();\ + } +#else + #define ENABLE_FILE_TRACE +#endif + +//----------------------------------------------------------------------------- +// Error trace macros +//----------------------------------------------------------------------------- +// +#ifdef ERROR_TRACE + + /** + * Error trace definitions. + */ + #ifdef TRACE_INTO_FILE + + #define ERROR( aErr, aMsg )\ + {\ + if( aErr < KErrNone )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_ERROR( aMsg ), aErr );\ + }\ + } + #define ERROR_1( aErr, aMsg, aP1 )\ + {\ + if( aErr < KErrNone )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_ERROR( aMsg ), aErr, aP1 );\ + }\ + } + #define ERROR_2( aErr, aMsg, aP1, aP2 )\ + {\ + if( aErr < KErrNone )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\ + }\ + } + #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\ + {\ + if( aErr < KErrNone )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\ + }\ + } + + #define ERROR_4( aErr, aMsg, aP1, aP2, aP3, aP4 )\ + {\ + if( aErr < KErrNone )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4 );\ + }\ + } + + #else//TRACE_INTO_FILE not defined + + #define ERROR( aErr, aMsg )\ + {\ + if( aErr < KErrNone )\ + {\ + RDebug::Print( _PREFIX_ERROR( aMsg ), aErr );\ + }\ + } + #define ERROR_1( aErr, aMsg, aP1 )\ + {\ + if( aErr < KErrNone )\ + {\ + RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1 );\ + }\ + } + #define ERROR_2( aErr, aMsg, aP1, aP2 )\ + {\ + if( aErr < KErrNone )\ + {\ + RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\ + }\ + } + #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\ + {\ + if( aErr < KErrNone )\ + {\ + RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\ + }\ + } + #define ERROR_4( aErr, aMsg, aP1, aP2, aP3, aP4 )\ + {\ + if( aErr < KErrNone )\ + {\ + RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3, aP4 );\ + }\ + } + + #endif//TRACE_INTO_FILE + + #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg ) + #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 ) + #define ERROR_GEN_2( aMsg, aP1, aP2 ) ERROR_2( KErrGeneral, aMsg, aP1, aP2 ) + #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) ERROR_3( KErrGeneral, aMsg, aP1, aP3 ) + #define ERROR_GEN_4( aMsg, aP1, aP2, aP3, aP4 ) ERROR_4( KErrGeneral, aMsg, aP1, aP3, aP4 ) + + #define ERROR_PARAM(_p) _p + + #define TRAPD_ERR( aErr, aStmt ) TRAPD( aErr, aStmt ) + #define TRAP_ERR( aErr, aStmt ) TRAP( aErr, aStmt ) + + #define TRAP_AND_LEAVE(_s,_t) \ + { TRAPD(_e,_s); ERROR(_e,_t); User::LeaveIfError(_e); } + +#else//ERROR_TRACE not defined + + #define ERROR( aErr, aMsg ) + #define ERROR_1( aErr, aMsg, aP1 ) + #define ERROR_2( aErr, aMsg, aP1, aP2 ) + #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 ) + #define ERROR_4( aErr, aMsg, aP1, aP2, aP3, aP4 ) + #define ERROR_GEN( aMsg ) + #define ERROR_GEN_1( aMsg, aP1 ) + #define ERROR_GEN_2( aMsg, aP1, aP2 ) + #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) + #define ERROR_GEN_4( aMsg, aP1, aP2, aP3, aP4 ) + + #define ERROR_PARAM(_p) + + #define TRAPD_ERR( aErr, aStmt ) TRAP_IGNORE( aStmt ) + #define TRAP_ERR( aErr, aStmt ) TRAP_IGNORE( aStmt ) + + #define TRAP_AND_LEAVE(_s,_t) { _s; } + +#endif//ERROR_TRACE + +//----------------------------------------------------------------------------- +// Info trace macros +//----------------------------------------------------------------------------- +// +#ifdef INFO_TRACE + + /** + * Info log message definitions. + */ + #ifdef TRACE_INTO_FILE + + #define INFO( aMsg )\ + {\ + RFileLogger::Write( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_INFO( aMsg ) );\ + } + #define INFO_1( aMsg, aP1 )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_INFO( aMsg ), aP1 );\ + } + #define INFO_2( aMsg, aP1, aP2 )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_INFO( aMsg ), aP1, aP2 );\ + } + #define INFO_3( aMsg, aP1, aP2, aP3 )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\ + } + #define INFO_4( aMsg, aP1, aP2, aP3, aP4 )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\ + } + #define INFO_5( aMsg, aP1, aP2, aP3, aP4, aP5 )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4, aP5 );\ + } + + #else//TRACE_INTO_FILE not defined + + #define INFO( aMsg )\ + {\ + RDebug::Print( _PREFIX_INFO( aMsg ) );\ + } + #define INFO_1( aMsg, aP1 )\ + {\ + RDebug::Print( _PREFIX_INFO( aMsg ), aP1 );\ + } + #define INFO_2( aMsg, aP1, aP2 )\ + {\ + RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2 );\ + } + #define INFO_3( aMsg, aP1, aP2, aP3 )\ + {\ + RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\ + } + #define INFO_4( aMsg, aP1, aP2, aP3, aP4 )\ + {\ + RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\ + } + #define INFO_5( aMsg, aP1, aP2, aP3, aP4, aP5 )\ + {\ + RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4, aP5 );\ + } + + #endif//TRACE_INTO_FILE + + #define INFO_PARAM( aParam ) aParam + +#else//INFO_TRACE not defined + + #define INFO( aMsg ) + #define INFO_1( aMsg, aP1 ) + #define INFO_2( aMsg, aP1, aP2 ) + #define INFO_3( aMsg, aP1, aP2, aP3 ) + #define INFO_4( aMsg, aP1, aP2, aP3, aP4 ) + #define INFO_5( aMsg, aP1, aP2, aP3, aP4, aP5 ) + #define INFO_PARAM( aParam ) + +#endif//INFO_TRACE + +//----------------------------------------------------------------------------- +// Trace current client thread name and process id +//----------------------------------------------------------------------------- +// +#ifdef CLIENT_TRACE + + #define _PREFIX_CLIENT( aMsg ) _PREFIX_TRACE( "[CLIENT: sid [0x%x] thread [%S]] " L##aMsg ) + + #ifdef TRACE_INTO_FILE + + #define CLIENT_TRACE_2( aMsg, aP1, aP2 )\ + {\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, _PREFIX_CLIENT(aMsg), aP1, aP2 );\ + } + + #else//TRACE_INTO_FILE not defined + + #define CLIENT_TRACE_2( aMsg, aP1, aP2 )\ + {\ + RDebug::Print( _PREFIX_CLIENT(aMsg), aP1, aP2 );\ + } + + #endif//TRACE_INTO_FILE + + /** + * Traces current secure id and thread + */ + #define CURRENT_CLIENT( aMsg )\ + {\ + TName name( RThread().Name() );\ + TSecureId sid( RThread().SecureId() );\ + CLIENT_TRACE_2( aMsg, sid.iId, &name );\ + } + + /** + * Traces secure id and thread from RMessage2 + */ + #define CLIENT( aRMessage2 )\ + {\ + RThread thread;\ + TInt err = aRMessage2.Client( thread );\ + if( err == KErrNone )\ + {\ + TName name( thread.Name() );\ + TSecureId sid( thread.SecureId() );\ + CLIENT_TRACE_2( "", sid.iId, &name );\ + }\ + thread.Close();\ + } + + /** + * Traces secure id and thread from RMessage2 + */ + #define CLIENT_1( aRMessage2, aMsg )\ + {\ + RThread thread;\ + TInt err = aRMessage2.Client( thread );\ + if( err == KErrNone )\ + {\ + TName name( thread.Name() );\ + TSecureId sid( thread.SecureId() );\ + CLIENT_TRACE_2( aMsg, sid.iId, &name );\ + }\ + thread.Close();\ + } + +#else + + #define CURRENT_CLIENT( aMsg ) + #define CLIENT( aRMessage2 ) + #define CLIENT_1( aRMessage2, aMsg ) + +#endif + +//----------------------------------------------------------------------------- +// Trace current heap usage +//----------------------------------------------------------------------------- +// +#ifdef HEAP_TRACE + + #define _PREFIX_HEAP( aMsg ) _PREFIX_TRACE( "[HEAP: %d bytes] " L##aMsg ) + + #ifdef TRACE_INTO_FILE + + #define HEAP( aMsg )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace );\ + } + #define HEAP_1( aMsg, aP1 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1 );\ + } + #define HEAP_2( aMsg, aP1, aP2 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2 );\ + } + #define HEAP_3( aMsg, aP1, aP2, aP3 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3 );\ + } + #define HEAP_4( aMsg, aP1, aP2, aP3, aP4 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3, aP4 );\ + } + + #else//TRACE_INTO_FILE not defined + + #define HEAP( aMsg )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace );\ + } + #define HEAP_1( aMsg, aP1 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1 );\ + } + #define HEAP_2( aMsg, aP1, aP2 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2 );\ + } + #define HEAP_3( aMsg, aP1, aP2, aP3 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3 );\ + } + #define HEAP_4( aMsg, aP1, aP2, aP3, aP4 )\ + {\ + TInt totalAllocSpace = 0;\ + User::AllocSize( totalAllocSpace );\ + RDebug::Print( _PREFIX_HEAP( aMsg ), totalAllocSpace, aP1, aP2, aP3, aP4 );\ + } + + #endif//TRACE_INTO_FILE + +#else//HEAP_TRACE not defined + + #define HEAP( aMsg ) + #define HEAP_1( aMsg, aP1 ) + #define HEAP_2( aMsg, aP1, aP2 ) + #define HEAP_3( aMsg, aP1, aP2, aP3 ) + #define HEAP_4( aMsg, aP1, aP2, aP3, aP4 ) + +#endif//HEAP_TRACE + + +//----------------------------------------------------------------------------- +// Function trace macros +//----------------------------------------------------------------------------- +// +#ifdef FUNC_TRACE + + #include // TCleanupItem + + /** + * Function logging definitions. + */ + #ifdef TRACE_INTO_FILE + + #define FUNC( aMsg, aP1 )\ + {\ + TPtrC8 trace( _S8( aMsg ) );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, trace, aP1 );\ + } + + #define FUNC_2( aMsg, aP1, aP2, aP3 )\ + {\ + TPtrC8 trace( _S8( aMsg ) );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, trace, aP1, aP2, aP3 );\ + } + + #else//TRACE_INTO_FILE not defined + + #define FUNC( aMsg, aP1 )\ + {\ + RDebug::Printf( aMsg, aP1 );\ + } + + #define FUNC_2( aMsg, aP1, aP2, aP3 )\ + {\ + RDebug::Printf( aMsg, aP1, aP2, aP3 );\ + } + + #endif//TRACE_INTO_FILE + + /** + * Function trace helper class. + */ + const TText KFuncNameTerminator = '('; + const TText KFuncLeaveIndicator = 'L'; + const TInt KFuncCanLeave = 0x1; + const TInt KFuncLeft = 0x2; + const TInt KFuncLogClient = 0x4; + + class TFuncLog + { + public: + static void Cleanup( TAny* aPtr ) + { + TFuncLog* self = static_cast< TFuncLog* >( aPtr ); + self->iFlags |= KFuncLeft; + self->LogLeave(); + } + + inline void LogStart() + { + if ( iFlags & KFuncLogClient ) + { + TBuf8 name8; + name8.Copy( RThread().Name() ); + TSecureId sid( RThread().SecureId() ); + FUNC_2( _PREFIX_TRACE8("%S-START(sid [0x%x] thread [%S])"), + &iFunc, sid.iId, &name8 ); + } + else + { + FUNC( _PREFIX_TRACE8("%S-START"), &iFunc ); + } + } + + inline void LogLeave() + { + if ( iFlags & KFuncLogClient ) + { + TBuf8 name8; + name8.Copy( RThread().Name() ); + TSecureId sid( RThread().SecureId() ); + FUNC_2( _PREFIX_TRACE8("%S-LEAVE(sid [0x%x] thread [%S])"), + &iFunc, sid.iId, &name8 ); + } + else + { + FUNC( _PREFIX_TRACE8("%S-LEAVE"), &iFunc ); + } + } + + inline void LogEnd() + { + if ( iFlags & KFuncLogClient ) + { + TBuf8 name8; + name8.Copy( RThread().Name() ); + TSecureId sid( RThread().SecureId() ); + FUNC_2( _PREFIX_TRACE8("%S-END(sid [0x%x] thread [%S])"), + &iFunc, sid.iId, &name8 ); + } + else + { + FUNC( _PREFIX_TRACE8("%S-END"), &iFunc ); + } + } + + // For non leaving and L methods + inline TFuncLog( const char* aFunc, TUint aFlags ) : + iFunc( aFunc ? _S8( aFunc ) : _S8("") ), + iFlags( aFlags ), + iCleanupItem( Cleanup, this ), + iLCPtr( NULL ) + { + TInt pos( iFunc.Locate( KFuncNameTerminator ) ); + if( pos >= 0 && pos < iFunc.Length() ) + { + iFunc.Set( iFunc.Left( pos ) ); + TInt len( iFunc.Length() ); + if( len > 0 && iFunc[ len - 1 ] == KFuncLeaveIndicator ) + { + iFlags |= KFuncCanLeave; + CleanupStack::PushL( iCleanupItem ); // Ignore warnings + } + } + LogStart(); + } + + // For LC methods only + inline TFuncLog( const char* aFunc, TUint aFlags, TAny** aLCPtr ) : + iFunc( aFunc ? _S8( aFunc ) : _S8("") ), + iFlags( aFlags ), + iCleanupItem( Cleanup, this ), + iLCPtr( NULL ) + { + TInt pos( iFunc.Locate( KFuncNameTerminator ) ); + if( pos >= 0 && pos < iFunc.Length() ) + { + iFunc.Set( iFunc.Left( pos ) ); + iFlags |= KFuncCanLeave; + iLCPtr = aLCPtr; + CleanupStack::PushL( iCleanupItem ); // Ignore warnings + } + LogStart(); + } + + inline ~TFuncLog() + { + if ( !( iFlags & KFuncLeft ) ) + { + if ( iFlags & KFuncCanLeave ) + { + if ( iLCPtr && *iLCPtr) + { + CleanupStack::Pop(); // Pop LC ptr first + CleanupStack::Pop( this ); // Pop the cleanup item + CleanupStack::PushL( *iLCPtr ); // Push LC ptr back + } + else + { + CleanupStack::Pop( this ); // Pop the cleanup item + } + } + LogEnd(); // Normally finished + } + } + + private: // Data + TPtrC8 iFunc; + TUint iFlags; + TCleanupItem iCleanupItem; + TAny** iLCPtr; + }; + + /* + * Use with non leaving and L methods + * + * CMyClass* CMyClass::DoL() + * { + * FUNC_LOG; + * CMyClass* ret = new (ELeave) CMyClass(); + * ... + * return ret; + * } + * + * CMyClass* CMyClass::Do() + * { + * FUNC_LOG; + * return iMyClass; + * } + * + */ + #define FUNC_LOG TFuncLog _fl( __PRETTY_FUNCTION__, 0 ); + + /* + * Use with LC methods + * + * CMyClass* CMyClass::DoLC() + * { + * CMyClass* ret = NULL; + * FUNC_LOG_LC( ret ); + * ... + * return ret; + * } + */ + #define FUNC_LOG_LC( aPtr ) TFuncLog _fl( __PRETTY_FUNCTION__, 0, (TAny**)&aPtr ); + +#ifdef CLIENT_TRACE + + /* + * Used like FUNC_LOG. Prints client info useful for client side executed API methods. + */ + #define FUNC_LOG_WITH_CLIENT TFuncLog _fl( __PRETTY_FUNCTION__, KFuncLogClient ); + + /* + * Used like FUNC_LOG_LC. Prints client info useful for client side executed API methods. + */ + #define FUNC_LOG_WITH_CLIENT_LC( aPtr )\ + TFuncLog _fl( __PRETTY_FUNCTION__, KFuncLogClient, (TAny**)&aPtr ); + +#else //CLIENT_TRACE not defined + + #define FUNC_LOG_WITH_CLIENT FUNC_LOG + #define FUNC_LOG_WITH_CLIENT_LC( aPtr ) FUNC_LOG_LC( aPtr ) + +#endif //CLIENT_TRACE + +#else//FUNC_TRACE not defined + + #define FUNC_LOG + #define FUNC_LOG_LC( ptr ) + #define FUNC_LOG_WITH_CLIENT + #define FUNC_LOG_WITH_CLIENT_LC( ptr ) + +#endif//FUNC_TRACE + +//----------------------------------------------------------------------------- +// Timestamp trace macros +//----------------------------------------------------------------------------- +// +#ifdef TIMESTAMP_TRACE + + #define PREFIX_TIMESTAMP( aCaption )\ + _PREFIX_TRACE_2("[TIMESTAMP] (%d:%02d:%02d.%06d us) ",aCaption) + #define CURRENT_TIME( aDt ) TDateTime aDt; { TTime t; t.HomeTime(); aDt = t.DateTime(); } + #define EXTRACT_TIME( aDt ) aDt.Hour(), aDt.Minute(), aDt.Second(), aDt.MicroSecond() + + #ifdef TRACE_INTO_FILE + + #define TIMESTAMP( aCaption )\ + {\ + CURRENT_TIME( dt );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ) );\ + } + + #define TIMESTAMP_1( aCaption, aP1 )\ + {\ + CURRENT_TIME( dt );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ),aP1 );\ + } + + #define TIMESTAMP_2( aCaption, aP1, aP2 )\ + {\ + CURRENT_TIME( dt );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ),aP1,aP2 );\ + } + + #define TIMESTAMP_3( aCaption, aP1, aP2, aP3 )\ + {\ + CURRENT_TIME( dt );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend,\ + PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ),aP1,aP2,aP3 );\ + } + + #else//TRACE_INTO_FILE not defined + + #define TIMESTAMP( aCaption )\ + {\ + CURRENT_TIME( dt );\ + RDebug::Print( PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ) );\ + } + + #define TIMESTAMP_1( aCaption, aP1 )\ + {\ + CURRENT_TIME( dt );\ + RDebug::Print( PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ),aP1 );\ + } + + #define TIMESTAMP_2( aCaption, aP1, aP2 )\ + {\ + CURRENT_TIME( dt );\ + RDebug::Print( PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ),aP1,aP2 );\ + } + + #define TIMESTAMP_3( aCaption, aP1, aP2, aP3 )\ + {\ + CURRENT_TIME( dt );\ + RDebug::Print( PREFIX_TIMESTAMP(aCaption),EXTRACT_TIME( dt ),aP1,aP2,aP3 );\ + } + + #endif//TRACE_INTO_FILE + +#else//TIMESTAMP_TRACE not defined + + #define TIMESTAMP( aCaption ) + #define TIMESTAMP_1( aCaption, aP1 ) + #define TIMESTAMP_2( aCaption, aP1, aP2 ) + #define TIMESTAMP_3( aCaption, aP1, aP2, aP3 ) + +#endif//TIMESTAMP_TRACE + +//----------------------------------------------------------------------------- +// Trace assert macros +//----------------------------------------------------------------------------- +// +#ifdef _DEBUG + + #ifdef TRACE_INTO_FILE + + #define PANIC_TRACE_2( aMsg, aP1, aP2 )\ + {\ + TPtrC8 trace( _S8( aMsg ) );\ + RFileLogger::WriteFormat( DriveAndPath( KTraceFile ), NameAndExt( KTraceFile ),\ + EFileLoggingModeAppend, trace, aP1, aP2 );\ + } + + #else//TRACE_INTO_FILE not defined + + #define PANIC_TRACE_2( aMsg, aP1, aP2 )\ + {\ + RDebug::Printf( aMsg, aP1, aP2 );\ + } + + #endif //TRACE_INTO_FILE not define + + static void Panic( const TDesC8& aFileName, const TInt aLineNum ) + { + PANIC_TRACE_2( "Assertion failed in file=%S, line=%d", &aFileName, aLineNum ); + User::Invariant(); + } + + #define ASSERT_ALWAYS_TRACE Panic( _L8(__FILE__), __LINE__ ); + #define ASSERT_TRACE( _s ) if ( !( _s ) ) { ASSERT_ALWAYS_TRACE; } + +#else // _DEBUG + + #define ASSERT_ALWAYS_TRACE + #define ASSERT_TRACE( _s ) + +#endif // _DEBUG + +//----------------------------------------------------------------------------- +// Event logging macros +//----------------------------------------------------------------------------- +// +#ifdef LOG_INTO_FILE + + #define _PREFIX_LOG( aMsg ) _PREFIX_TRACE( "[LOG] " L##aMsg ) + + class TLogObjectAppend + { + public: + inline TLogObjectAppend() + { + if ( iFlogger.Connect() == KErrNone ) + { + iFlogger.CreateLog( DriveAndPath(KLogFile), NameAndExt(KLogFile), + EFileLoggingModeAppend ); + } + } + inline ~TLogObjectAppend() + { + iFlogger.Close(); + } + public: + RFileLogger iFlogger; + }; + + class TLogObjectNew + { + public: + inline TLogObjectNew() + { + if ( iFlogger.Connect() == KErrNone ) + { + iFlogger.CreateLog( DriveAndPath(KLogFile), NameAndExt(KLogFile), + EFileLoggingModeOverwrite ); + } + } + inline ~TLogObjectNew() + { + iFlogger.Close(); + } + public: + RFileLogger iFlogger; + }; + + /* + * Use LOG_OBJECT as a member in class declaration or in a method needing logging support + * before using any other log macros + * + * DO NOT enter semicolon after this macro when used in class declaration to avoid compiler + * warning. + */ + #define LOG_OBJECT TLogObjectAppend _floggerObject; + + /* + * Use LOG_OBJECT_NEW as a member in class declaration or in a method needing logging support + * before using any other log macros. Macro overwrites the existing log file. + * + * DO NOT enter semicolon after this macro when used in class declaration to avoid compiler + * warning. + */ + #define LOG_OBJECT_NEW TLogObjectNew _floggerObject; + + /* + * Use LOG macros to write log file + */ + #define LOG( aMsg ) _floggerObject.iFlogger.WriteFormat( _PREFIX_LOG( aMsg ) ); + + #define LOG_1( aMsg, aP1 ) _floggerObject.iFlogger.WriteFormat( _PREFIX_LOG( aMsg ), aP1 ); + + #define LOG_2( aMsg, aP1, aP2 ) _floggerObject.iFlogger.WriteFormat( _PREFIX_LOG( aMsg ), aP1, aP2 ); + + #define LOG_3( aMsg, aP1, aP2, aP3 ) _floggerObject.iFlogger.WriteFormat( _PREFIX_LOG( aMsg ), aP1, aP2, aP3 ); + + #define LOG_4( aMsg, aP1, aP2, aP3, aP4 )\ + _floggerObject.iFlogger.WriteFormat( _PREFIX_LOG( aMsg ), aP1, aP2, aP3, aP4 ); + + #define LOG_5( aMsg, aP1, aP2, aP3, aP4, aP5 )\ + _floggerObject.iFlogger.WriteFormat( _PREFIX_LOG( aMsg ), aP1, aP2, aP3, aP4, aP5 ); + +#else //LOG_INTO_FILE not defined + + #define LOG_OBJECT + #define LOG_OBJECT_NEW + #define LOG( aMsg ) + #define LOG_1( aMsg, aP1 ) + #define LOG_2( aMsg, aP1, aP2 ) + #define LOG_3( aMsg, aP1, aP2, aP3 ) + #define LOG_4( aMsg, aP1, aP2, aP3, aP4 ) + #define LOG_5( aMsg, aP1, aP2, aP3, aP4, aP5 ) + +#endif //LOG_INTO_FILE + +#endif // TRACE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/inc/traceconfiguration.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/inc/traceconfiguration.hrh Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 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" +* 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: +*/ + + +#ifndef TRACECONFIGURATION_HRH +#define TRACECONFIGURATION_HRH + +//----------------------------------------------------------------------------- +// Trace definitions +//----------------------------------------------------------------------------- +// + +/** +* Error trace enabled +*/ +#if defined _DEBUG + #define ERROR_TRACE +#else + #undef ERROR_TRACE +#endif + +/** +* Info trace enabled +*/ +#if defined _DEBUG + #define INFO_TRACE + #define TIMESTAMP_TRACE +#else + #undef INFO_TRACE + #undef TIMESTAMP_TRACE +#endif + +/** +* Function trace enabled +*/ +#if defined _DEBUG && defined __FUNC_TRACE__ + #define FUNC_TRACE +#else + #undef FUNC_TRACE +#endif + +/** +* Timestamp tracing on +*/ +#if defined _DEBUG && defined __TIMESTAMP_TRACE__ + #define TIMESTAMP_TRACE +#else + #undef TIMESTAMP_TRACE +#endif + +/** +* Tracing current client process and thread +*/ +#ifdef _DEBUG + #define CLIENT_TRACE +#else + #undef CLIENT_TRACE +#endif + +/** +* Tracing into file enabled, default RDebug +*/ +#ifdef __TRACE_INTO_FILE__ + #define TRACE_INTO_FILE +#else + #undef TRACE_INTO_FILE +#endif + +/** +* Logging events into file enabled +*/ +#ifdef __LOG_INTO_FILE__ + #define LOG_INTO_FILE +#else + #undef LOG_INTO_FILE +#endif + +#endif diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/inc/tracedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/inc/tracedefs.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 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" +* 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: +*/ + + +#ifndef TRACEDEFS_H +#define TRACEDEFS_H + + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- +// + +/** +* Trace prefixes for macros with component name. +*/ +#define _PREFIX_TRACE( a ) TPtrC( (const TText*) L"[DLNAEXAMPLEAPP]: " L##a ) +#define _PREFIX_TRACE_2( a, b ) TPtrC( (const TText*) L"[DLNAEXAMPLEAPP]: " L##a L##b ) +#define _PREFIX_TRACE8( a ) (const char*)( "[DLNAEXAMPLEAPP] " ##a ) + +/** +* Files for traces and event log +*/ +#define TRACE_FILE "c:\\logs\\dlnaexampleapp\\dlnaexampleapp_trace.txt" +#define LOG_FILE "c:\\logs\\dlnaexampleapp\\dlnaexampleapp_log.txt" + +#endif // TRACEDEFS_H diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/install/dlnasrv_exampleapp.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/install/dlnasrv_exampleapp.pkg Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,33 @@ +; This file is based on the dlnasrv_exampleapp_template.pkg generated by qmake +; + +; Language +&EN + + +; SIS header: name, uid, version +#{"dlnasrv_exampleapp"},(0xE0000000),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 4, {"Qt"} +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + + +; Executable and default resource files +"/epoc32/release/armv5/urel/dlnasrv_exampleapp.exe" - "!:\sys\bin\dlnasrv_exampleapp.exe" +"/epoc32/data/z/resource/apps/dlnasrv_exampleapp.rsc" - "!:\resource\apps\dlnasrv_exampleapp.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/dlnasrv_exampleapp_reg.rsc" - "!:\private\10003a3f\import\apps\dlnasrv_exampleapp_reg.rsc" + +; Manual PKG post-rules from PRO files diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/src/exampleappengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/src/exampleappengine.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,330 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "exampleappengine.h" +#include "exampleappengine_p.h" +#include "trace.h" + +/*! + /class ExampleAppEngine + /brief Implements the playback engine and DLNA interface for the UI. +*/ + +/*! + C++ constructor. +*/ +ExampleAppEngine::ExampleAppEngine(): d_ptr(new ExampleAppEnginePrivate()) +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->q_ptr = this; + } +} + +/*! + C++ destructor. +*/ +ExampleAppEngine::~ExampleAppEngine() +{ + FUNC_LOG + + delete d_ptr; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::construct() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->construct(); + } +} + +/*! + description + + /a + /return +*/ +int ExampleAppEngine::getIap() const +{ + FUNC_LOG + + int iap(0); + + if (d_ptr) + { + iap = d_ptr->getConnectedIap(); + } + + return iap; +} + +/*! + description + + /a + /return +*/ +QString ExampleAppEngine::getIapName() const +{ + FUNC_LOG + + QString iapName; + + if (d_ptr) + { + iapName = d_ptr->getConnectedIapName(); + } + + return iapName; +} + +/*! + description + + /a + /return +*/ +bool ExampleAppEngine::isSeekSupported() const +{ + FUNC_LOG + + bool isSupported(false); + + if (d_ptr) + { + isSupported = d_ptr->isSeekSupported(); + } + + return isSupported; +} + +/*! + description + + /a + /return +*/ +int ExampleAppEngine::getPlaybackState() const +{ + FUNC_LOG + + int state(ExampleAppEngine::PlaybackStateStopped); + + if (d_ptr) + { + state = d_ptr->getPlaybackState(); + } + + return state; +} + +/*! + description + + /a + /return +*/ +bool ExampleAppEngine::isPauseSupported() const +{ + FUNC_LOG + + bool isSupported(false); + + if (d_ptr) + { + isSupported = d_ptr->isPauseSupported(); + } + + return isSupported; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::searchRenderingDevices() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->searchRenderingDevices(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::prepareRenderingDevice(const QString &uuid) +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->prepareRenderingDevice(uuid); + } +} + +/*! + description + + /a + /return +*/ +int ExampleAppEngine::initFile(const QString& file) +{ + FUNC_LOG + + int err(-1); + + if (d_ptr) + { + err = d_ptr->initFile(file); + } + + return err; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::play() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->play(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::pause() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->pause(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::stop() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->stop(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::volumeUp() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->volumeUp(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::volumeDown() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->volumeDown(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::rew() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->rew(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEngine::ff() +{ + FUNC_LOG + + if (d_ptr) + { + d_ptr->ff(); + } +} + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/src/exampleappengine_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/src/exampleappengine_p.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,1065 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "exampleappengine_p.h" +#include "trace.h" + +/*! + /class ExampleAppEnginePrivate + /brief Implements interface to Symbian side DLNA APIs. +*/ + +/*! + C++ constructor. +*/ +ExampleAppEnginePrivate::ExampleAppEnginePrivate(): + q_ptr(0), + mSettingsEngine(0), + mAVRenderingSession(0), + mRenderingStateMachine(0), + mVolumeStateMachine(0), + mAVController(0), + mIap(0), + mIapName(""), + mDevices(0), + mDevice(0), + mPlaybackState(ExampleAppEngine::PlaybackStateStopped), + mItemResolver(0) +{ + FUNC_LOG + + TRAP_IGNORE(mSettingsEngine = CUPnPSettingsEngine::NewL()); + + TRAP_IGNORE(mDevices = CUpnpAVDeviceList::NewL()); + + TRAP_IGNORE(mConnectionMonitor = CUPnPConnectionMonitor::NewL(0)); + mConnectionMonitor->SetObserver(*this); +} + +/*! + C++ destructor. +*/ +ExampleAppEnginePrivate::~ExampleAppEnginePrivate() +{ + FUNC_LOG + + delete mItemResolver; + + delete mDevices; + + delete mSettingsEngine; + + if (mAVRenderingSession) + { + if (mAVController) + { + mAVController->StopRenderingSession(*mAVRenderingSession); + } + } + + delete mRenderingStateMachine; + + delete mVolumeStateMachine; + + if (mAVController) + { + mAVController->Release(); + } + + delete mConnectionMonitor; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::construct() +{ + FUNC_LOG + + resolveIapL(); + resolveIapNameL(); +} + +/*! + description + + /a + /return +*/ +int ExampleAppEnginePrivate::getConnectedIap() const +{ + FUNC_LOG + + return mIap; +} + +/*! + description + + /a + /return +*/ +QString ExampleAppEnginePrivate::getConnectedIapName() const +{ + FUNC_LOG + + return mIapName; +} + +/*! + description + + /a + /return +*/ +int ExampleAppEnginePrivate::getPlaybackState() const +{ + FUNC_LOG + + return mPlaybackState; +} + +/*! + description + + /a + /return +*/ +bool ExampleAppEnginePrivate::isSeekSupported() const +{ + FUNC_LOG + + // TODO: return real value when seek is implemented + + return false; +} + +/*! + description + + /a + /return +*/ +bool ExampleAppEnginePrivate::isPauseSupported() const +{ + FUNC_LOG + + bool isSupported(false); + + if (mDevice) + { + isSupported = mDevice->PauseCapability(); + } + + return isSupported; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::searchRenderingDevices() +{ + FUNC_LOG + + if (mIap) + { + // first create av controller + if (!mAVController) + { + TRAP_IGNORE(mAVController = UPnPAVControllerFactory::NewUPnPAVControllerL()); + if (!mAVController) + { + return; + } + mAVController->SetDeviceObserver(*this); + } + + // check if devices have been found + TRAP_IGNORE(searchRenderingDevicesL()); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::prepareRenderingDevice(const QString &uuid) +{ + FUNC_LOG + + TRAP_IGNORE(prepareRenderingDeviceL(uuid)); +} + +/*! + description + + /a + /return +*/ +int ExampleAppEnginePrivate::initFile(const QString& file) +{ + FUNC_LOG + + TRAPD(err, initFileL(file)); + + return err; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::play() +{ + FUNC_LOG + + TRAP_IGNORE(playL()); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::pause() +{ + FUNC_LOG + + TRAP_IGNORE(pauseL()); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::stop() +{ + FUNC_LOG + + TRAP_IGNORE(stopL()); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::volumeUp() +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::volumeDown() +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::rew() +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::ff() +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice) +{ + FUNC_LOG + + TRAP_IGNORE(upnpDeviceDiscoveredL(aDevice)); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice) +{ + FUNC_LOG + + // search device from list + CUpnpAVDevice *device(NULL); + int count(mDevices->Count()); + int index(0); + for (int i = 0; i < count; i++) + { + device = (*mDevices)[i]; + if (device->Uuid() == aDevice.Uuid()) + { + index = i; + break; + } + device = NULL; + } + + // remove if device was found + if (device) + { + mDevices->Remove(index); + + if (device->Uuid() == mDevice->Uuid()) + { + stopRenderingSession(); + } + + QString name = asString8(device->FriendlyName()); + QString uuid = asString8(device->Uuid()); + emit q_ptr->renderingDeviceDisappeared(name, uuid); + + delete device; + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::WLANConnectionLost() +{ + FUNC_LOG + + // no implementation required +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::VolumeResult(TInt aError, + TInt aVolumeLevel, + TBool aActionResponse) +{ + FUNC_LOG + + if (mVolumeStateMachine) + { + mVolumeStateMachine->VolumeResult(aError, aVolumeLevel, aActionResponse); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::MuteResult(TInt aError, + TBool aMute, + TBool aActionResponse) +{ + FUNC_LOG + + if (mVolumeStateMachine) + { + mVolumeStateMachine->MuteResult(aError, aMute, aActionResponse); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::InteractOperationComplete(TInt aError, + TUPnPAVInteractOperation aOperation) +{ + FUNC_LOG + + if (mRenderingStateMachine) + { + mRenderingStateMachine->InteractOperationComplete(aError, aOperation); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::PositionInfoResult(TInt aError, + const TDesC8& aTrackPosition, + const TDesC8& aTrackLength) +{ + FUNC_LOG + + if (mRenderingStateMachine) + { + mRenderingStateMachine->PositionInfoResult(aError, aTrackPosition, aTrackLength); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::SetURIResult(TInt aError) +{ + FUNC_LOG + + if (mRenderingStateMachine) + { + mRenderingStateMachine->SetURIResult(aError); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::SetNextURIResult(TInt aError) +{ + FUNC_LOG + + if (mRenderingStateMachine) + { + mRenderingStateMachine->SetNextURIResult(aError); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::MediaRendererDisappeared(TUPnPDeviceDisconnectedReason /*aReason*/) +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::RendererSyncReady(TInt /*aError*/, Upnp::TState /*aState*/) +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::RenderingStateChanged(TInt aError, + Upnp::TState aState, + TBool /*aUserOriented*/, + TInt /*aStateParam*/) +{ + FUNC_LOG + + int state(ExampleAppEngine::PlaybackStateStopped); + + if (aError == KErrNone) + { + switch (aState) + { + case Upnp::EBuffering: + { + state = ExampleAppEngine::PlaybackStateBuffering; + break; + } + case Upnp::EPlaying: + { + state = ExampleAppEngine::PlaybackStatePlaying; + break; + } + case Upnp::EPaused: + { + state = ExampleAppEngine::PlaybackStatePaused; + break; + } + default: + { + // no actions, stopped state is used + break; + } + } + } + + mPlaybackState = state; + + emit q_ptr->stateChanged(mPlaybackState); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::PositionSync(TInt /*aError*/, + Upnp::TPositionMode /*aMode*/, + TInt /*aDuration*/, + TInt /*aPosition*/) +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::VolumeSyncReady(TInt /*aError*/) +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::VolumeChanged(TInt /*aError*/, + TInt /*aVolume*/, + TBool /*aUserOriented*/) +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::MuteChanged(TInt /*aError*/, + TBool /*aMuteState*/, + TBool /*aUserOriented*/) +{ + FUNC_LOG + + // TODO: implement +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::ResolveComplete(const MUPnPItemResolver& /*aResolver*/, + TInt aError) +{ + FUNC_LOG + + ERROR(aError, "Error while resolving an item"); + + emit q_ptr->initComplete(aError); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::ConnectionLost(TBool /*aUserOriented*/) +{ + FUNC_LOG + + stopRenderingSession(); + + mIap = 0; + mIapName = "Not connected"; + + emit q_ptr->iapUpdated(mIapName); + emit q_ptr->iapUpdated(mIap); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::ConnectionCreated(TInt /*aConnectionId*/) +{ + FUNC_LOG + + TRAP_IGNORE(resolveIapL()); + TRAP_IGNORE(resolveIapNameL()); + + emit q_ptr->iapUpdated(mIapName); + emit q_ptr->iapUpdated(mIap); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::searchRenderingDevicesL() +{ + FUNC_LOG + + emit q_ptr->renderingDeviceSearchStarted(); + + CUpnpAVDeviceList *deviceList = mAVController->GetMediaRenderersL(); + int count(deviceList->Count()); + for (int i = count - 1; i >= 0; i--) + { + CUpnpAVDevice *device = (*deviceList)[i]; + upnpDeviceDiscoveredL(*device); + } + delete deviceList; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::upnpDeviceDiscoveredL(const CUpnpAVDevice& aDevice) +{ + FUNC_LOG + + if (aDevice.DeviceType() == CUpnpAVDevice::EMediaRenderer) + { + CUpnpAVDevice *device(0); + int count(mDevices->Count()); + for (int i = 0; i < count; i++) + { + device = (*mDevices)[i]; + if (device->Uuid() == aDevice.Uuid()) + { + // found + break; + } + device = 0; + } + + if (!device) + { + // create new device + device = CUpnpAVDevice::NewL(aDevice); + mDevices->AppendDeviceL(*device); + + QString name = asString8(device->FriendlyName()); + QString uuid = asString8(device->Uuid()); + + INFO_2("New rendering device found: Name = %s, Uuid = %s", + name.utf16(), uuid.utf16()); + + emit q_ptr->renderingDeviceFound(name, uuid); + } + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::prepareRenderingDeviceL(const QString &uuid) +{ + FUNC_LOG + + // get current uuid + QString currentUuid; + if (mDevice) + { + currentUuid = asString8(mDevice->Uuid()); + } + + // check if uuid is different than the requsted one + if (currentUuid != uuid) + { + // search the rendering device + CUpnpAVDevice *device = 0; + int count(mDevices->Count()); + for (int i = 0; i < count; i++) + { + device = (*mDevices)[i]; + QString deviceUuid = asString8(device->Uuid()); + if (deviceUuid == uuid) + { + // device found + break; + } + device = 0; + } + + stopRenderingSession(); + + mDevice = device; + if (mDevice) + { + startRenderingSessionL(*mDevice); + } + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::startRenderingSessionL(const CUpnpAVDevice &device) +{ + FUNC_LOG + + // start new rendering session + mAVRenderingSession = &mAVController->StartRenderingSessionL(device); + mAVRenderingSession->SetObserver(*this); + + // start new rendering state machine + mRenderingStateMachine = CUpnpRenderingStateMachine::NewL(*mAVRenderingSession); + mRenderingStateMachine->SetObserver(*this); + mRenderingStateMachine->SyncL(); + + // start new volume state machine + mVolumeStateMachine = CUpnpVolumeStateMachine::NewL(*mAVRenderingSession); + mVolumeStateMachine->SetObserver(*this); + mVolumeStateMachine->SyncL(); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::stopRenderingSession() +{ + FUNC_LOG + + // stop ongoing playback + if (mPlaybackState != ExampleAppEngine::PlaybackStateStopped) + { + stop(); + RenderingStateChanged(KErrNone, Upnp::EStopped, EFalse, 0); + } + + // release rendering state machine + delete mRenderingStateMachine; + mRenderingStateMachine = 0; + + // release volume state machine + delete mVolumeStateMachine; + mVolumeStateMachine = 0; + + // stop and release rendering session + if (mAVController && mAVRenderingSession) + { + mAVController->StopRenderingSession(*mAVRenderingSession); + mAVRenderingSession = 0; + } + + mDevice = 0; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::initFileL(const QString &file) +{ + FUNC_LOG + + delete mItemResolver; + mItemResolver = 0; + + if (mDevice) + { + TPtrC filePath(file.utf16(), file.length()); + TUPnPSelectDefaultResource selector; + mItemResolver = + UPnPItemResolverFactory::NewLocalItemResolverL( + filePath, *mAVController, selector); + mItemResolver->ResolveL(*this, mDevice); + } + else + { + // rendering device has not been selected + User::Leave(KErrNotReady); + } +} + +/*! + description + + /a + /return +*/ +bool ExampleAppEnginePrivate::isReadyForPlayback() const +{ + FUNC_LOG + + bool isReady(false); + + if (mDevice && // device is selected + mAVRenderingSession && // av rendering session is created + mRenderingStateMachine && // rendering state machine is created + mVolumeStateMachine) // volume state machine is created + { + isReady = true; + } + + return isReady; +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::playL() +{ + FUNC_LOG + + if (isReadyForPlayback()) + { + mRenderingStateMachine->CommandL(Upnp::EPlay, 0, &mItemResolver->Item()); + } + else + { + User::Leave(KErrNotReady); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::pauseL() +{ + FUNC_LOG + + if (isReadyForPlayback()) + { + // double check that the rendering device supports pause capability + if (mDevice->PauseCapability()) + { + mRenderingStateMachine->CommandL(Upnp::EPause); + } + else + { + User::Leave(KErrNotSupported); + } + } + else + { + User::Leave(KErrNotReady); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::stopL() +{ + FUNC_LOG + + if (isReadyForPlayback()) + { + mRenderingStateMachine->CommandL(Upnp::EStop); + } + else + { + User::Leave(KErrNotReady); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::resolveIapL() +{ + FUNC_LOG + + // code below could be optimized so that connections to socket server + // are only made once + RSocketServ socketServ; + int err = socketServ.Connect(); + if (err == KErrNone) + { + RConnection connection; + err = connection.Open(socketServ); + if (err == KErrNone) + { + uint connectionCount(0); + err = connection.EnumerateConnections(connectionCount); + if (err == KErrNone && + connectionCount == 1) + { + // One active connection - find it and try using it + TPckgBuf connectionInfo; + for (int i = 1; i <= connectionCount; ++i) + { + if (connection.GetConnectionInfo(i, connectionInfo) == KErrNone) + { + // resolve iap id and name + mIap = connectionInfo().iIapId; + } + } + connection.Close(); + } + } + socketServ.Close(); + } + + mSettingsEngine->SetAccessPoint(mIap); +} + +/*! + description + + /a + /return +*/ +void ExampleAppEnginePrivate::resolveIapNameL() +{ + FUNC_LOG + + HBufC* iapName(NULL); + TRAP_IGNORE(iapName = CUPnPSettingsEngine::GetCurrentIapNameL(mIap)); + if (iapName) + { + mIapName = asString(*iapName); + delete iapName; + } +} + +/*! + description + + /a + /return +*/ +QString ExampleAppEnginePrivate::asString(const TDesC &desc) const +{ + return QString::fromUtf16(desc.Ptr(), desc.Length()); +} + +/*! + description + + /a + /return +*/ +QString ExampleAppEnginePrivate::asString8(const TDesC8 &desc) const +{ + return QString::fromUtf8((char*)desc.Ptr(), desc.Length()); +} + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/src/exampleappui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/src/exampleappui.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,612 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "exampleappui.h" +#include "exampleappengine.h" +#include "trace.h" + +/*! + \class ExampleAppUi + \brief Implements the application UI for Dlnasrv example application. +*/ + +/*! + ExampleAppUi constructor. + */ +ExampleAppUi::ExampleAppUi(): + mEngine(0), + mSelectedRenderer(0), + mSelectedFileLabel(0), + mPlaybackStatus(0), + mRenderingDevices(0), + mPauseButton(0), + mStopButton(0), + mRewButton(0), + mFfButton(0), + mSelectFileButton(0), + mSearchDevicesButton(0), + mSelectedFile("") +{ + FUNC_LOG +} + +/*! + ExampleAppUi destructor. +*/ +ExampleAppUi::~ExampleAppUi() +{ + FUNC_LOG + + delete mEngine; +} + +/*! + description + + /a + /return + */ +void ExampleAppUi::construct() +{ + FUNC_LOG + + createEngine(); + createUi(); +} + +/*! + description + + /a + /return + */ +void ExampleAppUi::createUi() +{ + FUNC_LOG + + // create main view + QWidget *view = new QWidget; + setCentralWidget(view); + + // create main view layout + QVBoxLayout *mainLayout = new QVBoxLayout; + view->setLayout(mainLayout); + + // create accesspoint selection + QLayout *layout = createApSelectionUi(); + mainLayout->addLayout(layout); + mainLayout->addSpacing(40); + + // create renderer selection + layout = createRendererSelectionUi(); + mainLayout->addLayout(layout); + mainLayout->addSpacing(40); + + // create file selection + layout = createFileSelectionUi(); + mainLayout->addLayout(layout); + mainLayout->addSpacing(40); + + // create playback ui + layout = createPlaybackUi(); + mainLayout->addLayout(layout); + mainLayout->addSpacing(40); +} + +/*! + description + + /a + /return + */ +QLayout *ExampleAppUi::createApSelectionUi() +{ + FUNC_LOG + + QVBoxLayout *layout = new QVBoxLayout; + QHBoxLayout *topLayout = new QHBoxLayout; + QLabel *titleLabel = new QLabel(tr("Access point:")); + QLabel *statusLabel = new QLabel(tr("Not connected")); + + // connect signals + connect(mEngine, SIGNAL(iapUpdated(const QString &)), statusLabel, SLOT(setText(const QString &))); + + // add widgets to top layout + topLayout->addWidget(titleLabel); + topLayout->addWidget(statusLabel); + + // add sub layouts to main layout + layout->addLayout(topLayout); + + // update iap + QString iapName = mEngine->getIapName(); + if (iapName.length()) + { + statusLabel->setText(iapName); + } + + return layout; +} + +/*! + description + + /a + /return + */ +QLayout *ExampleAppUi::createRendererSelectionUi() +{ + FUNC_LOG + + QVBoxLayout *layout = new QVBoxLayout; + QHBoxLayout *topLayout = new QHBoxLayout; + QVBoxLayout *bottomLayout = new QVBoxLayout; + QLabel *titleLabel = new QLabel(tr("Rendering device:")); + QLabel *statusLabel = new QLabel(tr("Not connected")); + QPushButton *searchButton = new QPushButton(tr("Search for new devices")); + QComboBox *selectionComboBox = new QComboBox; + + // connect signals + connect(searchButton, SIGNAL(clicked()), mEngine, SLOT(searchRenderingDevices())); + connect(selectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectRenderingDevice(int))); + connect(mEngine, SIGNAL(iapUpdated(int)), this, SLOT(enableRenderingDeviceSelection(int))); + + // add widgets to top layout + topLayout->addWidget(titleLabel); + topLayout->addWidget(statusLabel); + + // add widgets to bottom layout + bottomLayout->addWidget(searchButton); + bottomLayout->addWidget(selectionComboBox); + + // add sub layouts to main layout + layout->addLayout(topLayout); + layout->addLayout(bottomLayout); + + // store rendering devices + mRenderingDevices = selectionComboBox; + mSelectedRenderer = statusLabel; + mSearchDevicesButton = searchButton; + + // disable search button if iap has not been defined + if (!mEngine->getIap()) + { + disableRenderingDeviceSelection(); + } + + return layout; +} + +/*! + description + + /a + /return + */ +QLayout *ExampleAppUi::createFileSelectionUi() +{ + FUNC_LOG + + QVBoxLayout *layout = new QVBoxLayout; + QHBoxLayout *topLayout = new QHBoxLayout; + QVBoxLayout *bottomLayout = new QVBoxLayout; + QLabel *titleLabel = new QLabel(tr("Selected file:")); + QLabel *statusLabel = new QLabel(tr("None")); + QPushButton *selectButton = new QPushButton(tr("Select media file")); + + // connect signals + connect(selectButton, SIGNAL(clicked()), this, SLOT(selectFile())); + + // add widgets to top layout + topLayout->addWidget(titleLabel); + topLayout->addWidget(statusLabel); + + // add widgets to bottom layout + bottomLayout->addWidget(selectButton); + + // add sub layouts to main layout + layout->addLayout(topLayout); + layout->addLayout(bottomLayout); + + // store status label and select file button + mSelectedFileLabel = statusLabel; + mSelectFileButton = selectButton; + + // disable select file button by default + disableFileSelection(); + + return layout; +} + +/*! + description + + /a + /return + */ +QLayout *ExampleAppUi::createPlaybackUi() +{ + FUNC_LOG + + QVBoxLayout *layout = new QVBoxLayout; + QHBoxLayout *topLayout = new QHBoxLayout; + QHBoxLayout *bottomLayout = new QHBoxLayout; + QLabel *titleLabel = new QLabel(tr("Playback status:")); + QLabel *statusLabel = new QLabel(tr("Stopped")); + QPushButton *rewButton = new QPushButton(tr("Rew")); + QPushButton *playButton = new QPushButton(tr("Play")); + QPushButton *pauseButton = new QPushButton(tr("Pause")); + QPushButton *stopButton = new QPushButton(tr("Stop")); + QPushButton *ffButton = new QPushButton(tr("Ff")); + + // connect signals + connect(rewButton, SIGNAL(clicked()), mEngine, SLOT(rew())); + connect(playButton, SIGNAL(clicked()), mEngine, SLOT(play())); + connect(pauseButton, SIGNAL(clicked()), mEngine, SLOT(pause())); + connect(stopButton, SIGNAL(clicked()), mEngine, SLOT(stop())); + connect(ffButton, SIGNAL(clicked()), mEngine, SLOT(ff())); + + // add widgets to top layout + topLayout->addWidget(titleLabel); + topLayout->addWidget(statusLabel); + + // add widgets to bottom layout + bottomLayout->addWidget(rewButton); + bottomLayout->addWidget(playButton); + bottomLayout->addWidget(pauseButton); + bottomLayout->addWidget(stopButton); + bottomLayout->addWidget(ffButton); + + // add sub layouts to main layout + layout->addLayout(topLayout); + layout->addLayout(bottomLayout); + + // store status label + mPlaybackStatus = statusLabel; + mPlayButton = playButton; + mPauseButton = pauseButton; + mStopButton = stopButton; + mRewButton = rewButton; + mFfButton = ffButton; + + // disable all buttons by default + disablePlayback(); + + return layout; +} + +/*! + description + + /a + /return + */ +void ExampleAppUi::createEngine() +{ + FUNC_LOG + + mEngine = new ExampleAppEngine; + mEngine->construct(); + + // connect signals + connect(mEngine, SIGNAL(stateChanged(int)), this, SLOT(updateState(int))); + connect(mEngine, SIGNAL(renderingDeviceSearchStarted()), this, SLOT(deviceSearchStarted())); + connect(mEngine, SIGNAL(renderingDeviceFound(const QString &, const QString &)), this, SLOT(addRenderingDevice(const QString &, const QString &))); + connect(mEngine, SIGNAL(renderingDeviceDisappeared(const QString &, const QString &)), this, SLOT(removeRenderingDevice(const QString &, const QString &))); + connect(mEngine, SIGNAL(initComplete(int)), this, SLOT(enablePlayback(int))); +} + +/*! + description + + /a + /return + */ +void ExampleAppUi::updateState(int newState) +{ + FUNC_LOG + + switch (newState) + { + case ExampleAppEngine::PlaybackStateBuffering: + { + mPlaybackStatus->setText(tr("Buffering")); + break; + } + case ExampleAppEngine::PlaybackStatePlaying: + { + mPlaybackStatus->setText(tr("Playing")); + break; + } + case ExampleAppEngine::PlaybackStatePaused: + { + mPlaybackStatus->setText(tr("Paused")); + break; + } + case ExampleAppEngine::PlaybackStateStopped: + // fall through + default: + { + mPlaybackStatus->setText(tr("Stopped")); + break; + } + } + + // update playback controls + enablePlayback(); +} + +/*! + description + + /a + /return + */ +void ExampleAppUi::selectFile() +{ + FUNC_LOG + + mSelectedFile = QFileDialog::getOpenFileName(this, + tr("Open file"), + tr("e:\\"), + tr("Media Files (*.mp3 *.jpg *.mp4)")); + if (mSelectedFile.length()) + { + // convert all '/' to '\' since symbian does not understand '/' + // characters in the file path + mSelectedFile.replace("/", "\\"); + + // update text to ui + QFileInfo fileInfo(mSelectedFile); + // use only 20 characters to fit text on screen + // since otherwise qt will panic with bad alloc + mSelectedFileLabel->setText(fileInfo.fileName().left(20)); + + // resolve and init file for rendering + int err = mEngine->initFile(mSelectedFile); + if (err != 0) + { + ERROR_1(err, "Failed to init file %s", mSelectedFile.utf16()); + + mSelectedFile = ""; + + mSelectedFileLabel->setText(tr("Could not init")); + + disablePlayback(); + } + } + else + { + mSelectedFileLabel->setText(tr("Not selected")); + + disablePlayback(); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::deviceSearchStarted() +{ + FUNC_LOG + + if (!mRenderingDevices->count()) + { + mSelectedRenderer->setText(tr("Searching")); + } +} + +/*! + description + + /a + /return + */ +void ExampleAppUi::addRenderingDevice(const QString &name, const QString &uuid) +{ + FUNC_LOG + + mRenderingDevices->addItem(name, QVariant(uuid)); +} + +/*! + description + + /a + /return + */ +void ExampleAppUi::removeRenderingDevice(const QString &/*name*/, const QString &uuid) +{ + FUNC_LOG + + int count(mRenderingDevices->count()); + for (int i = 0; i < count; i++) + { + QVariant userData(mRenderingDevices->itemData(i)); + if (userData.toString() == uuid) + { + mRenderingDevices->removeItem(i); + break; + } + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::selectRenderingDevice(int index) +{ + FUNC_LOG + + // use only 16 characters to fit on screen otherwise qt will panic with bad alloc + mSelectedRenderer->setText(mRenderingDevices->itemText(index).left(16)); + + QVariant userData(mRenderingDevices->itemData(index)); + mEngine->prepareRenderingDevice(userData.toString()); + + enablePlayback(); + enableFileSelection(); +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::enablePlayback(int result) +{ + FUNC_LOG + + if (result == 0 && + mSelectedFile.length()) + { + switch (mEngine->getPlaybackState()) + { + case ExampleAppEngine::PlaybackStateBuffering: + { + // disable all controls when buffering + disablePlayback(); + break; + } + case ExampleAppEngine::PlaybackStatePlaying: + { + mRewButton->setEnabled(mEngine->isSeekSupported()); + mPlayButton->setDisabled(true); + mPauseButton->setEnabled(mEngine->isPauseSupported()); + mStopButton->setEnabled(true); + mRewButton->setEnabled(mEngine->isSeekSupported()); + break; + } + case ExampleAppEngine::PlaybackStatePaused: + { + mRewButton->setEnabled(mEngine->isSeekSupported()); + mPlayButton->setEnabled(true); + mPauseButton->setDisabled(true); + mStopButton->setEnabled(true); + mRewButton->setEnabled(mEngine->isSeekSupported()); + break; + } + case ExampleAppEngine::PlaybackStateStopped: + { + mRewButton->setDisabled(true); + mPlayButton->setEnabled(true); + mPauseButton->setDisabled(true); + mStopButton->setDisabled(true); + mRewButton->setDisabled(true); + break; + } + default: + { + // invalid state, disable all buttons + disablePlayback(); + break; + } + } + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::disablePlayback() +{ + FUNC_LOG + + mPlayButton->setDisabled(true); + mPauseButton->setDisabled(true); + mStopButton->setDisabled(true); + mRewButton->setDisabled(true); + mFfButton->setDisabled(true); +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::enableFileSelection() +{ + FUNC_LOG + + mSelectFileButton->setEnabled(true); +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::disableFileSelection() +{ + FUNC_LOG + + mSelectFileButton->setDisabled(true); +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::enableRenderingDeviceSelection(int iap) +{ + FUNC_LOG + + if (iap) + { + mSearchDevicesButton->setEnabled(true); + mRenderingDevices->setEnabled(true); + } +} + +/*! + description + + /a + /return +*/ +void ExampleAppUi::disableRenderingDeviceSelection() +{ + FUNC_LOG + + mSearchDevicesButton->setDisabled(true); + mRenderingDevices->setDisabled(true); +} + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_exampleapp/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dlnasrv_exampleapp/src/main.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include "exampleappui.h" +#include "trace.h" + +int main(int argc, char *argv[]) +{ + FUNC_LOG + + QApplication app(argc, argv); + + ExampleAppUi exampleAppUi; + exampleAppUi.construct(); + exampleAppUi.showMaximized(); + + return app.exec(); +}; diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_plat/upnp_avcp_api/group/bld.inf --- a/dlnasrv_plat/upnp_avcp_api/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/** @file -* Copyright (c) 2006 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: File that exports the files belonging to -: UPnP AVCP API -* -*/ - - -#include "../../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/upnpavcontrolpointobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcontrolpointobserver.h) -../inc/upnpavcontrolpoint.h MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcontrolpoint.h) diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpoint.h --- a/dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpoint.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,631 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: AV control point class -* -*/ - - - -#ifndef C_CUPNPAVCONTROLPOINT_H -#define C_CUPNPAVCONTROLPOINT_H - - -// INCLUDES -#include "upnpavcontrolpointobserver.h" -#include "upnpcontrolpoint.h" -#include "upnphttpmessage.h" - -// FORWARD DECLARATIONS -class CUpnpActionResponseHandler; -class CUpnpStateUpdateHandler; -class CUpnpAvtActionFactory; -class CUpnpCdsActionFactory; -class CUpnpCmActionFactory; -class CUpnpRcActionFactory; -// CLASS DECLARATION - -/** -* Main class of AV Control Point. -* This class serves as an interface to AVCP library and contais functions for -* UPnP Action creation and sending as well as receiving Action responses and -* UPnP events. -* -* Prior using the CUpnpAVControlPoint class, client application has to create -* the network connection. If connection is not up and -* running, the CUpnpDispatcherEngine class construction will fail. -* See UPnP Interface Design document for instuctions. -* -* @since Series 60 2.6 -*/ -class CUpnpAVControlPoint : public CUpnpControlPoint - { -public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CUpnpAVControlPoint* NewL( - MUpnpAVControlPointObserver& aAVControlPointObserver - ); - - /** - * Destructor. - */ - IMPORT_C virtual ~CUpnpAVControlPoint(); - -public: // New functions - - /** - * Service search and getter function. - * @since Series 60 2.6 - * @param aDevice Target device of search. - * @param aServiceType Type of searched service. - * @return Found CUpnpService or NULL if not found. - */ - IMPORT_C CUpnpService* Service( - CUpnpDevice* aDevice, - const TDesC8& aServiceType); - - /** - * Device getter. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @return Founded device. - IMPORT_C const CUpnpDevice* Device(const TDesC8& aUuid); - */ - - - /** - * Creates and sends a SetTransportURI action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aCurrentUri Content URI. - * @param aCurrentMetaData Content metadata. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtSetTransportUriActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aCurrentUri, - const TDesC8& aCurrentMetaData); - - /** - * Creates and sends a SetNextTransportURI action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aNextUri Content URI. - * @param aNextMetaData Content metadata. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtSetNextTransportUriActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aNextUri, - const TDesC8& aNextMetaData); - - /** - * Creates and sends a Seek action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aUnit - * @param aTarget - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtSeekActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aUnit, - const TDesC8& aTarget); - - /** - * Creates and sends a GetMediaInfo action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtMediaInfoActionL(const TDesC8& aUuid,TInt aInstanceId); - - /** - * Creates and sends a GetTransportInfo action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtTransportInfoActionL(const TDesC8& aUuid,TInt aInstanceId); - - /** - * Creates and sends a GetPositionInfo action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtPositionInfoActionL(const TDesC8& aUuid,TInt aInstanceId); - - /** - * Creates and sends a GetDeviceCapabilities action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtDeviceCapabilitiesActionL(const TDesC8& aUuid,TInt aInstanceId); - - /** - * Creates and sends a GetTransportSetings action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtTransportSettingsActionL(const TDesC8& aUuid, TInt aInstanceId); - - /** - * Creates and sends a Stop action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtStopActionL(const TDesC8& aUuid, TInt aInstanceId); - - /** - * Creates and sends a Play action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aSpeed Speed of playback. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtPlayActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aSpeed); - - /** - * Creates and sends a Pause action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtPauseActionL(const TDesC8& aUuid, TInt aInstanceId); - - /** - * Creates and sends a Record action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtRecordActionL(const TDesC8& aUuid,TInt aInstanceId); - - /** - * Creates and sends a Next action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtNextActionL(const TDesC8& aUuid, TInt aInstanceId); - - /** - * Creates and sends a Previous action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtPreviousActionL(const TDesC8& aUuid, TInt aInstanceId); - - /** - * Creates and sends a SetPlayMode action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aPlayMode - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtSetPlayModeActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aPlayMode); - - /** - * Creates and sends a SetRecordQualityMode action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aRecordMode - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtSetRecordModeActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aRecordMode); - - /** - * Creates and sends a GetTransportIDs action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt AvtTransportsActionL(const TDesC8& aUuid, TInt aInstanceId); - - /** - * Creates and sends a Browse action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aObjectId Target's id. - * @param aBrowseFlag MetaData or DirectChildren. - * @param aFilter What is returned. - * @param aStartingIndex First returned item. - * @param aRequestedCount How manyy items is returned. - * @param aSortCriteria Sorting order. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsBrowseActionL( - const TDesC8& aUuid, - const TDesC8& aObjectId, - const TDesC8& aBrowseFlag, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria); - - /** - * Creates and sends a Search action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aObjectId Target's id. - * @param aSearchCriteria Search rules. - * @param aFilter What is returned. - * @param aStartingIndex First returned item. - * @param aRequestedCount How manyy items is returned. - * @param aSortCriteria Sorting order. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsSearchActionL( - const TDesC8& aUuid, - const TDesC8& aObjectId, - const TDesC8& aSearchCriteria, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria - ); - - /** - * Creates and sends a GetSystemUpdateID action. - * @since Series 60 2.6 - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsSystemUpdateIdActionL(const TDesC8& aUuid); - - /** - * Creates and sends a GetSearchCapabilities action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsSearchCapabilitiesActionL(const TDesC8& aUuid); - - /** - * Creates and sends a GetSortCapabilities action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsSortCapabilitiesActionL(const TDesC8& aUuid); - - /** - * Creates and sends a CreateObject action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aId Parent container. - * @param aElements Object in XML form. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsCreateObjectActionL( - const TDesC8& aUuid, - const TDesC8& aId, - const TDesC8& aElements); - - /** - * Creates and sends a ImportResource action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aSourceUri Source of import. - * @param aDestinationUri Destination of import. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsImportResourceActionL( - const TDesC8& aUuid, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri - ); - - /** - * Creates and sends a ExportResource action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aSourceUri Source of export. - * @param aDestinationUri Destination of export. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsExportResourceActionL( - const TDesC8& aUuid, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri ); - - /** - * Creates and sends a CreteReference action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aDestinationContainerId Place for reference. - * @param aSourceObjectId Referred object. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsCreateReferenceActionL( - const TDesC8& aUuid, - const TDesC8& aDestinationContainerId, - const TDesC8& aSourceObjectId ); - - /** - * Creates and sends a DeleteResource action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aResourceUri Resource to be deleted. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsDeleteResourceActionL( - const TDesC8& aUuid, - const TDesC8& aResourceUri ); - - /** - * Creates and sends a DestroyObject action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aObjectId Object to be destroyed. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsDestroyObjectActionL( - const TDesC8& aUuid, - const TDesC8& aObjectId ); - - /** - * Creates and sends a StopTransfer action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aTransferId Transfer to be stopped. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsStopTransferActionL(const TDesC8& aUuid, TInt aTransferId ); - - /** - * Creates and sends a GetTransferProgress action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aTransferId Observed transfer. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsTransferProgressActionL(const TDesC8& aUuid, TInt aTransferId ); - - /** - * Creates and sends a SetTransportURI action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aObjectID Updated object. - * @param aCurrentTagValue Current object XML. - * @param aNewTagValue New object XML. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CdsUpdateObjectActionL( - const TDesC8& aUuid, - const TDesC8& aObjectID, - const TDesC8& aCurrentTagValue, - const TDesC8& aNewTagValue ); - - /** - * Creates and sends a GetProtocolInfo action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CmProtocolInfoActionL(const TDesC8& aUuid); - - /** - * Creates and sends a GetCurrentConnections action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CmCurrentConnectionsActionL(const TDesC8& aUuid); - - /** - * Creates and sends a PrepareForConnection action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aRemoteProtocolInfo - * @param aPeerConnectionManager - * @param aPeerConnectionID - * @param aDirection - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CmPrepareConnectionActionL( - const TDesC8& aUuid, - const TDesC8& aRemoteProtocolInfo, - const TDesC8& aPeerConnectionManager, - TInt aPeerConnectionID, - const TDesC8& aDirection - ); - - /** - * Creates and sends a ConnectionComplete action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aConnectionId - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CmConnectionCompleteActionL( - const TDesC8& aUuid, - TInt aConnectionId - ); - - /** - * Creates and sends a GetCurrentConnectionInfo action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aConnectionId - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt CmCurrentConnectionInfoActionL( - const TDesC8& aUuid, - TInt aConnectionId - ); - - /** - * Creates and sends a GetVolume action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceID Rendring Instance. - * @param aChannel Audio channel. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt RcGetVolumetActionL( - const TDesC8& aUuid, - TInt aInstanceID, - const TDesC8& aChannel - ); - - /** - * Creates and sends a SetVolume action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aChannel Audio channel. - * @param aVolume - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt RcSetVolumetActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aChannel, - TInt aVolume - ); - - /** - * Creates and sends a GetMute action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aChannel Audio channel. - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt RcGetMuteActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aChannel - ); - - /** - * Creates and sends a SetTransportURI action. - * @since Series 60 2.6 - * @param aUuid A Universal Unique Identifier of device. - * @param aInstanceId Rendring Instance. - * @param aChannel Audio channel. - * @param aMute - * @return Error code. KErrNone if no errors. - */ - IMPORT_C TInt RcSetMuteActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aChannel, - const TDesC8& aMute - ); - - /** - * This function will be invoke if some network event will occure - * for example IP Address of UPnP changes - */ - IMPORT_C void NetworkEvent( CUpnpNetworkEventBase* aEvent ); - -protected: // Functions from base classes - - /** - * From CUpnpControlPoint State update handler. - */ - IMPORT_C void StateUpdatedL(CUpnpService* aService); - - /** - * From CUpnpControlPoint Device discovery handler. - */ - IMPORT_C void DeviceDiscoveredL(CUpnpDevice* aDevice); - - /** - * From CUpnpControlPoint Device dissappear handler. - */ - IMPORT_C void DeviceDisappearedL(CUpnpDevice* aDevice); - - /** - * From CUpnpControlPoint Action response handler function. - */ - IMPORT_C void ActionResponseReceivedL(CUpnpAction* aAction); - - /** - * From CUpnpControlPoint HTTP message handler function. - */ - IMPORT_C void HttpResponseReceivedL(CUpnpHttpMessage* aMessage); - - /** - * C++ default constructor. - */ - IMPORT_C CUpnpAVControlPoint(MUpnpAVControlPointObserver& aAVControlPointObserver); - - /** - * By default Symbian 2nd phase constructor is private. - */ - IMPORT_C void ConstructL(); - - /** - * Initialize CdsActionFactory if is equal NULL - */ - IMPORT_C void InitializeCdsActionFactoryL(); - -protected: // Data - //AV control point observer (engine) - MUpnpAVControlPointObserver& iAVControlPointObserver; - - //Action response handler - CUpnpActionResponseHandler* iActionResponseHandler; - - // UPnP event handler - CUpnpStateUpdateHandler* iStateUpdateHandler; - - // Action factories - CUpnpAvtActionFactory* iAvtActionFactory; - CUpnpCdsActionFactory* iCdsActionFactory; - CUpnpCmActionFactory* iCmActionFactory; - CUpnpRcActionFactory* iRcActionFactory; - }; - -#endif // C_CUPNPAVCONTROLPOINT_H - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpointobserver.h --- a/dlnasrv_plat/upnp_avcp_api/inc/upnpavcontrolpointobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,825 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: MUpnpAVControlPointObserver -* -*/ - - - -#ifndef C_MUPNPAVCONTROLPOINTOBSERVER_H -#define C_MUPNPAVCONTROLPOINTOBSERVER_H - -// INCLUDES -#include "upnpdevice.h" - -// CLASS DECLARATION - -/** -* Interface class. -* This class defines a observer interface for AV controlpoint -* -* @since Series 60 2.6 -*/ -class MUpnpAVControlPointObserver - { - public: // Constructors and destructor - - public: // New functions - /** - * Observer callback for rendering control Set Volume. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aChannel audio channel. - * @param aDesiredVolume - */ - virtual void RcSetVolumeResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstance, - const TDesC8& aChannel, - const TDesC8& aDesiredVolume) = 0; - public: // New functions - /** - * Observer callback for rendering control Get Volume. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aChannel audio channel. - * @param aCurrentVolume - */ - virtual void RcVolumeResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstance, - const TDesC8& aChannel, - const TDesC8& aCurrentVolume) = 0; - /** - * Observer callback for rendering control Set Mute. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aChannel audio channel. - * @param aDesiredMute - */ - virtual void RcSetMuteResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstance, - const TDesC8& aChannel, - const TDesC8& aDesiredMute) = 0; - /** - * Observer callback for rendering control Get Mute. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aChannel audio channel. - * @param aCurrentMute - */ - virtual void RcMuteResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstance, - const TDesC8& aChannel, - const TDesC8& aCurrentMute) = 0; - - - /** - * Observer callback for rendering control AV set transport uri. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aCurrentUri Current transport URI. - * @param Current transport URI Metadata. - */ - virtual void AvtSetTransportUriResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aCurrentUri, - const TDesC8& aCurrentUriMetaData) = 0; - /** - * Observer callback for rendering control AV set next transport uri. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aCurrentUri Current transport URI. - * @param Current transport URI Metadata. - */ - virtual void AvtSetNextTransportUriResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aNextUri, - const TDesC8& aNextUriMetaData) = 0; - /** - * Observer callback for rendering control AV get media info response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aNrTracks Number of tracks. - * @param aMediaDuration - * @param aCurrentUri Current transport URI. - * @param aCurrentUriMetaData Metadata of current trransport uri. - * @param aNextUri Next transport URI. - * @param aNextUriMetaData Metadata of next trransport uri. - * @param aPlayMedium - * @param aRecordMedium - * @param aWriteStatus - */ - virtual void AvtMediaInfoResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aNrTracks, - const TDesC8& aMediaDuration, - const TDesC8& aCurrentUri, - const TDesC8& aCurrentUriMetaData, - const TDesC8& aNextUri, - const TDesC8& aNextUriMetaData, - const TDesC8& aPlayMedium, - const TDesC8& aRecordMedium, - const TDesC8& aWriteStatus) = 0; - /** - * Observer callback for rendering control AV get transport info response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aInstance rendering instance. - * @param aCurrenTransportState - * @param aCurrentTransportStatus - * @param aCurrentUri aCurrentSpeed - */ - virtual void AvtGetTransportInfoResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aCurrenTransportState, - const TDesC8& aCurrentTransportStatus, - const TDesC8& aCurrentSpeed) = 0; - /** - * Observer callback for rendering control AV get position info response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aTrack rendering instance. - * @param aTrackDuration - * @param aTrackMetaData - * @param aTrackURI - * @param aRelTime - * @param aAbsTime - * @param aRelCount - * @param aAbsCount - */ - virtual void AvtPositionInfoResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aTrack, - const TDesC8& aTrackDuration, - const TDesC8& aTrackMetaData, - const TDesC8& aTrackURI, - const TDesC8& aRelTime, - const TDesC8& aAbsTime, - const TDesC8& aRelCount, - const TDesC8& aAbsCount) = 0; - /** - * Observer callback for rendering control AV get device capabilities response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aPlayMedia - * @param aRecMedia - * @param aRecQualityModes - */ - virtual void AvtDeviceCapabilitiesResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aPlayMedia, - const TDesC8& aRecMedia, - const TDesC8& aRecQualityMode) = 0; - /** - * Observer callback for rendering control AV get transport settings response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aInstanceId - * @param aErr UPnP error code. - * @param aPlayMode - * @param aRecQualityMode - */ - virtual void AvtTransportSettingsResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aPlayMode, - const TDesC8& aRecQualityMode) = 0; - /** - * Observer callback for rendering control AV Stop response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - */ - virtual void AvtStopResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId) = 0; - /** - * Observer callback for rendering control AV Play response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSpeed - */ - virtual void AvtPlayResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aSpeed) = 0; - /** - * Observer callback for rendering control AV Pause response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - */ - virtual void AvtPauseResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId) = 0; - /** - * Observer callback for rendering control AV Record response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - */ - virtual void AvtRecordResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId) = 0; - /** - * Observer callback for rendering control AV Seek response. - * @since Series 60 2.6 - * @param aSessionId - * @param aErr UPnP error code. - * @param aUnit - * @param aTarget - */ - virtual void AvtSeekResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aUnit, - const TDesC8& aTarget) = 0; - /** - * Observer callback for rendering control AV Next response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - */ - virtual void AvtNextResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId) = 0; - /** - * Observer callback for rendering control AV Previous response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - */ - virtual void AvtPreviousResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId) = 0; - /** - * Observer callback for rendering control AV setplay mode response. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aNewPlayMode - */ - virtual void AvtSetPlayModeResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aNewPlayMode) = 0; - /** - * Observer callback for rendering control AV set record qualityresponse. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aNewRecordQuality - */ - virtual void AvtSetRecordModeResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aInstanceId, - const TDesC8& aNewRecordQuality) = 0; - /** - * Observer callback for Content Directory GetSearchCapabilities function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSearchCaps - */ - virtual void CdsSearchCapabilitiesResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aSearchCaps) = 0; - /** - * Observer callback for Content Directory GetSortCapabilities function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSortCaps - */ - virtual void CdsSortCapabilitiesResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aSortCaps) = 0; - /** - * Observer callback for Content Directory GetSystemUpdateID function. - * @since Series 60 2.6 - * @param aSessionId - * @param aErr UPnP error code. - * @param aSystemUpdateId - */ - virtual void CdsSystemUpdateIdResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - TInt aSystemUpdateId) = 0; - /** - * Observer callback for Content Directory Browse function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aObjectID - * @param aBrowseFlag - * @param aFilter - * @param aIndex - * @param arequest - * @param aSortCriteria - * @param aResult - * @param aReturned - * @param aMatches - * @param aUpdateID - */ - virtual void CdsBrowseResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aObjectID, - const TDesC8& aBrowseFlag, - const TDesC8& aFilter, - TInt aIndex, - TInt aRequest, - const TDesC8& aSortCriteria, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches, - const TDesC8& aUpdateID) = 0; - /** - * Observer callback for Content Directory Search function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aContainerId - * @param aSearchCriteria - * @param aFilter - * @param aIndex - * @param arequest - * @param aSortCriteria - * @param aResult - * @param aReturned - * @param aMatches - * @param aUpdateID - */ - virtual void CdsSearchResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aContainerId, - const TDesC8& aSearchCriteria, - const TDesC8& aFilter, - TInt aIndex, - TInt aRequest, - const TDesC8& aSortCriteria, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches, - const TDesC8& aUpdateID) = 0; - /** - * Observer callback for Content Directory DestroyObject function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aObjectId - */ - virtual void CdsDestroyObjectResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aObjectId ) = 0; - /** - * Observer callback for Content Directory UpdateObject function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aObjectId - * @param aCurrentTagValue - * @param aNewTagValue - */ - virtual void CdsUpdateObjectResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aObjectId, - const TDesC8& aCurrentTagValue, - const TDesC8& aNewTagValue ) = 0; - /** - * Observer callback for Content Directory ImportResource function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSourceURI - * @param aDestinationURI - * @param aTransferId - */ - virtual void CdsImportResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aSourceURI, - const TDesC8& aDestinationURI, - const TDesC8& aTransferId ) = 0; - /** - * Observer callback for Content Directory ExportResource function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSourceURI - * @param aDestinationURI - * @param aTransferId - */ - virtual void CdsExportResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aSourceURI, - const TDesC8& aDestinationURI, - const TDesC8& aTransferId ) = 0; - /** - * Observer callback for Content Directory StopTransfer function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSourceURI - * @param aDestinationURI - * @param aTransferId - */ - virtual void CdsStopTransferResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aTransferId ) = 0; - /** - * Observer callback for Content Directory GetTransferProgress function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aTransferId - * @param aTransferStatus - * @param aTransferTotal - */ - virtual void CdsCTransferProgressResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aTransferId, - const TDesC8& aTransferStatus, - const TDesC8& aTransferLength, - const TDesC8& aTransferTotal ) = 0; - /** - * Observer callback for Content Directory DeleteResource function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aResourceUri Resource to be deleted. - */ - virtual void CdsDeleteResourceResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aResourceUri ) = 0; - /** - * Observer callback for Content Directory CreateReference function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aContainerId Destination folder. - * @param aObjectId Source object. - * @param aNewId Created reference. - */ - virtual void CdsCreateReferenceResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aContainerId, - const TDesC8& aObjectId, - const TDesC8& aNewId ) = 0; - /** - * Observer callback for Content Directory CreateReference function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aContainerID Container in which new object is created. - * @param aElements Elements for item creation. - * @param aObjectID New objects ID. - * @param aResult Result of the action. - */ - virtual void CdsCreateObjectResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aContainerID, - const TDesC8& aElements, - const TDesC8& aObjectID, - const TDesC8& aResult ) = 0; - - /** - * Observer callback for Connection Manager GetProtocolInfo function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSource - * @param aSink - */ - virtual void CmProtocolInfoResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aSource, - const TDesC8& aSink ) = 0; - /** - * Observer callback for Connection Manager PrepareForConnection - * function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aRemoteProtocolInfo - * @param aPeerConnectionManager - * @param aPeerConnectionId - * @param aDirection - * @param aConnection - * @param aTransport - * @param aRsc - */ - virtual void CmPrepareResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aRemoteProtocolInfo, - const TDesC8& aPeerConnectionManager, - const TDesC8& aPeerConnectionId, - const TDesC8& aDirection, - TInt aConnection, - TInt aTransport, - TInt aRsc ) = 0; - /** - * Observer callback for Connection Manager ConnectionComplete - * function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aConnection - */ - virtual void CmComplete( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - TInt aConnection ) = 0; - /** - * Observer callback for Connection Manager GetCurrentConnectionIDs - * function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aConnection - */ - virtual void CmCurrentConnections( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aConnections) = 0; - /** - * Observer callback for Connection Manager GetCurrentConnectionInfo - * function. - * @since Series 60 2.6 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param rscId - * @param aProtocolInfo - * @param aPeerConnectionManager - * @param peerId - * @param aStatus - */ - virtual void CmCurrentInfo( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - TInt rscId, - TInt transportId, - const TDesC8& aProtocolInfo, - const TDesC8& aPeerConnectionManager, - TInt peerId, - const TDesC8& aDirection, - const TDesC8& aStatus ) = 0; - - //***************************************************************** - //Functions for UPnP event handling - //***************************************************************** - /** - * Content Directory SystemUpdateId event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aSystemUpdateId Device systemUpdateId. - */ - virtual void CdsUpdateEvent( - const TDesC8& aUuid, - TInt aSystemUpdateId - ) = 0; - /** - * Content Directory ContainerUpdateIDs event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aConteinerIds Device container update ids. - */ - virtual void CdsContainerEvent( - const TDesC8& aUuid, - const TDesC8& aConteinerIds - ) = 0; - /** - * Content Directory TransferIDs event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aTransferIds Device transfer ids. - */ - virtual void CdsTransferEvent( - const TDesC8& aUuid, - const TDesC8& aTransferIds - ) = 0; - /** - * Rendering Control LastChange event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aLastChange Device LastChange statevariable. - */ - virtual void RcLastChangeEvent( - const TDesC8& aUuid, - const TDesC8& aLastChange - ) = 0; - /** - * AV Transport LastChange event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aLastChange Device LastChange statevariable. - */ - virtual void AvtLastChangeEvent( - const TDesC8& aUuid, - const TDesC8& aLastChange - ) = 0; - /** - * Connection Manager SourceEvent event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aSource Device's source info. - */ - virtual void CmSourceEvent( - const TDesC8& aUuid, - const TDesC8& aSource - ) = 0; - /** - * Connection Manager SinkEvent event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aSink Device's sink info. - */ - virtual void CmSinkEvent( - const TDesC8& aUuid, - const TDesC8& aSink - ) = 0; - /** - * Connection Manager ConnectionsEvent event handler. - * @since Series 60 2.6 - * @param aUuid Device UUID. - * @param aConnections Devices connections. - */ - virtual void CmConnectionsEvent( - const TDesC8& aUuid, - const TDesC8& aConnections - ) = 0; - //***************************************************************** - // Device and http functions. - //***************************************************************** - /** - * Handles HTTP messages. - * @since Series 60 2.6 - * @param aMessage Incoming HTTP message. - */ - virtual void HttpResponseL(CUpnpHttpMessage* aMessage) = 0; - - /** - * Handles UPnP device discoveries. - * @since Series 60 2.6 - * @param aDevice Device that is discovered. - */ - virtual void DeviceDiscoveredL(CUpnpDevice* aDevice) = 0; - - /** - * Handles UPnP device disappears. - * @since Series 60 2.6 - * @param aDevice Device that disappeared. - */ - virtual void DeviceDisappearedL(CUpnpDevice* aDevice) = 0; - }; - -#endif // C_MUPNPAVCONTROLPOINTOBSERVER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff dlnasrv_plat/upnp_avcp_api/upnp_avcp_api.metaxml --- a/dlnasrv_plat/upnp_avcp_api/upnp_avcp_api.metaxml Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - UPnP AVCP API - Functions for controlling media server and media renderer UPnP devices and their AV services (Content Directory, Connection Manager, AV Transport, Rendering Control). - c++ - upnpavcontrolpoint - - - - - - - - - no - no - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/group/bld.inf --- a/homemedia/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006 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 info for the HomeMedia subsystem -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// ROM build -../rom/homemedia.iby CORE_MW_LAYER_IBY_EXPORT_PATH(homemedia.iby) -../rom/homemediaresources.iby CORE_MW_LAYER_IBY_EXPORT_PATH(homemediaresources.iby) -// LOC files -UPNP_LOC_EXPORT(homemedia.loc) -// IAD support -../install/upnpapplications_stub.SIS /epoc32/data/z/system/install/upnpapplications_stub.sis - - // HomeMedia - #include "../homemedia/group/bld.inf" diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/data/homemedia.rss --- a/homemedia/homemedia/data/homemedia.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,321 +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: Main resource file -* -*/ - - - - - - -// RESOURCE IDENTIFIER -NAME HOME // 4 letter ID - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "homemedia.hrh" - -RESOURCE RSS_SIGNATURE - { - } - -// -------------------------------------------------------------------------- -// -// Default Document Name -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_default_document_name - { - buf=qtn_iupnp_title_home_media; - } - -// -------------------------------------------------------------------------- -// -// Define default menu and CBA key. -// -// -------------------------------------------------------------------------- -// -RESOURCE EIK_APP_INFO r_localisable_app_info - { - menubar = r_homemedia_menubar; - custom_app_info_extension = r_info_extension; - } - -RESOURCE EIK_APP_INFO_EXT r_info_extension - { - popup_toolbar = r_fixed_toolbar; - } - -RESOURCE AVKON_TOOLBAR r_fixed_toolbar - { - flags = KAknToolbarFixed|KAknToolbarTransparent|KAknToolbarWithoutCba; - items = - { - TBAR_CTRL - { - type = EAknCtButton; - id = ECmdDummy; - control = AVKON_BUTTON - { - flags = 0; - states = - { - AVKON_BUTTON_STATE - { - txt = "Dummy"; - } - }; - }; - } - }; - } - -// -------------------------------------------------------------------------- -// -// Localization application info. -// -// -------------------------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_homemedia_localisable_app_info - { - short_caption = qtn_iupnp_grid_home_media; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_iupnp_title_home_media; - number_of_icons = 1; - icon_file = "\\resource\\apps\\homemedia_aif.mif"; - }; - } - -//---------------------------------------------------------------------------- -// -// r_homemedia_softkeys_options_exit__open -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_homemedia_softkeys_options_exit__open - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyExit; txt = text_softkey_exit; }, - CBA_BUTTON {id=EAknSoftkeyOpen; txt= qtn_msk_open; } - }; - } - -//---------------------------------------------------------------------------- -// -// r_homemedia_menubar -// -//---------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_homemedia_menubar - { - titles= - { - MENU_TITLE { menu_pane = r_homemedia_menu;} - }; - } - -//---------------------------------------------------------------------------- -// -// r_homemedia_menu -// -//---------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_homemedia_menu - { - items = - { - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknSoftkeyExit; - txt = qtn_options_exit; - } - }; - } - -//---------------------------------------------------- -// -// r_homemedia_main_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_homemedia_main_view - { - menubar = r_homemedia_main_view_menubar; - // required to define something here but cba will be - // changed dynamically - cba = r_homemedia_softkeys_options_exit__open; - } - -//---------------------------------------------------------------------------- -// -// r_homemedia_main_view_menubar -// -//---------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_homemedia_main_view_menubar - { - titles= - { - MENU_TITLE { menu_pane = r_homemedia_menu;}, - MENU_TITLE { menu_pane = r_homemedia_main_view_menu;} - }; - } - - -//---------------------------------------------------------------------------- -// -// r_homemedia_main_view_menu -// -//---------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_homemedia_main_view_menu - { - items = - { - MENU_ITEM - { - command = EAknSoftkeyOpen; - txt = qtn_options_open; - }, - MENU_ITEM - { - command = EHomeMediaCmdRunWizard; - txt = qtn_iupnp_options_run_wizard; - }, - MENU_ITEM - { - command = EHomeMediaCmdSettings; - txt = qtn_iupnp_options_settings_main; - } - }; - } - - - -//---------------------------------------------------------------------------- -// -// r_homemedia_connecting_dialog -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_homemedia_connecting_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_iupnp_wait_connecting; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_homemedia_browsehome_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF32 r_homemedia_browsehome_text { buf=qtn_iupnp_browse_home; } - -//---------------------------------------------------------------------------- -// -// r_homemedia_sharecontent_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF32 r_homemedia_sharecontent_text { buf=qtn_iupnp_share; } - -// -------------------------------------------------------------------------- -// -// r_homemedia_error_con_failed_text -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_homemedia_error_con_failed_text - { - buf = qtn_iupnp_err_con_failed; - } - -//---------------------------------------------------------------------------- -// -// r_homemedia_share_active_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF32 r_homemedia_share_active_text { buf=qtn_iupnp_share_active; } - -//---------------------------------------------------------------------------- -// -// r_homemedia_share_inactive_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF32 r_homemedia_share_inactive_text { buf=qtn_iupnp_share_inactive; } - -//---------------------------------------------------------------------------- -// -// r_homemedia_navi_not_connected_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF32 r_homemedia_navi_not_connected_text { buf=qtn_iupnp_navi_not_connected; } - -//---------------------------------------------------------------------------- -// -// r_homemedia_navi_connected_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF32 r_homemedia_navi_connected_text { buf=qtn_iupnp_navi_connected; } - -//---------------------------------------------------------------------------- -// -// r_homemedia_title_pane_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_homemedia_title_pane_text { buf=qtn_iupnp_title_home_media; } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/data/homemedia_reg.rss --- a/homemedia/homemedia/data/homemedia_reg.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +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: Application registry resource file -* -*/ - - - - - - -#include "homemedia.hrh" -#include -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 _UID3 - -RESOURCE APP_REGISTRATION_INFO - { - app_file="HomeMedia"; - localisable_resource_file = "\\Resource\\Apps\\homemedia"; - localisable_resource_id = R_HOMEMEDIA_LOCALISABLE_APP_INFO; - embeddability=KAppNotEmbeddable; - newfile=KAppDoesNotSupportNewFile; - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/gfx/qgn_menu_upnp_homemedia.svg --- a/homemedia/homemedia/gfx/qgn_menu_upnp_homemedia.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/gfx/qgn_prop_upnp_browse_home.svg --- a/homemedia/homemedia/gfx/qgn_prop_upnp_browse_home.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/gfx/qgn_prop_upnp_share_sub.svg --- a/homemedia/homemedia/gfx/qgn_prop_upnp_share_sub.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/group/bld.inf --- a/homemedia/homemedia/group/bld.inf Mon Nov 01 13:44:24 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: Build info for the HomeMedia application -* -*/ - - - - - -#include "../../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -// help exports -#include "../help/group/bld.inf" - -PRJ_MMPFILES -homemedia.mmp - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE homemedia.mif -OPTION HEADERFILE homemedia.mbg -OPTION SOURCEDIR ../gfx -OPTION SOURCES -c8,8 qgn_prop_upnp_share_sub -c8,8 qgn_prop_upnp_browse_home -END - -START EXTENSION s60/mifconv -OPTION TARGETFILE homemedia_aif.mif -OPTION SOURCEDIR ../gfx -OPTION SOURCES -c8,8 qgn_menu_upnp_homemedia -END diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/group/homemedia.mmp --- a/homemedia/homemedia/group/homemedia.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +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 specification for HomeMedia application -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" - -#include - -TARGET homemedia.exe -TARGETTYPE exe -UID 0x100039CE 0x2000F8D6 - -// Minimum heap size 16kB, maximum heap size 8MB -EPOCHEAPSIZE 16384 8388608 -EPOCSTACKSIZE 0x8000 -VENDORID VID_DEFAULT -SECUREID 0x2000F8D6 -CAPABILITY CAP_APPLICATION - -SOURCEPATH ../src -SOURCE homemedia.cpp -SOURCE homemediaapplication.cpp -SOURCE homemediaappview.cpp -SOURCE homemediaappui.cpp -SOURCE homemediadocument.cpp -SOURCE homemediacontainer.cpp -SOURCE homemediabaselistbox.cpp - -SOURCEPATH ../data - -START RESOURCE homemedia.rss -HEADER -TARGET homemedia -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END //RESOURCE - -START RESOURCE homemedia_reg.rss -DEPENDS homemedia.rsg -TARGET homemedia_reg -TARGETPATH /private/10003a3f/apps -LANGUAGE_IDS -END //RESOURCE - -//SYSTEM INCLUDE -APP_LAYER_SYSTEMINCLUDE - -//USER INCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT -USERINCLUDE ../../../inc -USERINCLUDE ../inc -USERINCLUDE ../help/inc - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY avkon.lib -LIBRARY CommonEngine.lib -LIBRARY hlplch.lib -LIBRARY GSEcomPlugin.lib -LIBRARY egul.lib -LIBRARY AKNSKINS.lib -LIBRARY eikcoctl.lib -LIBRARY eikctl.lib -LIBRARY bafl.lib -LIBRARY AknIcon.lib -LIBRARY featmgr.lib -LIBRARY ecom.lib -LIBRARY upnpappwizard.lib -LIBRARY upnpsettingsengine.lib -LIBRARY upnpapplicationengine.lib -LIBRARY upnpextensionpluginif.lib -LIBRARY upnputilities.lib -LIBRARY upnpsharingui.lib -LIBRARY upnpavcontrollerclient.lib -LIBRARY upnpcommonui.lib - -DEBUGLIBRARY flogger.lib - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/help/data/xhtml.zip Binary file homemedia/homemedia/help/data/xhtml.zip has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/help/group/bld.inf --- a/homemedia/homemedia/help/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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: -* Export help related files. -* -*/ - -#include -PRJ_EXPORTS -:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite -:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite - -../inc/iupnp.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/iupnp.hlp.hrh) -../rom/homemediahelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(homemediahelps_variant.iby) diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/help/inc/iupnp.hlp.hrh --- a/homemedia/homemedia/help/inc/iupnp.hlp.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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: -* -*/ - -// -// iupnp.hlp.hrh generated by CSXHelp Utilities. -// - -#ifndef __IUPNP_HLP_HRH__ -#define __IUPNP_HLP_HRH__ - -_LIT(KUPNP_HLP_SHARE_CONTENT, "UPNP_HLP_SHARE_CONTENT"); // -_LIT(KUPNP_HLP_SHARING_PROP, "UPNP_HLP_SHARING_PROP"); // -_LIT(KUPNP_HLP_MAIN_VIEW, "UPNP_HLP_MAIN_VIEW"); // -_LIT(KUPNP_HLP_MAIN_EXTERNAL, "UPNP_HLP_MAIN_EXTERNAL"); // -_LIT(KUPNP_HLP_CONTENT_VIEW, "UPNP_HLP_CONTENT_VIEW"); // -_LIT(KUPNP_HLP_REMOTE_DEVICES, "UPNP_HLP_REMOTE_DEVICES"); // -_LIT(KUPNP_HLP_SEARCH, "UPNP_HLP_SEARCH"); // - -#endif \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/help/rom/homemediahelps_variant.iby --- a/homemedia/homemedia/help/rom/homemediahelps_variant.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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: homemediahelps_variant.iby -* -*/ - -#ifndef __HOMEMEDIAHELPS_VARIANT_IBY__ -#define __HOMEMEDIAHELPS_VARIANT_IBY__ - -#if defined(FF_S60_HELPS_IN_USE) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\contents.zip) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\index.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\keywords.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000F8D6\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000F8D6\meta.xml) -#endif - -#endif \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/inc/homemedia.hrh --- a/homemedia/homemedia/inc/homemedia.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: Resource header -* -*/ - - - - - - -#ifndef __HOMEMEDIA_HRH__ -#define __HOMEMEDIA_HRH__ - -#define _UID3 0x2000F8D6 - -enum THomeMediaMainViewOptItems - { - EHomeMediaCmdRunWizard = 1, - EHomeMediaCmdSettings - }; - -enum THomeMediaMainViewItems - { - EHomeMediaBrowseHome = 0, - EHomeMediaFileSharingDialog - }; - -enum THomeMediaBtnCommandIds - { - ECmdDummy = 0 - }; - -#endif // __HOMEMEDIA_HRH__ diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/inc/homemediaapplication.h --- a/homemedia/homemedia/inc/homemediaapplication.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +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: Main application class -* -*/ - - - - - - -#ifndef __HOMEMEDIAAPPLICATION_H__ -#define __HOMEMEDIAAPPLICATION_H__ - -// INCLUDES -#include -#include "homemedia.hrh" - -// UID for the application; -// this should correspond to the uid defined in the mmp file -const TUid KUidhomemediaApp = - { - _UID3 - }; - -// CLASS DECLARATION - -/** - * ChomemediaApplication application class. - * Provides factory to create concrete document object. - * An instance of ChomemediaApplication is the application part of the - * AVKON application framework for the homemedia example application. - */ -class CHomeMediaApplication : public CAknApplication - { -public: - // Functions from base classes - - /** - * From CApaApplication, AppDllUid. - * @return Application's UID (KUidhomemediaApp). - */ - TUid AppDllUid() const; - -protected: - // Functions from base classes - - /** - * From CApaApplication, CreateDocumentL. - * Creates ChomemediaDocument document object. The returned - * pointer in not owned by the CHomeMediaApplication object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - }; - -#endif // __HOMEMEDIAAPPLICATION_H__ -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/inc/homemediaappui.h --- a/homemedia/homemedia/inc/homemediaappui.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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: Main Ui class -* -*/ - - - - - - -#ifndef __HOMEMEDIAAPPUI_H__ -#define __HOMEMEDIAAPPUI_H__ - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CHomeMediaAppView; - -// CLASS DECLARATION -/** - * ChomemediaAppUi application UI class. - * Interacts with the user through the UI and request message processing - * from the handler class - */ -class CHomeMediaAppUi : public CAknViewAppUi - { -public: - // Constructors and destructor - - /** - * ConstructL. - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * CHomeMediaAppUi. - * C++ default constructor. This needs to be public due to - * the way the framework constructs the AppUi - */ - CHomeMediaAppUi(); - - /** - * ~CHomeMediaAppUi. - * Virtual Destructor. - */ - virtual ~CHomeMediaAppUi(); - -private: - // Functions from base classes - - /** - * From CEikAppUi, HandleCommandL. - * Takes care of command handling. - * @param aCommand Command to be handled. - */ - void HandleCommandL(TInt aCommand); - - /** - * From CEikAppUi, handles key events. - * @param aType The type of resources that have changed - */ - virtual void HandleResourceChangeL( TInt aType ); - - /** - * From CCoeAppUi - */ - void HandleForegroundEventL( TBool aForeground ); - - -private: - // Data - - /** - * The application view - * Owned by CHomeMediaAppUi - */ - CHomeMediaAppView* iAppView; - - }; - -#endif // __HOMEMEDIAAPPUI_H__ -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/inc/homemediaappview.h --- a/homemedia/homemedia/inc/homemediaappview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,347 +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: Main application view -* -*/ - - - - - - -#ifndef __HOMEMEDIAAPPVIEW_H__ -#define __HOMEMEDIAAPPVIEW_H__ - -// INCLUDES -#include -#include //MAknBackgroundProcess -#include "upnpfilesharingengineobserver.h" -#include "upnppluginloaderobserver.h" - -//forward declaration -class CHomeMediaContainer; -class CUPnPFileSharingEngine; -class CUPnPPluginInterface; -class CUPnPPluginLoader; -class MUPnPAVController; -class CUPnPSettingsEngine; -class CAknNavigationDecorator; -class CGSPluginInterface; -class CIdle; -class CAknInputBlock; -class CUPnPAppFileSharingDialog; -class CUPnPPeriodic; - -/** - * CHomeMediaAppView - * View class for CHomeMediaAppUi, handles menu commands and creates - * container which shows main view items. - */ -class CHomeMediaAppView : public CAknView, - private MUPnPFileSharingEngineObserver, - private MAknBackgroundProcess, - private MUPnPPluginLoaderObserver - { -public: - // New methods - - /** - * NewL. - * Two-phased constructor. - * @return a pointer to the created instance of CHomeMediaAppView. - */ - static CHomeMediaAppView* NewL(); - - /** - * NewLC. - * Two-phased constructor. - * @return A pointer to the created instance of CHomeMediaAppView. - */ - static CHomeMediaAppView* NewLC(); - - /** - * ~CHomeMediaAppView - * Virtual Destructor. - */ - virtual ~CHomeMediaAppView(); - - /** - * Get the pointer of fileSharingDialog ,which is constructed in the function of - * ProcessCommandL - */ - void RefreshVisibilitySettingItemL() ; - -private: - // Constructors - - /** - * ConstructL - * 2nd phase constructor. - * Perform the second phase construction of a - * CHomeMediaAppView object. - */ - void ConstructL(); - - /** - * CHomeMediaAppView. - * C++ default constructor. - */ - CHomeMediaAppView(); - -public: // Functions from base classes - - /** - * Return Uid - */ - TUid Id() const; - - /** - * Handle Size changes - */ - void HandleClientRectChange(); - -private: // From AknView - - /** - * Activates view - */ - void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId, - const TDesC8& aCustomMessage); - - /** - * Deactivates view - */ - void DoDeactivate(); - -private: // Functions from base classes - - /** - * Handle Commands - */ - void HandleCommandL(TInt aCommand); - - /** - * Add some comments here - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: - /** - * From MAknBackgroundProcess - */ - void StepL(); - - /** - * From MAknBackgroundProcess - */ - TBool IsProcessDone() const; - - /** - * From MAknBackgroundProcess - */ - TInt CycleError( TInt aError ); - -private: //From MUPnPFileSharingEngineObserver - - /** - * Function informs when file sharing was enabled or disabled - * @param aEngine File sharing engine - * @param aError, error code - * @param aPhase ETrue if current phase is sharing activation, - * otherwise EFalse - */ - void HandleSharingStatus( - CUPnPFileSharingEngine& aEngine, - TInt aError, - TBool aPhase ); - - /** - * Callback to inform if connection has been lost - * @param aEngine File sharing engine - */ - void HandleSharingConnectionLost( - CUPnPFileSharingEngine& aEngine ); - -private: //From MUPnPPluginLoaderObserver - - /** - * Called by UPnPPluginLoader when plugin(s) has been updated - */ - void PluginsUpdated(); - -private: //business logic methods - - /** - * Browse home - */ - void ExecuteBrowseL(); - - /** - * Browse home - */ - void DoExecuteBrowseL(); - - /** - * Start wizard - * @return key pressed in the wizard - */ - TInt StartWizardL(); - - /** - * @return IAP id - */ - TInt IAP() const; - - /** - * @return validity of current IAP - */ - TBool CheckAccessPointValid(); - - /** - * Show the error note - * - * @param aMain resource id for loc - */ - void ShowErrorNoteL( TInt aMain ) const; - - /** - * Update title pane - */ - void UpdateTitlePaneL(); - - /** - * update navi pane - * - * @param aShowStatus ETrue if shown - */ - void UpdateNaviPaneL( TBool aShowStatus ); - - /** - * Load external plugins - */ - void LoadPluginL(); - - /** - * Launch the settings view - */ - void StartSettingsViewL(); - - /** - * If get the correct pointer ,refresh the correspond item in view or share dialog - */ - void RefreshSharelistItemL() ; - - /** - * Launch the setup wizard - * - * @param aPtr CHomeMediaAppView* pointer - * @return EFalse - */ - static TBool InitializeWizardL( TAny* aPtr ); - - /** - * Launch a timer - * - * @param aPtr CHomeMediaAppView* pointer - * @return KErrNone - */ - static TInt RefreshSharingL( TAny* aPtr ); - -private: - /** - * The internal phases of wait note when starting browsing - */ - enum TBrowsingState - { - EPhaseNotActive, - EPhaseProcessing, - EPhaseCompleted - }; - - /** - * View's window - * Own - */ - CHomeMediaContainer* iContainer; - - /** - * File sharing engine - * Own - */ - CUPnPFileSharingEngine* iFileSharing; - - /** - * Array of plugins - * Not own - */ - RPointerArray iPluginArray; - - /** - * Plugin loader - * Own - */ - CUPnPPluginLoader* iPluginLoader; - - /** - * Current browse state - */ - TBrowsingState iBrowseState; - - /** - * AV contoller - * Own - */ - MUPnPAVController* iAvControl; - - /** - * Settings engine - * Own - */ - CUPnPSettingsEngine* iSettingsEngine; - - /** - * App's navigation decorator - * Own - */ - CAknNavigationDecorator* iNaviDecorator; - - /** - * Settings view - * Not own - */ - CGSPluginInterface* iSettingsView; - - /** - * Idle loop - * Own - */ - CIdle* iIdle; - - /** - * block UI in case of first start - * Own - */ - CAknInputBlock* iInputBlocker; - - /** - * record the pointer of CUPnPAppFileSharingDialog - * Own - */ - CUPnPAppFileSharingDialog* ifileSharingDialog; - - CUPnPPeriodic* iRefreshTimer; - }; - -#endif // __HOMEMEDIAAPPVIEW_H__ -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/inc/homemediabaselistbox.h --- a/homemedia/homemedia/inc/homemediabaselistbox.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +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: Base listbox class -* -*/ - - - - - - -#ifndef HOMEMEDIABASELISTBOX_H_ -#define HOMEMEDIABASELISTBOX_H_ - -// INCLUDES -#include -#include -#include -#include -#include -#include - -/** - * CHomeMediaBaseListbox - * baseclass for lisboxes - */ -class CHomeMediaBaseListbox : public CCoeControl - { -public: // Constructors and destructor - - /** - * Constructor. - */ - CHomeMediaBaseListbox(); - - /** - * Destructor. - */ - virtual ~CHomeMediaBaseListbox(); - - /** - * Returns reference to listbox - * @return reference to CEikListBox - */ - CEikListBox& ListBox(); - - /** - * Add's new column to listbox - * - * @param aFmt format of the lisbox ex. "%d\t%S\t\t",0,str - */ - void AddColumnL( TRefByValue aFmt,... ); - -private: - - /** - * From CoeControl, SizeChanged. - * Called by framework when the view size is changed. - */ - void SizeChanged(); - - /** - * Handles key events - * - * @param aKeyEvent - * @param aType - * @return TKeyResponse - */ - TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, - TEventCode aType); - - /** - * From CoeControl,CountComponentControls. - * - * @return Number of components in this control - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl,ComponentControl. - * @param aIndex - * @return pointer to control - */ - CCoeControl* ComponentControl(TInt aIndex) const; - -protected: - - /** - * EPOC default constructor for performing 2nd stage construction - * - * @param aRect rectangle for this control - * @param aListBox baseclass for all s60 lisboxes, takes ownership - */ - void BaseConstructL( const TRect& aRect - , CEikTextListBox* aListBox ); - - /** - * Adds new icon to icon array - * - * @param aArray - * @param aSkin - * @param aMbmFile - * @param aID - * @param aBitmapId - * @param aMaskId - */ - void AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId); - - /** - * TOverFlowHandler - * handles over flow in formatlist - */ - class TOverFlowHandler : public TDes16Overflow - { - /** - * called when descriptor is overflowed - * - * @param reference to overflown data - */ - void Overflow(TDes16&){} - }; - - /** - * protected because derived classes may need to use iListBox ( owned ) - */ - CEikTextListBox* iListBox; - - /** - * protected because derived classes may need to use - * iListBoxItems ( owned ) - */ - CDesCArray* iListBoxItems; - - }; - -#endif /*HOMEMEDIABASELISTBOX_H_*/ diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/inc/homemediacontainer.h --- a/homemedia/homemedia/inc/homemediacontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +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: Main application window -* -*/ - - - - - - -#ifndef HOMEMEDIACONTAINER_H -#define HOMEMEDIACONTAINER_H - -// INCLUDES -#include -#include "homemediabaselistbox.h" - -//forward declaration -class CUPnPPluginInterface; -class CUPnPFileSharingEngine; - -/** - * CHomeMediaContainer - * Ui control for appview, inherited from CHomeMediaBaseListbox - * Shows listbox on screen containing items: Browse Home , Sharing - * , ++ possible plugin items - */ -class CHomeMediaContainer : public CHomeMediaBaseListbox - { - -public: - - // Constructors and destructor - /** - * Two-phased constructor. - * @param aRect Control's rectangle - * @param aFileSharing File sharing engine - * @param aPluginArray Array of extention plugins - * @return pointer to newly created CHomeMediaContainer - */ - static CHomeMediaContainer* NewL(const TRect& aRect, - CUPnPFileSharingEngine& aFileSharing, - const RPointerArray& aPluginArray ); - - /** - * Two-phased constructor. - * @param aRect Control's rectangle - * @param aFileSharing File sharing engine - * @param aPluginArray Array of extention plugins - * @return pointer to newly created CHomeMediaContainer - */ - static CHomeMediaContainer* NewLC(const TRect& aRect, - CUPnPFileSharingEngine& aFileSharing, - const RPointerArray& aPluginArray ); - - /** - * Destructor. - */ - ~CHomeMediaContainer(); - -public: - /** - * Update container if any changes has happed. - */ - void UpdateL(); - -private: - - /** - * Constructor for performing 1st stage construction - * @param aFileSharing File sharing engine - * @param aPluginArray Array of extention plugins - */ - CHomeMediaContainer( - CUPnPFileSharingEngine& aFileSharing, - const RPointerArray& aPluginArray ); - - /** - * EPOC default constructor for performing 2nd stage construction - * - * @param aRect rectangle for this control - */ - void ConstructL(const TRect& aRect); - - /** - * Load plugins icons and texts, update listbox. - */ - void UpdatePluginsL(); - - /** - * Get help context. - */ - void GetHelpContext( TCoeHelpContext& aContext ) const; - - /** - * File sharing engine ( Not owned ) - */ - CUPnPFileSharingEngine& iFileSharing; - - /** - * Array of extention plugins ( Not owned ) - */ - const RPointerArray& iPluginArray; - - }; - -#endif // HOMEMEDIACONTAINER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/inc/homemediadocument.h --- a/homemedia/homemedia/inc/homemediadocument.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +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: Main document class -* -*/ - - - - - - -#ifndef __HOMEMEDIADOCUMENT_H__ -#define __HOMEMEDIADOCUMENT_H__ - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CHomeMediaAppUi; -class CEikApplication; - -// CLASS DECLARATION - -/** - * ChomemediaDocument application class. - * An instance of class ChomemediaDocument is the Document part of the - * AVKON application framework for the homemedia example application. - */ -class CHomeMediaDocument : public CAknDocument - { -public: - // Constructors and destructor - - /** - * NewL. - * Two-phased constructor. - * Construct a CHomeMediaDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of CHomeMediaDocument. - */ - static CHomeMediaDocument* NewL(CEikApplication& aApp); - - /** - * NewLC. - * Two-phased constructor. - * Construct a CHomeMediaDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of CHomeMediaDocument. - */ - static CHomeMediaDocument* NewLC(CEikApplication& aApp); - - /** - * ~CHomeMediaDocument - * Virtual Destructor. - */ - virtual ~CHomeMediaDocument(); - -public: - // Functions from base classes - - /** - * CreateAppUiL - * From CEikDocument, CreateAppUiL. - * Create a ChomemediaAppUi object and return a pointer to it. - * The object returned is owned by the Uikon framework. - * @return Pointer to created instance of AppUi. - */ - CEikAppUi* CreateAppUiL(); - -public: - // New functions - - /** - * Registers the destructor key of ecom plugin implementation. - * Ecom plugin implementation will be destroyed in the destructor - * of the document object, after the appui object (and its views) - * has been destructed. - * - * Method check if the given TUid is already registered. - * Then it is not registered. - * - * @param aDestructorKey A key specifying the ecom plugin implementation. - */ - void RegisterEcomDestructorKeyL( const TUid& aDestructorKey ); - -private: - // Constructors - - /** - * ConstructL - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * CHomeMediaDocument. - * C++ default constructor. - * @param aApp Application creating this document. - */ - CHomeMediaDocument(CEikApplication& aApp); - -private: - - /** - * List of ecom destructor keys. - */ - RArray iEcomDestructorKeys; - - }; - -#endif // __HOMEMEDIADOCUMENT_H__ -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/src/homemedia.cpp --- a/homemedia/homemedia/src/homemedia.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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: Application entry point -* -*/ - - - - - - -// INCLUDE FILES -#include -#include "homemediaapplication.h" - -LOCAL_C CApaApplication* NewApplication() - { - return new CHomeMediaApplication; - } - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication( NewApplication ); - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/src/homemediaapplication.cpp --- a/homemedia/homemedia/src/homemediaapplication.cpp Mon Nov 01 13:44:24 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: Main application class -* -*/ - - - - - - -// INCLUDE FILES -#include "homemediadocument.h" -#include "homemediaapplication.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CHomeMediaApplication::CreateDocumentL() -// Creates CApaDocument object -// -------------------------------------------------------------------------- -// -CApaDocument* CHomeMediaApplication::CreateDocumentL() - { - // Create an homemedia document, and return a pointer to it - return CHomeMediaDocument::NewL(*this); - } - -// -------------------------------------------------------------------------- -// CHomeMediaApplication::AppDllUid() -// Returns application UID -// -------------------------------------------------------------------------- -// -TUid CHomeMediaApplication::AppDllUid() const - { - // Return the UID for the homemedia application - return KUidhomemediaApp; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/src/homemediaappui.cpp --- a/homemedia/homemedia/src/homemediaappui.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +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: Main Ui class -* -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// debug log support -_LIT( KComponentLogfile, "homemedia.txt"); -#include "upnplog.h" - -#include "homemedia.hrh" -#include "homemediaapplication.h" -#include "homemediaappui.h" -#include "homemediaappview.h" - -// -------------------------------------------------------------------------- -// CHomeMediaAppUi::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CHomeMediaAppUi::ConstructL() - { - __LOG("CHomeMediaAppUi::ConstructL begin"); - BaseConstructL( EAknEnableSkin|EAknEnableMSK ); - - // Create view object - iAppView = CHomeMediaAppView::NewL(); - - // Ownership transferred - AddViewL(iAppView); - - SetDefaultViewL(*iAppView); - - CAknToolbar* toolbar = CurrentFixedToolbar(); - if ( toolbar != NULL ) - { - toolbar->HideItem( ECmdDummy, ETrue, EFalse ); - toolbar->SetToolbarVisibility( EFalse ); - } - - __LOG("CHomeMediaAppUi::ConstructL end"); - } -// -------------------------------------------------------------------------- -// CHomeMediaAppUi::CHomeMediaAppUi() -// C++ default constructor can NOT contain any code, that might leave. -// -------------------------------------------------------------------------- -// -CHomeMediaAppUi::CHomeMediaAppUi() - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppUi::~CHomeMediaAppUi() -// Destructor. -// -------------------------------------------------------------------------- -// -CHomeMediaAppUi::~CHomeMediaAppUi() - { - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppUi::HandleCommandL() -// Takes care of command handling. -// -------------------------------------------------------------------------- -// -void CHomeMediaAppUi::HandleCommandL(TInt aCommand) - { - switch (aCommand) - { - case EEikCmdExit: - case EAknSoftkeyExit: // fall through - Exit(); - break; - default: - break; - } - } - -// -------------------------------------------------------------------------- -// Called by the framework when the application status pane -// size is changed. Passes the new client rectangle to the -// AppView -// -------------------------------------------------------------------------- -// -void CHomeMediaAppUi::HandleResourceChangeL( TInt aType ) - { - __LOG1("CHomeMediaAppUi::HandleResourceChangeL aType = %d",aType); - CAknAppUi::HandleResourceChangeL( aType ); - // ***************************** - // ADDED FOR SCALABLE UI SUPPORT - // ***************************** - if ( aType==KEikDynamicLayoutVariantSwitch ) - { - ((CHomeMediaAppView*) View( iAppView->Id() ) )-> - HandleClientRectChange( ); - } - } - -// --------------------------------------------------------------------------- -// HandleForegroundEventL -// handle switches to background and foreground -// --------------------------------------------------------------------------- -void CHomeMediaAppUi::HandleForegroundEventL( TBool aForeground ) - { - if( aForeground ) - { - iAppView->RefreshVisibilitySettingItemL(); - } - - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/src/homemediaappview.cpp --- a/homemedia/homemedia/src/homemediaappview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,820 +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: Main application view -* -*/ - - - - - - -// INCLUDE FILES -#include -#include // CGSPluginInterface -#include // StringLoader -#include // CAknErrorNote -#include // FeatureManager -#include // HlpLauncher -#include -#include -#include -#include // CAknInputBlock - -// upnpcontroller api -#include "upnpavcontrollerfactory.h" -#include "upnpavcontroller.h" - -// upnpframework api -#include "upnppluginloader.h" -#include "upnpcommonui.h" - -// upnpsettings api -#include "upnpsettingsengine.h" // CUPnPSettingsEngine -#include "upnpsettingsengine.hrh" // CUPnPSettingsEngine -#include "cupnpappwizard.h" -#include "upnpappfilesharingdialog.h" - -// upnpsharing api -#include "upnpfilesharingengine.h" - -// homemedia -#include "homemediadocument.h" -#include "homemediaappview.h" -#include "homemedia.hrh" -#include "homemediacontainer.h" -#include "upnpperiodic.h" - -// debug log support -_LIT( KComponentLogfile, "homemedia.txt"); -#include "upnplog.h" - -//CONSTANTS -static const TUid KHomeMediaAppViewId = {1}; -static const TUid KUPnPGSPluginImpUid = { 0x20009CB0 }; -static const TInt KNumberOfItemsBeforePlugins( 2 ); -static const TInt KUPnPAlreadyStarted( 0 ); - -// Media Server shutdown delay in seconds (15s) -const TInt KMediaServerShutdownTimeout = 15000000; -// -------------------------------------------------------------------------- -// ChomemediaAppView::NewL() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CHomeMediaAppView* CHomeMediaAppView::NewL() - { - CHomeMediaAppView* self = CHomeMediaAppView::NewLC(); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------- -// ChomemediaAppView::NewLC() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CHomeMediaAppView* CHomeMediaAppView::NewLC() - { - CHomeMediaAppView* self = new ( ELeave ) CHomeMediaAppView; - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// ChomemediaAppView::~ChomemediaAppView() -// Destructor. -// -------------------------------------------------------------------------- -// -CHomeMediaAppView::~CHomeMediaAppView() - { - delete iFileSharing; - delete iPluginLoader; - delete iSettingsEngine; - delete iNaviDecorator; - delete iIdle; - delete iInputBlocker; - delete iRefreshTimer; - } - -// -------------------------------------------------------------------------- -// ChomemediaAppView::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::ConstructL() - { - BaseConstructL( R_HOMEMEDIA_MAIN_VIEW ); - ifileSharingDialog= NULL; - iFileSharing = CUPnPFileSharingEngine::NewL(); - iFileSharing->SetObserver( this ); - - iPluginLoader = CUPnPPluginLoader::NewL(*this); - iPluginArray = iPluginLoader->CreatePluginsL(); - iSettingsEngine = CUPnPSettingsEngine::NewL(); - - TInt firstStart( 0 ); - iSettingsEngine->GetFirstStart( firstStart ); - if( firstStart ) - { - iInputBlocker = CAknInputBlock::NewLC(); - CleanupStack::Pop( iInputBlocker ); - iIdle = CIdle::NewL( CActive::EPriorityIdle ); - TCallBack cb( InitializeWizardL, this ); - iIdle->Start( cb ); - } - - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::CHomeMediaAppView() -// C++ default constructor can NOT contain any code, that might leave. -// -------------------------------------------------------------------------- -// -CHomeMediaAppView::CHomeMediaAppView() - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::Id() -// -------------------------------------------------------------------------- -// -TUid CHomeMediaAppView::Id ()const - { - return KHomeMediaAppViewId; - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::HandleClientRectChange() -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::HandleClientRectChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::DoActivateL() -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::DoActivateL(const TVwsViewId &/*aPrevViewId*/ - , TUid /*aCustomMessageId*/ - , const TDesC8 &/*aCustomMessage*/) - { - if( !iContainer ) - { - iContainer = CHomeMediaContainer::NewL( - ClientRect(), *iFileSharing, iPluginArray ); - iContainer->SetMopParent(this); - AppUi()->AddToStackL( *this, iContainer ); - - UpdateTitlePaneL(); - UpdateNaviPaneL( ETrue ); - } - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::DoDeactivate() - { - if ( iContainer ) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - } - delete iContainer; - iContainer = NULL; - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::HandleCommandL() -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::HandleCommandL(TInt aCommand) - { - __LOG("CHomeMediaAppView::HandleCommandL"); - - switch (aCommand) - { - case EAknSoftkeyOpen: // fall through - case EAknCmdOpen : // fall through - { - TInt index = iContainer->ListBox().CurrentItemIndex(); - if ( index == EHomeMediaFileSharingDialog ) - { - UpdateNaviPaneL( EFalse ); - CUPnPAppFileSharingDialog* dlg = - CUPnPAppFileSharingDialog::NewL( 0, *iFileSharing ); - ifileSharingDialog= dlg; - dlg->ExecuteSharingDialogLD(); - dlg = NULL; - ifileSharingDialog= NULL; - iContainer->UpdateL(); - } - else if ( index == EHomeMediaBrowseHome ) - { - ExecuteBrowseL(); - } - else - // plugin was chosen - { - LoadPluginL(); - } - break; - } - case EHomeMediaCmdRunWizard : - { - StartWizardL(); - iContainer->UpdateL(); - break; - } - case EHomeMediaCmdSettings: - { - StartSettingsViewL(); - break; - } - case EAknCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() ); - break; - } - case EAknSoftkeyExit : - { - AppUi()->HandleCommandL(EEikCmdExit); - break; - } - default: - { - break; - } - } - //Set observer back, because other ui componets might change observer - iFileSharing->SetObserver( this ); - if( aCommand != EHomeMediaCmdSettings ) - { - UpdateTitlePaneL(); - UpdateNaviPaneL( ETrue ); - } - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::DynInitMenuPaneL() -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - __LOG("CHomeMediaAppView::DynInitMenuPaneL"); - - // hide help option if not supported - if (aResourceId == R_HOMEMEDIA_MENU && - !FeatureManager::FeatureSupported(KFeatureIdHelp)) - { - aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAppMainDialog::StepL -// Step done during wait note -// From MAknBackgroundProcess -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::StepL(void) - { - if ( iBrowseState == EPhaseNotActive ) - { - // try to start avcontroller - // handle leaves in CycleError - iAvControl = UPnPAVControllerFactory::NewUPnPAVControllerL(); - iBrowseState = EPhaseCompleted; - } - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMainDialog::IsProcessDone -// Returns ETrue if process finished -// From MAknBackgroundProcess -// -------------------------------------------------------------------------- -// -TBool CHomeMediaAppView::IsProcessDone(void) const - { - TBool ret(EFalse); - if ( iBrowseState == EPhaseNotActive ) - { - // try to start avcontroller - } - else if ( iBrowseState == EPhaseCompleted ) - { - ret = ETrue; - } - else - { - __LOG( "CHomeMediaAppView::IsProcessDone: else branch" ); - } - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPAppMainDialog::CycleError -// Handle error -// From MAknBackgroundProcess -// -------------------------------------------------------------------------- -// -TInt CHomeMediaAppView::CycleError( TInt aError ) - { - __LOG( "CHomeMediaAppView::CycleError" ); - delete iAvControl; - iAvControl = NULL; - return aError; - } - - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::HandleSharingStatus -// Function informs when file sharing was enabled or disabled -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::HandleSharingStatus( - CUPnPFileSharingEngine& /*aEngine*/, - TInt /*aError*/, - TBool /*aPhase*/ ) - { - __LOG("CHomeMediaAppView::HandleSharingStatus begin"); - if( iContainer ) - { - TRAPD( err, iContainer->UpdateL() ); - if( err ) - { - __LOG1( "error=%d", err ); - } - } - __LOG("CHomeMediaAppView::HandleSharingStatus end"); - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::HandleSharingConnectionLost -// Callback to inform if connection has been lost -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::HandleSharingConnectionLost( - CUPnPFileSharingEngine& /*aEngine*/ ) - { - __LOG("CHomeMediaAppView::HandleSharingConnectionLost begin"); - if( iContainer ) - { - TRAPD( err, iContainer->UpdateL() ); - if( err ) - { - __LOG1( "iContainer->UpdateL error=%d", err ); - } - TRAP( err, UpdateNaviPaneL( ETrue ) ); - - if( err ) - { - __LOG1( "UpdateNaviPaneL error=%d", err ); - } - - } - __LOG("CHomeMediaAppView::HandleSharingConnectionLost end"); - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::PluginsUpdated -// Called by UPnPPluginLoader when plugin(s) has been updated -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::PluginsUpdated() - { - __LOG("CHomeMediaAppView::PluginsUpdated begin"); - if( iContainer ) - { - TRAPD( err, iContainer->UpdateL() ); - if( err ) - { - __LOG1( "error=%d", err ); - } - } - __LOG("CHomeMediaAppView::PluginsUpdated end"); - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::ExecuteBrowseL -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::ExecuteBrowseL() - { - __LOG("CHomeMediaAppView::ExecuteBrowseL begin"); - TInt leaveCode( KErrNone ); - - if( CheckAccessPointValid() ) - { - UpdateNaviPaneL( EFalse ); - TRAP( leaveCode, DoExecuteBrowseL() ); - } - else - { - TInt ret = StartWizardL(); - // ret: 0 when wizard is canceled - // ret: -2 when wizard steps are completed - if( ret ) - { - UpdateNaviPaneL( EFalse ); - TRAP( leaveCode, DoExecuteBrowseL() ); - } - } - - // Inform user if browse failed - // KErrCancel is returned when user selectes NO to WLAN query - if( leaveCode && - leaveCode != KErrCancel ) - { - ShowErrorNoteL( R_HOMEMEDIA_ERROR_CON_FAILED_TEXT ); - } - - __LOG("CHomeMediaAppView::ExecuteBrowseL end"); - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::DoExecuteBrowseL -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::DoExecuteBrowseL() - { - __LOG("CHomeMediaAppView::DoExecuteBrowseL begin"); - iBrowseState = EPhaseNotActive; - - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL(reinterpret_cast(waitNoteWrapper)); - waitNoteWrapper->ExecuteL( - R_HOMEMEDIA_CONNECTING_DIALOG, - *this, - ETrue); //ETrue = show immediately - CleanupStack::PopAndDestroy(waitNoteWrapper); - - if ( iAvControl ) - { - CUPnPCommonUI *commonui = CUPnPCommonUI::NewL(); - CleanupStack::PushL( commonui ); - - TInt returnValue( KErrNone ); - returnValue = commonui->ExecuteDeviceDialogL( *iAvControl ); - - CleanupStack::PopAndDestroy( commonui ); - delete iAvControl; - iAvControl = NULL; - if ( returnValue == EAknCmdExit || - returnValue == EEikCmdExit ) - { - User::Exit( KErrNone ); - } - } - __LOG("CHomeMediaAppView::DoExecuteBrowseL end"); - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::StartWizardL -// -------------------------------------------------------------------------- -// -TInt CHomeMediaAppView::StartWizardL() - { - //Start wizzard - - CUPnPAppWizard* wiz = - CUPnPAppWizard::NewL( KNullDesC, iFileSharing ); - CleanupStack::PushL( wiz ); - TInt ret = wiz->StartL(); - CleanupStack::PopAndDestroy( wiz ); - - return ret; - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::IAP() -// -------------------------------------------------------------------------- -// -TInt CHomeMediaAppView::IAP() const - { - TInt iapId( EUPnPSettingsEngineIAPIdNone ); - iSettingsEngine->GetAccessPoint( iapId ); - return iapId; - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::CheckAccessPointValid -// Check the current selected iap's validity -// -------------------------------------------------------------------------- -// -TBool CHomeMediaAppView::CheckAccessPointValid() - { - //check if the selected iap is still valid - __LOG( "CHomeMediaAppView::CheckAccessPointValid()" ); - - TBool validiap = EFalse; - TRAPD(err, validiap = CUPnPSettingsEngine::IsAccessPointValidL( IAP() ) ); - - if( !err && validiap ) - { - __LOG( "CheckAccessPointValid ETrue" ); - return ETrue; - } - else - { - __LOG( "etAccessPoint" ); - iSettingsEngine->SetAccessPoint( EUPnPSettingsEngineIAPIdNone ); - - /** - * These two APIs will be removed after the CUPnPSettingsEngine - * is refactoryed - */ - - iSettingsEngine->SetWapId( - EUPnPSettingsEngineIAPItemNone ); - iSettingsEngine->SetAccessPointSetting( - EUPnPSettingsEngineIAPItemNone ); - - __LOG( "CheckAccessPointValid EFalse" ); - return EFalse; - } - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::ShowErrorNoteL -// Shows note with error message -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::ShowErrorNoteL( TInt aMain ) const - { - __LOG("CHomeMediaAppView::ShowErrorNoteL begin"); - - // show error note - HBufC* errorNote = StringLoader::LoadLC( aMain ); - CAknErrorNote* note = new (ELeave) CAknErrorNote(ETrue); - note->ExecuteLD(*errorNote); - CleanupStack::PopAndDestroy(errorNote); - __LOG("CHomeMediaAppView::ShowErrorNoteL end"); - } - -//--------------------------------------------------------------------------- -// CHomeMediaAppView::UpdateTitlePaneL() -//--------------------------------------------------------------------------- -// -void CHomeMediaAppView::UpdateTitlePaneL() - { - __LOG("CHomeMediaAppView::UpdateTitlePaneL begin"); - CAknTitlePane* titlePane = static_cast( - StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - HBufC* titlePaneTxt = StringLoader::LoadLC( - R_HOMEMEDIA_TITLE_PANE_TEXT ); - titlePane->SetTextL( *titlePaneTxt ); - CleanupStack::PopAndDestroy( titlePaneTxt ); - __LOG("CHomeMediaAppView::UpdateTitlePaneL begin"); - } - -//--------------------------------------------------------------------------- -// CHomeMediaAppView::UpdateNaviPaneL() -//--------------------------------------------------------------------------- -// -void CHomeMediaAppView::UpdateNaviPaneL( TBool aShowStatus ) - { - __LOG("CHomeMediaAppView::UpdateNaviPaneL begin"); - TUid naviPaneUid; - naviPaneUid.iUid = EEikStatusPaneUidNavi; - CEikStatusPane* statusPane = StatusPane(); - CEikStatusPaneBase::TPaneCapabilities subPane = - statusPane->PaneCapabilities(naviPaneUid); - - if(subPane.IsPresent()&&subPane.IsAppOwned()) - { - CAknNavigationControlContainer* naviPane = - (CAknNavigationControlContainer*) statusPane->ControlL(naviPaneUid); - - if( aShowStatus ) - { - delete iNaviDecorator; - iNaviDecorator = NULL; - HBufC* naviPaneTxt = NULL; - - if( iFileSharing->SharingStateL() ) - { - TInt iapId( EUPnPSettingsEngineIAPIdNone ); - iSettingsEngine->GetAccessPoint( iapId ); - if( iapId == EUPnPSettingsEngineIAPIdAlwaysAsk ) - { - __LOG("alw ask"); - naviPaneTxt = StringLoader::LoadLC( - R_HOMEMEDIA_NAVI_CONNECTED_TEXT ); - } - else - { - naviPaneTxt = - CUPnPSettingsEngine::GetCurrentIapNameL( iapId ); - CleanupStack::PushL( naviPaneTxt ); - __LOG16( *naviPaneTxt ); - } - } - else - { - naviPaneTxt = StringLoader::LoadLC( - R_HOMEMEDIA_NAVI_NOT_CONNECTED_TEXT ); - } - - iNaviDecorator = naviPane->CreateNavigationLabelL(*naviPaneTxt); - naviPane->PushL(*iNaviDecorator); - CleanupStack::PopAndDestroy( naviPaneTxt ); - } - else - { - if ( iNaviDecorator ) - { - naviPane->Pop( iNaviDecorator ); - } - // destroy iNaviDecorator - delete iNaviDecorator; - iNaviDecorator = NULL; - } - } - __LOG("CHomeMediaAppView::UpdateNaviPaneL begin"); - } - -//--------------------------------------------------------------------------- -// CHomeMediaAppView::LoadPluginL() -//--------------------------------------------------------------------------- -// -void CHomeMediaAppView::LoadPluginL() - { - __LOG("CHomeMediaAppView::LoadPluginL begin"); - TInt iapId( IAP() ); - TInt index = iContainer->ListBox().CurrentItemIndex() - - KNumberOfItemsBeforePlugins; - if ( iPluginArray[index]->RequiresUpnpConfiguration() && - iapId <= EUPnPSettingsEngineIAPIdNone ) - { - //Start wizzard - StartWizardL(); - - // get the apid again - iapId = IAP(); - - //if apid is set,get into the plugin view - if ( iapId > EUPnPSettingsEngineIAPIdNone ) - { - // after wizard has been run, launch plugin - iPluginArray[index]->ExecuteL(); - } - } - else - { - iPluginArray[index]->ExecuteL(); - } - __LOG("CHomeMediaAppView::LoadPluginL begin"); - } - -//--------------------------------------------------------------------------- -// CHomeMediaAppView::StartSettingsViewL() -//--------------------------------------------------------------------------- -// -void CHomeMediaAppView::StartSettingsViewL() - { - CAknViewAppUi* appUi = AppUi(); - if( !appUi->View( KUPnPGSPluginImpUid ) ) - { - // Creates GS plugin implementation. CGSPluginInterface is - // inherited from the CAknView. - CGSPluginInterface* settingsView = CGSPluginInterface::NewL( - KUPnPGSPluginImpUid, NULL ); - CleanupStack::PushL( settingsView ); - - // Registers destructor key to document object. - // Ecom plugin implementation will be destroyed after view - // destruction. - CHomeMediaDocument* doc = static_cast( - appUi->Document() ); - doc->RegisterEcomDestructorKeyL( - settingsView->GetEcomDestructorKey() ); - - // Adds the view to system view framework. - appUi->AddViewL( settingsView ); //ownership transferred - CleanupStack::Pop( settingsView ); - } - - UpdateNaviPaneL( EFalse ); - - // We check the existence of gsplugin view with hardcoded uid, - // we active the view also with the same uid to detect - // possible changes better (leaves if view isn't found). - appUi->ActivateLocalViewL( KUPnPGSPluginImpUid ); - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::InitializeWizardL -// callback to run wizard -// -------------------------------------------------------------------------- -// -TBool CHomeMediaAppView::InitializeWizardL( TAny* aPtr ) - { - __LOG("[UPNP_HOMECONNECT]\t CUPnPAppMainDialog::InitializeWizardL \ -begin"); - CHomeMediaAppView* main = static_cast< CHomeMediaAppView* >( aPtr ); - if( main ) - { - if ( main->iInputBlocker ) - { - delete main->iInputBlocker; - main->iInputBlocker = NULL; - } - main->StartWizardL(); - main->iSettingsEngine->SetFirstStart( KUPnPAlreadyStarted ); - main->UpdateTitlePaneL(); - main->UpdateNaviPaneL( ETrue ); - if( main->iContainer ) - { - main->iContainer->UpdateL(); - } - } - return EFalse; - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::RefreshSharelistItemL -// if get the correct pointer ,refresh the correspond item -// in view or share dialog -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::RefreshSharelistItemL() - { - if( iContainer ) - { - iContainer->UpdateL(); - } - - if( ifileSharingDialog ) - { - ifileSharingDialog->UpdateFileSharingListL(); - } - - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::RefreshVisibilitySettingItemL -// First refresh the share item either in the CHomeMediaAppView or in the -// CUPnPAppFileSharingList,it is ten seconds that shutdown -// mediaserver,so need a timer refresh the items in time . -// -------------------------------------------------------------------------- -// -void CHomeMediaAppView::RefreshVisibilitySettingItemL() - { - RefreshSharelistItemL(); - if( iRefreshTimer ) - { - iRefreshTimer->Cancel(); - delete iRefreshTimer; - iRefreshTimer = NULL; - } - - iRefreshTimer = CUPnPPeriodic::NewL( CActive::EPriorityIdle ); - TCallBack updatelist( RefreshSharingL, this ); - iRefreshTimer->Start( KMediaServerShutdownTimeout, - KMediaServerShutdownTimeout, updatelist ); - - } - -// -------------------------------------------------------------------------- -// CHomeMediaAppView::RefreshSharingL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CHomeMediaAppView::RefreshSharingL( TAny* aPtr ) - { - CHomeMediaAppView* view( NULL ); - view = static_cast( aPtr ); - view->RefreshSharelistItemL(); - - view->iRefreshTimer->Cancel(); - delete view->iRefreshTimer; - view->iRefreshTimer = NULL; - - return KErrNone; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/src/homemediabaselistbox.cpp --- a/homemedia/homemedia/src/homemediabaselistbox.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,259 +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: Base listbox class -* -*/ - - - - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "homemediaappview.h" -#include "homemediabaselistbox.h" - -//CONSTANTS -static const TInt KIconGranularity( 3 ); -_LIT( KAknHomeMediaMbmFileName, "\\resource\\apps\\HomeMedia.mif" ); - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::CHomeMediaBaseListbox() -// -------------------------------------------------------------------------- -// -CHomeMediaBaseListbox::CHomeMediaBaseListbox() - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::~CHomeMediaBaseListbox() -// -------------------------------------------------------------------------- -// -CHomeMediaBaseListbox::~CHomeMediaBaseListbox() - { - delete iListBox; - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::ListBox() -// -------------------------------------------------------------------------- -// -CEikListBox& CHomeMediaBaseListbox::ListBox() - { - return *iListBox; - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::AddColumnL() -// -------------------------------------------------------------------------- -// -void CHomeMediaBaseListbox::AddColumnL( TRefByValue aFmt,... ) - { - // pointer to list of arguments - VA_LIST args; - // tells the code where to start the list - VA_START(args,aFmt); - HBufC* data = HBufC::NewLC(KMaxFileName); - // create TOverFlowHandler object in case if there is - // huge descriptor passed here - TOverFlowHandler overFlow; - // now format descriptor - data->Des().AppendFormatList( aFmt , args , &overFlow ); - // add item to list - iListBoxItems->AppendL(*data); - CleanupStack::PopAndDestroy(data); - // sets pointer to zero - VA_END(args); - // draw listbox - iListBox->HandleItemAdditionL(); - iListBox->DrawDeferred(); - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CHomeMediaBaseListbox::SizeChanged() - { - const TPoint listPosition(0,0); - iListBox->SetExtent(listPosition, iListBox->MinimumSize() ); - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::OfferKeyEventL() -// -------------------------------------------------------------------------- -// -TKeyResponse CHomeMediaBaseListbox::OfferKeyEventL( - const TKeyEvent &aKeyEvent, - TEventCode aType) - { - TKeyResponse ret(EKeyWasNotConsumed); - if( aType == EEventKey ) - { - if( aKeyEvent.iCode == EKeyUpArrow - || aKeyEvent.iCode == EKeyDownArrow ) - { - ret = iListBox->OfferKeyEventL(aKeyEvent, aType); - } - } - return ret; - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::CountComponentControls() -// -------------------------------------------------------------------------- -// -TInt CHomeMediaBaseListbox::CountComponentControls() const - { - return 1; - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::ComponentControl() -// -------------------------------------------------------------------------- -// -CCoeControl* CHomeMediaBaseListbox::ComponentControl(TInt aIndex) const - { - CCoeControl* ret = NULL; - switch( aIndex ) - { - case 0: - ret = iListBox; - break; - } - return ret; - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::BaseConstructL() -// -------------------------------------------------------------------------- -// -void CHomeMediaBaseListbox::BaseConstructL( const TRect& aRect - ,CEikTextListBox* aListBox ) - { - CreateWindowL(); - - // take the ownership of aListBox - iListBox = aListBox; - - /** This initializes the C-classes of a newly-created @c CEikTextListBox - * from supplied arguments. This function fully constructs the associated - * list box model and item drawer for this list box, and then invokes - * CEikListBox::ConstructL(). - */ - iListBox->ConstructL(this); - - /** - * Creates an own window for the list box or draws the list box to an old - * window defined by the container. - */ - iListBox->SetContainerWindowL(*this); - - // add scrollbars to listbox - iListBox->CreateScrollBarFrameL(ETrue); - - /** - * Sets the visibility state for both the horizontal and the vertical - * scrollbars. This is used when tiling. - */ - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); - - // get the pointer to listbox itemTextArray - iListBoxItems - = static_cast( iListBox->Model()->ItemTextArray() ); - - //Set icons - CAknIconArray* icons = new (ELeave) CAknIconArray( KIconGranularity ); - CleanupStack::PushL( icons ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) ); - - TFileName mbmFileName( KAknHomeMediaMbmFileName ); - TFileName dllName - = CEikonEnv::Static()->EikAppUi()->Application()->AppFullName(); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - mbmFileName.Insert( 0, drive ); - - // if new static menu item added constant KNumberOfItemsBeforePlugins - // has to be changed - AppendIconToArrayL( icons, skin, - mbmFileName, - KAknsIIDDefault, - EMbmHomemediaQgn_prop_upnp_browse_home, - EMbmHomemediaQgn_prop_upnp_browse_home_mask ); - - AppendIconToArrayL( icons, skin, - mbmFileName, - KAknsIIDDefault, - EMbmHomemediaQgn_prop_upnp_share_sub, - EMbmHomemediaQgn_prop_upnp_share_sub_mask ); - - static_cast(iListBox)->ItemDrawer()-> - FormattedCellData()->SetIconArray(icons); - - CleanupStack::Pop(icons); - - // Set the windows size - SetRect( aRect ); - // Activate the window, which makes it ready to be drawn - ActivateL(); - } - -// -------------------------------------------------------------------------- -// CHomeMediaBaseListbox::AppendIconToArrayL() -// -------------------------------------------------------------------------- -// -void CHomeMediaBaseListbox::AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId) - { - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC(aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId); - - CGulIcon* icon = CGulIcon::NewL(bitmap, mask); - icon->SetBitmapsOwnedExternally(EFalse); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop(mask); - CleanupStack::Pop(bitmap); - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL(icon); - - aArray->AppendL(icon); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(icon); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/src/homemediacontainer.cpp --- a/homemedia/homemedia/src/homemediacontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +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: Main application window -* -*/ - - - - - -#include -#include - -// debug log support -_LIT( KComponentLogfile, "homemedia.txt"); -#include "upnplog.h" - -#include "homemediacontainer.h" -#include "upnppluginloader.h" -#include "upnpfilesharingengine.h" -#include "iupnp.hlp.hrh" - -//CONSTANTS -#define KHomeMEdiaUID 0x2000F8D6 // home media app UID -static const TInt KNumberOfItemsBeforePlugins( 2 ); -_LIT( KFormatWithOneStr , "%d\t%S\t\t" ); -_LIT( KFormatWithTwoStr , "%d\t%S\t%S\t" ); - -// -------------------------------------------------------------------------- -// CHomeMediaContainer::NewL -// -------------------------------------------------------------------------- -// -CHomeMediaContainer* CHomeMediaContainer::NewL(const TRect& aRect, - CUPnPFileSharingEngine& aFileSharing, - const RPointerArray& aPluginArray) - { - CHomeMediaContainer* self = - CHomeMediaContainer::NewLC(aRect, aFileSharing, aPluginArray ); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------- -// CHomeMediaContainer::NewLC -// -------------------------------------------------------------------------- -// -CHomeMediaContainer* CHomeMediaContainer::NewLC(const TRect& aRect, - CUPnPFileSharingEngine& aFileSharing, - const RPointerArray& aPluginArray) - { - CHomeMediaContainer* self = - new (ELeave) CHomeMediaContainer(aFileSharing,aPluginArray); - CleanupStack::PushL(self); - self->ConstructL(aRect); - return self; - } - -// -------------------------------------------------------------------------- -// CHomeMediaContainer::~CHomeMediaContainer -// -------------------------------------------------------------------------- -// -CHomeMediaContainer::~CHomeMediaContainer() - { - } - -// -------------------------------------------------------------------------- -// CHomeMediaContainer::UpdateL -// -------------------------------------------------------------------------- -// -void CHomeMediaContainer::UpdateL() - { - if( iListBoxItems->Count() > 0 ) - { - iListBoxItems->Reset(); - } - //Set Browse item - HBufC* columnText = StringLoader::LoadLC( R_HOMEMEDIA_BROWSEHOME_TEXT ); - AddColumnL(KFormatWithOneStr,0,columnText); - CleanupStack::PopAndDestroy( columnText ); - - //Set Sharing item - HBufC* secondaryText = NULL; - if ( iFileSharing.SharingStateL() ) - { - secondaryText = - StringLoader::LoadLC( R_HOMEMEDIA_SHARE_ACTIVE_TEXT ); - } - else - { - secondaryText = - StringLoader::LoadLC( R_HOMEMEDIA_SHARE_INACTIVE_TEXT ); - } - - columnText = StringLoader::LoadLC( R_HOMEMEDIA_SHARECONTENT_TEXT ); - AddColumnL( KFormatWithTwoStr, - 1, - columnText, - secondaryText ); - CleanupStack::PopAndDestroy( columnText ); - CleanupStack::PopAndDestroy( secondaryText ); - - //Load plugins icons & texts - UpdatePluginsL(); - } - -// -------------------------------------------------------------------------- -// CHomeMediaContainer::CHomeMediaContainer -// -------------------------------------------------------------------------- -// -CHomeMediaContainer::CHomeMediaContainer( - CUPnPFileSharingEngine& aFileSharing, - const RPointerArray& aPluginArray ): - iFileSharing( aFileSharing ), - iPluginArray( aPluginArray ) - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CHomeMediaContainer::ConstructL -// -------------------------------------------------------------------------- -// -void CHomeMediaContainer::ConstructL(const TRect& aRect) - { - CAknDoubleLargeStyleListBox* listBoxModel - = new (ELeave)CAknDoubleLargeStyleListBox; - BaseConstructL( aRect , listBoxModel ); - UpdateL(); - } - -// -------------------------------------------------------------------------- -// CHomeMediaContainer::UpdatePluginsL -// -------------------------------------------------------------------------- -// -void CHomeMediaContainer::UpdatePluginsL() - { - __LOG("CHomeMediaContainer::UpdatePluginsL begin"); - CEikFormattedCellListBox* listBox = - static_cast( &ListBox() ); - - CArrayPtr& icons = - *listBox->ItemDrawer()->FormattedCellData()->IconArray(); - // Remove old plugins icons - TInt pluginIcons = icons.Count() - KNumberOfItemsBeforePlugins; - while( pluginIcons ) - { - pluginIcons--; - CGulIcon* icon = icons[ KNumberOfItemsBeforePlugins ]; - icons.Delete( KNumberOfItemsBeforePlugins ); - delete icon; - icon = NULL; - } - - for( TInt i = 0; i < iPluginArray.Count(); i++ ) - { - //append icon - const CGulIcon& icon = iPluginArray[i]->GetIcon(); - CGulIcon* copyIcon = CGulIcon::NewL( icon.Bitmap(), icon.Mask() ); - CleanupStack::PushL( copyIcon ); - // Icon is handled by us, but bitmaps by plugin - // when we delete icon, we delete icon only but not bitmaps - copyIcon->SetBitmapsOwnedExternally( ETrue ); - icons.AppendL( copyIcon ); //Ownership goes to array - CleanupStack::Pop( copyIcon ); - - HBufC* primary = NULL; - HBufC* secondary = NULL; - - // if title of the plugin is not null alloc space for it - if ( &(iPluginArray[i]->GetTitle()) ) - { - primary = ( iPluginArray[i]->GetTitle() ).AllocLC(); - } - else - { - primary = KNullDesC().AllocLC(); - } - - // if secondary text of the plugin is not null alloc space for it - if ( &(iPluginArray[i]->GetSecondaryText()) ) - { - secondary = ( iPluginArray[i]->GetSecondaryText() ).AllocLC(); - } - else - { - secondary = KNullDesC().AllocLC(); - } - - AddColumnL( KFormatWithTwoStr, - i + KNumberOfItemsBeforePlugins, - primary, - secondary ); - - // deletion of the texts after they have been set to listbox item - CleanupStack::PopAndDestroy( secondary ); - CleanupStack::PopAndDestroy( primary ); - } - __LOG("CHomeMediaContainer::UpdatePluginsL end"); - } - - -// --------------------------------------------------------------------------- -// CHomeMediaContainer::GetHelpContext -// --------------------------------------------------------------------------- -// -void CHomeMediaContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - - aContext.iMajor = TUid::Uid(0x2000F8D6); - aContext.iContext = KUPNP_HLP_MAIN_VIEW; - } diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/homemedia/src/homemediadocument.cpp --- a/homemedia/homemedia/src/homemediadocument.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +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: Main document class -* -*/ - - - - - - -// INCLUDE FILES -#include "homemediaappui.h" -#include "homemediadocument.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CHomeMediaDocument::NewL() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CHomeMediaDocument* CHomeMediaDocument::NewL( CEikApplication& aApp ) - { - CHomeMediaDocument* self = NewLC( aApp ); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------- -// CHomeMediaDocument::NewLC() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CHomeMediaDocument* CHomeMediaDocument::NewLC( CEikApplication& aApp ) - { - CHomeMediaDocument* self = new ( ELeave ) CHomeMediaDocument( aApp ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CHomeMediaDocument::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CHomeMediaDocument::ConstructL() - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CHomeMediaDocument::CHomeMediaDocument() -// C++ default constructor can NOT contain any code, that might leave. -// -------------------------------------------------------------------------- -// -CHomeMediaDocument::CHomeMediaDocument( CEikApplication& aApp ) : - CAknDocument( aApp ), - iEcomDestructorKeys( 1 ) - { - // No implementation required - } - -// --------------------------------------------------------------------------- -// CHomeMediaDocument::~CHomeMediaDocument() -// Destructor. -// --------------------------------------------------------------------------- -// -CHomeMediaDocument::~CHomeMediaDocument() - { - // Destroyes registered ecom plugin implementations. - TInt count = iEcomDestructorKeys.Count(); - if ( count ) - { - for ( TInt i = 0; i < count; i++ ) - { - REComSession::DestroyedImplementation( iEcomDestructorKeys[i] ); - } - } - iEcomDestructorKeys.Close(); - - // Tears down ECom framework. Probably application enviroment does the same - // thing but it doesn't cause any harm it it is here as well. - REComSession::FinalClose(); - } - -// --------------------------------------------------------------------------- -// CHomeMediaDocument::CreateAppUiL() -// Constructs CreateAppUi. -// --------------------------------------------------------------------------- -// -CEikAppUi* CHomeMediaDocument::CreateAppUiL() - { - // Create the application user interface, and return a pointer to it; - // the framework takes ownership of this object - return new ( ELeave )CHomeMediaAppUi; - } - -// --------------------------------------------------------------------------- -// CHomeMediaDocument::RegisterEcomDestructorKeyL() -// --------------------------------------------------------------------------- -// -void CHomeMediaDocument::RegisterEcomDestructorKeyL( const TUid& aDestructorKey ) - { - // Checks the given destructor key, does it exist already. - TInt idx = KErrNotFound; - TInt count = iEcomDestructorKeys.Count(); - for ( TInt i = 0; i < count; i++ ) - { - if ( iEcomDestructorKeys[i] == aDestructorKey ) - { - // Given TUid exists already. - idx = i; - break; - } - } - - if ( idx <= KErrNotFound ) - { - // Appends new TUid in the list. - iEcomDestructorKeys.AppendL( aDestructorKey ); - } - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/install/make_upnpapplications_sis.bat --- a/homemedia/install/make_upnpapplications_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Makes sisx for upnpapplications -rem - -makesis upnpapplications.pkg -signsis upnpapplications.sis upnpapplications.sisx rd.cer rd-key.pem - diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/install/make_upnpapplications_stub_sis.bat --- a/homemedia/install/make_upnpapplications_stub_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Package file for upnpapplications stub -rem - -makesis -s upnpapplications_stub.pkg diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/install/upnpapplications.pkg --- a/homemedia/install/upnpapplications.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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: Package file for upnpapplications -; -&EN - -; standard SIS file header -#{"UPnPApplications"},(0x1028291A),1,0,0, TYPE=SA, RU - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - - -; HomeMedia -"\Epoc32\release\armv5\urel\homemedia.exe"-"!:\sys\bin\homemedia.exe" -"\Epoc32\data\z\resource\apps\homemedia.rsc"-"!:\resource\apps\homemedia.rsc" -"\Epoc32\data\z\private\10003a3f\apps\homemedia_reg.rsc"-"!:\private\10003a3f\import\apps\homemedia_reg.rsc" -"\epoc32\data\Z\resource\apps\homemedia_aif.mif"-"!:\resource\apps\homemedia_aif.mif" -"\epoc32\data\Z\resource\apps\homemedia.mif"-"!:\resource\apps\homemedia.mif" - -; HomeSync -"\epoc32\release\armv5\urel\mediaservant.exe"-"!:\sys\bin\mediaservant.exe" -"\epoc32\data\z\private\10003a3f\apps\mediaservant_reg.rsc"-"!:\private\10003a3f\import\apps\mediaservant_reg.rsc" -"\epoc32\data\z\resource\apps\mediaservant_aif.mif"-"!:\resource\apps\mediaservant_aif.mif" -"\epoc32\data\z\resource\apps\mediaservant.mif"-"!:\resource\apps\mediaservant.mif" -"\epoc32\release\armv5\urel\msengine.dll"-"!:\sys\bin\msengine.dll" -"\epoc32\release\armv5\urel\msappwizard.dll"-"!:\sys\bin\msappwizard.dll" -"\epoc32\data\z\resource\apps\msappwizard.mif"-"!:\resource\apps\msappwizard.mif" -"\epoc32\data\z\resource\plugins\mediaservantplugin.rsc"-"!:\resource\plugins\mediaservantplugin.rsc" -"\epoc32\release\armv5\urel\mediaservantplugin.dll"-"!:\sys\bin\mediaservantplugin.dll" -"\epoc32\data\z\resource\plugins\msgsplugin.rsc"-"!:\resource\plugins\msgsplugin.rsc" -"\epoc32\release\armv5\urel\msgsplugin.dll"-"!:\sys\bin\msgsplugin.dll" -"\epoc32\release\armv5\urel\cmfillmanager.dll"-"!:\sys\bin\cmfillmanager.dll" -"\epoc32\release\armv5\urel\cmstoremanager.dll"-"!:\sys\bin\cmstoremanager.dll" -"\epoc32\release\armv5\urel\cmscheduler.dll"-"!:\sys\bin\cmscheduler.dll" -"\epoc32\release\armv5\urel\cmmemorymanager.dll"-"!:\sys\bin\cmmemorymanager.dll" -"\epoc32\release\armv5\urel\cmclient.dll"-"!:\sys\bin\cmclient.dll" -"\epoc32\release\armv5\urel\cmserver.exe"-"!:\sys\bin\cmserver.exe" -"\epoc32\data\z\resource\apps\mediaservant.rsc"-"!:\resource\apps\mediaservant.rsc" -"\epoc32\data\z\resource\apps\cmsappwizard.rsc"-"!:\resource\apps\cmsappwizard.rsc" -"\epoc32\data\z\resource\apps\memorymanager.rsc"-"!:\resource\apps\memorymanager.rsc" -"\epoc32\data\z\resource\msgspluginsrc.rsc"-"!:\resource\msgspluginsrc.rsc" -; End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/install/upnpapplications_stub.SIS Binary file homemedia/install/upnpapplications_stub.SIS has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/install/upnpapplications_stub.pkg --- a/homemedia/install/upnpapplications_stub.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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: Package file for upnpapplications stub -; -&EN - -; standard SIS file header -#{"UPnPApplications"},(0x1028291A),1,0,0, TYPE=SA - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/loc/homemedia.loc --- a/homemedia/loc/homemedia.loc Mon Nov 01 13:44:24 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: Localization strings -* -*/ - - - - - - -// LOCALISATION STRINGS - -//-------------------------------------------------------------------- -// -// Text of Home Media application in application grid -// and application title -// -// "Home Media" -// "Home Media" -//-------------------------------------------------------------------- -// - -//d:Icon text for the application grid -//l:cell_app_pane_t1 -//r:2.0 -// -#define qtn_iupnp_grid_home_media "Home Media" - - -//d:Title text for the application -//d:This is visible in the title pane -//l:title_pane_t2/opt9 -//r:2.0 -// -#define qtn_iupnp_title_home_media "Home Media" - - - -//-------------------------------------------------------------------- -// -// Text of setting list items in the Home Media: -// -// "Browse home" -// "Sharing" -//-------------------------------------------------------------------- -// - -//d:First line text for the "Browse home" -listbox item in the main -//d:pane of the Home Media application -//d:This starts the browsing home network -//l:list_double_large_graphic_pane_t1 -//r:2.0 -// -#define qtn_iupnp_browse_home "Browse home" - - -//d:First line text for the "Sharing" -listbox item in the main -//d:pane of the Home Media application -//d:This starts the Sharing dialog -//l:list_double_large_graphic_pane_t1 -//r:1.0 -// -#define qtn_iupnp_share "Sharing" - - - -//-------------------------------------------------------------------- -// -// Secondary text for the 2nd setting list -// item "Share content": -// -// "Sharing is on" -// "Sharing is off" -//-------------------------------------------------------------------- -// - -//d:Alternative second line text for the "Sharing" -listbox item -//d:in the main pane of the Home Media application -//d:Indicates that files can be seen through wlan network -//l:list_double_large_graphic_pane_t2 -//r:2.0 -// -#define qtn_iupnp_share_active "Sharing is on" - - -//d:Alternative second line text for the "Sharing" -listbox item -//d:in the main pane of the Home Media application -//d:Indicates that files can not be seen through wlan network -//l:list_double_large_graphic_pane_t2 -//r:2.0 -// -#define qtn_iupnp_share_inactive "Sharing is off" - - - -//-------------------------------------------------------------------- -// -// Text of Home Media Options menu items: -// "Run wizard" -// "Settings" -// -//-------------------------------------------------------------------- -// - -//d:Menu text in Home Media -//d:Start wizard dialog -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_iupnp_options_run_wizard "Run wizard" - - -//d:Menu text in Home Media -//d:Start settings view -//l:list_single_pane_t1_cp2 -//r:2.0 -// -#define qtn_iupnp_options_settings_main "Settings" - - -//-------------------------------------------------------------------- -// -// Text to be shown in Home Media NaviPane depending on the sharing -// status: -// -// "Not connected" -// "Connected" -// -//-------------------------------------------------------------------- - -//d:Text in nave pane if sharing is not active -//l:navi_text_pane_t1 -//r:2.0 -// -#define qtn_iupnp_navi_not_connected "Not connected" - - -//d:Text in nave pane if sharing is active and iap is always ask -//l:navi_text_pane_t1 -//r:wk50/2008 -// -#define qtn_iupnp_navi_connected "Connected" - - -//-------------------------------------------------------------------- -// -// Home Media wait notes: -// -// "Connecting" -//-------------------------------------------------------------------- -// - -//d:Connecting wait note. -//d:Shown when the user have selected Browse Home and waiting -//d:for connection to be established. -//l:popup_note_wait_window -//r:wk51/2008 -// -#define qtn_iupnp_wait_connecting "Connecting" - - -//-------------------------------------------------------------------- -// -// Text to be shown in Home Media when the -// connection is failed -// -// "Connection failed" -//-------------------------------------------------------------------- -// - -//d:Connection failed note -//l:popup_note_window/opt2 -//r:1.0 -// -#define qtn_iupnp_err_con_failed "Connection failed" - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/rom/homemedia.iby --- a/homemedia/rom/homemedia.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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: homemedia subsystem ROM include file -* -*/ - - - - - - -#ifndef __HOMEMEDIA_IBY__ -#define __HOMEMEDIA_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // HomeMedia - S60_APP_EXE(HomeMedia) - S60_UPGRADABLE_APP_REG_RSC(HomeMedia) - - // The stub sis file - data=ZSYSTEM\install\upnpapplications_stub.sis system\install\upnpapplications_stub.sis - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __HOMEMEDIA_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff homemedia/rom/homemediaresources.iby --- a/homemedia/rom/homemediaresources.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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: homemedia subsystem resource ROM include file -* -*/ - - - - - - -#ifndef __HOMEMEDIARESOURCES_IBY__ -#define __HOMEMEDIARESOURCES_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // HomeMedia - data=DATAZ_\resource\apps\homemedia.rsc \resource\apps\homemedia.rsc - data=DATAZ_\resource\apps\homemedia.mif \resource\apps\homemedia.mif - data=DATAZ_\resource\apps\homemedia_aif.mif \resource\apps\homemedia_aif.mif - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __HOMEMEDIARESOURCES_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/conf/mediaservant.confml Binary file homesync/conf/mediaservant.confml has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/conf/mediaservant_10281fab.crml Binary file homesync/conf/mediaservant_10281fab.crml has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/bwins/cmfillmanageru.def --- a/homesync/contentmanager/cmserver/cmfillmanager/bwins/cmfillmanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - ?NewFillManagerL@CmFillManagerFactory@@SAPAVMCmFmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 1 NONAME ; class MCmFmManager * CmFillManagerFactory::NewFillManagerL(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *) - ?NewFillManagerLC@CmFillManagerFactory@@SAPAVMCmFmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 2 NONAME ; class MCmFmManager * CmFillManagerFactory::NewFillManagerLC(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *) - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/eabi/cmfillmanageru.def --- a/homesync/contentmanager/cmserver/cmfillmanager/eabi/cmfillmanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - _ZN20CmFillManagerFactory15NewFillManagerLEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 1 NONAME - _ZN20CmFillManagerFactory16NewFillManagerLCEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 2 NONAME - _ZTI9CCmFmMain @ 3 NONAME ; ## - _ZTV9CCmFmMain @ 4 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/group/bld.inf --- a/homesync/contentmanager/cmserver/cmfillmanager/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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 information file for Fill Manager -* -*/ - - - -// Supported platforms -prj_platforms -DEFAULT - -// MMP files -prj_mmpfiles -cmfillmanager.mmp - -// Files to be exported -prj_exports -../inc/cmfillmanagerfactory.h |../../../../../inc/cmfillmanagerfactory.h -../inc/cmfillmanager.h |../../../../../inc/cmfillmanager.h diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/group/cmfillmanager.mmp --- a/homesync/contentmanager/cmserver/cmfillmanager/group/cmfillmanager.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 project Media servant -* -*/ - - -#include - -TARGET cmfillmanager.dll -TARGETTYPE dll -UID 0x1000008d 0x10281FAC - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH /sys/bin - -USERINCLUDE ../inc - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -SOURCEPATH ../src - -SOURCE cmfillmanagerfactory.cpp -SOURCE cmfmmain.cpp -SOURCE cmfmfilldrivemngr.cpp -SOURCE cmfmmpxnotifier.cpp -SOURCE cmfmglxnotifier.cpp -SOURCE cmfmupnpmngr.cpp -SOURCE cmfmdownloadmngr.cpp -SOURCE cmfmdownloadproxy.cpp -SOURCE cmfmduplicatedetector.cpp -SOURCE cmfmmdeduplicatedetector.cpp -SOURCE cmfmmpxduplicatedetector.cpp -SOURCE cmfmfillrulefilleddatamngr.cpp -SOURCE cmfmao.cpp - -LIBRARY euser.lib // Basic types -LIBRARY efsrv.lib // File server -LIBRARY charconv.lib // Character conversion -LIBRARY bafl.lib -LIBRARY inetprotutil.lib // EscapeUtils -// Media servant specific libraries -LIBRARY cmcommon.lib // Media servant common -LIBRARY cmdatabasemanager.lib // Database manager -LIBRARY cmsettingsengine.lib // Settings engine -LIBRARY cmmemorymanager.lib // Memory manager -LIBRARY cmsqlwrapper.lib // Sqlite wrapper -// Upnp specific libs -LIBRARY upnpavcontrollerclient.lib // Av controller client -LIBRARY upnpavcontrollerhelper.lib // Av controller helper -LIBRARY upnpavobjects.lib // Upnp Av objects -LIBRARY ws32.lib // RWsSession, CWsScreenDevice -LIBRARY upnpxmlparser.lib // Xml parser -// Metadata engine client -LIBRARY mdeclient.lib -// MPX framework -LIBRARY mpxcommon.lib -LIBRARY mpxcollectionutility.lib -LIBRARY mpxharvesterutility.lib -LIBRARY mpxcollectionmediator.lib -LIBRARY contentlistingframework.lib -// Path infos -LIBRARY PlatformEnv.lib -// Debug -DEBUGLIBRARY flogger.lib - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanager.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanager.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +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: Fill manager interface -* -*/ - - -#ifndef M_CMFMMANAGER_H -#define M_CMFMMANAGER_H - -// INCLUDE FILES -#include -#include -#include "cmcommon.h" -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class CCmSqlPropertyCollector; -class CCmSqlPropertyContainer; -class MUPnPAVController; -class CCmMediaServerFull; - -/** - * Defines the fill manager interface - * - * This class defines the fill manager interface. Provides methods to - * execute fill specific services - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( MCmFmManager ) - { - -public: - - /** - * Starts fill service - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void StartFillL() = 0; - - /** - * Cancels fill service - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void CancelOperation() = 0; - - /** - * Pre-process fill lists - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void PreProcessListsL() = 0; - - /** - * Processes defined fill list - * - * @since S60 5.1 - * @param aFillListName, name of the fill list - * @return None - */ - virtual void PreProcessListL( const TDesC8& aFillListName ) = 0; - - /** - * Provides metadata column item list - * - * @since S60 5.1 - * @param aType, metadata field - * @param aMedia, media type - * @param aArray, array of field values - * @return None - */ - virtual void GetColItemsL( TCmMetadataField aType, - TCmMediaType aMedia, CDesCArray& aArray ) = 0; - - /** - * Provides metadata column item list - * - * @since S60 5.1 - * @param aType, metadata field - * @param aMedia, media type - * @param aPropertys, container of field values - * @return None - */ - virtual void GetColItemsL( TCmMetadataField aType, - TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys ) = 0; - - /** - * Provides metadata items list - * - * @since S60 5.1 - * @param aPropertys, property collector reference - * @return None - */ - virtual void GetMetadataItemsL( - CCmSqlPropertyCollector& aPropertys ) = 0; - /** - * Sets av controller - * - * @since S60 5.1 - * @param aAVController, pointer to av controller - * @return None - */ - virtual void SetAvController( MUPnPAVController* aAVController ) = 0; - - /** - * Update fill list item priorities - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void UpdatePriorities() = 0; - - /** - * Update fill list item reference values - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void UpdateRefIds() = 0; - - /** - * Delete metadata from defined servers - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void DeleteMetadataL() = 0; - - /** - * Closes the utility and deletes the object - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void Close() = 0; - - }; - - -#endif // M_CMFMMANAGER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanagerfactory.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfillmanagerfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +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: Abstract factory for Fill Manager -* -*/ - - - -#ifndef C_CMFILLMANAGERFACTORY_H -#define C_CMFILLMANAGERFACTORY_H - -#include - -class MCmFmManager; -class MCmServiceObserver; -class CMdESession; -class CCmDmMain; -class CCmMmMain; - -/** - * Abstract factory for Fill manager - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -class CmFillManagerFactory - { - -public: - - /** - * Creates a new instance of Fill Manager - * - * @since S60 5.1 - * @param aObserver, service observer - * @param aSession, mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return pointer to CCmFmMain class - */ - IMPORT_C static MCmFmManager* NewFillManagerL( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - /** - * Creates a new instance of Fill Manager. Instance is left in - * cleanup stack. - * - * @since S60 5.1 - * @param aObserver, service observer - * @param aSession, mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return pointer to MCmFmManager class - */ - IMPORT_C static MCmFmManager* NewFillManagerLC( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - }; - -#endif // C_CMFILLMANAGERFACTORY_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmao.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2007 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: Fill rule and filled data managing Active object -* -*/ - - - -#ifndef __CMFMAO_H -#define __CMFMAO_H - -#include - - - -// Forward Declarations -class CCmFmFillRuleFilledDataMngr; - - /** - * Class asyncronous request completions from sqlite wrapper - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmAo ): public CActive - { - -public: - - /** - * Creates new CCmFmAo class - * - * @since S60 5.1 - * @param aMngr, main class - * @return pointer to CCmFmAo class - */ - static CCmFmAo* NewL( CCmFmFillRuleFilledDataMngr& aMngr ); - - /** - * Creates new CCmFmAo class - * - * @since S60 5.1 - * @param aMngr, main class - * @return pointer to CCmFmAo class - */ - static CCmFmAo* NewLC( CCmFmFillRuleFilledDataMngr& aMngr ); - - /** - * Destructor. - */ - virtual ~CCmFmAo(); - -// Functions from base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - - /** - * From CActive - * See base class definition - */ - virtual TInt RunError( TInt aError ); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aMngr, fill rule filled data manager - */ - CCmFmAo( CCmFmFillRuleFilledDataMngr& aMngr ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * Main manager class - */ - CCmFmFillRuleFilledDataMngr& iMngr; - - /** - * State variable if ETrue ao is on idle state - */ - TBool iIdle; - - }; - -#endif // __CMFMAO_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmcommon.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmcommon.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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: Common header for fill manager -* Version : %version: tr1ido#7 % << Don't touch! -* -*/ - - -#ifndef CMFMCOMMON_H -#define CMFMCOMMON_H - -// Fill temp file -_LIT( KCmFmTempFile, "cm_temp" ); - - -// Status codes used in Fill Manager -enum TCmFmStatus - { - ECmFmNULL = 0, - ECmFmFillRuleProgessingStarted, // Rule processing started - ECmFmFillRulesReady, // Not used at the moment - ECmFmMMCCheckStarted, // memory card check starting - ECmFmDeviceListingStarted, // Not used at the moment - ECmFmWrongMMC, // Wrong memory card found - ECmFmMMCOk, // Memory ok - ECmFmMMCCheckFailed, // Memory checking failed - ECmFmNoConnection, // Not used at the moment - ECmFmConnectionLost, // Not used at the moment - ECmFmStartUriCheck, // Starting Uri check - ECmFmDeleteFiles, // Starting delete files - ECmFmShrinkImage, // Starting shrink images - ECmFmBrowseReady, // Browse to check uri ready - ECmFmUriOK, // Uri ok - ECmFmCheckItem // Starting check item - }; - -// File transfer statuses -enum TCmFmTransferStatus - { - ECmFmFileFetchStarted = 20, // File copy started - ECmFmFileFetched // File copied - }; - -// Uri check statuses -enum TCmFmUriCheckResult - { - ECanceled = 25, // Operation canceled - ENoUriAvailable, // Uri not available - EUriChecked // Uri checked - }; - -// Fill list processing statuses -enum TCmFmFillRuleProcessing - { - EProcessingStarted = 60, // Fill rule processing started - EProcessing, // Processing on-going - EProcessingReady, // Processing ready - EQueryCompleted, // Metadata query completed - EQueryFailed, // Metadata query failed - ENextFillRule, // Processing next rule - EFillRulesLoaded, // Fill rules loaded - ENoRulesSelected, // Rules selected - ENoObjectsSelected, // Fill objects selected - EProcessingCanceled, // Canceled - EPreProcessingStarted, // Preprocessing started - EFillFilesLoaded, // Files loaded - EProcessStatusValues, // Processing file statuses - ERandomizingStarted, // Randomizing list - EColumnDataReady, // Property columns got - EProcessDuplicates, // Processing duplicate files - EProcessReferenceValues, // Processing reference files end - EProcessingFailed, // Processing failed - EUpdatePriorities, // Updating fill list priorities - EDoUpdatePriorities, // Do update priorities - EMetadataDeleted // Metadata deleted - }; - -#endif // CMFMCOMMON_H - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadmngr.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadmngr.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +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: Manages upnp download -* -*/ - - - -#ifndef __CMFMDOWNLOADMNGR_H -#define __CMFMDOWNLOADMNGR_H - -#include -#include -#include "upnpfiletransfersessionobserver.h" - -/* Forward declarations. */ -class MUPnPAVController; -class CUpnpAVDevice; -class MCmFmTransferObserver; - -// CLASS DECLARATION - /** - * Class represents methods to communication with AV Controller API. - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmDownloadMngr ): public CBase, - public MUPnPFileTransferSessionObserver - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aAVController, av controller - * @param aObserver, action observer - * @param aDevice, device - * @param aDownloadId, id for the download manager - * @return pointer to CCmFmDownloadMngr class - */ - static CCmFmDownloadMngr* NewL( MUPnPAVController* aAVController, - MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice, - const TInt aDownloadId ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aAVController, av controller - * @param aObserver, action observer - * @param aDevice, device - * @param aDownloadId, id for the download manager - * @return pointer to CCmFmDownloadMngr class - */ - static CCmFmDownloadMngr* NewLC( MUPnPAVController* aAVController, - MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice, - const TInt aDownloadId ); - - /** - * Destructor. - */ - virtual ~CCmFmDownloadMngr(); - -public: - - /** - * Starts to fetch defined file - * - * @since S60 5.1 - * @param aResElement, pointer to av controller - * @param aItem, item to be transferred - * @param aFile, file to be downloaded - * @param aInternalItemId, internal item index - * @return None - */ - void FetchFileL( const CUpnpElement& aResElement, - const CUpnpItem& aItem, RFile& aFile, const TInt64 aInternalItemId ); - - /** - * Cancel UPnP operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - -protected: - -// From base class MUPnPFileTransferSessionObserver - - /** - * From MUPnPFileTransferSessionObserver - * @see base class definition - */ - void TransferStarted( TInt aKey, TInt aStatus ); - - /** - * From MUPnPFileTransferSessionObserver - * @see base class definition - */ - void TransferCompleted( TInt aKey, TInt aStatus, - const TDesC& aFilePath ); - - /** - * From MUPnPFileTransferSessionObserver - * @see base class definition - */ - void TransferProgress( TInt aKey, TInt aBytes, TInt aTotalBytes ); - - /** - * From MUPnPFileTransferSessionObserver - * @see base class definition - */ - void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason ); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aAVController, av controller - * @param aObserver, transfer observer - * @param aDownloadId, download manager id - */ - CCmFmDownloadMngr( MUPnPAVController* aAVController, - MCmFmTransferObserver* aObserver, const TInt aDownloadId ); - - /** - * Performs the second phase construction. - * @since S60 5.1 - * @param aDevice, UPnP server - */ - void ConstructL( const CUpnpAVDevice& aDevice ); - - -private: - - /** - * AV Controller - */ - MUPnPAVController* iAVController; // Not owned - - /** - * File transfer Observer - */ - MCmFmTransferObserver* iObserver; // Not owned - - /** - * Download manager id. Proxy identifies managers with this id - */ - TInt iDownloadId; - - /** - * Download session - */ - MUPnPFileDownloadSession* iDownloadSession; // Not owned - - /** - * Size of transferred file - */ - TInt64 iFileSize; - - }; - -#endif // __CMFMDOWNLOADMNGR_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadproxy.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmdownloadproxy.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +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: Manages upnp download -* -*/ - - - -#ifndef __CMFMDOWNLOADPROXY_H -#define __CMFMDOWNLOADPROXY_H - -#include - -/* Forward declarations. */ -class MUPnPAVController; - -class CUpnpAVDevice; -class MCmFmTransferObserver; -class CCmFmDownloadMngr; - -// CLASS DECLARATION - -/** - * Class represents methods to communication with AV Controller API. - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmDownloadProxy ): public CBase - { - -private: - - // Struct containing indexed download session - // ( own session for each server ) - struct TCmFmDownloadSessionIndexes - { - TInt iDeviceIndex; // Device index - TInt iSessionIndex; // Session index - }; - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - */ - static CCmFmDownloadProxy* NewL( ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - */ - static CCmFmDownloadProxy* NewLC( ); - - /** - * Destructor. - */ - virtual ~CCmFmDownloadProxy(); - -public: - - /** - * Starts to fetch defined file - * - * @since S60 5.1 - * @param aObserver, action observer - * @param aAVController, pointer to av controller - * @param aDevices, list of devices - * @param aResElement, pointer to av controller - * @param aItem, item to be transferred - * @param aFile, file reference - * @param aInternalDeviceIndex, internal device index - * @param aInternalItemId, internal item index - * @return None - */ - void FetchFileL( MCmFmTransferObserver* aObserver, - MUPnPAVController* aAVController, CUpnpAVDeviceList* aDevices, - const CUpnpElement& aResElement, - const CUpnpItem& aItem, RFile& aFile, const TInt aInternalDeviceIndex, - const TInt64 aInternalItemId ); - - /** - * Closes download session - * - * @since S60 5.1 - * @param aSessionId, session to be closed - * @return ETrue, if sessions left - */ - TBool CloseDownloadSession( const TInt aSessionId ); - - /** - * Cancel UPnP operation download - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - -private: - - /** - * Starts new download session if session to - * defined device doesn't already exist. - * - * @since S60 5.1 - * @param aObserver, action observer - * @param aAVController, pointer to av controller - * @param aDevices, list of devices - * @param aInternalDeviceIndex, internal device index - * @return index of the used session - */ - TInt StartNewDownloadSessionIfNeededL( MCmFmTransferObserver* aObserver, - MUPnPAVController* aAVController, - CUpnpAVDeviceList* aDevices, - const TInt aInternalDeviceIndex ); - - /** - * Creates new download session - * - * @since S60 5.1 - * @param aObserver, action observer - * @param aAVController, pointer to av controller - * @param aDevices, list of devices - * @param aSessionCount, session count - * @param aSessionIndex, ref to session index - * @return index of the used session - */ - void CreateNewSessionL( - MCmFmTransferObserver* aObserver, MUPnPAVController* aAVController, - CUpnpAVDeviceList* aDevices, TInt aSessionCount, - TInt& aSessionIndex ); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmFmDownloadProxy( ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * Download sessions - */ - RPointerArray iDownloadSessions; - - /** - * Indexed array for download sessions - */ - RArray iSessionIndexes; - - /** - * Count of download session - */ - TInt iDownloadSessionCount; - - }; - -#endif // __CMFMDOWNLOADPROXY_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmduplicatedetector.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmduplicatedetector.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +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: Handles duplicate detection -* -*/ - - - -#ifndef __CMFMDUPLICATEDETECTOR_H -#define __CMFMDUPLICATEDETECTOR_H - -#include - -// Forward declarations -class CCmFillListItem; -class CMdESession; -class CCmFmMdEDuplicateDetector; -class CCmFmMpxDuplicateDetector; -class MCmFmItemHandlerObserver; - -// Class declaration - -/** - * CCmFmDuplicateDetector class - * Part of Fill manager. CCmFmDuplicateDetector manages - * duplicate detection - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmDuplicateDetector ) : public CBase - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @param aSession, mde session - * @return pointer to CCmFmDuplicateDetector class - */ - static CCmFmDuplicateDetector* NewL( MCmFmItemHandlerObserver& aObserver, - CMdESession& aSession ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @param aSession, mde session - * @return pointer to CCmFmDuplicateDetector class - */ - static CCmFmDuplicateDetector* NewLC( MCmFmItemHandlerObserver& aObserver, - CMdESession& aSession ); - - /** - * Destructor. - */ - virtual ~CCmFmDuplicateDetector(); - -public: - - /** - * Check if file is duplicate. - * @param aItem, item to be checked - * @return None - */ - void CheckItemL( const CCmFillListItem& aItem ); - - /** - * Add to items array for duplicated check - * @param aItem, item to be append - * @return None - */ - void AppendToArrayL( const CCmFillListItem& aItem ); - - /** - * reset the duplicator check array - * @param None - * @return None - */ - void ResetArray(); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmFmDuplicateDetector( ); - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aObserver, item handler observer - * @param aSession, mde session - */ - void ConstructL( MCmFmItemHandlerObserver& aObserver, - CMdESession& aSession ); - - -private: - - /** - * MdE (Video & Image) duplicate detector - */ - CCmFmMdEDuplicateDetector* iCmFmMdEDuplicateDetector; // owned - - /** - * Mpx (Music) duplicate detector - */ - CCmFmMpxDuplicateDetector* iCmFmMpxDuplicateDetector; // owned - - }; - -#endif // __CMFMDUPLICATEDETECTOR_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfilldrivemngr.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfilldrivemngr.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +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: Fill drive manager class -* -*/ - - - -#ifndef __CMFMFILLDRIVEMNGR_H -#define __CMFMFILLDRIVEMNGR_H - -#include -#include "cmfmcommon.h" - -// Forward declarations -class CCmDriveInfo; - -/** - * CCmFmFillDriveMngr class - * Part of Fill manager. CCmFmFillDriveMngr manages - * driveId checking, which is executed before every fill - * operation. - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmFillDriveMngr ): public CBase - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aFs, File server session - * @param aDrives, dirve array - * @return pointer to CCmFmFillDriveMngr class - */ - static CCmFmFillDriveMngr* NewL( RFs& aFs, - RPointerArray& aDrives ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aFs, File server session - * @param aDrives, dirve array - * @return pointer to CCmFmFillDriveMngr class - */ - static CCmFmFillDriveMngr* NewLC( RFs& aFs, - RPointerArray& aDrives ); - - /** - * Destructor. - */ - virtual ~CCmFmFillDriveMngr(); - -public: - - /** - * Checking Drive Id - * - * @since S60 5.1 - * @param None - * @return TCmFmStatus status of the drive id check - */ - TCmFmStatus CheckDriveId(); - - /** - * Checkking if the Drive has a capasity for saving the file - * - * @since S60 5.1 - * @param aFileSize, size of the file - * @param aDriveId, drive id - * @param aDriveNumber, drive number ( -1 if no space left ) - * @return index to drive array - */ - TInt CheckFreeDiscSpace( TUint32 aFileSize, TUint& aDriveId, - TInt& aDriveNumber ); - -private: - - /** - * Mounts file system - * - * @since S60 5.1 - * @param aFileServer, file server session - * @param aVolInfo, drive info - * @param aDriveNumber, drive number - * @return error code - */ - TInt DoMountFileSystem( RFs& aFileServer, TVolumeInfo& aVolInfo, - TInt aDriveNumber ); - - /** - * Selects drive to be used - * - * @since S60 5.1 - * @param None - * @return Drive number - */ - TInt SelectDrive(); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aFs, file server - * @param aDrives, drive array - */ - CCmFmFillDriveMngr( RFs& aFs, - RPointerArray& aDrives ); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: - - /** - * File server session - */ - RFs iFsSession; - - /** - * Drive info array - */ - RPointerArray& iDrives; - - }; - -#endif // __CMFMFILLDRIVEMNGR_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillrulefilleddatamngr.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillrulefilleddatamngr.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,648 +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: Fill rule and filled data managing -* Version : %version: tr1ido#8 % << Don't touch! -* -*/ - - - -#ifndef __CMFMFILLLIST_H -#define __CMFMFILLLIST_H - -#include -#include -#include "cmcommontypes.h" -#include "cmcommon.h" -#include "cmfmcommon.h" - -// Forward declarations -class MCmSqlMain; -class CCmDmMain; -class CCmFillRule; -class CCmFillListItem; -class CCmFillRuleContainer; -class CCmSqlPropertyItem; -class CCmSqlPropertyContainer; -class CCmFmAo; -class MCmFmFillRuleObserver; -class CCmSqlPropertyCollector; - - /** - * Class processes selected fill rules. Uses Database Manager and - * Sqlite wrapper API to retrieve wanted metadata. Fill service is - * started using processed metadata items. - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmFillRuleFilledDataMngr ): public CActive - { - -private: // enumerations - - // Metadata processing states - enum TCmFmMetadaProcessingState - { - ECmFmIdle = 0, - ECmFmLoadingMetadata, - ECmFmLoadingPropertys, - ECmFmDeletingMetadata, - ECmFmLoadingProfileIds - }; - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer for metadata processing - * @param aDBMngr, database manager - * @param aItems, items pointers array - * @return pointer to CCmFmFillRuleFilledDataMngr class - */ - static CCmFmFillRuleFilledDataMngr* NewL( - MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer for metadata processing - * @param aDBMngr, database manager - * @param aItems, items pointers array - * @return pointer to CCmFmFillRuleFilledDataMngr class - */ - static CCmFmFillRuleFilledDataMngr* NewLC( - MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems ); - - /** - * Destructor. - */ - virtual ~CCmFmFillRuleFilledDataMngr(); - -public: - - /** - * Notified when asyncronous operation is completed - * - * @since S60 5.1 - * @param aStatus, completion status - * @return None - */ - void OperationCompletedL( TInt aStatus ); - - /** - * Loads profile ids from database - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadProfileIdsL(); - - /** - * Starting fill rule pre-processing - * - * @since S60 5.1 - * @param None - * @return None - */ - void PreprocessListsL(); - - /** - * Starting fill rule processing - * - * @since S60 5.1 - * @param aFillListName, name of the list - * @return None - */ - void PreProcessListL( const TDesC8& aFillListName ); - - /** - * Provides metadata column item list - * - * @since S60 5.1 - * @param aType, metadata field identifier - * @param aMedia, media type identifier - * @param aPropertys, property container reference - * @return None - */ - void GetColItemsL( TCmMetadataField aType, - TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys ); - - /** - * Provides metadata items list - * - * @since S60 5.1 - * @param aPropertys, property collector reference - * @return None - */ - void GetMetadataItemsL( CCmSqlPropertyCollector& aPropertys ); - - /** - * Update fill list item priorities and reference values - * - * @since S60 5.1 - * @param None - * @return None - */ - void UpdatePriorities(); - - /** - * Do update fill list item reference ids - * - * @since S60 5.1 - * @param None - * @return None - */ - void DoUpdateReferenceIdsL(); - - /** - * Delete metadata from unselected servers - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteMetadataL(); - - /** - * Sets memory card quota to wrapper - * - * @since S60 5.1 - * @param aQuota, fill quota - * @return None - */ - void SetMemoryCardQuota( TInt64 aQuota ); - - /** - * Canceling operations - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - - /** - * Updating transfer history - * - * @since S60 5.1 - * @param aInterval, used time - * @param aDataAmount, amount of transferred data - * @param aServerId, server from where data transferred - * @return None - */ - void UpdateTransferHistoryData( TInt64 aInterval, - TInt64 aDataAmount, - TUint8 aServerId ); - - /** - * Loads wanted items from the db - * - * @since S60 5.1 - * @param None - * @return None - */ - void GetFillItemsL(); - - /** - * Loads to be deleted items from the db - * - * @since S60 5.1 - * @param aArray, array of to be deleted items - * @return None - */ - void GetToBeDeletedL( RPointerArray& aArray ); - - /** - * Updates listed items into db - * - * @since S60 5.1 - * @param aCancel, if this opration is called by cancel harvest - * @return None - */ - void UpdateFillItems( TBool aCancel = EFalse ); - - /** - * Updates listed items into db - * - * @since S60 5.1 - * @param aArray, array of to be deleted items - * @return None - */ - void UpdateToBeDeleted( RPointerArray& aArray ); - - /** - * Loads right Uuid - * - * @since S60 5.1 - * @param aUuid, contains uuid on return - * @param aId, id of the wanted uuid - * @return error code - */ - TInt GetUuidL( HBufC8*& aUuid, TUint8 aId ); - - /** - * Resets allocated data - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetData(); - - /** - * Calculating transfer history time - * - * @since S60 5.1 - * @param None - * @return None - */ - void CalculateAvgTransferTimeL(); - - /** - * Publishes transfer history time estimate - * - * @since S60 5.1 - * @param None - * @return None - */ - void SendAvgTransferTime(); - - /** - * Returns media servers db id - * - * @since S60 5.1 - * @param aUuid, media server's uuids - * @return database id - */ - TInt64 GetMediaServerIdL( const TDesC8& aUuid ); - -private: - - /** - * Do update fill list item priorities - * - * @since S60 5.1 - * @param None - * @return None - */ - void DoUpdatePrioritiesL(); - - /** - * Loading all selected fill rules - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadSelectedFillRulesL(); - - /** - * Loading all fill rules - * - * @since S60 5.1 - * @param None - * @return Fill rule container - */ - CCmFillRuleContainer* LoadAllFillRulesL(); - - /** - * Loads defined fill list - * - * @since S60 5.1 - * @param aFillListName, name of the list - * @return None - */ - void LoadRuleL( const TDesC8& aFillListName ); - - /** - * Updates fill list item priorities up to date - * - * @since S60 5.1 - * @param aContainer, container containing all rules - * @return None - */ - TInt UpdateListItemPriorities( CCmFillRuleContainer* aContainer ); - - /** - * Initializing metadata find - * - * @since S60 5.1 - * @param aFillRule, fill list - * @return None - */ - void LoadMetadataL( CCmFillRule* aFillRule ); - - /** - * Processing possible fill file list duplicates - * and adds reference values if needed - * - * @since S60 5.1 - * @param None - * @return None - */ - void ProcessReferenceValuesL(); - - /** - * Processes possible fill file list duplicates - * and adds reference values if needed - * - * @since S60 5.1 - * @param None - * @return None - */ - void DoProcessReferenceValuesL(); - - /** - * Processing possible fill file list duplicates, - * removes duplicates appeared in new sql query - * If same item is twice in item list, - * new item is removed - * - * @since S60 5.1 - * @param None - * @return None - */ - void ProcessDuplicates(); - - /** - * Selects fill list files which are with defined rule id - * - * @since S60 5.1 - * @param aList, list to be filled - * @param aId, fill list id - * @return None - */ - void SelectFillListFiles( RArray& aList, TUint8 aId ); - - /** - * Updates status values of the fill list files - * - * @since S60 5.1 - * @param None - * @return None - */ - void ProcessFileStatusValuesL(); - - /** - * Updatas the fill file's ids. - * - * @since S60 5.1 - * @param aDelIds,array to store files's id - * @param aIndex, Index of fill items - * @param aRealCount, count of fill items - * @param aRealSize, size of fill items - * @return None - */ - void ProcessFileSizeAndCount( RArray& aDelIds, TInt aIndex, - TInt64& aRealCount, TInt64& aRealSize ); - - /** - * Loads all fill file items - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadAllFillItemsL(); - - /** - * Delete duplicated fill items and adjust array - * - * @since S60 5.1 - * @param aIndex, Index array of fill items - */ - void DoDeleteProcess( TInt aIndex ); - - /** - * Defines unsupported dlna profile ids - * - * @since S60 5.1 - * @param None - * @return None - */ - void DefineAndSetDlnaProfileIdFiltersL(); - - /** - * Completes request - * - * @since S60 5.1 - * @param aStatus, defined id for the completing - * @return None - */ - void CompleteRequest( TCmFmFillRuleProcessing aStatus ); - - /** - * Starts asyncronous operartion observer - * i.e. creates active object - * @since S60 5.1 - * @param None - * @return None - */ - void StartObserverL(); - - /** - * Creates metadata cache wrapper - * @since S60 5.1 - * @param None - * @return None - */ - void CreateWrapperL(); - - /** - * Deletes metadata cache wrapper - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteWrapper(); - - /** - * Processes fill lists - * @since S60 5.1 - * @param None - * @return None - */ - void CheckFillListsL(); - - /** - * Deletes hash codes - * @since S60 5.2 - * @param None - * @return None - */ - void DeleteHashCodesL(); - -protected: - -// Functions from base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - - /** - * From CActive - * See base class definition - */ - virtual TInt RunError(TInt aError); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, Fill list observer - * @param aDBMngr, database manager - * @param aItems, array of list items - */ - CCmFmFillRuleFilledDataMngr( MCmFmFillRuleObserver* aObserver, - CCmDmMain* aDBMngr, RPointerArray& aItems ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * Metadata cache wrapper - */ - MCmSqlMain* iWrapper; // owned - - /** - * Active object in use of sql wrapper - */ - CCmFmAo* iAo; // owned - - /** - * Pointer to observer class - */ - MCmFmFillRuleObserver* iObserver; // not owned - - /** - * Pointer to database manager - */ - CCmDmMain* iDBManager; // not owned - - /** - * All fill list items - */ - RPointerArray& iItems; // not owned - - /** - * fill list items for updating to DB - */ - RPointerArray iUpdateItems; //owned - - /** - * Property values loaded from the cache - */ - RPointerArray iPropertys; // owned - - /** - * Property container referencing got from client - */ - CCmSqlPropertyContainer* iPropertyContainer; // not owned - - /** - * Property container referencing got from client - */ - CCmSqlPropertyCollector* iPropertyCollector; // not owned - - /** - * Rule array - */ - RPointerArray iRuleArray; - - /** - * Item ids on the list - */ - RArray iFileIds; - - /** - * State of the metadata processing - */ - TCmFmMetadaProcessingState iProcessingState; - - /** - * Count of new metadata items - */ - TInt iNewItemCount; - - /** - * Count of all metadata items - */ - TInt iAllItemCount; - - /** - * Start time of list processing - */ - TTime iQueryStart; - /** - * End time of list processing - */ - TTime iQueryFinished; - - /** - * Total transfer time estimate - */ - TCmProgressInfo iTransferInfo; - - /** - * Container for fill lists - */ - CCmFillRuleContainer* iContainer; // owned - - /** - * Server list whose metadata will be deleted - */ - RArray iMetadataServersToBeDeleted; - - /** - * Profile filters - */ - RArray iFilteredProfiles; - - /** - * File Server session - */ - RFs iFs; - - /** - * Old item ids on the list - */ - RArray iOldIds; - - }; - -#endif // __CMFMFILLLIST_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillruleobserver.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmfillruleobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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: Callback interface to fill rule processing -* -*/ - - - -#ifndef M_CMFMFILLRULEOBSERVER_H -#define M_CMFMFILLRULEOBSERVER_H - -#include "cmfmcommon.h" - -/** - * Fill rule observer class - * Callback interface class used to notify CmFmMain -class - * about fill rule processing status - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( MCmFmFillRuleObserver ) - { - -public: - - /** - * Used to notify about status changes in fill rule processing - * - * @since S60 5.1 - * @param aStatus, status of processing - * @return None - */ - virtual void FillRuleProcessingStatus( - TCmFmFillRuleProcessing aStatus ) = 0; - - }; - - -#endif // M_CMFMFILLRULEOBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmglxnotifier.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmglxnotifier.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2007 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: Gallery notifier class -* -*/ - - - -#ifndef __CMFMGLXNOTIFIER_H -#define __CMFMGLXNOTIFIER_H - -#include - -/** - * CCmFmGlxNotifier class - * Part of Fill manager. CCmFmGlxNotifier manages - * Gallery notify events - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmGlxNotifier ): public CBase - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aFS, file session - * @return pointer to CCmFmGlxNotifier class - */ - static CCmFmGlxNotifier* NewL( RFs& aFS ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aFS, file session - * @return pointer to CCmFmGlxNotifier class - */ - static CCmFmGlxNotifier* NewLC( RFs& aFS ); - - /** - * Destructor. - */ - virtual ~CCmFmGlxNotifier(); - -public: - - /** - * Notifying Media gallery about filled files - * - * @since S60 5.1 - * @param aFullPath, path of the filled files - * @return None - */ - void NotifyGalleryL( const TDesC& aFullPath ); - - /** - * Notifying Media gallery about filled files - * - * @since S60 5.1 - * @param None - * @return None - */ - void NotifyGalleryL(); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmFmGlxNotifier( ); - - /** - * Performs the second phase construction. - * @since S60 5.1 - * @param aFs, file server - */ - void ConstructL( RFs& aFS ); - - }; - -#endif // __CMFMGLXNOTIFIER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmitemhandlerobserver.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmitemhandlerobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2007 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: Callback interface to fill rule processing -* -*/ - - - -#ifndef M_CMFMITEMHANDLEROBSERVER_H -#define M_CMFMITEMHANDLEROBSERVER_H - - /** - * Call back observer - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( MCmFmItemHandlerObserver ) - { -public: - - /** - * Call back for observer - * - * @since S60 5.1 - * @param aDuplicate, ETrue if file is a duplicate - * @return None - */ - virtual void DuplicateL( const TBool aDuplicate ) = 0; - - }; - - -#endif // M_CMFMITEMHANDLEROBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmain.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmain.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,723 +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: Main class in the Fill manager component -* -*/ - - -#ifndef C_CMFMMAIN_H -#define C_CMFMMAIN_H - -#include -#include "cmfmfillruleobserver.h" -#include "cmfmupnpactionobserver.h" -#include "cmfmtransferobserver.h" -#include "cmfmitemhandlerobserver.h" -#include "cmmmobserver.h" -#include "cmcommon.h" -#include "cmfillmanager.h" - -/* Forward declarations. */ -class CCmFmUpnpMngr; -class MCmServiceObserver; -class CCmFmFillDriveMngr; -class CCmFmFillRuleFilledDataMngr; -class CCmFmDuplicateDetector; -class CCmMmMain; -class CCmDmMain; -class CCmFmDownloadProxy; -class CCmFillListItem; -class CUpnpAVDeviceList; -class CCmDriveInfo; -class CMdESession; -class CCmFmMpxNotifier; -class CCmFmGlxNotifier; - -// Constants -_LIT( KCmFmFillManager, "FillManager"); - -/** - * CCmFmMain class - * Part of Fill manager.Fill service - * - * @lib cmfillmanager.lib - * - * @since S60 v3.1 - */ -class CCmFmMain : public CActive, - public MCmFmManager, - public MCmFmFillRuleObserver, - public MCmFmUPnPActionObserver, - public MCmFmTransferObserver, - public MCmFmItemHandlerObserver, - public MCmMmObserver - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, service observer - * @param aSession, mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return pointer to CCmFmMain class - */ - static CCmFmMain* NewL( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, service observer - * @param aSession, mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return pointer to CCmFmMain class - */ - static CCmFmMain* NewLC( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - /** - * Destructor. - */ - virtual ~CCmFmMain(); - - /** - * Sort function that arranges pointers by id - * @since S60 5.1 - * @param aItem1, item to be sorted - * @param aItem2, item to be sorted - */ - static TInt CompareById( const CCmFillListItem& aItem1, - const CCmFillListItem& aItem2 ); - - /** - * Sort function that arranges pointers by size - * @since S60 3.2 - * @param aItem1, item to be sorted - * @param aItem2, item to be sorted - */ - static TInt CompareBySize( const CCmFillListItem& aItem1, - const CCmFillListItem& aItem2 ); - - -protected: - -// From base class MCmFmManager - - /** - * From MCmFmManager - * See base class definition - */ - void StartFillL(); - - /** - * From MCmFmManager - * See base class definition - */ - void CancelOperation(); - - /** - * From MCmFmManager - * See base class definition - */ - void PreProcessListsL(); - - /** - * From MCmFmManager - * See base class definition - */ - void PreProcessListL( const TDesC8& aFillListName ); - - /** - * From MCmFmManager - * See base class definition - */ - void GetColItemsL( TCmMetadataField aType, - TCmMediaType aMedia, CDesCArray& aArray ); - - /** - * From MCmFmManager - * See base class definition - */ - void GetColItemsL( TCmMetadataField aType, - TCmMediaType aMedia, - CCmSqlPropertyContainer& aPropertys ); - - /** - * From MCmFmManager - * See base class definition - */ - void GetMetadataItemsL( CCmSqlPropertyCollector& aPropertys ); - - /** - * From MCmFmManager - * See base class definition - */ - void SetAvController( MUPnPAVController* aAVController ); - - /** - * From MCmFmManager - * See base class definition - */ - void UpdatePriorities(); - - /** - * From MCmFmManager - * See base class definition - */ - void UpdateRefIds(); - - /** - * From MCmFmManager - * See base class definition - */ - void DeleteMetadataL(); - - /** - * From MCmFmManager - * See base class definition - */ - void Close(); - -// From base class MCmFmFillRuleObserver - - /** - * From MCmFmFillRuleObserver - * See base class definition - */ - virtual void FillRuleProcessingStatus( TCmFmFillRuleProcessing aStatus ); - -// From base class MCmFmTransferObserver - - /** - * From MCmFmTransferObserver - * See base class definition - */ - virtual void TransferStatus( TCmFmTransferStatus aStatus, - TInt aSessionId, - TInt aInternalItemId, - TInt aError, - TInt64 aFSize ); - -// From base class MCmFmUPnPActionObserver - - /** - * From MCmFmUPnPActionObserver - * See base class definition - */ - virtual void URICheckResult( TCmFmUriCheckResult aStatus, - const CUpnpItem* aItem = NULL, const CUpnpElement* aRes = NULL ); - -// From base class MCmFmItemHandlerObserver - - /** - * From MCmFmItemHandlerObserver - * See base class definition - */ - virtual void DuplicateL( const TBool aDuplicate ); - -// From base class MCmMmObserver - - /** - * From MCmMmObserver - * See base class definition - */ - virtual void DeleteCompleteL( TInt aErr ); - - /** - * From MCmMmObserver - * See base class definition - */ - virtual void ShrinkCompleteL( TInt aErr ); - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - - /** - * From CActive - * See base class definition - */ - TInt RunError( TInt aError ); - -private: - - /** - * Sets mmc quota to fill list manager - * - * @since S60 5.1 - * @param None - * @return None - */ - void SetMmcQuotaL(); - - /** - * Handles mmc id ok state - * - * @since S60 5.1 - * @param None - * @return None - */ - void HandleIfMmcOkL(); - - /** - * Handles if files need to be deleted - * - * @since S60 5.1 - * @param None - * @return None - */ - void HandleIfDeleteFilesL(); - - /** - * Completes request - * - * @since S60 5.1 - * @param aStatus, completing status - * @return None - */ - void CompleteRequest( TCmFmStatus aStatus ); - - /** - * Completes request and incerements iIndex - * - * @since S60 5.1 - * @param aStatus, completing status - * @return None - */ - void ProceedWithNextItem( TCmFmStatus aStatus ); - - /** - * Do uri check if needed - * - * @since S60 5.1 - * @param None - * @return None - */ - void DoUriCheckL(); - - /** - * Parses full path from the Uri and upnp class - * - * @since S60 5.1 - * @param None - * @return Error code - */ - TInt ParseFullPathL(); - - /** - * Parses file name from the Uri - * - * @since S60 5.1 - * @param None - * @return Error code - */ - TInt ParseFileNameL(); - - /** - * Sets uri to current item - * - * @since S60 5.1 - * @param None - * @return None - */ - void SetUriL(); - - /** - * Logs media server Uuids - * - * @since S60 5.1 - * @param None - * @return None - */ - void LogServers(); - - /** - * Reset metadata item infos - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetItemInfo(); - - /** - * Publishes progress info - * - * @since S60 5.1 - * @param aProgress, progress - * @return None - */ - void SendProgressInfo( TInt aProgress ); - - /** - * Sets status to ECmFilled for every reference file - * - * @since S60 5.1 - * @param aInternalItemId, item id - * @return None - */ - void SetStatusL( const TInt64 aInternalItemId ); - - /** - * Removes illegal chars from the file name - * - * @since S60 5.1 - * @param aFileName, file name - * @return modified file name - */ - HBufC* RemoveIllegalFilenameCharactersL( const TDesC& aFileName ); - - /** - * Replaces defined chars - * - * @since S60 5.1 - * @param aString, file name string - * @param aTrg, char to be changed - * @param aReplacement, replacement char - * @return None - */ - void ReplaceCharsL( TDes& aString, const TDesC& aTrg, - const TDesC& aReplacement ); - - /** - * Loads selected drives into iDrives array - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadDrivesL(); - - /** - * Updates selected drives into iDrives table - * - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateDrives(); - - /** - * Resolves root path of the fill drive - * - * @since S60 5.1 - * @param aDriveNumber, drive number - * @return Root path - */ - HBufC* ResolveAndAppendRootPathL( const TInt aDriveNumber ); - - /** - * Updates quota of used drive - * - * @since S60 5.1 - * @param aDriveNumber, drive number - * @param aQuota, new used quota - * @return None - */ - void UpdateDriveQuota( const TInt aDriveNumber, - const TInt64 aQuota ); - - /** - * Initializes quotas of all selected drives - * - * @since S60 5.1 - * @param None - * @return None - */ - void InitializeDriveQuotasL(); - - /** - * Initializes quotas of all selected drives - * - * @since S60 5.1 - * @param aDriveNumber, drive number - * @return used fill space per drive - */ - TInt64 GetUsedQuota( const TInt aDriveNumber ); - - - /** - * Creates RFile - * - * @since S60 5.1 - * @param aFilePath, file name and path - * @return error code - */ - TInt CreateRFile( const TDesC& aFilePath ); - - /** - * Resolves private path of cm server - * - * @since S60 5.1 - * @param None - * @return None - */ - void PrivatePathL( ); - - /** - * Replaces file with orginal file - * - * @since S60 5.1 - * @param aOriginal, orginal file name - * @return None - */ - void ReplaceFileL( const TDesC& aOriginal ); - - /** - * Returns index to iDevices device array - * - * @since S60 5.1 - * @param aUuid, identifier of the server - * @param aList, device list - * @return index to iDevices - */ - TInt CheckServerIndex( const TDesC8& aUuid, - const CUpnpAVDeviceList& aList ); - - /** - * Returns ETrue if one of needed servers is available - * - * @since S60 5.1 - * @param None - * @return ETrue if server available - */ - TBool NeededServerAvailableL( ); - - /** - * Reset item arrays - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetItems(); - - /** - * Reset delete queue array - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetDeleteQueue(); - - /** - * Adds file to delete queue - * - * @since S60 5.1 - * @param None - * @return None - */ - void AddFilesToDeleteQueueL(); - - /** - * Performs operations after items have been checked - * - * @since S60 5.1 - * @param None - * @return None - */ - void StopItemCheck(); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, service observer - * @param aMemManager, memory manager - * @pram aDBManager, database manager - */ - CCmFmMain( MCmServiceObserver* aObserver, CCmMmMain* aMemManager, - CCmDmMain* aDBManager ); - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aSession, mde session - * @param aDBManager, database manager - */ - void ConstructL( CMdESession& aSession, CCmDmMain* aDBManager ); - - -private: - - /** - * Fill manager observer - */ - MCmServiceObserver* iObserver; // Not owned - - /** - * Memory manager - */ - CCmMmMain* iMemManager; // Not owned - - /** - * Database manager - */ - CCmDmMain* iDbManager; // Not owned - - /** - * Upnp operation manager - */ - CCmFmUpnpMngr* iCmFmUpnpMngr; // Owned - - /** - * fill drive id manager - */ - CCmFmFillDriveMngr* iCmFmFillDriveMngr; // Owned - - /** - * Fill rule and filled data manager - */ - CCmFmFillRuleFilledDataMngr* iCmFmFillRuleFilledDataMngr; // Owned - - /** - * Item handler, checks if media item is already in phone - */ - CCmFmDuplicateDetector* iCmFmDuplicateDetector; // Owned - - /** - * Download proxy - */ - CCmFmDownloadProxy* iCmFmDownloadProxy; // Owned - - /** - * Mpx notifier - */ - CCmFmMpxNotifier* iCmFmMpxNotifier; // Owned - - /** - * Glx notifier - */ - CCmFmGlxNotifier* iCmFmGlxNotifier; // Owned - - /** - * AV Controller - */ - MUPnPAVController* iAvController; // Not owned - - /** - * Array of found devices - */ - CUpnpAVDeviceList* iDevices; // Owned - - /** - * Array of fill list items - */ - RPointerArray iItems; // Owned - - /** - * Array of to be deleted fill list items - */ - RPointerArray iToBeDeleted; // Owned - - /** - * Array of to be deleted fill file names and paths - */ - CDesCArray* iArray; // Owned - - /** - * File name and path to media file - */ - TFileName iFullPath; - - /** - * Fill progress info - */ - TCmProgressInfo iProgressInfo; - - /** - * Temporary uuid - */ - HBufC8* iUuid; // Owned - - /** - * Calculating fill transfer times - */ - TTime iFileFetchStart; - - /** - * Index of the current item - */ - TInt iIndex; - - /** - * Started service - */ - TCmService iService; - - /** - * Flag identifying if fill is on or not - */ - TBool iFetchingFile; - - /** - * File server session - */ - RFs iFsSession; - - /** - * Drive info table - */ - RPointerArray iDrives; - - /** - * Drive id of the fill drive - */ - TUint iDriveId; - - /** - * Drive number of the fill drive - */ - TInt iDriveNumber; - - /** - * Index to drive info array - */ - TInt iDriveIndex; - - /** - * File - */ - RFile iFile; - - /** - * Index of sent items - */ - TInt iTempIndex; - - }; - -#endif // C_CMFMMAIN_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmdeduplicatedetector.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmdeduplicatedetector.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +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: Handles duplicate detection for images and videos -* -*/ - - - -#ifndef __CMFMMDEDUPLICATEDETECTOR_H -#define __CMFMMDEDUPLICATEDETECTOR_H - -#include -#include - - -// Forward declarations -class CCmFillListItem; -class MCmFmItemHandlerObserver; -class CMdESession; -class CMdENamespaceDef; -class CMdEObjectDef; -class CMdEObjectQuery; -class CMdEPropertyDef; - -// Class declarations - -/** - * CCmFmMdEDuplicateDetector class - * Part of Fill manager. CCmFmMdEDuplicateDetector manages - * duplicate detection for images and videos - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmMdEDuplicateDetector ) : public CBase, - public MMdEQueryObserver - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @param aSession, mde session - * @return pointer to CCmFmMdEDuplicateDetector class - */ - static CCmFmMdEDuplicateDetector* NewL( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @param aSession, mde session - * @return pointer to CCmFmMdEDuplicateDetector class - */ - static CCmFmMdEDuplicateDetector* NewLC( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ); - - /** - * Destructor. - */ - virtual ~CCmFmMdEDuplicateDetector(); - -public: - - /** - * Check if file is duplicate. - * - * @since S60 5.1 - * @param aItem, item to be checked - * @return None - */ - void CheckImageOrVideoL( const CCmFillListItem& aItem ); - - /** - * Add to items array for duplicated check - * @param aItem, item to be append - * @return None - */ - void AppendToArrayL( const CCmFillListItem& aItem ); - - /** - * reset the duplicator check array - * @param None - * @return None - */ - void ResetArray(); - - -protected: - -// From base class MMdEQueryObserver - - /** - * From MMdEQueryObserver - * See base class definition - */ - void HandleQueryNewResults( CMdEQuery& aQuery, - TInt aFirstNewItemIndex, - TInt aNewItemCount ); - - /** - * From MMdEQueryObserver - * See base class definition - */ - void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); - -private: - - /** - * Set logic condition for image and video item query - * - * @since S60 5.1 - * @param aItem, item to be checked - * @return None - */ - void SetLogicConditionL( const CCmFillListItem& aItem ); - - /** - * Check if file is duplicate by compareing with array. - * @param aItem, item to be checked - * @return None - */ - void CheckImageOrVideoLIfDuplicated( const CCmFillListItem& aItem ); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, item handler observer - * @param aSession, mde session - */ - CCmFmMdEDuplicateDetector( MCmFmItemHandlerObserver& aObserver, - CMdESession& aSession ); - - /** - * Performs the second phase construction. - */ - void ConstructL( ); - - -private: - - /** - * Observer class - */ - MCmFmItemHandlerObserver& iObserver; - - /** - * MdE session - */ - CMdESession& iSession; - - /** - * mde namespace - */ - CMdENamespaceDef* iNamespace; // owned - - /** - * Object definition ( Image/Video ) - */ - CMdEObjectDef* iObjectDef; // owned - - /** - * Object definition ( Image/Video ) - */ - CMdEObjectDef* iMediaTypeDef; // owned - - /** - * Object query - */ - CMdEObjectQuery* iQuery; // owned - - /** - * Queried property - */ - CMdEPropertyDef* iTitle; // owned - - /** - * Queried property - */ - CMdEPropertyDef* iSize; // owned - - /** - * Queried property - */ - CMdEPropertyDef* iDate; // owned - - /** - * Item to be checked - */ - CCmFillListItem* iCheckItem; - - /** - * Array of fill list items - */ - RPointerArray iExistFiles; // Owned - - /** - * current download media type - */ - TCmMediaType iCurrentMediaType; - - }; - -#endif // __CMFMMDEDUPLICATEDETECTOR_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxduplicatedetector.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxduplicatedetector.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +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: Handles duplicate detection for music -* -*/ - - - -#ifndef __CMFMMPXDUPLICATEDETECTOR_H -#define __CMFMMPXDUPLICATEDETECTOR_H - -#include -#include - - -// Forward declarations -class MMPXCollectionUtility; - -// Class declarations - -/** - * CCmFmMpxDuplicateDetector class - * Part of Fill manager. CCmFmMpxDuplicateDetector manages - * duplicate detection - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmMpxDuplicateDetector ) : public CBase, - public MMPXCollectionObserver, - public MMPXCollectionFindObserver - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @return pointer to CCmFmMpxDuplicateDetector class - */ - static CCmFmMpxDuplicateDetector* NewL( - MCmFmItemHandlerObserver& aObserver ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @return pointer to CCmFmMpxDuplicateDetector class - */ - static CCmFmMpxDuplicateDetector* NewLC( - MCmFmItemHandlerObserver& aObserver ); - - /** - * Destructor. - */ - virtual ~CCmFmMpxDuplicateDetector(); - -public: - - /** - * Check if file is duplicate. - * - * @since S60 5.1 - * @param aItem, item to be checked - * @return None - */ - void CheckMusicL( const CCmFillListItem& aItem ); - - /** - * Opens connection to collection plugin - * - * @since S60 5.1 - * @param None - * @return None - */ - void OpenCollectionPluginL(); - - /** - * Closes connection to collection plugin - * - * @since S60 5.1 - * @param None - * @return None - */ - void CloseCollectionPlugin(); - -protected: - -// From base class MMPXCollectionObserver - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleCollectionMediaL(const CMPXMedia& aMedia, TInt aError); - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr ); - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleOpenL( const CMPXMedia& aEntries, - TInt aIndex,TBool aComplete,TInt aError ); - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError); - -// From base class MMPXCollectionFindObserver - - /** - * From MMPXCollectionFindObserver - * See base class definition - */ - void HandleFindAllL(const CMPXMedia& aResults, - TBool aComplete, TInt aError); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmFmMpxDuplicateDetector( MCmFmItemHandlerObserver& aObserver ); - - /** - * Performs the second phase construction. - */ - void ConstructL( ); - - -private: // data - - /** - * Observer class - */ - MCmFmItemHandlerObserver& iObserver; - - /** - * Collection utility of MPX framework - */ - MMPXCollectionUtility* iCollectionUtility; // owned - - /** - * Duplicate or not - */ - TBool iDuplicate; - - }; - -#endif // __CMFMMPXDUPLICATEDETECTOR_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxnotifier.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmpxnotifier.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +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: Mpx nofifier class -* -*/ - - - -#ifndef __CMFMMPXNOTIFIER_H -#define __CMFMMPXNOTIFIER_H - -#include -#include "mpxmediatorobserver.h" // base class -#include "mpxcollectionobserver.h" // base class - -// Forward declarations -class MMPXHarvesterUtility; -class MMPXCollectionUtility; -class CMPXCollectionMediator; - -/** - * CCmFmMpxNotifier class - * Part of Fill manager. - * Mpx nofifier class - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmFmMpxNotifier ): public CBase, - public MMPXMediatorObserver, - public MMPXCollectionObserver - { - -public: - - /** - * Two-phased constructor. - */ - static CCmFmMpxNotifier* NewL( ); - - /** - * Two-phased constructor. - */ - static CCmFmMpxNotifier* NewLC( ); - - /** - * Destructor. - */ - virtual ~CCmFmMpxNotifier(); - -public: - - /** - * Notifying Mpx about new music files - * - * @since S60 5.1 - * @param aTrackPath, path to track - * @param aTrackMetadata, metadata to be added in mpx db - * @return None - */ - void NotifyMpxL( const TDesC& aTrackPath, - const CUpnpItem& aTrackMetadata ); - -protected: - -// From base class MMPXMediatorObserver - - /** - * From MMPXMediatorObserver - * See base class definition - */ - void HandleMediatorPathUpdatedL( - CMPXMedia*& /*aMedia*/, TUid /*aOldPath*/ ) {} - -// From base class MMPXCollectionObserver - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleCollectionMediaL( - const CMPXMedia& /*aMedia*/, TInt /*aError*/) {} - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleCollectionMessageL( - const TMPXCollectionMessage& /*aMessage*/ ) {} - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleCollectionMessageL( - const CMPXMessage& /*aMsg*/ ) {} - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleOpenL( - const CMPXMedia& /*aEntries*/, - TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ ) {} - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleOpenL( - const CMPXCollectionPlaylist& /*aPlaylist*/, - TInt /*aError*/ ) {} - - /** - * From MMPXCollectionObserver - * See base class definition - */ - void HandleCommandComplete( - CMPXCommand* /*aCommandResult*/, TInt /*aError*/) {} - -private: - - /** - * Finds an element within CUpnpItem - * returns the element value converted to unicode - * - * Since S60 5.1 - * @param aSource the source CUpnpItem - * @param aSourceField the element name within source - * @return the vield value, or 0 if element not found. - */ - HBufC16* GetElementL( const CUpnpItem& aSource, - const TDesC8& aSourceField ) const; - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmFmMpxNotifier( ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: // data - - /** - * MPX harvester utility - */ - MMPXHarvesterUtility* iHarvester; // Owned - - /** - * MPX collection utility - */ - MMPXCollectionUtility* iCollectionUtil; // Owned - - /** - * MPX collection mediator - */ - CMPXCollectionMediator* iMediator; // Owned - - }; - -#endif // __CMFMMPXNOTIFIER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmtransferobserver.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmtransferobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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: Callback interface to Fill manager -* -*/ - - - -#ifndef M_CMFMTRANSFEROBSERVER_H -#define M_CMFMTRANSFEROBSERVER_H - -#include "cmfmcommon.h" - -/** - * Download observer - * Callback interface class used to notify Fill Manager - * about status changes in Fill Manager - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( MCmFmTransferObserver ) - { - -public: - - /** - * Status notify to Fill Manager - * - * @since S60 5.1 - * @param aStatus - * @param aSessionId - * @param aInternalItemId - * @param aError - * @param aFileSize - * @return None - */ - virtual void TransferStatus( TCmFmTransferStatus aStatus, TInt aSessionId, - TInt aInternalItemId, TInt aError, TInt64 aFSize ) = 0; - - }; - - -#endif // M_CMFMTRANSFEROBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpactionobserver.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpactionobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +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: Callback interface -* -*/ - - - -#ifndef M_CMFMUPNPACTIONOBSERVER_H -#define M_CMFMUPNPACTIONOBSERVER_H - -#include "cmfmcommon.h" - -// Forward declarations -class CUpnpItem; -class CUpnpElement; - -/** - * UPnP action observer - * Callback interface class used to notify CCmFmMain class - * about status changes in Upnp actions - * - * @lib cmfillmanager.lib - * - * @since S60 5.1 - */ -class MCmFmUPnPActionObserver - { - -public: - - /** - * Upnp action notify about Browse results - * - * @since S60 5.1 - * @param aStatus, uri check result - * @param aItem, item to be filled - * @param aRes, resource of item item - * @return None - */ - virtual void URICheckResult( TCmFmUriCheckResult aStatus, - const CUpnpItem* aItem = NULL, const CUpnpElement* aRes = NULL ) = 0; - - - }; - -#endif // M_CMFMUPNPACTIONOBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpmngr.h --- a/homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmupnpmngr.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,331 +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: Manages Upnp actions needed by Fill Manager -* -*/ - - - -#ifndef __CMFMUPNPMNGR_H -#define __CMFMUPNPMNGR_H - -#include -#include "upnpavbrowsingsessionobserver.h" -#include "upnpavdeviceobserver.h" - -// Forward declarations -class CUPnPXMLParser; -class CCmFillListItem; -class MCmFmUPnPActionObserver; - -// CLASS DECLARATION - /** - * Class represents methods to communication with AV Controller API. - * - * @lib cmfillmanager.lib - * - * @since S60 v3.1 - */ -NONSHARABLE_CLASS( CCmFmUpnpMngr ): public CBase, - public MUPnPAVBrowsingSessionObserver, - public MUPnPAVDeviceObserver - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, action observer - * @return pointer to CCmFmUpnpMngr class - */ - static CCmFmUpnpMngr* NewL( MCmFmUPnPActionObserver* aObserver ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, action observer - * @return pointer to CCmFmUpnpMngr class - */ - static CCmFmUpnpMngr* NewLC( MCmFmUPnPActionObserver* aObserver ); - - /** - * Destructor. - */ - virtual ~CCmFmUpnpMngr(); - -public: - - /** - * Sets av controller - * - * @since S60 5.1 - * @param aAVController, pointer to av controller - * @return None - */ - void SetAvController( MUPnPAVController* aAVController ); - - /** - * Lists media servers - * - * @since S60 5.1 - * @param aDevices, device list - * @return None - */ - void GetMediaServersL( CUpnpAVDeviceList*& aDevices ); - - /** - * Checks uri - * - * @since S60 5.1 - * @param aDevice, upnp device - * @param aItem, fill list item to be checked - * @return None - */ - void CheckURIL( CUpnpAVDevice* aDevice, CCmFillListItem& aItem ); - - /** - * Cancel UPnP operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - - /** - * Returns browsed uri - * - * @since S60 5.1 - * @param None - * @return uri - */ - TDesC8& Uri() const; - - /** - * Returns browsed upnp item - * - * @since S60 5.1 - * @param None - * @return upnp item - */ - CUpnpItem& UpnpItem() const; - -protected: - -// From base class MUPnPAVBrowsingSessionObserver - - /** - * From MUPnPAVBrowsingSessionObserver - * See base class definition - */ - virtual void BrowseResponse( const TDesC8& aBrowseResponse, - TInt aError, - TInt aMatches, - TInt aTotalCount, - const TDesC8& aUpdateId ); - - /** - * From MUPnPAVBrowsingSessionObserver - * See base class definition - */ - virtual void SearchResponse( const TDesC8& aSearchResponse, - TInt aError, - TInt aMatches, - TInt aTotalCount, - const TDesC8& aUpdateId ); - - /** - * From MUPnPAVBrowsingSessionObserver - * See base class definition - */ - virtual void SearchCapabilitiesResponse( - TInt aStatus, - const TDesC8& aSearchCapabilities ); - - /** - * From MUPnPAVBrowsingSessionObserver - * See base class definition - */ - virtual void CreateContainerResponse( TInt aError, - const TDesC8& aObjectId ); - - /** - * From MUPnPAVBrowsingSessionObserver - * See base class definition - */ - virtual void DeleteObjectResponse( TInt aStatus ); - - /** - * From MUPnPAVBrowsingSessionObserver - * See base class definition - */ - virtual void MediaServerDisappeared( - TUPnPDeviceDisconnectedReason aReason ); - - /** - * From MUPnPAVBrowsingSessionObserver - * See base class definition - */ - virtual void ReserveLocalMSServicesCompleted( TInt aStatus ); - -//public: -// From base class MCmAVDeviceObserver - - /** - * From MCmAVDeviceObserver - * See base class definition - */ - void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice); - - /** - * From MCmAVDeviceObserver - * See base class definition - */ - void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice); - - /** - * From MCmAVDeviceObserver - * See base class definition - */ - void WLANConnectionLost(); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, UPnP action observer - */ - CCmFmUpnpMngr( MCmFmUPnPActionObserver* aObserver ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Parser all resolution which object owns - * - * @since S60 5.1 - * @param aResElementsArray, resource array - * @return Optimal resource element - */ - const CUpnpElement& ParseImageResolutions( - RUPnPElementsArray& aResElementsArray ); - - /** - * Initializes screen size member variable - * - * @since S60 5.1 - * @param None - * @return None - */ - void ScreenSizeL(); - - /** - * Returns processed browse results received from a Media Server. - * - * UPnPAVController releases the memory allocated for - * aResultArray after calling the callback method. - * - * @since S60 5.1 - * @param aStatus TInt status information - * @param aTotalCount TInt total number of objects - * @param aResultArray browse result array - * @return None - */ - void BrowseResponseL( TInt aStatus, - TInt aTotalCount, - const TDesC8& aResultArray ); - - /** - * Returns processed search results received from a Media Server. - * - * UPnPAVController releases the memory allocated for - * aResultArray after calling the callback method. - * - * @since S60 5.1 - * @param aStatus TInt status information - * @param aTotalCount TInt total number of objects - * @param aResultArray RPointerArray of CUPnPObject objects - * @return None - */ - void SearchResponse( TInt aStatus, - TInt aTotalCount, - const RPointerArray& aResultArray ); - -private: - - /** - * Pointer to AV Controller - */ - MUPnPAVController* iAVController; // not owned - - /** - * Browse action Observer - */ - MCmFmUPnPActionObserver* iObserver; // not owned - - /** - * Browse response parser - */ - CUPnPXMLParser* iParser; // owned - - /** - * CUpnpAVDevice - */ - CUpnpAVDevice* iDevice; // Not owned - - /** - * URI - */ - HBufC8* iURI; // owned - - /** - * upnp item - */ - CUpnpItem* iItem; // owned - - /** - * Browse started - */ - TTime iBrowseStarted; - - /** - * Browse finished - */ - TTime iBrowseFinished; - - /** - * Browse session - */ - MUPnPAVBrowsingSession* iBrowseSession; // Not owned - - /** - * If true select optimal image size to be filled - */ - TBool iSelectOptimalImageSize; - - /** - * Screen size of the device - */ - TSize iScreenSize; - - }; - -#endif // __CMFMUPNPMNGR_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfillmanagerfactory.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfillmanagerfactory.cpp Mon Nov 01 13:44:24 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: The factory for Fill manager -* -*/ - - -#include "cmfillmanagerfactory.h" -#include "cmfillmanager.h" -#include "cmfmmain.h" - - -// -------------------------------------------------------------------------- -// CmFillManagerFactory::NewFillManagerL -// -------------------------------------------------------------------------- -// -EXPORT_C MCmFmManager* CmFillManagerFactory::NewFillManagerL( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ) - { - return CCmFmMain::NewL( aObserver, aSession, aDBManager, aMemManager ); - } - -// -------------------------------------------------------------------------- -// CmFillManagerFactory::NewFillManagerLC -// -------------------------------------------------------------------------- -// -EXPORT_C MCmFmManager* CmFillManagerFactory::NewFillManagerLC( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ) - { - return CCmFmMain::NewLC( aObserver, aSession, aDBManager, aMemManager ); - } - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmao.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2007 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: Fill rule and filled data processing Active object -* -*/ - - -#include "cmfmfillrulefilleddatamngr.h" -#include "cmfmao.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmFmAo::NewL -// --------------------------------------------------------------------------- -// -CCmFmAo* CCmFmAo::NewL( CCmFmFillRuleFilledDataMngr& aMngr ) - { - LOG(_L("[FILL MNGR]\t CCmFmAo::NewL() start")); - CCmFmAo* self = CCmFmAo::NewLC( aMngr ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmAo::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmAo::NewLC -// --------------------------------------------------------------------------- -// -CCmFmAo* CCmFmAo::NewLC( CCmFmFillRuleFilledDataMngr& aMngr ) - { - LOG(_L("[FILL MNGR]\t CCmFmAo::NewLC() start")); - CCmFmAo* self = new ( ELeave ) CCmFmAo( aMngr ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[FILL MNGR]\t CCmFmAo::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmAo::~CCmFmAo -// --------------------------------------------------------------------------- -// -CCmFmAo::~CCmFmAo() - { - LOG(_L("[FILL MNGR]\t CCmFmAo::~CCmFmAo() start")); - Cancel(); - LOG(_L("[FILL MNGR]\t CCmFmAo::~CCmFmAo() end")); - } - -// --------------------------------------------------------------------------- -// CCmFmAo::CCmFmAo -// --------------------------------------------------------------------------- -// -CCmFmAo::CCmFmAo( CCmFmFillRuleFilledDataMngr& aMngr ) - :CActive( EPriorityStandard ), iMngr( aMngr ), iIdle( ETrue ) - { - LOG(_L("[FILL MNGR]\t CCmFmAo::CCmFmAo()")); - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CCmFmAo::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmAo::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmAo::ConstructL()")); - } - -// --------------------------------------------------------------------------- -// CCmFmAo::RunL -// --------------------------------------------------------------------------- -// -void CCmFmAo::RunL() - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmAo::RunL status %d"),iStatus.Int() )); - if ( iIdle ) - { - LOG(_L("[FILL MNGR]\t CCmFmAo::RunL iIdle == ETrue ")); - SetActive(); - iIdle = EFalse; - } - else - { - LOG(_L("[FILL MNGR]\t CCmFmAo::RunL iIdle == EFalse ")); - iMngr.OperationCompletedL( iStatus.Int() ); - iIdle = ETrue; - } - } - -// --------------------------------------------------------------------------- -// CCmFmAo::DoCancel -// --------------------------------------------------------------------------- -// -void CCmFmAo::DoCancel() - { - LOG(_L("[FILL MNGR]\t CCmFmAo::DoCancel")); - } - -// --------------------------------------------------------------------------- -// CCmFmAo::RunError( TInt aError ) -// --------------------------------------------------------------------------- -// -TInt CCmFmAo::RunError( TInt aError ) - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmAo::RunError %d"), aError )); - return aError; - } - -// End of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadmngr.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadmngr.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +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: Download manager class, handles file download events -* -*/ - - -#include "upnpavcontroller.h" -#include "upnpfiledownloadsession.h" -#include "cmfmtransferobserver.h" -#include "cmfmdownloadmngr.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::NewL -// --------------------------------------------------------------------------- -// -CCmFmDownloadMngr* CCmFmDownloadMngr::NewL( MUPnPAVController* aAVController, - MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice, - const TInt aDownloadId ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewL() start")); - CCmFmDownloadMngr* self = CCmFmDownloadMngr::NewLC( aAVController, - aObserver, aDevice, aDownloadId ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::NewLC -// --------------------------------------------------------------------------- -// -CCmFmDownloadMngr* CCmFmDownloadMngr::NewLC( MUPnPAVController* aAVController, - MCmFmTransferObserver* aObserver, const CUpnpAVDevice& aDevice, - const TInt aDownloadId ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewLC() start")); - CCmFmDownloadMngr* self = - new ( ELeave ) CCmFmDownloadMngr( aAVController, - aObserver, aDownloadId ); - CleanupStack::PushL( self ); - self->ConstructL( aDevice ); - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::~CCmFmDownloadMngr -// --------------------------------------------------------------------------- -// -CCmFmDownloadMngr::~CCmFmDownloadMngr() - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::~CCmFmDownloadMngr()")); - CancelOperation(); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::CCmFmDownloadMngr -// --------------------------------------------------------------------------- -// -CCmFmDownloadMngr::CCmFmDownloadMngr( MUPnPAVController* aAVController, - MCmFmTransferObserver* aObserver, const TInt aDownloadId ) - : iAVController( aAVController ), iObserver( aObserver ), - iDownloadId( aDownloadId ) - - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::CCmFmDownloadMngr()")); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmDownloadMngr::ConstructL( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::ConstructL()")); - - iDownloadSession = &( iAVController-> - StartDownloadSessionL( aDevice ) ); - iDownloadSession->SetObserver( *this ); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::FetchFileL -// --------------------------------------------------------------------------- -// -void CCmFmDownloadMngr::FetchFileL( const CUpnpElement& aResElement, - const CUpnpItem& aItem, RFile& aFile, const TInt64 aInternalItemId ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::FetchFileL()")); - - iDownloadSession->StartDownloadL( aResElement, aItem, - aFile, aInternalItemId ); - iDownloadSession->StartTrackingProgressL( aInternalItemId ); - iFileSize = 0; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmFmDownloadMngr::CancelOperation() - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::CancelOperation() start")); - if( iAVController ) - { - if( iDownloadSession ) - { - iAVController->StopDownloadSession( *iDownloadSession ); - } - } - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::CancelOperation() end")); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::TransferStarted -// --------------------------------------------------------------------------- -// -void CCmFmDownloadMngr::TransferStarted( TInt aKey, TInt aStatus ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::TransferStarted()")); - iObserver->TransferStatus( ECmFmFileFetchStarted, iDownloadId, aKey, - aStatus, iFileSize ); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::TransferCompleted -// --------------------------------------------------------------------------- -// -void CCmFmDownloadMngr::TransferCompleted( TInt aKey, TInt aStatus, - const TDesC& /*aFilePath*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadMngr::TransferCompleted()")); - iObserver->TransferStatus( ECmFmFileFetched, iDownloadId, aKey, aStatus, - iFileSize ); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::TransferProgress -// --------------------------------------------------------------------------- -// -void CCmFmDownloadMngr::TransferProgress( TInt /*aKey*/, TInt aBytes, - TInt /*aTotalBytes*/ ) - { - TRACE(Print(_L("[FILL MNGR]\t aBytes= %d"), aBytes )); - - // Get the transferred bytes - iFileSize = ( aBytes / KKilo ); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadMngr::MediaServerDisappeared -// --------------------------------------------------------------------------- -// -void CCmFmDownloadMngr::MediaServerDisappeared( - TUPnPDeviceDisconnectedReason /*aReason*/ ) - { - TRACE(Print(_L("[FILL MNGR]\t MediaServerDisappeared = %d"), iDownloadId )); - iObserver->TransferStatus( ECmFmFileFetched, iDownloadId, KErrNone, - KErrDisconnected, KErrNone ); - } - -// End of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadproxy.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmdownloadproxy.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* Copyright (c) 2007 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: Proxy class to handle multiple download sessions -* -*/ - - -#include "upnpavcontroller.h" -#include "upnpavdevicelist.h" -#include "upnpitem.h" -#include "cmfmdownloadmngr.h" -#include "cmfmdownloadproxy.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::NewL -// --------------------------------------------------------------------------- -// -CCmFmDownloadProxy* CCmFmDownloadProxy::NewL( ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewL() start")); - CCmFmDownloadProxy* self = CCmFmDownloadProxy::NewLC( ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::NewLC -// --------------------------------------------------------------------------- -// -CCmFmDownloadProxy* CCmFmDownloadProxy::NewLC( ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewLC() start")); - CCmFmDownloadProxy* self = - new ( ELeave ) CCmFmDownloadProxy( ); - CleanupStack::PushL( self ); - self->ConstructL( ); - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::~CCmFmDownloadProxy -// --------------------------------------------------------------------------- -// -CCmFmDownloadProxy::~CCmFmDownloadProxy() - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::~CCmFmDownloadProxy()")); - CancelOperation(); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::CCmFmDownloadProxy -// --------------------------------------------------------------------------- -// -CCmFmDownloadProxy::CCmFmDownloadProxy( ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CCmFmDownloadProxy()")); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmDownloadProxy::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::ConstructL()")); - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::FetchFileL -// --------------------------------------------------------------------------- -// -void CCmFmDownloadProxy::FetchFileL( MCmFmTransferObserver* aObserver, - MUPnPAVController* aAVController, CUpnpAVDeviceList* aDevices, - const CUpnpElement& aResElement, const CUpnpItem& aItem, RFile& aFile, - const TInt aInternalDeviceIndex, const TInt64 aInternalItemId ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::FetchFileL()")); - - // Starts download session if no session for defined device exists yet - TInt index = StartNewDownloadSessionIfNeededL( aObserver, - aAVController, - aDevices, - aInternalDeviceIndex ); - - if( index > KErrNotFound && index < iDownloadSessions.Count() ) - { - TRACE(Print(_L("[FILL MNGR]\t FetchFileL index = %d"), index )); - iDownloadSessions[ index ]-> - FetchFileL( aResElement, aItem, aFile, aInternalItemId ); - } - else - { - User::Leave( KErrNotFound ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::CloseDownloadSession -// --------------------------------------------------------------------------- -// -TBool CCmFmDownloadProxy::CloseDownloadSession( const TInt aSessionId ) - { - TRACE(Print(_L("[FILL MNGR]\t CloseDownloadSession = %d"), aSessionId )); - TBool sessionsLeft( EFalse ); - - if( KErrNotFound < aSessionId && - aSessionId < iDownloadSessions.Count() && - iDownloadSessions[ aSessionId ] ) - { - // Delete defined download session - delete iDownloadSessions[ aSessionId ]; - iDownloadSessions[ aSessionId ] = NULL; - iDownloadSessionCount--; - TInt temp( KErrNotFound ); - for( TInt i = 0; i < iSessionIndexes.Count(); i++ ) - { - if( iSessionIndexes[i].iSessionIndex == aSessionId ) - { - temp = i; - } - } - - if( temp != KErrNotFound ) - { - iSessionIndexes.Remove( temp ); - } - } - - if( iDownloadSessionCount ) - { - sessionsLeft = ETrue; - } - else - { - LOG(_L("[FILL MNGR]\t No sessions left!")); - } - - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CloseDownloadSession() end")); - return sessionsLeft; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmFmDownloadProxy::CancelOperation() - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CancelOperation()")); - iDownloadSessions.ResetAndDestroy(); - iSessionIndexes.Reset(); - iSessionIndexes.Close(); - iDownloadSessionCount = 0; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::StartNewDownloadSessionIfNeededL -// --------------------------------------------------------------------------- -// -TInt CCmFmDownloadProxy::StartNewDownloadSessionIfNeededL( - MCmFmTransferObserver* aObserver, MUPnPAVController* aAVController, - CUpnpAVDeviceList* aDevices, const TInt aInternalDeviceIndex ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::\ - StartNewDownloadSessionIfNeededL()")); - - TBool newServer( ETrue ); - TInt sessionIndex( KErrNotFound ); - for( TInt i = 0; i < iSessionIndexes.Count(); i++ ) - { - if( iSessionIndexes[i].iDeviceIndex == aInternalDeviceIndex ) - { - TRACE(Print(_L("[FILL MNGR]\t old server sessionIndex = %d"), - i )); - newServer = EFalse; - sessionIndex = i; - // Index found => end loop - i = iSessionIndexes.Count(); - } - } - - if( newServer ) - { - TRACE(Print(_L("[FILL MNGR]\t New server found"))); - - CreateNewSessionL( aObserver, aAVController, aDevices, - iDownloadSessionCount, sessionIndex ); - } - TRACE(Print(_L("[FILL MNGR]\t started sessionIndex = %d"), sessionIndex )); - - return sessionIndex; - } - -// --------------------------------------------------------------------------- -// CCmFmDownloadProxy::CreateNewSessionL -// --------------------------------------------------------------------------- -// -void CCmFmDownloadProxy::CreateNewSessionL( - MCmFmTransferObserver* aObserver, MUPnPAVController* aAVController, - CUpnpAVDeviceList* aDevices, TInt aSessionCount, TInt& aSessionIndex ) - { - LOG(_L("[FILL MNGR]\t CCmFmDownloadProxy::CreateNewSessionL()")); - - CCmFmDownloadMngr* mngr = CCmFmDownloadMngr::NewL( aAVController, aObserver, - *(*aDevices)[aSessionCount], aSessionCount ); - CleanupStack::PushL( mngr ); - iDownloadSessions.AppendL( mngr ); - CleanupStack::Pop( mngr ); - iDownloadSessionCount++; - TCmFmDownloadSessionIndexes index; - index.iDeviceIndex = aSessionCount; - index.iSessionIndex = ( iDownloadSessions.Count() - 1 ); - iSessionIndexes.AppendL( index ); - aSessionIndex = index.iSessionIndex; - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmduplicatedetector.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmduplicatedetector.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +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: Duplicate detector -* -*/ - - -#include "cmfilllistitem.h" -#include "cmfmmdeduplicatedetector.h" -#include "cmfmmpxduplicatedetector.h" -#include "cmfmduplicatedetector.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::NewL -// --------------------------------------------------------------------------- -// -CCmFmDuplicateDetector* CCmFmDuplicateDetector::NewL( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ) - { - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewL() start")); - CCmFmDuplicateDetector* self = - CCmFmDuplicateDetector::NewLC( aObserver, aSession ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::NewLC -// --------------------------------------------------------------------------- -// -CCmFmDuplicateDetector* CCmFmDuplicateDetector::NewLC( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ) - { - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewLC() start")); - CCmFmDuplicateDetector* self = - new ( ELeave ) CCmFmDuplicateDetector( ); - CleanupStack::PushL( self ); - self->ConstructL( aObserver, aSession ); - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::~CCmFmDuplicateDetector -// --------------------------------------------------------------------------- -// -CCmFmDuplicateDetector::~CCmFmDuplicateDetector() - { - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::\ - ~CCmFmDuplicateDetector()")); - delete iCmFmMdEDuplicateDetector; - delete iCmFmMpxDuplicateDetector; - } - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::CCmFmDuplicateDetector -// --------------------------------------------------------------------------- -// -CCmFmDuplicateDetector::CCmFmDuplicateDetector( ) - { - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::\ - CCmFmDuplicateDetector()")); - } - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmDuplicateDetector::ConstructL( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ) - { - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::ConstructL()")); - - iCmFmMdEDuplicateDetector = - CCmFmMdEDuplicateDetector::NewL( aObserver, aSession ); - - iCmFmMpxDuplicateDetector = - CCmFmMpxDuplicateDetector::NewL( aObserver ); - } - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::CheckItemL -// --------------------------------------------------------------------------- -// -void CCmFmDuplicateDetector::CheckItemL( const CCmFillListItem& aItem ) - { - LOG(_L("[FILL MNGR]\t CCmFmDuplicateDetector::CheckItemL()")); - - if( aItem.MediaType() == ECmAudio ) - { - iCmFmMpxDuplicateDetector->CheckMusicL( aItem ); - } - else - { - iCmFmMdEDuplicateDetector->CheckImageOrVideoL( aItem ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::AppendToArrayL -// --------------------------------------------------------------------------- -// -void CCmFmDuplicateDetector::AppendToArrayL( const CCmFillListItem& aItem ) - { - if( aItem.MediaType() != ECmAudio ) - { - iCmFmMdEDuplicateDetector->AppendToArrayL( aItem ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmDuplicateDetector::ResetArray -// --------------------------------------------------------------------------- -// -void CCmFmDuplicateDetector::ResetArray() - { - iCmFmMdEDuplicateDetector->ResetArray(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfilldrivemngr.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfilldrivemngr.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +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: Fill drive handling -* -*/ - - -#include -#include "cmcommon.h" -#include "cmdriveinfo.h" -#include "cmfmfilldrivemngr.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::NewL -// --------------------------------------------------------------------------- -// -CCmFmFillDriveMngr* CCmFmFillDriveMngr::NewL( RFs& aFs, - RPointerArray& aDrives ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewL() start")); - CCmFmFillDriveMngr* self = CCmFmFillDriveMngr::NewLC( aFs, aDrives ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::NewLC -// --------------------------------------------------------------------------- -// -CCmFmFillDriveMngr* CCmFmFillDriveMngr::NewLC( RFs& aFs, - RPointerArray& aDrives ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewLC() start")); - CCmFmFillDriveMngr* self = new ( ELeave ) CCmFmFillDriveMngr( aFs, aDrives ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::~CCmFmFillDriveMngr -// --------------------------------------------------------------------------- -// -CCmFmFillDriveMngr::~CCmFmFillDriveMngr() - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::~CCmFmFillDriveMngr()")); - } - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::CCmFmFillDriveMngr -// --------------------------------------------------------------------------- -// -CCmFmFillDriveMngr::CCmFmFillDriveMngr( RFs& aFs, - RPointerArray& aDrives ) - : iFsSession( aFs ), iDrives( aDrives ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CCmFmFillDriveMngr()")); - } - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmFillDriveMngr::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::ConstructL()")); - } - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::CheckDriveId -// --------------------------------------------------------------------------- -// -TCmFmStatus CCmFmFillDriveMngr::CheckDriveId() - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CheckDriveId()")); - - TCmFmStatus status(ECmFmMMCCheckFailed); - TVolumeInfo volInfo; - for( TInt i = iDrives.Count() - 1; i >= 0; i-- ) - { - DoMountFileSystem( iFsSession, volInfo, iDrives[i]->DriveNumber() ); - if( volInfo.iUniqueID != iDrives[i]->DriveId() ) - { - delete iDrives[i]; - iDrives.Remove(i); - } - } - if( iDrives.Count() ) - { - status = ECmFmMMCOk; - } - - return status; - } - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::CheckFreeDiscSpace -// --------------------------------------------------------------------------- -// -TInt CCmFmFillDriveMngr::CheckFreeDiscSpace( TUint32 aFileSize, - TUint& aDriveId, - TInt& aDriveNumber ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CheckFreeDiscSpace()")); - - aDriveNumber = KErrNotFound; - TInt64 totalSize( 0 ); - TInt64 quota( 0 ); - TInt driveIndex( 0 ); - - for( TInt i = 0; i < iDrives.Count(); i++ ) - { - totalSize = iDrives[i]->UsedDriveQuota() + aFileSize; - quota = iDrives[i]->DriveQuota(); - TRACE(Print(_L("[FILL MNGR]\t CCmFmFillDriveMngr Quota = \ - : %ld"), quota )); - if( totalSize >= quota ) - { - TRACE(Print(_L("[FILL MNGR]\t QUOTA FULL drive number = %d"), - iDrives[i]->DriveNumber())); - } - else - { - TInt error( KErrNone ); - TVolumeInfo volInfo; - TInt64 freespace( 0 ); - - error = DoMountFileSystem( iFsSession, volInfo, - iDrives[i]->DriveNumber() ); - - if ( !error ) - { - freespace = volInfo.iFree; - TRACE(Print(_L("[FILL MNGR]\t CCmFmFillDriveMngr freespace \ - : %ld"), freespace )); - if( freespace < ( KCmMmcLowMemory + aFileSize ) ) - { - TRACE(Print(_L("[FILL MNGR]\t Disc full!!"))); - } - else - { - TRACE(Print(_L("[FILL MNGR]\t Drive number of the drive \ - where to fill = %d"), iDrives[i]->DriveNumber() )); - aDriveNumber = iDrives[i]->DriveNumber(); - aDriveId = iDrives[i]->DriveId(); - driveIndex = i; - i = iDrives.Count(); - } - } - else - { - // Disc is not ready => Do not fill - TRACE(Print(_L("[FILL MNGR]\t Disc is not ready!!"))); - } - } - } - - return driveIndex; - } - -// --------------------------------------------------------------------------- -// CCmFmFillDriveMngr::DoMountFileSystem -// --------------------------------------------------------------------------- -// -TInt CCmFmFillDriveMngr::DoMountFileSystem( RFs& aFileServer, - TVolumeInfo& aVolInfo, - TInt aDriveNumber ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillDriveMngr::CheckFreeDiscSpace()")); - - TInt error( KErrNone ); - TFullName fsname; - error = aFileServer.FileSystemName( fsname, aDriveNumber ); - - TRACE(Print(_L("[FILL MNGR]\t FileSystemName %d, %S"), - error, &fsname )); - - error = aFileServer.FileSystemName( fsname, aDriveNumber ); - - TRACE(Print(_L("[FILL MNGR]\t FileSystemName %d, %S"), - error, &fsname )); - - error = aFileServer.Volume( aVolInfo, aDriveNumber ); - - TRACE(Print(_L("[FILL MNGR]\t CCmFmFillDriveMngr::volinfo error = %d"), - error )); - - return error; - } - -// End of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfillrulefilleddatamngr.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmfillrulefilleddatamngr.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1686 +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: Fill rule and filled data processing -* Version : %version: ou1s60rt#18 % << Don't touch! -* -*/ - - - -#include -#include "upnpdlnautility.h" -#include "cmsqlmainfactory.h" -#include "mcmsqlmain.h" -#include "cmdmmain.h" -#include "cmfillrule.h" -#include "cmfillrulecontainer.h" -#include "cmsqlpropertyitem.h" -#include "cmmediaserverfull.h" -#include "cmfilllistitem.h" -#include "cmfmmain.h" -#include "cmfmao.h" -#include "cmfmfillrulefilleddatamngr.h" -#include "msdebug.h" - -// Constants -const TInt KCmFmIniDownloadDataAmount = 300; // 300 kBs -const TInt KCmFmIniDownloadTime = 1; // One second - - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::NewL -// --------------------------------------------------------------------------- -// -CCmFmFillRuleFilledDataMngr* CCmFmFillRuleFilledDataMngr::NewL( - MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewL() start")); - CCmFmFillRuleFilledDataMngr* self = CCmFmFillRuleFilledDataMngr::NewLC( - aObserver, aDBMngr, aItems ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::NewLC -// --------------------------------------------------------------------------- -// -CCmFmFillRuleFilledDataMngr* CCmFmFillRuleFilledDataMngr::NewLC( - MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewLC() start")); - CCmFmFillRuleFilledDataMngr* self = - new ( ELeave ) CCmFmFillRuleFilledDataMngr( aObserver, aDBMngr, - aItems ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::~CCmFmFillRuleFilledDataMngr -// --------------------------------------------------------------------------- -// -CCmFmFillRuleFilledDataMngr::~CCmFmFillRuleFilledDataMngr() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - ~CCmFmFillRuleFilledDataMngr() start")); - Cancel(); - - if ( iWrapper ) - { - iWrapper->Close(); - } - - if ( iAo ) - { - delete iAo; - } - - iObserver = NULL; - iDBManager = NULL; - - if ( iContainer ) - { - delete iContainer; - } - - iRuleArray.Reset(); - iRuleArray.Close(); - - iUpdateItems.Reset(); - iUpdateItems.Close(); - - iPropertys.ResetAndDestroy(); - - iFileIds.Close(); - iMetadataServersToBeDeleted.Close(); - iOldIds.Close(); - iFs.Close(); - iFilteredProfiles.Reset(); - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - ~CCmFmFillRuleFilledDataMngr() end")); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::CCmFmFillRuleFilledDataMngr -// --------------------------------------------------------------------------- -// -CCmFmFillRuleFilledDataMngr::CCmFmFillRuleFilledDataMngr( - MCmFmFillRuleObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems ) - :CActive( EPriorityStandard ), iObserver( aObserver ), - iDBManager( aDBMngr ), iItems(aItems) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - CCmFmFillRuleFilledDataMngr()")); - - CActiveScheduler::Add( this ); - iTransferInfo.iService = ECmServiceTransferInfoFill; - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::ConstructL()")); - User::LeaveIfError( iFs.Connect() ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::OperationCompletedL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::OperationCompletedL( TInt aStatus ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - OperationCompletedL()")); - - iQueryFinished.HomeTime(); - TTimeIntervalMicroSeconds usecsFrom = - iQueryFinished.MicroSecondsFrom( iQueryStart ); - TRACE(Print(_L("[FILL MNGR]\t Query \ - took = %ld mseconds"), ( usecsFrom.Int64() / 1000 ) )); - - if( KErrNone == aStatus ) - { - switch( iProcessingState ) - { - case ECmFmLoadingPropertys: - { - // Loading propertys ready - CompleteRequest( EColumnDataReady ); - break; - } - case ECmFmLoadingMetadata: - { - // Loading file metadata ready ( for one fill list ) - iNewItemCount = iItems.Count() - iNewItemCount; - CompleteRequest( EQueryCompleted ); - break; - } - case ECmFmDeletingMetadata: - { - // Metadata deleted from defined media servers - TRAPD( err, DeleteHashCodesL() ); - iMetadataServersToBeDeleted.Reset(); - iMetadataServersToBeDeleted.Close(); - iWrapper->DeleteUnusedPropertys( ); - if( !err ) - { - CompleteRequest( EMetadataDeleted ); - } - else - { - TRACE(Print(_L("[FILL MNGR]\t \ - OperationCompletedL err %d "), err )); - } - break; - } - case ECmFmLoadingProfileIds: - { - DefineAndSetDlnaProfileIdFiltersL(); - PreprocessListsL(); - break; - } - default: - { - LOG(_L("[FILL MNGR]\t OperationCompletedL processing \ - state not found")); - break; - } - } - } - else - { - TRACE(Print(_L("[FILL MNGR]\t OperationCompletedL aStatus = %d"), - aStatus )); - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::LoadProfileIdsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::LoadProfileIdsL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::LoadProfileIdsL()")); - // Loads all dlna profile ids from database. Profile ids are used - // to filter out unsupported media types - iPropertys.ResetAndDestroy(); - iProcessingState = ECmFmLoadingProfileIds; - CreateWrapperL(); - StartObserverL(); - iWrapper->GetPropertyValuesL( iPropertys, iAo->iStatus, - ECmProfileId, ECmAll ); - iQueryStart.HomeTime(); - iAo->RunL(); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::PreprocessListsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::PreprocessListsL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::PreprocessListsL()")); - -#ifdef _DEBUG - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE(Print(_L("[FILL MNGR]\t preprocess heap allocsize %d, \ - size %d, cells %d"), alloc, size, cells )); -#endif - iProcessingState = ECmFmIdle; - ResetData(); - // Creates sqlite wrapper and starts preprocessing of all fill lists - TRAP_IGNORE( CreateWrapperL() ); - iTransferInfo.iTotalItems = KErrNone; - iTransferInfo.iProcessedItems = KErrNone; - CompleteRequest( EPreProcessingStarted ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::PreProcessListL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::PreProcessListL( - const TDesC8& aFillListName ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::PreProcessListL()")); - - iProcessingState = ECmFmIdle; - // Creates sqlite wrapper and starts preprocessing of - // one defined fill list - CreateWrapperL(); - ResetData(); - iContainer = CCmFillRuleContainer::NewL(); - LoadRuleL( aFillListName ); - LoadAllFillItemsL(); - CompleteRequest( ERandomizingStarted ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::GetColItemsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::GetColItemsL( TCmMetadataField aType, - TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetColItemsL()")); - - iPropertyContainer = NULL; - iPropertyContainer = &aPropertys; - iPropertys.ResetAndDestroy(); - iProcessingState = ECmFmLoadingPropertys; - CreateWrapperL(); - StartObserverL(); - // starts loading defined propertys from database - iWrapper->GetPropertyValuesL(iPropertys, iAo->iStatus, aType, aMedia ); - iQueryStart.HomeTime(); - iAo->RunL(); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::GetMetadataItemsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::GetMetadataItemsL( - CCmSqlPropertyCollector& aPropertys ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - GetMetadataItemsL()")); - - iPropertyCollector = NULL; - iPropertyCollector = &aPropertys; - iProcessingState = ECmFmLoadingPropertys; - CreateWrapperL(); - StartObserverL(); - // starts loading property values. Selected artists, albums, genres and - // tracks are used as a filtering parameter ( e.g. if some artist is - // selected, only albums for that defined artist are loaded. - iWrapper->GetFilteredPropertyValuesL( *iPropertyCollector, iAo->iStatus ); - iQueryStart.HomeTime(); - iAo->RunL(); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::UpdatePriorities -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::UpdatePriorities() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::UpdatePriorities()")); - - CompleteRequest( EUpdatePriorities ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DoUpdatePrioritiesL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DoUpdatePrioritiesL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - DoUpdatePrioritiesL()")); - - // Updating first list item priorities -#ifdef _DEBUG - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE(Print(_L("[FILL MNGR]\t DoUpdatePrioritiesL start heap \ - allocsize %d, size %d, cells %d"), alloc, size, cells )); -#endif - - CCmFillRuleContainer* container = LoadAllFillRulesL(); - CleanupStack::PushL( container ); - TInt err( UpdateListItemPriorities( container ) ); - TRACE(Print(_L("[FILL MNGR]\t UpdateListItemPriorities err = %d"), - err )); - CleanupStack::PopAndDestroy(container); - CalculateAvgTransferTimeL(); - SendAvgTransferTime(); - -#ifdef _DEBUG - cells = User::Heap().AllocSize( alloc ); - size = User::Heap().Size(); - TRACE(Print(_L("[FILL MNGR]\t DoUpdatePrioritiesL end heap \ - allocsize %d, size %d, cells %d"), alloc, size, cells )); -#endif - - iObserver->FillRuleProcessingStatus( EDoUpdatePriorities ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DoUpdateReferenceIdsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DoUpdateReferenceIdsL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - DoUpdateReferenceIdsL()")); - -#ifdef _DEBUG - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE(Print(_L("[FILL MNGR]\t DoUpdateReferenceIdsL start heap \ - allocsize %d, size %d, cells %d"), alloc, size, cells )); -#endif - - LoadAllFillItemsL(); - LOG(_L("[FILL MNGR]\t Items loaded...")); - - // Processing set referense ids into duplicate items - LOG(_L("[FILL MNGR]\t Processing ref ids...")); - - DoProcessReferenceValuesL(); - - LOG(_L("[FILL MNGR]\t Ref ids processed...")); - UpdateFillItems(); - iItems.ResetAndDestroy(); - iItems.Close(); -#ifdef _DEBUG - cells = User::Heap().AllocSize( alloc ); - size = User::Heap().Size(); - TRACE(Print(_L("[FILL MNGR]\t DoUpdateReferenceIdsL end heap \ - allocsize %d, size %d, cells %d"), alloc, size, cells )); -#endif - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DeleteMetadataL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DeleteMetadataL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DeleteMetadataL()")); - - iMetadataServersToBeDeleted.Reset(); - - RPointerArray mediaServers; - CleanupClosePushL( mediaServers ); - - iDBManager->GetMediaServersL( mediaServers ); - - TBool setSystemUpdateIDChange( EFalse ); - for( TInt i = 0; i < mediaServers.Count(); i++ ) - { - // checks that server is either inactive or deleted - if( mediaServers[i]->DbId() != 0 && - !( mediaServers[i]->FillUsage() ) ) - { - iMetadataServersToBeDeleted.AppendL( mediaServers[i]->DbId() ); - TRACE(Print(_L("[FILL MNGR]\t DbId = %ld"), - mediaServers[i]->DbId() )); - - mediaServers[i]->SetSystemUpdateID( KErrNotFound ); - - setSystemUpdateIDChange = ETrue; - } - } - - if ( setSystemUpdateIDChange ) - { - iDBManager->SetMediaServersL( mediaServers ); - } - - mediaServers.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &mediaServers ); - - iProcessingState = ECmFmDeletingMetadata; - CreateWrapperL(); - StartObserverL(); - iWrapper->AsyncMetadataDelete( iMetadataServersToBeDeleted, - iAo->iStatus ); - iQueryStart.HomeTime(); - iAo->RunL(); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::SetMemoryCardQuota -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::SetMemoryCardQuota( TInt64 aQuota ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - SetMemoryCardQuota()")); - - if( iWrapper ) - { - iWrapper->SetQuota( aQuota ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::CancelOperation() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CancelOperation()")); - - Cancel(); - if( iWrapper ) - { - iWrapper->CancelAsyncOperation(); - } - DeleteWrapper(); - if( iAo ) - { - if( iAo->IsActive() ) - { - iAo->Cancel(); - } - delete iAo; - iAo = NULL; - } - LOG(_L("[FILL MNGR]\t iAo canceled...")); - iObserver->FillRuleProcessingStatus(EProcessingCanceled); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::UpdateTransferHistoryData -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::UpdateTransferHistoryData( - TInt64 aInterval, TInt64 aDataAmount, - TUint8 aServerId ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - UpdateTransferHistoryData()")); - - iDBManager->UpdateDownloadHistory( (TUint)aServerId, aDataAmount, - aInterval ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::GetFillItemsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::GetFillItemsL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetFillItemsL()")); - - iItems.ResetAndDestroy(); - iItems.Close(); - iDBManager->PrepareQueryCmdL(EAllFillFilesStatusQuery); - iDBManager->GetAllFillFilesL( iItems, - ECmToBeShrinked|ECmToBeFilled|ECmFilled|ECmLocalCopy ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::GetToBeDeletedL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::GetToBeDeletedL( - RPointerArray& aArray ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetToBeDeletedL()")); - - iDBManager->PrepareQueryCmdL(EAllFillFilesStatusQuery); - iDBManager->GetAllFillFilesL( aArray, ECmToBeRemoved ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::UpdateFillItems -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::UpdateFillItems( TBool aCancel ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::UpdateFillItems()")); - - iDBManager->DeleteFillFiles(); - if( aCancel && iUpdateItems.Count() ) - { - iDBManager->SetFillFiles( iUpdateItems ); - } - else - { - iDBManager->SetFillFiles( iItems ); - } - iUpdateItems.Reset(); - iUpdateItems.Close(); - - iItems.ResetAndDestroy(); - iItems.Close(); - - TRAP_IGNORE( CalculateAvgTransferTimeL() ); - SendAvgTransferTime(); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::UpdateToBeDeleted -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::UpdateToBeDeleted( - RPointerArray& aArray ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - UpdateToBeDeleted()")); - - // This function is needed when fill is processed only partially - // Some of the to be deleted files are still on device - iDBManager->SetFillFiles( aArray ); - aArray.ResetAndDestroy(); - aArray.Close(); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::GetUuidL -// --------------------------------------------------------------------------- -// -TInt CCmFmFillRuleFilledDataMngr::GetUuidL( HBufC8*& aUuid, TUint8 aId ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::GetUuidL()")); - - iDBManager->PrepareQueryCmdL( EMediaServerUDNQuery ); - return iDBManager->QueryMediaServerUdn(aUuid, aId); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::ResetData -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::ResetData() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::ResetData()")); - - iNewItemCount = KErrNone; - - iRuleArray.Reset(); - iRuleArray.Close(); - - iUpdateItems.Reset(); - iUpdateItems.Close(); - - iItems.ResetAndDestroy(); - iItems.Close(); - - iFileIds.Close(); - iOldIds.Close(); - - if( iContainer ) - { - delete iContainer; - iContainer = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::CalculateAvgTransferTimeL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::CalculateAvgTransferTimeL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - CalculateAvgTransferTimeL()")); - - TInt64 ud(KErrNone); - TInt64 dd(KErrNone); - TInt64 ut(KErrNone); - TInt64 dt(KErrNone); - TInt64 size( KErrNone ); - TInt64 shrinkTime(KErrNone); - TInt64 transferTime(KErrNone); - TInt ret( KErrNone ); - RPointerArray servers; - CleanupClosePushL( servers ); - - iDBManager->PrepareQueryCmdL( EMediaServersAllQuery ); - while( !ret ) - { - CCmMediaServerFull* server = CCmMediaServerFull::NewLC(); - ret = iDBManager->QueryAllMediaServersL( server ); - if( !ret ) - { - servers.AppendL( server ); - CleanupStack::Pop( server ); - } - else - { - CleanupStack::PopAndDestroy( server ); - } - } - TRACE( Print( _L("[FILL MNGR]\t servers.Count() = %d"), - servers.Count() )); - for( TInt i = 0; i < servers.Count(); i++ ) - { - iDBManager->PrepareQueryCmdL(ETransferHistoryQuery); - TPtrC8 ser( servers[i]->MediaServer() ); - if( &ser ) - { - iDBManager->QueryTransferHistory( - ser, dd, ud, dt, ut ); - size = iDBManager->KBytesToBeFilled( - GetMediaServerIdL(ser), - ECmToBeShrinked|ECmToBeFilled ); - TRACE( Print( _L("[FILL MNGR]\t data amount \ - to be filled = %ld"), size )); - - TRACE( Print( _L("[FILL MNGR]\t transferred data = %ld"), - dd )); - - TRACE( Print( _L("[FILL MNGR]\t transfer time = %ld"), - dt )); - if( dd == KErrNone || dt == KErrNone ) - { - dd = KCmFmIniDownloadDataAmount; - dt = KCmFmIniDownloadTime; - } - // If server hasn't been handled - if( size != KErrNone ) - { - transferTime = transferTime + (( dt * size ) / dd ); - } - TRACE( Print( _L("[FILL MNGR]\t avg transfer time = %ld"), - transferTime )); - } - - } - servers.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &servers ); - - TInt shrinkCount( iDBManager->FillFileCount(ECmToBeShrinked) ); - - shrinkTime = (iDBManager->GetAvgImageShrinkTime() * shrinkCount); - - TInt totalCount( iDBManager->FillFileCount( - ECmToBeShrinked|ECmToBeFilled )); - transferTime = transferTime + ( shrinkTime / 1000 ); - if( KErrNone >= totalCount ) - { - transferTime = KErrNone; - } - iDBManager->UpdateTransferInfo( ECmServiceFill, totalCount, - transferTime ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::SendAvgTransferTime -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::SendAvgTransferTime() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - SendAvgTransferTime()")); - - // Load transfer information from database - TInt err = iDBManager->GetTransferInfo( ECmServiceFill, - iTransferInfo.iProcessedItems, iTransferInfo.iTotalItems ); - - TRACE( Print( _L("[FILL MNGR]\t GetTransferInfo returned %d"), err)); - - TRACE( Print( _L( - "[FILL MNGR]\t item count = %d, avg time = %d"), - iTransferInfo.iProcessedItems, iTransferInfo.iTotalItems )); - iTransferInfo.iService = ECmServiceTransferInfoFill; - - TCmProgressInfoPckg transferInfoPckg( iTransferInfo ); - - err = RProperty::Set( KCmPropertyCat, KCmProperty, - transferInfoPckg ); - - TRACE( Print( _L("[FILL MNGR]\t RProperty::Set returned %d"), err)); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::GetMediaServerIdL -// --------------------------------------------------------------------------- -// -TInt64 CCmFmFillRuleFilledDataMngr::GetMediaServerIdL( const TDesC8& aUuid ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - GetMediaServerIdL()")); - - iDBManager->PrepareQueryCmdL( EMediaServerIdQuery ); - return iDBManager->QueryMediaServerId( aUuid ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::LoadSelectedFillRulesL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::LoadSelectedFillRulesL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - LoadSelectedFillRulesL()")); - - RPointerArray array; - CleanupClosePushL( array ); - - iDBManager->PrepareQueryCmdL( ESelectedFillRuleQuery ); - iDBManager->QuerySelectedFillRuleNamesL( array, (TInt)ECmSelected ); - // Load selected fill rules to array ( using names as a query - // parameter ) - for( TInt i = 0; i < array.Count(); i++ ) - { - LoadRuleL( *array[i] ); - } - - // Remove random rules. When fill manager is booted up first time - // Do not remove random rules => need to be processed - // If list don't have any files on the list => process list - for( TInt j = 0; j < iRuleArray.Count(); j++ ) - { - if( ECmRandom == iRuleArray[j]->Method() || - ECmRandomAlbum == iRuleArray[j]->Method() || - ECmRandomTrack == iRuleArray[j]->Method() ) - { - TInt count( KErrNone ); - iDBManager->GetFillFileCount(iRuleArray[j]->Name(), - ECmToBeFilled|ECmToBeShrinked|ECmFilled|ECmLocalCopy, count ); - if( KErrNone < count ) - { - LOG(_L("[FILL MNGR]\t Random rule is already processed")); - delete iRuleArray[j]; - iRuleArray.Remove(j); - j--; - } - else - { - LOG(_L("[FILL MNGR]\t Random rule is not processed")); - // Don't remove rule - } - } - } - for( TInt k = 0; k < iRuleArray.Count(); k++ ) - { - if( KErrNone == iRuleArray[k]->MediaServerCount() ) - { - LOG(_L("[FILL MNGR]\t No Servers included in fill rule")); - TRACE(Print(_L("[FILL MNGR]\t => Any Server rule..."))); - } - } - - array.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &array ); - - CompleteRequest( EFillRulesLoaded ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::LoadAllFillRulesL -// --------------------------------------------------------------------------- -// -CCmFillRuleContainer* CCmFmFillRuleFilledDataMngr::LoadAllFillRulesL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::FillRuleContainerL")); - - RPointerArray array; - CleanupClosePushL( array ); - - // Query fill rule names - iDBManager->PrepareQueryCmdL( EFillRuleNamesQuery ); - iDBManager->QueryFillRuleNamesL( array ); - TRACE(Print(_L("[FILL MNGR]\t fill rule array size is %d"), - array.Count())); - - CCmFillRuleContainer* ruleContainer = CCmFillRuleContainer::NewLC(); - for ( TInt i = 0; i < array.Count(); i++ ) - { - // Query all fill rules - CCmFillRule* rule = CCmFillRule::NewLC(); - rule->SetNameL( *(array[i]) ); - iDBManager->PrepareQueryCmdL( EFillRuleQuery ); - iDBManager->QueryFillRuleL( rule ); - - ruleContainer->AddFillRuleL( rule ); - CleanupStack::Pop( rule ); - } - CleanupStack::Pop( ruleContainer ); - - array.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &array ); - - return ruleContainer; - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::LoadRuleL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::LoadRuleL( const TDesC8& aFillListName ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::LoadRuleL()")); - - CCmFillRule* fillRule = CCmFillRule::NewLC(); - iDBManager->PrepareQueryCmdL(EFillRuleQuery); - fillRule->SetNameL( aFillListName ); - iDBManager->QueryFillRuleL( fillRule ); - iRuleArray.AppendL( fillRule ); - iContainer->AddFillRuleL( fillRule ); - CleanupStack::Pop( fillRule ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::UpdateListItemPriorities -// --------------------------------------------------------------------------- -// -TInt CCmFmFillRuleFilledDataMngr::UpdateListItemPriorities( - CCmFillRuleContainer* aContainer ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - UpdateListItemPriorities()")); - - TInt err( KErrNone ); - err = iDBManager->UpdateFillListItemPriority( aContainer ); - TRACE(Print(_L("[FILL MNGR]\t priority update err = %d"), - err )); - return err; - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::LoadMetadataL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::LoadMetadataL( CCmFillRule* aFillRule ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - LoadMetadataL()")); - - StartObserverL(); - TRAPD( err, iWrapper->GetFillItemsL( iItems, *aFillRule, iAo->iStatus ) ); - if( !err ) - { - iQueryStart.HomeTime(); - iAo->RunL(); - iNewItemCount = iItems.Count(); - //add the old item to list - SelectFillListFiles( iOldIds, aFillRule->ListId() ); - iProcessingState = ECmFmLoadingMetadata; - } - else - { - TRACE(Print(_L("[FILL MNGR]\t Metadata find err = %d"), err )); - TRACE(Print(_L("[FILL MNGR]\t Skipping rule..."))); - iRuleArray.Remove(0); - iRuleArray.Compress(); - /** Splitting long task into shorter ones */ - CompleteRequest( ENextFillRule ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::ProcessReferenceValuesL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::ProcessReferenceValuesL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - ProcessReferenceValuesL()")); - - DoProcessReferenceValuesL(); - CompleteRequest( EProcessStatusValues ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DoProcessReferenceValuesL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DoProcessReferenceValuesL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - DoProcessReferenceValuesL()")); - - RArray refIds; - CleanupClosePushL( refIds ); - - TBool ref( EFalse ); - // Processing set referense ids into duplicate items - for( TInt j = 0; j < iItems.Count(); j++ ) - { - for( TInt k = iItems.Count() - 1; k >= KErrNone; k-- ) - { - if( ( KErrNone == iItems[k]->PrimaryText().Compare( - iItems[j]->PrimaryText() )) && (iItems[k]->Size() - == iItems[j]->Size() ) && ( j != k ) && - ( ECmSelected == iItems[j]->Selected() || - ( ECmUnSelected == iItems[j]->Selected() && - ECmUnSelected == iItems[k]->Selected() ) ) ) - { - if( iItems[k]->Priority() > iItems[j]->Priority() ) - { - refIds.InsertInOrderL( k ); - } - else if ( iItems[k]->Priority() < iItems[j]->Priority() ) - { - // Some of the items are on the higher priority than - // iItems[ j ] - if( ECmUnSelected == iItems[k]->Selected() && - ECmSelected == iItems[j]->Selected() ) - { - refIds.InsertInOrderL( k ); - } - else - { - ref = ETrue; - } - } - } - // Check if there is a match on a selected list - if( ( KErrNone == iItems[k]->PrimaryText().Compare( - iItems[j]->PrimaryText() ) ) && ( iItems[k]->Size() - == iItems[j]->Size() ) && ( j != k ) && - ( ECmUnSelected == iItems[j]->Selected() && - ECmSelected == iItems[k]->Selected() ) && ( - iItems[k]->Priority() < iItems[j]->Priority() ) ) - { - // Do not set ref id to zero - ref = ETrue; - } - } - // Updating referense ids - for( TInt i = 0; i < refIds.Count(); i++ ) - { - iItems[refIds[i]]->SetRefId( iItems[j]->DbId() ); - } - if( !ref ) - { - iItems[j]->SetRefId( 0 ); - } - ref = EFalse; - refIds.Reset(); - } - - CleanupStack::PopAndDestroy( &refIds ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::ProcessDuplicates -// Processes duplicates. If same list has some item twice, -// newer one is removed from the list -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::ProcessDuplicates() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - ProcessDuplicates()")); - - TBool duplicateFound( EFalse ); - - for( TInt i = 0; i < iFileIds.Count() - 1; i++ ) - { - duplicateFound = EFalse; - //Compare item with following items - for( TInt j = i+1; j < iFileIds.Count() && !duplicateFound; j++ ) - { - if( ( iFileIds[i] < iItems.Count() ) && - ( iFileIds[j] < iItems.Count() ) ) - { - if( i != j && ( ( KErrNone == iItems[iFileIds[i]]-> - PrimaryText().Compare( - iItems[iFileIds[j]]->PrimaryText() ) ) - && ( iItems[iFileIds[i]]->Size() == - iItems[iFileIds[j]]->Size() ) || - iItems[iFileIds[i]]->DbId() == - iItems[iFileIds[j]]->DbId() ) ) - { - if( ( ECmImage == iItems[iFileIds[j]]->MediaType() && - ECmToBeShrinked == iItems[iFileIds[i]]->Status()) || - ( ECmImage == iItems[iFileIds[j]]->MediaType() && - ECmToBeFilled == iItems[iFileIds[i]]->Status()) ) - { - // if the media type is image and never be filled - //before ,so do not change the new items status value - //in this cycle , just delete the old items - } - else - { - iItems[iFileIds[j]]->SetStatus( - iItems[iFileIds[i]]->Status() ) ; - } - TRAP_IGNORE( iItems[iFileIds[j]]->SetPathL( - iItems[iFileIds[i]]->Path() ) ); - iItems[iFileIds[j]]->SetDriveId( - iItems[iFileIds[i]]->DriveId() ); - iItems[iFileIds[j]]->SetDriveNumber( - iItems[iFileIds[i]]->DriveNumber() ); - - duplicateFound = ETrue; - } - } - } - //iItems[iFileIds[i]] is duplicated, should delete it - if( duplicateFound ) - { - DoDeleteProcess( iFileIds[i] ); - i--; - } - } - iItems.Compress(); - - /** Spliting long task into shorter ones */ - CompleteRequest( EProcessReferenceValues ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::SelectFillListFiles -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::SelectFillListFiles( RArray& aList, - TUint8 aId ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - SelectFillListFiles()")); - - TRACE(Print(_L("[FILL MNGR]\t LIST ID = %d"), aId )); - aList.Reset(); - aList.Close(); - TInt count( iItems.Count() ); - for( TInt i = 0; i < count; i++ ) - { - if( iItems[i]->ListId() == aId ) - { - aList.InsertInOrderL( i ); - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::ProcessFileStatusValuesL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::ProcessFileStatusValuesL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - ProcessFileStatusValuesL()")); - - // Let's update priorities,is it possible that priority has changed - // And list ids - TInt64 ruleSize( KErrNone ); - TInt64 realSize( KErrNone ); - TInt err( KErrNone ); - if( iRuleArray.Count() > 0 ) - { - TRAP( err, iDBManager->SetFillListRealCountAndSizeL( - iRuleArray[0]->ListId(), 0, 0 ) ); - } - - TRACE(Print(_L("[FILL MNGR]\t Size set err = %d"), - err )); - TInt64 realCount( iFileIds.Count() ); - for( TInt k = ( iFileIds.Count() - 1 ); k >= KErrNone && - iFileIds[k] < iItems.Count() ; k-- ) - { - // Update priority - iItems[iFileIds[k]]->SetPriority( iRuleArray[0]->Priority() ); - // Update list id - iItems[iFileIds[k]]->SetListId( iRuleArray[0]->ListId() ); - if ( iItems[iFileIds[k]]->Status() == ECmToBeFilled || - iItems[iFileIds[k]]->Status() == ECmToBeShrinked || - iItems[iFileIds[k]]->Status() == ECmFilled || - iItems[iFileIds[k]]->Status() == ECmLocalCopy ) - { - // increases list size - realSize += iItems[iFileIds[k]]->Size(); - } - - else if ( iItems[iFileIds[k]]->Status() == ECmToBeRemoved ) - { - // reduces list size - realCount--; - } - - ruleSize = ruleSize + iItems[iFileIds[k]]->Size(); - } - - TInt index( KErrNone ); - RArray delIds; - CleanupClosePushL( delIds ); - - TRACE( Print( _L("[FILL MNGR]\t iAllItemCount = %d"), iAllItemCount ) ); - TRACE( Print( _L("[FILL MNGR]\t iFileIds.Count() = %d"), - iFileIds.Count() ) ); - TRACE( Print( _L("[FILL MNGR]\t iNewItemCount = %d"), - iNewItemCount ) ); - // Let's mark to be remove extra files - if( iRuleArray.Count() > 0 ) - { - TRACE( Print( _L("[FILL MNGR]\t fill rule array is not empty!"))); - if( iRuleArray[0]->LimitType() == EMbits ) - { - TRACE( Print( _L("[FILL MNGR]\t fill rule\ - Limit Type is EMbits!") ) ); - - // KMega=1024*1024 - // The size of files to be filled should be small than - // the amount value set by user. - // When realSize be 0 , realCount should be 0 also. - // iAllItemCount > iNewItemCount : sure that extra file be delete - while( ( (( iRuleArray[0]->Amount()*KMega ) < realSize ) && - ( realCount>0 )) || - iAllItemCount > iNewItemCount ) - { - // handle the fill file's count and size. - ProcessFileSizeAndCount( delIds, index, realCount, realSize); - index++; - iAllItemCount--; - } - } - else - { - // when limit tyep are EUnlimited and EPieces - // do not need to limit the size of the file that to be filled. - while( iAllItemCount > iNewItemCount ) - { - // handle the fill file's count and size. - ProcessFileSizeAndCount( delIds, index, realCount, realSize ); - index++; - iAllItemCount--; - } - } - } - else - { - // if the fill rule array is empty ,just show the information. - TRACE( Print( _L("[FILL MNGR]\t fill rule array is empty!"))); - } - // Let's remove items which had ECmToBeFilled or ECmToShrinked status - if( delIds.Count() > KErrNone ) - { - index = KErrNone; - while( delIds.Count() != KErrNone ) - { - ruleSize = ruleSize - iItems[delIds[0] - index]->Size(); - delete iItems[delIds[0] - index]; - iItems.Remove( delIds[0] - index ); - delIds.Remove(0); - index++; - } - } - - CleanupStack::PopAndDestroy( &delIds); - - if( iRuleArray.Count() > 0 ) - { - TRAP( err, iDBManager->SetFillListRealCountAndSizeL( - iRuleArray[0]->ListId(), realCount, ruleSize ) ); - iUpdateItems.Reset(); - for( TInt j = 0; j < iItems.Count(); j++ ) - { - iUpdateItems.AppendL( iItems[j] ); - } - } - - - TRACE(Print(_L("FILL RULE INFORMATION UPDATE err = %d"), err )); - if ( iRuleArray.Count() > 0 ) - { - iRuleArray.Remove(0); - iRuleArray.Compress(); - } - - TRACE(Print(_L("****** FILL RULE TOTAL SIZE ******"))); - TRACE(Print(_L("FILL RULE SIZE = %ld ( Bytes )"), ruleSize )); - TRACE(Print(_L("****** FILL RULE TOTAL SIZE ******"))); - - /** Spliting long task into shorter ones */ - CompleteRequest( ENextFillRule ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::ProcessFileSizeAndCount -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::ProcessFileSizeAndCount( - RArray& aDelIds, TInt aIndex, - TInt64& aRealCount, - TInt64& aRealSize ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - ProcessFileSizeAndCount()")); - - TRACE( Print( _L(" realCount = %ld, aDelIds's count =%d") , aRealCount, - aDelIds.Count() )); - TRACE( Print( _L(" realSize = %ld ( Bytes )") , aRealSize )); - - // Should this status be set if priority is higher than duplicates - // priority - if( iItems[iFileIds[aIndex]]->Status() == ECmFilled ) - { - iItems[iFileIds[aIndex]]->SetStatus( ECmToBeRemoved ); - aRealCount--; - for( TInt i = 0; i < iItems.Count(); i++ ) - { - if( iItems[i]->RefId() == iItems[iFileIds[aIndex]]->DbId() ) - { - // Set also reference ids to status to be removed - iItems[i]->SetStatus( ECmToBeRemoved ); - } - } - } - else if( iItems[iFileIds[aIndex]]->Status() == ECmToBeFilled || - iItems[iFileIds[aIndex]]->Status() == ECmToBeShrinked ) - { - aRealSize -= iItems[iFileIds[aIndex]]->Size(); - aDelIds.InsertInOrderL( iFileIds[aIndex] ); - aRealCount--; - } - else // ECmLocalCopy - { - TRACE(Print(_L("[FILL MNGR]\t No effect on size"))); - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::LoadAllFillItemsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::LoadAllFillItemsL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::LoadAllFillItemsL()")); - - iItems.ResetAndDestroy(); - iItems.Close(); - iDBManager->PrepareQueryCmdL( EAllFillFilesQuery ); - TInt err = iDBManager->QueryAllFillFilesL(iItems); - TRACE( Print( _L("[FILL MNGR]\t QueryAllFillFilesL err = %d"), err )); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DefineAndSetDlnaProfileIdFiltersL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DefineAndSetDlnaProfileIdFiltersL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - DefineAndSetDlnaProfileIdFiltersL()")); - - CDesC8Array* array = - &UPnPDlnaUtility::GetSupportedProfilesL( UPnPDlnaUtility::EDMPMode ); - CleanupStack::PushL( array ); - TInt okProfile( EFalse ); - iFilteredProfiles.Reset(); - for( TInt i = 0 ; i < iPropertys.Count(); i++ ) - { - for( TInt j = 0; j < array->Count(); j++ ) - { - if( KErrNotFound != - iPropertys[i]->Name().Match( array->MdcaPoint(j) ) ) - { - // Profile is supported - okProfile = ETrue; - // profile is supported, end loop - j = array->Count(); - } - } - if( !okProfile ) - { - iFilteredProfiles.InsertInSignedKeyOrder( iPropertys[i]->Id() ); - } - okProfile = EFalse; - } - iPropertys.ResetAndDestroy(); - CleanupStack::PopAndDestroy( array ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::CompleteRequest -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::CompleteRequest( - TCmFmFillRuleProcessing aStatus ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CompleteRequest()")); - - __ASSERT_DEBUG(!IsActive(),\ - User::Panic( KCmFmFillManager, KErrInUse )); - SetActive(); - TRequestStatus* pStatus = &iStatus; - User::RequestComplete( pStatus, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::StartObserverL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::StartObserverL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::StartObserverL()")); - - if( iAo ) - { - delete iAo; - iAo = NULL; - } - iAo = CCmFmAo::NewL( *this ); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::CreateWrapperL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::CreateWrapperL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CreateWrapperL()")); - - DeleteWrapper(); - iWrapper = CCmSqlMainFactory::NewCmSqlMainL( iFs ); -#ifndef __SERIES60_31__ - iWrapper->SetDlnaProfileFilters( iFilteredProfiles ); -#endif - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DeleteWrapper -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DeleteWrapper() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DeleteWrapper()")); - - if( iWrapper ) - { - iWrapper->Close(); - iWrapper = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::CheckFillListsL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::CheckFillListsL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::CheckFillListsL()")); - - delete iContainer; - iContainer = NULL; - iContainer = LoadAllFillRulesL(); - iRuleArray.Reset(); - for( TInt j = (iContainer->FillRuleCount() - 1 ) ; j >= 0; - j-- ) - { - if( ECmRandom == iContainer->FillRule(j)->Method() || - ECmRandomAlbum == iContainer->FillRule(j)->Method() || - ECmRandomTrack == iContainer->FillRule(j)->Method() ) - { - TInt count( KErrNone ); - iDBManager->GetFillFileCount( - iContainer->FillRule(j)->Name(), - ECmToBeFilled|ECmToBeShrinked|ECmFilled|ECmLocalCopy, - count ); - if( KErrNone < count ) - { - // If rule is random rule which is already processed - // do not process rule automatically - LOG(_L("[FILL MNGR]\t Random rule already processed")); - iContainer->DeleteFillRule( j ); - } - else - { - LOG(_L("[FILL MNGR]\t Random rule is not processed")); - // Don't remove rule - iRuleArray.AppendL( iContainer->FillRule( j ) ); - } - } - else - { - LOG(_L("[FILL MNGR]\t Rule is not random rule")); - iRuleArray.AppendL( iContainer->FillRule( j ) ); - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DeleteHashCodesL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DeleteHashCodesL() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DeleteHashCodesL()")); - - for( TInt i = 0; i < iMetadataServersToBeDeleted.Count(); i++ ) - { - iDBManager->DeleteHashValuesL( iMetadataServersToBeDeleted[i], 0 ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::RunL -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::RunL() - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::RunL\ - status = %d"), iStatus.Int() )); - switch( iStatus.Int() ) - { - case EPreProcessingStarted: - { - CheckFillListsL(); - CompleteRequest( EFillRulesLoaded ); - break; - } - case EQueryFailed: - { - // Error condition what about now... - TRACE(Print(_L("[FILL MNGR]\t EQueryFailed"))); - if( KErrNone < iRuleArray.Count() ) - { - iRuleArray.Remove(0); - iRuleArray.Compress(); - } - TRACE(Print(_L("[FILL MNGR]\t Jump to next rule"))); - CompleteRequest( ENextFillRule ); - break; - } - case EQueryCompleted: - { - // Select needed amount of Fill rules metadata objects - if( KErrNone < iRuleArray.Count() ) - { - SelectFillListFiles( iFileIds, iRuleArray[0]->ListId() ); - iAllItemCount = iFileIds.Count(); - TRACE(Print(_L("[FILL MNGR]\t Already on the list = %d"), - iAllItemCount )); - CompleteRequest( EProcessDuplicates ); - } - else - { - ResetData(); - DeleteWrapper(); - iObserver->FillRuleProcessingStatus(ENoObjectsSelected); - } - break; - } - case ENextFillRule: - { - // Start processing next fill rule - if( KErrNone < iRuleArray.Count() ) - { - LoadMetadataL(iRuleArray[0]); - } - else - { - TRACE(Print(_L("[FILL MNGR]\t Rule array empty"))); - UpdateFillItems(); - ResetData(); - DeleteWrapper(); -#ifdef _DEBUG - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE(Print(_L("[FILL MNGR]\t preprocess end heap \ - allocsize %d, size %d, cells %d"), alloc, size, cells )); -#endif - iObserver->FillRuleProcessingStatus(EProcessingReady); - } - break; - } - case EFillRulesLoaded: - { - LoadAllFillItemsL(); - CompleteRequest( EFillFilesLoaded ); - break; - } - case EFillFilesLoaded: - { - if( KErrNone < iRuleArray.Count() ) - { - LoadMetadataL( iRuleArray[0] ); - } - else - { - TRACE(Print(_L("[FILL MNGR]\t Rule array empty"))); - TRAP_IGNORE( CalculateAvgTransferTimeL() ); - SendAvgTransferTime(); - ResetData(); - DeleteWrapper(); - iObserver->FillRuleProcessingStatus(ENoRulesSelected); - } - break; - } - case EProcessDuplicates: - { - ProcessDuplicates(); - break; - } - case EProcessReferenceValues: - { - ProcessReferenceValuesL(); - break; - } - case EProcessStatusValues: - { - ProcessFileStatusValuesL() ; - break; - } - case ERandomizingStarted: - { - if( KErrNone < iRuleArray.Count() ) - { - LoadMetadataL( iRuleArray[0] ); - } - else - { - TRACE(Print(_L("[FILL MNGR]\t Rule array empty"))); - ResetData(); - DeleteWrapper(); - iObserver->FillRuleProcessingStatus(ENoRulesSelected); - } - break; - } - case EColumnDataReady: - { - DeleteWrapper(); - iObserver->FillRuleProcessingStatus(EColumnDataReady); - break; - } - case EUpdatePriorities: - { - DoUpdatePrioritiesL(); - break; - } - case EMetadataDeleted: - { - iObserver->FillRuleProcessingStatus( EMetadataDeleted ); - break; - } - default: - { - LOG(_L("[FILL MNGR]\t Fill rule processing RunL default")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::RunError -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -TInt CCmFmFillRuleFilledDataMngr::RunError( TInt aError ) -#else -TInt CCmFmFillRuleFilledDataMngr::RunError( TInt /*aError*/ ) -#endif - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::\ - RunError = %d"), aError )); - - iObserver->FillRuleProcessingStatus( EProcessingFailed ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DoCancel -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DoCancel() - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DoCancel()")); - } - -// --------------------------------------------------------------------------- -// CCmFmFillRuleFilledDataMngr::DoDeleteProcess -// --------------------------------------------------------------------------- -// -void CCmFmFillRuleFilledDataMngr::DoDeleteProcess( TInt aIndex ) - { - LOG(_L("[FILL MNGR]\t CCmFmFillRuleFilledDataMngr::DoDeleteProcess()")); - TBool delNew( ETrue ); - - //delete duplicated fill item - delete iItems[aIndex]; - iItems.Remove( aIndex ); - - //adjust iOldIds, and judge the item new item or old item - for( TInt i = 0; i < iOldIds.Count(); i++ ) - { - if( iOldIds[i] > aIndex ) - { - iOldIds[i] = iOldIds[i] - 1; - } - else if( iOldIds[i] == aIndex ) - { - delNew = EFalse; - iOldIds.Remove(i); - i--; - } - } - - //adjust iFileIds - for( TInt i = 0; i < iFileIds.Count(); i++ ) - { - if( iFileIds[i] > aIndex ) - { - iFileIds[i] = iFileIds[i] - 1; - } - else if( iFileIds[i] == aIndex ) - { - iFileIds.Remove(i); - i--; - } - } - - //count update - iAllItemCount--; - if( delNew ) - { - iNewItemCount--; - } - } - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmglxnotifier.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmglxnotifier.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +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: Gallery notifier -* -*/ - - - -#include -#include -#include -#include "cmfmglxnotifier.h" -#include "msdebug.h" - - -// --------------------------------------------------------------------------- -// CCmFmGlxNotifier::NewL -// --------------------------------------------------------------------------- -// -CCmFmGlxNotifier* CCmFmGlxNotifier::NewL( RFs& aFS ) - { - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewL() start")); - CCmFmGlxNotifier* self = CCmFmGlxNotifier::NewLC( aFS ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmGlxNotifier::NewLC -// --------------------------------------------------------------------------- -// -CCmFmGlxNotifier* CCmFmGlxNotifier::NewLC( RFs& aFS ) - { - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewLC() start")); - CCmFmGlxNotifier* self = new ( ELeave ) CCmFmGlxNotifier( ); - CleanupStack::PushL( self ); - self->ConstructL( aFS ); - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmGlxNotifier::~CCmFmGlxNotifier -// --------------------------------------------------------------------------- -// -CCmFmGlxNotifier::~CCmFmGlxNotifier() - { - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::~CCmFmGlxNotifier()")); - } - -// --------------------------------------------------------------------------- -// CCmFmGlxNotifier::CCmFmGlxNotifier -// --------------------------------------------------------------------------- -// -CCmFmGlxNotifier::CCmFmGlxNotifier( ) - { - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::CCmFmGlxNotifier()")); - } - -// --------------------------------------------------------------------------- -// CCmFmGlxNotifier::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmGlxNotifier::ConstructL( RFs& /*aFS*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::ConstructL()")); - } - -// --------------------------------------------------------------------------- -// CCmFmGlxNotifier::NotifyGalleryL -// --------------------------------------------------------------------------- -// -void CCmFmGlxNotifier::NotifyGalleryL( const TDesC& /*aFullPath*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NotifyGalleryL()")); - - MCLFContentListingEngine* clfEngine = - ContentListingFactory::NewContentListingEngineLC(); - - TRAP_IGNORE( clfEngine->UpdateItemsL() ); - - CleanupStack::PopAndDestroy(); // clfEngine - } - -// --------------------------------------------------------------------------- -// CCmFmGlxNotifier::NotifyGalleryL -// --------------------------------------------------------------------------- -// -void CCmFmGlxNotifier::NotifyGalleryL() - { - LOG(_L("[FILL MNGR]\t CCmFmGlxNotifier::NotifyGalleryL()")); - - MCLFContentListingEngine* clfEngine = - ContentListingFactory::NewContentListingEngineLC(); - - TRAP_IGNORE( clfEngine->UpdateItemsL() ); - - CleanupStack::PopAndDestroy(); // clfEngine - } - -// End of file - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmain.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmain.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1774 +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: Main class in the Fill manager component -* -*/ - - -#include -#include -#include -#include -#include "upnpavdevice.h" -#include "upnpavcontroller.h" -#include "upnpavdevicelist.h" -#include "upnpitem.h" -#include "upnpcontainer.h" -#include -#include -#include "cmserviceobserver.h" -#include "cmfmdownloadproxy.h" -#include "cmfmupnpmngr.h" -#include "cmfmfilldrivemngr.h" -#include "cmfmduplicatedetector.h" -#include "cmdriveinfo.h" -#include "cmfmfillrulefilleddatamngr.h" -#include "cmfmmpxnotifier.h" -#include "cmfmglxnotifier.h" -#include "cmfmcommon.h" -#include "cmdmmain.h" -#include "cmmmmain.h" -#include "cmfilllistitem.h" -#include "cmsqlpropertyitem.h" -#include "cmsqlpropertycontainer.h" -#include "cmfmmain.h" -#include "msdebug.h" - -const TUint8 KExtensionLength = 4; -const TInt KCmFmOneFile = 1; -const TInt KCmFmLengthOfRoot = 3; -const TInt KCmFmOneSecond = 1000000; -const TInt KArrayGranularity = 10; -const TInt KExtraSpace = 5; // space reserved for backslashes etc. -const TInt KDefaultCalculateSize = 100; - -_LIT16( KCmKorp, "<" ); -_LIT16( KCmProk, ">" ); -_LIT16( KCmQuotation, "\"" ); -_LIT16( KCmDoubleBackSlash, "\\" ); -_LIT16( KCmSlash, "/" ); -_LIT16( KCmStar, "*" ); -_LIT16( KCmPipe, "|" ); -_LIT16( KCmColon, ":"); -_LIT16( KCmQuestionMark, "?" ); -_LIT16( KCmUnderScore, "_" ); - -// --------------------------------------------------------------------------- -// CCmFmMain::NewL -// --------------------------------------------------------------------------- -// -CCmFmMain* CCmFmMain::NewL( MCmServiceObserver* aObserver, - CMdESession& aSession, CCmDmMain* aDBManager, - CCmMmMain* aMemManager ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::NewL() start")); - CCmFmMain* self = CCmFmMain::NewLC( aObserver, aSession, - aDBManager, aMemManager ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmMain::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::NewLC -// --------------------------------------------------------------------------- -// -CCmFmMain* CCmFmMain::NewLC( MCmServiceObserver* aObserver, - CMdESession& aSession, CCmDmMain* aDBManager, - CCmMmMain* aMemManager ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::NewLC() start")); - CCmFmMain* self = new ( ELeave ) CCmFmMain( aObserver, - aMemManager, aDBManager ); - CleanupStack::PushL( self ); - self->ConstructL( aSession, aDBManager ); - LOG(_L("[FILL MNGR]\t CCmFmMain::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::~CCmFmMain -// --------------------------------------------------------------------------- -// -CCmFmMain::~CCmFmMain() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::~CCmFmMain() start")); - if( IsActive() ) - { - Cancel(); - } - iFile.Close(); - iFsSession.Close(); - delete iCmFmFillDriveMngr; - delete iCmFmUpnpMngr; - - if( iDevices ) - { - iDevices->ResetAndDestroy(); - delete iDevices; - iDevices = NULL; - } - - delete iCmFmFillRuleFilledDataMngr; - delete iCmFmDownloadProxy; - delete iCmFmDuplicateDetector; - delete iCmFmGlxNotifier; - delete iCmFmMpxNotifier; - - ResetDeleteQueue(); - ResetItems(); - iFullPath.Zero(); - iDrives.ResetAndDestroy(); - iDrives.Close(); - LOG(_L("[FILL MNGR]\t CCmFmMain::~CCmFmMain() end")); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::CCmFmMain -// --------------------------------------------------------------------------- -// -CCmFmMain::CCmFmMain( MCmServiceObserver* aObserver, - CCmMmMain* aMemManager, CCmDmMain* aDBManager ) - : CActive( EPriorityStandard ), iObserver( aObserver ), - iMemManager( aMemManager ), iDbManager( aDBManager ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::CCmFmMain()")); - - CActiveScheduler::Add( this ); - iProgressInfo.iService = ECmServiceNone; - iProgressInfo.iProcessedItems = 0; - iProgressInfo.iItemsToTransferPerService = 0; - iProgressInfo.iTotalItems = 0; - iService = ECmServiceFill; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmMain::ConstructL( CMdESession& aSession, CCmDmMain* aDBManager ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ConstructL() start")); - - User::LeaveIfError( iFsSession.Connect() ); - User::LeaveIfError( iFsSession.ShareProtected() ); - iCmFmFillDriveMngr = CCmFmFillDriveMngr::NewL( iFsSession, iDrives ); - iCmFmUpnpMngr = CCmFmUpnpMngr::NewL( this ); - iCmFmFillRuleFilledDataMngr = - CCmFmFillRuleFilledDataMngr::NewL( this, aDBManager, iItems ); - iCmFmDownloadProxy = CCmFmDownloadProxy::NewL( ); - iCmFmDuplicateDetector = CCmFmDuplicateDetector::NewL( *this, aSession ); - iCmFmGlxNotifier = CCmFmGlxNotifier::NewL( iFsSession ); - iCmFmMpxNotifier = CCmFmMpxNotifier::NewL( ); - LOG(_L("[FILL MNGR]\t CCmFmMain::ConstructL() end")); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::StartFillL -// --------------------------------------------------------------------------- -// -void CCmFmMain::StartFillL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::StartFillL()")); - - iDbManager->GetProgressInfo( iProgressInfo.iProcessedItems, - iProgressInfo.iTotalItems ); - iProgressInfo.iItemsToTransferPerService = - iDbManager->FillFileCount( ECmToBeShrinked|ECmToBeFilled ); - iService = ECmServiceFill; - iProgressInfo.iService = ECmServiceFill; - iTempIndex = 0; - SendProgressInfo( KErrNone ); - LoadDrivesL(); - CompleteRequest( ECmFmMMCCheckStarted ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmFmMain::CancelOperation() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::CancelOperation()")); - - // Destroy all active objects - iCmFmUpnpMngr->CancelOperation(); - iCmFmFillRuleFilledDataMngr->CancelOperation(); - iCmFmDownloadProxy->CancelOperation(); - LOG(_L("[FILL MNGR]\t Filling => Update items to database")); - if( KErrNone < iItems.Count() ) - { - iCmFmFillRuleFilledDataMngr->UpdateFillItems( ETrue ); - } - if( KErrNone < iToBeDeleted.Count() ) - { - iCmFmFillRuleFilledDataMngr->UpdateToBeDeleted( iToBeDeleted ); - } - UpdateDrives(); - - // File fetching was ongoing => have to notify gallery - // about deleted file - if( iFetchingFile && iIndex < iItems.Count() ) - { - iFsSession.Delete( iFullPath ); - TRAP_IGNORE( iCmFmGlxNotifier->NotifyGalleryL( iFullPath ) ); - } - - // Update UI information - TRAPD( err, iCmFmFillRuleFilledDataMngr->CalculateAvgTransferTimeL() ); - if( err ) - { - TRACE(Print(_L("[FILL MNGR]\t CancelOperation error = %d"), err )); - } - - iCmFmFillRuleFilledDataMngr->SendAvgTransferTime(); - iCmFmFillRuleFilledDataMngr->ResetData(); - Cancel(); - iObserver->ServiceExecuted( iService, KErrCancel ); - if( iProgressInfo.iService != ECmServiceNone ) - { - // Service finished. Reset progress info. - iProgressInfo.iService = ECmServiceNone; - SendProgressInfo( KErrNone ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::PreProcessListsL -// --------------------------------------------------------------------------- -// -void CCmFmMain::PreProcessListsL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::PreProcessListsL()")); - - if( KErrNone == iDbManager->FillFileCount( - ECmToBeShrinked|ECmToBeFilled|ECmToBeRemoved|ECmFilled ) ) - { - // Set used fill space to zero - InitializeDriveQuotasL(); - } - iService = ECmServicePreProcessingFill; - - TRAPD( err, iCmFmFillRuleFilledDataMngr->LoadProfileIdsL() ); - - if( err ) - { - iObserver->ServiceExecuted( iService, KErrNone ); - } - - SetMmcQuotaL(); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::PreProcessListL -// --------------------------------------------------------------------------- -// -void CCmFmMain::PreProcessListL( const TDesC8& aFillListName ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::PreProcessListL()")); - - if( KErrNone == iDbManager->FillFileCount( - ECmToBeShrinked|ECmToBeFilled|ECmToBeRemoved|ECmFilled ) ) - { - // Set used fill space to zero - InitializeDriveQuotasL(); - } - iService = ECmServicePreProcessingFilllist; - TRAPD( err, - iCmFmFillRuleFilledDataMngr->PreProcessListL( aFillListName) ); - if( err ) - { - TRACE(Print(_L("[FILL MNGR]\t PreProcessListL err = %d"), err )); - iObserver->ServiceExecuted( iService, KErrNone ); - } - - SetMmcQuotaL(); - - } - -// --------------------------------------------------------------------------- -// CCmFmMain::GetColItemsL -// --------------------------------------------------------------------------- -// -void CCmFmMain::GetColItemsL( TCmMetadataField /*aType*/, - TCmMediaType /*aMedia*/, CDesCArray& /*aArray*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::GetColItemsL()")); - - iService = ECmServiceGetFillFields; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::GetMetadataItemsL -// --------------------------------------------------------------------------- -// -void CCmFmMain::GetMetadataItemsL( - CCmSqlPropertyCollector& aPropertys ) - - { - LOG(_L("[FILL MNGR]\t CCmFmMain::GetMetadataItemsL()")); - - iService = ECmServiceGetFillFields; - iCmFmFillRuleFilledDataMngr->GetMetadataItemsL( aPropertys ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::GetColItemsL -// --------------------------------------------------------------------------- -// -void CCmFmMain::GetColItemsL( TCmMetadataField aType, - TCmMediaType aMedia, CCmSqlPropertyContainer& aPropertys ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::GetColItemsL()")); - - iService = ECmServiceGetFillFields; - iCmFmFillRuleFilledDataMngr->GetColItemsL( aType, aMedia, aPropertys ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::SetAvController -// --------------------------------------------------------------------------- -// -void CCmFmMain::SetAvController( MUPnPAVController* aAVController ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::SetAvController()")); - - iAvController = aAVController; - iCmFmUpnpMngr->SetAvController( aAVController ); - iCmFmDownloadProxy->CancelOperation( ); - ResetItemInfo(); - iDrives.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::UpdatePriorities -// --------------------------------------------------------------------------- -// -void CCmFmMain::UpdatePriorities() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::UpdatePriorities()")); - - iCmFmFillRuleFilledDataMngr->UpdatePriorities(); - iService = ECmServiceUpdateFillLists; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::UpdateRefIds -// --------------------------------------------------------------------------- -// -void CCmFmMain::UpdateRefIds() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::UpdateRefIds()")); - - TRAPD( err, iCmFmFillRuleFilledDataMngr->DoUpdateReferenceIdsL() ); - if( err ) - { - TRACE(Print(_L("[FILL MNGR]\t UpdateRefIds err = %d"), err )); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::DeleteMetadataL -// --------------------------------------------------------------------------- -// -void CCmFmMain::DeleteMetadataL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::DeleteMetadataL()")); - - iCmFmFillRuleFilledDataMngr->DeleteMetadataL(); - iService = ECmServiceDeleteMetadata; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::SetMmcQuotaL -// --------------------------------------------------------------------------- -// -void CCmFmMain::SetMmcQuotaL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::SetMmcQuotaL()")); - - LoadDrivesL(); - TInt64 quota( KErrNone ); - for( TInt i = 0 ; i < iDrives.Count(); i++ ) - { - if( quota < iDrives[i]->DriveQuota() ) - { - quota = iDrives[i]->DriveQuota(); - } - } - iDrives.ResetAndDestroy(); - TRACE(Print(_L("[FILL MNGR]\t Max fill list size in bytes = %ld"), - quota )); - iCmFmFillRuleFilledDataMngr->SetMemoryCardQuota( quota ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::FillRuleProcessingStatus -// --------------------------------------------------------------------------- -// -void CCmFmMain::FillRuleProcessingStatus( TCmFmFillRuleProcessing aStatus ) - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::\ - FillRuleProcessingStatus status = %d"), (TInt)aStatus )); - - switch( aStatus ) - { - case EProcessingReady: - { - iObserver->ServiceExecuted( iService, - KErrNone ); - break; - } - case ENoRulesSelected: // fall through - case ENoObjectsSelected: // fall through - case EColumnDataReady: // fall through - case EDoUpdatePriorities: // fall through - case EMetadataDeleted: - { - // Finish fill operation - iObserver->ServiceExecuted( iService, KErrNone ); - break; - } - case EProcessingCanceled: - { - break; - } - case EProcessingFailed: - { - iObserver->ServiceExecuted( iService, - KErrUnknown ); - break; - } - default: - { - LOG(_L("[FILL MNGR]\t Wrong status in Fill rule processing")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::TransferStatus -// --------------------------------------------------------------------------- -// -void CCmFmMain::TransferStatus( TCmFmTransferStatus aStatus, TInt aSessionId, - TInt aInternalItemId, TInt aError, TInt64 aFSize ) - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::TransferStatus status = %d \ - error = %d"), (TInt)aStatus, (TInt)aError )); - - TInt err( KErrNone ); - switch( aStatus ) - { - case ECmFmFileFetchStarted: - { - if( !aError ) - { - TRACE(Print(_L("[FILL MNGR]\t File download started!"))); - iFetchingFile = ETrue; - } - else if( KErrDisconnected == aError ) - { - TransferStatus( ECmFmFileFetched, aSessionId, 0, - aError, 0 ); - } - else - { - ProceedWithNextItem( ECmFmCheckItem ); - } - break; - } - case ECmFmFileFetched: - { - iFetchingFile = EFalse; - iFile.Close(); - if( !aError ) - { - TTime fetchFinished; - fetchFinished.HomeTime(); - TTimeIntervalMicroSeconds usecsFrom = - fetchFinished.MicroSecondsFrom(iFileFetchStart); - TRACE(Print(_L("[FILL MNGR]\t File Fetch \ - took = %ld microseconds"), usecsFrom.Int64() )); - - // Update Fill quota - TInt64 fillSpace( KErrNone ); - fillSpace = iDrives[iDriveIndex]->UsedDriveQuota() + - ( aFSize * KKilo ); - UpdateDriveQuota( iDriveNumber, fillSpace ); - - TInt64 timeinsecs((TInt64)(usecsFrom.Int64()/KCmFmOneSecond)); - // Update transfer history information - iCmFmFillRuleFilledDataMngr->UpdateTransferHistoryData( - timeinsecs, aFSize, - iItems[iIndex]->DevId() ); - - // Update progress info - SendProgressInfo( KCmFmOneFile ); - - if( iItems[iIndex]->Status() == ECmToBeShrinked ) - { - // Let's update file status - TRAP( err, SetStatusL( aInternalItemId ) ); - TRACE(Print(_L("[FILL MNGR]\t SetStatusL err = %d"), err)); - CompleteRequest( ECmFmShrinkImage ); - } - else - { - TRAP( err, ReplaceFileL( iItems[iIndex]->Path() ) ); - TRACE(Print(_L("[FILL MNGR]\t ReplaceFileL err = %d"), - err)); - TRAP_IGNORE( iCmFmGlxNotifier->NotifyGalleryL( iFullPath ) ); - if( iItems[iIndex]->MediaType() == ECmAudio ) - { - TRAP( err, iCmFmMpxNotifier->NotifyMpxL( - iFullPath, iCmFmUpnpMngr->UpnpItem() ) ); - TRACE(Print(_L("[FILL MNGR]\t NotifyMpxL err = %d"), - err)); - } - else - { - TRACE(Print(_L("[FILL MNGR]\t Image or video file"))); - } - // Let's update file status to filled - TRAP( err, SetStatusL( aInternalItemId ) ); - TRACE(Print(_L("[FILL MNGR]\t SetStatusL err = %d"), err)); - // Jump to next file => Update item index - ProceedWithNextItem( ECmFmCheckItem ); - } - } - else if( KErrDisconnected == aError ) - { - // Close used session: wlan connection lost or - // used media server disappeared - if( iCmFmDownloadProxy->CloseDownloadSession( aSessionId ) ) - { - // Continue if some sessions still available - if( !IsActive() ) - { - ProceedWithNextItem( ECmFmCheckItem ); - } - } - else - { - // Update item information into db - if( KErrNone < iItems.Count() ) - { - iCmFmFillRuleFilledDataMngr->UpdateFillItems(); - } - if( KErrNone < iToBeDeleted.Count() ) - { - iCmFmFillRuleFilledDataMngr->UpdateToBeDeleted( - iToBeDeleted ); - } - UpdateDrives(); - // Finish filling if connection to all sessions lost - iObserver->ServiceExecuted( iService, KErrGeneral ); - } - } - else - { - ProceedWithNextItem( ECmFmCheckItem ); - } - break; - } - default: - { - LOG(_L("[FILL MNGR]\t Wrong status in transfer")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::URICheckResult -// --------------------------------------------------------------------------- -// -void CCmFmMain::URICheckResult( TCmFmUriCheckResult aStatus, - const CUpnpItem* aItem, const CUpnpElement* aRes ) - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::URICheckResult status = %d"), - (TInt)aStatus )); - - switch( aStatus ) - { - case ECanceled: - { - // Finish operation - iIndex = iItems.Count(); - CompleteRequest( ECmFmCheckItem ); - break; - } - case ENoUriAvailable: - { - // No uri available => Jump to next item - ProceedWithNextItem( ECmFmCheckItem ); - break; - } - case EUriChecked: - { - TRAPD( err, SetUriL( ) ); - TRACE(Print(_L("[FILL MNGR]\t SetUriL err = %d"), err )); - TInt error( KErrNone ); - TRAP( err, error = ParseFullPathL() ); - TRACE(Print(_L("[FILL MNGR]\t ParseFullPathL err=%d"), err )); - if( KErrNone == error && - iItems[iIndex]->Uri().Length() != KErrNone ) - { - iFullPath.Zero(); - TRAP( err, PrivatePathL( ) ); - TRACE(Print(_L("[FILL MNGR]\t PrivatePathL err=%d"), err )); - error = CreateRFile( iFullPath ); - TRACE(Print(_L("[FILL MNGR]\t CreateRFile error = %d"), - error )); - if( !error ) - { - iFileFetchStart.HomeTime(); - TRAP( error, iCmFmDownloadProxy->FetchFileL( this, - iAvController, iDevices, *aRes, *aItem, - iFile, CheckServerIndex( *iUuid, *iDevices ), - iItems[iIndex]->DbId() ) ); - TRACE(Print(_L("[FILL MNGR]\t FetchFileL error = %d"), - error)); - } - if( error ) - { - TRACE(Print(_L("[FILL MNGR]\t Error = %d"), error )); - ProceedWithNextItem( ECmFmCheckItem ); - } - } - else - { - ProceedWithNextItem( ECmFmCheckItem ); - } - break; - } - default: - { - LOG(_L("[FILL MNGR]\t Wrong URI check value")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::Duplicate -// --------------------------------------------------------------------------- -// -void CCmFmMain::DuplicateL( const TBool aDuplicate ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::Duplicate()")); - - if( !aDuplicate ) - { - // Not duplicate - CompleteRequest( ECmFmStartUriCheck ); - } - else - { - TInt index( iIndex ); - // Duplicate => skip item and check next one - ProceedWithNextItem( ECmFmCheckItem ); - - if ( index < iItems.Count() ) - { - // Update status of duplicate item to filled - iItems[index]->SetStatus( ECmFilled ); - RPointerArray items; - CleanupClosePushL( items ); - items.AppendL( iItems[index] ); - iDbManager->UpdateStatusValues( items ); - items.Reset(); - CleanupStack::PopAndDestroy( &items ); - - // Update transfer info - TInt count( KErrNone ); - TInt time( KErrNone ); - iDbManager->GetTransferInfo( ECmServiceFill, count, time ); - iProgressInfo.iItemsToTransferPerService = - iDbManager->FillFileCount( ECmToBeShrinked|ECmToBeFilled ); - iDbManager->UpdateTransferInfo( ECmServiceFill, - iProgressInfo.iItemsToTransferPerService, time ); - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::DeleteCompleteL -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -void CCmFmMain::DeleteCompleteL( TInt aErr ) -#else -void CCmFmMain::DeleteCompleteL( TInt /*aErr*/ ) -#endif - { - TRACE(Print(_L("[FILL MNGR]\t DeleteCompleteL err = %d"), aErr )); - //this function is called back by CmMmMain - //after all array is be deleted or cancel - for( TInt i = iToBeDeleted.Count() - 1; i >= 0; i-- ) - { - if ( KErrNone == iToBeDeleted[i]->RefId() ) - { - delete iToBeDeleted[i]; - iToBeDeleted.Remove( i ); - } - } - iToBeDeleted.Compress(); - CompleteRequest( ECmFmCheckItem ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ShrinkCompleteL -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -void CCmFmMain::ShrinkCompleteL( TInt aErr ) -#else -void CCmFmMain::ShrinkCompleteL( TInt /*aErr*/ ) -#endif - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::\ - ShrinkCompleteL err = %d"), aErr )); - - ReplaceFileL( iItems[iIndex]->Path() ); - iCmFmGlxNotifier->NotifyGalleryL( iFullPath ); - ProceedWithNextItem( ECmFmCheckItem ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::RunL -// --------------------------------------------------------------------------- -// -void CCmFmMain::RunL() - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::\ - RunL status = %d"), iStatus.Int() )); - - switch( iStatus.Int() ) - { - case ECmFmMMCCheckStarted: - { - // Update updated drive array into database - UpdateDrives(); - // Check first Drive Id - CompleteRequest( iCmFmFillDriveMngr->CheckDriveId() ); - break; - } - case ECmFmWrongMMC: - { - // Error Wrong MMC - iObserver->ServiceExecuted( iService, KErrNone ); - break; - } - case ECmFmMMCOk: - { - HandleIfMmcOkL(); - break; - } - case ECmFmMMCCheckFailed: - { - // Error MMC check failed - iObserver->ServiceExecuted( iService, KErrNone ); - break; - } - case ECmFmStartUriCheck: - { - if( iIndex < iItems.Count() && - ECmFilled != iItems[iIndex]->Status() && - ECmLocalCopy != iItems[iIndex]->Status() && - KErrNone == iItems[iIndex]->RefId() && - ECmSelected == iItems[iIndex]->Selected() ) - { - DoUriCheckL(); - } - else - { - ProceedWithNextItem( ECmFmCheckItem ); - } - break; - } - case ECmFmBrowseReady: - { - TRAP_IGNORE( SetUriL() ); - CompleteRequest( ECmFmUriOK ); - break; - } - case ECmFmCheckItem: - { - if( iIndex < iItems.Count() ) - { - TBool checkneed( EFalse ); - if( iIndex < iItems.Count() && - ECmFilled != iItems[iIndex]->Status() && - ECmLocalCopy != iItems[iIndex]->Status() && - KErrNone == iItems[iIndex]->RefId() && - ECmSelected == iItems[iIndex]->Selected() ) - { - TRAPD( err, - iCmFmDuplicateDetector->CheckItemL( *iItems[iIndex] ) ); - if( !err ) - { - checkneed = ETrue; - } - } - if( !checkneed ) - { - // Error occurred => Jump to next item - ProceedWithNextItem( ECmFmCheckItem ); - } - } - else - { - StopItemCheck(); - iObserver->ServiceExecuted( iService, KErrNone ); - } - break; - } - case ECmFmDeleteFiles: - { - HandleIfDeleteFilesL(); - break; - } - case ECmFmShrinkImage: - { - ResetDeleteQueue(); - iArray = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); - iArray->AppendL( iFullPath ); - // Let's ensure that fill manager is set as a observer - iMemManager->SetObserver( *this ); - iMemManager->ShrinkImagesL( *iArray ); - break; - } - default: - { - // NOT HERE -> Panic - LOG(_L("[FILL MNGR]\t RunL default")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::DoCancel -// --------------------------------------------------------------------------- -// -void CCmFmMain::DoCancel() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::DoCancel()")); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::RunError -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -TInt CCmFmMain::RunError( TInt aError ) -#else // _DEBUG -TInt CCmFmMain::RunError( TInt /*aError*/ ) -#endif // _DEBUG - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::RunError = %d"), aError )); - - iObserver->ServiceExecuted( iService, KErrNone ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::HandleIfMmcOkL -// --------------------------------------------------------------------------- -// -void CCmFmMain::HandleIfMmcOkL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::HandleIfMmcOkL()")); - - iIndex = KErrNone; - iCmFmFillRuleFilledDataMngr->GetFillItemsL(); - iCmFmFillRuleFilledDataMngr->GetToBeDeletedL(iToBeDeleted); - if ( iDevices ) - { - iDevices->ResetAndDestroy(); - delete iDevices; - iDevices = NULL; - } - TRAPD( err, iCmFmUpnpMngr->GetMediaServersL( iDevices ) ); - TRACE(Print(_L("[FILL MNGR]\t GetMediaServersL err = %d"), err )); - if( err ) - { - iObserver->ServiceExecuted( iService, KErrNone ); - } - else - { -#ifdef _DEBUG - LogServers(); -#endif - if( !iDevices->Count() ) - { - TRACE(Print(_L("[FILL MNGR]\t No devices selected"))); - iObserver->ServiceExecuted( iService, KErrNotFound ); - ResetItems(); - } - else - { - // If some of needed servers is available and there is items to - // be transfered => Start fill - if( NeededServerAvailableL() && - iProgressInfo.iItemsToTransferPerService ) - { - CompleteRequest( ECmFmDeleteFiles ); - } - else - { - TRACE(Print(_L("[FILL MNGR]\t No needed server available"))); - TRACE(Print(_L("[FILL MNGR]\t Or no items to be transfered."))); - TInt errorCode( KErrNone ); - if( 0 != iProgressInfo.iItemsToTransferPerService ) - { - errorCode = KErrNotFound; - } - iObserver->ServiceExecuted( iService , errorCode ); - ResetItems(); - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::HandleIfDeleteFilesL -// --------------------------------------------------------------------------- -// -void CCmFmMain::HandleIfDeleteFilesL() - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMain::ECmFmDeleteFiles, iIndex = %d"), - iIndex )); - ResetDeleteQueue(); - AddFilesToDeleteQueueL(); - if( KErrNone != iArray->Count() ) - { - iMemManager->SetObserver( *this ); - iMemManager->DeleteFilesL( *iArray ); - } - else - { - iCmFmDuplicateDetector->ResetArray(); - CompleteRequest( ECmFmCheckItem ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::CompleteRequest -// --------------------------------------------------------------------------- -// -void CCmFmMain::CompleteRequest( - TCmFmStatus aStatus ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::CompleteRequest()")); - - __ASSERT_DEBUG(!IsActive(),\ - User::Panic( KCmFmFillManager, KErrInUse )); - SetActive(); - TRequestStatus* pStatus = &iStatus; - User::RequestComplete( pStatus, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ProceedWithNextItem -// --------------------------------------------------------------------------- -// -void CCmFmMain::ProceedWithNextItem( TCmFmStatus aStatus ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ProceedWithNextItem()")); - - __ASSERT_DEBUG(!IsActive(),\ - User::Panic( KCmFmFillManager, KErrInUse )); - iIndex++; - SetActive(); - TRequestStatus* pStatus = &iStatus; - User::RequestComplete( pStatus, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::DoUriCheckL -// --------------------------------------------------------------------------- -// -void CCmFmMain::DoUriCheckL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::DoUriCheckL()")); - - ResetItemInfo(); - TInt ret( KErrNone ); - if( iIndex < iItems.Count() ) - { - ret = iCmFmFillRuleFilledDataMngr->GetUuidL( iUuid, - iItems[iIndex]->DevId() ); - } - else - { - ret = KErrNotFound; - } - // Check if file fits to mmc - iDriveIndex = iCmFmFillDriveMngr->CheckFreeDiscSpace( - iItems[iIndex]->Size(), iDriveId, iDriveNumber ); - iItems[iIndex]->SetDriveNumber( iDriveNumber ); - iItems[iIndex]->SetDriveId( iDriveId ); - if( ( KErrNone == ret ) && - ( KErrNone < iDevices->Count() ) && iDriveNumber != -1 ) - { - TBool found(EFalse); - TInt index(0); - for( TInt i = 0; i < iDevices->Count() && !found && - iUuid ; i++ ) - { - if( KErrNotFound != (((*iDevices)[i]->Uuid()).Match(*iUuid) ) ) - { - found = ETrue; - index = i; - TRACE(Print(_L("[FILL MNGR]\t device found= %d"), index )); - } - } - if( found ) - { - TRAPD( error, iCmFmUpnpMngr->CheckURIL( (*iDevices)[index], - *iItems[ iIndex ]) ); - if( error ) - { - TRACE(Print(_L("[FILL MNGR]\t Uri check failed..."))); - ProceedWithNextItem( ECmFmCheckItem ); - } - } - else - { - // Jump to next item - TRACE(Print(_L("[FILL MNGR]\t Device not found"))); - ProceedWithNextItem( ECmFmCheckItem ); - } - } - else if( KErrNotFound == ret ) - { - // Jump to next item - TRACE(Print(_L("[FILL MNGR]\t Media server not in db"))); - ProceedWithNextItem( ECmFmCheckItem ); - } - else if( iDriveNumber == -1 && KErrNone < iToBeDeleted.Count() ) - { - // Jump to next item - TRACE(Print(_L("[FILL MNGR]\t FILE TOO BIG OR NO DRIVES SELECTED"))); - ProceedWithNextItem( ECmFmCheckItem ); - } - else - { - ProceedWithNextItem( ECmFmCheckItem ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ParseFullPathL -// --------------------------------------------------------------------------- -// -TInt CCmFmMain::ParseFullPathL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ParseFullPathL()")); - - iFullPath.Zero(); - TInt ret( KErrNone ); - if( iIndex < iItems.Count() ) - { - HBufC* temp = ResolveAndAppendRootPathL( iDriveNumber ); - CleanupStack::PushL( temp ); - - iFullPath.Append( *temp ); - - CleanupStack::PopAndDestroy( temp ); - - if( ECmAudio == iItems[iIndex]->MediaType() ) - { - iFullPath.Append( PathInfo::SoundsPath() ); - } - else if( ECmVideo == iItems[iIndex]->MediaType() ) - { - iFullPath.Append( PathInfo::VideosPath() ); - } - else if( ECmImage == iItems[iIndex]->MediaType() ) - { - iFullPath.Append( PathInfo::ImagesPath() ); - } - else - { - // Not supported upnp class use OthersPath - iFullPath.Append( PathInfo::OthersPath() ); - } - ret = ParseFileNameL(); - } - else - { - ret = KErrNotFound; - } - return ret; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ParseFileNameL -// --------------------------------------------------------------------------- -// -TInt CCmFmMain::ParseFileNameL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ParseFileNameL()")); - - TInt index(0); - TInt ret( KErrNone ); - if( KErrNone != iItems[iIndex]->Uri().Length() ) - { - const TChar slash( '/' ); - index = iItems[iIndex]->Uri().LocateReverse( slash ); - if( KErrNotFound < index && KErrNone != - iItems[iIndex]->PrimaryText().Length() ) - { - HBufC* data16bitBuf = RemoveIllegalFilenameCharactersL( - iItems[iIndex]->PrimaryText() ); - TBuffileExtension; - fileExtension.Zero(); - TInt conversionError = CnvUtfConverter:: - ConvertToUnicodeFromUtf8(fileExtension, - iItems[iIndex]->Uri().Mid( - (iItems[iIndex]->Uri().Length() - - KExtensionLength), KExtensionLength) ); - - if( conversionError ) - { - ret = KErrGeneral; - } - else if ( ( iFullPath.Length() + - data16bitBuf->Length() + fileExtension.Length() ) < - KMaxFileName ) - { - iFullPath.Append(*data16bitBuf); - iFullPath.Append(fileExtension); - iItems[iIndex]->SetPathL( - iFullPath.Mid( KCmFmLengthOfRoot ) ); - iItems[iIndex]->SetDriveNumber( iDriveNumber ); - iItems[iIndex]->SetDriveId( iDriveId ); - iFullPath.Zero(); - } - else - { - iFullPath.Append( data16bitBuf->Left( - KMaxFileName - iFullPath.Length() - - fileExtension.Length() - KExtraSpace ) ); - - iFullPath.Append(fileExtension); - iItems[iIndex]->SetPathL( - iFullPath.Mid( KCmFmLengthOfRoot ) ); - iItems[iIndex]->SetDriveNumber( iDriveNumber ); - iItems[iIndex]->SetDriveId( iDriveId ); - iFullPath.Zero(); - } - delete data16bitBuf; - data16bitBuf = NULL; - } - } - else - { - LOG(_L("[FILL MNGR]\t File name parsing, compose failed)")); - ret = KErrGeneral; - } - return ret; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::SetUriL -// --------------------------------------------------------------------------- -// -void CCmFmMain::SetUriL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::SetUriL()")); - - if( iIndex < iItems.Count() ) - { - iItems[iIndex]->SetUriL( iCmFmUpnpMngr->Uri() ); - } - LOG(_L("[FILL MNGR]\t SetUriL end")); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::LogServers -// --------------------------------------------------------------------------- -// -void CCmFmMain::LogServers() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::LogServers()")); - - for( TInt i = 0; i < iDevices->Count(); i++ ) - { - TBuftemp; - if((*iDevices)[i]) - { - if( &(*iDevices)[i]->Uuid()) - { - if( (*iDevices)[i]->Uuid().Length() < KMaxName ) - { - temp.Copy( (*iDevices)[i]->Uuid() ); - TRACE(Print(_L("[FILL MNGR]\t FOUND DEVICE %d = %S"), - i+1, &temp )); - } - temp.Zero(); - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ResetItemInfo -// --------------------------------------------------------------------------- -// -void CCmFmMain::ResetItemInfo() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ResetItemInfo()")); - - if( iUuid ) - { - delete iUuid; - iUuid = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::SendProgressInfo -// --------------------------------------------------------------------------- -// -void CCmFmMain::SendProgressInfo( TInt aProgress ) - { - if ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems ) - { - iProgressInfo.iProcessedItems += aProgress; - iProgressInfo.iItemsToTransferPerService -= aProgress; - TCmProgressInfoPckg progressPckg( iProgressInfo ); - TRACE( Print( _L("[FILL MNGR]\t processed: %d total %d"), - iProgressInfo.iProcessedItems, iProgressInfo.iTotalItems) ); - - if ( ( iProgressInfo.iTotalItems <= iProgressInfo.iProcessedItems ) || - ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems && - iProgressInfo.iProcessedItems > 0 && - ( iProgressInfo.iProcessedItems - iTempIndex ) >= - iProgressInfo.iTotalItems / KDefaultCalculateSize ) - ) - { - iTempIndex = iProgressInfo.iProcessedItems; - TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, - progressPckg ); - TRACE( Print( _L("[FILL MNGR]\t RProperty::Set returned %d"), - err)); - } - else - { - LOG(_L("[FILL MNGR]\t progress small no need to pub&sub")); - } - } - - else - { - iProgressInfo.iProcessedItems += aProgress; - LOG(_L("[FILL MNGR]\t Bigger than 100%% or not beginning")); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::SetStatusL -// --------------------------------------------------------------------------- -// -void CCmFmMain::SetStatusL( const TInt64 aInternalItemId ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::SetStatusL()")); - - if( iIndex < iItems.Count() ) - { - iItems[iIndex]->SetStatus( ECmFilled ); - TUint id(iItems[iIndex]->DbId()); - for( TInt i = 0; i < iItems.Count(); i++ ) - { - // Set all reference items also filled - if( aInternalItemId == iItems[i]->RefId() && - iItems[i]->Selected() == ECmSelected ) - { - iItems[i]->SetStatus( ECmFilled ); - iItems[i]->SetPathL( iItems[iIndex]->Path() ); - iItems[i]->SetDriveId( iItems[iIndex]->DriveId() ); - iItems[i]->SetDriveNumber( iItems[iIndex]->DriveNumber() ); - } - } - // add to duplicatied detector - iCmFmDuplicateDetector->AppendToArrayL( *iItems[iIndex] ); - // Update statuses into db - iDbManager->UpdateFillTransferStatus( ECmFilled, iItems[iIndex] ); - TInt count( KErrNone ); - TInt time( KErrNone ); - iDbManager->GetTransferInfo( ECmServiceFill, count, time ); - - iDbManager->UpdateTransferInfo( ECmServiceFill, - iProgressInfo.iItemsToTransferPerService, time ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::RemoveIllegalFilenameCharactersL -// --------------------------------------------------------------------------- -// -HBufC* CCmFmMain::RemoveIllegalFilenameCharactersL( const TDesC& aFileName ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::RemoveIllegalFilenameCharactersL()")); - - HBufC* buf = aFileName.AllocLC(); - TPtr ptr = buf->Des(); - ReplaceCharsL( ptr, KCmProk(), KCmUnderScore() ); // > - ReplaceCharsL( ptr, KCmKorp(), KCmUnderScore() ); // < - ReplaceCharsL( ptr, KCmQuotation(), KCmUnderScore() ); // " - // \ character - ReplaceCharsL( ptr, KCmDoubleBackSlash(), KCmUnderScore() ); - ReplaceCharsL( ptr, KCmSlash(), KCmUnderScore() ); // / - ReplaceCharsL( ptr, KCmStar(), KCmUnderScore() ); // * - ReplaceCharsL( ptr, KCmPipe(), KCmUnderScore() ); // | - ReplaceCharsL( ptr, KCmColon(), KCmUnderScore() ); // : - ReplaceCharsL( ptr, KCmQuestionMark(), KCmUnderScore() );// question mark - CleanupStack::Pop(); // Can't pop by name, name invalid now - return buf; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ReplaceCharsL -// --------------------------------------------------------------------------- -// -void CCmFmMain::ReplaceCharsL( TDes& aString, const TDesC& aTrg, - const TDesC& aReplacement ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ReplaceCharsL()")); - - __ASSERT_DEBUG( aTrg != aReplacement, User::Panic( _L( "CmFm" ), 1) ); - TPtrC ptr( aString ); - TInt position( 0 ); - - TBool continueLoop = ETrue; - while ( continueLoop ) - { - TInt found = ptr.Find( aTrg ); - if( found < 0 ) - { - continueLoop = EFalse; - } - else - { - aString.Replace( position + found, aTrg.Length(), aReplacement ); - if( position + found + aReplacement.Length() < aString.Length() ) - { - position += found + aReplacement.Length(); - ptr.Set( aString.Mid( position ) ); - } - else - { - continueLoop = EFalse; - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::LoadDrivesL() -// --------------------------------------------------------------------------- -// -void CCmFmMain::LoadDrivesL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::LoadDrivesL()")); - - iDrives.ResetAndDestroy(); - iDbManager->PrepareQueryCmdL( EDrivesQuery ); - iDbManager->QueryDrivesL( iDrives ); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::UpdateDrives() -// --------------------------------------------------------------------------- -// -void CCmFmMain::UpdateDrives() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::UpdateDrives()")); - if ( 0 != iDrives.Count() ) - { - #ifdef _DEBUG - TRAPD( err, iDbManager->SetDrivesL( iDrives ) ); - TRACE(Print(_L("[FILL MNGR]\t drives update err = %d"), - err )); - #else // _DEBUG - TRAP_IGNORE( iDbManager->SetDrivesL( iDrives ) ); - #endif // _DEBUG - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ResolveAndAppendRootPath() -// --------------------------------------------------------------------------- -// -HBufC* CCmFmMain::ResolveAndAppendRootPathL( const TInt aDriveNumber ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ResolveAndAppendRootPathL()")); - - HBufC* buf = HBufC::NewLC( KExtensionLength ); - TChar driveChar; - iFsSession.DriveToChar( aDriveNumber, driveChar ); - buf->Des().Append( driveChar ); - buf->Des().Append( KCmColon ); - buf->Des().Append( KCmDoubleBackSlash ); - CleanupStack::Pop(); - return buf; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::UpdateDriveQuota() -// --------------------------------------------------------------------------- -// -void CCmFmMain::UpdateDriveQuota( const TInt aDriveNumber, - const TInt64 aQuota ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::UpdateDriveQuota()")); - - for( TInt i = 0 ; i < iDrives.Count(); i++ ) - { - if( iDrives[i]->DriveNumber() == aDriveNumber ) - { - iDrives[i]->SetUsedDriveQuota( aQuota ); - i = iDrives.Count(); - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::InitializeDriveQuotasL() -// --------------------------------------------------------------------------- -// -void CCmFmMain::InitializeDriveQuotasL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::InitializeDriveQuotasL()")); - - LoadDrivesL(); - for( TInt i = 0 ; i < iDrives.Count(); i++ ) - { - iDrives[i]->SetUsedDriveQuota( 0 ); - } - iDrives.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::GetUsedQuota() -// --------------------------------------------------------------------------- -// -TInt64 CCmFmMain::GetUsedQuota( const TInt aDriveNumber ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::GetUsedQuota()")); - - TInt64 quota( 0 ); - for( TInt i = 0; i < iDrives.Count(); i++ ) - { - if( iDrives[i]->DriveNumber() == aDriveNumber ) - { - quota = iDrives[i]->UsedDriveQuota(); - } - } - return quota; - } - -// ----------------------------------------------------------------------------- -// CCmFmMain::CreateRFile() -// ----------------------------------------------------------------------------- -// -TInt CCmFmMain::CreateRFile( const TDesC& aFilePath ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::CreateRFile()")); - - iFile.Close(); - TRACE(Print(_L("[FILL MNGR]\t Creating file : %S"), &aFilePath )); - TInt error(iFile.Create( iFsSession, aFilePath, EFileWrite )); - if( KErrAlreadyExists == error ) - { - TRACE(Print(_L("[FILL MNGR]\t Allready exists => delete old file") )); - error = iFsSession.Delete( aFilePath ); - error = iFile.Create( iFsSession, aFilePath, EFileWrite ); - } - TRACE(Print(_L("[FILL MNGR]\t CreateRFile err: %d"), error )); - return error; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::PrivatePathL -// --------------------------------------------------------------------------- -// -void CCmFmMain::PrivatePathL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::PrivatePathL()")); - - iFullPath.Zero(); - HBufC* temp = ResolveAndAppendRootPathL( iItems[ iIndex ]->DriveNumber() ); - CleanupStack::PushL( temp ); - iFullPath.Append( *temp ); - CleanupStack::PopAndDestroy( temp ); - - TFileName privatePath; - TInt err = iFsSession.PrivatePath( privatePath ); - if ( !err ) - { - iFullPath.Append( privatePath.Mid( 1 ) ); - - // Now the path contains everything but filename and extension - // => check that the directory exists. If not, it will be created. - // Possible error is ignored at the moment - // (normal case is KErrAlreadyExists) - err = iFsSession.MkDirAll( iFullPath ); - - iFullPath.Append( KCmFmTempFile() ); - } - LOG(_L("[FILL MNGR]\t CCmFmMain::PrivatePath() end")); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ReplaceFileL -// --------------------------------------------------------------------------- -// -void CCmFmMain::ReplaceFileL( const TDesC& aOriginal ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ReplaceFileL()")); - - HBufC* temp = ResolveAndAppendRootPathL( - iItems[ iIndex ]->DriveNumber() ); -// CleanupStack::PushL( temp ); - temp = temp->ReAllocL( temp->Length() + aOriginal.Length() ); - temp->Des().Append( aOriginal ); - - TInt error = iFsSession.Replace( iFullPath, *temp ); - if( error == KErrPathNotFound ) - { - error = iFsSession.MkDirAll( *temp ); - TRACE(Print(_L("[FILL MNGR]\t MkDir err: %d"), error )); - - error = iFsSession.Replace( iFullPath, *temp ); - TRACE(Print(_L("[FILL MNGR]\t MkDir err: %d"), error )); - } - iFullPath.Copy( *temp ); - delete temp; -// CleanupStack::PopAndDestroy( temp ); - - TRACE(Print(_L("[FILL MNGR]\t File Replace done err: %d"), error )); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::CheckServerIndex -// --------------------------------------------------------------------------- -// -TInt CCmFmMain::CheckServerIndex( const TDesC8& aUuid, - const CUpnpAVDeviceList& aList ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::CheckServerIndex()")); - - TInt index( KErrNotFound ); - for( TInt i = 0; i < aList.Count(); i++ ) - { - if( KErrNotFound != aList[i]->Uuid().Match( aUuid ) ) - { - index = i; - i = aList.Count(); - } - } - return index; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::NeededServerAvailableL -// --------------------------------------------------------------------------- -// -TBool CCmFmMain::NeededServerAvailableL( ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::NeededServerAvailableL()")); - - TBool available( EFalse ); - TInt index( 0 ); - for( TInt i = 0 ; i < iDevices->Count(); i++ ) - { - index = - iCmFmFillRuleFilledDataMngr->GetMediaServerIdL( - (*iDevices)[i]->Uuid() ); - if( index != KErrNotFound ) - { - available = ETrue; - i = iDevices->Count(); - LOG(_L("[FILL MNGR]\t Server available.")); - } - } - return available; - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ResetItems -// --------------------------------------------------------------------------- -// -void CCmFmMain::ResetItems() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ResetItems()")); - - iItems.ResetAndDestroy(); - iItems.Close(); - iToBeDeleted.ResetAndDestroy(); - iToBeDeleted.Close(); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::ResetDeleteQueue -// --------------------------------------------------------------------------- -// -void CCmFmMain::ResetDeleteQueue( ) - { - LOG(_L("[FILL MNGR]\t CCmFmMain::ResetDeleteQueue()")); - - if( iArray ) - { - iArray->Reset(); - delete iArray; - iArray = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::AddFilesToDeleteQueueL -// --------------------------------------------------------------------------- -// -void CCmFmMain::AddFilesToDeleteQueueL() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::AddFilesToDeleteQueueL()")); - - iArray = new ( ELeave ) CDesCArrayFlat( 10 ); - HBufC* temp = NULL; - TFileName path; - TInt64 totalSize( KErrNone ); - TBool drivechange( EFalse ); - for( TInt i = 0; i < iToBeDeleted.Count(); i++ ) - { - if( KErrNone == iToBeDeleted[i]->RefId() ) - { - drivechange = ETrue; - temp = ResolveAndAppendRootPathL( - iToBeDeleted[i]->DriveNumber() ); - path.Append( *temp ); - path.Append( iToBeDeleted[i]->Path() ); - iArray->AppendL( path ); - delete temp; - path.Zero(); - - totalSize = GetUsedQuota( - iToBeDeleted[i]->DriveNumber() ); - totalSize -= iToBeDeleted[i]->Size(); - UpdateDriveQuota( iToBeDeleted[i]->DriveNumber(), - totalSize ); - } - } - - if( drivechange ) - { - UpdateDrives(); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMain::StopItemCheck -// --------------------------------------------------------------------------- -// -void CCmFmMain::StopItemCheck() - { - if( KErrNone < iItems.Count() ) - { - iCmFmFillRuleFilledDataMngr->UpdateFillItems(); - } - if( KErrNone < iToBeDeleted.Count() ) - { - iCmFmFillRuleFilledDataMngr->UpdateToBeDeleted( - iToBeDeleted ); - } - iCmFmDownloadProxy->CancelOperation(); - iFullPath.Zero(); - if( iDevices ) - { - iDevices->ResetAndDestroy(); - } - delete iDevices; - iDevices = NULL; - UpdateDrives(); - iDrives.ResetAndDestroy(); - iToBeDeleted.ResetAndDestroy(); - ResetDeleteQueue(); - } - -// --------------------------------------------------------------------------- -// CCmFmMain::Close -// --------------------------------------------------------------------------- -// -void CCmFmMain::Close() - { - LOG(_L("[FILL MNGR]\t CCmFmMain::Close()")); - - delete this; - } - -// --------------------------------------------------------------------------- -// CompareById -// For sort. Sort is based on db id -// --------------------------------------------------------------------------- -// -TInt CCmFmMain::CompareById( const CCmFillListItem& aItem1, - const CCmFillListItem& aItem2 ) - { - TInt result = 0; - - if ( aItem1.DbId() < aItem2.DbId() ) - { - result = -1; - } - else if ( aItem1.DbId() > aItem2.DbId() ) - { - result = 1; - } - - return result; - } - -// --------------------------------------------------------------------------- -// CompareBySize -// For sort. Sort is based on item size -// --------------------------------------------------------------------------- -// -TInt CCmFmMain::CompareBySize( const CCmFillListItem& aItem1, - const CCmFillListItem& aItem2 ) - { - TInt result = 0; - - if ( aItem1.Size() < aItem2.Size() ) - { - result = -1; - } - else if ( aItem1.Size() > aItem2.Size() ) - { - result = 1; - } - - return result; - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmdeduplicatedetector.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmdeduplicatedetector.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,322 +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: Dublicate detector for images and videos -* -*/ - -#include -#include -#include -#include - -#include "cmfilllistitem.h" -#include "cmfmitemhandlerobserver.h" -#include "cmfmmdeduplicatedetector.h" -#include "cmfmmpxduplicatedetector.h" -#include "cmfmmain.h" -#include "msdebug.h" - - - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::NewL -// --------------------------------------------------------------------------- -// -CCmFmMdEDuplicateDetector* CCmFmMdEDuplicateDetector::NewL( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ) - { - LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewL() start")); - CCmFmMdEDuplicateDetector* self = - CCmFmMdEDuplicateDetector::NewLC( aObserver, aSession ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::NewLC -// --------------------------------------------------------------------------- -// -CCmFmMdEDuplicateDetector* CCmFmMdEDuplicateDetector::NewLC( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ) - { - LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewLC() start")); - CCmFmMdEDuplicateDetector* self = - new ( ELeave ) CCmFmMdEDuplicateDetector( aObserver, aSession ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::~CCmFmMdEDuplicateDetector -// --------------------------------------------------------------------------- -// -CCmFmMdEDuplicateDetector::~CCmFmMdEDuplicateDetector() - { - LOG(_L("[FILL MNGR]\t ~CCmFmMdEDuplicateDetector()")); - delete iTitle; - delete iDate; - delete iSize; - - delete iQuery; - delete iMediaTypeDef; - delete iObjectDef; - delete iNamespace; - delete iCheckItem; - iExistFiles.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::CCmFmMdEDuplicateDetector -// --------------------------------------------------------------------------- -// -CCmFmMdEDuplicateDetector::CCmFmMdEDuplicateDetector( - MCmFmItemHandlerObserver& aObserver, CMdESession& aSession ) - : iObserver( aObserver ), iSession( aSession ) - { - LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::\ - CCmFmMdEDuplicateDetector")); - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmMdEDuplicateDetector::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::ConstructL")); - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::CheckImageOrVideoL -// --------------------------------------------------------------------------- -// -void CCmFmMdEDuplicateDetector::CheckImageOrVideoL( - const CCmFillListItem& aItem ) - { - LOG(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::CheckImageOrVideoL")); - TCmMediaType theType = aItem.MediaType(); - if( iExistFiles.Count() > 0 && iCurrentMediaType == theType ) - { - CheckImageOrVideoLIfDuplicated( aItem ); - } - else - { - delete iCheckItem; - iCheckItem = NULL; - iCheckItem = CCmFillListItem::NewL(); - iCheckItem->SetPrimaryTextL( aItem.PrimaryText() ); - iCheckItem->SetSize( aItem.Size() ); - iCheckItem->SetDate( aItem.Date() ); - delete iQuery; - iQuery = NULL; - - if( !iNamespace ) - { - iNamespace = &iSession.GetDefaultNamespaceDefL(); - } - if( iNamespace ) - { - iObjectDef = - &iNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject ); - } - - iCurrentMediaType = theType; - if( ECmImage == theType || ECmOtherImage == theType ) - { - TRACE(Print(_L("ECmImage == aType"))); - iMediaTypeDef = - &iNamespace->GetObjectDefL( MdeConstants::Image::KImageObject ); - } - else if( ECmVideo == theType || ECmOtherVideo == theType ) - { - TRACE(Print(_L("ECmVideo == aType"))); - iMediaTypeDef = - &iNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject ); - } - else - { - User::Leave( KErrArgument ); - } - if( !iObjectDef || !iMediaTypeDef ) - { - User::Leave( KErrArgument ); - } - - iQuery = iSession.NewObjectQueryL( - *iNamespace, *iMediaTypeDef, this ); - if( !iQuery ) - { - User::Leave( KErrArgument ); - } - SetLogicConditionL( aItem ); - //iQuery->SetResultMode( EQueryResultModeId ); - iQuery->SetResultMode( EQueryResultModeItem ); - /** Start query, no need to query more than one item */ - iQuery->FindL(); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::HandleQueryNewResults -// --------------------------------------------------------------------------- -// -void CCmFmMdEDuplicateDetector::HandleQueryNewResults(CMdEQuery& aQuery, - TInt aFirstNewItemIndex, - TInt aNewItemCount) - { - TRACE(Print(_L("[FILL MNGR]\t CCmFmMdEDuplicateDetector::\ - HandleQueryNewResultsaNewItemCount %d"), aNewItemCount )); - CMdEObjectQuery& query = (CMdEObjectQuery &) aQuery; - iExistFiles.Reset(); - TRACE(Print(_L("[FILL MNGR]\t aNewItemCount %d"), aNewItemCount )); - if( &query ) - { - for ( TInt i = aFirstNewItemIndex; - i < aFirstNewItemIndex+aNewItemCount; - i++ ) - { - CCmFillListItem *itm = CCmFillListItem::NewLC(); - CMdEObject* object = (CMdEObject*)query.TakeOwnershipOfResult(i); - CMdEProperty* prop; - TInt propIndex = object->Property( *iTitle, prop ); - if( propIndex != KErrNotFound ) - { - CMdETextProperty* textprop = (CMdETextProperty*) prop; - itm->SetPrimaryTextL( textprop->Value() ); - } - else - { - TParsePtrC parser( object->Uri()); - itm->SetPrimaryTextL( parser.Name() ); - } - - propIndex = object->Property( *iSize, prop ); - if( propIndex != KErrNotFound ) - { - itm->SetSize( prop->Uint32ValueL() ); - } - iExistFiles.AppendL( itm ); - TRACE(Print(_L("[FILL MNGR]\t HandleQueryNewResults [%S][%d]"), - &itm->PrimaryText(), itm->Size() )); - CleanupStack::Pop( itm ); - } - - // sort by size - TLinearOrder key( CCmFmMain::CompareBySize ); - iExistFiles.Sort( key ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::HandleQueryCompleted -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -void CCmFmMdEDuplicateDetector::HandleQueryCompleted( CMdEQuery& /*aQuery*/, - TInt aError ) -#else -void CCmFmMdEDuplicateDetector::HandleQueryCompleted( CMdEQuery& /*aQuery*/, - TInt /*aError*/ ) -#endif - { - TRACE(Print(_L("[FILL MNGR]\t HandleQueryCompleted error = %d"), - aError )); - if( iCheckItem ) - { - CheckImageOrVideoLIfDuplicated( *iCheckItem ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::SetLogicConditionL -// --------------------------------------------------------------------------- -// -void CCmFmMdEDuplicateDetector::SetLogicConditionL( - const CCmFillListItem& /*aItem*/ ) - { - LOG(_L("[FILL MNGR]\t SetLogicConditionL")); - CMdELogicCondition& rootCondition = iQuery->Conditions(); - CMdELogicCondition* contentCondition = &rootCondition; - CMdELogicCondition& logicCondition = - contentCondition->AddLogicConditionL( ELogicConditionOperatorOr ); - logicCondition.AddObjectConditionL( *iMediaTypeDef ); - - iTitle = &iMediaTypeDef->GetPropertyDefL( - MdeConstants::Object::KTitleProperty ); - iSize = &iMediaTypeDef->GetPropertyDefL( - MdeConstants::Object::KSizeProperty ); - iDate = &iMediaTypeDef->GetPropertyDefL( - MdeConstants::Object::KCreationDateProperty ); - iQuery->AddPropertyFilterL( iTitle ); - iQuery->AddPropertyFilterL( iSize ); - iQuery->AddPropertyFilterL( iDate ); - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::CheckImageOrVideoLIfDuplicated -// --------------------------------------------------------------------------- -// -void CCmFmMdEDuplicateDetector::CheckImageOrVideoLIfDuplicated( - const CCmFillListItem& aItem ) - { - TInt count( iExistFiles.Count() ); - TBool dup( EFalse ); - for( TInt i = 0; i < count; i++ ) - { - if( iExistFiles[i]->Size() > aItem.Size() ) - { - //quit loop - i = count; - } - else if( iExistFiles[i]->Size() == aItem.Size() && KErrNone == - iExistFiles[i]->PrimaryText().CompareF( aItem.PrimaryText() ) ) - { - //quit loop - i = count; - dup = ETrue; - } - } - iObserver.DuplicateL( dup ); - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::AppendToArray -// --------------------------------------------------------------------------- -// -void CCmFmMdEDuplicateDetector::AppendToArrayL( const CCmFillListItem& aItem ) - { - CCmFillListItem* p = CCmFillListItem::NewLC(); - p->SetPrimaryTextL( aItem.PrimaryText() ); - p->SetSize( aItem.Size() ); - iExistFiles.AppendL( p ); - CleanupStack::Pop( p ); - - // sort by size - TLinearOrder key( CCmFmMain::CompareBySize ); - iExistFiles.Sort( key ); - } - -// --------------------------------------------------------------------------- -// CCmFmMdEDuplicateDetector::ResetArrayL -// --------------------------------------------------------------------------- -// -void CCmFmMdEDuplicateDetector::ResetArray() - { - iExistFiles.Reset(); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxduplicatedetector.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxduplicatedetector.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +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: Dublicate detector for music -* -*/ - -#include -#include // commonly used attribute keys -#include // container-specific attribute keys -#include // collection plugin types -#include "cmfilllistitem.h" -#include "cmfmitemhandlerobserver.h" -#include "cmfmmpxduplicatedetector.h" -#include "msdebug.h" - -const TUid KMpxLocalCollectionUid = { 0x101FFC3A }; -const TUid KCmServerUid = { 0x10281FA7 }; - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::NewL -// --------------------------------------------------------------------------- -// -CCmFmMpxDuplicateDetector* CCmFmMpxDuplicateDetector::NewL( - MCmFmItemHandlerObserver& aObserver ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewL() start")); - CCmFmMpxDuplicateDetector* self = - CCmFmMpxDuplicateDetector::NewLC( aObserver ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::NewLC -// --------------------------------------------------------------------------- -// -CCmFmMpxDuplicateDetector* CCmFmMpxDuplicateDetector::NewLC( - MCmFmItemHandlerObserver& aObserver ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewLC() start")); - CCmFmMpxDuplicateDetector* self = - new ( ELeave ) CCmFmMpxDuplicateDetector( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::~CCmFmMpxDuplicateDetector -// --------------------------------------------------------------------------- -// -CCmFmMpxDuplicateDetector::~CCmFmMpxDuplicateDetector() - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\ - ~CCmFmMpxDuplicateDetector()")); - CloseCollectionPlugin(); - } - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::CCmFmMpxDuplicateDetector -// --------------------------------------------------------------------------- -// -CCmFmMpxDuplicateDetector::CCmFmMpxDuplicateDetector( - MCmFmItemHandlerObserver& aObserver ) - : iObserver( aObserver ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\ - CCmFmMpxDuplicateDetector()")); - } - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::ConstructL()")); - - OpenCollectionPluginL(); - } - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::CheckMusicL -// --------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::CheckMusicL( const CCmFillListItem& aItem ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::CheckMusicL()")); - - CMPXMedia* criteria = CMPXMedia::NewL(); - CleanupStack::PushL( criteria ); - criteria->SetTObjectValueL( - KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid ); - criteria->SetTObjectValueL( - KMPXMediaGeneralType, EMPXItem ); - - criteria->SetTObjectValueL( - KMPXMediaGeneralCategory, EMPXSong ); - - // Set title, size and date to criteria - criteria->SetTextValueL( - KMPXMediaGeneralTitle, aItem.PrimaryText() ); - - criteria->SetTObjectValueL( - KMPXMediaGeneralSize, aItem.Size() ); - - criteria->SetTObjectValueL( - KMPXMediaGeneralDate, aItem.Date().Int64() ); - - // define attributes fetched - RArray attributes; - CleanupClosePushL( attributes ); - // add a dummy attribute because the query will fail if - // there are no attributes - attributes.AppendL( KMPXMediaGeneralId ); - - // now find - iCollectionUtility->Collection() - .FindAllL( *criteria , attributes.Array(), *this ); - CleanupStack::PopAndDestroy(); // attributes - CleanupStack::PopAndDestroy( criteria ); - } - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::OpenCollectionPluginL -// --------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::OpenCollectionPluginL( ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\ - OpenCollectionPluginL()")); - - iCollectionUtility = MMPXCollectionUtility::NewL( - (MMPXCollectionObserver*)this, KCmServerUid ); - // Fetch mpx/gallery collection collection UID - RArray uid; - CleanupClosePushL( uid ); - uid.AppendL( TUid::Uid( EMPXCollectionPluginMusic ) ); - TInt err = KErrNone; - TUid collection = iCollectionUtility->CollectionIDL( uid.Array() ); - TRAP( err,iCollectionUtility->Collection().CommandL( - EMcCmdCollectionInit, collection.iUid ) ); - CleanupStack::PopAndDestroy( &uid ); - } - -// --------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::CloseCollectionPlugin -// --------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::CloseCollectionPlugin() - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\ - CloseCollectionPlugin()")); - - if( iCollectionUtility ) - { - iCollectionUtility->Close(); - iCollectionUtility = NULL; - } - } - -// -------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::HandleCollectionMessage -// -------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::HandleCollectionMessage( CMPXMessage* /*aMsg*/, - TInt /*aErr*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\ - HandleCollectionMessage()")); - } - -// -------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::HandleCollectionMediaL -// -------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, - TInt /*aError*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::\ - HandleCollectionMediaL()")); - } - -// -------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::HandleOpenL -// -------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::HandleOpenL( const CMPXMedia& /*aEntries*/, - TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::HandleOpenL()")); - } - -// -------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::HandleOpenL -// -------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::HandleOpenL( - const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::HandleOpenL()")); - } - -// -------------------------------------------------------------------------- -// CCmFmMpxDuplicateDetector::HandleFindAllL -// Async find -// -------------------------------------------------------------------------- -// -void CCmFmMpxDuplicateDetector::HandleFindAllL( const CMPXMedia& aResults, - TBool /*aComplete*/, TInt /*aError*/ ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxDuplicateDetector::HandleFindAllL()")); - - if( &aResults ) - { - if( !aResults.Value( - KMPXMediaArrayContents )->Count() ) - { - // No results => Not duplicate - iObserver.DuplicateL( EFalse ); - } - else - { - iObserver.DuplicateL( ETrue ); - } - } - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxnotifier.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmmpxnotifier.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,252 +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: Notifies mpx -* -*/ - - -class MMPXCollection; - -#include -#include -#include -#include // for KMPXMediaGeneralCollectionId -#include // music-specific attribute keys -#include // s60 upnp stack -#include // for unicode conversion -#include "upnpitemutility.h" // for FindElementByName & ResourceFromItemL -#include "upnpconstantdefs.h" // for element names -#include "cmfmmpxnotifier.h" -#include "msdebug.h" - -// CONSTANTS -const TUid KMpxLocalCollectionUid = { 0x101FFC3A }; -const TUid KCmServerUid = { 0x10281FA7 }; - - -// --------------------------------------------------------------------------- -// CCmFmMpxNotifier::NewL -// --------------------------------------------------------------------------- -// -CCmFmMpxNotifier* CCmFmMpxNotifier::NewL( ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewL() start")); - CCmFmMpxNotifier* self = CCmFmMpxNotifier::NewLC( ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMpxNotifier::NewLC -// --------------------------------------------------------------------------- -// -CCmFmMpxNotifier* CCmFmMpxNotifier::NewLC( ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewLC() start")); - CCmFmMpxNotifier* self = new ( ELeave ) CCmFmMpxNotifier( ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmMpxNotifier::~CCmFmMpxNotifier -// --------------------------------------------------------------------------- -// -CCmFmMpxNotifier::~CCmFmMpxNotifier() - { - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::~CCmFmMpxNotifier()")); - if( iHarvester ) - { - iHarvester->Close(); - } - if( iCollectionUtil ) - { - iCollectionUtil->Close(); - } - delete iMediator; - } - -// --------------------------------------------------------------------------- -// CCmFmMpxNotifier::CCmFmMpxNotifier -// --------------------------------------------------------------------------- -// -CCmFmMpxNotifier::CCmFmMpxNotifier( ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::CCmFmMpxNotifier")); - } - -// --------------------------------------------------------------------------- -// CCmFmMpxNotifier::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmMpxNotifier::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::ConstructL")); - - iHarvester = CMPXHarvesterFactory::NewL(); - iCollectionUtil = MMPXCollectionUtility::NewL( 0, KCmServerUid ); - - iMediator = CMPXCollectionMediator::NewL( - iCollectionUtil->Collection(), this ); - } - -// --------------------------------------------------------------------------- -// CCmFmMpxNotifier::NotifyMpxL -// --------------------------------------------------------------------------- -// -void CCmFmMpxNotifier::NotifyMpxL( const TDesC& aTrackPath, - const CUpnpItem& aTrackMetadata ) - { - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::NotifyMpxL")); - - CMPXMedia* item = CMPXMedia::NewL(); - CleanupStack::PushL( item ); - item->SetTObjectValueL( - KMPXMediaGeneralCollectionId, KMpxLocalCollectionUid ); - item->SetTObjectValueL( - KMPXMediaGeneralType, EMPXItem ); - item->SetTObjectValueL( - KMPXMediaGeneralCategory, EMPXSong ); - item->SetTextValueL( - KMPXMediaGeneralUri, aTrackPath ); - // Insert metadata - HBufC16* buf = NULL; - // title - buf = EscapeUtils::ConvertToUnicodeFromUtf8L( aTrackMetadata.Title() ); - CleanupStack::PushL( buf ); - if( buf ) - { - item->SetTextValueL( - KMPXMediaGeneralTitle, *buf ); - } - CleanupStack::PopAndDestroy( buf ); - // artist - if ( ( buf = GetElementL( aTrackMetadata, KElementCreator ) ) != 0 ) - { - CleanupStack::PushL( buf ); - item->SetTextValueL( - KMPXMediaMusicArtist, *buf ); - CleanupStack::PopAndDestroy( buf ); - } - else if ( ( buf = GetElementL( aTrackMetadata, KElementArtist ) ) != 0 ) - { - CleanupStack::PushL( buf ); - item->SetTextValueL( - KMPXMediaMusicArtist, *buf ); - CleanupStack::PopAndDestroy( buf ); - } - // album - if ( ( buf = GetElementL( aTrackMetadata, KElementAlbum ) ) != 0 ) - { - CleanupStack::PushL( buf ); - item->SetTextValueL( - KMPXMediaMusicAlbum, *buf ); - CleanupStack::PopAndDestroy( buf ); - } - // genre - if ( ( buf = GetElementL( aTrackMetadata, KElementGenre ) ) != 0 ) - { - CleanupStack::PushL( buf ); - item->SetTextValueL( - KMPXMediaMusicGenre, *buf ); - CleanupStack::PopAndDestroy( buf ); - } - - // tracknumber - if ( ( buf = GetElementL( aTrackMetadata, KElementTrackNumber ) ) != 0 ) - { - CleanupStack::PushL( buf ); - TLex16 iLex(*buf); - TInt tracknumber(0); - iLex.Val(tracknumber); - item->SetTObjectValueL( - KMPXMediaMusicAlbumTrack, tracknumber ); - CleanupStack::PopAndDestroy( buf ); - } - - - // year - const CUpnpElement* elem = UPnPItemUtility::FindElementByName( - aTrackMetadata, KElementDate ); - if ( elem != 0 ) - { - TTime timestamp; - TInt err = - UPnPItemUtility::UPnPDateAsTTime( elem->Value(), timestamp ); - if( err == KErrNone ) - { - item->SetTObjectValueL( - KMPXMediaMusicYear, timestamp.Int64() ); - } - } - - // duration - const CUpnpElement* trackResource = - &UPnPItemUtility::ResourceFromItemL( aTrackMetadata ); - - if( trackResource != 0 ) - { - const CUpnpAttribute* attr = UPnPItemUtility - ::FindAttributeByName( *trackResource, KAttributeDuration ); - - if ( attr != 0 ) - { - TInt ms = 0; - UPnPItemUtility - ::UPnPDurationAsMilliseconds( attr->Value(), ms ); - - item->SetTObjectValueL( - KMPXMediaGeneralDuration, ms ); - } - } - - // Add to harvester - TRACE(Print(_L("[FILL MNGR]\t iHarvester->AddFileL "))); - TInt colUid = iHarvester->AddFileL( item ); - - // Add to collection, make sure we set the collection ID - item->SetTObjectValueL( - KMPXMediaGeneralCollectionId, TUid::Uid( colUid ) ); - - TRACE(Print(_L("[FILL MNGR]\t iMediator->AddItemL "))); - iMediator->AddItemL( item ); - - CleanupStack::PopAndDestroy( item ); - TRACE(Print(_L("[FILL MNGR]\t CCmFmMpxNotifier::NotifyMpxL end"))); - } - -// -------------------------------------------------------------------------- -// CCmFmMpxNotifier::GetElementL -// -------------------------------------------------------------------------- -// -HBufC16* CCmFmMpxNotifier::GetElementL( - const CUpnpItem& aSource, const TDesC8& aSourceField ) const - { - LOG(_L("[FILL MNGR]\t CCmFmMpxNotifier::GetElementL")); - HBufC16* result = 0; - const CUpnpElement* elem = UPnPItemUtility::FindElementByName( - aSource, aSourceField ); - if ( elem != 0 ) - { - result = EscapeUtils::ConvertToUnicodeFromUtf8L( elem->Value() ); - } - return result; - } - -// End of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmfillmanager/src/cmfmupnpmngr.cpp --- a/homesync/contentmanager/cmserver/cmfillmanager/src/cmfmupnpmngr.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,555 +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: AV Controller UPnP actions handler -* -*/ - - -#include "upnpavdevice.h" -#include "upnpxmlparser.h" -#include "upnpavcontroller.h" -#include "upnpavbrowsingsession.h" -#include "upnpconstantdefs.h" -#include "upnpitem.h" -#include - -#include "upnpitemutility.h" -#include "cmfilllistitem.h" -#include "cmfmupnpactionobserver.h" -#include "cmfmupnpmngr.h" -#include "msdebug.h" - -_LIT8( KCmBrowseFilter, "*" ); // No filter -_LIT8( KCmSortCriteria, "" ); // No sorting -const TInt KStartIndex = 0; // Start from beginning -const TInt KRequestedCount = 1; // Only one item browsed at a time -const TInt KScreenWidth = 128; -const TInt KScreenHeight = 128; -_LIT8( KCmFmXMark, "x" ); - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::NewL -// --------------------------------------------------------------------------- -// -CCmFmUpnpMngr* CCmFmUpnpMngr::NewL( MCmFmUPnPActionObserver* aObserver ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewL() start")); - CCmFmUpnpMngr* self = CCmFmUpnpMngr::NewLC( aObserver ); - CleanupStack::Pop( self ); - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::NewLC -// --------------------------------------------------------------------------- -// -CCmFmUpnpMngr* CCmFmUpnpMngr::NewLC( MCmFmUPnPActionObserver* aObserver ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewLC() start")); - CCmFmUpnpMngr* self = new ( ELeave ) CCmFmUpnpMngr( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::~CCmFmUpnpMngr -// --------------------------------------------------------------------------- -// -CCmFmUpnpMngr::~CCmFmUpnpMngr() - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::~CCmFmUpnpMngr()")); - - CancelOperation(); - - delete iURI; - delete iParser; - delete iItem; - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::CCmFmUpnpMngr -// --------------------------------------------------------------------------- -// -CCmFmUpnpMngr::CCmFmUpnpMngr( MCmFmUPnPActionObserver* aObserver ) - : iObserver( aObserver ), iScreenSize( KScreenWidth, KScreenHeight ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::CCmFmUpnpMngr()")); - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::ConstructL -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::ConstructL() - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ConstructL()")); - - iParser = CUPnPXMLParser::NewL(); - ScreenSizeL(); - TRACE(Print(_L("[FILL MNGR]\t Phones screen size = %d x %d"), - iScreenSize.iWidth, iScreenSize.iHeight )); - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::SetAvController -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::SetAvController( MUPnPAVController* aAVController ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::SetAvController()")); - - if( aAVController ) - { - aAVController->SetDeviceObserver( *this ); - } - iAVController = aAVController; - iBrowseSession = NULL; - delete iURI; - iURI = NULL; - delete iItem; - iItem = NULL; - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::GetMediaServersL -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::GetMediaServersL( CUpnpAVDeviceList*& aDevices ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::GetMediaServersL()")); - - if( iAVController ) - { - aDevices = iAVController->GetMediaServersL(); - } - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::CheckURIL -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::CheckURIL( CUpnpAVDevice* aDevice, - CCmFillListItem& aItem ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::CheckURIL()")); - if( iAVController ) - { - iSelectOptimalImageSize = EFalse; - if( aItem.Status() == ECmToBeShrinked ) - { - iSelectOptimalImageSize = ETrue; - } - - if( !iBrowseSession ) - { - // session not found -> create - iBrowseSession = - &iAVController->StartBrowsingSessionL( *aDevice ); - iBrowseSession->SetObserver( *this ); - iDevice = aDevice; - } - else if( ( aDevice != iDevice ) || - ( aDevice->Uuid() != iDevice->Uuid() ) ) - { - // device is different than previosly or pointer to it - // has been changed -> create new session - CancelOperation(); - iBrowseSession = - &iAVController->StartBrowsingSessionL( *aDevice ); - iBrowseSession->SetObserver( *this ); - iDevice = aDevice; - } - - iBrowseSession->BrowseL( aItem.ItemId(), KCmBrowseFilter, - MUPnPAVBrowsingSession::EMetadata, KStartIndex, - KRequestedCount, KCmSortCriteria ); - iBrowseStarted.HomeTime(); - TRACE(Print(_L("[FILL MNGR]\t BROWSE STARTED"))); -#ifdef _DEBUG - TBuf temp; - if( aDevice->Uuid().Length() < KMaxName ) - { - temp.Copy( aDevice->Uuid() ); - TRACE(Print(_L("[FILL MNGR]\t TARGET DEVICE %S"), &temp )); - } - temp.Zero(); - if( aItem.ItemId().Length() < KMaxName ) - { - temp.Copy( aItem.ItemId() ); - TRACE(Print(_L("[FILL MNGR]\t TARGET ITEM %S"), &temp )); - } - temp.Zero(); -#endif - } - else - { - TRACE(Print(_L("[FILL MNGR]\t iAVController == NULL"))); - iObserver->URICheckResult( ENoUriAvailable ); - } - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::CancelOperation() - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::CancelOperation()")); - - if( iBrowseSession ) - { - iAVController->StopBrowsingSession( *iBrowseSession ); - iBrowseSession = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::Uri -// --------------------------------------------------------------------------- -// -TDesC8& CCmFmUpnpMngr::Uri() const - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::Uri()")); - - return *iURI; - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::UpnpItem -// --------------------------------------------------------------------------- -// -CUpnpItem& CCmFmUpnpMngr::UpnpItem() const - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::UpnpItem()")); - - return *iItem; - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::BrowseResponse -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::BrowseResponse( - const TDesC8& aBrowseResponse, - TInt aError, - TInt /*aMatches*/, - TInt aTotalCount, - const TDesC8& /*aUpdateId*/ - ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::BrowseResponse()")); - - TRACE(Print(_L("[FILL MNGR]\t ParseResultDataL error = %d"), aError )); - - TRAPD( err, BrowseResponseL( aError, aTotalCount, aBrowseResponse ) ); - if ( err ) - { - TRACE(Print(_L("[FILL MNGR]\t BrowseResponseL err = %d"), err )); - } - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::BrowseResponseL -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::BrowseResponseL( TInt aStatus, - TInt /*aTotalCount*/, - const TDesC8& aResultArray ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::BrowseResponseL()")); - - RPointerArray tempArray; - CleanupClosePushL( tempArray ); - TInt err( aStatus ); - TRACE(Print(_L("[FILL MNGR]\t BrowseResponse err = %d"), err )); - if( !err ) - { - TRAP( err, iParser->ParseResultDataL( - tempArray, aResultArray ) ); - } - - /** Browse finished */ - iBrowseFinished.HomeTime(); - TTimeIntervalMicroSeconds usecsFrom = - iBrowseFinished.MicroSecondsFrom( iBrowseStarted ); - TRACE(Print(_L("[FILL MNGR]\t Browse took = %ld microseconds"), - usecsFrom.Int64() )); - - if( !err ) - { - if ( tempArray.Count() ) - { - if( iItem ) - { - delete iItem; - iItem = NULL; - } - iItem = CUpnpItem::NewL(); - // first object is an item, safe to downcast - CUpnpItem* item = static_cast( tempArray[0] ); - iItem->CopyL( *tempArray[0] ); - - const CUpnpElement& res = UPnPItemUtility::ResourceFromItemL( *item ); - if( iSelectOptimalImageSize ) - { - RUPnPElementsArray array; - UPnPItemUtility::GetResElements( *tempArray[0], array ); - const CUpnpElement& res = ParseImageResolutions( array ); - } - - if(iURI) - { - delete iURI; - iURI = NULL; - } - iURI = res.Value().AllocL(); - iObserver->URICheckResult( EUriChecked, item, &res ); - } - else - { - LOG(_L("[FILL MNGR]\t tempArray.Count() = 0")); - iObserver->URICheckResult( ENoUriAvailable ); - } - } - else - { - LOG(_L("[FILL MNGR]\t err != 0")); - iObserver->URICheckResult( ENoUriAvailable ); - } - - tempArray.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &tempArray ); - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::SearchResponse -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::SearchResponse( - const TDesC8& /*aSearchResponse*/, - TInt /*aError*/, - TInt /*aMatches*/, - TInt /*aTotalCount*/, - const TDesC8& /*aUpdateId*/ - ) - { - // None - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::SearchResponse -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::SearchResponse( - TInt /*aStatus*/, - TInt /*aTotalCount*/, - const RPointerArray& /*aResultArray*/ - ) - { - // None - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::SearchCapabilitiesResponse -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::SearchCapabilitiesResponse( - TInt /*aStatus*/, - const TDesC8& /*aSearchCapabilities*/ - ) - { - // None - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::CreateContainerResponse -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::CreateContainerResponse( TInt /*aError*/, - const TDesC8& /*aObjectId*/ ) - { - // None - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::DeleteObjectResponse -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::DeleteObjectResponse( TInt /*aStatus*/ ) - { - // None - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::MediaServerDisappeared -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::MediaServerDisappeared( - TUPnPDeviceDisconnectedReason /*aReason*/ ) - { - // None - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::ReserveLocalMSServicesCompleted -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::ReserveLocalMSServicesCompleted( TInt /*aStatus*/ ) - { - // None - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::UPnPDeviceDiscovered -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::UPnPDeviceDiscovered( const CUpnpAVDevice& /*aDevice*/ ) - { - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::UPnPDeviceDisappeared -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::UPnPDeviceDisappeared")); - if( iDevice ) - { - if( KErrNotFound != iDevice->Uuid().Match( aDevice.Uuid() ) ) - { - LOG(_L("[FILL MNGR]\t Used server disappeared!")); - LOG(_L("[FILL MNGR]\t Canceling")); - iObserver->URICheckResult( ECanceled ); - } - } - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::WLANConnectionLost -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::WLANConnectionLost() - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::WLANConnectionLost")); - iObserver->URICheckResult( ECanceled ); - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::ParseImageResolutions -// --------------------------------------------------------------------------- -// -const CUpnpElement& CCmFmUpnpMngr::ParseImageResolutions( - RUPnPElementsArray& aResElementsArray ) - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ParseImageResolutions")); - - TInt elementIndex( KErrNone ); - TSize matchingSize( 0, 0 ); - for( TInt i = 0 ; i < aResElementsArray.Count(); i++ ) - { - const CUpnpAttribute* attribute = - UPnPItemUtility::FindAttributeByName( *aResElementsArray[i], - KAttributeResolution() ); - - if( attribute ) - { - TPtrC8 resolution( attribute->Value() ); - TInt index = resolution.Find( KCmFmXMark ); - if( index != KErrNotFound ) - { - TLex8 lexH( resolution.Mid( index + 1 ) ); - TInt height( KErrNone ); - TInt err = lexH.Val( height ); - TRACE(Print(_L("[FILL MNGR]\t Val( height ) = %d"), err )); - - TInt width( KErrNone ); - TLex8 lexW( resolution.Mid( 0, index ) ); - err = lexW.Val( width ); - TRACE(Print(_L("[FILL MNGR]\t Val( width ) = %d"), err )); - - TRACE(Print(_L("[FILL MNGR]\t Sizes in landscape mode!!!"))); - TRACE(Print(_L("[FILL MNGR]\t Image heigth = %d"), height )); - TRACE(Print(_L("[FILL MNGR]\t Image width = %d"), width )); - if( height >= iScreenSize.iWidth && width >= - iScreenSize.iHeight ) - { - if( matchingSize.iHeight == 0 ) - { - matchingSize.iHeight = height; - matchingSize.iWidth = width; - elementIndex = i; - } - else - { - if( matchingSize.iHeight > height && - matchingSize.iWidth > width ) - { - matchingSize.iHeight = height; - matchingSize.iWidth = width; - elementIndex = i; - } - - } - } - } - } - else - { - LOG(_L("[FILL MNGR]\t attribute == NULL")); - } - } - TRACE(Print(_L("[FILL MNGR]\t Selected height = %d"), - matchingSize.iHeight )); - TRACE(Print(_L("[FILL MNGR]\t Selected width = %d"), - matchingSize.iWidth )); - TRACE(Print(_L("[FILL MNGR]\t Selected elementIndex = %d"), - elementIndex )); - return *aResElementsArray[ elementIndex ]; - } - -// --------------------------------------------------------------------------- -// CCmFmUpnpMngr::ScreenSizeL -// --------------------------------------------------------------------------- -// -void CCmFmUpnpMngr::ScreenSizeL() - { - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ScreenSizeL start")); - RWsSession session; - TInt error = session.Connect() ; - CleanupClosePushL( session ); - if ( !error ) - { - CWsScreenDevice* screenDevice = - new ( ELeave ) CWsScreenDevice( session ); - if ( screenDevice && !screenDevice->Construct() ) - { - iScreenSize = screenDevice->SizeInPixels(); - } - delete screenDevice; - screenDevice = NULL; - } - else - { - TRACE(Print(_L("[FILL MNGR]\t ScreenSizeL error = %d"), error )); - } - - CleanupStack::PopAndDestroy( &session ); - LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ScreenSizeL end")); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/bwins/cmmemorymanageru.def --- a/homesync/contentmanager/cmserver/cmmemorymanager/bwins/cmmemorymanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - ??1CCmMmMain@@UAE@XZ @ 1 NONAME ; CCmMmMain::~CCmMmMain(void) - ?Cancel@CCmMmMain@@QAEXXZ @ 2 NONAME ; void CCmMmMain::Cancel(void) - ?DeleteFilesL@CCmMmMain@@QAEXAAVCDesC16Array@@@Z @ 3 NONAME ; void CCmMmMain::DeleteFilesL(class CDesC16Array &) - ?NewL@CCmMmMain@@SAPAV1@AAVCCmDmMain@@@Z @ 4 NONAME ; class CCmMmMain * CCmMmMain::NewL(class CCmDmMain &) - ?NewLC@CCmMmMain@@SAPAV1@AAVCCmDmMain@@@Z @ 5 NONAME ; class CCmMmMain * CCmMmMain::NewLC(class CCmDmMain &) - ?SetObserver@CCmMmMain@@QAEXAAVMCmMmObserver@@@Z @ 6 NONAME ; void CCmMmMain::SetObserver(class MCmMmObserver &) - ?SetQuotaListenerStateL@CCmMmMain@@QAEXH@Z @ 7 NONAME ; void CCmMmMain::SetQuotaListenerStateL(int) - ?ShrinkImagesL@CCmMmMain@@QAEXAAVCDesC16Array@@@Z @ 8 NONAME ; void CCmMmMain::ShrinkImagesL(class CDesC16Array &) - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/data/memorymanager.rss --- a/homesync/contentmanager/cmserver/cmmemorymanager/data/memorymanager.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +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: Resource definitions for project Memory Manager -* -*/ - - -#include -#include - -//----------------------------------------------------------------------------- -// r_mserv_conf_auto_remove -//----------------------------------------------------------------------------- -// -RESOURCE LBUF r_mserv_conf_auto_remove - { - txt = qtn_mserv_conf_auto_remove; - } - -//----------------------------------------------------------------------------- -// r_mserv_progress_remove -//----------------------------------------------------------------------------- -// -RESOURCE LBUF r_mserv_progress_remove - { - txt = qtn_mserv_progress_remove_list; - } diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/eabi/cmmemorymanageru.def --- a/homesync/contentmanager/cmserver/cmmemorymanager/eabi/cmmemorymanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -EXPORTS - _ZN9CCmMmMain11SetObserverER13MCmMmObserver @ 1 NONAME - _ZN9CCmMmMain12DeleteFilesLER12CDesC16Array @ 2 NONAME - _ZN9CCmMmMain13ShrinkImagesLER12CDesC16Array @ 3 NONAME - _ZN9CCmMmMain22SetQuotaListenerStateLEi @ 4 NONAME - _ZN9CCmMmMain4NewLER9CCmDmMain @ 5 NONAME - _ZN9CCmMmMain5NewLCER9CCmDmMain @ 6 NONAME - _ZN9CCmMmMain6CancelEv @ 7 NONAME - _ZN9CCmMmMainD0Ev @ 8 NONAME - _ZN9CCmMmMainD1Ev @ 9 NONAME - _ZN9CCmMmMainD2Ev @ 10 NONAME - _ZTI13CCmMmShrinker @ 11 NONAME ; ## - _ZTI18CCmMmQuotaListener @ 12 NONAME ; ## - _ZTI26CCmMmImageMetadataResolver @ 13 NONAME ; ## - _ZTI9CCmMmMain @ 14 NONAME ; ## - _ZTV13CCmMmShrinker @ 15 NONAME ; ## - _ZTV18CCmMmQuotaListener @ 16 NONAME ; ## - _ZTV26CCmMmImageMetadataResolver @ 17 NONAME ; ## - _ZTV9CCmMmMain @ 18 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/group/bld.inf --- a/homesync/contentmanager/cmserver/cmmemorymanager/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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 information file for Memory Manager -* -*/ - - -#include "../../../../../group/upnpplatformvar.hrh" - -// Supported platforms -prj_platforms -DEFAULT - -// MMP files -prj_mmpfiles -cmmemorymanager.mmp - -// Files to be exported -prj_exports -../inc/cmmmmain.h |../../../../../inc/cmmmmain.h -../inc/cmmmobserver.h |../../../../../inc/cmmmobserver.h -../inc/cmmmquotalistener.h |../../../../../inc/cmmmquotalistener.h -../inc/cmmmshrinker.h |../../../../../inc/cmmmshrinker.h -// LOC export -UPNP_LOC_EXPORT(memorymanager.loc) diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/group/cmmemorymanager.mmp --- a/homesync/contentmanager/cmserver/cmmemorymanager/group/cmmemorymanager.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2006-2007 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 project Memory Manager -* -*/ - -#include - -TARGET cmmemorymanager.dll -TARGETTYPE dll -UID 0x1000008d 0x10282344 - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH /sys/bin - -USERINCLUDE ../inc -USERINCLUDE ../loc - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -SOURCEPATH ../src - -SOURCE cmmmmain.cpp -SOURCE cmmmquotalistener.cpp -SOURCE cmmmshrinker.cpp -SOURCE cmmmimagemetadataresolver.cpp - -LIBRARY euser.lib -LIBRARY efsrv.lib // f32file.h -LIBRARY aknnotify.lib // CAknGlobalNote, CAknGlobalProgressDialog -LIBRARY eiksrv.lib // CAknGlobalNote, CAknGlobalProgressDialog -LIBRARY bafl.lib // CDesCArray, RResourceFile -LIBRARY imageconversion.lib // CImageDecoder -LIBRARY bitmaptransforms.lib // CBitmapScaler -LIBRARY fbscli.lib // CFbsBitmap -LIBRARY mpxharvesterutility.lib // Mpx harvester -LIBRARY mpxcollectionhelper.lib //MMPXCollectionHelper -LIBRARY cmcommon.lib // TCmLowPriorityFilled, TCmShrinkResolution -LIBRARY cmdatabasemanager.lib -LIBRARY ws32.lib // RWsSession, CWsScreenDevice -LIBRARY PlatformEnv.lib // PathInfo -LIBRARY avkon.lib // CompeteWithAppPath -LIBRARY upnpipserversutils.lib -LIBRARY exiflib.lib -LIBRARY contentlistingframework.lib - -DEBUGLIBRARY flogger.lib - -START RESOURCE ../data/memorymanager.rss -HEADER -TARGETPATH /resource/apps -LANGUAGE_IDS -END diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmimagemetadataresolver.h --- a/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmimagemetadataresolver.h Mon Nov 01 13:44:24 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: Metadata resolver class in the Memory manager component -* -*/ - - -#ifndef C_CMMMIMAGEMETADATARESOLVER_H -#define C_CMMMIMAGEMETADATARESOLVER_H - -#include -#include // RFs - -// Forward declarations -class CExifRead; -class CExifModify; - -/** - * CCmMmImageMetadataResolver class - * Part of Memory manager - * - * @lib cmmemorymanager.lib - * @since S60 v3.2 - */ -class CCmMmImageMetadataResolver : public CBase - { - -public: // Symbian constructors and C++ destructor - - /** - * Creates new CCmMmImageMetadataResolver class - * - * @since S60 3.2 - * @param aFileSession - * @return pointer to CCmMmImageMetadataResolver object - */ - static CCmMmImageMetadataResolver* NewL( RFs& aFileSession ); - - /** - * Creates new CCmMmImageMetadataResolver class and leaves the instance - * in the cleanup stack - * - * @since S60 3.2 - * @param aFileSession - * @return pointer to CCmMmImageMetadataResolver object - */ - static CCmMmImageMetadataResolver* NewLC( RFs& aFileSession ); - - /** - * @since S60 3.2 - * - * C++ destructor - */ - virtual ~CCmMmImageMetadataResolver(); - -public: // New methods - - /** - * Captures orginal metadata - * @since S60 3.2 - * @param aOrigFileName, orginal file name - * @return None - */ - void CaptureOrginalMetadataL( const TDesC& aOrigFileName ); - - /** - * Captures and resolves image metadata - * @since S60 3.2 - * @param aShrinkedFileName, shrinked file name - * @return None - */ - void ResolveMetadataL( const TDesC& aShrinkedFileName ); - -private: - - /** - * Fills orginal exif data to shrinked image - * @since S60 3.2 - * @param aRead, exif reader - * @param aModify, exif modifier - * @return None - */ - void FillExifL( CExifRead& aRead, CExifModify& aModify ); - -private: // Constructors - - /** - * C++ constructor - * - * @since S60 3.2 - * @param None - */ - CCmMmImageMetadataResolver( RFs& aFileSession ); - - /** - * Second-phase constructor - * - * @since S60 3.2 - */ - void ConstructL(); - -private: // data - - /** File session*/ - RFs& iFileSession; - - /** Orginal Metadata ( owned ) */ - HBufC8* iExifOrig; - - }; - -#endif // C_CMMMIMAGEMETADATARESOLVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmmain.h --- a/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmmain.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Main class in the Memory manager component -* -*/ - - -#ifndef C_CMMMMAIN_H -#define C_CMMMMAIN_H - -#include -#include // CDesCArray -#include // RFs -#include "cmcommon.h" // TCmListItemStatus - -// Forward declarations -class MCmMmObserver; -class MMPXHarvesterUtility; -class CCmMmQuotaListener; -class CCmMmShrinker; -class CCmDmMain; -class MMPXCollectionHelper; - -/** - * CCmMmMain class - * Memory manager - * - * @lib cmmemorymanager.lib - * @since S60 v3.0 - */ -class CCmMmMain : public CBase - { - -public: // Symbian constructors and C++ destructor - - /** - * Creates new CCmMmMain class - * - * @since S60 v3.0 - * @param aDbManager - * @return pointer to CCmMmMain object - */ - IMPORT_C static CCmMmMain* NewL( CCmDmMain& aDbManager ); - - /** - * Creates new CCmMmMain class and leaves the instance - * in the cleanup stack - * - * @since S60 v3.0 - * @param aDbManager - * @return pointer to CCmMmMain object - */ - IMPORT_C static CCmMmMain* NewLC( CCmDmMain& aDbManager ); - - /** - * @since S60 v3.0 - * - * C++ destructor - */ - IMPORT_C virtual ~CCmMmMain(); - -public: // New methods - - /** - * Cancels deletion and shrinking - * - * @since S60 3.0 - */ - IMPORT_C void Cancel(); - - /** - * Deletes files from array - * - * @since S60 3.0 - * @param aFiles - */ - IMPORT_C void DeleteFilesL( CDesCArray& aFiles ); - - /** - * Sets observer - * - * @since S60 3.0 - * @param aObserver - */ - IMPORT_C void SetObserver( MCmMmObserver& aObserver ); - - /** - * Sets quotalistener on/off - * - * @since S60 3.0 - * @param aState - */ - IMPORT_C void SetQuotaListenerStateL( TBool aState ); - - /** - * Shrinks files from array - * - * @since S60 3.0 - * @param aFiles - */ - IMPORT_C void ShrinkImagesL( CDesCArray& aFiles ); - - /** - * Tells MMC state - * - * @since S60 3.0 - * @param aFileServer - * @param aDriveNumber - * @return ETrue if Drive is usable and else EFalse - */ - static TBool CCmMmMain::DriveState( - const RFs& aFileServer, - TInt aDriveNumber ); - -private: // Constructors - - /** - * C++ constructor - * - * @since S60 3.0 - * @param aObserver - */ - CCmMmMain( CCmDmMain& aDbManager ); - - /** - * Second-phase constructor - * - * @since S60 3.0 - */ - void ConstructL(); - -private: // New methods - - /** - * Static callback method for deletion - * - * @since S60 3.0 - * @param aMm - */ - static TInt BackgroundDeleteL( TAny* aMm ); - - /** - * Deletes files in background - * - * @since S60 3.0 - * @return ETrue if Drive is usable and else EFalse - */ - TInt DoBackgroundDeleteL(); - - /** - * Delete the collection hepler - * - * @since S60 3.0 - */ - void CloseMpxCollectionHelper(); - -private: // data - TInt iDeleteIndex; - RFs iFileSession; - TBool iQuotaListenerState; - CCmDmMain& iDbManager; - CIdle* iDeleter; // owned - CDesCArray* iFilesToDelete; // owned - CDesCArray* iFilesToShrink; // owned - MMPXHarvesterUtility* iHarvester; // owned - MCmMmObserver* iObserver; // now owned - CCmMmShrinker* iShrinker; // owned - RPointerArray iQuotaListeners; // owned - MMPXCollectionHelper* iMpxCollectionHelper; // owned - - }; - -#endif // C_CMMMMAIN_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmobserver.h --- a/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Callback interface -* -*/ - - -#ifndef M_CMMMOBSERVER_H -#define M_CMMMOBSERVER_H - -/** - * Callback interface class used to notify derived class - * about status changes in MemoryManager actions - * @lib cmmemorymanager.lib - * @since S60 v3.0 - */ -class MCmMmObserver - { - -public: - - /** - * Delete completed notification - * - * @since S60 3.0 - * @param aErr - */ - virtual void DeleteCompleteL( TInt aErr ) = 0; - - /** - * Shrink completed notification - * - * @since S60 3.0 - * @param aErr - */ - virtual void ShrinkCompleteL( TInt aErr ) = 0; - }; - -#endif // M_CMMMOBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmquotalistener.h --- a/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmquotalistener.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Quota listener class in the Store manager component -* -*/ - - -#ifndef C_CMMMQUOTALISTENER_H -#define C_CMMMQUOTALISTENER_H - -#include -#include // RFs - -/* Forward declarations. */ -class CAknGlobalProgressDialog; -class CCmDmMain; -class MMPXHarvesterUtility; - -/** - * CCmMmQuotaListener class - * Part of Memory Manager - * @lib cmmemorymanager.lib - * @since S60 v3.0 - */ -class CCmMmQuotaListener : public CActive - { - -public: // Symbian constructors and C++ destructor - - /** - * Creates new CCmMmQuotaListener class and opens connection to database - * - * @since S60 v3.0 - * @param aDbManager - * @param aDrive - * @return pointer to CCmMmQuotaListener object - */ - static CCmMmQuotaListener* NewL( CCmDmMain& aDbManager, TInt aDrive ); - - /** - * Creates new CCmMmQuotaListener class and leaves the instance - * in the cleanup stack - * - * @since S60 v3.0 - * @param aDbManager - * @param aDrive - * @return pointer to CCmMmQuotaListener object - */ - static CCmMmQuotaListener* NewLC( CCmDmMain& aDbManager, TInt aDrive ); - - /** - * C++ destructor - * - * @since S60 v3.0 - */ - virtual ~CCmMmQuotaListener(); - -protected: // Functions from base class - - /** - * From CActive - * Cancels any outstanding operation - * - * @since S60 v3.0 - */ - void DoCancel(); - - /** - * From CActive - * Callback function - * - * @since S60 v3.0 - */ - void RunL(); - -private: - - /** - * Resolves drives root path - * - * @since S60 v3.0 - * @param aDriveNumber - * @return Root path - */ - HBufC* ResolveAndAppendRootPathL( const TInt aDriveNumber ); - -private: - - /** - * C++ constructor - * - * @since S60 v3.0 - * @param aDbManager - * @param aDrive - */ - CCmMmQuotaListener( CCmDmMain& aDbManager, TInt aDrive ); - - /** - * Second-phase constructor - * - * @since S60 v3.0 - */ - void ConstructL(); - -private: // New methods - - /** - * ReadResourceL - * - * @since S60 v3.0 - * @param aResourceId - * @return resource string - */ - HBufC16* ReadResourceL( TInt aResourceId ); - - /** - * Waits for given time and after that issues NotifyDiskSpace request - * to the fileserver and sets this object active. - * - * @since S60 v3.1 - * @param aTimeoutValue time to wait. - */ - void RequestNotificationAfterTimeout( TInt aTimeoutValue ); - - /** - * Issues NotifyDiskSpace request to the fileserver and sets this object - * active. - * - * @since S60 v3.1 - */ - void RequestDiskSpaceNotification(); - - /** - * Asks a confirmation for delete operation from the user. - * - * @since S60 v3.1 - * @param aListName - * @param aListSize - * @return the status of the confirmation in a TRequestStatus - */ - TRequestStatus DeleteConfirmationL( - const TDesC& aListName, - TUint32 aListSize ); - - /** - * Deletes the files in the array. Shows progressnote about delete - * operation progress. - * - * @since S60 v3.1 - * @param aArray - * @param aListName - * @return Total size of all deleted files together. - */ - TUint32 DeleteFilesL( - const RPointerArray& aArray, - const TDesC8& aListName ); - - /** - * Remove files from the end of the array so that the total amount of - * files in the list is no more than aDeleteLimit megabytes. - * - * @since S60 v3.1 - * @param aArray the array - * @param aDeleteLimit maximum amount of the filesizes in the array - * together after this method call (in megabytes). - * @return Total size of all files in the array together. - */ - TUint32 CCmMmQuotaListener::RemoveExtraFiles( - RPointerArray& aArray, - TInt64 aDeleteLimit ) const; - -private: // data - TInt iDrive; - RFs iFileSession; - TInt64 iQuota; - CCmDmMain& iDbManager; - MMPXHarvesterUtility* iHarvester; // owned - CAknGlobalProgressDialog* iProgressDialog; //owned - }; - -#endif // C_CMMMQUOTALISTENER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmshrinker.h --- a/homesync/contentmanager/cmserver/cmmemorymanager/inc/cmmmshrinker.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Shrinker class in the Memory manager component -* -*/ - - -#ifndef C_CMMMSHRINKER_H -#define C_CMMMSHRINKER_H - -#include -#include "cmcommon.h" // TCmListItemStatus - -/* Forward declarations. */ -class MCmMmObserver; -class CCmMmImageMetadataResolver; -class CFbsBitmap; -class CImageDecoder; -class CBitmapScaler; -class CImageEncoder; -class CCmDmMain; - -/** - * CCmMmShrinker class - * - * @lib cmmemorymanager.lib - * @since S60 v3.1 - */ -class CCmMmShrinker : public CActive - { - -// States - enum TImageState - { - EIdle = 0, - EDecode, - EScale, - EEncode, - EReplace - }; - -public: // Constructors and destructor - - /** - * Creates new CCmMmShrinker class and opens connection to database - * - * @since S60 3.1 - * @param aDbManager - * @return pointer to CCmMmShrinker object - */ - static CCmMmShrinker* NewL( CCmDmMain& aDbManager ); - - /** - * Creates new CCmMmShrinker class and opens connection to database and - * leaves the instance in the cleanup stack - * - * @since S60 3.1 - * @param aDbManager - * @return pointer to CCmMmShrinker object - */ - static CCmMmShrinker* NewLC( CCmDmMain& aDbManager ); - - /** - * C++ destructor - * - * @since S60 3.1 - */ - virtual ~CCmMmShrinker(); - -public: // New functions - - /** - * Shrinks given images. - * - * @since S60 3.1 - * @param aFiles - */ - void ShrinkImagesL( CDesCArray& aFiles ); - - /** - * Sets memory manager observer - * - * @since S60 3.1 - * @param aObserver - */ - void SetObserver ( MCmMmObserver* aObserver ); - -protected: // Functions from base class - - /** - * From CActive - * Cancels any outstanding operation - * - * @since S60 3.1 - */ - void DoCancel(); - - /** - * Handles a leave occurring in the request - * completion event handler RunL() - * - * @since S60 3.1 - * @param aError - * @return error value - */ - TInt RunError( TInt aError ); - - /** - * From CActive - * Callback function - * Invoked to handle responses from the server - * - * @since S60 3.1 - */ - void RunL(); - - private: // New methods - - /** - * Return screensize - * - * @since S60 3.1 - * @return screensize - */ - TSize ScreenSizeL(); - - /** - * Returns the private path according to the specified file name - * - * @since S60 3.1 - * @param aFs handle to file server - * @param aPrivatePath reference to descriptor where private path is - modified. - * @param aOriginal original file path used to define drive and file name - */ - void PrivatePath( RFs& aFs, - TFileName& aPrivatePath, - const TFileName& aOriginal ); - - /** - * Clear shrinker mermber variables - * - * @since S60 3.1 - * @param None - */ - void ClearShrinker(); - -private: - - /** - * C++ constructor - * - * @since S60 3.1 - * @param aDbManager - */ - CCmMmShrinker( CCmDmMain& aDbManager ); - - /** - * Second-phase constructor. - * - * @since S60 3.1 - * @param aFiles - */ - void ConstructL(); - - - -private: // data - RFs iFileSession; - TSize iScreenSize; - TInt iShrinkIndex; - TTime iStartTime; - TImageState iState; - TTime iStopTime; - MCmMmObserver* iObserver; // not owned - CCmDmMain& iDbManager; - CFbsBitmap* iBitmap; // owned - CBitmapScaler* iBitmapScaler; // owned - CDesCArray* iFiles; // owned - CImageDecoder* iImageDecoder; // owned - CImageEncoder* iImageEncoder; // owned - TFileName iTempFilename; - CCmMmImageMetadataResolver* iImageMetadataResolver; - }; - -#endif // C_CMMMSHRINKER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/loc/memorymanager.loc --- a/homesync/contentmanager/cmserver/cmmemorymanager/loc/memorymanager.loc Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2007-2007 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: Localization strings for project MemoryManager -* -*/ - - -//d:Low memory on memory card. -//d:Temporarily remove %d MB of your synced home media from list %S? -//d:Parameter 1 max length: 5 characters -//d:Parameter 2 max length: 255 characters -//l:popup_note_window -//r:1.0 -// -#define qtn_mserv_conf_auto_remove "Memory low. Temporarily remove %d MB media content from list %S?" - -//d:Removing home media -//l:popup_note_wait_window -//r:1.0 -// -#define qtn_mserv_progress_remove "Removing home media" - -//d:Removing home media -//d:Parameter 2 max length: 255 characters -//l:popup_note_wait_window -//r:1.0 -// -#define qtn_mserv_progress_remove_list "Removing media content from list %S" diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmimagemetadataresolver.cpp --- a/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmimagemetadataresolver.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,427 +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: Image metadata resolver class in Memory manager component -* -*/ - - -#include -#include -#include -#include -#include -#include "msdebug.h" -#include "cmmmimagemetadataresolver.h" - -const TUint16 KIdFNumber = 0x829D; -const TUint16 KIdFocalLength = 0x920A; -const TUint16 KIdFocalLength35mmFilm = 0xA405; -const TUint16 KIdFocalPlaneResolutionUnit = 0xA210; -const TUint16 KIdFocalPlaneXResolution = 0xA20E; -const TUint16 KIdFocalPlaneYResolution = 0xA20F; -const TUint32 KDefaultPixelsPerResolutionUnitNumerator = 99; -const TUint32 KDefaultPixelsPerResolutionUnitDenominator = 66; -const TUint16 KDefaultYCbCrPositioningCentered = 1; -const TUint16 KDefaultColorSpace_sRGB = 1; - -// --------------------------------------------------------------------------- -// CCmMmImageMetadataResolver::NewL -// --------------------------------------------------------------------------- -// -CCmMmImageMetadataResolver* CCmMmImageMetadataResolver::NewL( - RFs& aFileSession ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewL() start")); - CCmMmImageMetadataResolver* self = - CCmMmImageMetadataResolver::NewLC( aFileSession ); - CleanupStack::Pop( self ); - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmMmImageMetadataResolver::NewLC -// --------------------------------------------------------------------------- -// -CCmMmImageMetadataResolver* CCmMmImageMetadataResolver::NewLC( - RFs& aFileSession ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewLC() start")); - CCmMmImageMetadataResolver* self = - new ( ELeave ) CCmMmImageMetadataResolver( aFileSession ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// C++ destructor -// --------------------------------------------------------------------------- -// -CCmMmImageMetadataResolver::~CCmMmImageMetadataResolver() - { - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::~CCmMmImageMetadataResolver() start")); - delete iExifOrig; - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::~CCmMmImageMetadataResolver() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmImageMetadataResolver::CaptureOrginalMetadataL -// --------------------------------------------------------------------------- -// -void CCmMmImageMetadataResolver::CaptureOrginalMetadataL( - const TDesC& aOrigFileName ) - { - RFile orig; - User::LeaveIfError( orig.Open( iFileSession, aOrigFileName, EFileRead ) ); - CleanupClosePushL( orig ); - TInt size = 0; - orig.Size(size); - delete iExifOrig; - iExifOrig = NULL; - iExifOrig = HBufC8::NewL( size ); - TPtr8 bufferDes( iExifOrig->Des() ); - User::LeaveIfError( orig.Read( bufferDes ) ); - CleanupStack::PopAndDestroy(); - } - -// --------------------------------------------------------------------------- -// CCmMmImageMetadataResolver::ResolveMetadataL -// --------------------------------------------------------------------------- -// -void CCmMmImageMetadataResolver::ResolveMetadataL( - const TDesC& aShrinkedFileName ) - { - RFile shrinked; - User::LeaveIfError( - shrinked.Open( iFileSession, aShrinkedFileName, EFileRead|EFileWrite ) ); - - CleanupClosePushL( shrinked ); - - // 1. Read Exif image from the file to a buffer... - TInt sizeS = 0; - shrinked.Size(sizeS); - HBufC8* exifShrinked = HBufC8::NewL( sizeS ); - CleanupStack::PushL( exifShrinked ); - TPtr8 bufferDesS( exifShrinked->Des() ); - User::LeaveIfError( shrinked.Read( bufferDesS ) ); - - CExifModify* modify = NULL; - CExifRead* read = NULL; - TRAPD( err1, read = CExifRead::NewL( iExifOrig->Des() ) ); - User::LeaveIfError( err1 ); - // 2. Instantiate Exif modifier in EModify mode... - TRAPD( err, modify = CExifModify::NewL( exifShrinked->Des() ) ); - if(err == KErrCorrupt) - { - modify = CExifModify::NewL( exifShrinked->Des(), CExifModify::ECreate ); - } - CleanupStack::PushL(modify); - // If exif info fails, there is nothing we can do - TRAP_IGNORE( FillExifL( *read, *modify ) ); - - // 4. Get the modified Exif image... - // If zero length descriptor is given instead of exif->Des(), then only the - // Exif meta data is returned - TInt pos = 0; - User::LeaveIfError( shrinked.Seek( ESeekStart, pos ) ); - HBufC8* modifiedExif = NULL; - TRAPD( err2, modifiedExif = modify->WriteDataL( exifShrinked->Des() ) ); - /* Process the modified Exif data */ - if( modifiedExif && !err2 ) - { - shrinked.Write( *modifiedExif, modifiedExif->Des().Length() ); - } - - delete modifiedExif; - modifiedExif = NULL; - - // 5. Delete the modifier instance... - CleanupStack::PopAndDestroy( modify ); - CleanupStack::PopAndDestroy( exifShrinked ); - CleanupStack::PopAndDestroy(); - delete iExifOrig; - iExifOrig = NULL; - - } - -// --------------------------------------------------------------------------- -// C++ constructor -// --------------------------------------------------------------------------- -// -CCmMmImageMetadataResolver::CCmMmImageMetadataResolver( RFs& aFileSession ) - : iFileSession( aFileSession ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::CCmMmImageMetadataResolver() start")); - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::CCmMmImageMetadataResolver() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmImageMetadataResolver::ConstructL -// --------------------------------------------------------------------------- -// -void CCmMmImageMetadataResolver::ConstructL() - { - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::ConstructL() start")); - LOG(_L("[MEMORY MNGR]\t CCmMmImageMetadataResolver::ConstructL() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmImageMetadataResolver::FillExifL -// --------------------------------------------------------------------------- -// -void CCmMmImageMetadataResolver::FillExifL( CExifRead& aRead, CExifModify& aModify ) - { - TRAP_IGNORE( aModify.SetImageDescriptionL( *aRead.GetImageDescriptionL() ) ); - TRAP_IGNORE( aModify.SetMakeL( *aRead.GetMakeL() ) ); - TRAP_IGNORE( aModify.SetModelL( *aRead.GetModelL() ) ); - - TRAP_IGNORE( aModify.SetThumbnailL( *aRead.GetThumbnailL() ) ); - TRAP_IGNORE( aModify.SetTransferFunctionL( *aRead.GetTransferFunctionL() ) ); - TRAP_IGNORE( aModify.SetDateTimeL( *aRead.GetDateTimeL() ) ); - - TRAP_IGNORE( aModify.SetSoftwareL( *aRead.GetSoftwareL() ) ); - TRAP_IGNORE( aModify.SetCopyrightL( *aRead.GetCopyrightL() ) ); - - aModify.SetXResolutionL( - KDefaultPixelsPerResolutionUnitNumerator, - KDefaultPixelsPerResolutionUnitDenominator ); - aModify.SetYResolutionL( - KDefaultPixelsPerResolutionUnitNumerator, - KDefaultPixelsPerResolutionUnitDenominator ); - - aModify.SetYCbCrPositioningL( KDefaultYCbCrPositioningCentered ); - - aModify.SetColorSpaceL( KDefaultColorSpace_sRGB ); - - TUint32 uint32Value = 0; - TUint16 uint16Value = 0; - HBufC8* textValue = NULL; - const CExifTag* exifTagInfo = NULL; - TInt exifError( KErrNone ); - exifError = aRead.GetPixelXDimension( uint32Value ); - if( exifError == KErrNone ) - { - TRAP_IGNORE( aModify.SetPixelXDimensionL( uint32Value ) ); - } - exifError = aRead.GetPixelYDimension( uint32Value ); - if( exifError == KErrNone ) - { - TRAP_IGNORE( aModify.SetPixelYDimensionL( uint32Value ) ); - } - - exifError = aRead.GetWhiteBalance( uint16Value ); - if( exifError == KErrNone ) - { - aModify.SetWhiteBalanceL( uint16Value ); - } - exifError = aRead.GetFlash( uint16Value ); - if( exifError == KErrNone ) - { - aModify.SetFlashL( uint16Value ); - } - - exifError = aRead.GetExposureProgram( uint16Value ); - if( exifError == KErrNone ) - { - aModify.SetExposureProgramL( uint16Value ); - } - - - TRAP( exifError, textValue = aRead.GetUserCommentL() ); - - if ( exifError == KErrNone ) - { - aModify.SetUserCommentL( *textValue ); - } - - TRAP( exifError, textValue = aRead.GetDateTimeOriginalL() ); - if ( exifError == KErrNone ) - { - aModify.SetDateTimeOriginalL( *textValue ); - } - - TRAP( exifError, textValue = aRead.GetDateTimeDigitizedL() ); - if ( exifError == KErrNone ) - { - aModify.SetDateTimeDigitizedL( *textValue ); - } - - exifError = aRead.GetOrientation( uint16Value ); - if ( exifError == KErrNone ) - { - aModify.SetOrientationL( uint16Value ); - } - - exifError = aRead.GetYCbCrPositioning( uint16Value ); - if ( exifError == KErrNone ) - { - aModify.SetYCbCrPositioningL( uint16Value ); - } - - exifError = aRead.GetResolutionUnit( uint16Value ); - if ( exifError == KErrNone ) - { - aModify.SetResolutionUnitL( uint16Value ); - } - - TRAP( exifError, textValue = aRead.GetIsoSpeedRatingsL() ); - if ( exifError == KErrNone ) - { - aModify.SetIsoSpeedRatingsL( *textValue ); - } - - TRAP( exifError, textValue = aRead.GetRelatedSoundFileL() ); - if ( exifError == KErrNone ) - { - aModify.SetRelatedSoundFileL( *textValue ); - } - - TUint32 exifDenominator = 0; - exifError = aRead.GetExposureTime( uint32Value, exifDenominator ); - if ( exifError == KErrNone ) - { - aModify.SetExposureTimeL( uint32Value, exifDenominator ); - } - - exifDenominator = 0; - exifError = aRead.GetApertureValue( uint32Value, exifDenominator ); - if ( exifError == KErrNone ) - { - aModify.SetApertureValueL( uint32Value, exifDenominator ); - } - - exifError = aRead.GetColorSpace( uint16Value ); - if ( exifError == KErrNone ) - { - aModify.SetColorSpaceL( uint16Value ); - } - - TInt32 exifExposureB = 0; - TInt32 exifDenominatorB = 0; - exifError = aRead.GetExposureBiasValue( exifExposureB, exifDenominatorB ); - if ( exifError == KErrNone ) - { - aModify.SetExposureBiasValueL( exifExposureB, exifDenominatorB ); - } - - exifError = aRead.GetMeteringMode( uint16Value ); - if ( exifError == KErrNone ) - { - aModify.SetMeteringModeL( uint16Value ); - } - - exifDenominator = 0; - exifError = aRead.GetThumbnailXResolution( uint32Value, exifDenominator ); - if ( exifError == KErrNone ) - { - aModify.SetThumbnailXResolutionL( uint32Value, exifDenominator ); - } - - exifDenominator = 0; - exifError = aRead.GetThumbnailYResolution( uint32Value, exifDenominator ); - if ( exifError == KErrNone ) - { - aModify.SetThumbnailYResolutionL( uint32Value, exifDenominator ); - } - - exifError = aRead.GetThumbnailResolutionUnit( uint16Value ); - if ( exifError == KErrNone ) - { - aModify.SetThumbnailResolutionUnitL( uint16Value ); - } - - - TInt32 exifShutterSpeedValue = 0; - TInt32 exifDenominatorS = 0; - exifError = aRead.GetShutterSpeedValue( exifShutterSpeedValue, exifDenominatorS ); - if ( exifError == KErrNone ) - { - aModify.SetShutterSpeedValueL( exifShutterSpeedValue, exifDenominatorS ); - } - - TUint8 exifComponent4th( 0 ); - TUint8 exifComponent3rd( 0 ); - TUint8 exifComponent2nd( 0 ); - TUint8 exifComponent1st( 0 ); - - exifError = aRead.GetComponentsConfiguration( - exifComponent1st, exifComponent2nd, exifComponent3rd, exifComponent4th ); - if ( exifError == KErrNone ) - { - aModify.SetComponentsConfigurationL( - exifComponent1st, exifComponent2nd, - exifComponent3rd, exifComponent4th ); - } - - TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFNumber ) ); - if ( exifError == KErrNone ) - { - TPtrC8 exifFNumberBuf( exifTagInfo->Data() ); - TExifTagInfo tagInfo( KIdFNumber, CExifTag::ETagRational, 1 ); - aModify.SetTagL( EIfdExif, tagInfo, exifFNumberBuf ); - } - - - TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalLength ) ); - if ( exifError == KErrNone ) - { - TPtrC8 exifFocalLengthBuf( exifTagInfo->Data() ); - TExifTagInfo tagInfo( KIdFocalLength, CExifTag::ETagRational, 1 ); - TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalLengthBuf ) ); - } - - TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalLength35mmFilm ) ); - if ( exifError == KErrNone ) - { - TPtrC8 exifFocal35mmBuf( exifTagInfo->Data() ); - TExifTagInfo tagInfo( KIdFocalLength35mmFilm, CExifTag::ETagRational, 1 ); - TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocal35mmBuf ) ); - } - - TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalPlaneResolutionUnit ) ); - if ( exifError == KErrNone ) - { - TPtrC8 exifFocalPlaneResolutionUnitBuf( exifTagInfo->Data() ); - TExifTagInfo tagInfo( KIdFocalPlaneResolutionUnit, CExifTag::ETagShort, 1 ); - TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalPlaneResolutionUnitBuf ) ); - } - - TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalPlaneXResolution ) ); - if ( exifError == KErrNone ) - { - TPtrC8 exifFocalPlaneXResBuf( exifTagInfo->Data() ); - TExifTagInfo tagInfo( KIdFocalPlaneXResolution, CExifTag::ETagRational, 1 ); - TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalPlaneXResBuf ) ); - } - - TRAP( exifError, exifTagInfo = aRead.GetTagL( EIfdExif, KIdFocalPlaneYResolution ) ); - if ( exifError == KErrNone ) - { - TPtrC8 exifFocalPlaneYResBuf( exifTagInfo->Data() ); - TExifTagInfo tagInfo( KIdFocalPlaneYResolution, CExifTag::ETagRational, 1 ); - TRAP_IGNORE( aModify.SetTagL( EIfdExif, tagInfo, exifFocalPlaneYResBuf ) ); - } - - exifError = aRead.GetLightSource( uint16Value ); - if ( exifError == KErrNone ) - { - TRAP_IGNORE( aModify.SetLightSourceL( uint16Value ) ); - } - - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmmain.cpp --- a/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmmain.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,367 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Main class in the Memory manager component -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cmdmmain.h" -#include "msdebug.h" -#include "cmmmmain.h" -#include "cmdriveinfo.h" -#include "cmmmquotalistener.h" -#include "cmmmshrinker.h" -#include "cmmmobserver.h" - -// --------------------------------------------------------------------------- -// CCmMmMain::NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMmMain* CCmMmMain::NewL( CCmDmMain& aDbManager ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewL() start")); - CCmMmMain* self = CCmMmMain::NewLC( aDbManager ); - CleanupStack::Pop( self ); - LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmMmMain::NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMmMain* CCmMmMain::NewLC( CCmDmMain& aDbManager ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewLC() start")); - CCmMmMain* self = new ( ELeave ) CCmMmMain( aDbManager ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[MEMORY MNGR]\t CCmMmMain::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// C++ destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMmMain::~CCmMmMain() - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::~CCmMmMain() start")); - - iFileSession.Close(); - iQuotaListeners.ResetAndDestroy(); - delete iDeleter; - delete iFilesToDelete; - delete iFilesToShrink; - - if( iHarvester ) - { - iHarvester->Close(); - } - - CloseMpxCollectionHelper(); - - delete iObserver; - delete iShrinker; - LOG(_L("[MEMORY MNGR]\t CCmMmMain::~CCmMmMain() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmMain::Cancel -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMmMain::Cancel() - { - if ( iDeleter ) - { - iDeleter->Cancel(); - if ( iObserver ) - { - // Trap here, do nothing if it leaves. - TRAP_IGNORE( iObserver->DeleteCompleteL( KErrCancel ) ); - } - } - if ( iShrinker ) - { - iShrinker->Cancel(); - if ( iObserver ) - { - // Trap here, do nothing if it leaves - TRAP_IGNORE( iObserver->ShrinkCompleteL( KErrCancel ) ); - } - } - for( TInt i = 0; i < iQuotaListeners.Count(); i++ ) - { - iQuotaListeners[i]->Cancel(); - } - } - -// --------------------------------------------------------------------------- -// CCmMmMain::DeleteFilesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMmMain::DeleteFilesL( CDesCArray& aFiles ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::DeleteFilesL() start")); - - if ( &aFiles && aFiles.Count() > 0 ) - { - delete iFilesToDelete; - iFilesToDelete = NULL; - iFilesToDelete = new ( ELeave ) CDesC16ArrayFlat( aFiles.Count() ); - for ( TInt i = 0; i < aFiles.Count(); i++ ) - { - iFilesToDelete->AppendL( aFiles[i] ); - } - } - iDeleteIndex = 0; - - if ( iDeleter ) - { - CloseMpxCollectionHelper(); - iMpxCollectionHelper = CMPXCollectionHelperFactory::NewCollectionHelperL(); - iDeleter->Start( TCallBack( BackgroundDeleteL, this ) ); - } - LOG(_L("[MEMORY MNGR]\t CCmMmMain::DeleteFilesL() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmMain::SetObserver -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMmMain::SetObserver( MCmMmObserver& aObserver ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::SetObserver() start")); - iObserver = &aObserver; - LOG(_L("[MEMORY MNGR]\t CCmMmMain::SetObserver() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmMain::SetQuotaListenerStateL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMmMain::SetQuotaListenerStateL( TBool aState ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::SetQuotaListenerStateL() start")); - - if( !aState ) - { - iQuotaListeners.ResetAndDestroy(); - iQuotaListeners.Close(); - LOG(_L("[MEMORY MNGR]\t Quotalisteners deleted")); - } - else - { - iDbManager.PrepareQueryCmdL( EDrivesQuery ); - RPointerArray drives; - TRAP_IGNORE( iDbManager.QueryDrivesL( drives ) ); - iQuotaListeners.ResetAndDestroy(); - for( TInt i = 0 ; i < drives.Count(); i++ ) - { - TRACE(Print(_L("[MEMORY MNGR]\t Starting quota listener to \ - drive = %d"), drives[i]->DriveNumber() )); - CCmMmQuotaListener* listener = - CCmMmQuotaListener::NewL( - iDbManager, - drives[i]->DriveNumber() ); - iQuotaListeners.AppendL( listener ); - } - drives.ResetAndDestroy(); - } - } - -// --------------------------------------------------------------------------- -// CCmMmMain::ShrinkImagesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMmMain::ShrinkImagesL( CDesCArray& aFiles ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::ShrinkImagesL() start")); - - if ( !iShrinker ) - { - iShrinker = CCmMmShrinker::NewL( iDbManager ); - } - else - { - // Cancel the possible ongoing operation - iShrinker->Cancel(); - } - iShrinker->SetObserver( iObserver ); - iShrinker->ShrinkImagesL( aFiles ); - - LOG(_L("[MEMORY MNGR]\t CCmMmMain::ShrinkImagesL() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmMain::MmcState -// --------------------------------------------------------------------------- -// -TBool CCmMmMain::DriveState( const RFs& aFileServer, TInt aDriveNumber ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::DriveState() start")); - - TDriveInfo driveInfo; - TInt error = aFileServer.Drive( driveInfo, aDriveNumber ); - - //check if MMC is present - TBool status = EFalse; - if ( error == KErrNone && driveInfo.iType == EMediaHardDisk ) - { - status = ETrue; - LOG(_L("[MEMORY MNGR]\t CCmMmMain::DriveState() Drive found")); - } - - LOG(_L("[MEMORY MNGR]\t CCmMmMain::DriveState() end")); - return status; - } - -// --------------------------------------------------------------------------- -// C++ constructor -// --------------------------------------------------------------------------- -// -CCmMmMain::CCmMmMain( CCmDmMain& aDbManager ) : - iDeleteIndex( 0 ), - iQuotaListenerState( ETrue ), - iDbManager( aDbManager ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::CCmMmMain() start")); - LOG(_L("[MEMORY MNGR]\t CCmMmMain::CCmMmMain() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmMain::ConstructL -// --------------------------------------------------------------------------- -// -void CCmMmMain::ConstructL() - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::ConstructL() start")); - - User::LeaveIfError( iFileSession.Connect() ); - iDeleter = CIdle::NewL( CActive::EPriorityIdle ); - iHarvester = CMPXHarvesterFactory::NewL(); - SetQuotaListenerStateL( ETrue ); - - LOG(_L("[MEMORY MNGR]\t CCmMmMain::ConstructL() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmMain::BackgroundDeleteL -// --------------------------------------------------------------------------- -// -TInt CCmMmMain::BackgroundDeleteL( TAny* aMm ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::BackgroundDeleteL() start")); - LOG(_L("[MEMORY MNGR]\t CCmMmMain::BackgroundDeleteL() end")); - return ((CCmMmMain*)aMm)->DoBackgroundDeleteL(); - } - -// --------------------------------------------------------------------------- -// CCmMmMain::DoBackgroundDeleteL -// --------------------------------------------------------------------------- -// -TInt CCmMmMain::DoBackgroundDeleteL() - { - LOG(_L("[MEMORY MNGR]\t CCmMmMain::DoBackgroundDeleteL() start")); - TInt moreFiles = EFalse; - TInt error = KErrNone; - TInt trapinfo( KErrNone ); - - if ( iFilesToDelete ) - { - if ( iDeleteIndex < iFilesToDelete->Count() ) - { - TPtrC filenameTemp = (*iFilesToDelete)[iDeleteIndex]; - // Delete file from filesystem - error = iFileSession.Delete( filenameTemp ); - - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmMain:DoBackgroundDeleteL \ -error: %d"), error)); - -#ifdef _DEBUG - - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmMain: File %S deleted"), - &filenameTemp )); -#endif // _DEBUG - TRAP( trapinfo, iMpxCollectionHelper->RemoveL( filenameTemp ) ); - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmMain:DoBackgroundDeleteL \ -RemoveL: %d"), trapinfo)); - - iDeleteIndex++; - } - - // return ETrue if there are more files to delete - if ( iDeleteIndex < iFilesToDelete->Count() ) - { - moreFiles = ETrue; - } - // No more files to be deleted. Call Media Gallery update. - else if ( iFilesToDelete->Count() ) - { - MCLFContentListingEngine* clfEngine = - ContentListingFactory::NewContentListingEngineLC(); - if( clfEngine ) - { - TRAP_IGNORE( clfEngine->UpdateItemsL() ); - - TRAP_IGNORE( iHarvester->RemoveFilesL( *iFilesToDelete ) ); - } - CleanupStack::PopAndDestroy(); - - } - - } - - // If all files are deleted, inform observer that deletion is ready. - if ( !moreFiles ) - { - CloseMpxCollectionHelper(); - } - - if ( !moreFiles && iObserver ) - { - delete iFilesToDelete; - iFilesToDelete = NULL; - iObserver->DeleteCompleteL( error ); - } - LOG(_L("[MEMORY MNGR]\t CCmMmMain::DoBackgroundDeleteL() end")); - - // Return EFalse if background deletion is done, ETrue if there are more - // files to be deleted. - return moreFiles; - } - -// --------------------------------------------------------------------------- -// CCmMmMain::CloseMpxCollectionHelper -// --------------------------------------------------------------------------- -// -void CCmMmMain::CloseMpxCollectionHelper() - { - if( iMpxCollectionHelper ) - { - iMpxCollectionHelper->Close(); - } - iMpxCollectionHelper = NULL; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmquotalistener.cpp --- a/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmquotalistener.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,541 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Main class in the manory manager component -* -*/ - - -#include -#include // CAknGlobalNote -#include // CAknGlobalProgressDialog -#include -#include -#include -#include // R_AVKON_SOFTKEYS_OK_EMPTY -#include // RResourceFile -#include // TResourceReader -#include // BaflUtils -#include -#include -#include - -#include "cmcommon.h" -#include "cmfilllistitem.h" -#include "cmdmmain.h" -#include "upnpstring.h" -#include "msdebug.h" -#include "cmmmmain.h" -#include "cmmmquotalistener.h" - - -// Contants -const TInt64 KDeleteLimit = 50; // 50MB -const TInt KSizeStringLength = 10; -const TInt KTimeoutValue = 3000000; // 3 seconds -_LIT16( KCmDoubleBackSlash, "\\" ); -_LIT16( KCmColon, ":"); - -_LIT( KResourceFilePath, "\\resource\\apps\\memorymanager.rsc" ); - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::NewL -// --------------------------------------------------------------------------- -// -CCmMmQuotaListener* CCmMmQuotaListener::NewL( CCmDmMain& aDbManager, - TInt aDrive ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewL() start")); - CCmMmQuotaListener* self = CCmMmQuotaListener::NewLC( aDbManager, - aDrive ); - CleanupStack::Pop( self ); - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::NewLC -// --------------------------------------------------------------------------- -// -CCmMmQuotaListener* CCmMmQuotaListener::NewLC( CCmDmMain& aDbManager, - TInt aDrive ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewLC() start")); - CCmMmQuotaListener* self = new ( ELeave ) CCmMmQuotaListener( aDbManager, - aDrive ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// C++ destructor -// --------------------------------------------------------------------------- -// -CCmMmQuotaListener::~CCmMmQuotaListener() - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::~CCmMmQuotaListener()\ - start")); - if( IsActive() ) - { - Cancel(); - } - iFileSession.Close(); - - if( iHarvester ) - { - iHarvester->Close(); - } - delete iProgressDialog; - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::~CCmMmQuotaListener() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::DoCancel -// --------------------------------------------------------------------------- -// -void CCmMmQuotaListener::DoCancel() - { - iFileSession.NotifyDiskSpaceCancel(); - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::RunL -// --------------------------------------------------------------------------- -// -void CCmMmQuotaListener::RunL() - { - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmQuotaListener:RunL status = %d"), - iStatus.Int() ) ); - - // Check if MMC is inserted - if ( CCmMmMain::DriveState( iFileSession, iDrive ) && - !iProgressDialog ) - { - // Check out that NotifyDiskSpace event came from quota - TVolumeInfo volumeInfo; - iFileSession.Volume( volumeInfo, iDrive ); - - if ( volumeInfo.iFree >= iQuota ) - { - // Request a notification when disk space crosses the threshold - // value. - RequestDiskSpaceNotification(); - } - else - { - // Get lowest priority list - RPointerArray array; - iDbManager.PrepareQueryCmdL( EFilledLowPriorityQuery ); - iDbManager.GetLowPriorityFilledFilesL( iDrive, array ); - // If Fill list is empty we wait 3 seconds and try again - if ( !array.Count() ) - { - TRACE( Print( _L("[MEMORY MNGR]\t CCmMmQuotaListener:RunL \ - Fill list is empty") ) ); - } - else - { - switch ( iStatus.Int() ) - { - case KErrNone: - { - // Remove files from the end of the list so that the - // total amount of files in the list is no more than - // KDeleteLimit megabytes. - - // listsize is the total size of the files in array - // in megabytes. - TUint32 listSize = RemoveExtraFiles( array, - KDeleteLimit ); - - // Get fill list name - HBufC8* listName8 = NULL; - iDbManager.GetFillListNameL( listName8, - array[0]->ListId() ); - CleanupStack::PushL( listName8 ); - - HBufC* listName16 = - HBufC::NewLC( listName8->Length() ); - listName16->Des().Copy( *listName8 ); - - // Get confirmation for the delete operation from the - // user. - TRequestStatus status = DeleteConfirmationL( - *listName16, - listSize ); - - // If file deletion Yes is selected - if ( status.Int() == EAknSoftkeyYes ) - { - // delete the files - TUint32 delAmount = DeleteFilesL( array, - *listName8 ); - - TRACE( Print(_L("[MEMORY MNGR]\t Deleted %d \ - MBytes from list %S"), - delAmount, listName16 ) ); - } - else - { - LOG( _L("EAknSoftkeyNo") ); - // Request a notification when disk space crosses - // the threshold value. - iFileSession.NotifyDiskSpace( - iQuota, iDrive, iStatus ); - } - - // clean up - CleanupStack::PopAndDestroy( listName16 ); - CleanupStack::PopAndDestroy( listName8 ); - array.ResetAndDestroy(); - SetActive(); - break; - } - case KErrNotReady: - { - TRACE( Print( - _L("[MEMORY MNGR]\t CCmMmQuotaListener::RunL \ - status = %d"), iStatus.Int() ) ); - - // Wait 3 seconds and try again. - RequestNotificationAfterTimeout( KTimeoutValue ); - break; - } - default: - { - TRACE( Print( - _L("[MEMORY MNGR]\t CCmMmQuotaListener::RunL \ - status = %d"), iStatus.Int() ) ); - - // Request a notification when disk space crosses the - // threshold value. - RequestDiskSpaceNotification(); - break; - } - } - } - } - } - else if( iProgressDialog ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::RunL ProgressDialog")); - iProgressDialog->CancelProgressDialog(); - iProgressDialog = NULL; - RequestDiskSpaceNotification(); - } - else - { - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmQuotaListener:RunL: \ - Drive not found!"))); - } - } - -// --------------------------------------------------------------------------- -// C++ constructor -// --------------------------------------------------------------------------- -// -CCmMmQuotaListener::CCmMmQuotaListener( CCmDmMain& aDbManager, TInt aDrive ) - : CActive( EPriorityStandard ), - iDrive( aDrive ), - iQuota( KCmMmcLowMemory ), - iDbManager( aDbManager ) - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::ConstructL -// --------------------------------------------------------------------------- -// -void CCmMmQuotaListener::ConstructL() - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ConstructL() start")); - - User::LeaveIfError( iFileSession.Connect() ); - - iHarvester = CMPXHarvesterFactory::NewL(); - - // Request a notification when disk space crosses the threshold - // value. - RequestDiskSpaceNotification(); - - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ConstructL() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::ReadResourceL -// --------------------------------------------------------------------------- -// -HBufC16* CCmMmQuotaListener::ReadResourceL( TInt aResourceId ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ReadReasourceL() start")); - TFileName rscFileName( KResourceFilePath ); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( iFileSession, rscFileName ); - - TRACE( Print( _L("[MEMORY MNGR]\t Resource path = %s"), &rscFileName ) ); - RResourceFile resourceFile; - TInt err( KErrNone ); - TRAP(err, resourceFile.OpenL(iFileSession, rscFileName )) - if ( err != KErrNone ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::Read from e")); - // not found? let's try mmc drive - rscFileName.Copy( PathInfo::MemoryCardRootPath() ); - rscFileName.Delete(2, 2); // remove // - rscFileName.Append( KResourceFilePath ); - resourceFile.OpenL(iFileSession, rscFileName ); - } - HBufC8* res = resourceFile.AllocReadLC( aResourceId ); - TResourceReader theReader; - theReader.SetBuffer(res); - HBufC16* des = theReader.ReadHBufC16L(); - CleanupStack::PopAndDestroy( res ); - resourceFile.Close(); - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::ReadReasourceL() end")); - return des; - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::ResolveAndAppendRootPath() -// --------------------------------------------------------------------------- -// -HBufC* CCmMmQuotaListener::ResolveAndAppendRootPathL( - const TInt aDriveNumber ) - { - HBufC* buf = HBufC::NewLC( 4 ); - TChar driveChar; - iFileSession.DriveToChar( aDriveNumber, driveChar ); - buf->Des().Append( driveChar ); - buf->Des().Append( KCmColon ); - buf->Des().Append( KCmDoubleBackSlash ); - CleanupStack::Pop( buf ); - return buf; - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::RequestNotificationAfterTimeout() -// --------------------------------------------------------------------------- -// -void CCmMmQuotaListener::RequestNotificationAfterTimeout( TInt aTimeoutValue ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::\ - RequestNotificationAfterTimeout()")); - TTimeIntervalMicroSeconds32 timeOut( aTimeoutValue ); - RTimer timer; - timer.CreateLocal(); - TRequestStatus status( KRequestPending ); - timer.After( status, timeOut ); // Wait time defined by aTimeoutValue - User::WaitForRequest( status ); - timer.Close(); - - // Request a notification when disk space crosses the threshold - // value. - RequestDiskSpaceNotification(); - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::RequestDiskSpaceNotification() -// --------------------------------------------------------------------------- -// -void CCmMmQuotaListener::RequestDiskSpaceNotification() - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::\ - RequestDiskSpaceNotification()")); - iFileSession.NotifyDiskSpace( iQuota, iDrive, iStatus ); - SetActive(); - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::DeleteConfirmationL() -// --------------------------------------------------------------------------- -// -TRequestStatus CCmMmQuotaListener::DeleteConfirmationL( - const TDesC& aListName, - TUint32 aListSize ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::DeleteConfirmationL()")); - // Get text for delete confirmation dialog - HBufC* format = ReadResourceL( R_MSERV_CONF_AUTO_REMOVE ); - CleanupStack::PushL( format ); - - HBufC* tempName = aListName.AllocLC(); - - // Create confirm note - HBufC* confirmNote = NULL; - if ( aListName.Length() == 0 ) - { - //reserve 1 character for empty list name - confirmNote = HBufC::NewLC( format->Length() + - 1 + - KSizeStringLength ); - confirmNote->Des().Format( *format, - aListSize, - &KNullDesC() ); - } - else - { - confirmNote = HBufC::NewLC( format->Length() + - aListName.Length() + - KSizeStringLength ); - confirmNote->Des().Format( *format, - aListSize, - tempName ); - } - - // Show note to ask if it's ok to delete files. - CAknGlobalNote* note = CAknGlobalNote::NewLC(); - TRequestStatus status = KRequestPending; - note->SetSoftkeys( R_AVKON_SOFTKEYS_YES_NO ); - note->ShowNoteL( status, - EAknGlobalInformationNote, - *confirmNote ); - User::WaitForRequest( status ); - - // Clean up - CleanupStack::PopAndDestroy( note ); - CleanupStack::PopAndDestroy( confirmNote ); - CleanupStack::PopAndDestroy( tempName ); - CleanupStack::PopAndDestroy( format ); - - // Return the user selection. - return status; - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::DeleteFilesL() -// --------------------------------------------------------------------------- -// -TUint32 CCmMmQuotaListener::DeleteFilesL( - const RPointerArray& aArray, - const TDesC8& aListName - ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::DeleteFilesL()")); - // Get text for progress dialog - HBufC* format = ReadResourceL( R_MSERV_PROGRESS_REMOVE ); - CleanupStack::PushL( format ); - - HBufC* listName = UpnpString::ToUnicodeL( aListName ); - CleanupStack::PushL( listName ); - - HBufC* progressNote = NULL; - if ( listName->Length() == 0 ) - { - //reserve 1 character for empty list name - progressNote = HBufC::NewLC( format->Length() + 1 ); - progressNote->Des().Format( *format, - &KNullDesC() ); - } - else - { - progressNote = HBufC::NewLC( format->Length() + - listName->Length() ); - progressNote->Des().Format( *format, - listName ); - } - - - // Show file deletion progress in a progress dialog. - iProgressDialog = CAknGlobalProgressDialog::NewL(); - iProgressDialog->ShowProgressDialogL( iStatus, - *progressNote, - R_AVKON_SOFTKEYS_EMPTY, - aArray.Count() ); - - // Create files array for file paths - CDesC16Array* files = - new (ELeave) CDesC16ArrayFlat( aArray.Count() ); - CleanupStack::PushL( files ); - - // Delete all items from current array - HBufC* temp( NULL ); - TFileName path; - TUint32 sizes = 0; - - for ( TInt i = 0; i < aArray.Count(); i++ ) - { - temp = ResolveAndAppendRootPathL( iDrive ); - CleanupStack::PushL( temp ); - path.Append( *temp ); - path.Append( aArray[i]->Path() ); - files->AppendL( path ); - iFileSession.Delete( path ); - CleanupStack::PopAndDestroy( temp ); - path.Zero(); - sizes += aArray[i]->Size(); - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmQuotaListener::DeleteFilesL \ - Deleted file %S, size %d"), - &aArray[i]->Path(), - aArray[i]->Size())); - iProgressDialog->UpdateProgressDialog( i, aArray.Count() - 1 ); - } - - TInt tes( KErrNone ); - TRAP( tes, iDbManager.RestoreFileStatusesL( aArray, - aListName ) ); - TRACE( Print( _L("[MEMORY MNGR]\t tes = %d "), tes ) ); - - MCLFContentListingEngine* clfEngine = - ContentListingFactory::NewContentListingEngineLC(); - TRAP_IGNORE( clfEngine->UpdateItemsL() ); - CleanupStack::PopAndDestroy(); - - TRAP_IGNORE( iHarvester->RemoveFilesL( *files ) ); - - CleanupStack::PopAndDestroy( files ); - iProgressDialog->ProcessFinished(); - CleanupStack::PopAndDestroy( progressNote ); - CleanupStack::PopAndDestroy( listName ); - CleanupStack::PopAndDestroy( format ); - - return sizes; - } - -// --------------------------------------------------------------------------- -// CCmMmQuotaListener::RemoveExtraFiles() -// --------------------------------------------------------------------------- -// -TUint32 CCmMmQuotaListener::RemoveExtraFiles( - RPointerArray& aArray, - TInt64 aDeleteLimit ) const - { - LOG(_L("[MEMORY MNGR]\t CCmMmQuotaListener::RemoveExtraFiles()")); - TUint32 listSize( 0 ); - TInt lastIndex( 0 ); - for ( TInt i = 0; - i < aArray.Count() && listSize <= aDeleteLimit; - i++ ) - { - listSize += ( aArray[i]->Size() / KMega ); - lastIndex = i; - } - - TRACE(Print(_L("[MEMORY MNGR]\t Deleting extra \ - items..."))); - for( TInt j = ( aArray.Count() - 1 ); - j > lastIndex ; - j-- ) - { - delete aArray[j]; - aArray.Remove( j ); - } - - aArray.Compress(); - return listSize; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmshrinker.cpp --- a/homesync/contentmanager/cmserver/cmmemorymanager/src/cmmmshrinker.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,525 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CCmShrinker class in the Memory manager component -* -*/ - - -#include -#include // CImageDecoder, CImageEncoder -#include // CBitmapScaler -#include // CFbsBitmap -#include // RWsSession, CWsScreenDevice - -#include "cmdmmain.h" -#include "msdebug.h" -#include "cmmmimagemetadataresolver.h" -#include "cmmmobserver.h" -#include "cmmmshrinker.h" - -// CONSTANTS -const TInt KScreenWidth = 128; -const TInt KScreenHeight = 128; - - -// --------------------------------------------------------------------------- -// CCmMmShrinker::NewL -// --------------------------------------------------------------------------- -// -CCmMmShrinker* CCmMmShrinker::NewL( CCmDmMain& aDbManager ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewL() start")); - CCmMmShrinker* self = CCmMmShrinker::NewLC( aDbManager ); - CleanupStack::Pop( self ); - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::NewLC -// --------------------------------------------------------------------------- -// -CCmMmShrinker* CCmMmShrinker::NewLC( CCmDmMain& aDbManager ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewLC() start")); - CCmMmShrinker* self = new ( ELeave ) CCmMmShrinker( aDbManager ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// C++ constructor -// --------------------------------------------------------------------------- -// -CCmMmShrinker::CCmMmShrinker( CCmDmMain& aDbManager ) : - CActive( EPriorityIdle ), - iShrinkIndex( 0 ), - iState( EIdle ), - iDbManager( aDbManager ) - { - - CActiveScheduler::Add( this ); - } - - -// --------------------------------------------------------------------------- -// CCmMmShrinker::ConstructL -// --------------------------------------------------------------------------- -// -void CCmMmShrinker::ConstructL() - { - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ConstructL() start")); - - User::LeaveIfError( iFileSession.Connect() ); - User::LeaveIfError( RFbsSession::Connect() ); - - // Get the screen size - iScreenSize = ScreenSizeL(); - - iImageMetadataResolver = CCmMmImageMetadataResolver::NewL( iFileSession ); - - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ConstructL() end")); - } - - -// --------------------------------------------------------------------------- -// C++ destructor -// --------------------------------------------------------------------------- -// -CCmMmShrinker::~CCmMmShrinker() - { - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::~CCmMmShrinker() start")); - Cancel(); - delete iBitmap; - iFileSession.Close(); - - delete iBitmapScaler; - delete iFiles; - delete iImageDecoder; - delete iImageEncoder; - RFbsSession::Disconnect(); - delete iImageMetadataResolver; - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::~CCmMmShrinker() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::DoCancel -// --------------------------------------------------------------------------- -// -void CCmMmShrinker::DoCancel() - { - ClearShrinker(); - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::RunError -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -TInt CCmMmShrinker::RunError( TInt aError ) -#else //_DEBUG -TInt CCmMmShrinker::RunError( TInt /*aError*/ ) -#endif // _DEBÚG - { - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunError error = %d"), - aError )); - - // NOTE!!! - // Should we continue from the next file, if there's error in the - // middle of the shrinking operation - iShrinkIndex++; - iState = EIdle; - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::ShrinkImagesL -// --------------------------------------------------------------------------- -// -void CCmMmShrinker::ShrinkImagesL( CDesCArray& aFiles ) - { - // Cancel 1st - Cancel(); - - // Add processed files - if ( &aFiles ) - { - delete iFiles; - iFiles = NULL; - iFiles = new ( ELeave ) CDesC16ArrayFlat( aFiles.Count() ); - for (TInt i = 0; i < aFiles.Count(); i++) - { - iFiles->AppendL( aFiles[i] ); - } - } - // Start the action - iShrinkIndex = 0; - iState = EIdle; - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone); - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::SetObserver -// --------------------------------------------------------------------------- -// -void CCmMmShrinker::SetObserver( MCmMmObserver* aObserver ) - { - iObserver = aObserver; - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::RunL -// --------------------------------------------------------------------------- -// -void CCmMmShrinker::RunL() - { - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL status = %d"), - iStatus.Int() )); - - // If all files have been processed, notify the observer. - if ( iShrinkIndex >= iFiles->Count() ) - { - if ( iObserver ) - { - iObserver->ShrinkCompleteL( KErrNone ); - } - } - else - { - if ( iState == EIdle ) - { - const TDesC& origFilename = (*iFiles)[iShrinkIndex]; - iImageMetadataResolver->CaptureOrginalMetadataL( origFilename ); - // Check that file exists (entry is not actually used) - TEntry entry; - User::LeaveIfError( iFileSession.Entry( origFilename, entry )); - iStartTime.HomeTime(); - CImageDecoder* imageDecoder = NULL; - TRAPD( error, - imageDecoder = CImageDecoder::FileNewL( - iFileSession, - origFilename, - CImageDecoder::EOptionNone ) ); - if ( error ) - { - if ( iObserver ) - { - iObserver->ShrinkCompleteL( error ); - } - } - else - { - TUid imageType = KNullUid; - TUid imageSubType = KNullUid; - imageDecoder->ImageType( 0, imageType, imageSubType ); - - if ( imageType == KImageTypeBMPUid ) - { - iState = EScale; - } - else if ( imageType == KImageTypeGIFUid || - imageType == KImageTypePNGUid || - imageType == KImageTypeJPGUid ) - { - iState = EDecode; - } - else - { - if ( iObserver ) - { - iObserver->ShrinkCompleteL( KErrNone ); - } - } - - delete imageDecoder; - imageDecoder = NULL; - } - } - - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: status = %d"), - iStatus.Int() )); - - switch ( iState ) - { - case EDecode: - { - const TDesC& origFilename = (*iFiles)[iShrinkIndex]; - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: Decoding file \ - %S"), &origFilename )); - - delete iImageDecoder; - iImageDecoder = NULL; - delete iBitmap; - iBitmap = NULL; - - iImageDecoder = CImageDecoder::FileNewL( iFileSession, - origFilename, CImageDecoder::EOptionNone ); - iBitmap = new (ELeave) CFbsBitmap(); - TInt error = iBitmap->Create( - iImageDecoder->FrameInfo().iOverallSizeInPixels, - iImageDecoder->FrameInfo().iFrameDisplayMode ); - if ( error != KErrNone ) - { - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL \ - error: %d"), error )); - if ( iObserver ) - { - TRACE(Print(_L("[MEMORY MNGR]\t Clearing shrinker" ))); - ClearShrinker(); - iObserver->ShrinkCompleteL( error ); - } - Cancel(); - } - else - { - iImageDecoder->Convert( &iStatus, *iBitmap ); - - iState = EScale; - SetActive(); - } - break; - } - case EScale: - { - const TDesC& origFilename = (*iFiles)[iShrinkIndex]; - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: Scaling file \ - %S"), &origFilename )); - - // If converting is still ongoing we should continue it - if ( iStatus == KErrUnderflow ) - { - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: \ - Still decoding file %S"), &origFilename )); - iImageDecoder->ContinueConvert( &iStatus ); - SetActive(); - } - else - { - delete iBitmapScaler; - iBitmapScaler = NULL; - iBitmapScaler = CBitmapScaler::NewL(); - - iBitmapScaler->Scale( &iStatus, *iBitmap, iScreenSize ); - iState = EEncode; - SetActive(); - - delete iImageDecoder; - iImageDecoder = NULL; - } - - break; - } - case EEncode: - { - const TDesC& origFilename = (*iFiles)[iShrinkIndex]; - TRACE(Print(_L("[MEMORY MNGR]\t CCmMmShrinker: Encoding file \ - %S"), &origFilename )); - - delete iImageEncoder; - iImageEncoder = NULL; - - // Shrink into private directory - PrivatePath( iFileSession, iTempFilename, origFilename ); - - // Check that if the file already exists somehow... - if ( iTempFilename == origFilename ) - { - // Delete the original - iFileSession.Delete( origFilename ); - } - iImageEncoder = CImageEncoder::FileNewL( - iFileSession, - iTempFilename, - CImageEncoder::EOptionNone, - KImageTypeJPGUid ); - - iImageEncoder->Convert( &iStatus, *iBitmap ); - iState = EReplace; - - SetActive(); - break; - } - case EReplace: - { - const TDesC& origFilename = (*iFiles)[iShrinkIndex]; - TRACE( Print( - _L("[MEMORY MNGR]\t CCmMmShrinker: Replacing file %S"), - &origFilename) ); - - TInt error = iFileSession.Replace( - iTempFilename, - origFilename ); - - TRACE( Print( - _L("[MEMORY MNGR]\t CCmMmShrinker: Replace done err: %d"), - error ) ); - - // Resolve orginal image metadata!!! - TRAPD( mdError, iImageMetadataResolver->ResolveMetadataL( - origFilename ) ); - if( mdError ) - { - TRACE( Print( - _L("[MEMORY MNGR]\t Metadata resolving error : %d"), - mdError ) ); - } - - iStopTime.HomeTime(); - - TTimeIntervalMicroSeconds t = - iStartTime.MicroSecondsFrom( iStopTime ); - error = iDbManager.IncrementShrinkTimeL( - iFiles->Count(), - iStartTime.MicroSecondsFrom( iStopTime ).Int64() / 1000 ); - - iState = EIdle; - iShrinkIndex++; - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - break; - } - case EIdle: - { - TRACE( Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL() \ - Idle state")) ); - break; - } - default: - { - TRACE( Print(_L("[MEMORY MNGR]\t CCmMmShrinker::RunL() \ - Incorrect state")) ); - if ( iObserver ) - { - iObserver->ShrinkCompleteL( iStatus.Int() ); - } - Cancel(); - break; - } - } - } - } - - -// --------------------------------------------------------------------------- -// CCmMmShrinker::ScreenSizeL -// --------------------------------------------------------------------------- -// -TSize CCmMmShrinker::ScreenSizeL() - { - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ScreenSizeL() start")); - - TSize screenSize( KScreenWidth, KScreenHeight ); - RWsSession session; - - TInt error = session.Connect() ; - CleanupClosePushL( session ); - if ( !error ) - { - CWsScreenDevice* screenDevice = - new ( ELeave ) CWsScreenDevice( session ); - if ( screenDevice && !screenDevice->Construct() ) - { - TSize temp( KScreenWidth, KScreenHeight ); - temp = screenDevice->SizeInPixels(); - // Use landscape mode in shrinking - TRACE(Print(_L("[MEMORY MNGR]\t Image height = %d"),temp.iWidth)); - TRACE(Print(_L("[MEMORY MNGR]\t Image width = %d"),temp.iHeight)); - screenSize.iHeight = temp.iWidth; - screenSize.iWidth = temp.iHeight; - } - delete screenDevice; - screenDevice = NULL; - } - - CleanupStack::PopAndDestroy( &session ); - - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::ScreenSizeL() end")); - return screenSize; - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::PrivatePath -// --------------------------------------------------------------------------- -// -void CCmMmShrinker::PrivatePath( RFs& aFs, - TFileName& aPrivatePath, - const TFileName& aOriginal ) - { - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::PrivatePath() start")); - - aPrivatePath.Zero(); - - TParse nameParse; - nameParse.Set( aOriginal, NULL, NULL ); - - aPrivatePath.Append( nameParse.Drive() ); - TFileName privatePath; - TInt err = aFs.PrivatePath( privatePath ); - if ( !err ) - { - aPrivatePath.Append( privatePath ); - - // Now the path contains everything but filename and extension - // => check that the directory exists. If not, it will be created. - // Possible error is ignored at the moment - // (normal case is KErrAlreadyExists) - err = aFs.MkDirAll( aPrivatePath ); - - - aPrivatePath.Append( nameParse.NameAndExt() ); - } - LOG(_L("[MEMORY MNGR]\t CCmMmShrinker::PrivatePath() end")); - } - -// --------------------------------------------------------------------------- -// CCmMmShrinker::ClearShrinker -// --------------------------------------------------------------------------- -// -void CCmMmShrinker::ClearShrinker() - { - if ( iImageDecoder ) - { - iImageDecoder->Cancel(); - delete iImageDecoder; - iImageDecoder = NULL; - } - if ( iBitmapScaler ) - { - iBitmapScaler->Cancel(); - delete iBitmapScaler; - iBitmapScaler = NULL; - } - if ( iImageEncoder ) - { - iImageEncoder->Cancel(); - delete iImageEncoder; - iImageEncoder = NULL; - } - if( iBitmap ) - { - delete iBitmap; - iBitmap = NULL; - } - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/bwins/cmscheduleru.def --- a/homesync/contentmanager/cmserver/cmscheduler/bwins/cmscheduleru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - ?NewL@CCmScheduler@@SAPAV1@AAVMCmServiceObserver@@AAVMCmSettings@@@Z @ 1 NONAME ; class CCmScheduler * CCmScheduler::NewL(class MCmServiceObserver &, class MCmSettings &) - ?ServiceExecuted@CCmScheduler@@QAEXW4TCmService@@H@Z @ 2 NONAME ; void CCmScheduler::ServiceExecuted(enum TCmService, int) - ?SetEnabledL@CCmScheduler@@QAEXH@Z @ 3 NONAME ; void CCmScheduler::SetEnabledL(int) - ?SetScheduledServiceState@CCmScheduler@@QAEXH@Z @ 4 NONAME ; void CCmScheduler::SetScheduledServiceState(int) - ?SetServiceToExecute@CCmScheduler@@QAEXW4TCmService@@@Z @ 5 NONAME ; void CCmScheduler::SetServiceToExecute(enum TCmService) - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/eabi/cmscheduleru.def --- a/homesync/contentmanager/cmserver/cmscheduler/eabi/cmscheduleru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -EXPORTS - _ZN12CCmScheduler11SetEnabledLEi @ 1 NONAME - _ZN12CCmScheduler15ServiceExecutedE10TCmServicei @ 2 NONAME - _ZN12CCmScheduler19SetServiceToExecuteE10TCmService @ 3 NONAME - _ZN12CCmScheduler24SetScheduledServiceStateEi @ 4 NONAME - _ZN12CCmScheduler4NewLER18MCmServiceObserverR11MCmSettings @ 5 NONAME - _ZTI12CCmScheduler @ 6 NONAME ; ## - _ZTI17CCmCenrepNotifier @ 7 NONAME ; ## - _ZTI18CCmCommsDbNotifier @ 8 NONAME ; ## - _ZTV12CCmScheduler @ 9 NONAME ; ## - _ZTV17CCmCenrepNotifier @ 10 NONAME ; ## - _ZTV18CCmCommsDbNotifier @ 11 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/group/bld.inf --- a/homesync/contentmanager/cmserver/cmscheduler/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 information file for CM Scheduler -* -*/ - - - -// Supported platforms -prj_platforms -DEFAULT - -// MMP files -prj_mmpfiles -cmscheduler.mmp - -// files to be exported -prj_exports -../inc/cmscheduler.h |../../../../../inc/cmscheduler.h diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/group/cmscheduler.mmp --- a/homesync/contentmanager/cmserver/cmscheduler/group/cmscheduler.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +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 project MyMediaWizard -* -*/ - -#include - -TARGET cmscheduler.dll -TARGETTYPE dll -UID 0x1000008d 0x10281FAF - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH /sys/bin - -USERINCLUDE ../inc -USERINCLUDE ../../../mediaservant/inc -USERINCLUDE ../../cmserver/inc/server - -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -SOURCEPATH ../src - -SOURCE cmscheduler.cpp -SOURCE cmcommsdbnotifier.cpp -SOURCE cmcenrepnotifier.cpp - -LIBRARY euser.lib -LIBRARY connmon.lib -LIBRARY commdb.lib -LIBRARY apgrfx.lib -LIBRARY ws32.lib -LIBRARY cmsettingsengine.lib -LIBRARY centralrepository.lib // cenrep notifier -LIBRARY ecom.lib -LIBRARY cmcommon.lib // for wlan scan - -DEBUGLIBRARY flogger.lib diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/inc/cmcenrepnotifier.h --- a/homesync/contentmanager/cmserver/cmscheduler/inc/cmcenrepnotifier.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +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: central repository notifier class definition -* -*/ - - -#ifndef _CCMCENREPNOTIFIER_H -#define _CCMCENREPNOTIFIER_H - -// Include Files -#include - -// FORWARD DECLARATIONS -class CRepository; -class CCmScheduler; - - -// CLASS DECLARATION - -/** - * Comms database notifier class for scheduler - * @lib cmscheduler.lib - * @since S60 5.1 - */ -class CCmCenrepNotifier : public CActive - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CCmCenrepNotifier* NewL( CCmScheduler& aSheduler ); - - /** - * Destructor. - */ - virtual ~CCmCenrepNotifier(); - - /** - * Reads current profile from central repository - * - * @since S60 5.1 - * @param aProfile, reference of current profile - * @return TInt, error code - */ - TInt GetCurrentProfile( TInt& aProfile ); - - protected: // From CActive - - /** - * Called when request completes - * - * @since S60 5.1 - */ - void RunL(); - - /** - * Called when request is cancelled - * - * @since S60 5.1 - */ - void DoCancel(); - - /** - * Called when RunL leaves - * - * @since S60 5.1 - */ - TInt RunError(TInt aError); - - private: // Constructors - - /** - * Default constructor. - */ - CCmCenrepNotifier( CCmScheduler& aSheduler ); - - /** - * Two-phased constructor. - */ - void ConstructL(); - - /** - * Initiates asyncronous notification request to database - * - * @since S60 5.1 - */ - void RequestNotification(); - - private: - - /** - * Database to be monitored - */ - CRepository* iRepository; // owned - - /** - * Change observer - */ - CCmScheduler& iScheduler; // not owned - }; - -#endif // _CCMCENREPNOTIFIER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/inc/cmcommsdbnotifier.h --- a/homesync/contentmanager/cmserver/cmscheduler/inc/cmcommsdbnotifier.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +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: Comms database notifier class definition -* -*/ - - -#ifndef _CCMCOMMSDBNOTIFIER_H -#define _CCMCOMMSDBNOTIFIER_H - -// Include Files -#include - -// FORWARD DECLARATIONS -class CCommsDatabase; -class CCmScheduler; - -// CLASS DECLARATION - -/** - * Comms database notifier class for scheduler - * @lib cmscheduler.lib - * @since S60 5.1 - */ -class CCmCommsDbNotifier : public CActive - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CCmCommsDbNotifier* NewL( CCmScheduler& aSheduler ); - - /** - * Destructor. - */ - virtual ~CCmCommsDbNotifier(); - - /** - * Checks wlan scan state - * - * @since S60 5.1 - * @return TBool, ETrue if value changed, EFalse otherwise - */ - TBool HasScanStateChangedL(); - - /** - * Gets wlan scan interval setting value - * - * @since S60 5.1 - * @return TUint32, scan interval - */ - TUint32 WlanScanStateL(); - - protected: // From CActive - - /** - * Called when request completes - * - * @since S60 5.1 - */ - void RunL(); - - /** - * Called when request is cancelled - * - * @since S60 5.1 - */ - void DoCancel(); - - /** - * Called when RunL leaves - * - * @since S60 5.1 - */ - TInt RunError(TInt aError); - - private: // Constructors - - /** - * Default constructor. - */ - CCmCommsDbNotifier( CCmScheduler& aSheduler ); - - /** - * Two-phased constructor. - */ - void ConstructL(); - - /** - * Initiates asyncronous notification request to database - * - * @since S60 5.1 - */ - void RequestNotification(); - - private: - - /** - * Database to be monitored - */ - CCommsDatabase* iDb; // owned - - /** - * Change observer - */ - CCmScheduler* iScheduler; // not owned - - /** - * Previous scan state - */ - TUint32 iScanState; - }; - -#endif // _CCMCOMMSDBNOTIFIER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/inc/cmscheduler.h --- a/homesync/contentmanager/cmserver/cmscheduler/inc/cmscheduler.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,298 +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: Main class in the CM Scheduler component -* -*/ - - -#ifndef _CMSCHEDULER_H -#define _CMSCHEDULER_H - -#include -#include -#include "cmserver.h" -#include "cmsettings.h" - -/* Forward declarations. */ -class CCmCommsDbNotifier; -class CCmCenrepNotifier; -class CCmSettingsEngine; -class MCmSettings; - -/** - * CCmScheduler class - * Part of CM Scheduler - * @lib cmscheduler.lib - * @since S60 v5.1 - */ -class CCmScheduler : public CActive, - public MConnectionMonitorObserver - { - private: // Enumerations - - // Scheduler states - enum TCmSchedulerState - { - ECmScStateOffline = 0, // Don't start processing - ECmScStateOnline // Start processing - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CCmScheduler* NewL( MCmServiceObserver& aServer, - MCmSettings& aSettings ); - - /** - * Destructor. - */ - virtual ~CCmScheduler(); - - /** - * Enabled connection monitor events - * - * @since S60 5.1 - * @param aEnable, ETrue if enabled, EFalse otherwise - */ - void SetEnabledL( TBool aEnable ); - - /** - * Called when service is executed - * - * @since S60 5.1 - * @param aService, executed service - * @param aErr, error code - */ - IMPORT_C void ServiceExecuted( TCmService aService, TInt aErr ); - - /** - * Sets service where execution starts - * - * @since S60 5.1 - * @param aService, service to be executed - */ - IMPORT_C void SetServiceToExecute( TCmService aService ); - - /** - * Called by commsdb notifier when wlan scan state is changed - * - * @since S60 5.1 - * @param aState, Scan interval - */ - void WlanScanStateChanged( TInt aState ); - - /** - * Called by cenrep notifier when profile has been changed - * - * @since S60 5.1 - * @param aProfile, current profile - */ - void ProfileChangedL( TInt aProfile ); - - /** - * Sets scheduled service state - * - * @since S60 5.1 - * @param TBool, ETrue = running - * EFalse = not running - */ - IMPORT_C void SetScheduledServiceState( TBool aState ); - - - protected: - - // From base class MConnectionMonitorObserver - - /** - * From MConnectionMonitorObserver - * see base class definition - */ - void EventL( const CConnMonEventBase &aConnMonEvent ); - - // From base class CActive - - /** - * From CActive - * see base class definition - */ - void RunL(); - - /** - * From CActive - * see base class definition - */ - void DoCancel(); - - /** - * From CActive - * see base class definition - */ - TInt RunError( TInt aError ); - - private: - - /** - * Tries to execute service - * - * @since S60 5.1 - * @param aService, service to be executed - */ - void TryToExecuteService( TCmService aService ); - - /** - * Tries to start timer - * - * @since S60 5.1 - */ - void TryToStartRetryTimer(); - - /** - * Cancels timer - * - * @since S60 5.1 - */ - void CancelTimer(); - - /** - * Handles connection event - * - * @since S60 5.1 - * @param aConnMonEvent The event information. - */ - void HandleConnectionEventL( - const CConnMonEventBase& aConnMonEvent ); - - /** - * Checks if client application is running - * - * @since S60 5.1 - * @return TBool, ETrue if running, EFalse otherwise - */ - TBool ApplicationRunning(); - - /** - * Checks if iap is available - * - * @since S60 5.1 - * @param aConnMonEvent The event information. - * @return TBool, ETrue if iap is available, EFalse otherwise - */ - TBool CheckIapAvailabilityL( - const CConnMonEventBase& aConnMonEvent ); - - private: - - /** - * C++ default constructor. - */ - CCmScheduler( MCmServiceObserver& aServer, - MCmSettings& aSettings ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - - /** - * Service observer - */ - MCmServiceObserver& iServer; - - /** - * Settings handler - */ - MCmSettings& iSettings; - - /** - * Service state - */ - TBool iScheduledServiceRunning; - - /** - * Connection monitor state - */ - TBool iEnabled; - - /** - * Scheduler state - */ - TCmSchedulerState iState; - - /** - * Timer counter - */ - TInt iTimerCount; - - /** - * Service to be executed - */ - TCmService iServiceToExecute; - - /** - * Harvest execution flag - */ - TBool iExecuteHarvest; - - /** - * Scheduler started operation - */ - TBool iSchedulerInitiated; - - /** - * Connection monitor - */ - RConnectionMonitor iConnMon; - - /** - * Timer for service execution - */ - RTimer iTimer; - - /** - * Comms database notifier - */ - CCmCommsDbNotifier* iNotifier; // owned - - /** - * Cenral repository notifier - */ - CCmCenrepNotifier* iRepositoryNotifier; // owned - - /** - * Current profile - */ - TInt iCurrentProfile; - - /** - * Wlan scan state - */ - TInt iWlanScanState; - - /** - * Store preprocessing flag - */ - TBool iStorePreprocessed; - - /** - * Last sync time - */ - TTime iLastSyncTime; - }; - - -#endif // _CMSCHEDULER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/src/cmcenrepnotifier.cpp --- a/homesync/contentmanager/cmserver/cmscheduler/src/cmcenrepnotifier.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +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: Checks if wlan scan state changes and informs observer of it -* -*/ - - -// Include Files -#include -#include -#include "cmscheduler.h" -#include "cmcenrepnotifier.h" -#include "msdebug.h" - -// Two-phased constructor. -CCmCenrepNotifier* CCmCenrepNotifier::NewL( CCmScheduler& aScheduler ) - { - CCmCenrepNotifier* self = new (ELeave) CCmCenrepNotifier( aScheduler ); - - CleanupStack::PushL( self ); - CActiveScheduler::Add( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; -} - -void CCmCenrepNotifier::ConstructL() - { - // open central repository - iRepository = CRepository::NewL( KCRUidProfileEngine ); - // assign notification request - RequestNotification(); - } - -// -------------------------------------------------------------------------- -// CCmCenrepNotifier::CCmCenrepNotifier -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CCmCenrepNotifier::CCmCenrepNotifier( CCmScheduler& aScheduler ) : - CActive( CActive::EPriorityStandard ), iScheduler( aScheduler ) - { - LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::CCmCenrepNotifier()")); - } - -// Destructor -CCmCenrepNotifier::~CCmCenrepNotifier() - { - LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::~CCmCenrepNotifier()")); - - Cancel(); - delete iRepository; - } - -// -------------------------------------------------------------------------- -// CCmCenrepNotifier::RequestNotification -// Requests database notification -// -------------------------------------------------------------------------- -// -void CCmCenrepNotifier::RequestNotification() - { - LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::RequestNotification()")); - if ( !IsActive() ) - { - iRepository->NotifyRequest( KProEngActiveProfile, iStatus ); - SetActive(); - } - } - - -// -------------------------------------------------------------------------- -// CCmCenrepNotifier::DoCancel -// -------------------------------------------------------------------------- -// -void CCmCenrepNotifier::DoCancel() - { - // cancel possible requests - iRepository->NotifyCancelAll(); - } - -// --------------------------------------------------------------------------- -// CCmCenrepNotifier::RunL -// Called when change in database occurs -// --------------------------------------------------------------------------- -// -void CCmCenrepNotifier::RunL() - { - LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::RunL()")); - - // Get ID of current profile - TInt profile( 0 ); - User::LeaveIfError( GetCurrentProfile( profile ) ); - - iScheduler.ProfileChangedL( profile ); - - // Assign new request - RequestNotification(); - } - -// -------------------------------------------------------------------------- -// CCmCenrepNotifier::RunError -// Called if RunL leaves -// -------------------------------------------------------------------------- -// -#ifdef _DEBUG -TInt CCmCenrepNotifier::RunError( TInt aError ) -#else // _DEBUG -TInt CCmCenrepNotifier::RunError( TInt /*aError*/ ) -#endif // _DEBUG - { - TRACE(Print(_L("[Cm Scheduler]\t \ - CCmCenrepNotifier::RunError errorcode = %d"), aError)); - - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CCmCenrepNotifier::GetCurrentProfile -// -------------------------------------------------------------------------- -// -TInt CCmCenrepNotifier::GetCurrentProfile( TInt& aProfile ) - { - LOG(_L("[Cm Scheduler]\t CCmCenrepNotifier::GetCurrentProfile()")); - - return iRepository->Get( KProEngActiveProfile, aProfile ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/src/cmcommsdbnotifier.cpp --- a/homesync/contentmanager/cmserver/cmscheduler/src/cmcommsdbnotifier.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +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: Checks if wlan scan state changes and informs observer of it -* -*/ - - -// Include Files -#include -#include -#include -#include -#include "cmcommsdbnotifier.h" -#include "cmscheduler.h" -#include "msdebug.h" - -// Two-phased constructor. -CCmCommsDbNotifier* CCmCommsDbNotifier::NewL( CCmScheduler& aScheduler ) - { - CCmCommsDbNotifier* self = new (ELeave) CCmCommsDbNotifier( aScheduler ); - - CleanupStack::PushL( self ); - CActiveScheduler::Add( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; -} - -void CCmCommsDbNotifier::ConstructL() - { - // open comms database - iDb = CCommsDatabase::NewL(); - // assign notification request - RequestNotification(); - } - -// -------------------------------------------------------------------------- -// CCmCommsDbNotifier::CCmCommsDbNotifier -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CCmCommsDbNotifier::CCmCommsDbNotifier( CCmScheduler& aScheduler ) : - CActive( CActive::EPriorityStandard ) - { - LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::CCmCommsDbNotifier()")); - - // Scheduler reads scan interval on construction, so we can - // assume it's off - // now - iScanState = 0; - iScheduler = &aScheduler; - } - -// Destructor -CCmCommsDbNotifier::~CCmCommsDbNotifier() - { - LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::~CCmCommsDbNotifier()")); - - Cancel(); - - delete iDb; - } - -// -------------------------------------------------------------------------- -// CCmCommsDbNotifier::RequestNotification -// Requests database notification -// -------------------------------------------------------------------------- -// -void CCmCommsDbNotifier::RequestNotification() - { - LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::RequestNotification()")); - if ( !IsActive() ) - { - iDb->RequestNotification( iStatus ); - SetActive(); - } - } - - -// -------------------------------------------------------------------------- -// CCmCommsDbNotifier::DoCancel -// -------------------------------------------------------------------------- -// -void CCmCommsDbNotifier::DoCancel() - { - // cancel possible requests - iDb->CancelRequestNotification(); - } - -// --------------------------------------------------------------------------- -// CCmCommsDbNotifier::RunL -// Called when change in database occurs -// --------------------------------------------------------------------------- -// -void CCmCommsDbNotifier::RunL() - { - LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::RunL()")); - - if ( iScheduler && - iStatus.Int() == RDbNotifier::ECommit && - HasScanStateChangedL() ) - { - iScheduler->WlanScanStateChanged( iScanState ); - } - - // Assign new request - RequestNotification(); - } - -// -------------------------------------------------------------------------- -// CCmCommsDbNotifier::RunError -// Called if RunL leaves -// -------------------------------------------------------------------------- -// -#ifdef _DEBUG -TInt CCmCommsDbNotifier::RunError( TInt aError ) -#else // _DEBUG -TInt CCmCommsDbNotifier::RunError( TInt /*aError*/ ) -#endif // _DEBUG - - { - TRACE(Print(_L("[Cm Scheduler]\t \ - CCmCommsDbNotifier::RunError errorcode = %d"), aError)); - - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CCmCommsDbNotifier::HasScanStateChangedL -// Checks if wlan scanning interval has been changed -// -------------------------------------------------------------------------- -// -TBool CCmCommsDbNotifier::HasScanStateChangedL() - { - LOG(_L("[Cm Scheduler]\t CCmCommsDbNotifier::HasScanStateChangedL")); - - TBool status( EFalse ); - - TUint32 scanState = WlanScanStateL(); - - if ( iScanState != scanState ) - { - // value changed - iScanState = scanState; - status = ETrue; - } - else - { - // value not changed - status = EFalse; - } - - return status; - } - -// -------------------------------------------------------------------------- -// CCmCommsDbNotifier::WlanScanStateL -// Returns state of wlan scan interval setting -// -------------------------------------------------------------------------- -// -TUint32 CCmCommsDbNotifier::WlanScanStateL() - { - TUint32 scanState( 0 ); - -#ifndef __WINS__ - - // open wlan table - CCommsDbTableView* view = iDb->OpenViewMatchingUintLC - ( - TPtrC( WLAN_DEVICE_SETTINGS ), - TPtrC( WLAN_DEVICE_SETTINGS_TYPE ), KWlanUserSettings - ); - - User::LeaveIfError( view->GotoFirstRecord() ); - - // read scanning interval - view->ReadUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), - scanState ); - - TRACE(Print(_L("[Cm Scheduler]\t CCmCommsDbNotifier::prev: %d, \ - scan :%d"), iScanState, scanState )); - - - CleanupStack::PopAndDestroy( view ); - -#endif - - return scanState; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmscheduler/src/cmscheduler.cpp --- a/homesync/contentmanager/cmserver/cmscheduler/src/cmscheduler.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,646 +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: Content Manager server's scheduler component -* -*/ - - -// INCLUDE FILES -#include - -#include "cmsettings.h" -#include "cmcommonutils.h" -#include "cmscheduler.h" -#include "mediaservantuid.h" -#include "cmcommsdbnotifier.h" -#include "cmcenrepnotifier.h" -#include "msdebug.h" - -// WLAN scanning interval [s] -const TInt - KTimerInterval = 30 * 60 * 1000 * 1000; // 30 minutes in microseconds -const TInt KTimerCount = 2; // KTimerCount*KTimerInterval = 1 hour -const TUid KMediaServantUid = { KMediaServantUID3 }; // application uid -const TInt KOfflineProfile = 5; // offline profile identifier - -// ========================== MEMBER FUNCTIONS =============================== - -// Two-phased constructor. -EXPORT_C CCmScheduler* CCmScheduler::NewL( - MCmServiceObserver& aServer, MCmSettings& aSettings) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::NewL")); - CCmScheduler* self = new ( ELeave ) - CCmScheduler( aServer, aSettings ); - self->ConstructL(); - return self; - } - -// Destructor -CCmScheduler::~CCmScheduler() - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::~CCmScheduler")); - - Cancel(); - delete iNotifier; - delete iRepositoryNotifier; - iConnMon.CancelNotifications(); - iConnMon.Close(); - iTimer.Close(); - } - -// -------------------------------------------------------------------------- -// CCmScheduler::CCmScheduler -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CCmScheduler::CCmScheduler( - MCmServiceObserver& aServer, MCmSettings& aSettings) - : CActive( EPriorityStandard ), - iServer( aServer ), iSettings( aSettings ), - iScheduledServiceRunning( EFalse ), iEnabled( ETrue ), - iState( ECmScStateOffline ), iTimerCount( 0 ), - iServiceToExecute( ECmServicePreProcessingStore ), - iExecuteHarvest( ETrue ), iSchedulerInitiated( EFalse ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::CCmScheduler()")); - } - -// -------------------------------------------------------------------------- -// CCmScheduler::ConstructL() -// -------------------------------------------------------------------------- -// -void CCmScheduler::ConstructL() - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL")); - - // Ensure that iap is set. Otherwise scheduler cannot be used -#ifdef __DEBUG - TInt iap( 0 ); - User::LeaveIfError( iSettings.GetIapL( iap ) ); - TRACE( Print( _L("[Cm Scheduler]\t IAP to use is %d"), iap)); -#endif - - User::LeaveIfError( iTimer.CreateLocal() ); - CActiveScheduler::Add( this ); - iEnabled = EFalse; - - iRepositoryNotifier = CCmCenrepNotifier::NewL( *this ); - User::LeaveIfError( iRepositoryNotifier->GetCurrentProfile( - iCurrentProfile ) ); - - // create commsdb notifier - TRAPD( error, iNotifier = CCmCommsDbNotifier::NewL( *this ) ); - - if ( !error ) - { - iWlanScanState = iNotifier->WlanScanStateL(); - } - else - { - TRACE( Print( _L("[Cm Scheduler]\t CCmScheduler::ConstructL \ - error = %d"), error)); - } - - // check that mc is not in offline mode - if ( iCurrentProfile != KOfflineProfile ) - { - iState = ECmScStateOnline; - if ( error == KErrNone ) - { - // We assume that scan is off. - // State is checked and if it is on wlan events can be used. - if ( iNotifier->HasScanStateChangedL() ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \ - Scanning state changed on")); - // scanning is on - SetEnabledL( ETrue ); - } - - else - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \ - Scanning state is off - starting timer")); - // scanning is off - use timer - TryToStartRetryTimer(); - } - } - else - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \ - Notifier creation failed")); - // if notifier cannot be created we start the timer - TryToStartRetryTimer(); - } - } - else - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ConstructL() \ - profile = offline")); - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::EventL() -// Called when an event arrives to connection monitor -// -------------------------------------------------------------------------- -// -void CCmScheduler::EventL( const CConnMonEventBase& aConnMonEvent ) - { - TRACE(Print(_L("[Cm Scheduler]\t CCmScheduler::EventL() \ - eventtype = %d, connection id = %d"), - aConnMonEvent.EventType(), aConnMonEvent.ConnectionId())); - - TTime currentTime; - currentTime.HomeTime(); - - TTimeIntervalHours interval; - currentTime.HoursFrom( iLastSyncTime, interval ); - - TRACE(Print(_L("[Cm Scheduler]\t CCmScheduler::EventL() \ - hours from last sync = %d"), interval.Int())); - - if ( interval.Int() >= 1 && !ApplicationRunning() ) - { - HandleConnectionEventL( aConnMonEvent ); - } - - } - -// -------------------------------------------------------------------------- -// CCmScheduler::HandleConnectionEventL() -// Handles connection event -// -------------------------------------------------------------------------- -// -void CCmScheduler::HandleConnectionEventL( - const CConnMonEventBase& aConnMonEvent ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::HandleConnectionEventL() \ - HandleConnectionEventL")); - - if ( aConnMonEvent.EventType() == EConnMonIapAvailabilityChange ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::HandleConnectionEventL() \ - EConnMonIapAvailabilityChange")); - - TCmSchedulerState newState = ECmScStateOffline; - - if ( CheckIapAvailabilityL( aConnMonEvent ) ) - { - newState = ECmScStateOnline; - } - - if ( newState != iState ) - { - iState = newState; - - if ( newState && !iScheduledServiceRunning ) - { - LOG(_L("[Cm Scheduler]\t State changed to online,\ - starting operation..")); - iSchedulerInitiated = ETrue;// do also harvest - TRACE( Print( _L("[Cm Scheduler]\t HandleConnectionEventL \ - iSchedulerInitiated = %d"), iSchedulerInitiated)); - iExecuteHarvest = ETrue; - TRACE( Print( _L("[Cm Scheduler]\t HandleConnectionEventL \ - iExecuteHarvest = %d"), iExecuteHarvest)); - TryToExecuteService( iServiceToExecute ); - } - else - { - LOG(_L("[Cm Scheduler]\t State changed to offline,\ - canceling timer..")); - CancelTimer(); - } - } - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::RunL() -// Called when the timer elapses -// -------------------------------------------------------------------------- -// -void CCmScheduler::RunL() - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::RunL()")); - TRACE( Print( _L("[Cm Scheduler]\t status %d"), iStatus.Int() )); - TRACE( Print( _L("[Cm Scheduler]\t state %d"), iState )); - - if ( KErrNone == iStatus.Int() && - iState == ECmScStateOnline && - !iScheduledServiceRunning ) - { - if ( ++iTimerCount >= KTimerCount && !ApplicationRunning() ) - { - LOG(_L("[Cm Scheduler]\t Online timer passed, \ - starting operation..")); - iSchedulerInitiated = ETrue;// do also harvest - TRACE( Print( _L("[Cm Scheduler]\t RunL \ - iSchedulerInitiated = %d"), iSchedulerInitiated)); - iExecuteHarvest = ETrue; - TRACE( Print( _L("[Cm Scheduler]\t RunL \ - iExecuteHarvest = %d"), iExecuteHarvest)); - TryToExecuteService( iServiceToExecute ); - } - else - { - iTimer.After( iStatus, - TTimeIntervalMicroSeconds32( KTimerInterval ) ); - SetActive(); - } - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::TryToExecuteService() -// Starts process if application is not running -// -------------------------------------------------------------------------- -// -void CCmScheduler::TryToExecuteService( TCmService aService ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::TryToExecuteService()")); - TInt err = KErrNone; - - TRAP( err, iServer.ExecuteServiceL( aService )); - iScheduledServiceRunning = !err; - - if ( !err && aService == ECmServicePreProcessingStore ) - { - iStorePreprocessed = EFalse; - } - - TRACE( Print( _L("[Cm Scheduler]\t ExecuteServiceL err: %d"), err)); - - if ( err ) - { - TryToStartRetryTimer(); - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::TryToStartRetryTimer() -// Starts timer if not already active -// -------------------------------------------------------------------------- -// -void CCmScheduler::TryToStartRetryTimer() - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::TryToStartRetryTimer()")); - - if ( !IsActive() ) - { - LOG(_L("[Cm Scheduler]\t starting one hour resync timer..")); - - CancelTimer(); - - iTimer.After( - iStatus, TTimeIntervalMicroSeconds32( KTimerInterval )); - SetActive(); - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::CancelTimer() -// Cancels timer -// -------------------------------------------------------------------------- -// -void CCmScheduler::CancelTimer() - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::CancelTimer")); - - iTimer.Cancel(); - iTimerCount = 0; - } - -// -------------------------------------------------------------------------- -// CCmScheduler::SetEnabledL() -// Enabled/disabled connection monitor events -// -------------------------------------------------------------------------- -// -EXPORT_C void CCmScheduler::SetEnabledL( TBool aEnable ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::SetEnabled()")); - if ( iEnabled != aEnable ) - { - iEnabled = aEnable; - if ( iEnabled ) - { - LOG(_L("[Cm Scheduler]\t enabling scheduler..")); - LOG(_L("[Cm Scheduler]\t starting to listen wlan events..")); - User::LeaveIfError( iConnMon.ConnectL() ); - iConnMon.NotifyEventL( *this ); - - } - else // iConnMon is connected when entering here... - { - LOG(_L("[Cm Scheduler]\t disabling scheduler..")); - - iConnMon.CancelNotifications(); - iConnMon.Close(); - - } - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::SetServiceToExecute -// Sets service to be executed -// -------------------------------------------------------------------------- -// -EXPORT_C void CCmScheduler::SetServiceToExecute( TCmService aService ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::SetServiceToExecute()")); - iServiceToExecute = aService; - } - -// -------------------------------------------------------------------------- -// CCmScheduler::ServiceExecuted -// Called when service is ready -// -------------------------------------------------------------------------- -// -EXPORT_C void CCmScheduler::ServiceExecuted( TCmService aService, TInt aErr ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ServiceExecuted()")); - TRACE( Print( _L("[Cm Scheduler]\t service %d err %d"), - aService, aErr)); - - if ( !iScheduledServiceRunning ) - { - LOG(_L("[Cm Scheduler]\t No scheduled service running, returning")); - return; - } - - iScheduledServiceRunning = EFalse; - TBool startRetryTimer( EFalse ); - if ( aErr ) - { - startRetryTimer = ETrue; - } - else - { - switch ( aService ) - { - case ECmServicePreProcessingStore: - { - if ( iStorePreprocessed == EFalse ) - { - iStorePreprocessed = ETrue; - TryToExecuteService( ECmServiceStore ); - } - else - { - iLastSyncTime.HomeTime(); - startRetryTimer = ETrue; - iSchedulerInitiated = EFalse; - } - break; - } - case ECmServiceStore: - { - // execute fill - TryToExecuteService( ECmServiceFill ); - break; - } - - case ECmServiceFill: - { - if ( iExecuteHarvest ) - { - TRACE( Print( _L("[Cm Scheduler]\t serviceexecuted \ - harvest %d schedulerinitiated %d"), - iExecuteHarvest, iSchedulerInitiated)); - // execute harvest - TryToExecuteService( ECmServiceHarvest ); - } - else - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ServiceExecuted \ - ExecuteHarvest = EFalse")); - startRetryTimer = ETrue; - iLastSyncTime.HomeTime(); - iSchedulerInitiated = EFalse; - TRACE( Print( _L("[Cm Scheduler]\t ServiceExecuted \ - iSchedulerInitiated = %d"), iSchedulerInitiated)); - } - break; - } - - case ECmServiceHarvest: - // fall through - case ECmServicePreProcessingFill: - { - iSchedulerInitiated = EFalse; - TRACE( Print( _L("[Cm Scheduler]\t ServiceExecuted \ - iSchedulerInitiated = %d"), iSchedulerInitiated)); - startRetryTimer = ETrue; - iLastSyncTime.HomeTime(); - break; - } - - default: - { - LOG(_L("[Cm Scheduler]\t default")); - break; - } - } - - } - if ( startRetryTimer ) - { - TryToStartRetryTimer(); - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::DoCancel -// Called by framework when timer is cancelled -// -------------------------------------------------------------------------- -// -void CCmScheduler::DoCancel() - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::DoCancel()")); - - CancelTimer(); - } - -// -------------------------------------------------------------------------- -// CCmScheduler::WlanScanStateChanged -// starts/disables timer and connection monitor events depending on state -// of wlan scanning interval -// -------------------------------------------------------------------------- -// -void CCmScheduler::WlanScanStateChanged( TInt aState ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::WlanScanStateChanged()")); - - iWlanScanState = aState; - - if ( iCurrentProfile != KOfflineProfile ) - { - if ( aState == KWlanScanNetworkNever ) - { - TRAP_IGNORE( SetEnabledL( EFalse ) ); - // state is set online so we can try start process - iState = ECmScStateOnline; - TryToStartRetryTimer(); - } - else - { - // cancel timer - CancelTimer(); - - TRAP_IGNORE( SetEnabledL( ETrue ) ); - } - } - } - - -// -------------------------------------------------------------------------- -// CCmScheduler::ProfileChangedL -// -------------------------------------------------------------------------- -// -void CCmScheduler::ProfileChangedL( TInt aProfile ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ProfileChangedL()")); - - if ( aProfile == KOfflineProfile ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ProfileChangedL() \ - offline")); - - iCurrentProfile = aProfile; - - // disable wlan scanning - CmCommonUtils::SetWlanScanL( KWlanScanNetworkNever ); - - // stop receiving events - SetEnabledL( EFalse ); - // cancel timer - CancelTimer(); - } - else if ( iCurrentProfile == KOfflineProfile ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ProfileChangedL() \ - online")); - - iCurrentProfile = aProfile; - - // enable wlan scanning - CmCommonUtils::SetWlanScanL( KWlanScanNetworkInterval60 ); - - if ( iWlanScanState ) - { - SetEnabledL( ETrue ); - } - else - { - TryToStartRetryTimer(); - } - } - } - -// -------------------------------------------------------------------------- -// CCmScheduler::SetScheduledServiceState -// -------------------------------------------------------------------------- -// -EXPORT_C void CCmScheduler::SetScheduledServiceState( TBool aState ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::SetScheduledServiceState()")); - - iScheduledServiceRunning = aState; - // we don't want to make second round - iStorePreprocessed = ETrue; - // This function is called when application transfers responsibility - // to scheduler. In this case we don't want to do harvest. - if ( !iSchedulerInitiated ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::SetScheduledServiceState() \ - iSchedulerInitiated = EFalse")); - iExecuteHarvest = EFalse; - TRACE( Print( _L("[Cm Scheduler]\t SetScheduledServiceState \ - iExecuteHarvest = %d"), iExecuteHarvest)); - } - - } - -// -------------------------------------------------------------------------- -// CCmScheduler::RunError -// -------------------------------------------------------------------------- -// -TInt CCmScheduler::RunError( TInt aError ) - { - TRACE( Print( _L("[Cm Scheduler]\t CCmScheduler::RunError \ - error = %d"), aError)); - - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CCmScheduler::ApplicationRunning -// -------------------------------------------------------------------------- -// -TBool CCmScheduler::ApplicationRunning() - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::ApplicationRunning()")); - - TBool mediaServantRunning( EFalse ); - RWsSession wsSession; - TInt err = wsSession.Connect(); - if ( !err ) - { - TApaTaskList taskList( wsSession ); - mediaServantRunning = taskList.FindApp( KMediaServantUid ).Exists(); - wsSession.Close(); - } - return mediaServantRunning; - } - -// -------------------------------------------------------------------------- -// CCmScheduler::CheckIapAvailabilityL() -// -------------------------------------------------------------------------- -// -TBool CCmScheduler::CheckIapAvailabilityL( - const CConnMonEventBase& aConnMonEvent ) - { - LOG(_L("[Cm Scheduler]\t CCmScheduler::CheckIapAvailabilityL()")); - - TBool iapFound( EFalse ); - TInt accessPoint( -1 ); - User::LeaveIfError( iSettings.GetIapL( accessPoint ) ); - TRACE( Print( _L("[Cm Scheduler]\t \ - IAP to use is %d"), accessPoint)); - - CConnMonIapAvailabilityChange* eventIap = - ( CConnMonIapAvailabilityChange* ) &aConnMonEvent; - - TConnMonIapInfo iaps = eventIap->IapAvailability(); - - for ( TInt i = 0; i < iaps.iCount; i++ ) - { - // Compare available IAPs to our IAP - TRACE( Print( _L("[Cm Scheduler]\t CONNMON iap: %d"), - iaps.iIap[i].iIapId)); - if ( accessPoint == iaps.iIap[i].iIapId ) - { - LOG(_L("[Cm Scheduler]\t FOUND CORRECT IAP!")); - iapFound = ETrue; - i = iaps.iCount; - } - } - return iapFound; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/bwins/cmclientu.def --- a/homesync/contentmanager/cmserver/cmserver/bwins/cmclientu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -EXPORTS - ??0RContentManager@@QAE@XZ @ 1 NONAME ; RContentManager::RContentManager(void) - ?AppWizardState@RContentManager@@QBEHXZ @ 2 NONAME ; int RContentManager::AppWizardState(void) const - ?ApplicationExit@RContentManager@@QAEXXZ @ 3 NONAME ; void RContentManager::ApplicationExit(void) - ?Cancel@RContentManager@@QAEXXZ @ 4 NONAME ; void RContentManager::Cancel(void) - ?Close@RContentManager@@QAEHXZ @ 5 NONAME ; int RContentManager::Close(void) - ?Connect@RContentManager@@QAEHXZ @ 6 NONAME ; int RContentManager::Connect(void) - ?DeleteDeletedMediaserversL@RContentManager@@QAEXXZ @ 7 NONAME ; void RContentManager::DeleteDeletedMediaserversL(void) - ?DeleteMetadataL@RContentManager@@QAEXAAVTRequestStatus@@@Z @ 8 NONAME ; void RContentManager::DeleteMetadataL(class TRequestStatus &) - ?DriveSelectionStatus@RContentManager@@QAEHXZ @ 9 NONAME ; int RContentManager::DriveSelectionStatus(void) - ?ExecuteService@RContentManager@@QAEHW4TCmService@@AAVTRequestStatus@@@Z @ 10 NONAME ; int RContentManager::ExecuteService(enum TCmService, class TRequestStatus &) - ?FillRulesL@RContentManager@@QAEPAVCCmFillRuleContainer@@XZ @ 11 NONAME ; class CCmFillRuleContainer * RContentManager::FillRulesL(void) - ?GetDrivesL@RContentManager@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 12 NONAME ; void RContentManager::GetDrivesL(class RPointerArray &) - ?GetFilteredMetadataL@RContentManager@@QAEHW4TCmService@@AAPAVCCmSqlPropertyCollector@@AAVTRequestStatus@@@Z @ 13 NONAME ; int RContentManager::GetFilteredMetadataL(enum TCmService, class CCmSqlPropertyCollector * &, class TRequestStatus &) - ?GetItemCountsL@RContentManager@@QBEHW4TCmService@@ABVTDesC8@@AAHAA_J@Z @ 14 NONAME ; int RContentManager::GetItemCountsL(enum TCmService, class TDesC8 const &, int &, long long &) const - ?GetTransferInfo@RContentManager@@QBEXW4TCmService@@AAH1@Z @ 15 NONAME ; void RContentManager::GetTransferInfo(enum TCmService, int &, int &) const - ?LastSyncTime@RContentManager@@QBE?AVTTime@@XZ @ 16 NONAME ; class TTime RContentManager::LastSyncTime(void) const - ?ListItemsL@RContentManager@@QAEPAV?$RPointerArray@VCCmBaseListItem@@@@ABVTDesC8@@W4TCmService@@@Z @ 17 NONAME ; class RPointerArray * RContentManager::ListItemsL(class TDesC8 const &, enum TCmService) - ?MediaserversL@RContentManager@@QBEPAV?$RPointerArray@VCCmMediaServerFull@@@@XZ @ 18 NONAME ; class RPointerArray * RContentManager::MediaserversL(void) const - ?PreProcessFillList@RContentManager@@QAEHABVTDesC8@@AAVTRequestStatus@@@Z @ 19 NONAME ; int RContentManager::PreProcessFillList(class TDesC8 const &, class TRequestStatus &) - ?ServerState@RContentManager@@QBE?AW4TCmServerState@@XZ @ 20 NONAME ; enum TCmServerState RContentManager::ServerState(void) const - ?ServiceState@RContentManager@@QBE?AW4TCmServiceState@@W4TCmService@@@Z @ 21 NONAME ; enum TCmServiceState RContentManager::ServiceState(enum TCmService) const - ?SetAppWizardState@RContentManager@@QAEHXZ @ 22 NONAME ; int RContentManager::SetAppWizardState(void) - ?SetDrivesL@RContentManager@@QAEXV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 23 NONAME ; void RContentManager::SetDrivesL(class RPointerArray) - ?SetFillFileStatusesL@RContentManager@@QAEXABV?$RPointerArray@VCCmBaseListItem@@@@@Z @ 24 NONAME ; void RContentManager::SetFillFileStatusesL(class RPointerArray const &) - ?SetFillRulesL@RContentManager@@QAEXABVCCmFillRuleContainer@@@Z @ 25 NONAME ; void RContentManager::SetFillRulesL(class CCmFillRuleContainer const &) - ?SetMediaserversL@RContentManager@@QAEHAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 26 NONAME ; int RContentManager::SetMediaserversL(class RPointerArray &) - ?SetServiceState@RContentManager@@QAEHW4TCmService@@W4TCmServiceState@@@Z @ 27 NONAME ; int RContentManager::SetServiceState(enum TCmService, enum TCmServiceState) - ?SetStoreRulesL@RContentManager@@QAEXABVCCmStoreRuleContainer@@@Z @ 28 NONAME ; void RContentManager::SetStoreRulesL(class CCmStoreRuleContainer const &) - ?StoreRulesL@RContentManager@@QAEPAVCCmStoreRuleContainer@@XZ @ 29 NONAME ; class CCmStoreRuleContainer * RContentManager::StoreRulesL(void) - ?UpdateFillListsL@RContentManager@@QAEXAAVTRequestStatus@@@Z @ 30 NONAME ; void RContentManager::UpdateFillListsL(class TRequestStatus &) - ?GetFilledFilesSize@RContentManager@@QBEXAA_JH@Z @ 31 NONAME ; void RContentManager::GetFilledFilesSize(long long &, int) const - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/data/cmserver.rss --- a/homesync/contentmanager/cmserver/cmserver/data/cmserver.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2007 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: A startup control file to add content manager server to startup -* list -* -*/ - -#include - -RESOURCE STARTUP_ITEM_INFO contentmanager_server - { - executable_name = "\\sys\\bin\\cmserver.exe"; - recovery = EStartupItemExPolicyNone; - } diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/data/cmserver_reg.rss --- a/homesync/contentmanager/cmserver/cmserver/data/cmserver_reg.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Resource definitions -* -*/ - - -#include // APP_REGISTRATION_INFO. -#include // APP_RESOURCE_DIR. - -UID2 KUidAppRegistrationResourceFile -UID3 0x1000008d - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "cmserver"; // Filename of application binary (without extension). - hidden = KAppIsHidden; - } diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/eabi/cmclientu.def --- a/homesync/contentmanager/cmserver/cmserver/eabi/cmclientu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -EXPORTS - _ZN15RContentManager10FillRulesLEv @ 1 NONAME - _ZN15RContentManager10GetDrivesLER13RPointerArrayI12CCmDriveInfoE @ 2 NONAME - _ZN15RContentManager10ListItemsLERK6TDesC810TCmService @ 3 NONAME - _ZN15RContentManager10SetDrivesLE13RPointerArrayI12CCmDriveInfoE @ 4 NONAME - _ZN15RContentManager11StoreRulesLEv @ 5 NONAME - _ZN15RContentManager13SetFillRulesLERK20CCmFillRuleContainer @ 6 NONAME - _ZN15RContentManager14ExecuteServiceE10TCmServiceR14TRequestStatus @ 7 NONAME - _ZN15RContentManager14SetStoreRulesLERK21CCmStoreRuleContainer @ 8 NONAME - _ZN15RContentManager15ApplicationExitEv @ 9 NONAME - _ZN15RContentManager15DeleteMetadataLER14TRequestStatus @ 10 NONAME - _ZN15RContentManager15SetServiceStateE10TCmService15TCmServiceState @ 11 NONAME - _ZN15RContentManager16SetMediaserversLER13RPointerArrayI18CCmMediaServerFullE @ 12 NONAME - _ZN15RContentManager16UpdateFillListsLER14TRequestStatus @ 13 NONAME - _ZN15RContentManager17SetAppWizardStateEv @ 14 NONAME - _ZN15RContentManager18PreProcessFillListERK6TDesC8R14TRequestStatus @ 15 NONAME - _ZN15RContentManager20DriveSelectionStatusEv @ 16 NONAME - _ZN15RContentManager20GetFilteredMetadataLE10TCmServiceRP23CCmSqlPropertyCollectorR14TRequestStatus @ 17 NONAME - _ZN15RContentManager20SetFillFileStatusesLERK13RPointerArrayI15CCmBaseListItemE @ 18 NONAME - _ZN15RContentManager26DeleteDeletedMediaserversLEv @ 19 NONAME - _ZN15RContentManager5CloseEv @ 20 NONAME - _ZN15RContentManager6CancelEv @ 21 NONAME - _ZN15RContentManager7ConnectEv @ 22 NONAME - _ZN15RContentManagerC1Ev @ 23 NONAME - _ZN15RContentManagerC2Ev @ 24 NONAME - _ZNK15RContentManager11ServerStateEv @ 25 NONAME - _ZNK15RContentManager12LastSyncTimeEv @ 26 NONAME - _ZNK15RContentManager12ServiceStateE10TCmService @ 27 NONAME - _ZNK15RContentManager13MediaserversLEv @ 28 NONAME - _ZNK15RContentManager14AppWizardStateEv @ 29 NONAME - _ZNK15RContentManager14GetItemCountsLE10TCmServiceRK6TDesC8RiRx @ 30 NONAME - _ZNK15RContentManager15GetTransferInfoE10TCmServiceRiS1_ @ 31 NONAME - _ZNK15RContentManager18GetFilledFilesSizeERxi @ 32 NONAME - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/group/bld.inf --- a/homesync/contentmanager/cmserver/cmserver/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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 information file for Content Manager server -* -*/ - - - -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS - -../inc/client/contentmanager.h |../../../../../inc/contentmanager.h - -PRJ_MMPFILES - -cmclient.mmp -cmserver.mmp - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/group/cmclient.mmp --- a/homesync/contentmanager/cmserver/cmserver/group/cmclient.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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 specification file for Content Manager client -* -*/ - -#include -#include "../inc/cmuids.hrh" - -TARGET cmclient.dll -TARGETTYPE dll -UID 0x1000008D KCmClientUid - -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../src/client -SOURCE cmclientsession.cpp -SOURCE cmactive.cpp - -USERINCLUDE ../inc/client -USERINCLUDE ../inc - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -LIBRARY euser.lib -LIBRARY bafl.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY cmcommon.lib - -DEBUGLIBRARY flogger.lib - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/group/cmserver.mmp --- a/homesync/contentmanager/cmserver/cmserver/group/cmserver.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +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 specification file for Content Manager server -* -*/ - - -#include -#include "../inc/cmuids.hrh" - -TARGET cmserver.exe -TARGETTYPE exe -UID 0x1000008d KCmServerUid - -TARGETPATH /system/programs - -CAPABILITY CAP_SERVER -VENDORID VID_DEFAULT - -// Minimum heap size 4kB, maximum heap size 16MB, stack size 32kB -EPOCHEAPSIZE 0x1000 0x1000000 -EPOCSTACKSIZE 0x8000 - -SOURCEPATH ../src/server -SOURCE cmservermain.cpp -SOURCE cmserver.cpp -SOURCE cmserversession.cpp - -START RESOURCE ../../data/cmserver.rss -TARGETPATH /resource/apps -END - -USERINCLUDE ../inc -USERINCLUDE ../inc/server - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -LIBRARY avcontrolframework.lib -LIBRARY upnpserviceframework.lib -LIBRARY upnpavcontrollerclient.lib -LIBRARY cmmdhclient.lib -LIBRARY cmsettingsengine.lib -LIBRARY cmcommon.lib -LIBRARY cmdatabasemanager.lib -LIBRARY cmfillmanager.lib -LIBRARY cmstoremanager.lib -LIBRARY cmscheduler.lib -LIBRARY cmmemorymanager.lib -LIBRARY centralrepository.lib -LIBRARY mdeclient.lib -LIBRARY bafl.lib -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY ws32.lib // for application activity info -LIBRARY apgrfx.lib // for application activity info -DEBUGLIBRARY flogger.lib - -START RESOURCE ../../data/cmserver_reg.rss -TARGETPATH /resource/apps -END - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/inc/client/cmactive.h --- a/homesync/contentmanager/cmserver/cmserver/inc/client/cmactive.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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: Content Manager server's client ao header -* -*/ - - -#ifndef CMACTIVE_H -#define CMACTIVE_H - -#include -#include "contentmanager.h" - -NONSHARABLE_CLASS ( CCmActive ) : public CActive - { -public: - - /** - * Two-phased constructor. - * - * @param aCm, cmserver reference - */ - static CCmActive* NewL( RContentManager& aCm ); - - /** - * Two-phased constructor. - * - * @param aCm, cmserver reference - */ - static CCmActive* NewLC( RContentManager& aCm ); - - /** - * Destructor. - */ - virtual ~CCmActive(); - - -// From base class CActive - - /** - * From CActive - * see base class definition - */ - void RunL(); - -protected: - -// From base class CActive - - /** - * From CActive - * see base class definition - */ - void DoCancel(); - - /** - * From CActive - * see base class definition - */ - TInt RunError( TInt aError ); - -private: - - /** - * Performs the first phase of two phase construction - * - * @since S60 5.1 - * @param aCm, client reference. - */ - CCmActive( RContentManager& aCm ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -private: - - /** - * server client interface - */ - RContentManager& iCm; - /** - * idle indicator - */ - TBool iIdle; - }; - -#endif - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/inc/client/contentmanager.h --- a/homesync/contentmanager/cmserver/cmserver/inc/client/contentmanager.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,379 +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: Content Manager server's client header -* -*/ - - - -#ifndef CONTENTMANAGER_H -#define CONTENTMANAGER_H - -// INCLUDES -#include -#include -#include "cmcommon.h" - -// FORWARD DECLARATIONS -class CCmFillRuleContainer; -class CCmStoreRuleContainer; -class CCmMediaServerFull; -class CCmBaseListItem; -class CCmActive; -class CCmDriveInfo; -class CCmSqlPropertyCollector; -class RDesReadStream; - -/** -* Content Manager session -* -* @lib cmclient.lib -* @since S60 3.1 -*/ -class RContentManager : public RSessionBase - { -public: - - /** - * Session constructor. - */ - IMPORT_C RContentManager(); - - /** - * Creates a connection to server. If server is not started, - * method will start the server first and then create a new session. - * - * @since S60 3.1 - * @return TInt indicating the success of the call. - */ - IMPORT_C TInt Connect(); - - /** - * Closes connection to server - * - * @since S60 3.1 - * @return TInt indicating the success of the call. - */ - IMPORT_C TInt Close(); - - /** - * Cancels all ongoing async operations - * - * @since S60 3.1 - */ - IMPORT_C void Cancel(); - - /** - * Returns the current state of the Content Manager - * - * @since S60 3.1 - * @return TCmServerState state of the manager - */ - IMPORT_C TCmServerState ServerState() const; - - - /** - * Sets state of a service - * - * @since S60 3.1 - * @param aService, defines the service - * @param aNewState, service state to set¨ - * @return TInt, status of the operation - */ - IMPORT_C TInt SetServiceState( const TCmService aService, - const TCmServiceState aNewState ); - - /** - * Gets service state - * - * @since S60 3.1 - * @param aService, defining the requested service - * @return TCmServiceState, service state - */ - IMPORT_C TCmServiceState ServiceState( const TCmService aService ) const; - - /** - * Execute a service - * - * @since S60 3.1 - * @param aService defines the service - * @param aStatus asynchronous request status - * @return TInt, KErrNone if successfull - */ - IMPORT_C TInt ExecuteService( const TCmService aService, - TRequestStatus& aStatus ); - - /** - * Sets media server information to database - * - * @since S60 3.1 - * @param aServers New media server information. - * @return TInt, status of the operation - */ - IMPORT_C TInt SetMediaserversL( - RPointerArray& aServers ); - - /** - * Deletes media servers from db ( servers with deleted status ) - * - * @since S60 3.1 - * @return None - */ - IMPORT_C void DeleteDeletedMediaserversL(); - - /** - * Gets media server information from database (ownership to caller) - * - * @since S60 3.1 - * @return RPointerArray, - * media server information array - */ - IMPORT_C RPointerArray* MediaserversL() const; - - /** - * Gets current item count for a list of a service (fill or store) - * - * @since S60 3.1 - * @param aService defines the service - * @param aListName list name - * @param aCount returns count - * @param aSize returns size - * @return TInt, KErrNone if successfull - */ - IMPORT_C TInt GetItemCountsL( const TCmService aService, - const TDesC8& aListName, - TInt& aCount, - TInt64& aSize ) const; - /** - * Gets filled files size - * - * @since S60 3.1 - * @param aSize returns size - * @param aID id of fill rule - */ - IMPORT_C void GetFilledFilesSize( TInt64& aSize, const TInt aID ) const; - - /** - * Gets filtered metadata items - * - * @since S60 3.2 - * @param aService, defines the service - * @param aCollector, metadata collector - * @param aStatus, asynchronous request status - * @return TInt, error code - */ - IMPORT_C TInt GetFilteredMetadataL( const TCmService aService, - CCmSqlPropertyCollector*& aCollector, - TRequestStatus& aStatus ); - - /** - * Updating fill lists - * - * @since S60 3.1 - * @param aStatus asynchronous request status - */ - IMPORT_C void UpdateFillListsL( TRequestStatus& aStatus ); - - /** - * Deleting metadata - * - * @since S60 3.1 - * @param aStatus asynchronous request status - */ - IMPORT_C void DeleteMetadataL( TRequestStatus& aStatus ); - - /** - * Returns the app wizard execution information. - * - * @since S60 3.1 - * @return TBool, ETrue if app wizard has been executed at startup - */ - IMPORT_C TBool AppWizardState() const; - - /** - * Sets the app wizard execution information. - * - * @since S60 3.1 - * @return TInt, KErrNone if successfull - */ - IMPORT_C TInt SetAppWizardState(); - - /** - * Gets last sync time - * - * @since S60 3.1 - * @return TTime, last sync time - */ - IMPORT_C TTime LastSyncTime() const; - - /** - * Sets fill file statuses - * - * @param aItems, reference to item array containing statuses - * @since S60 3.1 - */ - IMPORT_C void SetFillFileStatusesL( - const RPointerArray& aItems ); - - /** - * Get transfer item count and time for a service - * - * @param aService defines the service - * @param aItemCount, item count value - * @param aTimeInSec, transfer time value - * @since S60 3.1 - */ - IMPORT_C void GetTransferInfo( const TCmService aService, - TInt& aItemCount, - TInt& aTimeInSec ) const; - - /** - * Sets Fill rules - * - * @since S60 3.1 - * @param aFillRules, reference to fill rule container object - */ - IMPORT_C void SetFillRulesL( const CCmFillRuleContainer& aFillRules ); - - /** - * Gets fill rules - * - * @since S60 3.1 - * @return CCmFillRuleContainer, pointer to fill rule container - * object (ownership to caller) - */ - IMPORT_C CCmFillRuleContainer* FillRulesL(); - - /** - * Gets files of the list - * - * @since S60 3.1 - * @param aListName, list name - * @param aService, fill or store service - * @return RPointerArray* - ListItemsL( const TDesC8& aListName, TCmService aService ); - - /** - * Preprocesses fill list - * - * @since S60 3.1 - * @param aListName fill list name - * @return TInt, error code - */ - IMPORT_C TInt PreProcessFillList( const TDesC8& aListName, - TRequestStatus& aStatus ); - - /** - * Sets store rules - * - * @since S60 3.1 - * @param aStoreRules reference to store rule container object - */ - IMPORT_C void SetStoreRulesL( - const CCmStoreRuleContainer& aStoreRules ); - - /** - * Gets store rules - * - * @since S60 3.1 - * @return CCmStoreRuleContainer, pointer to store rule container object - * (ownership to caller) - */ - IMPORT_C CCmStoreRuleContainer* StoreRulesL(); - - /** - * Sets drives - * @since S60 3.1 - * @param aDrive, drive info array - */ - IMPORT_C void SetDrivesL( RPointerArray aDrives ); - - /** - * Gets drives - * @since S60 3.1 - * @param aDrives, drives on return - */ - IMPORT_C void GetDrivesL( RPointerArray& aDrives ); - - /** - * Returns drive selection status - * @since S60 3.1 - * @return TBool, ETrue if set, EFalse otherwise - */ - IMPORT_C TBool DriveSelectionStatus(); - - /** - * Informs server that application will be shut down - * @since S60 3.1 - */ - IMPORT_C void ApplicationExit(); - - /** - * Informs client when server operation is complete - * - * @since S60 3.1 - * @param aErr - * @return TInt, KErrNone if successfull - */ - TInt OperationCompletedL( TInt aErr ); - -private: - - /** - * Copy items from server side collector to client collector - * @Since s60 3.1 - * @param aStream, dataStream from server - */ - void CopyItemsL( RDesReadStream& aStream ); - -private: // data - - /** - * active object - */ - CCmActive* iAo; // owned - - /** - * target array for metadata items - */ - CCmSqlPropertyCollector** iTargetContainer; // not owned - - /** - * client's request status - */ - TRequestStatus* iClientRequest; - - /** - * indicator for user cancelling - */ - TBool iCanceled; - - /** - * data buffer - */ - CBufFlat* iBuffer; // owned - - /** - * buffer to be sent to server size - */ - TPtrC8 iBufferPointer; - }; - - -#endif // CONTENTMANAGER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/inc/cmuids.hrh --- a/homesync/contentmanager/cmserver/cmserver/inc/cmuids.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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: Specifies the UID values used in Content Manager -* -*/ - - -#ifndef CM_UIDS_HRH -#define CM_UIDS_HRH - -// Content Manager module Uids -#define KCmClientUid 0x10281FA8 -#define KCmServerUid 0x10281FA7 - - -#endif // CM_UIDS_HRH - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/inc/server/cmserver.h --- a/homesync/contentmanager/cmserver/cmserver/inc/server/cmserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,478 +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: Content Manager server executable header file -* -*/ - - - -#ifndef CMSERVER_H -#define CMSERVER_H - -// Includes -#include -#include "upnpavdeviceobserver.h" -#include - -#include "cmmmobserver.h" -#include "cmserviceobserver.h" - -// Forward declarations -class MUPnPAVController; -class CCmMediaServerFull; -class CCmDriveInfo; -class CCmFillListItem; -class CCmSqlPropertyCollector; -class CCmDmMain; -class MCmFmManager; -class MCmSmManager; -class CCmMmMain; -class MCmMdhClient; -class MCmSettings; -class CCmScheduler; -class CCmFillRuleContainer; -class CCmSqlPropertyContainer; - - -// CLASS DECLARATION - -/** - * Content Manager server Core class - * - * @since S60 3.1 - */ -NONSHARABLE_CLASS ( CCmServer ) : public CPolicyServer, - public MCmServiceObserver, - public MUPnPAVDeviceObserver, - public MCmMmObserver, - public MMdESessionObserver - { - -public: - - /** - * Two-phased constructor. - */ - static CCmServer* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmServer(); - -public: - - /** - * Decrements server sessions - * @Since S60 3.1 - */ - void DecrementSessions(); - - /** - * Server state - * @Since S60 3.1 - * @return TCmServerState, server state - */ - TCmServerState ServerState() const; - - /** - * Sets asynchronous message - * @Since S60 3.1 - * @param aMessage, asynchronous message - */ - void SetCurrentAsyncMsg( const RMessage2& aMessage ); - - /** - * Executes service - * @Since S60 3.1 - * @param aService, service to be executed - */ - void ExecuteServiceL( TCmService aService ); - - /** - * Executes service - * @Since S60 3.1 - * @param aService, service to be executed - * @param aOptParam1, optional parameter 1 - * @param aOptParam2, optional parameter 2 - */ - void ExecuteServiceL( TCmService aService, - TInt aOptParam1, - TAny* aOptParam2 ); - - /** - * Sets service state - * @Since S60 3.1 - * @param aService, Service - * @param aState, service state - */ - void SetServiceStateL( TCmService aService, TCmServiceState aState ); - - /** - * Cancels current service - * @Since S60 3.1 - */ - void CancelServiceL(); - - /** - * Returns propertycontainer - * @since S60 3.1 - * @return CCmSqlPropertyContainer, property container - */ - CCmSqlPropertyContainer* PropertyContainer() const; - - /** - * Returns propertycollector - * @since S60 3.2 - * @return CCmSqlPropertyCollector, property containers - */ - CCmSqlPropertyCollector* PropertyCollector() const; - - /** - * Returns mediaserver array - * @Since S60 3.1 - * @return RPointerArray, server array - */ - RPointerArray& MediaServerArray(); - - /** - * Returns fill rule container - * @Since S60 3.1 - * @return CCmFillRuleContainer, fill rule container - */ - CCmFillRuleContainer* FillRuleContainerL() const; - - /** - * Drive status - * @since S60 3.1 - * @return TBool, ETrue if set, EFalse otherwise - */ - TBool DriveSelectionStatus(); - - /** - * Sets drive status - * @since S60 3.1 - * @param aDriveSelectionStatus, Drive status - */ - void SetDriveSelectionStatus( const TBool aDriveSelectionStatus ); - - /** - * Set async observer flag - * @since S60 3.1 - * @param aState, ETrue if application initiated - * EFalse if scheduler initiated - */ - void SetAsyncRequestStateL( TBool aState ); - -protected: - -// From base class MCmAVDeviceObserver - - /** - * From MCmAVDeviceObserver - * See base class definition - */ - void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice); - - /** - * From MCmAVDeviceObserver - * See base class definition - */ - void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice); - - /** - * From MCmAVDeviceObserver - * See base class definition - */ - void WLANConnectionLost(); - -// From base class MCmMmObserver - - /** - * From MCmMmObserver - * See base class definition - */ - void DeleteCompleteL( TInt aErr ); - - /** - * From MCmMmObserver - * See base class definition - */ - void ShrinkCompleteL( TInt aErr ); - -// From base class MMdESessionObserver - - /** - * From MMdESessionObserver - * See base class definition - */ - void HandleSessionOpened(CMdESession& aSession, TInt aError); - - /** - * From MMdESessionObserver - * See base class definition - */ - void HandleSessionError(CMdESession& aSession, TInt aError); - -// From base class CPolicyServer - - /** - * From CPolicyServer - * See base class definition - */ - CSession2* NewSessionL( const TVersion& aVersion, - const RMessage2& aMessage ) const; - -private: - /** - * Creates SQL about files to be deleted - * - * @since S60 5.1 - * @param aItems, item list - * @param aDrives, drivinfo - * @param aFilesToDelete, Sql clause array - */ - void CreateFileDeleteSQLL( RPointerArray& aItems, - RPointerArray& aDrives, - CDesCArrayFlat* aFilesToDelete ); -private: - - /** - * C++ default constructor. - */ - CCmServer(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Creates AV controller and starts discovery timer - * @since S60 3.1 - */ - void CreateAvcAndTimerL(); - - /** - * Checks if server is not ready - * @since S60 3.1 - */ - void LeaveIfNotReadyL(); - - /** - * Deletes next fill rule - * @since S60 3.1 - */ - void DeleteUnselectedFillFilesL(); - - /** - * Starts store process - * @since S60 3.1 - */ - void ExecuteStoreL(); - - /** - * Starts fill process - * @since S60 3.1 - */ - void ExecuteFillL(); - - /** - * Gets status by group id - * @since S60 3.1 - * @param aListId, list id - * @param aStatus, list item status - * @return TInt, error code - */ - TInt GetStatusByGroupId( TUint aListId, TCmListItemStatus& aStatus ); - - /** - * Checks server and adds it to db - * @since S60 3.1 - * @param aDevice, media server - */ - void CheckServerL( const CUpnpAVDevice& aDevice ); - - /** - * Deletes filled files - * @Since S60 3.1 - */ - void DeleteFilledFilesL(); - - /** - * Device discovery timer - * @Since S60 3.1 - * @param TAny, caller class pointer - * @return TInt, returns always 0 - */ - static TInt SearchTimerCompletedL( TAny* aNy ); - - /** - * Called when service is executed - * @Since S60 3.1 - * @param TCmService, completed service - * @param TInt, error code - */ - void ServiceExecuted( TCmService aService, TInt aErrCode ); - - /** - * Updates fill list priorities - * @Since S60 3.1 - */ - void UpdateFillPriorities(); - - /** - * Append drive letter - * @since S60 3.1 - * @param aFs, file server - * @param aDriveNumber, drive number - */ - HBufC* ResolveAndAppendRootPathL( RFs& aFs, const TInt aDriveNumber ); - - /** - * Updates drive quota when files are deleted - * @since S60 3.1 - * @param aDrives, drive info - * @param aItem, deleted item - */ - void UpdateDriveQuota( RPointerArray& aDrives, - CCmFillListItem& aItem ); - - /** - * Starts service when timer elapses - * @Since S60 3.1 - * @return TInt, returns always 0 - */ - TInt DoSearchTimerCompletedL(); - - /** - * Deletes property container - * @Since S60 3.1 - */ - void DeletePropertyContainer(); - - /** - * Deletes items from database by FillListId - * @Since S60 3.1 - */ - void DeleteItemsByFillListId( TInt aFillListId ); - - /** - * Sort function that arranges pointers by id - * @since S60 5.1 - * @param aItem1, item to be sorted - * @param aItem2, item to be sorted - */ - static TInt CompareById( const CCmFillListItem& aItem1, - const CCmFillListItem& aItem2 ); - -private: - - /** - * AV controller - */ - MUPnPAVController* iAvController; // owned - /** - * Database manager - */ - CCmDmMain* iDbManager; // owned - /** - * Fill manager - */ - MCmFmManager* iFillManager; // owned - /** - * Store manager - */ - MCmSmManager* iStoreManager; // owned - /** - * Memory manager - */ - CCmMmMain* iMemoryManager; // owned - /** - * Metadata harvester - */ - MCmMdhClient* iMdhClient; // owned - /** - * Settings engine - */ - MCmSettings* iSettings; // owned - /** - * Scheduler - */ - CCmScheduler* iScheduler; // owned - /** - * Server state - */ - TCmServerState iServerState; - /** - * Current asyncronous message holder - */ - RMessage2 iCurrentAsyncMsg; - /** - * Device discovery timer - */ - CPeriodic* iDeviceDiscoveryTimer; // owned - /** - * Fill rule container - */ - CCmFillRuleContainer* iFillRuleContainer; // owned - /** - * Item container - */ - CCmSqlPropertyContainer* iPropertyContainer; // owned - /** - * Mediaserver array - */ - RPointerArray iMediaServers; // owned - /** - * Session counter - */ - TInt* iSessionCount; - /** - * Fill rule index - */ - TInt iFillRuleIndex; - /** - * Indicator for delete process - */ - TBool iDeletingDeletedItems; - /** - * Asynchronous request status - */ - TBool iAsyncRequestOn; - /** - * Store execution indicator - */ - TBool iExecuteStoreAfterDelete; - /** - * Memory manager status - */ - TBool iMmState; - /** - * MDE session - */ - CMdESession* iSession; // owned - /** - * Fill list collector - */ - CCmSqlPropertyCollector* iPropertyCollector; // not owned - /** - * status flag for drive setting - */ - TBool iDriveSelectionStatus; - }; - -#endif // CMSERVER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/inc/server/cmserversession.h --- a/homesync/contentmanager/cmserver/cmserver/inc/server/cmserversession.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +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: content manager server session header -* -*/ - - - -#ifndef CMSERVERSESSION_H -#define CMSERVERSESSION_H - - -// FORWARD DECLARATIONS -class CCmServer; - -// CLASS DECLARATION - -/** -* CCmSession -* This is a class for content manager server main session -* -* @since S60 3.1 -*/ -NONSHARABLE_CLASS( CCmSession ) : public CSession2 - { -public: - - /** - * Two-phased constructor. - */ - static CCmSession* NewL( CCmDmMain& aDbManager, - MCmSettings& aSettings ); - - /** - * Destructor. - */ - virtual ~CCmSession(); - -// From base class CSession2 - - /** - * From CSession2. - * see base class definition - */ - void ServiceL( const RMessage2 &aMessage ); - -protected: - - /** - * Panics the client - * - * @since S60 5.1 - * @param aMessage, received message - * @param aPanic, panic code - */ - void PanicClient( const RMessage2& aMessage, TInt aPanic ) const; - -private: - - /** - * Constructor. - */ - CCmSession( CCmDmMain& aDbManager, MCmSettings& aSettings ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Performs the first phase of two phase construction - * @since S60 3.1 - * @param void - * @return content manager server reference - */ - CCmServer& Server(); - -private: - - /** - * Database manager - */ - CCmDmMain& iDbManager; - /** - * Settings engine - */ - MCmSettings& iSettings; - /** - * Buffer for collected data - */ - CBufFlat* iDataBuffer; // owned - /** - * Metadata collector - */ - CCmSqlPropertyCollector* iCollector; // owned - }; - -#endif // CMSERVERSESSION_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/src/client/cmactive.cpp --- a/homesync/contentmanager/cmserver/cmserver/src/client/cmactive.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +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: Content Manager server's client ao implementation -* -*/ - - -#include "cmactive.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmActive::NewL -// --------------------------------------------------------------------------- -CCmActive* CCmActive::NewL( RContentManager& aCm ) - { - LOG(_L("[Cm Server]\t CCmActive::NewL")); - CCmActive* self = CCmActive::NewLC( aCm ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmActive::NewLC -// --------------------------------------------------------------------------- -CCmActive* CCmActive::NewLC( RContentManager& aCm ) - { - LOG(_L("[Cm Server]\t CCmActive::NewL")); - CCmActive* self = new ( ELeave ) CCmActive( aCm ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmActive::~CCmActive -// --------------------------------------------------------------------------- -CCmActive::~CCmActive() - { - LOG(_L("[Cm Server]\t CCmActive::~CCmActive")); - } - -// --------------------------------------------------------------------------- -// CCmActive::CCmActive -// --------------------------------------------------------------------------- -CCmActive::CCmActive( RContentManager& aCm ) - : CActive( EPriorityHigh ), - iCm( aCm ), iIdle( ETrue ) - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CCmActive::ConstructL -// --------------------------------------------------------------------------- -void CCmActive::ConstructL() - { - LOG(_L("[Cm Server]\t CCmActive::ConstructL")); - } - -// --------------------------------------------------------------------------- -// CCmActive::RunL -// --------------------------------------------------------------------------- -void CCmActive::RunL() - { - LOG(_L("[Cm Server]\t CCmActive::RunL")); - TRACE(Print(_L("[Cm Server]\t status %d"), iStatus.Int() )); - - if ( iIdle ) - { - LOG(_L("[Cm Server]\t CCmActive::RunL set active")); - SetActive(); - iIdle = EFalse; - } - else - { - LOG(_L("[Cm Server]\t CCmActive::RunL operation completed")); - iCm.OperationCompletedL( iStatus.Int() ); - } - } - -// --------------------------------------------------------------------------- -// CCmActive::DoCancel -// --------------------------------------------------------------------------- -void CCmActive::DoCancel() - { - LOG(_L("[Cm Server]\t CCmActive::DoCancel")); - TRAPD( error, iCm.OperationCompletedL( KErrCancel ) ); - if ( error ) - { - TRACE(Print(_L("[Cm Server]\tCCmActive::DoCancel \ - error = %d"), error )); - } - } - -// --------------------------------------------------------------------------- -// CCmActive::RunError -// --------------------------------------------------------------------------- -TInt CCmActive::RunError( TInt aError ) - { - TRACE( Print(_L("[Cm Server]\t CCmActive::RunError \ - error = %d"), aError )); - - // let it leave - return aError; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/src/client/cmclientsession.cpp --- a/homesync/contentmanager/cmserver/cmserver/src/client/cmclientsession.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,938 +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: Content Manager server's client -* -*/ - - - -// INCLUDE FILES - -#include -#include - -#include "cmfillrulecontainer.h" -#include "cmstorerulecontainer.h" -#include "cmbaselistitem.h" -#include "cmmediaserverfull.h" -#include "cmsqlpropertyitem.h" -#include "cmsqlpropertycontainer.h" -#include "cmsqlpropertycollector.h" -#include "cmdriveinfo.h" -#include "cmactive.h" -#include "msdebug.h" - - -// CONSTANTS -// Number of retries to start server -const TInt KServerRetries = 2; -// wizard executed state -const TInt KAppWizardExecuted = 1; - -// --------------------------------------------------------------------------- -// StartServer -// Creates a new process for the server and starts it up. -// --------------------------------------------------------------------------- -// -static TInt StartServer() - { - LOG(_L("[Cm Server]\t StartServer begin")); - - TInt result( KErrNone ); - // create server - if one of this name does not already exist - TFindServer findServer( KCmServerName ); - TFullName name; - if ( findServer.Next( name ) != KErrNone ) // we don't exist already - { - - TRequestStatus status( KRequestPending ); - RProcess server; - // Create the server process - result = server.Create( KCmServerExe, KNullDesC ); - if( result != KErrNone ) - { - return result; - } - - // Process created successfully - server.Resume(); // start it going - server.Rendezvous( status ); - - // Wait until the completion of the server creation - // server signals us when it's up - User::WaitForRequest( status ); - - if( status != KErrNone ) - { - server.Close(); - return status.Int(); - } - - // Server created successfully - server.Close(); // we can close the handle to server process now - } - - LOG(_L("[Cm Server]\t StartServer end")); - - return result; - } - -// --------------------------------------------------------------------------- -// RContentManager::RContentManager -// --------------------------------------------------------------------------- -// -EXPORT_C RContentManager::RContentManager() - { - LOG(_L("[Cm Server]\t RContentManager::RContentManager")); - - iClientRequest = NULL; - iTargetContainer = NULL; - iBuffer = NULL; - iAo = NULL; - } - -// --------------------------------------------------------------------------- -// RContentManager::Close -// --------------------------------------------------------------------------- -// -EXPORT_C TInt RContentManager::Close() - { - LOG(_L("[Cm Server]\t RContentManager::Close")); - - // Base call - RSessionBase::Close(); - - if ( iAo ) - { - delete iAo; iAo = NULL; - } - - if( iBuffer ) - { - delete iBuffer; - iBuffer = NULL; - } - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::Connect -// Starts and creates a session of Content Manager -// --------------------------------------------------------------------------- -// -EXPORT_C TInt RContentManager::Connect() - { - LOG(_L("[Cm Server]\t RContentManager::Connect")); - - iCanceled = EFalse; - - TInt tryLoop( 0 ); - TInt errCode( KErrNone ); - - for ( tryLoop = 0; tryLoop < KServerRetries; tryLoop++ ) - { - errCode = CreateSession(KCmServerName, - TVersion( KCmServerMajor, KCmServerMinor, - KCmServerBuild ) ); - //gives MessageSlots of -1 - //this uses global pool rather than local pool - - TRACE(Print(_L("[Cm Server]\t RContentManager::Connect New Session \ - created with status %d\n"), errCode)); - - if( errCode == KErrNotSupported ) - { - TRACE(Print(_L("[Cm Server]\t Version not supported!\n"))); - return errCode; - } - if ( errCode != KErrNotFound && errCode != KErrServerTerminated) - { - return errCode; - } - - errCode = StartServer(); - - TRACE(Print(_L("[Cm Server]\t RContentManager::Connect Start server \ - errCode %d\n"), errCode)); - - if ( errCode != KErrNone && errCode != KErrAlreadyExists ) - { - return errCode; - } - - } - return errCode; - } - -// --------------------------------------------------------------------------- -// RContentManager::OperationCompletedL -// --------------------------------------------------------------------------- -// -TInt RContentManager::OperationCompletedL( TInt aErr ) - { - LOG(_L("[Cm Server]\t RContentManager::OperationCompletedL")); - - TRACE(Print(_L("[Cm Server]\t RContentManager::OperationCompletedL \ - aErr = %d, iCanceled = %d\n"), aErr, iCanceled)); - - if ( !aErr && !iCanceled ) - { - // Items are changed so we don't want to keep old ones - // Containers cannot be deleted because application - // looses their address - for ( TInt i = 0; - i < (*iTargetContainer)->PropertyContainerCount(); - i++ ) - { - CCmSqlPropertyContainer* container = - (*iTargetContainer)->PropertyContainer( i ); - for ( TInt j = 0; j < container->PropertyItemCount(); j++ ) - { - container->DeletePropertyItem(j--); - } - } - - TInt size( 0 ); - TPckg sizePckg( size ); - SendReceive( ECmGetDataFieldSize, TIpcArgs( &sizePckg )); - - if ( size > 0 ) - { - HBufC8* buffer = HBufC8::NewLC( size ); - - TPtr8 bufferPointer = buffer->Des(); - SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) ); - - RDesReadStream stream; - stream.Open( bufferPointer ); - CleanupClosePushL( stream ); - - // copy items to application side containers - CopyItemsL( stream ); - - CleanupStack::PopAndDestroy( 2, buffer ); - } - - - } - User::RequestComplete( iClientRequest, aErr ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::CopyItemsL -// --------------------------------------------------------------------------- -// -void RContentManager::CopyItemsL( RDesReadStream& aStream ) - { - LOG(_L("[Cm Server]\t RContentManager::CopyItemsL")); - - CCmSqlPropertyCollector* collector = CCmSqlPropertyCollector::NewLC(); - collector->InternalizeL( aStream ); - - // append internalized items to containers - for ( TInt k = 0; k < collector->PropertyContainerCount(); k++ ) - { - CCmSqlPropertyContainer* container = - collector->PropertyContainer( k ); - CCmSqlPropertyContainer* targetContainer = - (*iTargetContainer)->PropertyContainer(k); - for ( TInt l = 0; l < container->PropertyItemCount(); l++ ) - { - // copy item - // must be done so that we can destroy collector - CCmSqlPropertyItem* item = new ( ELeave ) - CCmSqlPropertyItem( *container->PropertyItem(l)); - CleanupStack::PushL( item ); - // add copied item - targetContainer->AddPropertyItemL( item ); - CleanupStack::Pop( item ); - // delete original item - container->DeletePropertyItem( l ); - // itemcount decreased so index must be updated also - l--; - } - } - CleanupStack::PopAndDestroy( collector ); - } - -// --------------------------------------------------------------------------- -// RContentManager::Cancel -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::Cancel() - { - LOG(_L("[Cm Server]\t RContentManager::Cancel\n")); - - // iCanceled is set ETrue if user is closing the application - // We don't want to cancel asynchronous process - - TRACE(Print(_L("[Cm Server]\t RContentManager::Cancel value is %d\n"), - iCanceled)); - if ( !iCanceled ) - { - SendReceive( ECmCancel, TIpcArgs() ); - } - - if ( iAo ) - { - iAo->Deque(); - delete iAo; iAo = NULL; - } - - LOG(_L("[Cm Server]\t RContentManager::Cancel end\n")); - } - -// --------------------------------------------------------------------------- -// RContentManager::ServerState -// --------------------------------------------------------------------------- -EXPORT_C TCmServerState RContentManager::ServerState() const - { - LOG(_L("[Cm Server]\t RContentManager::ServerState\n")); - - TCmServerState state; - TPckg pckg( state ); - SendReceive( ECmGetServerState, TIpcArgs( &pckg ) ); - - return state; - } - -// --------------------------------------------------------------------------- -// RContentManager::SetServiceState -// --------------------------------------------------------------------------- -EXPORT_C TInt RContentManager::SetServiceState( const TCmService aService, - const TCmServiceState aNewState ) - { - LOG(_L("[Cm Server]\t RContentManager::SetServiceState\n")); - - TRACE(Print(_L("[Cm Server]\t service %d state %d \n"), - aService, (TInt)aNewState )); - - SendReceive( ECmSetServiceState, TIpcArgs( aService, aNewState ) ); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::ServiceState -// --------------------------------------------------------------------------- -EXPORT_C TCmServiceState RContentManager::ServiceState - ( const TCmService aService ) const - { - LOG(_L("[Cm Server]\t RContentManager::ServiceState\n")); - - TCmServiceState state; - TPckg pckg( state ); - SendReceive( ECmGetServiceState, TIpcArgs( aService, &pckg ) ); - - return state; - } - -// --------------------------------------------------------------------------- -// RContentManager::ExecuteService -// --------------------------------------------------------------------------- -EXPORT_C TInt RContentManager::ExecuteService( const TCmService aService, - TRequestStatus& aStatus ) - { - TRACE( Print (_L("[Cm Server]\t RContentManager::ExecuteServiceL \ - aService = %d\n"), aService )); - - SendReceive( ECmExecuteService, TIpcArgs( aService ), aStatus ); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::GetItemCountsL -// --------------------------------------------------------------------------- - -EXPORT_C TInt RContentManager::GetItemCountsL( const TCmService aService, - const TDesC8& aListName, - TInt& aCount, - TInt64& aSize ) const - { - TRACE( Print( _L("[Cm Server]\t RContentManager::GetItemCountsL \ - service = %d\n"), aService )); - - if ( aService != ECmServiceFill && - aService != ECmServiceStore ) - { - LOG(_L("[Cm Server]\t RContentManager::ItemCount wrong argument\n")); - User::Leave( KErrArgument ); - } - TPckg countPckg( aCount ); - TPckg sizePckg( aSize ); - - SendReceive( ECmGetItemCount, - TIpcArgs( &countPckg, &sizePckg, aService, &aListName ) ); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// Get filled files size -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::GetFilledFilesSize( TInt64& aSize, const TInt aID ) const - { - TPckg sizePckg( aSize ); - SendReceive( ECmGetFilledFilesSize, TIpcArgs( &sizePckg, aID ) ); - } - -// RContentManager::GetTransferInfo -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::GetTransferInfo( const TCmService aService, - TInt& aItemCount, - TInt& aTimeInSec ) const - { - TRACE( Print( _L("[Cm Server]\t RContentManager::GetTransferInfo \ - service = %d\n"), aService )); - TPckg countPckg( aItemCount ); - TPckg timePckg( aTimeInSec ); - SendReceive( ECmGetTransferInfo, - TIpcArgs( aService, &countPckg, &timePckg ) ); - } - -// --------------------------------------------------------------------------- -// RContentManager::GetFilteredMetadataL -// --------------------------------------------------------------------------- -EXPORT_C TInt RContentManager::GetFilteredMetadataL( - const TCmService aService, - CCmSqlPropertyCollector*& aCollector, - TRequestStatus& aStatus ) - { - TRACE( Print( _L("[Cm Server]\t RContentManager::GetFilteredMetadataL \ - service = %d\n"), aService )); - - if ( aService != ECmServiceFill && - aService != ECmServiceStore ) - { - LOG(_L("[Cm Server]\t RContentManager::GetFilteredMetadataL \ - wrong argument\n")); - User::Leave( KErrArgument ); - } - - iCanceled = EFalse; - - if ( iAo ) - { - delete iAo; iAo = NULL; - } - iAo = CCmActive::NewL( *this ); - - iBuffer = CBufFlat::NewL( KKilo ); - RBufWriteStream stream; - stream.Open( *iBuffer ); - CleanupClosePushL( stream ); - aCollector->ExternalizeL( stream ); - - iBufferPointer.Set( iBuffer->Ptr(0) ); - SendReceive( ECmGetDataFields, - TIpcArgs( &iBufferPointer ), - iAo->iStatus); - - CleanupStack::PopAndDestroy(); // stream - - iAo->RunL(); - - aStatus = KRequestPending; - iTargetContainer = &aCollector; - - iClientRequest = &aStatus; - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::DeleteMetadataL -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::UpdateFillListsL( TRequestStatus& aStatus ) - { - LOG(_L("[Cm Server]\t RContentManager::UpdateFillListsL\n")); - SendReceive( ECmUpdateFillLists, aStatus ); - } - -// --------------------------------------------------------------------------- -// Deleting metadata harvested from unselected servers -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::DeleteMetadataL( - TRequestStatus& aStatus ) - { - LOG(_L("[Cm Server]\t RContentManager::DeleteMetadataL\n")); - if( iBuffer ) - { - delete iBuffer; - iBuffer = NULL; - } - iBuffer = CBufFlat::NewL( KKilo ); - RBufWriteStream stream; - stream.Open( *iBuffer ); - CleanupClosePushL( stream ); - - iBufferPointer.Set( iBuffer->Ptr(0) ); - SendReceive( ECmDeleteMetadata, - TIpcArgs( &iBufferPointer ), - aStatus ); - CleanupStack::PopAndDestroy( &stream ); - } - -// --------------------------------------------------------------------------- -// RContentManager::LastSyncTime -// --------------------------------------------------------------------------- -EXPORT_C TTime RContentManager::LastSyncTime() const - { - LOG(_L("[Cm Server]\t RContentManager::LastSyncTime\n")); - TTime syncTime( 0 ); - TPckg timePckg( syncTime ); - SendReceive( ECmGetSyncTime, TIpcArgs( &timePckg ) ); - return syncTime; - } - - -// --------------------------------------------------------------------------- -// RContentManager::SetFillFileStatusesL -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::SetFillFileStatusesL( - const RPointerArray& aItems ) - { - LOG(_L("[Cm Server]\t RContentManager::SetFillFileStatusesL\n")); - - CBufFlat* buffer = CBufFlat::NewL( KKilo ); - CleanupStack::PushL( buffer ); - RBufWriteStream stream; - stream.Open( *buffer ); - CleanupClosePushL( stream ); - for ( TInt i = 0; i < aItems.Count(); i++ ) - { - aItems[ i ]->ExternalizeL( stream ); - } - - TPtrC8 bufferPointer = buffer->Ptr(0); - SendReceive( ECmSetFillFileStatuses, - TIpcArgs( &bufferPointer, aItems.Count() ) ); - CleanupStack::PopAndDestroy( 2, buffer ); - } - -// --------------------------------------------------------------------------- -// RContentManager::AppWizardState -// --------------------------------------------------------------------------- - -EXPORT_C TBool RContentManager::AppWizardState() const - { - LOG(_L("[Cm Server]\t RContentManager::AppWizardState\n")); - - TInt appWizardState(0); - TPckg wizardStatepckg( appWizardState ); - SendReceive( ECmGetAppWizardState, TIpcArgs( &wizardStatepckg ) ); - - TBool returnvalue = EFalse; - if ( appWizardState == KAppWizardExecuted ) - { - returnvalue = ETrue; - } - return returnvalue; - } - -// --------------------------------------------------------------------------- -// RContentManager::SetAppWizardState -// --------------------------------------------------------------------------- - -EXPORT_C TInt RContentManager::SetAppWizardState() - { - LOG(_L("[Cm Server]\t RContentManager::SetAppWizardState\n")); - - SendReceive( ECmSetAppWizardState ); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::SetFillRulesL -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::SetFillRulesL( - const CCmFillRuleContainer& aFillRules ) - { - LOG(_L("[Cm Server]\t RContentManager::SetFillRulesL\n")); - -#ifdef _DEBUG - CCmFillRuleContainer* temp = (CCmFillRuleContainer*) &aFillRules; - TInt count = temp->FillRuleCount(); - TRACE(Print(_L("[Cm Server]\t fill rule count is %d\n"), count)); -#endif - - CBufFlat* buffer = CBufFlat::NewL( KKilo ); - CleanupStack::PushL( buffer ); - RBufWriteStream stream; - stream.Open( *buffer ); - CleanupClosePushL( stream ); - aFillRules.ExternalizeL( stream ); - TPtrC8 bufferPointer = buffer->Ptr(0); - SendReceive( ECmSetFillRules, TIpcArgs( &bufferPointer ) ); - CleanupStack::PopAndDestroy( 2, buffer ); - } - -// --------------------------------------------------------------------------- -// RContentManager::FillRulesL -// --------------------------------------------------------------------------- -EXPORT_C CCmFillRuleContainer* RContentManager::FillRulesL() - { - LOG(_L("[Cm Server]\t RContentManager::FillRulesL\n")); - TInt size( 0 ); - TPckg pckg( size ); - SendReceive( ECmGetFillRulesSize, TIpcArgs( &pckg )); - // for some reason the sendreceive sometimes leaves size as negative. - // leave if this is the case. - if ( size < 0 ) - { - User::Leave( KErrArgument ); - } - TRACE(Print(_L("[Cm Server]\t RContentManager: buffer size is %d\n"), - size) ); - HBufC8* buffer = HBufC8::NewLC( size ); - TPtr8 bufferPointer = buffer->Des(); - SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) ); - - RDesReadStream stream; - stream.Open( bufferPointer ); - CleanupClosePushL( stream ); - CCmFillRuleContainer* container = CCmFillRuleContainer::NewLC(); - container->InternalizeL( stream ); - CleanupStack::Pop( container ); - CleanupStack::PopAndDestroy( 2, buffer ); - return container; - } - - -// --------------------------------------------------------------------------- -// RContentManager::ListItemsL -// --------------------------------------------------------------------------- -// -EXPORT_C RPointerArray* - RContentManager::ListItemsL( const TDesC8& aListName, - TCmService aService ) - { - LOG(_L("[Cm Server]\t RContentManager::ListItemsL")); - -#ifdef _DEBUG - HBufC* listName16 = HBufC::NewLC( aListName.Length() ); - listName16->Des().Copy( aListName ); - TRACE( Print(_L("[Cm Server]\t RContentManager::FillListItemsL \ - list name %S"), listName16 ) ); - CleanupStack::PopAndDestroy( listName16 ); -#endif - - TInt size( 0 ); - TInt itemCount( 0 ); - TPckg sizePckg( size ); - TPckg countPckg( itemCount ); - - // Switch statement ensures that SendReceive is not called with other - // services that ECmGetFillItemsSize and ECmGetStoreItemsSize - switch ( aService ) - { - case ECmServiceFill: - { - SendReceive( ECmGetFillItemsSize, - TIpcArgs( &aListName, &sizePckg, &countPckg ) ); - - break; - } - case ECmServiceStore: - { - SendReceive( ECmGetStoreItemsSize, - TIpcArgs( &aListName, &sizePckg, &countPckg ) ); - break; - } - default: - { - LOG(_L("[Cm Server]\t RContentManager::ListItemsL \ - service not supported")); - break; - } - - } - - TRACE( Print( _L("[Cm Server]\t RContentManager::ListItemsL \ - size = %d, itemCount = %d"), size, itemCount )); - - // Sendreceive leaves size or itemCount as negative - if ( size < 0 || itemCount < 0 ) - { - User::Leave( KErrArgument ); - } - - HBufC8* buffer = HBufC8::NewLC( size ); - TPtr8 bufferPointer = buffer->Des(); - SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) ); - RDesReadStream stream; - stream.Open( bufferPointer ); - CleanupClosePushL( stream ); - - RPointerArray* itemArray = - new (ELeave)RPointerArray(); - CleanupStack::PushL( itemArray ); - for( TInt i = 0; i < itemCount; i++ ) - { - CCmBaseListItem* item = CCmBaseListItem::NewLC(); - item->InternalizeL( stream ); - itemArray->AppendL( item ); - CleanupStack::Pop( item ); - } - - CleanupStack::Pop( itemArray ); - CleanupStack::PopAndDestroy( 2, buffer ); - return itemArray; - - } - -// --------------------------------------------------------------------------- -// RContentManager::PreProcessFillList -// --------------------------------------------------------------------------- -EXPORT_C TInt RContentManager::PreProcessFillList( const TDesC8& aListName, - TRequestStatus& aStatus ) - { - LOG(_L("[Cm Server]\t RContentManager::PreProcessFillList\n")); - - SendReceive( ECmPreProcessFillList, TIpcArgs( &aListName ), aStatus ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::MediaserversL -// --------------------------------------------------------------------------- - -EXPORT_C RPointerArray* - RContentManager::MediaserversL() const - { - LOG(_L("[Cm Server]\t RContentManager::MediaServersL\n")); - TInt size( 0 ); - TInt amount( 0 ); - TPckg pckg( size ); - TPckg pckg2( amount ); - - SendReceive( ECmGetMediaserversSize, TIpcArgs( &pckg, &pckg2 ) ); - // Sendreceive leaves size or amount as negative - if ( size < 0 || amount < 0 ) - { - User::Leave( KErrArgument ); - } - - TRACE(Print(_L("[Cm Server]\t RContentManager: \ - buffer size is %d, amount %d\n"), size, amount)); - - HBufC8* buffer = HBufC8::NewLC( size ); - TPtr8 bufferPointer = buffer->Des(); - SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) ); - - RDesReadStream stream; - stream.Open( bufferPointer ); - CleanupClosePushL( stream ); - - RPointerArray* mediaServers = - new (ELeave) RPointerArray(); - CleanupStack::PushL( mediaServers ); - - for ( TInt i = 0; i < amount; i++ ) - { - CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC(); - tempServer->InternalizeL( stream ); - mediaServers->Append( tempServer ); - CleanupStack::Pop( tempServer ); - } - CleanupStack::Pop( mediaServers ); - CleanupStack::PopAndDestroy( 2, buffer ); - return mediaServers; - } - -// --------------------------------------------------------------------------- -// RContentManager::SetMediaserversL -// --------------------------------------------------------------------------- -EXPORT_C TInt RContentManager::SetMediaserversL( - RPointerArray& aMediaServers ) - { - LOG(_L("[Cm Server]\t RContentManager::SetMediaserversL\n")); - - CBufFlat* buffer = CBufFlat::NewL( KKilo ); - CleanupStack::PushL( buffer ); - RBufWriteStream stream; - stream.Open( *buffer ); - CleanupClosePushL( stream ); - for ( TInt i = 0; i < aMediaServers.Count(); i++ ) - { - aMediaServers[ i ]->ExternalizeL( stream ); - } - - TPtrC8 bufferPointer = buffer->Ptr(0); - SendReceive( ECmSetMediaServers, - TIpcArgs( &bufferPointer, aMediaServers.Count() ) ); - CleanupStack::PopAndDestroy( 2, buffer ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// RContentManager::DeleteDeletedMediaserversL -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::DeleteDeletedMediaserversL() - { - LOG(_L("[Cm Server]\t RContentManager::DeleteDeletedMediaserversL\n")); - SendReceive( ECmDeleteDeletedMediaServers ); - } - -// --------------------------------------------------------------------------- -// RContentManager::SetStoreRulesL -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::SetStoreRulesL( - const CCmStoreRuleContainer& aStoreRules ) - { - LOG(_L("[Cm Server]\t RContentManager::SetStoreRulesL\n")); - -#ifdef _DEBUG - CCmStoreRuleContainer* temp = (CCmStoreRuleContainer*) &aStoreRules; - TInt count = temp->StoreRuleCount(); - TRACE(Print(_L("[Cm Server]\t store rule count is %d\n"), count)); -#endif - - CBufFlat* buffer = CBufFlat::NewL( KKilo ); - CleanupStack::PushL( buffer ); - RBufWriteStream stream; - stream.Open( *buffer ); - CleanupClosePushL( stream ); - aStoreRules.ExternalizeL( stream ); - TPtrC8 bufferPointer = buffer->Ptr(0); - SendReceive( ECmSetStoreRules, TIpcArgs( &bufferPointer ) ); - CleanupStack::PopAndDestroy( 2, buffer ); - - } - -// --------------------------------------------------------------------------- -// RContentManager::StoreRulesL -// --------------------------------------------------------------------------- -EXPORT_C CCmStoreRuleContainer* RContentManager::StoreRulesL() - { - LOG(_L("[Cm Server]\t RContentManager::StoreRulesL\n")); - TInt size( 0 ); - TPckg pckg( size ); - SendReceive( ECmGetStoreRulesSize, TIpcArgs( &pckg ) ); - // Sendreceive leaves size as negative - if ( size < 0 ) - { - User::Leave( KErrArgument ); - } - - TRACE(Print(_L("[Cm Server]\t RContentManager: buffer size is %d\n"), - size)); - - HBufC8* buffer = HBufC8::NewLC( size ); - TPtr8 bufferPointer = buffer->Des(); - SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) ); - - RDesReadStream stream; - stream.Open( bufferPointer ); - CleanupClosePushL( stream ); - CCmStoreRuleContainer* container = CCmStoreRuleContainer::NewLC(); - container->InternalizeL( stream ); - CleanupStack::Pop( container ); - CleanupStack::PopAndDestroy( 2, buffer ); - return container; - } - -// --------------------------------------------------------------------------- -// RContentManager::SetDrivesL -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::SetDrivesL( - RPointerArray aDrives ) - { - LOG(_L("[Cm Server]\t RContentManager::SetDrivesL\n")); - - CBufFlat* buffer = CBufFlat::NewL( KKilo ); - CleanupStack::PushL( buffer ); - RBufWriteStream stream; - stream.Open( *buffer ); - CleanupClosePushL( stream ); - - for ( TInt i = 0; i < aDrives.Count(); i++ ) - { - aDrives[ i ]->ExternalizeL( stream ); - } - - TPtrC8 bufferPointer = buffer->Ptr(0); - SendReceive( ECmSetDrives, - TIpcArgs( &bufferPointer, aDrives.Count() ) ); - CleanupStack::PopAndDestroy( 2, buffer ); - } - -// --------------------------------------------------------------------------- -// RContentManager::GetDrivesL -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::GetDrivesL( - RPointerArray& aDrives ) - { - LOG(_L("[Cm Server]\t RContentManager::GetDrivesL\n")); - TInt size( 0 ); - TInt amount( 0 ); - TPckg pckg( size ); - TPckg pckg2( amount ); - SendReceive( ECmGetDrivesSize, TIpcArgs( &pckg, &pckg2 ) ); - // Sendreceive leaves size or amount as negative - if ( size < 0 || amount < 0 ) - { - User::Leave( KErrArgument ); - } - - TRACE(Print(_L("[Cm Server]\t RContentManager: \ - buffer size is %d, amount %d\n"), size, amount)); - - HBufC8* buffer = HBufC8::NewLC( size ); - TPtr8 bufferPointer = buffer->Des(); - SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) ); - - RDesReadStream stream; - stream.Open( bufferPointer ); - CleanupClosePushL( stream ); - - for ( TInt i = 0; i < amount; i++ ) - { - CCmDriveInfo* tempDrive = CCmDriveInfo::NewLC(); - tempDrive->InternalizeL( stream ); - aDrives.AppendL( tempDrive ); - CleanupStack::Pop( tempDrive ); - } - CleanupStack::PopAndDestroy( 2, buffer ); - } - -// --------------------------------------------------------------------------- -// RContentManager::DriveSelectionStatus -// --------------------------------------------------------------------------- -EXPORT_C TBool RContentManager::DriveSelectionStatus() - { - LOG(_L("[Cm Server]\t RContentManager: DriveSelectionStatus\n")); - - TBool status( EFalse ); - TPckg pckg( status ); - - SendReceive( ECmGetDriveSelectionStatus, TIpcArgs( &pckg ) ); - return status; - } - -// --------------------------------------------------------------------------- -// RContentManager::ApplicationExit -// --------------------------------------------------------------------------- -EXPORT_C void RContentManager::ApplicationExit() - { - LOG(_L("[Cm Server]\t RContentManager: ApplicationExit\n")); - iCanceled = ETrue; - - SendReceive( ECmApplicationExit, TIpcArgs() ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/src/server/cmserver.cpp --- a/homesync/contentmanager/cmserver/cmserver/src/server/cmserver.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1786 +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: Server implementation -* -*/ - - -#include -#include "upnpavdevice.h" -#include "upnpavcontroller.h" -#include "upnpavcontrollerfactory.h" - -#include "cmdmmain.h" -#include "cmfillmanagerfactory.h" -#include "cmfillmanager.h" -#include "cmstoremanagerfactory.h" -#include "cmstoremanager.h" -#include "cmscheduler.h" -#include "cmmmmain.h" -#include "cmfilllistitem.h" -#include "cmdriveinfo.h" -#include "cmmediaserverfull.h" -#include "cmfillrulecontainer.h" -#include "cmfillrule.h" -#include "cmsqlpropertycontainer.h" -#include "cmsettingsfactory.h" -#include "mmdhclient.h" -#include "mdhclientfactory.h" -#include "cmsettings.h" -#include "cmserver.h" -#include "cmserversession.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KDefaultSystemUpdateId = 0; // default system update id -const TInt KArrayGranularity = 16; // array granularity -const TInt KDriveBufferSize = 4; // drive letter buffer size -const TInt KDeleteDataBaseItem = 255; // delete status for FillListId -_LIT( KColon, ":"); // colon -_LIT( KDoubleBackSlash, "\\"); // double backslash - -//Total number of ranges -const TUint KCmServerRangeCount = 2; - -//Definition of the ranges of IPC numbers -const TInt KCmServerRanges[KCmServerRangeCount] = - { - 0, - 34 - }; - -//Policy to implement for each of the above ranges -const TUint8 KCmServerElementsIndex[KCmServerRangeCount] = - { - 1, //applies to 1st range - CPolicyServer::ENotSupported - }; - -//Specific capability checks -const CPolicyServer::TPolicyElement KCmServerElements[] = - { - {_INIT_SECURITY_POLICY_C3(ECapabilityNetworkServices, - ECapabilityReadUserData, ECapabilityWriteUserData ), - CPolicyServer::EFailClient }, - {_INIT_SECURITY_POLICY_C1(ECapabilityNetworkServices), - CPolicyServer::EFailClient} - }; - -//Package all the above together into a policy -const CPolicyServer::TPolicy KCmServerPolicy = - { - //specifies all connect attempts should pass - CPolicyServer::EAlwaysPass, - KCmServerRangeCount, - KCmServerRanges, - KCmServerElementsIndex, - KCmServerElements - }; - - -// --------------------------------------------------------------------------- -// CCmServer::CCmServer -// --------------------------------------------------------------------------- -// -CCmServer::CCmServer() - : CPolicyServer( CActive::EPriorityHigh, KCmServerPolicy ) - { - LOG(_L("[Cm Server]\t CCmServer::CCmServer")); - } - -// --------------------------------------------------------------------------- -// CCmServer::ConstructL -// --------------------------------------------------------------------------- -// -void CCmServer::ConstructL() - { - LOG(_L("[Cm Server]\t CCmServer::ConstructL")); - - iServerState = ECmServerStateIdle; - iSessionCount = (TInt*) User::AllocL( sizeof( TInt ) ); - *iSessionCount = 0; - - LOG(_L("[Cm Server]\t Creating settings..")); - iSettings = CCmSettingsFactory::NewCmSettingsEngineL(); - - TCmServiceState cmState( ECmServiceStateDisabled ); - iSettings->GetServiceState( ECmServiceContentManager, cmState ); - - TRACE(Print(_L("[Cm Server]\t Cm state is %d\n"), cmState)); - - if ( cmState ) - { - LOG(_L("[Cm Server]\t Creating scheduler..")); - iScheduler = CCmScheduler::NewL( *this, *iSettings ); - if ( cmState == ECmServiceStateAutomatic ) - { - iScheduler->SetServiceToExecute( ECmServicePreProcessingStore ); - } - } - - LOG(_L("[Cm Server]\t Creating db manager")); - iDbManager = CCmDmMain::NewL(); - LOG(_L("[Cm Server]\t Creating Mde session")); - iSession = CMdESession::NewL(*this); - - RPointerArray drives; - CleanupClosePushL( drives ); - iDbManager->PrepareQueryCmdL( EDrivesQuery ); - iDbManager->QueryDrivesL( drives ); - TRACE(Print(_L("[Cm Server]\t Drives count = %d"), - drives.Count() )); - if( drives.Count() ) - { - SetDriveSelectionStatus( ETrue ); - } - drives.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &drives ); - - LOG(_L("[Cm Server]\t Creating memory manager")); - TBool mmEnabled( EFalse ); - iSettings->GetMemoryManagerStatus( mmEnabled ); - LOG(_L("[Cm Server]\t Creating memory manager")); - iMemoryManager = CCmMmMain::NewL( *iDbManager ); - iMemoryManager->SetQuotaListenerStateL( mmEnabled ); - - LOG(_L("[Cm Server]\t Creating store manager")); - iStoreManager = CmStoreManagerFactory::NewStoreManagerL( this, *iSession, - iDbManager, iMemoryManager); - - LOG(_L("[Cm Server]\t Creating fill manager")); - iFillManager = CmFillManagerFactory::NewFillManagerL( - this, *iSession, iDbManager, iMemoryManager); - - LOG(_L("[Cm Server]\t Starting server...")); - - StartL( KCmServerName ); - - LOG(_L("[Cm Server]\t CCmServer::ConstructL end")); - } - -// --------------------------------------------------------------------------- -// CCmServer::NewLC -// --------------------------------------------------------------------------- -// -CCmServer* CCmServer::NewLC() - { - LOG(_L("[Cm Server]\t CCmServer::NewLC")); - CCmServer *self = new (ELeave) CCmServer(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmServer::~CCmServer -// --------------------------------------------------------------------------- -// -CCmServer::~CCmServer() - { - LOG(_L("[Cm Server]\t CCmServer::~CCmServer")); - - delete iDeviceDiscoveryTimer; - delete iFillRuleContainer; - - if ( iFillManager ) - { - iFillManager->Close(); - } - if ( iStoreManager ) - { - iStoreManager->Close(); - } - if ( iAvController ) - { - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - } - - iMdhClient->Close(); - delete iPropertyContainer; - delete iDbManager; - delete iMemoryManager; - delete iSessionCount; - iSettings->Close(); - delete iSession; - delete iScheduler; - } - - -// --------------------------------------------------------------------------- -// CCmServer::NewSessionL -// --------------------------------------------------------------------------- -// -CSession2* CCmServer::NewSessionL( const TVersion& aVersion, - const RMessage2 &/*aMessage*/) const - { - LOG(_L("[Cm Server]\t CCmServer::NewSessionL")); - // check we're the right version - TVersion version( KCmServerMajor, - KCmServerMinor, - KCmServerBuild); - - if( !User::QueryVersionSupported( version, aVersion ) ) - { - LOG(_L("[Cm Server]\t CCmServer::NewSessionL leave with \ - KErrNotSupported")); - User::Leave( KErrNotSupported ); - } - ++(*iSessionCount); - // make new session - return CCmSession::NewL( *iDbManager, *iSettings ); - } - -// --------------------------------------------------------------------------- -// CCmServer::CreateAvcAndTimerL -// --------------------------------------------------------------------------- -// -void CCmServer::CreateAvcAndTimerL() - { - LOG(_L("[Cm Server]\t CCmServer::CreateAvcAndTimerL")); - - iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL(); - iAvController->SetDeviceObserver( *this ); - - LOG( _L("[Cm Server]\t Creating CPeriodic timer..." ) ); - - iDeviceDiscoveryTimer = CPeriodic::NewL(EPriorityHigh); - TInt deviceDiscoveryDelay( 0 ); - iSettings->GetDiscoveryDelay( deviceDiscoveryDelay ); - - TRACE(Print(_L("[Cm Server]\t using device discovery delay %d\n"), - deviceDiscoveryDelay)); - - iDeviceDiscoveryTimer->Start(deviceDiscoveryDelay * KMega, - 0, - TCallBack(SearchTimerCompletedL, - this)); - - LOG( _L("[Cm Server]\t Updated!" ) ); - - iMediaServers.ResetAndDestroy(); - - LOG( _L("[Cm Server]\t Loading media servers from db..." ) ); - - iDbManager->GetMediaServersL( iMediaServers ); - } - -// --------------------------------------------------------------------------- -// CCmServer::LeaveIfNotReadyL -// --------------------------------------------------------------------------- -// -void CCmServer::LeaveIfNotReadyL() - { - LOG(_L("[Cm Server]\t CCmServer::LeaveIfNotReadyL")); - - if ( ServerState() != ECmServerStateIdle ) - { - if ( !ServerState() ) // CM disabled - { - LOG(_L("[Cm Server]\t CCmServer::LeaveIfNotReadyL \ - leave with KErrNotReady")); - User::Leave( KErrNotReady ); - } - // CM busy - LOG(_L("[Cm Server]\t CCmServer::LeaveIfNotReadyL \ - leave with KErrServerBusy")); - User::Leave( KErrServerBusy ); - } - } - -// --------------------------------------------------------------------------- -// CCmServer::DeleteUnselectedFillFilesL -// --------------------------------------------------------------------------- -// -void CCmServer::DeleteUnselectedFillFilesL() - { - LOG(_L("[Cm Server]\t CCmServer::DeleteUnselectedFillFilesL")); - - for ( ; iFillRuleIndex < iFillRuleContainer->FillRuleCount(); - iFillRuleIndex++ ) - { - CCmFillRule* rule = - iFillRuleContainer->FillRule( iFillRuleIndex ); - - TCmFillRuleStatus status = rule->Selected(); - - if ( status == ECmUnSelected || status == ECmDeleted ) - { - iDeletingDeletedItems = ETrue; - DeleteFilledFilesL(); - iFillRuleIndex = iFillRuleContainer->FillRuleCount(); - } - } - - if ( !iDeletingDeletedItems ) - { - // no unselected lists - complete delete request - iDeletingDeletedItems = EFalse; - ServiceExecuted( ECmServiceDeleteFilledFiles, KErrNone ); - } - } - -// --------------------------------------------------------------------------- -// CCmServer::DecrementSessions -// --------------------------------------------------------------------------- -// -void CCmServer::DecrementSessions() - { - LOG(_L("[Cm Server]\t CCmServer::DecrementSessions")); - - --( *iSessionCount ); - - if ( (*iSessionCount) <= 0 ) - { - TCmServiceState cmState; - iSettings->GetServiceState( ECmServiceContentManager, cmState ); - TBool mmEnabled; - iSettings->GetMemoryManagerStatus( mmEnabled ); - - if ( !cmState && !mmEnabled && - ServerState() == ECmServerStateIdle ) - // cm & mm disabled and server idle - { - // shutdown server - LOG(_L("[Cm Server]\t Server & mm disabled and \ - no sessions left, shutting down..")); - CActiveScheduler::Stop(); - } - } - } - -// --------------------------------------------------------------------------- -// CCmServer::ServerState -// --------------------------------------------------------------------------- -// -TCmServerState CCmServer::ServerState() const - { - TRACE( Print( _L("[Cm Server]\t CCmServer::ServerState \ - iServerState = %d"), iServerState )); - return iServerState; - } - -// --------------------------------------------------------------------------- -// CCmServer::PropertyContainer -// --------------------------------------------------------------------------- -// -CCmSqlPropertyContainer* CCmServer::PropertyContainer() const - { - LOG(_L("[Cm Server]\t CCmServer::PropertyContainer")); - return iPropertyContainer; - } - -// --------------------------------------------------------------------------- -// CCmServer::PropertyCollector -// --------------------------------------------------------------------------- -// -CCmSqlPropertyCollector* CCmServer::PropertyCollector() const - { - LOG(_L("[Cm Server]\t CCmServer::PropertyCollector")); - return iPropertyCollector; - } - -// --------------------------------------------------------------------------- -// CCmServer::MediaServerArray -// --------------------------------------------------------------------------- -// -RPointerArray& CCmServer::MediaServerArray() - { - LOG(_L("[Cm Server]\t CCmServer::MediaServerArray")); - - return iMediaServers; - } - -// --------------------------------------------------------------------------- -// CCmServer::UpdateFillPriorities -// --------------------------------------------------------------------------- -// -void CCmServer::UpdateFillPriorities() - { - LOG(_L("[Cm Server]\t CCmServer::UpdateFillPriorities")); - iFillManager->UpdatePriorities(); - } - -// --------------------------------------------------------------------------- -// CCmServer::DeletePropertyContainer -// --------------------------------------------------------------------------- -// -void CCmServer::DeletePropertyContainer() - { - LOG(_L("[Cm Server]\t CCmServer::DeletePropertyContainer")); - - if ( iPropertyContainer ) - { - delete iPropertyContainer; - iPropertyContainer = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmServer::DeleteItemsByFillListId -// --------------------------------------------------------------------------- -// -void CCmServer::DeleteItemsByFillListId( TInt aFillListId ) - { - LOG(_L("[Cm Server]\t CCmServer::DeleteItemsByFillListId")); - - TInt error = iDbManager->DeleteItemsByFillListId( aFillListId ); - - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::DeleteItemsByFillListId \ - error = %d\n"), error )); - } - } - -// --------------------------------------------------------------------------- -// CCmServer::FillRuleContainerL -// --------------------------------------------------------------------------- -// -CCmFillRuleContainer* CCmServer::FillRuleContainerL() const - { - LOG(_L("[Cm Server]\t CCmServer::FillRuleContainerL")); - - RPointerArray array; - CleanupClosePushL( array ); - iDbManager->PrepareQueryCmdL( EFillRuleNamesQuery ); - iDbManager->QueryFillRuleNamesL( array ); - TRACE(Print(_L("[Cm Server]\t fill rule array size is %d"), - array.Count())); - - CCmFillRuleContainer* ruleContainer = CCmFillRuleContainer::NewLC(); - for ( TInt i = 0; i < array.Count(); i++ ) - { - CCmFillRule* rule = CCmFillRule::NewLC(); - rule->SetNameL( *(array[i]) ); - iDbManager->PrepareQueryCmdL( EFillRuleQuery ); - iDbManager->QueryFillRuleL( rule ); - - ruleContainer->AddFillRuleL( rule ); - CleanupStack::Pop( rule ); - } - CleanupStack::Pop( ruleContainer ); - array.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &array ); - - return ruleContainer; - } - -// --------------------------------------------------------------------------- -// CCmServer::ExecuteStoreL -// --------------------------------------------------------------------------- -// -void CCmServer::ExecuteStoreL() - { - LOG(_L("[Cm Server]\t CCmServer::ExecuteStoreL")); - TInt err = KErrNone; - iServerState = ECmServerStateStoring; - if ( !iAvController ) // need to create avc and wait for devices - { - TRAP( err, CreateAvcAndTimerL() ); - TRACE(Print(_L("[Cm Server]\t CreateAvcAndTimerL err = %d"), err )); - } - else // avc already created, start store - { - iStoreManager->SetAvController( iAvController ); - TRAP( err, iStoreManager->StartStoreL() ); - } - if ( err ) - { - TRACE(Print(_L("[Cm Server]\t Error occurred = %d"), err )); - ServiceExecuted( ECmServiceStore, err ); - } - } - -// --------------------------------------------------------------------------- -// CCmServer::ExecuteFillL -// --------------------------------------------------------------------------- -// -void CCmServer::ExecuteFillL() - { - LOG(_L("[Cm Server]\t CCmServer::ExecuteFillL")); - if( !iDriveSelectionStatus ) - { - LOG(_L("[Cm Server]\t No drives selected. Do not start fill!!!")); - iServerState = ECmServerStateFilling; - ServiceExecuted( ECmServiceFill, KErrNone ); - } - else - { - TInt err = KErrNone; - if ( !iAvController ) // need to create avc and wait for devices - { - TRAP( err, CreateAvcAndTimerL() ); - } - else // avc already created, start fill - { - iSettings->GetMemoryManagerStatus( iMmState ); - TRACE(Print(_L("[Cm Server]\t Mm status = %d"), (TInt)iMmState )); - LOG(_L("[Cm Server]\t Disabling quota listener...")); - iMemoryManager->SetQuotaListenerStateL( EFalse ); - iAvController->RemoveDeviceObserver(); - iFillManager->SetAvController( iAvController ); - TRAP( err, iFillManager->StartFillL() ); - } - iServerState = ECmServerStateFilling; - if ( err ) - { - ServiceExecuted( ECmServiceFill, err ); - } - } - } - -// --------------------------------------------------------------------------- -// CCmServer::SetCurrentAsyncMsg -// --------------------------------------------------------------------------- -// -void CCmServer::SetCurrentAsyncMsg( const RMessage2& aMessage ) - { - LOG(_L("[Cm Server]\t CCmServer::SetCurrentAsyncMsg")); - if ( !iAsyncRequestOn ) - { - iCurrentAsyncMsg = aMessage; - iAsyncRequestOn = ETrue; - } - - } - -// --------------------------------------------------------------------------- -// CCmServer::SearchTimerCompletedL -// --------------------------------------------------------------------------- -// -TInt CCmServer::SearchTimerCompletedL(TAny* aInstance) - { - LOG(_L("[Cm Server]\t CCmServer::SearchTimerCompleted")); - return static_cast(aInstance)->DoSearchTimerCompletedL(); - } - -// --------------------------------------------------------------------------- -// CCmServer::DoSearchTimerCompletedL -// --------------------------------------------------------------------------- -// -TInt CCmServer::DoSearchTimerCompletedL() - { - LOG(_L("[Cm Server]\t CCmServer::DoSearchTimerCompleted")); - delete iDeviceDiscoveryTimer; - iDeviceDiscoveryTimer = NULL; - - switch ( ServerState() ) - { - case ECmServerStateFilling: - { - ExecuteFillL(); - break; - } - - case ECmServerStateStoring: - { - ExecuteStoreL(); - break; - } - - case ECmServerStateSearchingForServers: - { - ServiceExecuted( ECmServiceSearchForServers, KErrNone ); - break; - } - default: - { - LOG(_L("[Cm Server]\t CCmServer::DoSearchTimerCompletedL \ - leave with KErrUnknown")); - User::Leave( KErrUnknown ); - break; - } - } - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CCmServer::SetServiceStateL -// --------------------------------------------------------------------------- -// -void CCmServer::SetServiceStateL( TCmService aService, - TCmServiceState aState ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::SetServiceStateL \ - state = %d"), aState )); - - switch ( aService ) - { - case ECmServiceFill: // fall through - case ECmServiceStore: // fall through - case ECmServiceContentManager: - // sync setting - { - switch ( aState ) - { - case ECmServiceStateDisabled: - { - iSettings->SetAutoSync( EFalse ); - // disable scheduler - if ( iScheduler ) - { - LOG(_L("[Cm Server]\t CCmServer::\ - SetServiceStateL delete scheduler")); - delete iScheduler; - iScheduler = NULL; - } - break; - } - - case ECmServiceStateAutomatic: - { - // enable scheduler - if ( !iScheduler ) - { - iScheduler = CCmScheduler::NewL( *this, *iSettings ); - LOG(_L("[Cm Server]\t CCmServer::\ - SetServiceStateL create scheduler")); - - } - iScheduler->SetServiceToExecute( - ECmServicePreProcessingStore ); - iSettings->SetAutoSync( ETrue ); - break; - } - default: - { - LOG(_L("[Cm Server]\t CCmServer::SetServiceStateL \ - leave with KErrArgument")); - User::Leave( KErrArgument ); - } - } - iSettings->SetServiceState( ECmServiceContentManager, - aState ); - break; - } - case ECmServiceMemoryManager: - { - TBool enable = (TBool) aState; - iMemoryManager->SetQuotaListenerStateL( enable ); - iSettings->SetMemoryManagerStatus( enable ); - break; - } - default: - { - LOG(_L("[Cm Server]\t CCmServer::SetServiceStateL \ - leave with KErrArgument")); - User::Leave( KErrArgument ); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmServer::ExecuteServiceL -// --------------------------------------------------------------------------- -// -void CCmServer::ExecuteServiceL( TCmService aService ) - { - LOG(_L("[Cm Server]\t CCmServer::ExecuteServiceL")); - - ExecuteServiceL( aService, 0, NULL ); - } - -// --------------------------------------------------------------------------- -// CCmServer::ExecuteServiceL -// --------------------------------------------------------------------------- -// -void CCmServer::ExecuteServiceL( TCmService aService, - TInt aOptParam1, - TAny* aOptParam2 ) - { - LOG(_L("[Cm Server]\t CCmServer::ExecuteServiceL")); - LeaveIfNotReadyL(); - -#ifdef _DEBUG - - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE(Print(_L("[Cm Server]\t heap allocsize %d, size %d, cells %d"), - alloc, size, cells )); - -#endif - - - - switch ( aService ) - { - case ECmServiceHarvest: - { - LOG(_L("[Cm Server]\t ECmServiceHarvest")); - - if ( iMdhClient ) - { - iMdhClient->Close(); - iMdhClient = NULL; - } - - iMdhClient = CCmMdhClientFactory::NewCmMdhClientL( *this ); - User::LeaveIfError( iMdhClient->Harvest() ); - iServerState = ECmServerStateHarvesting; - break; - } - case ECmServiceFill: - { - LOG(_L("[Cm Server]\t ECmServiceFill")); - ExecuteFillL(); - break; - } - case ECmServiceStore: - { - LOG(_L("[Cm Server]\t ECmServiceStore")); - - // just executes deletefilledfiles and - // sets a flag to start store after that - iExecuteStoreAfterDelete = ETrue; - ExecuteServiceL( ECmServiceDeleteFilledFiles ); - break; - } - case ECmServicePreProcessingStore: - { - LOG(_L("[Cm Server]\t ECmServicePreProcessingStore")); - iStoreManager->PreProcessLists(); - iServerState = ECmServerStatePreProcessingStore; - break; - } - - case ECmServicePreProcessingFill: - { - LOG(_L("[Cm Server]\t ECmServicePreProcessingFill")); - iFillManager->PreProcessListsL(); - iServerState = ECmServerStatePreProcessingFill; - break; - } - - case ECmServiceGetStoreFields: - { - LOG(_L("[Cm Server]\t ECmServiceGetStoreFields")); - - iServerState = ECmServerStateGettingStoreFields; - - TCmMediaType mediaType = - static_cast ( aOptParam1 ); - - DeletePropertyContainer(); - iPropertyContainer = CCmSqlPropertyContainer::NewL(); - iStoreManager->GetColItemsL( mediaType, *iPropertyContainer ); - - break; - } - - case ECmServiceGetFillFields: - { - LOG(_L("[Cm Server]\t ECmServiceGetFillFields")); - - iServerState = ECmServerStateGettingFillFields; - - iPropertyCollector = - static_cast (aOptParam2); - - iFillManager->GetMetadataItemsL( *iPropertyCollector ); - - break; - } - case ECmServiceSearchForServers: - { - LOG(_L("[Cm Server]\t ECmServiceSearchForServers")); - - if ( !iAvController ) - { - CreateAvcAndTimerL(); - } - iServerState = ECmServerStateSearchingForServers; - break; - } - - case ECmServiceDeleteFilledFiles: - { - LOG(_L("[Cm Server]\t ECmServiceDeleteFilledFiles")); - - iServerState = ECmServerStateDeleting; - iFillRuleContainer = FillRuleContainerL(); - iFillRuleIndex = 0; - - DeleteUnselectedFillFilesL(); - DeleteItemsByFillListId( KDeleteDataBaseItem ); - // this request is completed in DeleteComplete or - // DeleteUnselectedFillFilesL - break; - } - - case ECmServicePreProcessingFilllist: - { - LOG(_L("[Cm Server]\t ECmServicePreProcessingFilllist")); - - HBufC8* listName = static_cast ( aOptParam2 ); - iFillManager->PreProcessListL( *listName ); - iServerState = ECmServerStatePreProcessingFilllist; - delete listName; - break; - } - case ECmServiceUpdateFillLists: - { - LOG(_L("[Cm Server]\t ECmServiceUpdateFillLists")); - UpdateFillPriorities(); - iServerState = ECmServerStateUpdatingFillLists; - break; - } - case ECmServiceDeleteMetadata: - { - LOG(_L("[Cm Server]\t ECmServiceDeleteMetadata")); - iFillManager->DeleteMetadataL(); - iServerState = ECmServerStateDeletingMetadata; - break; - } - default: - - { - LOG(_L("[Cm Server]\t CCmServer::ExecuteServiceL \ - leave with KErrArgument")); - User::Leave( KErrArgument ); - break; - } - } - - } - -// --------------------------------------------------------------------------- -// CCmServer::CancelServiceL -// --------------------------------------------------------------------------- -// -void CCmServer::CancelServiceL() - { - LOG(_L("[Cm Server]\t CCmServer::CancelServiceL")); - switch ( ServerState() ) - { - case ECmServerStateHarvesting: - { - iMdhClient->Stop(); - break; - } - - case ECmServerStateFilling: // fall through - case ECmServerStatePreProcessingFill: // fall through - case ECmServerStatePreProcessingFilllist: // fall through - case ECmServerStateGettingFillFields: // fall through - case ECmServerStateUpdatingFillLists: // fall through - case ECmServerStateDeletingMetadata: - { - if ( iDeviceDiscoveryTimer ) // only possible with fill - { - ServiceExecuted( ECmServiceFill, KErrCancel ); - } - else - { - iFillManager->CancelOperation(); - } - break; - } - - case ECmServerStateStoring: - case ECmServerStatePreProcessingStore: - case ECmServerStateGettingStoreFields: - - { - if ( iDeviceDiscoveryTimer ) // only possible with store - { - ServiceExecuted( ECmServiceStore, KErrCancel ); - } - else - { - iStoreManager->CancelOperation(); - } - break; - } - - case ECmServerStateSearchingForServers: - { - ServiceExecuted( ECmServiceSearchForServers, KErrCancel ); - break; - } - - case ECmServerStateDeleting: - { - iMemoryManager->Cancel(); - if ( iFillRuleContainer ) - { - delete iFillRuleContainer; - iFillRuleContainer = NULL; - } - ServiceExecuted( ECmServiceDeleteFilledFiles, KErrCancel ); - break; - } - - case ECmServerStateIdle: - { - break; - } - - default: - { - LOG(_L("[Cm Server]\t CCmServer::CancelServiceL \ - leave with KErrNotReady")); - User::Leave( KErrNotReady ); - break; - } - } - - LOG(_L("[Cm Server]\t CCmServer::CancelServiceL end")); - } - -// --------------------------------------------------------------------------- -// CCmServer::DeleteFilledFilesL -// --------------------------------------------------------------------------- -// -void CCmServer::DeleteFilledFilesL() - { - LOG(_L("[Cm Server]\t CCmServer::DeleteFilledFilesL")); - iDbManager->PrepareQueryCmdL(EAllFillFilesStatusQuery); - CDesCArrayFlat* filesToDelete = - new (ELeave) CDesCArrayFlat( KArrayGranularity ); - CleanupStack::PushL( filesToDelete ); - - TInt ret( KErrNone ); - TFileName file; - RPointerArray drives; - CleanupClosePushL( drives ); - iDbManager->PrepareQueryCmdL( EDrivesQuery ); - TRAP( ret, iDbManager->QueryDrivesL( drives ) ); - TRACE(Print(_L("[Cm Server]\t QueryDrivesL error = %d \n"), - ret )); - - RPointerArray items; - CleanupClosePushL( items ); - iDbManager->PrepareQueryCmdL( EAllFillFilesStatusQuery ); - iDbManager->GetAllFillFilesL( items, - ECmToBeShrinked | ECmToBeFilled | ECmFilled | ECmLocalCopy ); - - TRACE(Print(_L("[Cm Server]\t %d total count of list items \n"), - items.Count())); - - RFs fs; - ret = fs.Connect(); - TRACE(Print(_L("[Cm Server]\t File session connect error = %d \n"), - ret )); - - TLinearOrder key( CompareById ); - items.Sort( key ); - TInt itemcount = items.Count(); - CCmFillListItem* pi = NULL; - CCmFillListItem* pj = NULL; - for ( TInt i = 0; i < itemcount; i++ ) - { - CleanupStack::PushL( items[i] ); - pi = items[i]; - // if file is on some other list, do not delete - if( ECmToBeFilled == pi->Status() || - ECmToBeShrinked == pi->Status() || - ECmLocalCopy == pi->Status() ) - { - // Do not handle this. Already removed. - } - else - { - TCmListItemStatus sta( ECmToBeFilled ); - // gets list status where item belogs to - TInt err = GetStatusByGroupId( pi->ListId(), sta ); - TRACE( Print( _L("[Cm Server]\t GetStatusByGroupId ret = %d\n"), - err )); - if( pi->Selected() == ECmUnSelected || - pi->Selected() == ECmDeleted ) - { - //file of unselected, delete - if( pi->RefId() == 0 ) - { - file.Append( *ResolveAndAppendRootPathL( fs, - pi->DriveNumber() )); - file.Append( pi->Path() ); - TRAPD( error, filesToDelete->InsertIsqL( file ) ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t GetStatusByGroupId \ - error = %d\n"), error )); - } - UpdateDriveQuota( drives, *pi ); - file.Zero(); - } - //duplicated file, just set status - if( ECmUnSelected == pi->Selected() ) - { - pi->SetStatus( sta ); - } - } - else - { - //duplicated file, just set status - if( pi->RefId() != 0 ) - { - pi->SetStatus( sta ); - } - else - { - TInt j( 0 ); - for ( j = i + 1; j < itemcount; j++ ) - { - pj = items[j]; - if( items[i]->DbId() != items[j]->DbId() ) - { - break; - } - else if ( ECmSelected == pj->Selected() && - pj->Priority() < pi->Priority() ) - { - file.Append( *ResolveAndAppendRootPathL( fs, - pi->DriveNumber() ) ); - file.Append( pi->Path() ); - filesToDelete->InsertIsqL( file ); - UpdateDriveQuota( drives, *pi ); - file.Zero(); - items[i]->SetStatus( sta ); - break; - } - } - for ( j = i - 1; j >= 0; j-- ) - { - pj = items[j]; - if( items[i]->DbId() != items[j]->DbId() ) - { - break; - } - else if ( ECmSelected == pj->Selected() && - pj->Priority() < pi->Priority() ) - { - file.Append( *ResolveAndAppendRootPathL( fs, - pi->DriveNumber() ) ); - file.Append( pi->Path() ); - filesToDelete->InsertIsqL( file ); - UpdateDriveQuota( drives, *pi ); - file.Zero(); - items[i]->SetStatus( sta ); - break; - } - } - } - } - } - } - - filesToDelete->Compress(); - TRACE(Print(_L("[Cm Server]\t %d files to delete\n"), - filesToDelete->Count())); - iMemoryManager->SetObserver( *this ); - // delete files asynchronously - // DeleteCompleteL callback is called when ready - iMemoryManager->DeleteFilesL( *filesToDelete ); - - //refresh the fill items - iDbManager->DeleteFillFiles(); - iDbManager->SetFillFiles( items ); - CleanupStack::Pop( items.Count() ); - items.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &items ); - - TRAP( ret, iDbManager->SetDrivesL( drives ) ); - drives.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &drives ); - - TRACE(Print(_L("[Cm Server]\t Poping filesToDelete \n"))); - CleanupStack::PopAndDestroy( filesToDelete ); - - //updates RefIds - iFillManager->UpdateRefIds(); - iDbManager->DeleteDeletedItemsL(); - } - -// --------------------------------------------------------------------------- -// CCmServer::CreateFileDeleteSQLL -// --------------------------------------------------------------------------- -void CCmServer::CreateFileDeleteSQLL( RPointerArray& aItems, - RPointerArray& aDrives, - CDesCArrayFlat* aFilesToDelete ) - { - LOG(_L("[Cm Server]\t CCmServer::CCmServer::CreateFileDeleteSQLL")); - - TFileName file; - - TInt ret( KErrNone ); - RFs fs; - ret = fs.Connect(); - TRACE(Print(_L("[Cm Server]\t File session connect error = %d \n"), - ret )); - - if ( ret == KErrNone ) - { - for ( TInt i = 0; i < aItems.Count(); i++ ) - { - // if file is on some other list, do not delete - if( ECmToBeFilled == aItems[i]->Status() || - ECmToBeShrinked == aItems[i]->Status() || - ECmLocalCopy == aItems[i]->Status() ) - { - // Do not handle this. Already removed. - } - else - { - TCmListItemStatus sta( ECmToBeFilled ); - TInt err = GetStatusByGroupId( aItems[i]->ListId(), sta ); - TRACE( Print( _L("[Cm Server]\t GetStatusByGroupId \ - ret = %d\n"), - err )); - if( aItems[i]->Selected() == ECmUnSelected || - aItems[i]->Selected() == ECmDeleted ) - { - //file of unselected, delete - if( aItems[i]->RefId() == 0 ) - { - file.Append( *ResolveAndAppendRootPathL( fs, - aItems[i]->DriveNumber() )); - file.Append( aItems[i]->Path() ); - TRAPD( error, aFilesToDelete->InsertIsqL( file ) ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t \ - insertIsql failed with error = %d\n"), error )); - } - UpdateDriveQuota( aDrives, *aItems[i] ); - file.Zero(); - } - //duplicated file, just set status - if( ECmUnSelected == aItems[i]->Selected() ) - { - aItems[i]->SetStatus( sta ); - } - } - else - { - //duplicated file, just set status - if( aItems[i]->RefId() != 0 ) - { - aItems[i]->SetStatus( sta ); - } - else - { - for ( TInt j = 0; j < aItems.Count(); j++ ) - { - //If the prioritys of items with the same Dbid - //have changed, should delete files - if( aItems[i]->DbId() == aItems[j]->DbId() && - i != j && - ECmSelected == aItems[j]->Selected() && - aItems[j]->Priority() < - aItems[i]->Priority() ) - { - file.Append( *ResolveAndAppendRootPathL( fs, - aItems[i]->DriveNumber() )); - file.Append( aItems[i]->Path() ); - TRAPD( error, aFilesToDelete->InsertIsqL( - file ) ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t \ - CCmServer::DeleteFilledFilesL \ - error = %d\n"), error )); - } - UpdateDriveQuota( aDrives, *aItems[i] ); - file.Zero(); - - //set status and break - aItems[i]->SetStatus( sta ); - j = aItems.Count(); - } - } - } - } - } - } - } - fs.Close(); - } - -// --------------------------------------------------------------------------- -// CCmServer::ServiceExecuted -// --------------------------------------------------------------------------- -// -void CCmServer::ServiceExecuted( TCmService aService, TInt aErrCode ) - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted")); - TRACE(Print(_L("[Cm Server]\t service %d state %d err %d\n"), - aService, iServerState, aErrCode )); - -#ifdef _DEBUG - - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE(Print(_L("[Cm Server]\t heap allocsize %d, size %d, cells %d"), - alloc, size, cells )); - -#endif - - if ( iDeviceDiscoveryTimer ) - { - delete iDeviceDiscoveryTimer; - iDeviceDiscoveryTimer = NULL; - } - - if ( aService != ServerState() ) - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted INTERNAL ERROR")); - return; - } - - TBool returnToIdle = ETrue; - switch ( aService ) - { - case ECmServiceHarvest: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServiceHarvest")); - - // Harvest includes fill preprocessing - iServerState = ECmServerStateIdle; - TRAPD( error, ExecuteServiceL( ECmServicePreProcessingFill ) ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::\ - ServiceExecuted fill preprocessing error = %d"), error)); - } - // return from here because processing continues, - // so we do not complete msg - return; - } - case ECmServiceFill: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServiceFill")); - TRACE(Print(_L("[Cm Server]\t Setting mm to state = %d"), - (TInt)iMmState )); - TRAPD( error, iMemoryManager->SetQuotaListenerStateL( - iMmState ) ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::\ - ServiceExecuted ECmServiceFill \ - error = %d"), error)); - } - - if ( aErrCode == KErrNone ) - { - iDbManager->SetSyncTime(); - } - // Creation of av controller failed - if( KErrServerTerminated == aErrCode ) - { - aErrCode = KErrNone; - } - iFillManager->SetAvController( NULL ); - if ( iAvController ) - { - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - LOG(_L("[Cm Server]\t avc deleted")); - } - break; - } - case ECmServiceStore: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServiceStore")); - - iStoreManager->SetAvController( NULL ); - if ( aErrCode != KErrNone ) - { - if ( iAvController ) - { - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - LOG(_L("[Cm Server]\t avc deleted")); - } - } - break; - } - case ECmServicePreProcessingStore: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServicePreProcessingStore")); - break; - } - - case ECmServicePreProcessingFill: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServicePreProcessingFill")); - iServerState = ECmServerStateIdle; - TRAPD( error, ExecuteServiceL( ECmServicePreProcessingStore ) ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::\ - ServiceExecuted ECmServicePreProcessingFill \ - error = %d"), error)); - } - break; - } - - case ECmServiceGetStoreFields: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServiceGetStoreFields")); - break; - } - - case ECmServiceGetFillFields: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServiceGetFillFields")); - break; - } - - case ECmServiceSearchForServers: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServiceSearchForServers")); - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - iServerState = ECmServerStateIdle; - break; - } - - case ECmServiceDeleteFilledFiles: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServiceDeleteFilledFiles")); - - // check if store is flagged to be run after delete - if ( aErrCode == KErrNone && iExecuteStoreAfterDelete ) - { - iExecuteStoreAfterDelete = EFalse; - TRAPD( error, ExecuteStoreL() ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::\ - ServiceExecuted ECmServiceDeleteFilledFiles \ - error = %d"), error)); - } - return; - } - iExecuteStoreAfterDelete = EFalse; - break; - } - - case ECmServicePreProcessingFilllist: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServicePreProcessingFilllist")); - break; - } - case ECmServerStateUpdatingFillLists: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServerStateUpdatingFillLists")); - break; - } - case ECmServerStateDeletingMetadata: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - ECmServerStateDeletingMetadata")); - break; - } - default: - { - LOG(_L("[Cm Server]\t CCmServer::ServiceExecuted \ - default")); - } - } - - if ( aService == ECmServicePreProcessingFill ) - { - return; - } - - if ( !iCurrentAsyncMsg.IsNull() ) - // client-initiated case - { - LOG(_L("[Cm Server]\t CCmServer::completing message..")); - - iCurrentAsyncMsg.Complete( aErrCode ); - - iAsyncRequestOn = EFalse; - - if ( returnToIdle ) - { - iServerState = ECmServerStateIdle; - } - } - - else // scheduler-initiated case - { - if ( returnToIdle ) - { - iServerState = ECmServerStateIdle; - } - - iScheduler->ServiceExecuted( aService, aErrCode ); - } - - - if ( aService == ECmServiceFill || - aService == ECmServicePreProcessingStore ) - { - TCmProgressInfo progressInfo; - progressInfo.iService = ECmServiceNone; - progressInfo.iProcessedItems = 0; - progressInfo.iItemsToTransferPerService = 0; - TCmProgressInfoPckg progressPckg( progressInfo ); - - TInt err = - RProperty::Set( KCmPropertyCat, KCmProperty, progressPckg ); - - TRACE( Print( _L( - "[CMSERVER]\t CmServer::ServiceExecuted progresInfo sent"), - progressInfo.iProcessedItems, progressInfo.iTotalItems)); - } - - TCmServiceState cmState; - iSettings->GetServiceState( ECmServiceContentManager, cmState ); - TBool mmEnabled; - iSettings->GetMemoryManagerStatus( mmEnabled ); - - if ( !cmState && !mmEnabled && !(*iSessionCount) && - !ServerState() == ECmServerStateIdle - ) - // server & mm disabled and idle, no sessions - { - // shutdown server - LOG(_L("[Cm Server]\t Server & mm disabled and \ - no sessions left, shutting down..")); - CActiveScheduler::Stop(); - } - - } - -// --------------------------------------------------------------------------- -// CCmServer::UPnPDeviceDiscovered -// --------------------------------------------------------------------------- -// -void CCmServer::UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[Cm Server]\t CCmServer::UPnPDeviceDiscovered")); - CUpnpAVDevice* device = const_cast ( &aDevice ); - - TRACE(Print(_L("[Cm Server]\t serverstate %d devicetype %d\n"), - iServerState, device->DeviceType() )); - TBool allFound( EFalse ); - if( device->DeviceType() == CUpnpAVDevice::EMediaServer ) - { - for( TInt i = 0 ; i < iMediaServers.Count(); i++ ) - { - if( KErrNotFound != - device->Uuid().Match( iMediaServers[i]->MediaServer() ) ) - { - iMediaServers[i]->SetIsActive( EFalse ); - } - if( iMediaServers[i]->IsActive() ) - { - allFound = ETrue; - } - } - } - - if ( ServerState() == ECmServerStateSearchingForServers && - device->DeviceType() == CUpnpAVDevice::EMediaServer ) - { - TRAPD( error, CheckServerL( *device ) ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::\ - UPnPDeviceDiscovered error = %d"), error)); - } - } - - if( !allFound && iMediaServers.Count() && - device->DeviceType() == CUpnpAVDevice::EMediaServer && - iDeviceDiscoveryTimer ) - { - delete iDeviceDiscoveryTimer; - iDeviceDiscoveryTimer = NULL; - - TRACE( Print( - _L("[Cm Server]\t All Servers found => Start Syncing\n") ) ); - TRAPD( error, DoSearchTimerCompletedL() ); - if ( error ) - { - TRACE( Print( _L("[Cm Server]\t CCmServer::\ - UPnPDeviceDiscovered searchtimer error = %d"), error)); - } - iMediaServers.ResetAndDestroy(); - } - } - -// --------------------------------------------------------------------------- -// CCmServer::UPnPDeviceDisappeared -// --------------------------------------------------------------------------- -// -void CCmServer::UPnPDeviceDisappeared( const CUpnpAVDevice& /* aDevice */) - { - LOG(_L("[Cm Server]\t CCmServer::UPnPDeviceDisappeared")); - } - -// --------------------------------------------------------------------------- -// CCmServer::DeleteCompleteL -// --------------------------------------------------------------------------- -// -void CCmServer::DeleteCompleteL( TInt aErr ) - { - LOG(_L("[Cm Server]\t CCmServer::DeleteCompleteL")); - - iDeletingDeletedItems = EFalse; - // just complete delete process - ServiceExecuted( ECmServiceDeleteFilledFiles, aErr ); - } - -// --------------------------------------------------------------------------- -// See mdesession.h -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -void CCmServer::HandleSessionOpened( CMdESession& /*aSession*/, - TInt aError ) - { -#else -void CCmServer::HandleSessionOpened( CMdESession& /*aSession*/, - TInt /*aError*/ ) - { -#endif - TRACE(Print(_L("[Cm Server]\t CCmServer::HandleSessionOpened\ - aError = %d"), aError )); - } - -// --------------------------------------------------------------------------- -// See mdesession.h -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -void CCmServer::HandleSessionError( CMdESession& /*aSession*/, - TInt aError ) - { -#else -void CCmServer::HandleSessionError( CMdESession& /*aSession*/, - TInt /*aError*/ ) - { -#endif - TRACE(Print(_L("[Cm Server]\t CCmServer::HandleSessionError\ - aError = %d"), aError )); - } - -// --------------------------------------------------------------------------- -// CCmServer::WLANConnectionLost -// --------------------------------------------------------------------------- -// -void CCmServer::WLANConnectionLost() - { - LOG(_L("[Cm Server]\t CCmServer::WLANConnectionLost")); - LOG(_L("[Cm Server]\t Finishing operation...")); - - TInt err( KErrNone ); - - TRAP( err,CancelServiceL() ); - - if ( err ) - { - TRACE( Print( _L( "[Cm Server]\t Wlan lost error = %d" ), err ) ); - } - } - -// -------------------------------------------------------------------------- -// CCmServer::DriveSelectionStatus -// -------------------------------------------------------------------------- -TBool CCmServer::DriveSelectionStatus() - { - LOG(_L("[Cm Server]\t CCmServer::DriveSelectionStatus")); - - return iDriveSelectionStatus; - } - -// -------------------------------------------------------------------------- -// CCmServer::SetDriveSelectionStatus -// -------------------------------------------------------------------------- -void CCmServer::SetDriveSelectionStatus( const TBool aDriveSelectionStatus ) - { - LOG(_L("[Cm Server]\t CCmServer::SetDriveSelectionStatus")); - - iDriveSelectionStatus = aDriveSelectionStatus; - } - -// --------------------------------------------------------------------------- -// CCmServer::ResolveAndAppendRootPathL -// --------------------------------------------------------------------------- -// -HBufC* CCmServer::ResolveAndAppendRootPathL( RFs& aFs, - const TInt aDriveNumber ) - { - LOG(_L("[Cm Server]\t CCmServer::ResolveAndAppendRootPathL")); - - HBufC* buf = HBufC::NewLC( KDriveBufferSize ); - TChar driveChar; - TInt error = aFs.DriveToChar( aDriveNumber, driveChar ); - if ( !error ) - { - buf->Des().Append( driveChar ); - buf->Des().Append( KColon ); - } - buf->Des().Append( KDoubleBackSlash ); - CleanupStack::Pop(); - return buf; - } - -// --------------------------------------------------------------------------- -// CCmServer::UpdateDriveQuota -// --------------------------------------------------------------------------- -// -void CCmServer::UpdateDriveQuota( RPointerArray& aDrives, - CCmFillListItem& aItem ) - { - LOG(_L("[Cm Server]\t CCmServer::UpdateDriveQuota")); - - for( TInt i = 0; i < aDrives.Count(); i++ ) - { - if( aDrives[i]->DriveNumber() == aItem.DriveNumber() ) - { - TInt64 usedQuota( aDrives[i]->UsedDriveQuota() ); - usedQuota -= aItem.Size(); - aDrives[i]->SetUsedDriveQuota( usedQuota ); - i = aDrives.Count(); - } - } - } - -// --------------------------------------------------------------------------- -// CCmServer::ShrinkCompleteL -// --------------------------------------------------------------------------- -// -void CCmServer::ShrinkCompleteL( TInt /* aErr */) - { - LOG(_L("[Cm Server]\t CCmServer::ShrinkCompleteL")); - } - -// --------------------------------------------------------------------------- -// CCmServer::GetStatusByGroupId -// --------------------------------------------------------------------------- -// -TInt CCmServer::GetStatusByGroupId( TUint aListId, - TCmListItemStatus& aStatus ) - { - LOG(_L("[Cm Server]\t CCmServer::GetStatusByGroupId")); - - TInt result( KErrNotFound ); - TInt count = iFillRuleContainer->FillRuleCount(); - for ( TInt i( 0 ); i < count; i++ ) - { - CCmFillRule* rule = - iFillRuleContainer->FillRule( i ); - if ( rule->ListId() == aListId ) - { - aStatus = rule->Status(); - result = KErrNone; - i = count; - } - } - return result; - } - -// --------------------------------------------------------------------------- -// CCmServer::CheckServerL -// --------------------------------------------------------------------------- -// -void CCmServer::CheckServerL( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[Cm Server]\t CCmServer::CheckServerL")); - - CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC(); - tempServer->SetUDNL( aDevice.Uuid() ); - iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery ); - TInt errCode = iDbManager->QueryMediaServerL( tempServer ); - if ( errCode == KErrNotFound ) - { - LOG(_L("[CmMdh Server]\t not found in DB, adding new..")); - tempServer->SetMediaServerNameL( aDevice.FriendlyName() ); - tempServer->SetSystemUpdateID( KDefaultSystemUpdateId ); - TTime timeStamp; - timeStamp.HomeTime(); - tempServer->SetVisibleDate( timeStamp ); - iDbManager->AddMediaServerL( tempServer ); - - } - else - { - TRACE(Print(_L("[CmMdh Server]\t CCmServer::CheckServerL \ - error = %d"), errCode )); - } - CleanupStack::PopAndDestroy( tempServer ); - } - -// --------------------------------------------------------------------------- -// CCmServer::SetAsyncRequestStateL -// --------------------------------------------------------------------------- -// -void CCmServer::SetAsyncRequestStateL( TBool aState ) - { - LOG(_L("[Cm Server]\t CCmServer::SetAsyncRequestStateL")); - - iAsyncRequestOn = aState; - - if ( !iCurrentAsyncMsg.IsNull() ) - { - iCurrentAsyncMsg.Complete( KErrNone ); - } - - if ( !iScheduler ) - { - iScheduler = CCmScheduler::NewL( *this, *iSettings ); - LOG(_L("[Cm Server]\t CCmServer::SetAsyncRequestState\ - scheduler created")); - } - - // responsibility of starting services transferred to scheduler - iScheduler->SetScheduledServiceState( ETrue ); - } - -// --------------------------------------------------------------------------- -// CompareById -// For sort. Sort is based on db id -// --------------------------------------------------------------------------- -// -TInt CCmServer::CompareById( const CCmFillListItem& aItem1, - const CCmFillListItem& aItem2 ) - { - TInt result = 0; - - if ( aItem1.DbId() < aItem2.DbId() ) - { - result = -1; - } - else if ( aItem1.DbId() > aItem2.DbId() ) - { - result = 1; - } - - return result; - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/src/server/cmservermain.cpp --- a/homesync/contentmanager/cmserver/cmserver/src/server/cmservermain.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +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: Main functions to start the Content Manager server -* -*/ - - -// INCLUDE FILES -#include "cmserver.h" -#include "msdebug.h" - - -// LOCAL FUNCTION PROTOTYPES -void RunServerL(); - -// --------------------------------------------------------------------------- -// E32Main -// -// Module entry point -// --------------------------------------------------------------------------- -// -TInt E32Main() - { - LOG(_L("[Cm Server]\t E32Main")); - - __UHEAP_MARK; - CTrapCleanup* cleanup = CTrapCleanup::New(); - TInt error = KErrNoMemory; - if ( cleanup ) - { - TRAP( error, RunServerL() ); - delete cleanup; - } - __UHEAP_MARKEND; - - return error; - } - -// --------------------------------------------------------------------------- -// RunServerL -// -// Constructs Active Scheduler and starts the server up & running -// --------------------------------------------------------------------------- -// -void RunServerL() - { - LOG(_L("[Cm Server]\t RunServerL")); - // Create and install the active scheduler we need - CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler; - CleanupStack::PushL( scheduler ); - CActiveScheduler::Install( scheduler ); - - // Create server - CCmServer* server = CCmServer::NewLC(); - - // Initialisation complete, now signal the client - User::LeaveIfError( RThread().RenameMe( KCmServerName ) ); - RProcess::Rendezvous( KErrNone ); - - // Ready to run - CActiveScheduler::Start(); - - // Cleanup the server and scheduler - CleanupStack::PopAndDestroy( server ); - CleanupStack::PopAndDestroy( scheduler ); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmserver/src/server/cmserversession.cpp --- a/homesync/contentmanager/cmserver/cmserver/src/server/cmserversession.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1138 +0,0 @@ -/* -* Copyright (c) 2007 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: Session implementation class for Content Manager -* -*/ - - -// INCLUDE FILES -#include -#include - -#include "cmcommon.h" -#include "cmfillrulecontainer.h" -#include "cmfillrule.h" -#include "cmstorerulecontainer.h" -#include "cmstorerule.h" -#include "cmbaselistitem.h" -#include "cmdmmain.h" -#include "cmsettingsfactory.h" -#include "cmsettings.h" -#include "cmmediaserverfull.h" -#include "cmsqlpropertycontainer.h" -#include "cmsqlpropertycollector.h" -#include "cmdriveinfo.h" -#include "cmserversession.h" -#include "cmserver.h" -#include "msdebug.h" - -// data buffer size -const TInt KBufferExpandSize = KKilo; - - -// ============================ MEMBER FUNCTIONS ============================= - -// --------------------------------------------------------------------------- -// CCmSession::CCmSession -// --------------------------------------------------------------------------- -// -CCmSession::CCmSession( CCmDmMain& aDbManager, MCmSettings& aSettings ) - : iDbManager( aDbManager ), iSettings( aSettings ) - { - } - -// --------------------------------------------------------------------------- -// CCmSession::NewL -// --------------------------------------------------------------------------- -// -CCmSession* CCmSession::NewL( CCmDmMain& aDbManager, - MCmSettings& aSettings ) - { - LOG(_L("[Cm Server]\t CCmSession::NewL")); - CCmSession* self = - new (ELeave) CCmSession( aDbManager, aSettings ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSession::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSession::ConstructL() - { - LOG(_L("[Cm Server]\t CCmSession::ConstructL")) - iCollector = CCmSqlPropertyCollector::NewL(); - } - - -// --------------------------------------------------------------------------- -// CCmSession::~CCmSession -// --------------------------------------------------------------------------- -// -CCmSession::~CCmSession() - { - LOG(_L("[Cm Server]\t CCmSession::~CCmSession")); - - delete iDataBuffer; - - Server().DecrementSessions(); - - delete iCollector; - } - - - -// --------------------------------------------------------------------------- -// CCmSession::Server -// Returns a reference to server -// --------------------------------------------------------------------------- -// -CCmServer& CCmSession::Server() - { - LOG(_L("[Cm Server]\t CCmSession::Server")); - - return *static_cast(const_cast - (CSession2::Server())); - } - - - -// --------------------------------------------------------------------------- -// CCmSession::ServiceL -// Implements CSession2 -derived ServiceL -method. -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmSession::ServiceL(const RMessage2& aMessage) - { - LOG(_L("[Cm Server]\t CCmSession::ServiceL")); - - switch ( aMessage.Function() ) - { - case ECmExecuteService: - { - LOG(_L("[Cm Server]\t ECmExecuteService request")); - TCmService service = (TCmService)aMessage.Int0(); - - TRACE( Print (_L("[Cm Server]\t CCmSession::\ - ServiceL ECmExecuteService service = %d\n"), service )); - - Server().SetCurrentAsyncMsg( aMessage ); - Server().ExecuteServiceL( service ); - break; - } - - case ECmCancel: - { - LOG(_L("[Cm Server]\t ECmCancel request")); - Server().CancelServiceL(); - - aMessage.Complete( KErrNone ); - break; - } - - case ECmGetServerState: - { - LOG(_L("[Cm Server]\t ECmGetServerState request")); - TPckg pckg( Server().ServerState() ); - aMessage.WriteL(0, pckg ); - aMessage.Complete( KErrNone ); - break; - } - - case ECmGetServiceState: - { - LOG(_L("[Cm Server]\t ECmGetServiceState request")); - TCmService service = static_cast(aMessage.Int0()); - - TRACE( Print (_L("[Cm Server]\t CCmSession::\ - ServiceL ECmGetServiceState service = %d\n"), service )); - - TCmServiceState state = ECmServiceStateDisabled; - TInt err( KErrNone ); - switch ( service ) - { - case ECmServiceFill: // fall through - case ECmServiceStore: // fall through - case ECmServiceContentManager: - { - iSettings.GetServiceState( ECmServiceContentManager, - state ); - if ( state ) - { - TBool autoSync = EFalse; - iSettings.GetAutoSync( autoSync ); - if ( autoSync ) - { - state = ECmServiceStateAutomatic; - } - else - { - LOG(_L("[Cm Server]\t ECmGetServiceState \ - request autosync = disabled")); - } - } - else - { - LOG(_L("[Cm Server]\t ECmGetServiceState request \ - state = ECmServiceStateDisabled")); - } - break; - } - case ECmServiceMemoryManager: - { - TBool mm = EFalse; - iSettings.GetMemoryManagerStatus( mm ); - state = ECmServiceStateAutomatic; - if ( !mm ) - { - state = ECmServiceStateDisabled; - } - - break; - } - default: - { - err = KErrArgument; - break; - } - } - TPckg pckg( state ); - aMessage.WriteL(1, pckg ); - aMessage.Complete( err ); - break; - } - - case ECmSetServiceState: - { - LOG(_L("[Cm Server]\t ECmSetServiceState request")); - - TCmService service = static_cast(aMessage.Int0()); - TCmServiceState state = - static_cast(aMessage.Int1()); - - TRACE(Print(_L("[Cm Server]\t service %d state %d \n"), - service, state )); - - Server().SetServiceStateL( service, state ); - - aMessage.Complete( KErrNone ); - break; - } - - case ECmGetItemCount: - { - LOG(_L("[Cm Server]\t ECmGetItemCount request")); - TCmService service = static_cast(aMessage.Int2()); - - TRACE( Print (_L("[Cm Server]\t CCmSession::\ - ServiceL ECmGetItemCount service = %d\n"), service )); - - TInt len = aMessage.GetDesLength( 3 ); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmGetItemCount request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - HBufC8* name = HBufC8::NewLC( len ); - TPtr8 ptr( name->Des() ); - aMessage.ReadL( 3, ptr ); - TInt64 size = 0; - TInt count = 0; - - if ( service == ECmServiceFill ) - { - size = iDbManager.ListSize( - ECmFmFillRule, - *name, - ECmFilled | ECmToBeFilled | ECmToBeShrinked - ); - iDbManager.GetFillFileCount( - *name, - ECmFilled | ECmToBeFilled | ECmToBeShrinked, - count - ); - TRACE(Print(_L("[Cm Server]\t got fill size %ld count %d"), - size, count)); - } - else // ECmServiceStore - { - size = iDbManager.ListSize( - ECmFmStoreRule, - *name, - ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice - ); - iDbManager.GetStoreFileCount( - *name, - ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice, - count - ); - TRACE(Print(_L("[Cm Server]\t got store size %ld count %d"), - size, count)); - } - CleanupStack::PopAndDestroy( name ); - TPckg countPckg( count ); - TPckg sizePckg( size ); - aMessage.WriteL( 0, countPckg ); - aMessage.WriteL( 1, sizePckg ); - - aMessage.Complete( KErrNone ); - break; - } - - case ECmGetTransferInfo: - { - LOG(_L("[Cm Server]\t ECmGetTransferInfo request")); - TCmService service = static_cast(aMessage.Int0()); - TInt count( 0 ); - TInt time( 0 ); - TPckg countPckg( count ); - TPckg timePckg( time ); - - iDbManager.GetTransferInfo( - service, count, time ); - - TRACE(Print(_L("[Cm Server]\t ECmGetTransferInfo \ - count = %d, time = %d"), count, time)); - - aMessage.WriteL( 1, countPckg ); - aMessage.WriteL( 2, timePckg ); - aMessage.Complete( KErrNone ); - break; - } - - - case ECmGetDataFields: - { - LOG(_L("[Cm Server]\t ECmGetDataFields request")); - - TInt len = aMessage.GetDesLength(0); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmGetDataFields request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len)); - - HBufC8* buffer = HBufC8::NewLC(len); - - TPtr8 ptr(buffer->Des()); - aMessage.ReadL(0, ptr); - RDesReadStream stream; - stream.Open(ptr); - CleanupClosePushL(stream); - - iCollector->InternalizeL( stream ); - - Server().SetCurrentAsyncMsg( aMessage ); - Server().ExecuteServiceL( ECmServiceGetFillFields, - 0, - iCollector ); - CleanupStack::PopAndDestroy( 2 ); - break; - } - - case ECmGetDataFieldSize: - { - LOG(_L("[Cm Server]\t ECmGetDataFieldSize request")); - - delete iDataBuffer; - iDataBuffer = NULL; - - iDataBuffer = CBufFlat::NewL( KBufferExpandSize ); - RBufWriteStream propertyStream; - propertyStream.Open( *iDataBuffer ); - CleanupClosePushL( propertyStream ); - - CCmSqlPropertyCollector* propertyCollector = - Server().PropertyCollector(); - - if( !propertyCollector ) - { - LOG(_L("[Cm Server]\t ECmGetDataFieldSize request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - propertyCollector->ExternalizeL( propertyStream ); - - TInt size = iDataBuffer->Size(); - TPckg pckg( size ); - aMessage.WriteL(0, pckg ); - CleanupStack::PopAndDestroy( &propertyStream ); - - TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size)); - - aMessage.Complete( KErrNone ); - break; - } - - case ECmGetDataBuffer: - { - TInt errCode = KErrNone; - if ( !iDataBuffer ) - { - LOG(_L("[Cm Server]\t ECmGetDataBuffer \ - databuffer doesn't exist")); - errCode = KErrNotReady; - } - - if (errCode == KErrNone ) - { - aMessage.WriteL(0, iDataBuffer->Ptr(0)); - } - aMessage.Complete( errCode ); - break; - } - - case ECmGetFillRulesSize: - { - LOG(_L("[Cm Server]\t ECmGetFillRulesSize request")); - - delete iDataBuffer; - iDataBuffer = NULL; - - iDataBuffer = CBufFlat::NewL( KBufferExpandSize ); - RBufWriteStream ruleStream; - ruleStream.Open( *iDataBuffer ); - CleanupClosePushL( ruleStream ); - - CCmFillRuleContainer* ruleContainer = - Server().FillRuleContainerL(); - CleanupStack::PushL( ruleContainer ); - ruleContainer->ExternalizeL( ruleStream ); - CleanupStack::PopAndDestroy( ruleContainer ); - - TInt size = iDataBuffer->Size(); - TPckg pckg( size ); - aMessage.WriteL(0, pckg ); - CleanupStack::PopAndDestroy( &ruleStream ); - - TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size)); - - aMessage.Complete( KErrNone ); - LOG(_L("[Cm Server]\t ECmGetFillRulesSize request end")); - - break; - } - - case ECmGetStoreItemsSize: - { - LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request")); - - TInt len = aMessage.GetDesLength( 0 ); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - HBufC8* name = HBufC8::NewLC( len ); - TPtr8 ptr( name->Des() ); - aMessage.ReadL(0, ptr); - - iDbManager.PrepareQueryCmdL( EStoreFilesQuery ); - RPointerArray items; - CleanupClosePushL( items ); - - iDbManager.QueryStoreFileListL( - items, - *name, - ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice - ); - - TInt count = items.Count(); - - TRACE(Print(_L("[Cm Server]\t store item array size is %d"), - count)); - - delete iDataBuffer; - iDataBuffer = NULL; - - iDataBuffer = CBufFlat::NewL( KBufferExpandSize ); - RBufWriteStream ruleStream; - ruleStream.Open( *iDataBuffer ); - CleanupClosePushL( ruleStream ); - - for ( TInt i = 0; i < count; i++ ) - { - items[i]->ExternalizeL( ruleStream ); - } - - CleanupStack::PopAndDestroy( &ruleStream ); - items.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &items ); - CleanupStack::PopAndDestroy( name ); - - TInt size = iDataBuffer->Size(); - - TPckg sizePckg( size ); - aMessage.WriteL( 1, sizePckg ); - TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size)); - - TPckg countPckg( count ); - aMessage.WriteL( 2, countPckg ); - TRACE(Print(_L("[Cm Server]\t item count is %d"), count)); - - aMessage.Complete( KErrNone ); - - LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request end")); - - break; - } - - case ECmGetFillItemsSize: - { - LOG(_L("[Cm Server]\t ECmGetFillItemsSize request")); - - TInt len = aMessage.GetDesLength( 0 ); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmGetFillItemsSize request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - HBufC8* name = HBufC8::NewLC( len ); - TPtr8 ptr( name->Des() ); - aMessage.ReadL(0, ptr); - - iDbManager.PrepareQueryCmdL( EFillFilesQuery ); - RPointerArray items; - CleanupClosePushL( items ); - - iDbManager.QueryFillFileListL( - items, - *name, - ECmFilled | ECmToBeFilled | ECmToBeShrinked | ECmLocalCopy - ); - - TInt count = items.Count(); - - TRACE(Print(_L("[Cm Server]\t list item array size is %d"), - count)); - - delete iDataBuffer; - iDataBuffer = NULL; - - iDataBuffer = CBufFlat::NewL( KBufferExpandSize ); - RBufWriteStream ruleStream; - ruleStream.Open( *iDataBuffer ); - CleanupClosePushL( ruleStream ); - - for ( TInt i = 0; i < count; i++ ) - { - items[i]->ExternalizeL( ruleStream ); - } - - CleanupStack::PopAndDestroy( &ruleStream ); - items.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &items ); - CleanupStack::PopAndDestroy( name ); - TInt size = iDataBuffer->Size(); - - TPckg sizePckg( size ); - aMessage.WriteL( 1, sizePckg ); - TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size)); - - TPckg countPckg( count ); - aMessage.WriteL( 2, countPckg ); - TRACE(Print(_L("[Cm Server]\t item count is %d"), count)); - - aMessage.Complete( KErrNone ); - - LOG(_L("[Cm Server]\t ECmGetStoreItemsSize request end")); - - break; - } - - case ECmSetFillRules: - { - LOG(_L("[Cm Server]\t ECmSetFillRules request")); - - TInt len = aMessage.GetDesLength(0); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmSetFillRules request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len)); - - HBufC8* buffer = HBufC8::NewLC(len); - - TPtr8 ptr(buffer->Des()); - aMessage.ReadL(0, ptr); - RDesReadStream stream; - stream.Open(ptr); - CleanupClosePushL(stream); - - CCmFillRuleContainer* tempContainer = - CCmFillRuleContainer::NewLC(); - tempContainer->InternalizeL( stream ); - iDbManager.DeleteAllFillRules(); - for ( TInt i = 0; i < tempContainer->FillRuleCount(); i++ ) - { -#ifdef _DEBUG - TDesC8& name = tempContainer->FillRule( i )->Name(); - TBuf buf; - buf.Copy(name); - TRACE(Print(_L("[Cm Server]\t updating fill rule %S"), &buf)); -#endif - - if ( tempContainer->FillRule( i )->Selected() == ECmDeleted ) - { - TRACE(Print(_L("[Cm Server]\t skipping deleted rule %S"), - &buf)); - iDbManager.SetFillListStateL( - tempContainer->FillRule( i )->ListId(), ECmDeleted ); - } - else - { - TRACE(Print(_L("[Cm Server]\t storing rule %S to db"), - &buf)); - TInt ret = iDbManager.AddFillRuleL( - tempContainer->FillRule( i )); - TRACE(Print(_L("[Cm Server]\t ret = %d"), ret)); - } - } - aMessage.Complete( KErrNone ); - CleanupStack::PopAndDestroy( 3, buffer ); - break; - } - - case ECmPreProcessFillList: - { - LOG(_L("[Cm Server]\t ECmPreProcessFillList request")); - - TInt len = aMessage.GetDesLength( 0 ); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmPreProcessFillList request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - HBufC8* name = HBufC8::NewLC( len ); - TPtr8 ptr( name->Des() ); - aMessage.ReadL(0, ptr); - - TRACE(Print(_L("[Cm Server]\t list name %S"), name )); - - Server().ExecuteServiceL( - ECmServicePreProcessingFilllist, 0, name ); - Server().SetCurrentAsyncMsg( aMessage ); - - CleanupStack::Pop( name ); - break; - } - - case ECmGetSyncTime: - { - LOG(_L("[Cm Server]\t ECmGetSyncTime request")); - TTime syncTime; - TInt err = iDbManager.GetSyncTime( syncTime ); - TRACE( Print(_L("[Cm Server]\t returning time %ld"), - syncTime.Int64() ) ); - - TPckg pckg( syncTime ); - aMessage.WriteL( 0, pckg ); - aMessage.Complete( err ); - break; - } - - case ECmGetMediaserversSize: - { - LOG(_L("[Cm Server]\t ECmGetMediaserversSize request")); - - iDbManager.PrepareQueryCmdL( EMediaServersAllQuery ); - - delete iDataBuffer; - iDataBuffer = NULL; - - iDataBuffer = CBufFlat::NewL( KBufferExpandSize ); - RBufWriteStream serverStream; - serverStream.Open( *iDataBuffer ); - CleanupClosePushL( serverStream ); - - TInt ret( KErrNone ); - TInt amount = 0; - while( KErrNotFound != ret ) - { - CCmMediaServerFull* server = CCmMediaServerFull::NewLC(); - ret = iDbManager.QueryAllMediaServersL( server ); - if( KErrNotFound != ret ) - { - ++amount; - server->ExternalizeL( serverStream ); - } - CleanupStack::PopAndDestroy( server ); - } - - TInt size = iDataBuffer->Size(); - TPckg pckg( size ); - aMessage.WriteL(0, pckg ); - - TPckg pckg2( amount ); - aMessage.WriteL(1, pckg2 ); - - TRACE(Print(_L("[Cm Server]\t buffer size is %d, amount %d"), - size, amount)); - - aMessage.Complete( KErrNone ); - CleanupStack::PopAndDestroy( &serverStream ); - break; - } - - case ECmGetStoreRulesSize: - { - LOG(_L("[Cm Server]\t ECmGetStoreRulesSize request")); - RPointerArray array; - CleanupClosePushL( array ); - iDbManager.PrepareQueryCmdL( EStoreRuleNamesQuery ); - iDbManager.QueryStoreRuleNamesL( array ); - TRACE(Print(_L("[Cm Server]\t store rule array size is %d"), - array.Count())); - - CCmStoreRuleContainer* ruleContainer = - CCmStoreRuleContainer::NewLC(); - for ( TInt i = 0; i < array.Count(); i++ ) - { - CCmStoreRule* rule = CCmStoreRule::NewLC(); - rule->SetNameL( *(array[i]) ); - iDbManager.PrepareQueryCmdL( EStoreRuleQuery ); - iDbManager.QueryStoreRuleL( rule ); - ruleContainer->AddStoreRuleL( rule ); - CleanupStack::Pop( rule ); - } - - delete iDataBuffer; - iDataBuffer = NULL; - - iDataBuffer = CBufFlat::NewL( KBufferExpandSize ); - RBufWriteStream ruleStream; - ruleStream.Open( *iDataBuffer ); - CleanupClosePushL( ruleStream ); - - ruleContainer->ExternalizeL( ruleStream ); - TInt size = iDataBuffer->Size(); - TPckg pckg( size ); - aMessage.WriteL(0, pckg ); - - TRACE(Print(_L("[Cm Server]\t buffer size is %d"), size)); - - aMessage.Complete( KErrNone ); - CleanupStack::PopAndDestroy( 2, ruleContainer ); - array.Reset(); - CleanupStack::PopAndDestroy( &array ); - LOG(_L("[Cm Server]\t ECmGetStoreRulesSize request end")); - - break; - } - - case ECmSetStoreRules: - { - LOG(_L("[Cm Server]\t ECmSetStoreRules request")); - - TInt len = aMessage.GetDesLength(0); - TInt totalCount(0); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmSetStoreRules request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len)); - - HBufC8* buffer = HBufC8::NewLC(len); - - TPtr8 ptr(buffer->Des()); - aMessage.ReadL(0, ptr); - RDesReadStream stream; - stream.Open(ptr); - CleanupClosePushL(stream); - - CCmStoreRuleContainer* tempContainer = - CCmStoreRuleContainer::NewLC(); - tempContainer->InternalizeL( stream ); - iDbManager.DeleteAllStoreRules(); - for ( TInt i = 0; i < tempContainer->StoreRuleCount(); i++ ) - { - TDesC8& name = tempContainer->StoreRule( i )->Name(); - TBuf buf; - buf.Copy(name); - TRACE(Print(_L("[Cm Server]\t updating store rule %S"), - &buf)); - TInt ret = iDbManager.AddStoreRuleL( - tempContainer->StoreRule( i )); - TRACE(Print(_L("[Cm Server]\t ret = %d"), ret)); - - if( tempContainer->StoreRule( i )->Selected() ) - { - TInt oneRuleCount(0); - iDbManager.GetStoreFileCount( - name, - ECmToBeRemoved | ECmToBeShrinked | ECmKeepOnDevice, - oneRuleCount ); - totalCount += oneRuleCount; - } - } - TInt time (0); - TInt count(0); - iDbManager.GetTransferInfo( ECmServiceStore, count, time ); - iDbManager.UpdateTransferInfo( ECmServiceStore, totalCount, - time ); - - aMessage.Complete( KErrNone ); - - CleanupStack::PopAndDestroy( 3, buffer ); - break; - } - - case ECmSetMediaServers: - { - LOG(_L("[Cm Server]\t ECmSetMediaServers request")); - - TInt mediaServerCount = aMessage.Int1(); - TInt len = aMessage.GetDesLength(0); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmSetMediaServers request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len)); - TRACE(Print(_L("[Cm Server]\t mediaserver count is %d"), - mediaServerCount )); - - HBufC8* buffer = HBufC8::NewLC(len); - - TPtr8 ptr(buffer->Des()); - aMessage.ReadL(0, ptr); - RDesReadStream stream; - stream.Open(ptr); - CleanupClosePushL(stream); - - RPointerArray mediaServers; - CleanupClosePushL( mediaServers); - - for ( TInt i = 0; i < mediaServerCount; i++ ) - { - CCmMediaServerFull* mediaServer = - CCmMediaServerFull::NewLC(); - mediaServer->InternalizeL( stream ); - mediaServers.AppendL( mediaServer ); - CleanupStack::Pop( mediaServer ); - } - TInt ret = iDbManager.SetMediaServersL( mediaServers ); - TRACE(Print(_L("[Cm Server]\t mediaservers update ret = %d"), - ret)); - - aMessage.Complete( ret ); - - mediaServers.ResetAndDestroy(); - CleanupStack::PopAndDestroy( 3 ); //buffer, &stream, &mediaServers - break; - } - - case ECmSetFillFileStatuses: - { - LOG(_L("[Cm Server]\t ECmSetFillFileStatuses request")); - - TInt itemCount = aMessage.Int1(); - TInt len = aMessage.GetDesLength(0); - if( len <= 0 ) - { - LOG(_L("[Cm Server]\t ECmSetFillFileStatuses request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len)); - TRACE(Print(_L("[Cm Server]\t item count is %d"), - itemCount )); - - HBufC8* buffer = HBufC8::NewLC(len); - - TPtr8 ptr(buffer->Des()); - aMessage.ReadL(0, ptr); - RDesReadStream stream; - stream.Open(ptr); - CleanupClosePushL(stream); - - RPointerArray items; - CleanupClosePushL( items ); - - for ( TInt i = 0; i < itemCount; i++ ) - { - CCmBaseListItem* item = CCmBaseListItem::NewLC(); - item->InternalizeL( stream ); - items.AppendL( item ); - CleanupStack::Pop( item ); - } - TInt ret = iDbManager.UpdateStatusValues( items ); - TRACE(Print(_L("[Cm Server]\t fillfile status update ret = %d"), - ret)); - - aMessage.Complete( ret ); - - items.ResetAndDestroy(); - CleanupStack::PopAndDestroy( 3 ); //buffer, &stream, &items - break; - } - - case ECmGetAppWizardState: - { - LOG(_L("[Cm Server]\t ECmGetAppWizardState request")); - - TInt appWizardState( KErrNotFound ); - TInt err; - err = iSettings.GetAppWizardInformation( appWizardState ); - TPckg pckg( appWizardState ); - aMessage.WriteL(0, pckg ); - aMessage.Complete( err ); - break; - } - - case ECmSetAppWizardState: - { - LOG(_L("[Cm Server]\t ECmSetAppWizardState request")); - TInt err; - err = iSettings.SetAppWizardInformation(); - aMessage.Complete( err ); - - break; - } - case ECmUpdateFillLists: - { - LOG(_L("[Cm Server]\t ECmUpdateLists request")); - Server().ExecuteServiceL( - ECmServiceUpdateFillLists, 0, NULL ); - Server().SetCurrentAsyncMsg( aMessage ); - break; - } - case ECmDeleteMetadata: - { - LOG(_L("[Cm Server]\t ECmDeleteMetadata request")); - - Server().ExecuteServiceL( - ECmServiceDeleteMetadata, 0, NULL ); - Server().SetCurrentAsyncMsg( aMessage ); - break; - } - case ECmDeleteDeletedMediaServers: - { - TRAPD( err, iDbManager.DeleteDeletedMediaServersL() ); - aMessage.Complete( err ); - break; - } - case ECmGetDriveSelectionStatus: - { - TInt err( KErrNone ); - TPckg pckg( Server().DriveSelectionStatus() ); - aMessage.WriteL( 0, pckg ); - aMessage.Complete( err ); - break; - } - case ECmSetDrives: - { - LOG(_L("[Cm Server]\t ECmSetDrives request")); - - TInt driveCount = aMessage.Int1(); - TInt len = aMessage.GetDesLength(0); - if( len < 0 ) - { - LOG(_L("[Cm Server]\t ECmSetDrives request \ - leaving with KErrArgument")); - User::Leave( KErrArgument ); - } - TRACE(Print(_L("[Cm Server]\t buffer length is %d"), len)); - TRACE(Print(_L("[Cm Server]\t drive count is %d"), - driveCount )); - - RPointerArray origDrives; - CleanupClosePushL( origDrives ); - - iDbManager.PrepareQueryCmdL( EDrivesQuery ); - TRAPD( ret, iDbManager.QueryDrivesL( origDrives ) ); - TRACE(Print(_L("[Cm Server]\t Query orig drives ret = %d"), - ret )); - - HBufC8* buffer = HBufC8::NewLC(len); - - TPtr8 ptr(buffer->Des()); - aMessage.ReadL(0, ptr); - RDesReadStream stream; - stream.Open(ptr); - CleanupClosePushL(stream); - - RPointerArray drives; - CleanupClosePushL( drives ); - - for ( TInt i = 0; i < driveCount; i++ ) - { - CCmDriveInfo* drive = - CCmDriveInfo::NewLC(); - drive->InternalizeL( stream ); - drives.AppendL( drive ); - } - // Has drive slots changed or has some mmc taken away - TBool driveSelected( EFalse ); - for( TInt j = 0; j < origDrives.Count(); j++ ) - { - for( TInt k = 0; k < drives.Count(); k++ ) - { - if( origDrives[j]->DriveId() == drives[k]->DriveId() ) - { - driveSelected = ETrue; - if( origDrives[j]->DriveNumber() != - drives[k]->DriveNumber() ) - { - // update fill list drive numbers and ids - iDbManager.UpdateFillListDriveStatusesL( - origDrives[j], drives[k], driveSelected ); - } - else - { - // Do nothing, drive still in same slot as - // previously - } - } - } - if( !driveSelected ) - { - // Drive not selected, update fill file list statuses - // Use drive id in update clause - iDbManager.UpdateFillListDriveStatusesL( - origDrives[j], NULL, driveSelected ); - } - driveSelected = EFalse; - } - - TRAP( ret, iDbManager.SetDrivesL( drives ) ); - TRACE(Print(_L("[Cm Server]\t drives update ret = %d"), - ret)); - if( drives.Count() ) - { - Server().SetDriveSelectionStatus( ETrue ); - } - else - { - Server().SetDriveSelectionStatus( EFalse ); - } - aMessage.Complete( ret ); - - CleanupStack::PopAndDestroy( driveCount ); - drives.Reset(); - CleanupStack::PopAndDestroy( &drives ); - CleanupStack::PopAndDestroy( 2, buffer ); - origDrives.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &origDrives ); - // Restart quota listener if needed - TBool mmEnabled( EFalse ); - iSettings.GetMemoryManagerStatus( mmEnabled ); - Server().SetServiceStateL( ECmServiceMemoryManager, - (TCmServiceState)mmEnabled ); - break; - } - case ECmGetDrivesSize: - { - LOG(_L("[Cm Server]\t ECmGetDrivesSize request")); - - iDbManager.PrepareQueryCmdL( EDrivesQuery ); - - delete iDataBuffer; - iDataBuffer = NULL; - - iDataBuffer = CBufFlat::NewL( KBufferExpandSize ); - RBufWriteStream driveStream; - driveStream.Open( *iDataBuffer ); - CleanupClosePushL( driveStream ); - - RPointerArray drives; - CleanupClosePushL( drives ); - iDbManager.QueryDrivesL( drives ); - for( TInt i = 0; i < drives.Count(); i++ ) - { - drives[i]->ExternalizeL( driveStream ); - } - - TInt size = iDataBuffer->Size(); - TPckg pckg( size ); - aMessage.WriteL(0, pckg ); - - TPckg pckg2( drives.Count() ); - aMessage.WriteL(1, pckg2 ); - - TRACE(Print(_L("[Cm Server]\t buffer size is %d, amount %d"), - size, drives.Count() )); - - aMessage.Complete( KErrNone ); - drives.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &drives ); - CleanupStack::PopAndDestroy( &driveStream ); - break; - } - case ECmApplicationExit: - { - LOG(_L("[Cm Server]\t ECmApplicationExit request")); - Server().SetAsyncRequestStateL( EFalse ); - if ( !aMessage.IsNull() ) - { - aMessage.Complete( KErrNone ); - } - break; - } - case ECmGetFilledFilesSize: - { - LOG(_L("[Cm Server]\t ECmGetFilledFilesSize request")); - TInt id = aMessage.Int1(); - TInt64 size = iDbManager.BytesFilled( id ); - TPckg pckg( size ); - - aMessage.WriteL(0, pckg ); - aMessage.Complete( KErrNone ); - - break; - } - default: - { - LOG(_L("[Cm Server]\t default panic with ECmClientBadRequest")); - // Unknown opcode --> panic client - PanicClient( aMessage, ECmClientBadRequest ); - break; - } - } - - // If ServiceL leaves, default implementation in server framework - // completes the RMessage2 with the leave code. - } - -// --------------------------------------------------------------------------- -// PanicClient -// Client panic handler -// RMessage2::Panic() also completes the message. This is: -// (a) important for efficient cleanup within the kernel -// (b) a problem if the message is completed a second time -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmSession::PanicClient( const RMessage2& aMessage, TInt aPanic ) const - { - TRACE(Print(_L("[Cm Server]\t PanicClient: Reason = %d\n"), aPanic)); - aMessage.Panic( KCmServerPanic, aPanic ); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/bwins/cmstoremanageru.def --- a/homesync/contentmanager/cmserver/cmstoremanager/bwins/cmstoremanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - ?NewStoreManagerL@CmStoreManagerFactory@@SAPAVMCmSmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 1 NONAME ; class MCmSmManager * CmStoreManagerFactory::NewStoreManagerL(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *) - ?NewStoreManagerLC@CmStoreManagerFactory@@SAPAVMCmSmManager@@PAVMCmServiceObserver@@AAVCMdESession@@PAVCCmDmMain@@PAVCCmMmMain@@@Z @ 2 NONAME ; class MCmSmManager * CmStoreManagerFactory::NewStoreManagerLC(class MCmServiceObserver *, class CMdESession &, class CCmDmMain *, class CCmMmMain *) - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/eabi/cmstoremanageru.def --- a/homesync/contentmanager/cmserver/cmstoremanager/eabi/cmstoremanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - _ZN21CmStoreManagerFactory16NewStoreManagerLEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 1 NONAME - _ZN21CmStoreManagerFactory17NewStoreManagerLCEP18MCmServiceObserverR11CMdESessionP9CCmDmMainP9CCmMmMain @ 2 NONAME - _ZTI26CCmSmContentChangeObserver @ 3 NONAME ; ## - _ZTI9CCmSmMain @ 4 NONAME ; ## - _ZTV26CCmSmContentChangeObserver @ 5 NONAME ; ## - _ZTV9CCmSmMain @ 6 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/group/bld.inf --- a/homesync/contentmanager/cmserver/cmstoremanager/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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 information file for Store Manager -* -*/ - - - -// Supported platforms -prj_platforms -DEFAULT - -// MMP files -prj_mmpfiles -cmstoremanager.mmp - -// Files to be exported -prj_exports -../inc/cmstoremanagerfactory.h |../../../../../inc/cmstoremanagerfactory.h -../inc/cmstoremanager.h |../../../../../inc/cmstoremanager.h diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/group/cmstoremanager.mmp --- a/homesync/contentmanager/cmserver/cmstoremanager/group/cmstoremanager.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +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 project store manager -* -*/ - -#include - -TARGET cmstoremanager.dll -TARGETTYPE dll -UID 0x1000008d 0x10281FAE - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH /sys/bin - -USERINCLUDE ../inc - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -SOURCEPATH ../src - -SOURCE cmstoremanagerfactory.cpp -SOURCE cmsmmain.cpp -SOURCE cmsmtransferengine.cpp -SOURCE cmsmfilemngr.cpp -SOURCE cmsmvideoandimagemngr.cpp -SOURCE cmsmclfmngr.cpp -SOURCE cmsmcontentchangeobserver.cpp -SOURCE cmsmiteminfo.cpp -SOURCE cmsmmsinfo.cpp - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY charconv.lib -LIBRARY cmcommon.lib -LIBRARY cmdatabaseManager.lib -LIBRARY cmmemorymanager.lib -LIBRARY cmsqlwrapper.lib -LIBRARY upnpavcontrollerclient.lib -LIBRARY upnpavcontrollerhelper.lib -LIBRARY mdeclient.lib -LIBRARY contentlistingframework.lib - -// Path infos -LIBRARY PlatformEnv.lib - -DEBUGLIBRARY flogger.lib - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmclfmngr.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmclfmngr.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +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: store file manager -* -*/ - - - -#ifndef __CMSMCLFMNGR_H -#define __CMSMCLFMNGR_H - -#include -#include -#include -#include -#include "cmcommontypes.h" -#include "cmcommon.h" -#include "cmsmcommon.h" - -// Forward declarations -class MCLFContentListingEngine; -class MCLFItemListModel; -class MCLFSortingStyle; -class MCmSmMusicMngrObserver; -class CCmSmFileMngr; - -// CLASS DECLARATION - - /** - * CCmSmClfMngr class definition - * This class processes music files metadata. - * - * @lib cmstoremanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmSmClfMngr ) : public CActive, - public MCLFOperationObserver - { -public: - - /** - * Two-phased constructor. - * Creates new CCmSmClfMngr class - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aFileMngr, file manager reference - * @param aItems, store list items - * @return pointer to CCmSmClfMngr class - */ - static CCmSmClfMngr* NewL( MCmSmMusicMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, RPointerArray& aItems ); - - /** - * Two-phased constructor. - * Creates new CCmSmClfMngr class - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aFileMngr, file manager reference - * @param aItems, store list items - * @return pointer to CCmSmClfMngr class - */ - static CCmSmClfMngr* NewLC( MCmSmMusicMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, RPointerArray& aItems ); - - /** - * Destructor. - */ - virtual ~CCmSmClfMngr(); - - /** - * Cancels list processing - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - - /** - * Cancel clf refresh - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelClfRefresh(); - - /** - * Setting up clf lists - * - * @since S60 5.1 - * @param aMediaType, media type - * @return None - */ - void SetupCLFListModelsL( TCmMediaType aMediaType ); - - /** - * CLF refresh - * - * @since S60 5.1 - * @param aMediaType, media type - * @return None - */ - void DoRefreshL( TCmMediaType aMediaType ); - - /** - * Filters files from the clf lists - * - * @since S60 5.1 - * @param None - * @return None - */ - void FilterItemsL(); - - /** - * Filters defined media files from the clf lists - * - * @since S60 5.1 - * @param aNewItems, list model - * @param aDeviceIds, devices - * @param aType, media type - * @return None - */ - void FilterNewItemsL( MCLFItemListModel* aNewItems, - RArray aDeviceIds, TCmMediaType aType ); - -// From base class MCLFOperationObserver - - /** - * From MCLFOperationObserver - * See base class definition - */ - void HandleOperationEventL( TCLFOperationEvent aOperationEvent, - TInt aError ); - -protected: - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - -private: - - /** - * Completes request - * - * @since S60 5.1 - * @param aStatus, defined id for the completing - * @return None - */ - void CompleteRequest( TCmSmFileProcessingStatus aStatus ); - -private: - - /** - * Performs the first phase of two phase construction. - * - * since S60 5.1 - * @param aObserver, music manager observer - * @param aFileMngr, file manager - * @param aItems, store list items - */ - CCmSmClfMngr( MCmSmMusicMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, RPointerArray& aItems ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -private: - - /** - * Pointer to observer class - */ - MCmSmMusicMngrObserver& iObserver; - /** - * Main file manager - */ - CCmSmFileMngr& iFileMngr; - /** - * Clf engine - */ - MCLFContentListingEngine* iEngine; // owned - /** - * Audio list model to be refreshed - */ - MCLFItemListModel* iNewAudioItems; // owned - /** - * Image list model to be refreshed - */ - MCLFItemListModel* iNewImageItems; // owned - /** - * Video list model to be refreshed - */ - MCLFItemListModel* iNewVideoItems; // owned - /** - * Sorting style for item ordering. - */ - MCLFSortingStyle* iSortingStyle; // owned - /** - * Store file list items - */ - RPointerArray& iItems; - /** - * Filter file index - */ - TInt iFilterIndex; - }; - -#endif // __CMSMCLFMNGR_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcommon.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcommon.h Mon Nov 01 13:44:24 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: Common header for store manager -* -*/ - - -#ifndef __CMSMCOMMON_H -#define __CMSMCOMMON_H - -// Used in store manager panics -_LIT( KCmSmManager, "CmStoreManager" ); - -/// Status codes used in Store Manager -// Transfer engine call back statuses -enum TCmSmTransferStatus - { - ECmSmTransferCompleted = 0, - ECmSmAborted, - ECmSmTransferCanceled, - ECmSmFileTransferred, - ECmSmFileTransferFailed, - ECmSmWlanLost, - ECmSmTransferContinued - }; - -// Store file processing call back statuses -enum TCmSmFileProcessingStatus - { - ECmSmStoreRulesLoaded = 20, - ECmSmProcessingFilesStarted, - ECmSmProcessingFilesReady, - ECmSmAllLoaded, - ECmSmStoreRulesReady, - ECmSmAllRefreshed, - ECmSmMediaTypesSelected, - ECmSmFilesLoaded, - ECmSmStartItemFiltering, - ECmSmContinueFiltering, - ECmSmFilteringReady, - ECmSmProcessingCanceled, - ECmSmRefreshError, - ECmSmNoStoreRulesSelected, - ECmSmNoDevicesAvailable, - ECmSmPreProcessingStarted, - ECmSmLoadFilledAndStored, - ECmSmPreProcessingReady, - ECmSmFileAdded, - ECmSmFileRemoved, - ECmSmFileRenamed, - ECmSmEventProcessed, - ECmSmProcessAlbumList, - ECmSmAlbumFilteringReady, - ECmSmAlbumProcessingReady, - ECmSmQueryCompleted, - ECmSmQueryFailed, - ECmSmContentChanged, - ECmSmNone - }; - -// Store manager main statuses -enum TCmSmMainSequencer - { - ECmSmGetMediaServers = 40, - ECmSmStartFileProcessing, - ECmSmStartFileFiltering, - ECmSmStartCopying, - ECmSmContinueCopying, - ECmSmManageFiles, - ECmSmFinishCanceling, - ECmSmFinishing - }; - -// Transfer engine states -enum TCmSmTransferEngineState - { - ECmSmIdle = 60, - ECmSmCopying, - ECmSmNextFile, - ECmSmWaitingForCopyStarted, - ECmSmTransferComplete, - ECmSmTransferAborted, - ECmSmStartingTransfer, - ECmSmCanceling, - ECmSmReserveLocalMs, - ECmSmReserveLocalMsFailed - }; - -#endif // __CMSMCOMMON_H - -// end of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcontentchangeobserver.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmcontentchangeobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +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: Handles devices internal content change events -* -*/ - - - -#ifndef __CMSMCONTENTCHANGEOBSERVER_H -#define __CMSMCONTENTCHANGEOBSERVER_H - -#include -#include - -// FORWARD DECLARATIONS -class MCmSmFileProcessingObserver; - -// CLASS DECLARATION -/** - * Handles devices internal content change events - * Store list processing will be started when notification is received - * - * @lib cmstoremanager.lib - * - * @since S60 v5.1 - */ -class CCmSmContentChangeObserver : public CBase, - public MMdEObjectObserver - { - -public: - - /** - * Two-phased constructor. - * Creates new CCmSmContentChangeObserver class - * - * @since S60 5.1 - * @param aSession, mds session - * @param aObserver, observer class - * @return pointer to CCmSmContentChangeObserver class - */ - static CCmSmContentChangeObserver* NewL( CMdESession& aSession, - MCmSmFileProcessingObserver& aObserver ); - - /** - * Two-phased constructor. - * Creates new CCmSmContentChangeObserver class - * - * @since S60 5.1 - * @param aSession, mds session - * @param aObserver, observer class - * @return pointer to CCmSmContentChangeObserver class - */ - static CCmSmContentChangeObserver* NewLC( CMdESession& aSession, - MCmSmFileProcessingObserver& aObserver ); - - /** - * Destructor. - */ - virtual ~CCmSmContentChangeObserver(); - - /** - * Starts content change observers - * - * @since S60 5.1 - * @param None - */ - void StartObserversL(); - - /** - * ETrue if observers are started - * - * @since S60 5.1 - * @param None - * @return ETrue if observers started - */ - TBool IsStarted(); - -protected: - -// From base class MMdEObjectObserver - - /** - * From MMdEObjectObserver - * See base class definition - */ - void HandleObjectNotification(CMdESession& aSession, - TObserverNotificationType aType, - const RArray& aObjectIdArray); - -private: - - /** - * Performs the first phase of two phase construction. - * - * since S60 5.1 - * @param aSession, mde session - * @param aObserver, process observer - */ - CCmSmContentChangeObserver( CMdESession& aSession, - MCmSmFileProcessingObserver& aObserver ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -private: // data - - /** - * MdS session - */ - CMdESession& iMdSSession; // not owned - - /** - * Observer to give notification about changed content - */ - MCmSmFileProcessingObserver& iObserver; // not owned - - /** - * ETrue if observers started - */ - TBool iStarted; - - }; - -#endif // __CMSMCONTENTCHANGEOBSERVER_H - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfilemngr.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfilemngr.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,517 +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: store file manager -* -*/ - - - -#ifndef __CMSMFILEMNGR_H -#define __CMSMFILEMNGR_H - -#include -#include -#include "cmsmvideoandimagemngrobserver.h" -#include "cmsmmusicmngrobserver.h" -#include "cmsmcommon.h" -#include "cmcommontypes.h" -#include "cmcommon.h" - -// Forward declarations -class CCmDmMain; -class CMdESession; -class CCmStoreRule; -class CUpnpAVDevice; -class MCmSmFileProcessingObserver; -class CCmStoreListItem; -class CCmFillListItem; -class CUpnpAVDeviceList; -class CCmSmVideoAndImageMngr; -class CCmSmClfMngr; -class CCmSmContentChangeObserver; -class CCmSmItemInfo; -class CCmSmMsInfo; - - -// CLASS DECLARATION - /** - * Processes store files - * - * @lib cmstoremanager.lib - * - * @since S60 v5.1 - */ -NONSHARABLE_CLASS( CCmSmFileMngr ): public CActive, - public MCmSmVideoAndImageMngrObserver, - public MCmSmMusicMngrObserver - { -public: - - /** - * Two-phased constructor. - * Creates new CCmSmFileMngr class - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aSession, mde session - * @param aDBMngr, database manager - * @param aItems, store list items - * @return pointer to CCmSmFileMngr class - */ - static CCmSmFileMngr* NewL( - MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBMngr, RPointerArray& aItems ); - - /** - * Two-phased constructor. - * Creates new CCmSmFileMngr class - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aSession, mde session - * @param aDBMngr, database manager - * @param aItems, store list items - * @return pointer to CCmSmFileMngr class - */ - static CCmSmFileMngr* NewLC( - MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBMngr, RPointerArray& aItems ); - - /** - * Destructor. - */ - virtual ~CCmSmFileMngr(); - -public: - - /** - * Starts store list processing - * - * @since S60 5.1 - * @param None - * @return None - */ - void StartProcessing(); - - /** - * Provides album list - * @param aMedia, media type - * @param aArray, array of albums - * @return None - */ - void ProcessAlbumList( TCmMediaType aMedia, - CDesCArray& aArray ); - - /** - * Canceling file processing - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - - /** - * Returns amount of items to be stored - * - * @since S60 5.1 - * @param None - * @return count - */ - TInt StoreItemCount(); - - /** - * Returns amount of items to be filled - * - * @since S60 5.1 - * @param None - * @return count - */ - TInt FillItemCount(); - - /** - * Returns amount of items to be stored, no duplicates - * - * @since S60 5.1 - * @param aCount - * @return None - */ - void GetStoreFileCountNoDuplicatesL( TInt& aCount ); - - /** - * Updating transfer history - * @param aInterval, time stamp - * @param aDataAmount, transfered data - * @param aServerId, device id - * @return None - */ - void UpdateTransferHistoryData(TInt64 aInterval, - TInt64 aDataAmount, TUint8 aServerId ); - - /** - * Loading all selected Store rules - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadSelectedStoreRulesL(); - - /** - * Processing Store rules - * - * @since Series 60 5.1 - * @param None - * @return None - */ - void ProcessStoreRules(); - - /** - * Loads filled and stored items - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadFilledAndStoredL(); - - /** - * Loading all filled items - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadFilledL(); - - /** - * Loading all stored items ( filled from UDN ) - * - * @since S60 5.1 - * @param aUDN, server identifier - * @return None - */ - void LoadStoredL( const TDesC8& aUDN ); - - /** - * Reseting filled array - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetFilledArray(); - - /** - * Selects media types from store rules for CLF - * Refresh. - * - * @since S60 5.1 - * @param None - * @return None - */ - void SelectMediaTypes(); - - /** - * Checks if file is filled - * - * @since S60 5.1 - * @param aPathAndFileName, file to be chekced - * @return ETrue if file is filled - */ - TBool CheckIsFilledFileL( const TDesC& aPathAndFileName ); - - /** - * Checks if file is already stored - * - * @since S60 5.1 - * @param aPathAndFileName, file to be chekced - * @param aStoredIds, reference to stored servers array - * @param aStoreIds, reference to store servers array - * @return None - */ - void IsAlreadyStoreL( const TDesC& aPathAndFileName, - RArray& aStoredIds, RArray& aStoreIds ); - - /** - * Identifies media types used with aDeviceIndex server - * - * @since S60 5.1 - * @param aIds, media server ids - * @param aType, media type - * @return None - */ - void MediaTypesL( RArray& aIds, TCmMediaType aType ); - - /** - * Loads all media server id from the database - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadMediaServerIdsL(); - - /** - * Returns devide id - * - * @since S60 5.1 - * @param aUuid, media server identifier - * @return id, database id - */ - TInt64 GetDevId( const TDesC8& aUuid ); - - /** - * Select files which is needed to be stored to def. server - * - * @since S60 5.1 - * @param aItemIds, item id array - * @param aUuid, server identifier - * @param aId, server database id - * @return None - */ - void GetItemsL( RArray& aItemIds, - const TDesC8& aUuid, TInt64& aId ); - - /** - * Updates store file list up to date - * - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateStoreFileListL(); - - /** - * Loads store file list from the db - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadStoreFileListL(); - - /** - * Get store rule id - * - * @since S60 5.1 - * @param aType, media type - * @return rule id - */ - TInt64 RetrieveListId( TCmMediaType aType ); - - /** - * Get status values and server ids - * - * @since S60 5.1 - * @param aType, media type - * @param aStatus - * @return None - */ - void RetrieveListStatusValues( TCmMediaType aType, - TCmListItemStatus& aStatus ); - - /** - * Deletes items which need to be deleled - * - * @since S60 5.1 - * @param aIds, item id array - * @return None - */ - void DeleteItems( RArray& aIds ); - - /** - * Reseting arrays - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetArrays(); - - /** - * Calculating transfer history time - * - * @since S60 5.1 - * @param None - * @return None - */ - void CalculateAvgTransferTimeL(); - - /** - * Publishes transfer history time estimate - * - * @since S60 5.1 - * @param None - * @return None - */ - void SendAvgTransferTime(); - - /** - * Sets processing status - * @param aStatus, processing status - * @return None - */ - void SetProcessingStatus( TCmSmFileProcessingStatus aStatus ); - -protected: - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - - /** - * From CActive - * See base class definition - */ - TInt RunError( TInt aError ); - -// From base class MCmSmMediaTypeObserver - - /** - * From MCmSmMediaTypeObserver - * See base class definition - */ - void ImagesAndVideosReady( const TInt aStatus ); - -// From base class MCmSmMusicMngrObserver - - /** - * From MCmSmMusicMngrObserver - * See base class definition - */ - void MusicReady( const TInt aStatus ); - -private: - - /** - * Process media lists - * - * @param aType, defined media type - * @return None - */ - void ProcessMedia( TCmMediaType aType ); - - /** - * Process music - * - * @param None - * @return None - */ - void ProcessMusics(); - - /** - * Completes request - * - * @since S60 5.1 - * @param aStatus, defined id for the completing - * @return None - */ - void CompleteRequest( TCmSmFileProcessingStatus aStatus ); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, process observer - * @param aDBMngr, database manager - * @param aItems, store items - */ - CCmSmFileMngr( - MCmSmFileProcessingObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems ); - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aSesstion, mde sesstion - */ - void ConstructL( CMdESession& aSession ); - -private: - - /** - * Pointer to observer class - */ - MCmSmFileProcessingObserver* iObserver; // not owned - /** - * Pointer to database manager - */ - CCmDmMain* iDBManager; // not owned - /** - * Rule array - */ - RPointerArray iRuleArray; // owned - /** - * Stored items array - */ - RPointerArrayiStoredArray; // owned - /** - * Media server id array - */ - RPointerArray iMsIds; // owned - /** - * Store file list items - */ - RPointerArray& iItems; // not owned - /** - * Filled file list items - */ - RPointerArrayiFilledItems; // owned - /** - * video and image process - */ - CCmSmVideoAndImageMngr* iVideoAndImageMngr; // owned - /** - * music process temp - */ - CCmSmClfMngr* iClfMusicMngr; // owned - /** - * observers content changes in local device - */ - CCmSmContentChangeObserver* iCcObserver; // owned - /** - * Media type array - */ - RArrayiMediaTypes; // owned - /** - * Used to select media to be refreshed - */ - TInt iRefreshIndex; - /** - * Total transfer time estimate - */ - TCmProgressInfo iTransferInfo; - /** - * Processing status - */ - TCmSmFileProcessingStatus iProcessingStatus; - - }; - -#endif // __CMSMFILEMNGR_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfileprocessingobserver.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmfileprocessingobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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: Callback interface to store file processing -* -*/ - - - -#ifndef M_CMSMFILERULEPROCESSINGOBSERVER_H -#define M_CMSMFILERULEPROCESSINGOBSERVER_H - -#include "cmsmcommon.h" - -/** - * Callback interface class used to notify CmSmMain -class - * about store file processing status - * - * @lib cmstoremanager.lib - * - * @since S60 v5.1 - */ -class MCmSmFileProcessingObserver - { - -public: - - /** - * Used to notify about status changes in fill rule processing - * - * @since S60 5.1 - * @param aStatus, status of the file processing - * @return None - */ - virtual void FileProcessingStatus( - TCmSmFileProcessingStatus aStatus ) = 0; - }; - -#endif // M_CMSMFILERULEPROCESSINGOBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmiteminfo.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmiteminfo.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +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: store item info class -* -*/ - - - -#ifndef __CMSMITEMINFO_H -#define __CMSMITEMINFO_H - -#include - -// Forward declarations - -// LITERALS - -// CLASS DECLARATION - /** - * Stored item class - * @lib cmstoremanager.lib - * @since S60 v5.1 - */ -NONSHARABLE_CLASS( CCmSmItemInfo ): public CBase - { -public: - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aFile, file name - * @param aId, media server's id - * @return pointer to CCmSmItemInfo class - */ - static CCmSmItemInfo* NewL( TDesC& aFile, TInt64 aId ); - - /** - * Two-phased constructor. - * - * since S60 5.1 - * @param aFile, file name - * @param aId, media server's id - * @return pointer to CCmSmItemInfo class - */ - static CCmSmItemInfo* NewLC( TDesC& aFile, TInt64 aId ); - - /** - * Destructor. - */ - virtual ~CCmSmItemInfo(); - -private: - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aFile, file name - * @param aId, media server's id - * @return None - */ - void ConstructL( TDesC& aFile, TInt64 aId ); - - /** - * Performs the first phase of two phase construction. - */ - CCmSmItemInfo( ); - -public: - - /** - * File name - */ - HBufC* iFile; // owned - /** - * Media server identifier - */ - TInt64 iId; - }; - -#endif // __CMSMITEMINFO_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmain.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmain.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,394 +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: Main class in the Store manager component -* -*/ - - -#ifndef C_CMSMMAIN_H -#define C_CMSMMAIN_H - -#include -#include "cmsmfileprocessingobserver.h" -#include "cmsmtransferobserver.h" -#include "cmmmobserver.h" -#include "cmcommon.h" -#include "cmstoremanager.h" - -// Forward declarations -class MUPnPAVController; -class MCmServiceObserver; -class CCmSmTransferEngine; -class CCmSmFileMngr; -class CCmDmMain; -class CCmStoreListItem; -class CCmSqlPropertyContainer; -class CCmMmMain; -class CUpnpAVDeviceList; - - -/** - * CCmSmMain class definition - * - * @lib cmstoremanager.lib - * - * @since S60 v5.1 - */ -class CCmSmMain : public CActive, - public MCmSmManager, - public MCmSmFileProcessingObserver, - public MCmSmTransferObserver, - public MCmMmObserver - { - -public: - - /** - * Two-phased constructor. - * Creates new CCmSmMain class and opens connection to database. - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aSession, Mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return pointer to CCmSmMain class - */ - static CCmSmMain* NewL( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - /** - * Two-phased constructor. - * Creates new CCmSmMain class and opens connection to database and - * leaves the instance in the cleanup stack. - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aSession, Mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return pointer to CCmSmMain class - */ - static CCmSmMain* NewLC( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - /** - * Destructor. - */ - virtual ~CCmSmMain(); - -public: - - /** - * Starts store service - * - * @since S60 5.1 - * @param None - * @return None - */ - void StartStoreL(); - - /** - * Cancels store service - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - - /** - * Starts store list processing - * - * @since S60 5.1 - * @param None - * @return None - */ - void PreProcessLists(); - - /** - * Provides album list - * - * @since S60 5.1 - * @param aMedia, media type - * @param aArray, list of values - * @return None - */ - void GetColItemsL( TCmMediaType aMedia, - CDesCArray& aArray ); - - /** - * Provides metadata column item list - * - * @since S60 5.1 - * @param aMedia, media type - * @param aPropertys, list of values - * @return None - */ - void GetColItemsL( TCmMediaType aMedia, - CCmSqlPropertyContainer& aPropertys ); - - /** - * Sets av controller - * - * @since S60 5.1 - * @param aAVController, av controller pointer - * @return None - */ - void SetAvController( MUPnPAVController* aAVController ); - -// From base class MCmSmManager - - /** - * From MCmSmManager - * See base class definition - */ - void Close(); - -// From base class MCmSmFileProcessingObserver - - /** - * From MCmSmFileProcessingObserver - * See base class definition - */ - void FileProcessingStatus( TCmSmFileProcessingStatus aStatus ); - -// From base class MCmSmTransferObserver - - /** - * From MCmSmTransferObserver - * See base class definition - */ - void TransferStatus( TCmSmTransferStatus aStatus ); - -// From base class MCmMmObserver - - /** - * From MCmMmObserver - * See base class definition - */ - void DeleteCompleteL( TInt aErr ); - - /** - * From MCmMmObserver - * See base class definition - */ - void ShrinkCompleteL( TInt aErr ); - -protected: - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - - /** - * From CActive - * See base class definition - */ - TInt RunError( TInt aError ); - -private: - - /** - * Managing files after storing - * - * @since S60 5.1 - * @param None - * @return None - */ - void ManageFileL(); - -#ifdef _DEBUG - /** - * Logs server Uuids - * - * @since S60 5.1 - * @param None - * @return None - */ - void LogServers(); -#endif - - /** - * Publish progress info - * - * @since S60 5.1 - * @param aProgress - * @return None - */ - void SendProgressInfo( TInt aProgress ); - - /** - * Changes state - * - * @since S60 5.1 - * @param aStatus, defined id for the completing - * @return None - */ - void ChangeState( TCmSmMainSequencer aStatus ); - - /** - * Starts clf refresh timer - * - * @since S60 5.1 - * @param None - * @return None - */ - void StartMdETimerL(); - - /** - * Cancels mde refresh timer - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelMdETimer(); - - /** - * Call back for clf refresh timer - * - * @since S60 5.1 - * @param aPtr, this - * @return None - */ - static TInt CheckItems( TAny* aPtr ); - - /** - * Starts clf refresh if no services ongoing - * - * @since S60 5.1 - * @param None - * @return KErrNone - */ - TInt CheckItemsChanged( ); - - /** - * Delete devices - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteDevices(); - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, service observer - * @param aDBManager, database manager - * @param aMemManager, memory manager - */ - CCmSmMain( MCmServiceObserver* aObserver, CCmDmMain* aDBManager, - CCmMmMain* aMemManager ); - - /** - * Performs the second phase construction. - */ - void ConstructL( CMdESession& aSession, CCmDmMain* aDBManager ); - - -private: - - /** - * Service observer - */ - MCmServiceObserver* iObserver; // not owned - - /** - * Database manager - */ - CCmMmMain* iMemManager; // not owned - - /** - * Memory manager - */ - CCmDmMain* iDbManager; // not owned - - /** - * Upnp operation manager - */ - CCmSmTransferEngine* iCmSmTransferEngine; // owned - - /** - * File manager - */ - CCmSmFileMngr* iCmSmFileMngr; // owned - - /** - * Checks if clf state has changed - */ - CPeriodic* iPeriodic; // owned - - /** - * Array of found devices - */ - CUpnpAVDeviceList* iDevices; // owned - - /** - * Fill progress info - */ - TCmProgressInfo iProgressInfo; - - /** - * Logged storing time values - */ - TTime iStoreStarted; - - /** - * Index to device array - */ - TInt iDeviceIndex; - - /** - * List of store file items - */ - RPointerArray iItems; // owned - - /** - * List of store item ids - */ - RArrayiItemIds; // owned - - /** - * Id of the current mediaserver - */ - TInt64 iId; - - /** - * Service - */ - TCmService iService; - - /** - * Flag defining if cancel is on - */ - TBool iCancelOnGoing; - - }; - -#endif // C_CMSMMAIN_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmsinfo.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmsinfo.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +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: media server info class -* -*/ - - - -#ifndef __CMSMMSINFO_H -#define __CMSMMSINFO_H - -#include - -// CLASS DECLARATION - /** - * Media server info class - * - * @lib cmstoremanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmSmMsInfo ): public CBase - { -public: - - /** - * Two-phased constructor. - * Creates new CCmSmMsInfo class - * - * @since S60 5.1 - * @param aUuid, server's uuid - * @param aId, media server's id - * @return pointer to CCmSmMsInfo class - */ - static CCmSmMsInfo* NewL( TDesC8& aUuid, TInt aId ); - - /** - * Two-phased constructor. - * Creates new CCmSmMsInfo class - * - * @since S60 5.1 - * @param aUuid, server's uuid - * @param aId, media server's id - * @return pointer to CCmSmMsInfo class - */ - static CCmSmMsInfo* NewLC( TDesC8& aUuid, TInt aId ); - - /** - * Destructor. - */ - virtual ~CCmSmMsInfo(); - -private: - - /** - * Performs the second phase construction. - */ - void ConstructL( TDesC8& aUuid, TInt aId ); - - /** - * Performs the first phase of two phase construction. - */ - CCmSmMsInfo( ); - -public: - - /** - * Server's uuid - */ - HBufC8* iUuid; // owned - - /** - * Media server identifier - */ - TInt iId; - }; - -#endif // __CMSMMSINFO_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmusicmngrobserver.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmmusicmngrobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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: store file manager observer for music files -* -*/ - - - -#ifndef __CMSMMUSICMNGROBSERVER_H -#define __CMSMMUSICMNGROBSERVER_H - -// CLASS DECLARATION - /** - * Music manager observer class definition - * - * @lib cmstoremanager.lib - * - * @since S60 v5.1 - */ -class MCmSmMusicMngrObserver - { -public: - - /** - * Call back for observer - * - * @since S60 5.1 - * @param aStatus, KErrNone if no errors, otherwise system wide error codes - * @return None - */ - virtual void MusicReady( const TInt aStatus ) = 0; - - }; - -#endif // __CMSMMUSICMNGROBSERVER_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferengine.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferengine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,470 +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: Manages Upnp actions needed by Store Manager -* Version : %version: tr1ido#1.1.6 % << Don't touch! -* -*/ - - - -#ifndef __CMSMTRANSFERENGINE_H -#define __CMSMTRANSFERENGINE_H - -#include -#include -#include -#include "upnpfiletransfersessionobserver.h" - -// Forward declarations -class MUPnPAVController; -class MCmSmTransferObserver; -class CCmDmMain; -class CCmStoreListItem; -class MCmSqlMain; - -// CLASS DECLARATION - /** - * Class represents methods to communication with AV Controller API. - * - * @lib cmstoremanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmSmTransferEngine ): public CBase, - public MUPnPFileTransferSessionObserver - { - -public: - - // panic codes - enum TCmSmTransferEnginePanic - { - ECmSmTransferQueueMessedUp = 30 - }; - - // Copy statuses - enum TCmSmCopyStatus - { - ECmSmCopyNever, - ECmSmCopyContinued, - ECmSmCopySuccess - }; -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aDBMngr, database manager - * @param aItems, reference to items array - * @param aItemIds, reference to item id array - * @return pointer to CCmSmTransferEngine class - */ - static CCmSmTransferEngine* NewL( MCmSmTransferObserver* aObserver, - CCmDmMain* aDBMngr, RPointerArray& aItems, - RArray& aItemIds ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aDBMngr, database manager - * @param aItems, reference to items array - * @param aItemIds, reference to item id array - * @return pointer to CCmSmTransferEngine class - */ - static CCmSmTransferEngine* NewLC( MCmSmTransferObserver* aObserver, - CCmDmMain* aDBMngr, RPointerArray& aItems, - RArray& aItemIds ); - - /** - * Destructor. - */ - virtual ~CCmSmTransferEngine(); - -public: - - /** - * Sets av controller - * - * @since S60 5.1 - * @param aAVControl, pointer to av controller - * @return None - */ - void SetAvController( MUPnPAVController* aAVController ); - - /** - * Lists media servers - * - * @since S60 5.1 - * @param aDevices, device list - * @return None - */ - void GetMediaServersL( CUpnpAVDeviceList*& aDevices ); - - /** - * Resets file arrays - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetFileArrays(); - - /** - * Cancel UPnP copy operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelCopy(); - - /** - * Copy files - * - * @since S60 5.1 - * @param aDevId, device identifier - * @param aDevice, device - * @return None - */ - void CopyFilesL( TUint8 aDevId, CUpnpAVDevice* aDevice ); - - /** - * Continue Copying files - * - * @since S60 5.1 - * @return None - */ - void ContinueCopyFilesL(); - - /** - * Transferred data - * - * @since S60 5.1 - * @param None - * @return data amount - */ - TInt DataAmount() const; - - /** - * Returns file list - * - * @since S60 5.1 - * @param None - * @return file array - */ - CDesCArray& FilesToBeRemoved(); - - /** - * Delete file list - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteToBeRemoved(); - - /** - * Returns file list - * - * @since S60 5.1 - * @param None - * @return file array - */ - CDesCArray& FilesToBeShrinked(); - - /** - * Delete file list - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteToBeShrinked(); - - /** - * Returns item ids which need to be deleted - * - * @since S60 5.1 - * @param None - * @return Item ids - */ - RArray& ToBeDeleted(); - - /** - * Cancel operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - -protected: - -// From base class MUPnPFileTransferSessionObserver - - /** - * From MUPnPFileTransferSessionObserver - * See base class definition - */ - void TransferStarted( TInt aKey, TInt aStatus ); - - /** - * From MUPnPFileTransferSessionObserver - * See base class definition - */ - void TransferCompleted( TInt aKey, TInt aStatus, - const TDesC& aFilePath ); - - /** - * From MUPnPFileTransferSessionObserver - * See base class definition - */ - void TransferProgress( TInt aKey, TInt aBytes, - TInt aTotalBytes ); - - /** - * From MUPnPFileTransferSessionObserver - * See base class definition - */ - void MediaServerDisappeared( - TUPnPDeviceDisconnectedReason aReason ); - -private: - - /** - * Copying one file - * - * @since S60 5.1 - * @param None - * @return None - */ - void CopySingleFileL(); - - /** - * Connects to device - * - * @since S60 5.1 - * @param aDevice to be connected - * @return None - */ - void ConnectedToDeviceL( const CUpnpAVDevice& aDevice ); - - /** - * Wait - * - * @since S60 5.1 - * @param aDelay, delay in seconds - * @return None - */ - void WaitForProgress( TInt aDelay ); - - /** - * Abort operation - * - * @since S60 5.1 - * @param aError, error code - * @return None - */ - void AbortTransfer( TInt aError ); - - /** - * Adds stored item to database - * - * @since S60 5.1 - * @param aFileName, name of the stored file - * @param aUDN, where file was stored - * @param aTimeStamp, time stamp for store - * @return None - */ - void AddStoredL( const TDesC& aFileName, const TDesC8& aUDN, - TTime aTimeStamp ); - - /** - * Handles item status values - * @param aKey, database id of item - * @return None - */ - void HandleItemStatusL( const TInt aKey ); - - /** - * Updates status - * - * @since S60 5.1 - * @param aStatus, status to be set - * @param aFid, file id - * @param aMsId, media server id - * @return None - */ - void UpdateStoreTransferStatus( TUint aStatus, TInt64 aFid, - TInt64 aMsId ); - - /** - * Returns index to transferred items array - * - * @since S60 5.1 - * @param aKey, database id - * @return index to item array - */ - TInt GetArrayIndex( TInt aKey ); - - /** - * Returns ETrue if file is already on server - * - * @since S60 5.1 - * @param aIndex, index to iItems array - * @return ETrue if file is duplicate - */ - TBool IsDuplicateL( const TInt aIndex ); - - /** - * Handle to copying files once - * - * @since S60 3.2 - * @param None - * @return None - */ - void CopyFilesOnceL(); - - /** - * Complete the copy process - * - * @since S60 3.2 - * @param None - * @return None - */ - void FinishCopy(); - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, transfer observer - * @param aDBMngr, database manager - * @param aItems, store items - * @param aItemIds, item ids - * @return None - */ - CCmSmTransferEngine( MCmSmTransferObserver* aObserver, - CCmDmMain* aDBMngr, RPointerArray& aItems, - RArray& aItemIds ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * Pointer to AV Controller - */ - MUPnPAVController* iAVController; // not owned - - /** - * Browse action Observer - */ - MCmSmTransferObserver* iObserver; // not owned - - /** - * Database manager - */ - CCmDmMain* iDBManager; // not owned - - /** - * File transfer started - */ - TTime iTransferStarted; - - /** - * Device - */ - CUpnpAVDevice* iDevice; // not owned - - /** - * File Data amount in kbytes - */ - TInt iTransferredData; - - /** - * Total transferred data amount in kbytes - */ - TInt iTotalTransferredData; - - /** - * Items to store - */ - RPointerArray& iItems; - - /** - * Ids of the selected store items - */ - RArray& iItemIds; - - /** - * Item ids to be deleted - */ - RArray iToBeDeleted; // owned - - /** - * Index of the processed file - */ - TInt iIndex; - - /** - * Index of the current mediaserver - */ - TUint8 iDevId; - - /** - * File to be removed - */ - CDesCArray* iFilesToBeRemoved; // owned - - /** - * File to be shrinked - */ - CDesCArray* iFilesToBeShrinked; // owned - - /** - * Database wrapper ( member variable because of performance issues ) - */ - MCmSqlMain* iDbWrapper; // owned - - /** Browse session */ - MUPnPFileUploadSession* iUploadSession; // not owned - - /** - * Transfer queue - */ - RArray iTransferQueue; - - /** - * Copy status - */ - TCmSmCopyStatus iCopyStatus; - - /** - * File server session - */ - RFs iFSession; - - }; - -#endif // __CMSMTRANSFERENGINE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferobserver.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmtransferobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2007 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: Callback interface -* -*/ - - - -#ifndef M_CMSMTRANSFEROBSERVER_H -#define M_CMSMTRANSFEROBSERVER_H - -#include "cmsmcommon.h" - -/** - * Callback interface class used to notify client - * about status changes in Upnp actions - * @lib cmstoremanager.lib - * @since S60 v3.1 - */ -class MCmSmTransferObserver - { - -public: - - /** - * Upnp action notifys - * @since S60 3.1 - * @param aStatus, transfer status - * @return None - */ - virtual void TransferStatus( TCmSmTransferStatus aStatus ) = 0; - - }; - -#endif // M_CMSMTRANSFEROBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngr.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngr.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +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: store file manager for images and videos -* -*/ - - - -#ifndef __CMSMVIDEOANDIMAGEMNGR_H -#define __CMSMVIDEOANDIMAGEMNGR_H - -#include -#include -#include -#include "cmcommontypes.h" -#include "cmcommon.h" -#include "cmsmcommon.h" - -// Forward declarations -class CMdESession; -class CMdENamespaceDef; -class CMdEObjectDef; -class CMdEObjectQuery; -class CMdEPropertyDef; -class CCmStoreListItem; -class CCmSmFileMngr; -class CMdEObject; -class MCmSmVideoAndImageMngrObserver; - -// CLASS DECLARATION - - /** - * Video and Image manager class definition - * - * @lib cmstoremanager.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmSmVideoAndImageMngr ): public CActive, - public MMdEQueryObserver - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @param aFileMngr, file manager - * @param aSession, mde session - * @param aItems, store list items - * @return pointer to CCmSmVideoAndImageMngr class - */ - static CCmSmVideoAndImageMngr* NewL( - MCmSmVideoAndImageMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, CMdESession& aSession, - RPointerArray& aItems ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer class - * @param aFileMngr, file manager - * @param aSession, mde session - * @param aItems, store list items - * @return pointer to CCmSmVideoAndImageMngr class - */ - static CCmSmVideoAndImageMngr* NewLC( - MCmSmVideoAndImageMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, CMdESession& aSession, - RPointerArray& aItems ); - - /** - * Destructor. - */ - virtual ~CCmSmVideoAndImageMngr(); - -public: - - /** - * Starts video/image list processing - * - * @since S60 5.1 - * @param aType, media type to be processed - * @return None - */ - void ProcessMedia( TCmMediaType aType ); - - /** - * Canceling file processing - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelOperation(); - - /** - * Canceling clf refress - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelListRefresh(); - - /** - * Filters files from the clf lists - * - * @since S60 5.1 - * @param None - * @return None - */ - void FilterItems(); - - /** - * Filters defined media files from the clf lists - * - * @since S60 5.1 - * @param aDeviceIds, devices - * @param aType, media type - * @return None - */ - void FilterNewItemsL( RArrayaDeviceIds, - TCmMediaType aType ); - -protected: - -// From base class MMdEQueryObserver - - /** - * From MMdEQueryObserver - * See base class definition - */ - void HandleQueryNewResults(CMdEQuery& aQuery, - TInt aFirstNewItemIndex, - TInt aNewItemCount); - - /** - * From MMdEQueryObserver - * See base class definition - */ - void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - - /** - * From CActive - * See base class definition - */ - TInt RunError( TInt aError ); - -private: - - /** - * Creates query for defined media type - * - * @since S60 5.1 - * @param aType, media type - * @return None - */ - void SetQueryAndStartFindL( TCmMediaType aType ); - - /** - * Sets property filters - * - * @since S60 5.1 - * @param None - * @return None - */ - void SetPropertyFiltersL( ); - - /** - * Sets logic condition - * - * @since S60 5.1 - * @param aType, media type ( phone or other ) - * @return None - */ - void SetLogicConditionL( TCmMediaType aType ); - - /** - * Resets mde query - * - * @since S60 5.1 - * @param None - * @return None - */ - void ResetQuery(); - - /** - * Completes request - * - * @since S60 5.1 - * @param aStatus, defined id for the completing - * @return None - */ - void CompleteRequest( TCmSmFileProcessingStatus aStatus ); - - /** - * Collects item info from mde objects - * - * @since S60 5.1 - * @param aType, media type - * @return TCmListItemStatus, list status value - */ - TCmListItemStatus CollectItemDataL( TCmMediaType aType ); - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, video and image manager observer - * @param aFileMngr, file manager - * @param aSession, Mde session - * @param aItems, Store items - * @return None - */ - CCmSmVideoAndImageMngr( - MCmSmVideoAndImageMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, CMdESession& aSession, - RPointerArray& aItems ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -private: - - /** - * Observer - */ - MCmSmVideoAndImageMngrObserver& iObserver; - - /** - * Reference to main file manager - */ - CCmSmFileMngr& iFileMngr; - - /** - * MdE session - */ - CMdESession& iSession; - - /** - * Reference to store list items - */ - RPointerArray& iItems; - - /** - * mde namespace - */ - CMdENamespaceDef* iNamespace; // owned - - /** - * Object definition ( Image/Video ) - */ - CMdEObjectDef* iObjectDef; // owned - - /** - * Object definition ( Image/Video ) - */ - CMdEObjectDef* iMediaTypeDef; // owned - - /** - * Object query - */ - CMdEObjectQuery* iQuery; // owned - - /** - * Queried property - */ - CMdEPropertyDef* iTitleDef; // owned - - /** - * Queried property - */ - CMdEPropertyDef* iSizeDef; // owned - - /** - * Queried property - */ - CMdEPropertyDef* iDateDef; // owned - - /** - * Metadata object array - */ - RPointerArray iObjects; // Owned - - /** - * Defines which media query is active - */ - TCmMediaType iQueriedMedia; - - }; - -#endif // __CMSMVIDEOANDIMAGEMNGR_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngrobserver.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngrobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: store file manager observer for images and videos -* -*/ - - - -#ifndef __CMSMVIDEOANDIMAGEMNGROBSERVER_H -#define __CMSMVIDEOANDIMAGEMNGROBSERVER_H - - -// CLASS DECLARATION - /** - * Video and image manager observer class definition - * - * @lib cmstoremanager.lib - * - * @since S60 v3.1 - */ -class MCmSmVideoAndImageMngrObserver - { -public: - - /** - * Call back for observer - * - * @since S60 5.1 - * @param aStatus, KErrNone if no errors, otherwise - * system wide error codes - * @return None - */ - virtual void ImagesAndVideosReady( const TInt aStatus ) = 0; - }; - -#endif // __CMSMVIDEOANDIMAGEMNGROBSERVER_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanager.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanager.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +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: Store manager interface -* -*/ - - -#ifndef M_CMSTOREMANAGER_H -#define M_CMSTOREMANAGER_H - -// INCLUDE FILES -#include -#include -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class MUPnPAVController; -class CCmSqlPropertyContainer; - -/** - * Defines the store manager interface - * - * This class defines the store manager interface. Provides methods to - * execute storing - * - * @lib cmstoremanager.lib - * - * @since S60 5.1 - */ -class MCmSmManager - { - -public: - - /** - * Starts store service - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void StartStoreL() = 0; - - /** - * Cancels store service - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void CancelOperation() = 0; - - /** - * Starts store list processing - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void PreProcessLists() = 0; - - /** - * Provides album list - * - * @since S60 5.1 - * @param aMedia, media type - * @param aArray, list of values - * @return None - */ - virtual void GetColItemsL( TCmMediaType aMedia, - CDesCArray& aArray ) = 0; - - /** - * Provides metadata column item list - * - * @since S60 5.1 - * @param aMedia, media type - * @param aPropertys, list of values - * @return None - */ - virtual void GetColItemsL( TCmMediaType aMedia, - CCmSqlPropertyContainer& aPropertys ) = 0; - - /** - * Sets av controller - * - * @since S60 5.1 - * @param aAVController, av controller pointer - * @return None - */ - virtual void SetAvController( MUPnPAVController* aAVController ) = 0; - - /** - * Closes the utility and deletes the object - * - * @since S60 5.1 - */ - virtual void Close() = 0; - }; - - -#endif // M_CMSTOREMANAGER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanagerfactory.h --- a/homesync/contentmanager/cmserver/cmstoremanager/inc/cmstoremanagerfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +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: Abstract factory for Store manager -* -*/ - - - -#ifndef C_CMSTOREMANAGERFACTORY_H -#define C_CMSTOREMANAGERFACTORY_H - -#include - -class MCmSmManager; -class MCmServiceObserver; -class CMdESession; -class CCmDmMain; -class CCmMmMain; - -/** - * Abstract factory for Store manager - * - * @lib cmstoremanager.lib - * - * @since S60 5.1 - */ -class CmStoreManagerFactory - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aSession, Mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return instance of Store manager - */ - IMPORT_C static MCmSmManager* NewStoreManagerL( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aObserver, observer pointer - * @param aSession, Mde session - * @param aDBManager, database manager - * @param aMemManager, memory manager - * @return instance of Store manager - */ - IMPORT_C static MCmSmManager* NewStoreManagerLC( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ); - - }; - -#endif // C_CMSTOREMANAGERFACTORY_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmclfmngr.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmclfmngr.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,450 +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: Store music file processing -* Version : %version: tr1ido#9.1.2 % << Don't touch! -* -*/ - - - -#include -#include -#include -#include -#include "upnpfileutility.h" - -#include "cmstorelistitem.h" -#include "cmsmfilemngr.h" -#include "cmsmclfmngr.h" -#include "msdebug.h" - -// CONSTANTS - _LIT( KCmSmIconExtension, ".fil" ); - _LIT( ROM1, "Z" ); - _LIT( ROM2, "z" ); -// Once filter maximum count; -const TInt KFilterMaxCount = 10; - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::NewL -// --------------------------------------------------------------------------- -// -CCmSmClfMngr* CCmSmClfMngr::NewL( MCmSmMusicMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, RPointerArray& aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewL() start")); - CCmSmClfMngr* self = CCmSmClfMngr::NewLC( - aObserver, aFileMngr, aItems ); - CleanupStack::Pop( self ); - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::NewLC -// --------------------------------------------------------------------------- -// -CCmSmClfMngr* CCmSmClfMngr::NewLC( MCmSmMusicMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, RPointerArray& aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewLC() start")); - CCmSmClfMngr* self = new ( ELeave ) CCmSmClfMngr( - aObserver, aFileMngr, aItems ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::~CCmSmClfMngr -// --------------------------------------------------------------------------- -// -CCmSmClfMngr::~CCmSmClfMngr() - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::\ - ~CCmSmClfMngr() start")); - Cancel(); - CancelClfRefresh(); - delete iNewAudioItems; - delete iNewImageItems; - delete iNewVideoItems; - delete iEngine; - delete iSortingStyle; - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::\ - ~CCmSmClfMngr() end")); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::CCmSmClfMngr -// --------------------------------------------------------------------------- -// -CCmSmClfMngr::CCmSmClfMngr( MCmSmMusicMngrObserver& aObserver, - CCmSmFileMngr& aFileMngr, RPointerArray& aItems ) - :CActive( EPriorityStandard ), - iObserver( aObserver ), iFileMngr( aFileMngr ), - iItems( aItems ) - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::ConstructL() - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::ConstructL()")); - iEngine = ContentListingFactory::NewContentListingEngineLC(); - CleanupStack::Pop(); - iNewAudioItems = iEngine->CreateListModelLC( *this ); - CleanupStack::Pop(); - - // Creating a temporary pointer since ContentListingFactory interface - // forces us to use LC-method and we don't want to assign an member - // variable with LC-method. - MCLFSortingStyle* sortingStyle = - ContentListingFactory::NewSortingStyleLC(); - CleanupStack::Pop(); // can't pop by name here - iSortingStyle = sortingStyle; - sortingStyle = NULL; - - iSortingStyle->SetOrdering( ECLFOrderingAscending ); - iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC ); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::CancelClfRefresh -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::CancelClfRefresh() - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::CancelClfRefresh()")); - if( iNewAudioItems ) - { - iNewAudioItems->CancelRefresh(); - } - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::CancelOperation() - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::CancelOperation")); - - if ( IsActive() ) - { - Cancel(); - } - CancelClfRefresh(); - iObserver.MusicReady( ECmSmProcessingCanceled ); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::SetupCLFListModelsL -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::SetupCLFListModelsL( TCmMediaType aMediaType ) - { - LOG(_L("[STORE MNGR]\t SetupCLFListModelsL")); - - RArray< TInt > mediaTypes; - CleanupClosePushL( mediaTypes ); - - switch(aMediaType) - { - case ECmAudio: - { - mediaTypes.AppendL( ECLFMediaTypeMusic ); - mediaTypes.AppendL( ECLFMediaTypeSound ); - iNewAudioItems->SetWantedMediaTypesL( mediaTypes.Array() ); - iNewAudioItems->SetSortingStyle( iSortingStyle ); - break; - } - default: - { - break; - } - } - CleanupStack::PopAndDestroy( &mediaTypes ); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::DoRefreshL -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::DoRefreshL( TCmMediaType aMediaType ) - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::DoRefreshL")); - - switch( aMediaType ) - { - case ECmAudio: - { - SetupCLFListModelsL( aMediaType ); - iNewAudioItems->RefreshL(); - break; - } - default: - { - LOG(_L("[STORE MNGR]\t DoRefreshL invariant media type")); - User::Invariant(); - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::FilterItemsL -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::FilterItemsL() - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::DoRefreshL")); - TRACE(Print( _L("[STORE MNGR]\t Filter file start index = %d"), - iFilterIndex ) ); - TCmSmFileProcessingStatus status = ECmSmNone; - if ( iFilterIndex < iNewAudioItems->ItemCount() ) - { - RArrayids; - CleanupClosePushL( ids ); - iFileMngr.MediaTypesL( ids, ECmAudio ); - FilterNewItemsL( iNewAudioItems, ids, ECmAudio ); - CleanupStack::PopAndDestroy( &ids ); - status = ECmSmContinueFiltering; - } - else - { - status = ECmSmFilteringReady; - } - - TRACE(Print( _L("[STORE MNGR]\t Filter file end index = %d"), - iFilterIndex ) ); - CompleteRequest( status ); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::FilterNewItemsL -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::FilterNewItemsL( MCLFItemListModel* aNewItems, - RArrayaDeviceIds, TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t Filtering defined media type items")); - - TInt allCount = aNewItems->ItemCount(); - - RArraystoreIds; - CleanupClosePushL( storeIds ); - RArraystoredIds; - CleanupClosePushL( storedIds ); - - // Copy all file names - TInt count = ( iFilterIndex + KFilterMaxCount ) <= allCount ? - KFilterMaxCount : ( allCount - iFilterIndex ); - TRACE(Print( _L("[STORE MNGR]\t FilterNewItemsL file count = %d"), - count ) ); - - TBool drm( EFalse ); - for ( TInt i = 0; i < count; i++ ) - { - storeIds.Reset(); - - // Copy ids into temporary array - for( TInt ll = 0; ll < aDeviceIds.Count(); ll++ ) - { - storeIds.Append(aDeviceIds[ll]); - } - - const MCLFItem& item = aNewItems->Item( iFilterIndex ); - // Fetch protection type - TPtrC fileName; - TPtrC path; - TInt32 size( 0 ); - TTime date; - TPtrC album; - TPtrC mediaType; - TPtrC pathAndFileName; - TPtrC fileExtension; - User::LeaveIfError( item.GetField( ECLFFieldIdPath, path )); - User::LeaveIfError( item.GetField( ECLFFieldIdFileName, fileName )); - User::LeaveIfError( item.GetField( ECLFFieldIdFileSize, size )); - User::LeaveIfError( item.GetField( ECLFFieldIdFileDate, date )); - User::LeaveIfError( item.GetField( ECLFFieldIdFileNameAndPath, - pathAndFileName )); - User::LeaveIfError( item.GetField( ECLFFieldIdFileExtension, - fileExtension ) ); - - // Album list is needed for UI use - TInt error( item.GetField( ECLFFieldIdAlbum, album ) ); - - TRACE(Print( _L("[STORE MNGR]\t %03d: %S"), i, &fileName ) ); - - // If the items is not an DRM item and album isn't in excluded list, - // it is a potential candidate to be added into list of - // files to transfer. - TRAP( error, drm = - UPnPFileUtility::IsFileProtectedL( pathAndFileName ) ); - TRACE( Print( _L("[STORE MNGR]\t IsFileProtectedL err = %d"), error)); - if ( pathAndFileName[0] != ROM1()[0] - && pathAndFileName[0] != ROM2()[0] - && !drm - && KErrNotFound == fileExtension.Match( KCmSmIconExtension ) ) - { - if( iFileMngr.CheckIsFilledFileL( pathAndFileName ) ) - { - storeIds.Reset(); - } - iFileMngr.IsAlreadyStoreL( pathAndFileName, storedIds, storeIds ); - // If file is already stored to every wanted server - // => no need to keep file on the list any longer - if( KErrNone < storeIds.Count() ) - { - TCmListItemStatus status; - CCmStoreListItem* item = CCmStoreListItem::NewLC(); - item->SetPrimaryTextL( fileName ); - item->SetPathL( pathAndFileName ); - item->SetSize( size ); - item->SetDate( date ); - item->SetListId( iFileMngr.RetrieveListId( aType ) ); - // Ms id values are binded with file status values - iFileMngr.RetrieveListStatusValues( aType, status ); - // Where item will be stored - for( TInt s = 0 ; s < storeIds.Count(); s++ ) - { - item->SetDevId( storeIds[s], status ); - } - // Where item has already been stored - for( TInt d = 0; d < storedIds.Count(); d++ ) - { - item->SetDevId( storedIds[d], ECmStored ); - } - iItems.AppendL( item ); - CleanupStack::Pop( item ); - } - storedIds.Reset(); - } - iFilterIndex++; - } - - CleanupStack::PopAndDestroy( &storedIds ); - CleanupStack::PopAndDestroy( &storeIds ); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::HandleOperationEventL -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::HandleOperationEventL( - TCLFOperationEvent aOperationEvent, TInt aError ) - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::HandleOperationEventL")); - - if ( aOperationEvent == ECLFRefreshComplete ) - { - switch ( aError ) - { - case KErrNone: - { - CompleteRequest( ECmSmAllRefreshed ); - break; - } - case KErrCancel: - { - iObserver.MusicReady( ECmSmProcessingCanceled ); - break; - } - default: - { - // Notify observer. - iObserver.MusicReady( ECmSmRefreshError ); - break; - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::CompleteRequest -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::CompleteRequest( - TCmSmFileProcessingStatus aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::CompleteRequest")); - - __ASSERT_DEBUG(!IsActive(),\ - User::Panic( KCmSmManager, KErrInUse )); - SetActive(); - TRequestStatus* pStatus = &iStatus; - User::RequestComplete( pStatus, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::RunL -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::RunL() - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmClfMngr::RunL\ - status = %d"), iStatus.Int() )); - - switch( iStatus.Int() ) - { - case ECmSmAllRefreshed: - { - CompleteRequest( ECmSmStartItemFiltering ); - break; - } - case ECmSmStartItemFiltering: - { - iFilterIndex = 0; - TRACE(Print( _L("[STORE MNGR]\t Need filter file count = %d"), - iNewAudioItems->ItemCount() ) ); - CompleteRequest( ECmSmContinueFiltering ); - break; - } - case ECmSmContinueFiltering: - { - FilterItemsL(); - break; - } - case ECmSmFilteringReady: - { - iObserver.MusicReady( KErrNone ); - break; - } - default: - { - LOG(_L("[STORE MNGR]\t Store file processing RunL default")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmClfMngr::DoCancel -// --------------------------------------------------------------------------- -// -void CCmSmClfMngr::DoCancel() - { - LOG(_L("[STORE MNGR]\t CCmSmClfMngr::DoCancel")); - } - -// End of file - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmcontentchangeobserver.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmcontentchangeobserver.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +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: Handles devices content change events -* -*/ - - -#include "cmsmcontentchangeobserver.h" -#include "cmsmfileprocessingobserver.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmSmContentChangeObserver::NewL -// --------------------------------------------------------------------------- -// -CCmSmContentChangeObserver* CCmSmContentChangeObserver::NewL( - CMdESession& aSession, - MCmSmFileProcessingObserver& aObserver ) - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewL() start")); - CCmSmContentChangeObserver* self = - CCmSmContentChangeObserver::NewLC( aSession, aObserver ); - CleanupStack::Pop( self ); - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmContentChangeObserver::NewLC -// --------------------------------------------------------------------------- -// -CCmSmContentChangeObserver* CCmSmContentChangeObserver::NewLC( - CMdESession& aSession, - MCmSmFileProcessingObserver& aObserver ) - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewLC() start")); - CCmSmContentChangeObserver* self = - new ( ELeave ) CCmSmContentChangeObserver( aSession, aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmContentChangeObserver::~CCmSmContentChangeObserver -// --------------------------------------------------------------------------- -// -CCmSmContentChangeObserver::~CCmSmContentChangeObserver() - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\ - ~CCmSmContentChangeObserver() start")); - TRAP_IGNORE( iMdSSession.RemoveObjectObserverL( *this ) ); - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\ - ~CCmSmContentChangeObserver() end")); - } - -// --------------------------------------------------------------------------- -// CCmSmContentChangeObserver::StartObserversL -// --------------------------------------------------------------------------- -// -void CCmSmContentChangeObserver::StartObserversL() - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::StartObserversL")); - - iMdSSession.AddObjectObserverL( *this ); - iStarted = ETrue; - } - -// --------------------------------------------------------------------------- -// CCmSmContentChangeObserver::IsStarted -// --------------------------------------------------------------------------- -// -TBool CCmSmContentChangeObserver::IsStarted() - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::IsStarted")); - - return iStarted; - } - -// --------------------------------------------------------------------------- -// CCmSmContentChangeObserver::HandleObjectNotification -// --------------------------------------------------------------------------- -// -void CCmSmContentChangeObserver::HandleObjectNotification( - CMdESession& /*aSession*/, - TObserverNotificationType /*aType*/, - const RArray& /*aObjectIdArray*/) - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\ - HandleObjectNotification")); - - iObserver.FileProcessingStatus( ECmSmContentChanged ); - } - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CCmSmContentChangeObserver::CCmSmContentChangeObserver( - CMdESession& aSession, - MCmSmFileProcessingObserver& aObserver ) : iMdSSession( aSession ), - iObserver( aObserver ) - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::\ - CCmSmContentChangeObserver")); - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSmContentChangeObserver::ConstructL() - { - LOG(_L("[STORE MNGR]\t CCmSmContentChangeObserver::ConstructL")); - - iStarted = EFalse; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmfilemngr.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmfilemngr.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1007 +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: Store file processing -* -*/ - - -#include -#include "cmdmmain.h" -#include "cmstorerule.h" -#include "cmstorelistitem.h" -#include "cmfilllistitem.h" -#include "cmsmfileprocessingobserver.h" -#include "cmsmcontentchangeobserver.h" -#include "cmsmvideoandimagemngr.h" -#include "cmsmclfmngr.h" -#include "cmsmiteminfo.h" -#include "cmsmmsinfo.h" -#include "cmsmfilemngr.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KCmSmIniStoreTransferSpeed = 200; // 200 kBs -const TInt KCmSmIniStoreTransferTime = 1; // One second - - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::NewL -// --------------------------------------------------------------------------- -// -CCmSmFileMngr* CCmSmFileMngr::NewL( - MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBMngr, RPointerArray& aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewL() start")); - CCmSmFileMngr* self = CCmSmFileMngr::NewLC( - aObserver, aSession, aDBMngr, aItems ); - CleanupStack::Pop( self ); - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::NewLC -// --------------------------------------------------------------------------- -// -CCmSmFileMngr* CCmSmFileMngr::NewLC( - MCmSmFileProcessingObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBMngr, - RPointerArray& aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewLC() start")); - CCmSmFileMngr* self = new ( ELeave ) CCmSmFileMngr( - aObserver, aDBMngr, aItems ); - CleanupStack::PushL( self ); - self->ConstructL( aSession ); - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::~CCmSmFileMngr -// --------------------------------------------------------------------------- -// -CCmSmFileMngr::~CCmSmFileMngr() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::\ - ~CCmSmFileMngr() start")); - Cancel(); - - delete iVideoAndImageMngr; - delete iClfMusicMngr; - iRuleArray.ResetAndDestroy(); - iRuleArray.Close(); - - iFilledItems.ResetAndDestroy(); - iFilledItems.Close(); - - iStoredArray.ResetAndDestroy(); - iStoredArray.Close(); - - iMsIds.ResetAndDestroy(); - iMsIds.Close(); - - iMediaTypes.Reset(); - iMediaTypes.Close(); - - delete iCcObserver; - - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::\ - ~CCmSmFileMngr() end")); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::CCmSmFileMngr -// --------------------------------------------------------------------------- -// -CCmSmFileMngr::CCmSmFileMngr( - MCmSmFileProcessingObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems ) - :CActive( EPriorityStandard ), - iObserver( aObserver ), iDBManager( aDBMngr ), iItems( aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CCmSmFileMngr()")); - - CActiveScheduler::Add( this ); - iTransferInfo.iTotalItems = KErrNone; - iTransferInfo.iProcessedItems = KErrNone; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ConstructL( CMdESession& aSession ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ConstructL()")); - iVideoAndImageMngr = - CCmSmVideoAndImageMngr::NewL( *this, *this, aSession, iItems ); - iClfMusicMngr = CCmSmClfMngr::NewL( *this, *this, iItems ); - iCcObserver = - CCmSmContentChangeObserver::NewL( aSession, *iObserver ); - iProcessingStatus = ECmSmNone; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::StartProcessing -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::StartProcessing() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::StartProcessing()")); - - iTransferInfo.iTotalItems = KErrNone; - iTransferInfo.iProcessedItems = KErrNone; - if( !iCcObserver->IsStarted() ) - { - TRAPD( err, iCcObserver->StartObserversL() ); - if( err ) - { - TRACE(Print( _L("[STORE MNGR] StartObserversL err = %d"), - err ) ); - } - } - CompleteRequest( ECmSmPreProcessingStarted ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ProcessAlbumList -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ProcessAlbumList( TCmMediaType /*aMedia*/, - CDesCArray& /*aArray*/ ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessAlbumList()")); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::StoreItemCount -// --------------------------------------------------------------------------- -// -TInt CCmSmFileMngr::StoreItemCount() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::StoreItemCount()")); - - return iDBManager->StoreFileCount( - ECmToBeRemoved|ECmToBeShrinked|ECmKeepOnDevice ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::FillItemCount -// --------------------------------------------------------------------------- -// -TInt CCmSmFileMngr::FillItemCount() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::FillItemCount()")); - - return iDBManager->FillFileCount( ECmToBeShrinked|ECmToBeFilled ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::GetStoreFileCountNoDuplicatesL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::GetStoreFileCountNoDuplicatesL( TInt& aCount ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::\ - GetStoreFileCountNoDuplicatesL()")); - - iDBManager->GetStoreFileCountNoDuplicatesL( aCount, - ECmToBeRemoved|ECmToBeShrinked|ECmKeepOnDevice ); - TRACE(Print( _L("[STORE MNGR] GetStoreFileCountNoDuplicatesL count = %d"), - aCount ) ); - TInt count = 0; - TInt time = 0; - iDBManager->GetTransferInfo( ECmServiceStore, count, time ); - iDBManager->UpdateTransferInfo( ECmServiceStore, aCount, - time ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::UpdateTransferHistoryData -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::UpdateTransferHistoryData( - TInt64 aInterval, TInt64 aDataAmount, - TUint8 aServerId ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::UpdateTransferHistoryData()")); - - iDBManager->UpdateUploadHistory( aServerId, - aDataAmount, aInterval ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::CancelOperation() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CancelOperation()")); - - Cancel(); - iVideoAndImageMngr->CancelOperation(); - iClfMusicMngr->CancelOperation(); - iObserver->FileProcessingStatus( ECmSmProcessingCanceled ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ImagesAndVideosReady -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ImagesAndVideosReady( const TInt /*aStatus*/ ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ImagesAndVideosReady()")); - - CompleteRequest( ECmSmMediaTypesSelected ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::MusicReady -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::MusicReady( const TInt /*aStatus*/ ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::MusicReady()")); - - CompleteRequest( ECmSmMediaTypesSelected ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::LoadSelectedStoreRulesL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::LoadSelectedStoreRulesL() - { - LOG(_L("[FILL MNGR]\t CCmSmFileMngr::LoadSelectedStoreRulesL()")); - - RPointerArray array; - CleanupClosePushL( array ); - iDBManager->PrepareQueryCmdL( ESelectedStoreRuleQuery ); - iDBManager->QuerySelectedStoreRuleNamesL( array, 1 ); - // Load selected store rules to array ( using names as a qyery - // parameter ) - for( TInt i = 0; i < array.Count(); i++ ) - { - CCmStoreRule* storeRule = CCmStoreRule::NewLC(); - iDBManager->PrepareQueryCmdL(EStoreRuleQuery); - storeRule->SetNameL( *array[i] ); - iDBManager->QueryStoreRuleL( storeRule ); - iRuleArray.AppendL( storeRule ); - CleanupStack::Pop(storeRule); - } - array.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &array ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ProcessStoreRules -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ProcessStoreRules() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessStoreRules()")); - - TPtrC8 mediaServer; - for( TInt i = iRuleArray.Count() - 1; i >= 0; i-- ) - { - if( KErrNone == iRuleArray[i]->MediaServerCount() ) - { - // If no servers defined => DO NOT use rule at all - // First delete the object - delete iRuleArray[i]; - // Then delete the pointer - iRuleArray.Remove(i); - LOG(_L("[STORE MNGR]\t Store rule doesn't have any \ - defined servers")); - LOG(_L("[STORE MNGR]\t ******* ==> RULE SKIPPED \ - ******************")); - } - else - { - // Do nothing - } - } - iRuleArray.Compress(); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::LoadFilledAndStoredL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::LoadFilledAndStoredL() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadFilledAndStoredL()")); - - LoadMediaServerIdsL(); - LoadFilledL(); - for( TInt i = 0; i < iMsIds.Count(); i++ ) - { - LoadStoredL( *iMsIds[i]->iUuid ); - } - CompleteRequest( ECmSmAllLoaded ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::LoadFilledL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::LoadFilledL() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadFilledL()")); - - iFilledItems.ResetAndDestroy(); - iFilledItems.Close(); - iDBManager->PrepareQueryCmdL(EAllFillFilesStatusQuery); - iDBManager->GetAllFillFilesL( - iFilledItems,ECmFilled|ECmToBeRemoved|ECmLocalCopy ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::LoadStoredL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::LoadStoredL( const TDesC8& aUDN ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadStoredL()")); - - // Load to spesific server filled items - iDBManager->PrepareQueryCmdL( EMediaServerIdQuery ); - TInt64 id( iDBManager->QueryMediaServerId( aUDN ) ); - if( KErrNone < id ) - { - RPointerArray array; - CleanupClosePushL( array ); - iDBManager->PrepareQueryCmdL(EStoredRowQuery); - iDBManager->QueryStoredRowL( array, aUDN, KErrNotFound ); - for( TInt i = 0; i < array.Count(); i++ ) - { - CCmSmItemInfo* storedItemInfo = - CCmSmItemInfo::NewLC( *array[i], id ); - iStoredArray.Append( storedItemInfo ); - CleanupStack::Pop( storedItemInfo ); - } - // Ownership didn't change, reset and destroy - array.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &array ); - } - else - { - LOG(_L("[STORE MNGR]\t No media server id found")); - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ResetFilledArray -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ResetFilledArray() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ResetFilledArray()")); - - iFilledItems.ResetAndDestroy(); - iFilledItems.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::SelectMediaTypes -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::SelectMediaTypes() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::SelectMediaTypes()")); - - TCmMediaType mediaType; - for( TInt i = 0; i < iRuleArray.Count(); i++ ) - { - for( TInt j = 0; j < iRuleArray[i]->DefCount(); j++ ) - { - iRuleArray[i]->StoreRule( j, &mediaType ); - if( KErrNotFound == iMediaTypes.Find( mediaType ) ) - { - iMediaTypes.Append( mediaType ); - } - } - } - iRefreshIndex = 0; - CompleteRequest( ECmSmMediaTypesSelected ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::CheckIsFilledFileL -// --------------------------------------------------------------------------- -// -TBool CCmSmFileMngr::CheckIsFilledFileL( const TDesC& aPathAndFileName ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CheckIsFilledFileL()")); - - TBool processed( EFalse ); - // Check if file is filled from some listed server - for( TInt j = 0; j < iFilledItems.Count() && !processed; j++ ) - { - if( KErrNotFound != aPathAndFileName.FindC( - iFilledItems[j]->Path() ) ) - { - LOG(_L("[STORE MNGR]\t Filled file!!!")); - LOG(_L("[STORE MNGR]\t File not stored!!!")); - processed = ETrue; - // End loop - j = iFilledItems.Count(); - } - } - return processed; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::IsAlreadyStoreL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::IsAlreadyStoreL( const TDesC& aPathAndFileName, - RArray& aStoredIds, RArray& aStoreIds ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::IsAlreadyStoreL()")); - - // Check if file is already stored to some of the defined servers - for( TInt k = 0; k < iStoredArray.Count() ;k++ ) - { - if( KErrNone == iStoredArray[k]->iFile-> - Compare( aPathAndFileName ) ) - { - for( TInt l = aStoreIds.Count() - 1; l >= 0; l-- ) - { - if( aStoreIds[l] == iStoredArray[k]->iId ) - { - aStoredIds.Append( aStoreIds[l] ); - aStoreIds.Remove(l); - LOG(_L("[STORE MNGR]\t Stored file!!!")); - } - } - aStoreIds.Compress(); - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::MediaTypesL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::MediaTypesL( RArray& aIds, TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::MediaTypesL()")); - - // Loop for store rules - for( TInt i = 0; i < iRuleArray.Count(); i++ ) - { - TBool addServers = EFalse; - TInt msCount(iRuleArray[i]->MediaServerCount()); - TInt defCount( iRuleArray[i]->DefCount() ); - TCmMediaType temptype; - - // In specific store rule, loop to check if the rule has relevant - // media type. - for( TInt n = 0; n < defCount; n++ ) - { - iRuleArray[i]->StoreRule(n, &temptype ); - if( aType == temptype ) - { - addServers = ETrue; - } - } - if( addServers ) - { - // Loop for media servers - for( TInt k = 0; k < msCount ; k++ ) - { - const TPtrC8 ms = iRuleArray[i]->MediaServerL( k ); - - // To find if Uuid of ms has been in iMsIds. - for( TInt l = 0 ; l < iMsIds.Count(); l++ ) - { - if( KErrNone == ms.Compare( *iMsIds[l]->iUuid ) ) - { - aIds.InsertInOrderL( iMsIds[l]->iId ); - // End loop - l = iMsIds.Count(); - } - } - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::LoadMediaServerIdsL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::LoadMediaServerIdsL() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadMediaServerIdsL()")); - - TInt64 id(KErrNone); - RArray tempIds; - CleanupClosePushL( tempIds ); - for( TInt i = 0; i < iRuleArray.Count(); i++ ) - { - for( TInt j = 0 ; j < iRuleArray[i]->MediaServerCount(); j++ ) - { - const TDesC8& mediaServer = iRuleArray[i]->MediaServerL( j ); - iDBManager->PrepareQueryCmdL( EMediaServerIdQuery ); - id = iDBManager->QueryMediaServerId( mediaServer ); - if( KErrNone < id && KErrNotFound == tempIds.Find(id) ) - { - HBufC8* uuid = mediaServer.AllocLC(); - CCmSmMsInfo* msInfo = CCmSmMsInfo::NewLC( *uuid, id ); - tempIds.AppendL(id); - iMsIds.AppendL(msInfo); - CleanupStack::Pop( msInfo ); - CleanupStack::PopAndDestroy( uuid ); - } - } - } - tempIds.Reset(); - CleanupStack::PopAndDestroy( &tempIds ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::GetDevId -// --------------------------------------------------------------------------- -// -TInt64 CCmSmFileMngr::GetDevId( const TDesC8& aUuid ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::GetDevId()")); - - TInt64 id( KErrNone ); - TBool flag( EFalse ); - for( TInt i = 0; i < iMsIds.Count() && !flag; i++ ) - { - if( KErrNotFound != iMsIds[i]->iUuid->Match( aUuid ) ) - { - id = iMsIds[i]->iId; - flag = ETrue; - } - } - return id; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::GetItemsL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::GetItemsL( RArray& aItemIds, - const TDesC8& aUuid, TInt64& aId ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::GetItemsL()")); - - aItemIds.Reset(); - - RArrayids; - RArray statusValues; - - aId = GetDevId( aUuid ); - for( TInt i = 0; i < iItems.Count() && aId != KErrNone; i++ ) - { - ids = iItems[i]->DevIds(); - statusValues = iItems[i]->StatusValues(); - TInt index( ids.FindInOrder( aId ) ); - if( KErrNotFound != index ) - { - TBool itemOnSelectedList( EFalse ); - // check that item belongs to selected list - for ( TInt j = 0; j < iRuleArray.Count(); j++ ) - { - CCmStoreRule* rule = iRuleArray[j]; - if ( iItems[i]->ListId() == rule->ListId() ) - { - itemOnSelectedList = ETrue; - } - } - - // Check that item isn't stored yet - if( index < statusValues.Count() ) - { - if( itemOnSelectedList && - ECmStored != statusValues[ index ] ) - { - aItemIds.AppendL( i ); - } - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::UpdateStoreFileListL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::UpdateStoreFileListL() - { - TRACE( Print( _L("[STORE MNGR]\t UpdateStoreFileListL iItemsCount = %d"), - iItems.Count() )); - - iDBManager->DeleteStoreFiles(); - iDBManager->SetStoreFilesL( iItems ); - iItems.ResetAndDestroy(); - iItems.Close(); - CalculateAvgTransferTimeL(); - SendAvgTransferTime(); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::LoadStoreFileListL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::LoadStoreFileListL() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::LoadStoreFileListL()")); - - iItems.ResetAndDestroy(); - iItems.Close(); - ResetArrays(); - LoadSelectedStoreRulesL(); - ProcessStoreRules(); - LoadMediaServerIdsL(); - - iDBManager->PrepareQueryCmdL( EAllStoreFilesQuery ); - iDBManager->QueryAllStoreFilesL( iItems ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::RetrieveListId -// --------------------------------------------------------------------------- -// -TInt64 CCmSmFileMngr::RetrieveListId( TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::RetrieveListId()")); - - TCmMediaType type; - TUint id( KErrNone ); - TBool flag( EFalse ); - for( TInt i = 0; i < iRuleArray.Count() && !flag; i++ ) - { - TInt defCount = iRuleArray[i]->DefCount(); - for( TInt j = 0; j < defCount && !flag; j++ ) - { - iRuleArray[i]->StoreRule( j, &type ); - if( type == aType ) - { - flag = ETrue; - id = iRuleArray[i]->ListId(); - } - } - } - return id; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::RetrieveListStatusValues -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::RetrieveListStatusValues( TCmMediaType aType, - TCmListItemStatus& aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::RetrieveListStatusValues()")); - - TCmMediaType type; - TBool flag( EFalse ); - for( TInt i = 0; i < iRuleArray.Count() && !flag; i++ ) - { - TInt defCount = iRuleArray[i]->DefCount(); - for( TInt j = 0; j < defCount && !flag; j++ ) - { - iRuleArray[i]->StoreRule( j, &type ); - if( type == aType ) - { - flag = ETrue; - // Set found status value - aStatus = iRuleArray[i]->Status(); - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::DeleteItems -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::DeleteItems( RArray& aIds ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::DeleteItems()")); - - TInt i( 0 ); - // aIds has indexes to iItems array. - while( aIds.Count() ) - { - if( ( aIds[0] - i ) < iItems.Count() ) - { - delete iItems[aIds[0] - i]; - iItems.Remove( aIds[0] - i ); - aIds.Remove(0); - } - i++; - } - iItems.Compress(); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ResetArrays -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ResetArrays() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ResetArrays()")); - - // Let's reset all needed array - iRuleArray.ResetAndDestroy(); - iRuleArray.Close(); - - iFilledItems.ResetAndDestroy(); - iFilledItems.Close(); - iStoredArray.ResetAndDestroy(); - iStoredArray.Close(); - - iMsIds.ResetAndDestroy(); - iMsIds.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ProcessMedia -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ProcessMedia( TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessMedia")); - switch( aType ) - { - case ECmAudio: - { - ProcessMusics(); - break; - } - case ECmVideo: // Fall through - case ECmImage: // Fall through - case ECmOtherImage: // Fall through - case ECmOtherVideo: // Fall through - { - iVideoAndImageMngr->ProcessMedia( aType ); - break; - } - default: - { - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::ProcessMusics -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::ProcessMusics() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::ProcessMusics()")); - - TRAPD( err, iClfMusicMngr->DoRefreshL( ECmAudio ) ); - if( err ) - { - TRACE( Print( _L( "ProcessMusics err = %d"), err )); - CompleteRequest( ECmSmPreProcessingReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::CalculateAvgTransferTimeL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::CalculateAvgTransferTimeL() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CalculateAvgTransferTimeL()")); - - TInt64 ud(KErrNone); - TInt64 dd(KErrNone); - TInt64 ut(KErrNone); - TInt64 dt(KErrNone); - TInt64 size( KErrNone ); - TInt64 shrinkTime(KErrNone); - TInt64 transferTime(KErrNone); - for( TInt i = 0; i < iMsIds.Count(); i++ ) - { - iDBManager->PrepareQueryCmdL(ETransferHistoryQuery); - iDBManager->QueryTransferHistory( - *iMsIds[i]->iUuid, dd, ud, dt, ut ); - size = iDBManager->KBytesToBeStored( iMsIds[i]->iId, - ECmToBeRemoved|ECmToBeShrinked|ECmKeepOnDevice ); - if( ud == KErrNone || ut == KErrNone ) - { - ud = KCmSmIniStoreTransferSpeed; - ut = KCmSmIniStoreTransferTime; - } - transferTime = transferTime + (( ut * size ) / ud ); - } - - TInt shrinkCount( iDBManager->StoreFileCount(ECmToBeShrinked) ); - - shrinkTime = (iDBManager->GetAvgImageShrinkTime() * shrinkCount); - - TInt totalCount(KErrNone); - totalCount = iDBManager->StoreFileCountNoDuplicates(); - transferTime = transferTime + (shrinkTime / 1000 ); - if( KErrNone >= totalCount ) - { - transferTime = KErrNone; - } - iDBManager->UpdateTransferInfo( ECmServiceStore, totalCount, - transferTime ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::SendAvgTransferTime -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::SendAvgTransferTime() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::SendAvgTransferTime()")); - - iDBManager->GetTransferInfo( ECmServiceStore, - iTransferInfo.iProcessedItems, iTransferInfo.iTotalItems ); - iTransferInfo.iService = ECmServiceTransferInfoStore; - - TRACE( Print( _L("[STORE MNGR]\t Store file count %d"), - iTransferInfo.iProcessedItems)); - - TCmProgressInfoPckg transferInfoPckg( iTransferInfo ); - - TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, - transferInfoPckg ); - - TRACE( Print( _L("[STORE MNGR]\t RProperty::Set returned %d"), err)); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::SetProcessingStatus -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::SetProcessingStatus( TCmSmFileProcessingStatus aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::SetProcessingStatus()")); - - iProcessingStatus = aStatus; - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::CompleteRequest -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::CompleteRequest( - TCmSmFileProcessingStatus aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::CompleteRequest()")); - - __ASSERT_DEBUG(!IsActive(),\ - User::Panic( KCmSmManager, KErrInUse )); - SetActive(); - TRequestStatus* pStatus = &iStatus; - User::RequestComplete( pStatus, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::RunL -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::RunL() - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmFileMngr::RunL\ - status = %d"), iStatus.Int() )); - switch( iStatus.Int() ) - { - case ECmSmPreProcessingStarted: - { - LoadSelectedStoreRulesL(); - CompleteRequest( ECmSmStoreRulesLoaded ); - break; - } - case ECmSmStoreRulesLoaded: - { - ProcessStoreRules(); - if( KErrNone < iRuleArray.Count() ) - { - CompleteRequest( ECmSmLoadFilledAndStored ); - } - else - { - // No selected rules => Delete all store files - TInt err( iDBManager->DeleteStoreFiles() ); - TRACE(Print(_L("[STORE MNGR]\t DeleteStoreFiles error = %d"), - err )); - CalculateAvgTransferTimeL(); - SendAvgTransferTime(); - iObserver->FileProcessingStatus( ECmSmNoStoreRulesSelected ); - } - break; - } - case ECmSmLoadFilledAndStored: - { - LoadFilledAndStoredL(); - break; - } - case ECmSmAllLoaded: - { - SelectMediaTypes(); - break; - } - case ECmSmMediaTypesSelected: - { - if( iMediaTypes.Count() > iRefreshIndex ) - { - ProcessMedia( iMediaTypes[iRefreshIndex] ); - iRefreshIndex++; - if( iProcessingStatus == ECmSmProcessingFilesStarted ) - { - iObserver->FileProcessingStatus( iProcessingStatus ); - iProcessingStatus = ECmSmNone; - } - } - else - { - LOG(_L("[STORE MNGR]\t Store list processing ready")); - UpdateStoreFileListL(); - CompleteRequest( ECmSmPreProcessingReady ); - } - break; - } - case ECmSmPreProcessingReady: - { - ResetArrays(); - if( iProcessingStatus == ECmSmProcessingFilesStarted ) - { - iObserver->FileProcessingStatus( iProcessingStatus ); - iProcessingStatus = ECmSmNone; - } - iObserver->FileProcessingStatus( ECmSmPreProcessingReady ); - break; - } - default: - { - LOG(_L("[STORE MNGR]\t Store file processing RunL default")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::DoCancel -// --------------------------------------------------------------------------- -// -void CCmSmFileMngr::DoCancel() - { - LOG(_L("[STORE MNGR]\t CCmSmFileMngr::DoCancel()")); - } - -// --------------------------------------------------------------------------- -// CCmSmFileMngr::RunError -// --------------------------------------------------------------------------- -// -TInt CCmSmFileMngr::RunError( TInt aError ) - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmFileMngr::RunError\ - aError = %d"), aError )); - return aError; - } - -// End of file - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmiteminfo.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmiteminfo.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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: Store item info class -* -*/ - - -#include "cmsmiteminfo.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmSmItemInfo::NewL -// --------------------------------------------------------------------------- -// -CCmSmItemInfo* CCmSmItemInfo::NewL( TDesC& aFile, TInt64 aId ) - { - LOG(_L("[STORE MNGR]\t CCmSmItemInfo::NewL")); - - CCmSmItemInfo* self = CCmSmItemInfo::NewLC( aFile, aId ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmItemInfo::NewLC -// --------------------------------------------------------------------------- -// -CCmSmItemInfo* CCmSmItemInfo::NewLC( TDesC& aFile, TInt64 aId ) - { - LOG(_L("[STORE MNGR]\t CCmSmItemInfo::NewLC")); - - CCmSmItemInfo* self = new ( ELeave ) CCmSmItemInfo(); - CleanupStack::PushL( self ); - self->ConstructL( aFile, aId ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmItemInfo::~CCmSmItemInfo -// --------------------------------------------------------------------------- -// -CCmSmItemInfo::~CCmSmItemInfo() - { - LOG(_L("[STORE MNGR]\t CCmSmItemInfo::~CCmSmItemInfo")); - - delete iFile; - } - -// --------------------------------------------------------------------------- -// CCmSmItemInfo::CCmSmItemInfo -// --------------------------------------------------------------------------- -// -CCmSmItemInfo::CCmSmItemInfo() - { - LOG(_L("[STORE MNGR]\t CCmSmItemInfo::CCmSmItemInfo")); - } - -// --------------------------------------------------------------------------- -// CCmSmItemInfo::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSmItemInfo::ConstructL( TDesC& aFile, TInt64 aId ) - { - LOG(_L("[STORE MNGR]\t CCmSmItemInfo::ConstructL")); - - iFile = aFile.AllocL(); - iId = aId; - } - -// End of file - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmain.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmain.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,778 +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: Main class in Store manager component -* -*/ - - -#include -#include "upnpavdevice.h" -#include "upnpavcontroller.h" -#include "upnpavdevicelist.h" -#include -#include "cmserviceobserver.h" -#include "cmsmfilemngr.h" -#include "cmsmtransferengine.h" -#include "cmstorelistitem.h" -#include "cmdmmain.h" -#include "cmmmmain.h" -#include "cmsmmain.h" -#include "msdebug.h" - -// One file transfered -const TInt KCmOneFile = 1; -const TInt KCmSmClfRefreshInterval = 15000000; -const TInt KCmSmOneSecond = 1000000; - -// --------------------------------------------------------------------------- -// CCmSmMain::NewL -// --------------------------------------------------------------------------- -// -CCmSmMain* CCmSmMain::NewL( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::NewL() start")); - CCmSmMain* self = CCmSmMain::NewLC( aObserver, aSession, - aDBManager, aMemManager ); - CleanupStack::Pop( self ); - LOG(_L("[STORE MNGR]\t CCmSmMain::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmMain::NewLC -// --------------------------------------------------------------------------- -// -CCmSmMain* CCmSmMain::NewLC( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::NewLC() start")); - CCmSmMain* self = new ( ELeave ) CCmSmMain( aObserver, aDBManager, - aMemManager ); - CleanupStack::PushL( self ); - self->ConstructL( aSession, aDBManager ); - LOG(_L("[STORE MNGR]\t CCmSmMain::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmMain::~CCmSmMain -// --------------------------------------------------------------------------- -// -CCmSmMain::~CCmSmMain() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::~CCmSmMain() start")); - Cancel(); - delete iCmSmTransferEngine; - delete iCmSmFileMngr; - DeleteDevices(); - iItems.ResetAndDestroy(); - iItems.Close(); - iItemIds.Reset(); - iItemIds.Close(); - delete iPeriodic; - LOG(_L("[STORE MNGR]\t CCmSmMain::~CCmSmMain() end")); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::CCmSmMain -// --------------------------------------------------------------------------- -// -CCmSmMain::CCmSmMain( MCmServiceObserver* aObserver, CCmDmMain* aDBManager, - CCmMmMain* aMemManager ) - : CActive( EPriorityStandard ), iObserver( aObserver ), - iMemManager( aMemManager ), iDbManager( aDBManager ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::CCmSmMain")); - - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSmMain::ConstructL( CMdESession& aSession, CCmDmMain* aDBManager ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::ConstructL() start")); - iService = ECmServiceNone; - iCmSmTransferEngine = - CCmSmTransferEngine::NewL( this, aDBManager, iItems, iItemIds ); - iCmSmFileMngr = - CCmSmFileMngr::NewL( this, aSession, aDBManager, iItems ); - LOG(_L("[STORE MNGR]\t CCmSmMain::ConstructL() end")); - iProgressInfo.iService = ECmServiceStore; - } - -// --------------------------------------------------------------------------- -// CCmSmMain::StartStoreL -// --------------------------------------------------------------------------- -// -void CCmSmMain::StartStoreL() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::StartStoreL()")); - if( iService == ECmServiceAutomStoreListProcess ) - { - iCmSmFileMngr->CancelOperation(); - } - iCancelOnGoing = EFalse; - iService = ECmServiceStore; - iMemManager->SetObserver( *this ); - iDeviceIndex = KErrNone; - iProgressInfo.iService = ECmServiceStore; - iProgressInfo.iProcessedItems = KErrNone; - iProgressInfo.iTotalItems = iCmSmFileMngr->StoreItemCount() + - iCmSmFileMngr->FillItemCount(); - SendProgressInfo( KErrNone ); - ChangeState( ECmSmGetMediaServers ); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmSmMain::CancelOperation() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::CancelOperation()")); - // If some files need to be removed or shrinked do it now - iCancelOnGoing = ETrue; - iItems.ResetAndDestroy(); - iItems.Close(); - iItemIds.Reset(); - iItemIds.Close(); - iCmSmFileMngr->CancelOperation(); - iCmSmTransferEngine->CancelOperation(); - iObserver->ServiceExecuted( iService, KErrCancel ); - // Service finished. Reset progress info. - iProgressInfo.iService = ECmServiceNone; - iService = ECmServiceNone; - SendProgressInfo( KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::PreProcessLists -// --------------------------------------------------------------------------- -// -void CCmSmMain::PreProcessLists() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::PreProcessLists")); - - iCancelOnGoing = EFalse; - if( iService == ECmServiceAutomStoreListProcess ) - { - iCmSmFileMngr->CancelOperation(); - iCmSmFileMngr->SetProcessingStatus( ECmSmProcessingFilesStarted ); - } - else - { - ChangeState( ECmSmStartFileProcessing ); - } - - iService = ECmServicePreProcessingStore; - } - -// --------------------------------------------------------------------------- -// CCmSmMain::GetColItemsL -// --------------------------------------------------------------------------- -// -void CCmSmMain::GetColItemsL( TCmMediaType aMedia, - CDesCArray& aArray ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::GetColItemsL")); - - iCancelOnGoing = EFalse; - if( iService == ECmServiceAutomStoreListProcess ) - { - iCmSmFileMngr->CancelOperation(); - } - iService = ECmServiceGetStoreFields; - iCmSmFileMngr->ProcessAlbumList( aMedia, aArray ); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::GetColItemsL -// --------------------------------------------------------------------------- -// -void CCmSmMain::GetColItemsL( TCmMediaType /*aMedia*/, - CCmSqlPropertyContainer& /*aPropertys*/ ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::GetColItemsL")); - - iService = ECmServiceGetFillFields; - ChangeState( ECmSmFinishing ); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::SetAvController -// --------------------------------------------------------------------------- -// -void CCmSmMain::SetAvController( MUPnPAVController* aAVController ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::SetAvController")); - - iCmSmTransferEngine->SetAvController(aAVController); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::FileProcessingStatus -// --------------------------------------------------------------------------- -// -void CCmSmMain::FileProcessingStatus( TCmSmFileProcessingStatus aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::FileProcessingStatus()")); - - CancelMdETimer(); - switch(aStatus) - { - case ECmSmProcessingFilesStarted: - { - if( iService == ECmServicePreProcessingStore ) - { - ChangeState( ECmSmStartFileProcessing ); - } - break; - } - case ECmSmProcessingFilesReady: - { - break; - } - case ECmSmProcessingCanceled: - { - break; - } - case ECmSmNoStoreRulesSelected: - { - if( iService == ECmServiceAutomStoreListProcess ) - { - // Do not complete message - } - else - { - ChangeState( ECmSmFinishing ); - } - break; - } - case ECmSmPreProcessingReady: - { - if( iService == ECmServiceAutomStoreListProcess ) - { - // Do not complete message - } - else - { - iObserver->ServiceExecuted( iService, KErrNone ); - } - iService = ECmServiceNone; - break; - } - case ECmSmRefreshError: - { - if( iService == ECmServiceAutomStoreListProcess ) - { - // Do not complete message - } - else - { - iObserver->ServiceExecuted( iService, - KErrGeneral ); - } - iService = ECmServiceNone; - break; - } - case ECmSmAlbumProcessingReady: - { - if( iService == ECmServiceAutomStoreListProcess ) - { - // Do not complete message - } - else - { - iObserver->ServiceExecuted( iService, KErrNone ); - } - iService = ECmServiceNone; - break; - } - case ECmSmContentChanged: - { - // If timer start up fails => wait next content change event - TRAPD( err, StartMdETimerL() ); - if( err ) - { - TRACE(Print(_L("[STORE MNGR]\t StartMdETimerL err = %d"), - err )); - } - break; - } - default: - { - break; - } - } - - } - -// --------------------------------------------------------------------------- -// CCmSmMain::TransferStatus -// --------------------------------------------------------------------------- -// -void CCmSmMain::TransferStatus( TCmSmTransferStatus aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::TransferStatus()")); - switch( aStatus ) - { - case ECmSmTransferCompleted: - { - TTime storeFinished; - storeFinished.HomeTime(); - TTimeIntervalMicroSeconds usecsFrom = - storeFinished.MicroSecondsFrom(iStoreStarted); - TInt64 timeinsecs((TInt64)( usecsFrom.Int64() / KCmSmOneSecond )); - TRACE(Print(_L("[STORE MNGR]\t Store took = %ld seconds"), - timeinsecs )); - - iCmSmFileMngr->UpdateTransferHistoryData( timeinsecs, - iCmSmTransferEngine->DataAmount(), (TUint8)iId ); - ChangeState( ECmSmManageFiles ); - break; - } - case ECmSmAborted: - { - ChangeState( ECmSmStartCopying ); - break; - } - case ECmSmTransferCanceled: - { - break; - } - case ECmSmFileTransferred: - { - SendProgressInfo( KCmOneFile ); - break; - } - case ECmSmFileTransferFailed: - { - // File transferring failed => skip file - SendProgressInfo( KCmOneFile ); - break; - } - case ECmSmWlanLost: - { - if( iDevices ) - { - iDevices->ResetAndDestroy(); - delete iDevices; - iDevices = NULL; - } - iItemIds.Reset(); - iItemIds.Close(); - iCmSmFileMngr->ResetArrays(); - iObserver->ServiceExecuted( iService, KErrGeneral ); - iProgressInfo.iService = ECmServiceNone; - iService = ECmServiceNone; - SendProgressInfo( KErrNone ); - break; - } - case ECmSmTransferContinued: - { - ChangeState( ECmSmContinueCopying ); - break; - } - default: - { - break; - } - } - } - -#ifdef _DEBUG -// --------------------------------------------------------------------------- -// CCmSmMain::LogServers -// --------------------------------------------------------------------------- -// -void CCmSmMain::LogServers() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::LogServers")); - - for( TInt i = 0; i < iDevices->Count(); i++ ) - { - TBuftemp; - if((*iDevices)[i]) - { - if( &(*iDevices)[i]->Uuid() ) - { - if( (*iDevices)[i]->Uuid().Length() < KMaxName ) - { - temp.Copy( (*iDevices)[i]->Uuid() ); - TRACE(Print(_L("[STORE MNGR]\t FOUND DEVICE %d = %S"), - i+1, &temp )); - } - temp.Zero(); - } - } - } - } -#endif - -// --------------------------------------------------------------------------- -// CCmSmMain::SendProgressInfo -// --------------------------------------------------------------------------- -// -void CCmSmMain::SendProgressInfo( TInt aProgress ) - { - TRACE( Print( _L( - "[STORE MNGR]\t CCmSmMain::SendProgressInfo( %d )"), - aProgress)); - - iProgressInfo.iProcessedItems += aProgress; - TRAPD( error, iCmSmFileMngr->GetStoreFileCountNoDuplicatesL( - iProgressInfo.iItemsToTransferPerService ) ); - if ( error ) - { - TRACE( Print( _L( "[STORE MNGR]\t GetStoreFileCountNoDuplicatesL \ - failed with error %d"), error ) ); - } - TCmProgressInfoPckg progressPckg( iProgressInfo ); - - TRACE( Print( _L( - "[STORE MNGR]\t processed: %d total %d"), - iProgressInfo.iProcessedItems, iProgressInfo.iTotalItems)); - - TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, progressPckg ); - - TRACE( Print( _L("[STORE MNGR]\t RProperty::Set returned %d"), err)); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::ManageFileL -// --------------------------------------------------------------------------- -// -void CCmSmMain::ManageFileL() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::ManageFileL")); - - if( KErrNone < iCmSmTransferEngine->FilesToBeRemoved().Count() ) - { - iMemManager->DeleteFilesL( iCmSmTransferEngine->FilesToBeRemoved() ); - } - else if ( KErrNone < iCmSmTransferEngine->FilesToBeShrinked().Count() ) - { - TRAPD( err, iMemManager->ShrinkImagesL( - iCmSmTransferEngine->FilesToBeShrinked() ) ); - if( err ) - { - ChangeState( ECmSmStartCopying ); - } - } - else if( iCancelOnGoing ) - { - ChangeState( ECmSmFinishCanceling ); - } - else - { - // Store to next server... - ChangeState( ECmSmStartCopying ); - } - } - -// --------------------------------------------------------------------------- -// CCmSmMain::DeleteCompleteL -// --------------------------------------------------------------------------- -// -void CCmSmMain::DeleteCompleteL( TInt /*aErr*/ ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteCompleteL")); - - iCmSmTransferEngine->DeleteToBeRemoved(); - ManageFileL(); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::ShrinkCompleteL -// --------------------------------------------------------------------------- -// -void CCmSmMain::ShrinkCompleteL( TInt /*aErr*/ ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::ShrinkCompleteL")); - - iCmSmTransferEngine->DeleteToBeShrinked(); - ManageFileL(); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::ChangeState -// --------------------------------------------------------------------------- -// -void CCmSmMain::ChangeState( - TCmSmMainSequencer aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::ChangeState")); - - __ASSERT_DEBUG(!IsActive(),\ - User::Panic( KCmSmManager, KErrInUse )); - SetActive(); - TRequestStatus* pStatus = &iStatus; - User::RequestComplete( pStatus, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::StartMdETimerL -// --------------------------------------------------------------------------- -// -void CCmSmMain::StartMdETimerL() - { - LOG( _L("[STORE MNGR] CCmSmMain::StartMdETimerL start")); - - if( iPeriodic ) - { - iPeriodic->Cancel(); - } - else - { - iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle ); - } - iPeriodic->Start( KCmSmClfRefreshInterval, KCmSmClfRefreshInterval, - TCallBack( CheckItems, this ) ); - LOG( _L("[STORE MNGR] CCmSmMain::StartMdETimerL end")); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::CancelMdETimer -// --------------------------------------------------------------------------- -// -void CCmSmMain::CancelMdETimer() - { - LOG( _L("[STORE MNGR] CCmSmMain::CancelMdETimer start")); - - if( iPeriodic ) - { - iPeriodic->Cancel(); - } - LOG( _L("[STORE MNGR] CCmSmMain::CancelMdETimer end")); - } - -// ----------------------------------------------------------------------------- -// CCmSmMain::CheckItems -// ----------------------------------------------------------------------------- -// -TInt CCmSmMain::CheckItems( TAny* aPtr ) - { - LOG( _L("[STORE MNGR] CCmSmMain::CheckItems")); - - return ( (CCmSmMain*)aPtr)->CheckItemsChanged(); - } - -// ----------------------------------------------------------------------------- -// CCmSmMain::CheckItemsChanged -// ----------------------------------------------------------------------------- -// -TInt CCmSmMain::CheckItemsChanged( ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::CheckItemsChanged")); - - TInt restart( 1 ); - if( iService == ECmServiceNone ) - { - LOG( _L("[STORE MNGR] Starting autom. store list process...")); - iService = ECmServiceAutomStoreListProcess; - iCmSmFileMngr->StartProcessing(); - } - else - { - LOG( _L("[STORE MNGR] Store manager busy wait another x mins...")); - restart = 0; - } - return restart; - } - -// --------------------------------------------------------------------------- -// CCmSmMain::DeleteDevices -// --------------------------------------------------------------------------- -// -void CCmSmMain::DeleteDevices() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices")); - - if ( iDevices ) - { - iDevices->ResetAndDestroy(); - delete iDevices; - iDevices = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmSmMain::RunL -// --------------------------------------------------------------------------- -// -void CCmSmMain::RunL() - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmMain::RunL status = %d"), - iStatus.Int() )); - - switch( iStatus.Int() ) - { - case ECmSmGetMediaServers: - { - DeleteDevices(); - TRAPD( err, iCmSmTransferEngine->GetMediaServersL( iDevices ) ); - TRACE(Print(_L("[STORE MNGR]\t GetMediaServersL err = %d"), - err )); - if( err || 0 == iDevices->Count() ) - { - iObserver->ServiceExecuted( iService, KErrNotFound ); - iService = ECmServiceNone; - } - else - { -#ifdef _DEBUG - LogServers(); -#endif - iDeviceIndex = 0; - // Load store list into memory - iCmSmFileMngr->LoadStoreFileListL(); - iCmSmTransferEngine->ResetFileArrays(); - ChangeState( ECmSmStartCopying ); - } - break; - } - case ECmSmStartFileProcessing: - { - if( iService == ECmServicePreProcessingStore ) - { - iCmSmFileMngr->StartProcessing(); - } - break; - } - case ECmSmStartCopying: - { - LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \ - start file copy")); - - iStoreStarted.HomeTime(); - if( iDeviceIndex < iDevices->Count()) - { - iCmSmFileMngr->GetItemsL( iItemIds, - (*iDevices)[iDeviceIndex]->Uuid(), iId ); - if( KErrNone < iItemIds.Count() ) - { - LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \ - files to be copied")); - iCmSmTransferEngine->CopyFilesL( (TUint8)iId, - (*iDevices)[iDeviceIndex] ); - } - else - { - // Jump to next device - LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \ - undefined mediaserver - no items")); - ChangeState( ECmSmStartCopying ); - } - iDeviceIndex++; - } - else - { - iCmSmFileMngr->DeleteItems( - iCmSmTransferEngine->ToBeDeleted() ); - iCmSmFileMngr->UpdateStoreFileListL(); - iDbManager->SetProgressInfo( iProgressInfo.iProcessedItems, - iProgressInfo.iTotalItems ); - DeleteDevices(); - iItemIds.Reset(); - iItemIds.Close(); - iCmSmFileMngr->ResetArrays(); - iObserver->ServiceExecuted( iService, KErrNone ); - iService = ECmServiceNone; - } - break; - } - case ECmSmContinueCopying: - { - iCmSmTransferEngine->ContinueCopyFilesL(); - break; - } - case ECmSmFinishing: - { - LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices no \ - rules selected")); - iObserver->ServiceExecuted( iService, - KErrNone ); - iService = ECmServiceNone; - break; - } - case ECmSmManageFiles: - { - ManageFileL(); - break; - } - case ECmSmFinishCanceling: - { - iCancelOnGoing = EFalse; - // Before canceling update content of the db - if( KErrNone < iItems.Count() ) - { - iCmSmFileMngr->DeleteItems( - iCmSmTransferEngine->ToBeDeleted() ); - iCmSmFileMngr->UpdateStoreFileListL(); - } - if( IsActive() ) - { - Cancel(); - } - break; - } - default: - { - LOG(_L("[STORE MNGR]\t CCmSmMain::DeleteDevices \ - no defined status")); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmMain::Close -// --------------------------------------------------------------------------- -// -void CCmSmMain::Close() - { - LOG(_L("[STORE MNGR]\t CCmSmMain::Close")); - - delete this; - } - -// --------------------------------------------------------------------------- -// CCmSmMain::DoCancel -// --------------------------------------------------------------------------- -// -void CCmSmMain::DoCancel() - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmMain::DoCancel()"))); - } - -// --------------------------------------------------------------------------- -// CCmSmMain::RunError -// --------------------------------------------------------------------------- -// -TInt CCmSmMain::RunError( TInt aError ) - { - TRACE(Print(_L("[STORE MNGR]\t RunError aError = %d"), aError )); - return aError; - } - -// End of file - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmsinfo.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmmsinfo.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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: Store media server info class -* -*/ - - -#include "cmsmmsinfo.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmSmMsInfo::NewL -// --------------------------------------------------------------------------- -// -CCmSmMsInfo* CCmSmMsInfo::NewL( TDesC8& aUuid, TInt aId ) - { - LOG(_L("[STORE MNGR]\t CCmSmMsInfo::NewL")); - - CCmSmMsInfo* self = CCmSmMsInfo::NewLC( aUuid, aId ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmMsInfo::NewLC -// --------------------------------------------------------------------------- -// -CCmSmMsInfo* CCmSmMsInfo::NewLC( TDesC8& aUuid, TInt aId ) - { - LOG(_L("[STORE MNGR]\t CCmSmMsInfo::NewLC")); - - CCmSmMsInfo* self = new ( ELeave ) CCmSmMsInfo(); - CleanupStack::PushL( self ); - self->ConstructL( aUuid, aId ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmMsInfo::~CCmSmMsInfo -// --------------------------------------------------------------------------- -// -CCmSmMsInfo::~CCmSmMsInfo() - { - LOG(_L("[STORE MNGR]\t CCmSmMsInfo::~CCmSmMsInfo")); - - delete iUuid; - } - -// --------------------------------------------------------------------------- -// CCmSmMsInfo::CCmSmMsInfo -// --------------------------------------------------------------------------- -// -CCmSmMsInfo::CCmSmMsInfo() - { - LOG(_L("[STORE MNGR]\t CCmSmMsInfo::CCmSmMsInfo")); - } - -// --------------------------------------------------------------------------- -// CCmSmMsInfo::Construct -// --------------------------------------------------------------------------- -// -void CCmSmMsInfo::ConstructL( TDesC8& aUuid, TInt aId ) - { - LOG(_L("[STORE MNGR]\t CCmSmMsInfo::ConstructL")); - - iUuid = aUuid.AllocL(); - iId = aId; - } - -// End of file - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmtransferengine.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmtransferengine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,753 +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: AV Controller UPnP actions handler -* Version : %version: tr1ido#1.1.10 % << Don't touch! -* -*/ - -#include -#include "upnpavdevice.h" -#include "upnpavcontroller.h" -#include "upnpfileuploadsession.h" - -#include "cmsmtransferobserver.h" -#include "cmdmmain.h" -#include "cmstorelistitem.h" -#include "cmsqlmainfactory.h" -#include "mcmsqlmain.h" -#include "cmsmtransferengine.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KGranularity = 10; -//If once total size bigger than 30MB may cause timeout when uploading -const TInt KCopySizePerTime = 30 * KMega; -//If once total count more than 20 files may cause timeout when uploading -const TInt KCopyCountPerTime = 20; - -#ifdef _DEBUG -_LIT( KCmStoreManager, "CmStoreManager" ); -#endif // _DEBUG - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::NewL -// --------------------------------------------------------------------------- -// -CCmSmTransferEngine* CCmSmTransferEngine::NewL( - MCmSmTransferObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems, RArray& aItemIds ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewL() start")); - CCmSmTransferEngine* self = CCmSmTransferEngine::NewLC( aObserver, - aDBMngr, aItems, aItemIds ); - CleanupStack::Pop( self ); - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::NewLC -// --------------------------------------------------------------------------- -// -CCmSmTransferEngine* CCmSmTransferEngine::NewLC( - MCmSmTransferObserver* aObserver, CCmDmMain* aDBMngr, - RPointerArray& aItems, RArray& aItemIds ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewLC() start")); - CCmSmTransferEngine* self = new ( ELeave ) CCmSmTransferEngine( aObserver, - aDBMngr, aItems, aItemIds ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::~CCmSmTransferEngine -// --------------------------------------------------------------------------- -// -CCmSmTransferEngine::~CCmSmTransferEngine() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::~CCmSmTransferEngine()")); - CancelCopy(); - if( iFilesToBeRemoved ) - { - iFilesToBeRemoved->Reset(); - delete iFilesToBeRemoved; - } - if( iFilesToBeShrinked ) - { - iFilesToBeShrinked->Reset(); - delete iFilesToBeShrinked; - } - iToBeDeleted.Close(); - iObserver = NULL; - iDBManager = NULL; - iDbWrapper->Close(); - iFSession.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::CCmSmTransferEngine -// --------------------------------------------------------------------------- -// -CCmSmTransferEngine::CCmSmTransferEngine( MCmSmTransferObserver* aObserver, - CCmDmMain* aDBMngr, RPointerArray& aItems, - RArray& aItemIds ) - : iObserver( aObserver ), iDBManager( aDBMngr ), iDevice( NULL ), - iItems( aItems ), iItemIds(aItemIds) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CCmSmTransferEngine")); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::ConstructL() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::ConstructL")); - - User::LeaveIfError( iFSession.Connect() ); - iFilesToBeRemoved = new ( ELeave ) CDesCArrayFlat( KGranularity ); - iFilesToBeShrinked = new ( ELeave ) CDesCArrayFlat( KGranularity ); - iDbWrapper = CCmSqlMainFactory::NewCmSqlMainL( iFSession ); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::SetAvController -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::SetAvController( MUPnPAVController* aAVController ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::SetAvController")); - - iAVController = aAVController; - iUploadSession = NULL; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::GetMediaServersL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::GetMediaServersL( - CUpnpAVDeviceList*& aDevices ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::GetMediaServersL()")); - - aDevices = iAVController->GetMediaServersL(); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::ResetFileArrays -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::ResetFileArrays() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::ResetFileArrays")); - - if( iFilesToBeRemoved ) - { - iFilesToBeRemoved->Reset(); - } - if( iFilesToBeShrinked ) - { - iFilesToBeShrinked->Reset(); - } - iToBeDeleted.Reset(); - iToBeDeleted.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::CancelCopy -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::CancelCopy() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CancelCopy()")); - - if ( iAVController ) - { - iAVController->StopUploadSession( *iUploadSession ); - iUploadSession = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::CopyFilesL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::CopyFilesL( TUint8 aDevId, - CUpnpAVDevice* aDevice ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CopyFilesL")); - - if( iAVController ) - { - iAVController->StopUploadSession( *iUploadSession ); - iUploadSession = NULL; - } - iDevId = aDevId; - iIndex = iItemIds.Count() - 1; - iDevice = aDevice; - ResetFileArrays(); - iTransferredData = KErrNone; - iTotalTransferredData = KErrNone; - - if( aDevice ) - { - ConnectedToDeviceL( *aDevice ); - CopySingleFileL(); - } - else - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CopyFilesL \ - aDevice == NULL")); - FinishCopy(); - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::DataAmount -// --------------------------------------------------------------------------- -// -TInt CCmSmTransferEngine::DataAmount() const - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::DataAmount")); - - return iTotalTransferredData; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::FilesToBeRemoved -// --------------------------------------------------------------------------- -// -CDesCArray& CCmSmTransferEngine::FilesToBeRemoved() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::FilesToBeRemoved")); - - /** Files to be removed */ - return *iFilesToBeRemoved; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::DeleteToBeRemoved -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::DeleteToBeRemoved() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::DeleteToBeRemoved")); - - iFilesToBeRemoved->Reset(); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::FilesToBeShrinked -// --------------------------------------------------------------------------- -// -CDesCArray& CCmSmTransferEngine::FilesToBeShrinked() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::FilesToBeShrinked")); - - /** Files to be shrinked */ - return *iFilesToBeShrinked; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::DeleteToBeShrinked -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::DeleteToBeShrinked() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::DeleteToBeShrinked")); - - iFilesToBeShrinked->Reset(); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::ToBeDeleted -// --------------------------------------------------------------------------- -// -RArray& CCmSmTransferEngine::ToBeDeleted() - { - TRACE(Print(_L("[STORE MNGR] CCmSmTransferEngine::DeleteToBeShrinked \ - To be deleted count = %d"), - iToBeDeleted.Count() )); - return iToBeDeleted; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::TransferStarted -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -void CCmSmTransferEngine::TransferStarted( TInt aKey, TInt aStatus ) - { -#else -void CCmSmTransferEngine::TransferStarted( TInt /*aKey*/, TInt /*aStatus*/ ) - { -#endif - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::TransferStarted()")); - TRACE(Print( _L("[STORE MNGR] Started transferin file aKey = %D"),aKey)); - TRACE(Print( _L("[STORE MNGR] Started transferin file aStatus = %D"), - aStatus )); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::TransferCompleted -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::TransferCompleted( TInt aKey, TInt aStatus, - const TDesC& /*aFilePath*/ ) - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmTransferEngine::TransferCompleted() \ - aStatus %d"), aStatus )); - TRACE(Print( _L("[STORE MNGR] Transfered file = %d"), aKey )); - - iObserver->TransferStatus( ECmSmFileTransferred ); - TInt err( KErrNone ); - if( !aStatus ) - { - TTime time; - time.HomeTime(); - if( iItems[ iItemIds[ aKey ] ] ) - { - TRAP( err, AddStoredL( iItems[iItemIds[aKey]]->Path(), - iDevice->Uuid(), time ) ); - TRACE(Print( _L("[STORE MNGR] AddStoredL err = %d"), err )); - } - TRAP( err, HandleItemStatusL( aKey ) ); - TRACE(Print( _L("[STORE MNGR] HandleItemStatusL err = %d"), err )); - } - TInt index( iTransferQueue.FindInOrder( aKey ) ); - if( KErrNotFound != index ) - { - iTransferQueue.Remove( index ); - if( !iTransferQueue.Count() ) - { - LOG( _L("[STORE MNGR] Transfer successfully completed")); - LOG( _L("[STORE MNGR] Queue empty!")); - iObserver->TransferStatus( ECmSmTransferCompleted ); - iTransferQueue.Reset(); - } - } - else - { - LOG( _L("[STORE MNGR] Transfer successfully completed")); - iObserver->TransferStatus( ECmSmTransferCompleted ); - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::TransferProgress -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::TransferProgress( TInt /*aKey*/, TInt aBytes, - TInt aTotalBytes ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::TransferProgress")); - - iTransferredData = ( aBytes / KKilo ); // Convert to kilobytes - - // Check if file has been transferred completely - if ( aBytes == aTotalBytes ) - { - iTotalTransferredData += ( aTotalBytes / KKilo ); - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::MediaServerDisappeared -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::MediaServerDisappeared( - TUPnPDeviceDisconnectedReason /*aReason*/ ) - { - TRACE(Print( _L("[STORE MNGR] CCmSmTransferEngine::\ - MediaServerDisappeared WLANLost") )); - CancelCopy(); - iObserver->TransferStatus( ECmSmWlanLost ); - DeleteToBeRemoved(); - DeleteToBeShrinked(); - iToBeDeleted.Reset(); - iToBeDeleted.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::CancelOperation() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CancelOperation")); - - CancelCopy(); - DeleteToBeRemoved(); - DeleteToBeShrinked(); - iToBeDeleted.Reset(); - iToBeDeleted.Close(); - iObserver->TransferStatus(ECmSmTransferCanceled); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::CopySingleFileL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::CopySingleFileL() - { - LOG( _L("[STORE MNGR] COTSTransferEngine::CopySingleFileL")); - - /** File transfer started */ - iTransferStarted.HomeTime(); - // Files left in queue - iTransferQueue.Reset(); - iCopyStatus = ECmSmCopyNever; - //start uploading - CopyFilesOnceL(); - - if( iItems.Count() == KErrNone ) - { - iCopyStatus = ECmSmCopySuccess; - LOG( _L("[STORE MNGR] Transfer successfully completed")); - __ASSERT_DEBUG(( iIndex + 1 == 0 ),\ - User::Panic( KCmStoreManager, ECmSmTransferQueueMessedUp )); - FinishCopy(); - } - if( ECmSmCopyNever == iCopyStatus ) - { - FinishCopy(); - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::ContinueCopyFilesL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::ContinueCopyFilesL() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::ContinueCopyFilesL")); - - CopyFilesOnceL(); - - if ( iIndex == KErrNotFound && ECmSmCopyContinued == iCopyStatus ) - { - iCopyStatus = ECmSmCopyNever; - } - if( ECmSmCopyNever == iCopyStatus ) - { - FinishCopy(); - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::CopyFilesOnceL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::CopyFilesOnceL() - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::CopyFilesOnceL")); - - TInt copySize( 0 ); - TInt copyCt( 0 ); - if( iItemIds.Count() ) - { - while( 0 <= iIndex && - copySize < KCopySizePerTime && - copyCt < KCopyCountPerTime ) - { - if( iItemIds[iIndex] < iItems.Count() ) - { - TFileName tempFileName; - tempFileName.Copy( iItems[iItemIds[iIndex]]->Path() ); - TRACE(Print( _L("[STORE MNGR] Filename S.L 16-bit = %S,%d"), - &tempFileName, iUploadSession )); - if( !IsDuplicateL( iIndex ) ) - { - TRAPD( err, iUploadSession->StartUploadL( - tempFileName, iIndex ) ); - - if( !err ) - { - iCopyStatus = ECmSmCopySuccess; - } - - TRAP( err, - iUploadSession->StartTrackingProgressL( iIndex ) ); - tempFileName.Zero(); - if( !err ) - { - iTransferQueue.InsertInOrder( iIndex ); - } - copySize += iItems[iItemIds[iIndex]]->Size(); - copyCt++; - } - else - { - LOG( _L("[STORE MNGR] File already \ - on server!Skip file!")); - - TTime time; - time.HomeTime(); - AddStoredL( iItems[iItemIds[iIndex]]->Path(), - iDevice->Uuid(), time ); - HandleItemStatusL( iIndex ); - } - } - iIndex--; - if( ( copySize >= KCopySizePerTime || - copyCt >= KCopyCountPerTime ) && - iIndex != KErrNotFound ) - { - if( ECmSmCopySuccess != iCopyStatus ) - { - iCopyStatus = ECmSmCopyContinued; - } - iObserver->TransferStatus( ECmSmTransferContinued ); - } - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::FinishCopy -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::FinishCopy() - { - LOG( _L("[STORE MNGR] CCmSmTransferEngine::FinishCopy \ - No files to be transfered!")); - iObserver->TransferStatus( ECmSmTransferCompleted ); - CancelCopy(); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::ConnectedToDeviceL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::ConnectedToDeviceL( const CUpnpAVDevice& aDevice ) - { - LOG( _L("[STORE MNGR] CCmSmTransferEngine::ConnectedToDeviceL")); - - CancelCopy(); - iUploadSession = &iAVController->StartUploadSessionL( aDevice ); - iUploadSession->SetObserver( *this ); -#ifdef _DEBUG - CUpnpAVDevice& device = const_cast< CUpnpAVDevice& >( aDevice ); - HBufC* data16bitBuf = HBufC::NewLC( device.FriendlyName().Length() ); - TPtr data16bitPtr = data16bitBuf->Des(); - TInt conversionError = - CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, - device.FriendlyName() ); - - TRACE(Print( _L("[STORE MNGR] conversionError = %d"), conversionError )); - TRACE(Print( _L("[STORE MNGR] Target device name: %S"), - &data16bitPtr )); - - CleanupStack::PopAndDestroy( data16bitBuf ); - - data16bitBuf = HBufC::NewLC( device.FriendlyName().Length() ); - - data16bitPtr = data16bitBuf->Des(); - conversionError = - CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, - device.FriendlyName() ); - TRACE(Print( _L("[STORE MNGR] conversionError = %d"), conversionError )); - TRACE(Print( _L("[STORE MNGR] Targer device id: %S"), - &data16bitPtr )); - - CleanupStack::PopAndDestroy( data16bitBuf ); -#endif - - LOG( _L("[STORE MNGR] ****** Connected to target device ******")); - LOG( _L("[STORE MNGR] CCmSmTransferEngine::ConnectedToDeviceL end")); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::AddStoredL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::AddStoredL( const TDesC& aFileName, - const TDesC8& aUDN, TTime aTimeStamp ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::AddStoredL")); - - iDBManager->AddStoredL( aFileName, aUDN, aTimeStamp ); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::HandleItemStatusL -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::HandleItemStatusL( const TInt aKey ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::HandleItemStatusL")); - - RArray statusValues; // ownership transferred - RArray devIds; // ownership transferred - - TInt index( KErrNotFound ); - TCmListItemStatus status( ECmStored ); - - if( iItemIds[aKey] < iItems.Count() ) - { - devIds = iItems[iItemIds[aKey]]->DevIds(); - statusValues = iItems[iItemIds[aKey]]->StatusValues(); - index = devIds.Find( iDevId ); - } - - if( KErrNotFound != index ) - { - status = statusValues[index]; - } - TInt countOfStatusVal( KErrNone ); - TRACE(Print( _L("[STORE MNGR] Status = %d"), - (TInt)status )); - TRACE(Print( _L("[STORE MNGR] statusValues.Count() = %d"), - statusValues.Count() )); - for( TInt i = 0 ; i < statusValues.Count(); i++ ) - { - if( statusValues[i] == status ) - { - countOfStatusVal++; - } - } - - TRACE(Print( _L("[STORE MNGR] countOfStatusVal = %d"), - countOfStatusVal )); - if( iItemIds[aKey] < iItems.Count() ) - { - switch( status ) - { - case ECmToBeRemoved: - { - LOG(_L("[STORE MNGR]\t To be removed")); - if ( 2 > countOfStatusVal ) - { - iItems[iItemIds[aKey]]-> - UpdateFileStatusL( iDevId, ECmStored ); - // Let's mark item to be deleted from the db - iToBeDeleted.InsertInOrder( iItemIds[aKey] ); - iFilesToBeRemoved->AppendL( - iItems[iItemIds[aKey]]->Path() ); - } - else - { - iItems[iItemIds[aKey]]-> - UpdateFileStatusL( iDevId, ECmStored ); - } - break; - } - case ECmToBeShrinked: - { - LOG(_L("[STORE MNGR]\t To be shrinked")); - if ( 2 > countOfStatusVal) - { - iItems[iItemIds[aKey]]-> - UpdateFileStatusL( iDevId, ECmStored ); - // Let's mark item to be deleted from the db - iToBeDeleted.InsertInOrder( iItemIds[aKey] ); - iFilesToBeShrinked->AppendL( - iItems[iItemIds[aKey]]->Path() ); - } - else - { - iItems[iItemIds[aKey]]-> - UpdateFileStatusL( iDevId, ECmStored ); - } - break; - } - case ECmKeepOnDevice: - { - LOG(_L("[STORE MNGR]\t Keep On Device")); - if( 2 > countOfStatusVal ) - { - iItems[iItemIds[aKey]]-> - UpdateFileStatusL( iDevId, ECmStored ); - // Let's mark item to be deleted from the db - iToBeDeleted.InsertInOrder( iItemIds[aKey] ); - } - else - { - // If no action needed just change status - iItems[iItemIds[aKey]]-> - UpdateFileStatusL( iDevId, ECmStored ); - } - break; - } - case ECmStored: - { - LOG(_L("[STORE MNGR]\t already stored")); - break; - } - default: - { - LOG(_L("[STORE MNGR]\t Wrong status!!!")); - TRACE(Print( _L("[STORE MNGR] Status = %d"), (TInt)status )); - User::Invariant(); - break; - } - } - UpdateStoreTransferStatus( ECmStored, - iItems[iItemIds[aKey]]->DbId(), - iDevId ); - } - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::UpdateStoreTransferStatus -// --------------------------------------------------------------------------- -// -void CCmSmTransferEngine::UpdateStoreTransferStatus( TUint aStatus, - TInt64 aFid, TInt64 aMsId ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::UpdateStoreTransferStatus")); - - iDBManager->UpdateStoreTransferStatus( aStatus, aFid, aMsId ); - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::GetArrayIndex -// --------------------------------------------------------------------------- -// -TInt CCmSmTransferEngine::GetArrayIndex( TInt aKey ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::GetArrayIndex")); - - TInt index( 0 ); - for( TInt i = 0; i < iItemIds.Count(); i++ ) - { - if( iItems[iItemIds[i]]->DbId() == aKey ) - { - index = i; - // End loop - i = iItemIds.Count(); - } - } - return index; - } - -// --------------------------------------------------------------------------- -// CCmSmTransferEngine::IsDuplicateL -// --------------------------------------------------------------------------- -// -TBool CCmSmTransferEngine::IsDuplicateL( const TInt aIndex ) - { - LOG(_L("[STORE MNGR]\t CCmSmTransferEngine::IsDuplicateL")); - - return iDbWrapper->ExistsL( *iItems[iItemIds[aIndex]], iDevId ); - } - -// End of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmsmvideoandimagemngr.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmsmvideoandimagemngr.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,536 +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: Store image ja video file processing -* -*/ - - -#include -#include -#include "upnpfileutility.h" -#include -#include "cmstorelistitem.h" -#include "cmsmfilemngr.h" -#include "cmsmvideoandimagemngr.h" -#include "msdebug.h" - - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::NewL -// --------------------------------------------------------------------------- -// -CCmSmVideoAndImageMngr* CCmSmVideoAndImageMngr::NewL( - MCmSmVideoAndImageMngrObserver& aObserver, CCmSmFileMngr& aFileMngr, - CMdESession& aSession, RPointerArray& aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewL() start")); - CCmSmVideoAndImageMngr* self = CCmSmVideoAndImageMngr::NewLC( aObserver, - aFileMngr, aSession, aItems ); - CleanupStack::Pop( self ); - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewL() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::NewLC -// --------------------------------------------------------------------------- -// -CCmSmVideoAndImageMngr* CCmSmVideoAndImageMngr::NewLC( - MCmSmVideoAndImageMngrObserver& aObserver, CCmSmFileMngr& aFileMngr, - CMdESession& aSession, RPointerArray& aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewLC() start")); - CCmSmVideoAndImageMngr* self = new ( ELeave ) CCmSmVideoAndImageMngr( - aObserver, aFileMngr, aSession, aItems ); - CleanupStack::PushL( self ); - self->ConstructL(); - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::NewLC() end")); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::~CCmSmVideoAndImageMngr -// --------------------------------------------------------------------------- -// -CCmSmVideoAndImageMngr::~CCmSmVideoAndImageMngr() - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::\ - ~CCmSmVideoAndImageMngr() start")); - Cancel(); - delete iTitleDef; - delete iSizeDef; - delete iDateDef; - delete iQuery; - delete iMediaTypeDef; - delete iObjectDef; - delete iNamespace; - iObjects.ResetAndDestroy(); - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::\ - ~CCmSmVideoAndImageMngr() end")); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::CCmSmVideoAndImageMngr -// --------------------------------------------------------------------------- -// -CCmSmVideoAndImageMngr::CCmSmVideoAndImageMngr( - MCmSmVideoAndImageMngrObserver& aObserver, CCmSmFileMngr& aFileMngr, - CMdESession& aSession, RPointerArray& aItems ) - :CActive( EPriorityStandard ), iObserver( aObserver ), - iFileMngr( aFileMngr ), iSession( aSession ), iItems( aItems ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CCmSmVideoAndImageMngr")); - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::ConstructL() - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::ConstructL()")); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::ProcessMedia -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::ProcessMedia( TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::ProcessMedia")); - - TRAPD( err, SetQueryAndStartFindL( aType ) ); - iQueriedMedia = aType; - if( err ) - { - TRACE(Print(_L("SetQueryAndStartFindL err = %d"), err )); - iObserver.ImagesAndVideosReady( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::CancelListRefresh -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::CancelListRefresh() - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CancelListRefresh()")); - ResetQuery(); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::CancelOperation -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::CancelOperation() - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CancelOperation")); - - Cancel(); - CancelListRefresh(); - iFileMngr.ResetArrays(); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::HandleQueryNewResults -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::HandleQueryNewResults(CMdEQuery& aQuery, - TInt aFirstNewItemIndex, - TInt aNewItemCount) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::HandleQueryNewResults")); - - CMdEObjectQuery& query = (CMdEObjectQuery &) aQuery; - TRACE(Print(_L("[FILL MNGR]\t aNewItemCount %d"), aNewItemCount )); - if( &query ) - { - for ( TInt i=aFirstNewItemIndex; - i < aFirstNewItemIndex+aNewItemCount; - i++ ) - { - CMdEObject* object = (CMdEObject*)query.TakeOwnershipOfResult(i); - iObjects.AppendL(object); - } - } - - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::HandleQueryCompleted -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::HandleQueryCompleted( CMdEQuery& aQuery, - TInt aError ) - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::\ - HandleQueryCompleted error = %d"), aError )); - if (aError == KErrNone) - { - if( &aQuery ) - { - CompleteRequest( ECmSmQueryCompleted ); - } - else - { - CompleteRequest( ECmSmQueryFailed ); - } - } - else if ( aError == KErrCancel ) - { - // Query canceled - } - else - { - CompleteRequest( ECmSmQueryFailed ); - } - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::FilterItems -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::FilterItems() - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterItems")); - - TInt err( KErrNone ); - RArray ids; - - TRAP( err, iFileMngr.MediaTypesL( ids, iQueriedMedia ) ); - TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterItems \ - mediatypes err = %d"), err )); - TRAP( err, FilterNewItemsL( ids, iQueriedMedia ) ); - TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterItems \ - filter new items err = %d"), err )); - ids.Reset(); - - CompleteRequest( ECmSmFilteringReady ); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::FilterNewItemsL -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::FilterNewItemsL( RArrayaDeviceIds, - TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::FilterNewItemsL")); - - RArraystoreIds; - RArraystoredIds; - - - // Collecting mde object propertys into CCmFillListItem package - for( TInt i = 0; i < iObjects.Count(); i++ ) - { - // Copy ids into temporary array - for( TInt ll = 0; ll < aDeviceIds.Count(); ll++ ) - { - storeIds.Append(aDeviceIds[ll]); - } - - if ( !UPnPFileUtility::IsFileProtectedL( iObjects[i]->Uri( ) ) ) - { - if( iFileMngr.CheckIsFilledFileL( iObjects[i]->Uri( ) ) ) - { - storeIds.Reset(); - storeIds.Close(); - } - iFileMngr.IsAlreadyStoreL( iObjects[i]->Uri(), - storedIds, - storeIds ); - if( KErrNone < storeIds.Count() ) - { - TCmListItemStatus status; - CCmStoreListItem* item = CCmStoreListItem::NewL(); - CleanupStack::PushL( item ); - item->SetPathL( iObjects[i]->Uri( ) ); - item->SetListId( iFileMngr.RetrieveListId( aType ) ); - // Ms id values are binded with file status values - iFileMngr.RetrieveListStatusValues( aType, status ); - CMdEProperty* prop; - CMdETextProperty* textprop; - TInt propIndex = iObjects[i]->Property( *iTitleDef, prop ); - if( propIndex != KErrNotFound ) - { - textprop = (CMdETextProperty*) prop; - item->SetPrimaryTextL( textprop->Value() ); - } - else - { - TParsePtrC parser( iObjects[i]->Uri()); - item->SetPrimaryTextL( parser.Name() ); - LOG(_L("[STORE MNGR]\t Title not found file name used")); - } - - propIndex = iObjects[i]->Property( *iSizeDef, prop ); - if( propIndex != KErrNotFound ) - { - item->SetSize( prop->Uint32ValueL() ); - } - else - { - LOG(_L("[STORE MNGR]\t Size not found")); - } - propIndex = iObjects[i]->Property( *iDateDef, prop ); - if( propIndex != KErrNotFound ) - { - CMdETimeProperty* dateprop = (CMdETimeProperty*)prop; - item->SetDate( dateprop->Value() ); - } - else - { - LOG(_L("[STORE MNGR]\t Date not found")); - } - // Where item will be stored - for( TInt s = 0 ; s < storeIds.Count(); s++ ) - { - item->SetDevId( storeIds[s], status ); - } - // Where item has already been stored - for( TInt d = 0; d < storedIds.Count(); d++ ) - { - item->SetDevId( storedIds[d], ECmStored ); - } - iItems.AppendL( item ); - CleanupStack::Pop( item ); - } - } - storedIds.Reset(); - storedIds.Close(); - storeIds.Reset(); - storeIds.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::SetQueryAndStartFindL -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::SetQueryAndStartFindL( TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::SetQueryAndStartFindL")); - - ResetQuery(); - if( !iNamespace ) - { - iNamespace = &iSession.GetDefaultNamespaceDefL(); - } - if( iNamespace ) - { - iObjectDef = - &iNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject ); - } - if( ECmImage == aType || ECmOtherImage == aType ) - { - TRACE(Print(_L("ECmImage == aType"))); - iMediaTypeDef = - &iNamespace->GetObjectDefL( MdeConstants::Image::KImageObject ); - } - else if( ECmVideo == aType || ECmOtherVideo == aType ) - { - TRACE(Print(_L("ECmVideo == aType"))); - iMediaTypeDef = - &iNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject ); - } - else - { - User::Leave( KErrArgument ); - } - if( !iObjectDef ) - { - User::Leave( KErrArgument ); - } - if( !iMediaTypeDef ) - { - User::Leave( KErrArgument ); - } - - iQuery = iSession.NewObjectQueryL( *iNamespace, *iMediaTypeDef, this ); - if( !iQuery ) - { - User::Leave( KErrArgument ); - } - /** Set logic condition */ - SetLogicConditionL( aType ); - /** Set property filters */ - SetPropertyFiltersL(); - iQuery->SetResultMode( EQueryResultModeItem ); - /** Start query */ - iQuery->FindL(); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::SetPropertyFiltersL -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::SetPropertyFiltersL( ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::SetPropertyFiltersL")); - - iTitleDef = &iObjectDef->GetPropertyDefL( - MdeConstants::Object::KTitleProperty ); - iSizeDef = &iObjectDef->GetPropertyDefL( - MdeConstants::Object::KSizeProperty ); - iDateDef = &iObjectDef->GetPropertyDefL( - MdeConstants::Object::KCreationDateProperty ); - iQuery->AddPropertyFilterL( iTitleDef ); - iQuery->AddPropertyFilterL( iSizeDef ); - iQuery->AddPropertyFilterL( iDateDef ); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::SetLogicConditionL -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::SetLogicConditionL( TCmMediaType aType ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::SetLogicConditionL")); - - CMdELogicCondition& rootCondition = iQuery->Conditions(); - CMdELogicCondition* contentCondition = &rootCondition; - CMdELogicCondition& logicCondition = - contentCondition->AddLogicConditionL( ELogicConditionOperatorOr ); - logicCondition.AddObjectConditionL( *iMediaTypeDef ); - - CMdEPropertyDef* originProperty = NULL; - if( aType == ECmOtherVideo || aType == ECmOtherImage ) - { - originProperty = &iObjectDef->GetPropertyDefL( _L("Origin") ); - if( originProperty ) - { - CMdELogicCondition& origLogicCondition = - contentCondition->AddLogicConditionL( - ELogicConditionOperatorAnd ); - origLogicCondition.AddPropertyConditionL( - *originProperty, TMdEUintNotEqual( - MdeConstants::Object::ECamera )); - } - } - if( aType == ECmVideo || aType == ECmImage ) - { - originProperty = &iObjectDef->GetPropertyDefL( _L("Origin") ); - if( originProperty ) - { - CMdELogicCondition& origLogicCondition = - contentCondition->AddLogicConditionL( - ELogicConditionOperatorAnd ); - origLogicCondition.AddPropertyConditionL( - *originProperty, TMdEUintEqual( - MdeConstants::Object::ECamera )); - } - } - - } - -// --------------------------------------------------------------------------- -// RCCmSmVideoAndImageMngr::ResetQuery -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::ResetQuery() - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::ResetQuery")); - - iObjects.ResetAndDestroy(); - - if ( iQuery ) - { - iQuery->Cancel(); - delete iQuery; - iQuery = NULL; - } - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::CompleteRequest -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::CompleteRequest( - TCmSmFileProcessingStatus aStatus ) - { - LOG(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::CompleteRequest")); - - __ASSERT_DEBUG(!IsActive(),\ - User::Panic( KCmSmManager, KErrInUse )); - SetActive(); - TRequestStatus* pStatus = &iStatus; - User::RequestComplete( pStatus, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::RunL -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::RunL() - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::RunL\ - status = %d"), iStatus.Int() )); - switch( iStatus.Int() ) - { - case ECmSmQueryCompleted: - { - FilterItems(); - break; - } - case ECmSmFilteringReady: - { - iObserver.ImagesAndVideosReady( KErrNone ); - break; - } - case ECmSmQueryFailed: - { - iObserver.ImagesAndVideosReady( KErrGeneral ); - break; - } - default: - { - LOG(_L("[STORE MNGR]\t Store file processing RunL default")); - User::Invariant(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::DoCancel -// --------------------------------------------------------------------------- -// -void CCmSmVideoAndImageMngr::DoCancel() - { - TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::DoCancel()"))); - } - -// --------------------------------------------------------------------------- -// CCmSmVideoAndImageMngr::RunError -// --------------------------------------------------------------------------- -// -#ifdef _DEBUG -TInt CCmSmVideoAndImageMngr::RunError( TInt aError ) - { -#else -TInt CCmSmVideoAndImageMngr::RunError( TInt /*aError*/ ) - { -#endif - TRACE(Print(_L("[STORE MNGR]\t CCmSmVideoAndImageMngr::RunError\ - aError = %d"), aError )); - iObserver.ImagesAndVideosReady( KErrGeneral ); - return KErrNone; - } - -// End of file - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/cmserver/cmstoremanager/src/cmstoremanagerfactory.cpp --- a/homesync/contentmanager/cmserver/cmstoremanager/src/cmstoremanagerfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: The factory for store manager -* -*/ - - -#include "cmstoremanagerfactory.h" -#include "cmstoremanager.h" -#include "cmsmmain.h" - -// -------------------------------------------------------------------------- -// CmStoreManagerFactory::NewStoreManagerL -// -------------------------------------------------------------------------- -// -EXPORT_C MCmSmManager* CmStoreManagerFactory::NewStoreManagerL( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ) - { - return CCmSmMain::NewL( aObserver, aSession, aDBManager, aMemManager ); - } - -// -------------------------------------------------------------------------- -// CmStoreManagerFactory::NewStoreManagerLC -// -------------------------------------------------------------------------- -// -EXPORT_C MCmSmManager* CmStoreManagerFactory::NewStoreManagerLC( - MCmServiceObserver* aObserver, CMdESession& aSession, - CCmDmMain* aDBManager, CCmMmMain* aMemManager ) - { - return CCmSmMain::NewLC( aObserver, aSession, aDBManager, aMemManager ); - } - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_1.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_1.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - -]> - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_2.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_2.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_3.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_3.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_4.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_4.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_5.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_5.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_6.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_6.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_7.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_7.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_8.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_8.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_9.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_indi_upnp_search_9.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - -]> - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_mserv_app_menu_icon.svg --- a/homesync/contentmanager/homesyncgsplugin/bitmaps/qgn_mserv_app_menu_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/data/msgsplugin.rss --- a/homesync/contentmanager/homesyncgsplugin/data/msgsplugin.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +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: ECOM plugin resource file for MediaServant GS Plugin. -* -*/ - -#include - -RESOURCE REGISTRY_INFO pluginInfo - { - dll_uid = 0x10282910; - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x10207236; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10282912; - version_no = 1; - display_name = "MediaServant plugin"; - default_data = "0x10207239"; // Parent UID; - opaque_data = "1000"; // Order number - } - }; - } - }; - } - -//End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/data/msgspluginsrc.rss --- a/homesync/contentmanager/homesyncgsplugin/data/msgspluginsrc.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,680 +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: Resource file for MediaServant gs plugin -* -*/ - - - -// RESOURCE IDENTIFIER -NAME MSGS // 4 letter ID - -// INCLUDES -#include // Avkon localized strings -#include -#include // Common GS resource structures -#include -#include -#include -#include -#include // For APP_RESOURCE_DIR -#include // Localized strings -#include "msgs.hrh" - - -// RESOURCE DEFINITIONS - -//---------------------------------------------------- -// -// -// Needed or loading the resource fails! -// -//---------------------------------------------------- -// -RESOURCE RSS_SIGNATURE - { - } - - -//---------------------------------------------------- -// -// r_gs_ms_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_gs_hs_view - { - menubar = r_ms_menubar_settings_view; - cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -//---------------------------------------------------- -// -// r_ms_settings_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_settings_view - { - menubar = r_ms_menubar_settings_view; - cba = r_ms_softkeys_options_back__change; - } - -//---------------------------------------------------- -// -// r_ms_menubar_settings_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_settings_view - { - titles = - { - MENU_TITLE { menu_pane = r_ms_setting_menu; } - }; - } - -//---------------------------------------------------- -// -// r_ms_setting_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_setting_menu - { - items = - { - MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; }, - MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, - MENU_ITEM { command = EEikCmdExit; txt = qtn_options_exit; } - }; - } - -/***************************** GENERAL SETTINGS ****************************/ -/***************************************************************************/ - -//---------------------------------------------------- -// -// r_ms_general_settings -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_ITEM_LIST r_ms_general_settings - { - items = - { - AVKON_SETTING_ITEM - { - identifier = EMSSettingsSync; - setting_page_resource = r_ms_sync_setting_page; - associated_resource = r_ms_sync_popup_texts; - name = qtn_mserv_item_sync; - }, - AVKON_SETTING_ITEM - { - identifier = EMSSettingsSourceDevices; - name = qtn_mserv_item_source_devices; - }, - AVKON_SETTING_ITEM - { - identifier = EMSSettingsTargetDevices; - name = qtn_mserv_item_target_devices; - }, - AVKON_SETTING_ITEM - { - identifier = EMSSettingsMemory; - name = qtn_mserv_item_used_memory; - }, - AVKON_SETTING_ITEM - { - identifier = EMSMemoryManager; - setting_page_resource = r_ms_memory_manager_setting_page; - associated_resource = r_ms_memory_manager_page_texts; - name = qtn_mserv_item_memory_manager; - } - }; - } - -/******************************* SYNC SETTING ******************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_sync_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_sync_setting_page - { - type = EAknCtPopupSettingList; - label = qtn_mserv_sett_sync_act; - editor_resource_id = r_ms_sync_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_popup_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_sync_popup_texts - { - setting_texts_resource = r_ms_sync_texts; - popped_up_texts_resource = r_ms_sync_item_texts; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_sync_editor - { - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_sync_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSSyncDisabled; - text = qtn_mserv_sett_sync_manually; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSSyncAutomatic; - text = qtn_mserv_sett_sync_automatic; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_item_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_sync_item_texts - { - items = - { - LBUF { txt = qtn_mserv_sett_sync_manually; }, - LBUF { txt = qtn_mserv_sett_sync_automatic; } - }; - } - - - -/*************************** SOURCE DEVICE SETTING ***************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_settings_source_devices -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_settings_source_devices - { - label = qtn_mserv_sett_source_devices; - type = EAknSetListBox; - editor_resource_id = r_ms_store_settings_source_editor; - softkey_resource = r_ms_softkeys_ok_cancel__toggle; - } - - -//---------------------------------------------------------------------------- -// r_ms_wait_dialog -// resource formediaservant wait dialog -//---------------------------------------------------------------------------- - -RESOURCE DIALOG r_ms_wait_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_mserv_searching_devices; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// r_ms_wait_for_createavc_dialog -// resource for wait dialog -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_ms_wait_for_createavc_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -// --------------------------------------------------------------------------- -// r_ms_source_device_selection_dialog -// resource for device search dialog -// --------------------------------------------------------------------------- - -RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_ms_source_device_selection_dialog - { - flags = EGeneralQueryFlags; - - softkeys = r_ms_softkeys_ok_cancel__toggle; - items = - { - AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSingleGraphicPopupMenuListBox; - listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST - { - }; - heading = qtn_mserv_sett_source_devices; - }; - } - }; - } - -// --------------------------------------------------------------------------- -// r_ms_target_device_selection_dialog -// resource for device search dialog -// --------------------------------------------------------------------------- - -RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_ms_target_device_selection_dialog - { - flags = EGeneralQueryFlags; - - softkeys = r_ms_softkeys_ok_cancel__toggle; - items = - { - AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSingleGraphicPopupMenuListBox; - listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST - { - }; - heading = qtn_mserv_sett_target_devices; - }; - } - }; - } - -/***************************** MEMORY SETTING ******************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_memoryselection_setting -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_memoryselection_setting - { - type = EAknSetListBox; - label = qtn_mserv_sett_used_memory; - editor_resource_id = r_ms_setting_page_editor; - softkey_resource = r_ms_softkeys_ok_cancel__select; - } - -//----------------------------------------------------------------------------- -// -// r_ms_setting_page_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE LISTBOX r_ms_setting_page_editor - { - flags = EAknListBoxMultipleSelection; - } - -/********************* MEMORY MANAGER SETTING ***********************/ - -//---------------------------------------------------- -// -// r_ms_memory_manager_setting_page -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_memory_manager_setting_page - { - type = EAknCtPopupSettingList; - editor_resource_id = r_ms_memory_manager_editor; - } - -//---------------------------------------------------- -// -// r_ms_memory_manager_page_texts -// -//---------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_memory_manager_page_texts - { - setting_texts_resource = r_ms_memory_manager_settingitem_texts; - popped_up_texts_resource = r_ms_memory_manager_settingpage_texts; - } - -//---------------------------------------------------- -// -// r_ms_memory_manager_editor -// -//---------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_memory_manager_editor - { - } - -//---------------------------------------------------- -// -// r_ms_memory_manager_settingitem_texts -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_ms_memory_manager_settingitem_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSDisabled; - text = qtn_mserv_item_manager_disabled; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSAskWhenFull; - text = qtn_mserv_item_ask_full; - } - }; - } - -//---------------------------------------------------- -// -// r_ms_memory_manager_settingpage_texts -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_ms_memory_manager_settingpage_texts - { - items = - { - LBUF { txt = qtn_mserv_item_manager_disabled; }, - LBUF { txt = qtn_mserv_item_ask_full; } - }; - } - -//---------------------------------------------------------------------------- -// r_msgs_animation_for_selection_dialog -//---------------------------------------------------------------------------- -// - -RESOURCE BMPANIM_DATA r_msgs_animation_for_selection_dialog - { - frameinterval = 300; - playmode = EAknBitmapAnimationPlayModeCycle; - bmpfile = ""APP_RESOURCE_DIR"\\msgsplugin.mif"; - frames = r_msgs_animation_for_selection_dialog_images; - } - -//---------------------------------------------------------------------------- -// r_msgs_animation_for_selection_dialog_images -//---------------------------------------------------------------------------- -// - -RESOURCE ARRAY r_msgs_animation_for_selection_dialog_images - { - items= - { - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_1 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_1_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_2 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_2_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_3 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_3_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_4 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_4_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_5 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_5_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_6 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_6_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_7 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_7_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_8 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_8_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsgspluginQgn_indi_upnp_search_9 ; - maskid=EMbmMsgspluginQgn_indi_upnp_search_9_mask;} - }; - } -// -------------------------------------------------------------------------- -// r_ms_softkeys_ok_cancel__select -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_ok_cancel__select - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOk; // left sk - txt = text_softkey_ok; - }, - CBA_BUTTON - { - id = EAknSoftkeyCancel; // right sk - txt = text_softkey_cancel; - } -#ifndef __SERIES60_31__ - , - CBA_BUTTON - { - id = EAknSoftkeySelect; - } -#endif - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_softkeys_options_back__change -// -//----------------------------------------------------------------------------- -// -RESOURCE CBA r_ms_softkeys_options_back__change - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOptions; // left sk - txt = text_softkey_option; - }, - CBA_BUTTON - { - id = EAknSoftkeyBack; // right sk - txt = text_softkey_back; - }, - CBA_BUTTON - { - id = EAknCmdOpen; // middle sk - txt = qtn_msk_change; - } - }; - } - -// -------------------------------------------------------------------------- -// r_ms_softkeys_ok_cancel__toggle -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_ok_cancel__toggle - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOk; // left sk - txt = text_softkey_ok; - }, - CBA_BUTTON - { - id = EAknSoftkeyCancel; // right sk - txt = text_softkey_cancel; - } -#ifndef __SERIES60_31__ - , - CBA_BUTTON - { - id = EAknSoftkeyForwardKeyEvent; - } -#endif - }; - } - - -//----------------------------------------------------------------------------- -// -// r_ms_store_settings_source_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE LISTBOX r_ms_store_settings_source_editor - { - flags = EEikListBoxMultipleSelection; - } - -//----------------------------------------------------------------------------- -// -// r_ms_no_memory_in_use -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_no_memory_in_use - { - buf = qtn_mserv_none_memory_in_use; - } - -//----------------------------------------------------------------------------- -// -// r_ms_nof_memories_in_use -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_nof_memories_in_use - { - buf = qtn_mserv_item_nof_of_memories; - } - -//----------------------------------------------------------------------------- -// -// r_ms_settings_default_memory_name -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_settings_default_memory_name - { - buf = qtn_mserv_default_mmc_name; - } - -//----------------------------------------------------------------------------- -// -// r_ms_item_devices -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_item_devices - { - buf = qtn_mserv_item_nof_servers; - } - -//----------------------------------------------------------------------------- -// -// r_ms_preprocessing_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_preprocessing_text - { - buf = qtn_mserv_wait_preprocessing; - } - -//----------------------------------------------------------------------------- -// -// r_ms_gs_plugin_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_gs_plugin_text - { - buf = qtn_mserv_grid_media_servant_home_media; - } - -//----------------------------------------------------------------------------- -// -// r_ms_gs_settings_view_title -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_no_server_selected - { - buf = qtn_mserv_none_serv; - } - -//----------------------------------------------------------------------------- -// -// r_ms_gs_settings_view_title -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_gs_settings_view_title - { - buf = qtn_mserv_title_sync_settings; - } - -//----------------------------------------------------------------------------- -// -// r_ms_gs_memory_full -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_gs_memory_full - { - buf = qtn_memlo_not_enough_memory; - } - -//End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/group/bld.inf --- a/homesync/contentmanager/homesyncgsplugin/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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: Information required for building GSMediaServantPlugin. -* -*/ - - -#include "../../../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../inc/msgsinterface.h |../../../../inc/msgsinterface.h -../inc/msgspluginuids.h |../../../../inc/msgspluginuids.h -../inc/msgs.inl |../../../../inc/msgs.inl -// LOC export -UPNP_LOC_EXPORT(msgsplugin.loc) - -PRJ_MMPFILES -msgsplugin.mmp - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE msgsplugin.mif -OPTION HEADERFILE msgsplugin.mbg -OPTION SOURCEDIR ../bitmaps -OPTION SOURCES -c8,8 qgn_mserv_app_menu_icon \ - -c8,8 qgn_indi_upnp_search_1 \ - -c8,8 qgn_indi_upnp_search_2 \ - -c8,8 qgn_indi_upnp_search_3 \ - -c8,8 qgn_indi_upnp_search_4 \ - -c8,8 qgn_indi_upnp_search_5 \ - -c8,8 qgn_indi_upnp_search_6 \ - -c8,8 qgn_indi_upnp_search_7 \ - -c8,8 qgn_indi_upnp_search_8 \ - -c8,8 qgn_indi_upnp_search_9 -END - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/group/msgsplugin.mmp --- a/homesync/contentmanager/homesyncgsplugin/group/msgsplugin.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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 specification file for MediaServant plugin. -* -*/ - -#include //this is needed for RESOURCE_FILES_DIR -#include - -TARGET msgsplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10282910 - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE msgspluginimplementationtable.cpp -SOURCE mssettingsview.cpp -SOURCE mssettingitemlist.cpp -SOURCE mssettingitemmemory.cpp -SOURCE mssettingitemdevices.cpp -SOURCE msmultiselectionpopup.cpp -SOURCE mssettingitems.cpp - -USERINCLUDE ../data -USERINCLUDE ../inc -USERINCLUDE ../loc -USERINCLUDE ../../mediaservant/help/inc - -// System Includes -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../inc - -SOURCEPATH ../data - -START RESOURCE msgsplugin.rss -TARGET msgsplugin.rsc -TARGETPATH ECOM_RESOURCE_DIR -END - -START RESOURCE msgspluginsrc.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -LIBRARY AKNSKINS.lib // AknsUtils.h -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY CommonEngine.lib // RConeResourceLoader -LIBRARY cone.lib -LIBRARY egul.lib // CGulIcon -LIBRARY AknIcon.lib -LIBRARY eikcoctl.lib -LIBRARY eikcore.lib -LIBRARY euser.lib -LIBRARY flogger.lib // RFileLogger -LIBRARY GSEcomPlugin.lib -LIBRARY GSFramework.lib -LIBRARY hlplch.lib // HlpLauncher -LIBRARY msengine.lib -LIBRARY cmsettingsengine.lib -LIBRARY cmcommon.lib -LIBRARY eikdlg.lib // multiselection dialog -LIBRARY charconv.lib -LIBRARY upnpavcontrollerclient.lib -LIBRARY commdb.lib -LIBRARY ecom.lib -LIBRARY centralrepository.lib // profile query -LIBRARY PlatformEnv.lib // pathinfo - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/msgs.hrh --- a/homesync/contentmanager/homesyncgsplugin/inc/msgs.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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: Resource headers for project Media Servant -* -*/ - - -#ifndef MSGS_HRH -#define MSGS_HRH - - -// setting list items -enum TMSSettingItems - { - EMSSettingsSync = 0, - EMSSettingsSourceDevices, - EMSSettingsTargetDevices, - EMSSettingsMemory, - EMSMemoryManager - }; - -// memory manager setting items -enum TMSMemoryManagerItems - { - EMSDisabled = 0, - EMSAskWhenFull - }; - -// sync setting items -enum TMSSyncSettings - { - EMSSyncDisabled = 0, - EMSSyncAutomatic - }; - -#endif // MSGS_HRH diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/msgs.inl --- a/homesync/contentmanager/homesyncgsplugin/inc/msgs.inl Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2007 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: Inline methods of Mediaservant GS plugin -* -*/ - - -#ifndef MSGS_INL -#define MSGS_INL - -// ---------------------------------------------------- -// CMSGSInterface::NewL -// Creates General Settings plugin. -// ---------------------------------------------------- -// -CMSGSInterface* CMSGSInterface::NewL( const TUid aUid ) - { - TAny* ext = REComSession::CreateImplementationL( - aUid, _FOFF( CMSGSInterface, iDtor_ID_Key ) ); - - CMSGSInterface* result = - reinterpret_cast< CMSGSInterface* >( ext ); - return result; - } - - -// ---------------------------------------------------- -// CMSGSInterface::DestroyPlugin -// Destroy Ecom plugin. -// ---------------------------------------------------- -// -void CMSGSInterface::DestroyPlugin() - { - REComSession::DestroyedImplementation( iDtor_ID_Key ); - } - -#endif // MSGS_INL - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/msgsinterface.h --- a/homesync/contentmanager/homesyncgsplugin/inc/msgsinterface.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Interface for Mediaservant application -* -*/ - - -#ifndef MSGSINTERFACE_H -#define MSGSINTERFACE_H - -#include -#include - - -/** - * GS plugin interface - * - * @lib msgsplugin.lib - */ -class CMSGSInterface : public CAknView - { - public: // New functions - - /** - * Wraps ECom object instantiation. - * @param aUid Specifies the concrete implementation. - */ - inline static CMSGSInterface* NewL( const TUid aUid ); - - - /** - * Notifies framework that this instance is being destroyed - * and resources can be released. - */ - inline void DestroyPlugin(); - - protected: - /** iDtor_ID_Key Instance identifier key. When instance of an - * implementation is created by ECOM framework, the - * framework will assign UID for it. The UID is used in - * destructor to notify framework that this instance is - * being destroyed and resources can be released. - */ - TUid iDtor_ID_Key; - }; - -#include "msgs.inl" - -#endif // MSGSINTERFACE_H - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/msgspluginuids.h --- a/homesync/contentmanager/homesyncgsplugin/inc/msgspluginuids.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2007 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: UID definition for MSGSPlugin -* -*/ - - -#ifndef __MSGSPLUGINUID_H -#define __MSGSPLUGINUID_H - -// INCLUDES -#include - -// CONSTANTS -const TUid KMSGSImplementationUid = { 0x10282912 }; - -#endif // __MSGSPLUGINUID_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/msmultiselectionpopup.h --- a/homesync/contentmanager/homesyncgsplugin/inc/msmultiselectionpopup.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +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: CMSMultiselectionPopup class definition -* -*/ - - -#ifndef CMSMULTISELECTIONPOPUP_H -#define CMSMULTISELECTIONPOPUP_H - -// INCLUDES -#include // CAknIconArray -#include //CAknListQueryDialog - -// CLASS DECLARATION - -/** - * CMSMultiselectionPopup dialog class - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSMultiselectionPopup ) : public CAknListQueryDialog - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - * - * @since S60 v5.1 - * @param aMediaServerArray, array of servers to show - * @param aSelectionIndexArray, currently selected servers - * @return CMSMultiselectionPopup*, the new CMSMultiselectionPopup object - */ - static CMSMultiselectionPopup* NewL( - TBool aUploadCapabilitySupport, - RPointerArray* aMediaServerArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ); - - /** - * Two-phased constructor. - * - * @since S60 v5.1 - * @param aMediaServerArray, array of servers to show - * @param aSelectionIndexArray, currently selected servers - * @return CMSMultiselectionPopup*, the new CMSMultiselectionPopup object - */ - static CMSMultiselectionPopup* NewLC( - TBool aUploadCapabilitySupport, - RPointerArray* aMediaServerArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ); - - /** - * Destructor. - */ - virtual ~CMSMultiselectionPopup(); - - /** - * Updates the list of servers. - * - * @since S60 v5.1 - * @param aMediaServer, found server - */ - void UpdateAndDrawPopupL( CCmMediaServerFull* aMediaServer ); - - /** - * Handles pointer event on touchscreen - * - * @param aPointerEvent, touchscreen key event - */ - void HandlePointerEventL ( const TPointerEvent& aPointerEvent ); - - protected: - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - - // From base class CAknSelectionListDialog - /** - * From CAknSelectionListDialog - * See base class definition - */ - void PreLayoutDynInitL(); - - /** - * From CAknSelectionListDialog - * See base class definition - */ - void PostLayoutDynInitL(); - - /** - * From CAknSelectionListDialog - * See base class definition - */ - TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, - TEventCode aType ); - /** - * From CAknSelectionListDialog - * See base class definition - */ - TBool OkToExitL( TInt aButtonId ); - - private: - - /** - * C++ default constructor. - */ - CMSMultiselectionPopup( - TBool aUploadCapabilitySupport, - RPointerArray* aMediaServerArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ); - - - /** - * Loads a possibly skinned icon and adds it to icon array - * - * @since S60 v5.1 - * @param CAknIconArray, array of icons - * @param MAknsSkinInstance, skin instance - * @param TDesC, reference to icon file - * @param TAknsItemID, skinned icon id - * @param TInt, bitmap id - * @param TInt, bitmap mask id - */ - void AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ) const; - - /** - * Sets the list of servers for the listbox. - * @since S60 v5.1 - */ - void AppendMediaServersL(); - - /** - * Creates listbox item string - * @since S60 v5.1 - * @param aServer, server info - * @return HBufC*, listbox item - */ - HBufC* CreateListBoxItemLC( const CCmMediaServerFull* aServer ); - - // Enumerations - - // icons indexes for the listbox - enum TIconList - { - ECheckedBox = 0, - EUnCheckedBox, - EUploadCapability, - EIconLast - }; - - private: // data - - /** - * Dialog control item - */ - CEikListBox* iListBox; // not owned - - /** - * Indicates if upload capability is needed - */ - TBool iUploadCapabilitySupport; - - /** - * Media servers - */ - RPointerArray* iServers; // not owned - - /** - * Previously selected indexes - */ - CArrayFix* iPreviousSelection; // not owned - }; - -#endif // CMSMULTISELECTIONPOPUP_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/mssettingitemdevices.h --- a/homesync/contentmanager/homesyncgsplugin/inc/mssettingitemdevices.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,308 +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: Definition for MediaServant Source devices setting item -* -*/ - - -#ifndef C_MSSETTINGITEMSOURCEDEV_H -#define C_MSSETTINGITEMSOURCEDEV_H - -// INCLUDES -#include -#include "upnpavdeviceobserver.h" -#include //MAknBackgroundProcess -#include "mssettingitems.h" - -// FORWARD DECLARATIONS -class CMSMultiselectionPopup; -class MUPnPAVController; -class CMSEngine; - -/** - * CMSSettingItemDevices class. - * - * Class searches devices and shows them to user - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSSettingItemDevices ): public CMSTextSettingItem, - public MAknBackgroundProcess, - public MProgressDialogCallback, - public MUPnPAVDeviceObserver - { - - public: // Constructor and destructor - - /** - * NewL - * 2-phase constructor. - * - * @since S60 v5.1 - * @param aIdentifier, setting item identifier - * @param aText, setting item text - * @param aMSEngine, application engine - * @param aStoredServers, stored servers - * @param aUploadCapabilitySupport, upload capability support - * @return CMSSettingItemDevices*, the new CMSSettingItemDevices object - */ - static CMSSettingItemDevices* NewL( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - RPointerArray& aStoredServers, - TBool aUploadCapabilitySupport = EFalse ); - - /** - * NewLC - * 2-phase constructor. - * - * @since S60 v5.1 - * @param aIdentifier, setting item identifier - * @param aText, setting item text - * @param aMSEngine, application engine - * @param aStoredServers, stored servers - * @param aUploadCapabilitySupport, upload capability support - * @return CMSSettingItemDevices*, the new CMSSettingItemDevices object - */ - static CMSSettingItemDevices* NewLC( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - RPointerArray& aStoredServers, - TBool aUploadCapabilitySupport = EFalse ); - - /** - * Destructor. - */ - virtual ~CMSSettingItemDevices(); - - - public:// from MAknBackgroundProcess - - /** - * Completes one cycle of the process. - */ - void StepL(); - - /** - * Return true when the process is done. - */ - TBool IsProcessDone() const; - - /** - * Handles error occurred in StepL. - */ - TInt CycleError( TInt aError ); - - protected: - - // From base class CAknTextSettingItem - - /** - * From CAknTextSettingItem - * See base class definition - */ - void EditItemL( TBool aCalledFromMenu ); - - // From base class MProgressDialogCallback - - /** - * From MProgressDialogCallback - * See base class definition - */ - void DialogDismissedL( TInt aButtonId ); - - // From base class MUPnPAVDeviceObserver - - /** - * From MUPnPAVDeviceObserver - * See base class definition - */ - void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ); - - /** - * From MUPnPAVDeviceObserver - * See base class definition - */ - void UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice ); - - /** - * From MUPnPAVDeviceObserver - * See base class definition - */ - void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); - - /** - * From MUPnPAVDeviceObserver - * See base class definition - */ - void WLANConnectionLost(); - - private: - - /** - * Shows error note - * @since S60 5.1 - * @param aTextResource, error text resource - */ - void ShowErrorNoteL( TInt aTextResource ); - - /** - * Sets servers activity - * @since S60 5.1 - */ - void SetServersActivity(); - - /** - * Reads source devices and set item text - * @since S60 5.1 - */ - void ReadServerListL(); - - /** - * Sets correct text for settings page - * @since S60 5.1 - */ - void SetSettingItemTextL(); - - /** - * Returns number of selected servers in active servers list. - * @since S60 5.1 - * @return number of selected servers - */ - TInt CountSelectedItems() const; - - /** - * Creates AV controller. - * @since S60 5.1 - * @return operation success. KErrNone if succesfull - */ - TInt CreateAvcontrollerL(); - - /** - * Cancels devices search operation. - * @since S60 5.1 - */ - void CancelDeviceSearch(); - - /** - * Fetches devices from AVController and calls - * DeviceDiscovered-callback for each of them. - * @since S60 5.1 - */ - void FetchAlreadyDiscoveredDevicesL(); - - /** - * Creates AVController, fetches devices from it and calls - * DeviceDiscovered-callback for each of them. Starts wait note if no - * devices are already discovered. - * - * @since S60 5.1 - * @return TInt system wide error code. KErrNone if successful. - */ - TInt CreateAvcAndFetchDevicesL(); - - /** - * Constructor. - */ - CMSSettingItemDevices( TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - RPointerArray& aStoredServers, - TBool aUploadCapabilitySupport ); - - /** - * ConstructL - * Second phase constructor. - */ - void ConstructL(); - - private: - - /** - * The internal phases of wait note when creating AvC - */ - enum TCreateAvCState - { - EPhaseNotActive, - EPhaseProcessing, - EPhaseCompleted - }; - - /** - * Id list of selected servers - */ - CArrayFix* iSelectedServers; // owned - - /** - * Flag for indicating user cancel - */ - TBool iUserCancelledSearch; - - /** - * Device selection dialog - */ - CMSMultiselectionPopup* iDevSelectionDlg; // owned - - /** - * application engine - */ - CMSEngine& iMSEngine; - - /** - * Servers to be shown to user - */ - RPointerArray iServerList; // not owned - - /** - * searched servers list - */ - RPointerArray& iStoredServers; // not owned - - /** - * Indicates if upload capability is needed - */ - TBool iUploadCapabilitySupport; - - /** - * Server name string (external set) - */ - HBufC* iSettingText; // ownded - - /** - * Wait dialog shown on device search - */ - CAknWaitDialog* iWaitDialog; // owned - - /** - * Wait scheduler - */ - CActiveSchedulerWait iWait; - - /** - * AV controller for device search - */ - MUPnPAVController* iAvController; // owned - - /** - * Current state of creating AvC - */ - TCreateAvCState iCreateAvCState; - - }; - -#endif // C_MSSETTINGITEMSOURCEDEV_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/mssettingitemlist.h --- a/homesync/contentmanager/homesyncgsplugin/inc/mssettingitemlist.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +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: Definition for Setting item list -class -* -*/ - - -#ifndef MSSETTINGITEMLIST_H -#define MSSETTINGITEMLIST_H - -// INCLUDES -#include - -#include "cmcommon.h" -#include "msengineobserver.h" -#include "msgs.hrh" - -// FORWARD DECLARATIONS -class CMSSettingsView; -class CMSEngine; -class CCmMediaServerFull; - - -// CLASS DECLARATION - -/** -* CMSSSettingItemList general class. This class is used to -* create setting items to several setting item lists. -*/ -NONSHARABLE_CLASS( CMSSettingItemList ): public CAknSettingItemList, - public MMSEngineObserver - { - public: // Constructor and destructor - - /** - * NewL - * 2-phase constructor. - * @param aResourceId : resource ID of setting page. - * @param aAppUi : application ui. - */ - static CMSSettingItemList* NewL( TInt aResourceId, - CMSSettingsView& aView ); - - /** - * NewLC - * 2-phase constructor. - * @param aResourceId : resource ID of setting page. - * @param aAppUi : application ui. - */ - static CMSSettingItemList* NewLC( TInt aResourceId, - CMSSettingsView& aView ); - - /** - * Constructor. - */ - CMSSettingItemList( CMSSettingsView& aView ); - - /** - * ConstructL - * Second phase constructor. - * @param aResourceId : resource ID of setting page. - * @param aAppUi : application ui - */ - void ConstructL( TInt aResourceId ); - - /** - * Destructor. - */ - virtual ~CMSSettingItemList(); - - /** - * Opens the selected listbox item - * - * @since S60 5.1 - */ - void OpenSelectedListboxItemL(); - - /** - * Returns MSEngine - * - * @since S60 5.1 - * @return CMSEngine, application engine - */ - CMSEngine* MSEngine(); - - protected: - - // From base class CAknSettingItemList - - /** - * From CAknSettingItemList - * See base class definition - */ - CAknSettingItem* CreateSettingItemL( TInt aSettingId ); - - /** - * From CAknSettingItemList - * See base class definition - */ - void SizeChanged(); - - /** - * From CAknSettingItemList - * See base class definition - */ - void HandleResourceChange( TInt aType ); - - /** - * From CAknSettingItemList - * See base class definition - */ - void EditItemL ( TInt aIndex, TBool aCalledFromMenu ); - - /** - * From CAknSettingItemList - * See base class definition - */ - void HandleListBoxEventL( CEikListBox *aListBox, - TListBoxEvent aEventType ); - - // From base class MMSEngineObserver - - /** - * From MMSEngineObserver - * see base class definition - */ - void ReadyL( TCmService aService, TInt aError ); - - // From base class CCoeControl - - /** - * From CCoeControl - * see base class definition - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - - private: - - /** - * Searches item from the list be item ID - * - * @since S60 5.1 - * @param aId, item id - * @return CAknSettingItem, item pointer - */ - CAknSettingItem* SearchItemById( const TMSSettingItems aId ) const; - - /** - * Reads current profile from cenrep - * - * @since S60 5.1 - * @return TInt, profile - */ - TInt GetCurrentProfileL() const; - - /** - * Sets memory selection visibility - * - * @since S60 5.1 - */ - void SetMemorySelectionL(); - - private: - - /** - * Reference to AppUi - */ - CMSEngine* iMSEngine; // owned - - /** - * Parent view - */ - CMSSettingsView& iView; - - /** - * Pointer to listbox - */ - CEikFormattedCellListBox* iListBox; // not owned - - /** - * dummy text needed by text setting items - */ - TBuf iDummyText; - - /** - * Sync selection - */ - TCmServiceState iSync; - - /** - * Memory manager - */ - TCmServiceState iMemoryManager; - - /** - * searched servers list - */ - RPointerArray* iStoredServers; // owned - }; - -#endif // MSSETTINGITEMLIST_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/mssettingitemmemory.h --- a/homesync/contentmanager/homesyncgsplugin/inc/mssettingitemmemory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +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: Definition for MediaServant memory setting item -* -*/ - - -#ifndef MSSETTINGITEMMEMORY_H -#define MSSETTINGITEMMEMORY_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CMSEngine; -class CSelectionItemList; -class CMSSettingItemList; - -// CLASS DECLARATION - -/** - * CMSSettingItemmemory class. - */ -NONSHARABLE_CLASS( CMSSettingItemMemory ): public CAknTextSettingItem - { - public: // Constructor and destructor - - /** - * NewL - * 2-phase constructor. - * - * @param aIdentifier, setting item identifier - * @param aText, setting item text - * @param aMSEngine, application engine - * @param aParent, parent list - * @return CMSSettingItemMemory*, the new CMSSettingItemMemory object - */ - static CMSSettingItemMemory* NewL( TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - CMSSettingItemList& aParent ); - - /** - * NewLC - * 2-phase constructor. - * - * @param aIdentifier, setting item identifier - * @param aText, setting item text - * @param aMSEngine, application engine - * @param aParent, parent list - * @return CMSSettingItemMemory*, the new CMSSettingItemMemory object - */ - static CMSSettingItemMemory* NewLC( TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - CMSSettingItemList& aParent ); - - /** - * Destructor. - */ - virtual ~CMSSettingItemMemory(); - - - protected: // From CAknSettingItem - - /** - * This method activates the memory "setting page" - */ - void EditItemL( TBool aCalledFromMenu ); - - private: // New functions - - /** - * Creates selection list for drive selection - * - * @since S60 5.1 - */ - void CreateSelectionListL(); - - /** - * Sets storage information to settings - * - * @since S60 5.1 - */ - void SetStorageInformationL(); - - /** - * Sets correct text setting item secondary text - * - * @since S60 5.1 - */ - void SetSettingItemTextL(); - - private: - - /** - * Constructor. - */ - CMSSettingItemMemory( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - CMSSettingItemList& aParent - ); - - /** - * ConstructL - * Second phase constructor. - */ - void ConstructL(); - - private: - - /** - * application ui - */ - CMSEngine& iMSEngine; - - /** - * application ui - */ - CMSSettingItemList& iParent; - - /** - * array of available memory cards - needed for settingpage - */ - CSelectionItemList* iItemArray; // owned - - /** - * drive info array - */ - RPointerArray iDriveArray; // owned - }; - -#endif // MSSETTINGITEMMEMORY_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/mssettingitems.h --- a/homesync/contentmanager/homesyncgsplugin/inc/mssettingitems.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +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: Definition for MediaServant fill rule editor class -* -*/ - - -#ifndef C_MSSETTINGITEMS_H -#define C_MSSETTINGITEMS_H - -#include - -// CLASS DECLARATIONS - -/** - * CMSTextSettingItem - * Text setting item class - */ -class CMSTextSettingItem : public CAknTextSettingItem - { - public: - CMSTextSettingItem( TInt aIdentifier, TDes& aText ); - - public: - /** - * Setting page acceptance status - * - * @since S60 5.1 - * @return TBool, ETrue if accepted EFalse if cancelled - */ - TBool SettingAccepted(); - /** - * Sets setting page accept state - * - * @since S60 5.1 - * @param aState, ETrue if accepted - */ - void SetAcceptState( TBool aState ); - - private: - /* - * Setting page acceptance status - */ - TBool iOKPressed; - }; - -#endif // C_MSSETTINGITEMS_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/inc/mssettingsview.h --- a/homesync/contentmanager/homesyncgsplugin/inc/mssettingsview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +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: MediaServant settings view. -* -*/ - - -#ifndef MSSETTINGSVIEW_H -#define MSSETTINGSVIEW_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CMSSettingItemList; -class CAknNavigationDecorator; -class CAknNavigationControlContainer; - -/** - * MediaServant settings view. - * - * @lib msgsplugin.lib - */ -NONSHARABLE_CLASS( CMSSettingsView ) : public CGSPluginInterface - { - - public: - /** - * NewL - * Two phased constructor. - * @return CMSSettingsView*, the new CMSSettingsView object - */ - static CMSSettingsView* NewL(); - - /** - * NewLC - * Two phased constructor. - * @return CMSSettingsView*, the new CMSSettingsView object - */ - static CMSSettingsView* NewLC(); - - /** - * Destructor. - */ - virtual ~CMSSettingsView(); - - /** - * SetNavigationPaneTextL - * Sets Navigation pane text. - * @since S60 5.1 - * @param aText, text to be shown - */ - void SetNavigationPaneTextL( const TDesC& aText ); - - /** - * ClearCurrentNaviPaneText - * Clears current navi pane text - * @since S60 5.1 - */ - void ClearCurrentNaviPaneText(); - - protected: - - // From base class CAknView - - /** - * From CAknView - * See base class definition. - */ - TUid Id() const; - - /** - * From CAknView - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknView - * See base class definition - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - - // From base class CGSPluginInterface - - /** - * From CGSPluginInterface - * See base class definition - */ - void GetCaptionL( TDes& aCaption ) const; - - /** - * From CGSPluginInterface - * See base class definition - */ - CGulIcon* CreateIconL( const TUid aIconType ); - - private: - - /** - * Default constructor. - */ - CMSSettingsView(); - - /** - * Second phase constructor. - */ - void ConstructL(); - - /** - * Sets text by resource ID in title pane. - * - * @since S60 5.1 - * @param aResourceId, The ID of outline number to displayed next. - */ - void SetTitlePaneTextL( const TInt aResourceId ); - - private: // data - - /** - * Setting list - */ - CMSSettingItemList* iSettingItemList; // owned - - /** - * Resource file offset - */ - TInt iResFileOffset; - - /** - * Navi decorator - */ - CAknNavigationDecorator* iNaviDecorator; // owned - - /** - * Navigation pane - */ - CAknNavigationControlContainer* iNaviPane; // not owned - - /** - * Control environment for file session - */ - CEikonEnv* iCoeEnv; // not owned - - }; - -#endif // MSSETTINGSVIEW_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/loc/msgsplugin.loc --- a/homesync/contentmanager/homesyncgsplugin/loc/msgsplugin.loc Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +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: Localization strings for GS plugin -* -*/ - - -//d:Setting list item primary text -//d:Scheduled syncronisation setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_sync "Synchronization" - -//d:Source devices setting item primary text -//d:Devices where data search is done -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_source_devices "Source devices" - -//d:Store setting item primary text -//d:Location where files will be copied -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_target_devices "Target devices" - -//d:Memory setting item primary text -//d:Used memory card -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_used_memory "Memory in use" - -//d:Setting list item primary text -//d:Memory manager setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_memory_manager "Memory manager" - -//d:Setting page heading text -//d:Syncronization mode setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_sync_act "Synchronization" - -//d:Sync setting page item text -//d:Sync is done manually by user -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_sync_manually "Manual" - -//d:Sync setting page item text -//d:Sync is done automatically by certain period -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_sync_automatic "Automatic" - -//d:Sync setting item secondary text -//d:Sync is done automatically by certain period -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_sync_automatically "Automatic" - -//d:Setting page heading text -//d:Source devices where data search is done -//l:heading_pane_t1/opt2 -//r:1.0 -// -#define qtn_mserv_sett_source_devices "Source device(s)" - -//d:Wait dialog text -//l:popup_note_wait_window -//r:2.1 -// -#define qtn_mserv_searching_devices "Searching for compatible devices" - -//d:Setting page heading text -//d:Sets target devices for file copying -//l:list_setting_pane_t1 -//r:1.0 -#define qtn_mserv_sett_target_devices "Target devices" - -//d:Setting page heading text -//d:Memomory manager state -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_used_memory "Memory in use" - -//d:Setting item secondary text -//d:Memory manager is turned off -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_manager_disabled "Disabled" - -//d:Setting item secondary text -//d:Memory manager is turned on -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_ask_full "Ask when full" - -//d:Setting list item secondary text -//d:No memory card selected -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_none_memory_in_use "None" - -//d:Setting list item secondary text -//d:N drives selected -//d:Parameter maximum length: 2 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_nof_of_memories "%N drives" - -//d:Setting list item secondary text -//d:MMC default name -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_default_mmc_name "Noname" - -//d:Source and target devices setting item secondary text -//d:Devices count where data search is done -//d:Parameter maximum length: 2 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_nof_servers "%N devices" - -//d:Source devices setting item secondary text -//d:No devices selected -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_none_serv "None" - -//d:Navi pane text -//d:Preprocesses files so that updated information can be seen on screen -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_wait_preprocessing "Updating lists" - -//d:Item primary text on listbox -//d:Name of the plugin -//l:list_double_large_graphic_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_grid_media_servant_home_media "Media Sync" - -//d:settings view title -//d:General synchronization settings -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_sync_settings "Sync settings" - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/src/msgspluginimplementationtable.cpp --- a/homesync/contentmanager/homesyncgsplugin/src/msgspluginimplementationtable.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: ECOM proxy table for MediaServant plugin. -* -*/ - - -// System includes -#include - -// User includes -#include "mssettingsview.h" - -// Constants -const TImplementationProxy KMSGSSettingsPluginImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10282912, CMSSettingsView::NewL ) - }; - -// --------------------------------------------------------------------------- -// ImplementationGroupProxy -// Gate/factory function -// -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - aTableCount = sizeof( KMSGSSettingsPluginImplementationTable ) - / sizeof( TImplementationProxy ); - return KMSGSSettingsPluginImplementationTable; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/src/msmultiselectionpopup.cpp --- a/homesync/contentmanager/homesyncgsplugin/src/msmultiselectionpopup.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,415 +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: Multiselection popup implementation -* -*/ - - -// INCLUDE FILES -#include -#include - -#include "cmmediaserverfull.h" -#include "msmultiselectionpopup.h" -#include "msconstants.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KSoftkeyOk = 63585; - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::NewL -// Two-phased constructor. -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup* CMSMultiselectionPopup::NewL( - TBool aUploadCapabilitySupport, - RPointerArray* aMediaServerArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ) - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewL begin")); - - CMSMultiselectionPopup* self = CMSMultiselectionPopup::NewLC( - aUploadCapabilitySupport, - aMediaServerArray, - aSelectionIndexArray ); - - CleanupStack::Pop( self ); - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewL end")); - return self; - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::NewLC -// Two-phased constructor. -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup* CMSMultiselectionPopup::NewLC( - TBool aUploadCapabilitySupport, - RPointerArray* aMediaServerArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ) - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewLC begin")); - - CMSMultiselectionPopup* self = - new(ELeave) CMSMultiselectionPopup( aUploadCapabilitySupport, - aMediaServerArray, - aSelectionIndexArray ); - - CleanupStack::PushL(self); - self->ConstructL(); - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::NewLC end")); - return self; - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::ConstructL -// Symbian 2nd phase constructor can leave. -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::ConstructL() - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::ConstructL begin")); - - for (TInt i=0;iCount();i++) - { - if ( iUploadCapabilitySupport && (*iServers)[i]->StoreUsage() ) - { - iPreviousSelection->AppendL(i); - } - else if (!iUploadCapabilitySupport && (*iServers)[i]->FillUsage() ) - { - iPreviousSelection->AppendL(i); - } - else - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::ConstructL \ - server not used")); - } - } - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::ConstructL end")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::CMSMultiselectionPopup -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup::CMSMultiselectionPopup( - TBool aUploadCapabilitySupport, - RPointerArray* aMediaServerArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ) - : CAknListQueryDialog( aSelectionIndexArray ), - iUploadCapabilitySupport ( aUploadCapabilitySupport ), - iServers( aMediaServerArray ), - iPreviousSelection( aSelectionIndexArray ) - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - CMSMultiselectionPopup")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::~CMSMultiselectionPopup -// C++ default destructor. -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup::~CMSMultiselectionPopup() - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - ~CMSMultiselectionPopup")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::UpdateAndDrawPopupL -// -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::UpdateAndDrawPopupL( - CCmMediaServerFull* aMediaServer ) - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - UpdateAndDrawPopupL begin")); - - // Listbox items - CDesCArray* device_array = static_cast - (ListControl()->listbox()->Model()->ItemTextArray()); - - HBufC* item = CreateListBoxItemLC( aMediaServer ); - device_array->AppendL( *item ); - CleanupStack::PopAndDestroy( item ); - - iListBox->HandleItemAdditionL(); // Update listbox - - Layout(); - SizeChanged(); - DrawNow(); - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - UpdateAndDrawPopupL ends")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::HandlePointerEventL -// -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::HandlePointerEventL - ( const TPointerEvent& aPointerEvent ) - { - CCoeControl::HandlePointerEventL( aPointerEvent ); - - if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) - { - TKeyEvent keyEvent; - keyEvent.iCode = EKeyOK; - this->OfferKeyEventL( keyEvent, EEventKey ); - } - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::AppendIconToArrayL -// -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ) const - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - AppendIconToArrayL begin")); - - __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC(aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId); - - CGulIcon* icon = CGulIcon::NewL(bitmap, mask); - icon->SetBitmapsOwnedExternally(EFalse); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop(2); // mask, bitmap - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL(icon); - - // ownership transferred - aArray->AppendL(icon); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(icon); - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - AppendIconToArrayL end")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::OkToExitL(TInt aButtonId) -// called by framework when the softkey is pressed -// --------------------------------------------------------------------------- -// -TBool CMSMultiselectionPopup::OkToExitL( TInt /*aButtonId*/ ) - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::OkToExitL")); - return ETrue; - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::AppendMediaServersL -// Appends items to the listbox -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::AppendMediaServersL() - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - AppendMediaServersL begin")); - - TInt serverCount = iServers->Count(); - - CDesCArray* listBoxArray = static_cast - (ListControl()->listbox()->Model()->ItemTextArray()); - - for ( TInt i = 0; i < serverCount; i++ ) - { - CCmMediaServerFull* server = (*iServers)[i]; - - HBufC* item = CreateListBoxItemLC( server ); - - listBoxArray->AppendL( *item ); - - CleanupStack::PopAndDestroy( item ); - } - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - AppendMediaServersL end")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::PreLayoutDynInitL() -// called by framework before dialog is shown -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::PreLayoutDynInitL() - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - PreLayoutDynInitL begin")); - - CAknListQueryDialog::PreLayoutDynInitL(); - - CAknIconArray* icons = new (ELeave) CAknIconArray( EIconLast ); - CleanupStack::PushL( icons ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName() ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOn, - EMbmAvkonQgn_indi_checkbox_on, - EMbmAvkonQgn_indi_checkbox_on_mask ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOff, - EMbmAvkonQgn_indi_checkbox_off, - EMbmAvkonQgn_indi_checkbox_off_mask ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnIndiNaviArrowRight, - EMbmAvkonQgn_indi_navi_arrow_right, - EMbmAvkonQgn_indi_navi_arrow_right_mask ); - - CAknListQueryDialog::SetIconArrayL( icons ); - - CleanupStack::Pop( icons ); - - iListBox = ListBox(); - SetOwnershipType( ELbmOwnsItemArray ); - - AppendMediaServersL(); - - iListBox->ActivateL(); - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - PreLayoutDynInitL end")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::PostLayoutDynInitL() -// Called by framework before dialog is shown. -// Needed because filter is not active until PreLayoutDynInitL(). -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::PostLayoutDynInitL() - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - PostLayoutDynInitL begin")); - - CAknListQueryDialog::PostLayoutDynInitL(); - ListBox()->ActivateL(); - - if ( iPreviousSelection && iPreviousSelection->Count() ) - { - iListBox->SetSelectionIndexesL( iPreviousSelection ); - } - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - PostLayoutDynInitL end")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::OfferKeyEventL() -// called by framework when key is pressed -// --------------------------------------------------------------------------- -// -TKeyResponse CMSMultiselectionPopup::OfferKeyEventL ( - const TKeyEvent &aKeyEvent, - TEventCode aType ) - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::OfferKeyEventL begin")); - - TKeyResponse status( EKeyWasNotConsumed ); - - // check if user has selected something - if (aKeyEvent.iCode == EKeyOK) - { - status = ListBox()->OfferKeyEventL( aKeyEvent, aType ); - - TInt itemNbr = iListBox->CurrentItemIndex(); - if( iListBox->View()->ItemIsSelected( itemNbr ) ) - { - iPreviousSelection->AppendL( itemNbr ); - } - else - { - TKeyArrayFix sortKey( 0, ECmpTInt ); - TInt itemIndex( 0 ); - - if( iPreviousSelection->Find( - itemNbr, sortKey, itemIndex ) == 0 ) - { - // remove selection - iPreviousSelection->Delete( itemIndex ); - } - } - } - else - { - // prevents to mark item if dialog is accepted with OK key - if ( aKeyEvent.iCode == KSoftkeyOk ) - { - iListBox->View()->SetDisableRedraw(ETrue); - } - - status = CAknListQueryDialog::OfferKeyEventL(aKeyEvent,aType); - } - - LOG(_L("[MediaServant]\t CMSMultiselectionPopup::OfferKeyEventL end")); - return status; -} - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::CreateListBoxItemLC() -// Creates listbox item -// --------------------------------------------------------------------------- -// -HBufC* CMSMultiselectionPopup::CreateListBoxItemLC( - const CCmMediaServerFull* aServer ) - { - LOG(_L("[MediaServant]\t CMSMultiselectionPopup:: \ - CreateListBoxItemLC")); - - TBuf serverName; - serverName.Copy( aServer->MediaServerName().Left( KMaxFileName ) ); - - HBufC* item = HBufC::NewLC( serverName.Size() + - sizeof( KSingleGraphicStyleFormatStringNoTrailIcons() ) ); - item->Des().Format( KSingleGraphicStyleFormatStringNoTrailIcons, - EUnCheckedBox, - &serverName ); - - return item; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/src/mssettingitemdevices.cpp --- a/homesync/contentmanager/homesyncgsplugin/src/mssettingitemdevices.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,776 +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: CMSSettingItemDevices class implementation -* -*/ - - -#include -#include -#include "upnpavdevice.h" -#include "upnpavcontroller.h" // for MUPnPAVController -#include "upnpavcontrollerfactory.h" // for UPnPAVControllerFactory -#include -#include // for CnvUtfConverter - -#include "cmmediaserverfull.h" -#include "cmcommonutils.h" -#include -#include "mssettingitemdevices.h" -#include "msmultiselectionpopup.h" -#include "msengine.h" -#include "upnpavdevicelist.h" -#include "msdebug.h" - -// CONSTANTS - -// reserved list size -const TInt KItemArrayGranularity = 3; - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::NewL -// -------------------------------------------------------------------------- -// -CMSSettingItemDevices* CMSSettingItemDevices::NewL( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - RPointerArray& aStoredServers, - TBool aUploadCapabilitySupport ) - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::NewL")); - - CMSSettingItemDevices* self = CMSSettingItemDevices::NewLC( - aIdentifier, - aText, - aMSEngine, - aStoredServers, - aUploadCapabilitySupport ); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::NewLC -// -------------------------------------------------------------------------- -// -CMSSettingItemDevices* CMSSettingItemDevices::NewLC( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - RPointerArray& aStoredServers, - TBool aUploadCapabilitySupport ) - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::NewLC")); - - CMSSettingItemDevices* self = new ( ELeave ) CMSSettingItemDevices( - aIdentifier, - aText, - aMSEngine, - aStoredServers, - aUploadCapabilitySupport ); - - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::ConstructL -// -------------------------------------------------------------------------- -// -void CMSSettingItemDevices::ConstructL() - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ConstructL begins")); - - iSettingText = HBufC::NewL( KMaxFileName ); - - iSelectedServers = - new (ELeave) CArrayFixFlat( KItemArrayGranularity ); - - SetSettingItemTextL(); - - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ConstructL ends")); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::~~CMSSettingItemDevices() -// -------------------------------------------------------------------------- -// -CMSSettingItemDevices::~CMSSettingItemDevices() - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::~CMSSettingItemDevices")); - - delete iSettingText; - - delete iSelectedServers; - - iServerList.Reset(); - iServerList.Close(); - - if ( iAvController ) - { - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - } - - if ( iWaitDialog ) - { - TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); - iWaitDialog = NULL; - } - - if ( iWait.IsStarted() ) - { - iWait.AsyncStop(); - } - - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CMSSettingItemDevices::EditItemL( TBool /*aCalledFromMenu*/ ) - { - LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::EditItemL") ); - - // restore original state - SetAcceptState( EFalse ); - - // Create list for selection - ReadServerListL(); - - // Create Avcontroller and fetch already discovered devices from it. - CreateAvcAndFetchDevicesL(); - - if( !iUserCancelledSearch ) - { - if ( iUploadCapabilitySupport ) - { - iDevSelectionDlg = CMSMultiselectionPopup::NewL( - iUploadCapabilitySupport, - &iServerList, - iSelectedServers ); - iDevSelectionDlg->PrepareLC( - R_MS_TARGET_DEVICE_SELECTION_DIALOG ); - } - else - { - iDevSelectionDlg = CMSMultiselectionPopup::NewL( - iUploadCapabilitySupport, - &iServerList, - iSelectedServers ); - iDevSelectionDlg->PrepareLC( - R_MS_SOURCE_DEVICE_SELECTION_DIALOG ); - } - - #ifndef __WINS__ - iDevSelectionDlg->QueryHeading()->SetHeaderAnimationL( - R_MSGS_ANIMATION_FOR_SELECTION_DIALOG ); - #endif - - TInt returnValue = iDevSelectionDlg->RunLD(); - - iDevSelectionDlg = NULL; - - CancelDeviceSearch(); - - if( returnValue ) - { - // User presses OK - SetAcceptState( ETrue ); - - SetServersActivity(); - SetSettingItemTextL(); - - iMSEngine.SetMediaServersL( iStoredServers ); - - LoadL(); - UpdateListBoxTextL(); - } - } - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::SetServersActivity -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::SetServersActivity() - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::SetServersActivity \ - begins")); - - // Set all servers inactive - for( TInt ind=0; ind < iStoredServers.Count(); ind++ ) - { - CCmMediaServerFull* server = iStoredServers[ind]; - - if ( iUploadCapabilitySupport ) - { - server->SetStoreUsage( EFalse ); - } - else - { - server->SetFillUsage( EFalse ); - } - - if ( !server->StoreUsage() && !server->FillUsage() ) - { - server->SetIsActive( EFalse ); - } - } - - // Set selected servers active - if( iSelectedServers ) - { - // loop trough selected servers - for ( TInt iy = 0; iy < iSelectedServers->Count(); iy++ ) - { - - // Look for the server in selection array - TInt selectedIndex = iSelectedServers->At( iy ); - // server points to iStoredServers table - CCmMediaServerFull* server = iServerList[selectedIndex]; - - if ( iUploadCapabilitySupport ) - { - server->SetStoreUsage( ETrue ); - } - else // fill server - { - server->SetFillUsage( ETrue ); - } - server->SetIsActive( ETrue ); - } - } - - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::SetServersActivity \ - ends")); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::CMSSettingItemDevices -// -------------------------------------------------------------------------- -// -CMSSettingItemDevices::CMSSettingItemDevices( TInt aIdentifier, TDes& aText, - CMSEngine& aMSEngine, - RPointerArray& aStoredServers, - TBool aUploadCapabilitySupport ): - CMSTextSettingItem( aIdentifier, aText ), - iMSEngine( aMSEngine ), - iStoredServers( aStoredServers ), - iUploadCapabilitySupport( aUploadCapabilitySupport ) - { - LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::CMSSettingItemDevices") ); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::ReadServerListL -// -// -------------------------------------------------------------------------- -// -void CMSSettingItemDevices::ReadServerListL() - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ReadServerListL")); - - // delete old ones - iServerList.Reset(); - - for ( TInt i = 0; i < iStoredServers.Count(); i++ ) - { - // Add selected/marked servers to list - if (iUploadCapabilitySupport && iStoredServers[i]->CopyCapability() - && iStoredServers[i]->StoreUsage() ) - { - // Add selected target servers - iServerList.AppendL(iStoredServers[i]); - } - else if (!iUploadCapabilitySupport && iStoredServers[i]->FillUsage() ) - { - // Add selected source servers - iServerList.AppendL(iStoredServers[i]); - } - else - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::ReadServerListL \ - Not selected servers should not show to user")); - } - } - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::SetSettingItemTextL -// Sets setting item secondary text according to selected items -// -------------------------------------------------------------------------- -// -void CMSSettingItemDevices::SetSettingItemTextL() - { - LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::SetSettingItemTextL") ); - - // count how many active devices threre are - TInt count = CountSelectedItems(); - HBufC* itemText = NULL; - - if ( count == 1 ) - { - // one active found - need to get server name - for ( TInt index = 0; index < iStoredServers.Count(); index++ ) - { - CCmMediaServerFull* server = iStoredServers[index]; - - if ( ( iUploadCapabilitySupport && server->StoreUsage() ) || - ( !iUploadCapabilitySupport && server->FillUsage() ) ) - { - itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - server->MediaServerName() ); - CleanupStack::PushL(itemText); - - iSettingText->Des().Copy( itemText->Left( KMaxFileName) ); - - CleanupStack::PopAndDestroy( itemText ); - index = iStoredServers.Count(); // break loop - } - else - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\ - SetSettingItemTextL copycapability required but not \ - supported by server")); - } - } - } - // more than one item selected - else - { - if ( count > 1 ) - { - itemText = StringLoader::LoadLC( R_MS_ITEM_DEVICES, count ); - } - else - { - itemText = StringLoader::LoadLC( R_MS_NO_SERVER_SELECTED ); - } - - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iSettingText->Des().Copy( *itemText ); - CleanupStack::PopAndDestroy( itemText ); - } - - // Set new value - SetExternalText( *iSettingText ); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::CountSelectedItems -// Counts selected items -// -------------------------------------------------------------------------- -// -TInt CMSSettingItemDevices::CountSelectedItems() const - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::CountSelectedItems")); - - TInt count(0); - - if( iStoredServers.Count() ) - { - TRACE(Print(_L("[MSGSPlugin]\t server COUNT: = %d"), - iStoredServers.Count() )); - for ( TInt index = 0; index < iStoredServers.Count(); index++ ) - { - - CCmMediaServerFull* server = iStoredServers[index]; - - if ( iUploadCapabilitySupport && server->StoreUsage() ) - { - count++; - } - else if ( !iUploadCapabilitySupport && server->FillUsage() ) - { - count++; - } - else - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\ - CountSelectedItems server not used")); - } - } - } - TRACE(Print(_L("[MSGSPlugin]\t active server COUNT: = %d"), - count )); - return count; - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::DialogDismissedL -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::DialogDismissedL( TInt aButtonId ) - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::DialogDismissedL")); - - if( aButtonId != EAknSoftkeyDone ) - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\ - DialogDismissedL CANCEL")); - iUserCancelledSearch = ETrue; - // cancel server search if it was started - CancelDeviceSearch(); - } - - if ( iWait.IsStarted() ) - { - iWait.AsyncStop(); - } - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::UPnPDeviceDiscoveredL -// Returns discovered device from UPnP AV control point. -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::UPnPDeviceDiscoveredL( - const CUpnpAVDevice& aDevice) - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::UPnPDeviceDiscoveredL")); - - // Check that this is mediaserver - if ( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer && - aDevice.SearchCapability() && aDevice.DlnaCompatible() ) - { - LOG(_L("[MSGSPlugin]\t Found device is Media server!")); - -#ifdef __DEBUG - HBufC* devName = UpnpString::ToUnicodeL( aDevice.FriendlyName() ); - TRACE(Print(_L("[MSGSPlugin]\t device Name= %S"), devName )); - delete devName; -#endif - TPtrC8 deviceUDN = aDevice.Uuid(); - - TInt serverCount = iStoredServers.Count(); - TBool newServer( ETrue ); - CCmMediaServerFull* tempServer = NULL; - - // Check if server is already on the list - for ( TInt i=0; i < serverCount; i++ ) - { - // Compare server udn - if ( deviceUDN.Compare( - iStoredServers[i]->MediaServer() ) == 0 ) - { - tempServer = iStoredServers[i]; - // server already on the list - i = serverCount; // end loop - newServer = EFalse; - } - } - - if ( newServer ) - { - tempServer = CCmMediaServerFull::NewL(); - CleanupStack::PushL( tempServer ); - tempServer->SetUDNL( aDevice.Uuid() ); - tempServer->SetMediaServerNameL( aDevice.FriendlyName() ); - tempServer->SetCopyCapability( aDevice.CopyCapability() ); - - // Add the server to found list - iStoredServers.Append( tempServer ); - - CleanupStack::Pop( tempServer ); - } - // Add unselected servers to show to user - if ( ( iUploadCapabilitySupport && tempServer->CopyCapability() - && !tempServer->StoreUsage() ) - || ( !iUploadCapabilitySupport && !tempServer->FillUsage() ) ) - { - iServerList.AppendL( tempServer ); - if ( iWaitDialog ) - { - TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); - iWaitDialog = NULL; - } - - // If devices are searched for the first time - // the dialog needs to be created in EditItemL. - // This call is for updating existing dialog. - if ( iDevSelectionDlg ) - { - iDevSelectionDlg->UpdateAndDrawPopupL( tempServer ); - } - } - } - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::UPnPDeviceDiscovered -// Returns discovered device from UPnP AV control point -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::UPnPDeviceDiscovered( - const CUpnpAVDevice& aDevice ) - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\ - UPnPDeviceDiscovered")); - - TRAP_IGNORE( UPnPDeviceDiscoveredL( aDevice ) ); - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::UPnPDeviceDisappeared -// Returns disappeared device from UPnP AV control point. -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::UPnPDeviceDisappeared( - const CUpnpAVDevice& /*aDevice*/ ) - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::\ - UPnPDeviceDisappeared")); - // do nothing - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::WLANConnectionLost -// Notifies wlan connection lost -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::WLANConnectionLost() - { - LOG(_L("[MSGSPlugin]\t CMSSettingItemDevices::WLANConnectionLost")); - - TRAP_IGNORE( DialogDismissedL( EAknSoftkeyCancel ) ); - if ( iWaitDialog ) - { - TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); - iWaitDialog = NULL; - } - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::CreateAvcontrollerL -// -// -------------------------------------------------------------------------- -// -TInt CMSSettingItemDevices::CreateAvcontrollerL() - { - LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::CreateAvcontrollerL" ) ); - - if( iAvController ) - { - iAvController->Release(); - iAvController = NULL; - } - - iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL(); - - if( iAvController ) - { - iAvController->SetDeviceObserver( *this ); - } - - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemDevices::CancelDeviceSearch -// -// -------------------------------------------------------------------------- -// -void CMSSettingItemDevices::CancelDeviceSearch() - { - LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::CancelDeviceSearch" ) ); - - if ( iAvController ) - { - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - } - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::FetchAlreadyDiscoveredDevicesL -// Fetches devices from AVController and calls -// DeviceDiscovered-callback for each of them. -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::FetchAlreadyDiscoveredDevicesL() - { - LOG( _L("[MSGSPlugin]\t CMSSettingItemDevices::\ - FetchAlreadyDiscoveredDevicesL") ); - - // If iAvController is not created, this method is unusable. - // Call CreateAvControllerL first. - User::LeaveIfNull( iAvController ); - - // Fetch already found devices from AVController. - CUpnpAVDeviceList* discoveredDevices = - iAvController->GetMediaServersL(); - CleanupStack::PushL( discoveredDevices ); - - if ( discoveredDevices && discoveredDevices->Count() > 0 ) - { - // the AVController already has some devices. - LOG(_L("[MSGSPlugin]\t \ - CMSSettingItemDevices::FetchAlreadyDiscoveredDevicesL: \ - AVController has already discovered devices" ) ); - - // process the already existing devices - for ( TInt i = 0 ; i < discoveredDevices->Count() ; i++ ) - { - UPnPDeviceDiscovered( - *( discoveredDevices->operator[](i) ) ); - } - } - - // clean up - CleanupStack::PopAndDestroy( discoveredDevices ); - discoveredDevices = NULL; - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::CreateAvcAndFetchDevicesL -// Creates AVController, fetches devices from it and calls -// DeviceDiscovered-callback for each of them. Starts wait note if no devices -// are already discovered. -// --------------------------------------------------------------------------- -// -TInt CMSSettingItemDevices::CreateAvcAndFetchDevicesL() - { - LOG( _L( - "[MSGSPlugin]\t CMSSettingItemDevices::CreateAvcAndFetchDevicesL" ) - ); - - iUserCancelledSearch = EFalse; - - if( iSelectedServers ) - { - iSelectedServers->Reset(); - delete iSelectedServers; - iSelectedServers = NULL; - } - iSelectedServers = - new (ELeave) CArrayFixFlat( KItemArrayGranularity ); - - iCreateAvCState = EPhaseNotActive; - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL( reinterpret_cast( waitNoteWrapper ) ); - TRAPD( err, waitNoteWrapper->ExecuteL( - R_MS_WAIT_FOR_CREATEAVC_DIALOG, - *this, - ETrue ) );//ETrue = show immediately - CleanupStack::PopAndDestroy( waitNoteWrapper ); - - - if ( iAvController ) - { - // Process devices that AVController has already discovered. - FetchAlreadyDiscoveredDevicesL(); - - // If still no devices discovered, start wait note. - if ( iServerList.Count() == 0 ) - { - iWaitDialog = new ( ELeave ) CAknWaitDialog( - ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) ); - iWaitDialog->SetCallback( this ); - iWaitDialog->ExecuteLD( R_MS_WAIT_DIALOG ); - LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::\ - CreateAvcAndFetchDevicesL starting wait" ) ); - iWait.Start(); // wait here until first server is found. - } - } - else - { - //handle the error - if( KErrDiskFull == err ) - { - ShowErrorNoteL( R_MS_GS_MEMORY_FULL ); - } - iUserCancelledSearch = ETrue; // Don't show selection dialog. - } - - return err; - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::ShowErrorNoteL -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::ShowErrorNoteL( TInt aTextResource ) - { - LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::ShowErrorNoteL" ) ); - HBufC* warningText = - StringLoader::LoadLC( aTextResource ); - CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ); - dlg->ExecuteLD( *warningText ); - CleanupStack::PopAndDestroy( warningText ); - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::StepL -// --------------------------------------------------------------------------- -// -void CMSSettingItemDevices::StepL() - { - LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::StepL" ) ); - if( EPhaseNotActive == iCreateAvCState ) - { - CreateAvcontrollerL(); - iCreateAvCState = EPhaseCompleted; - } - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::IsProcessDone -// --------------------------------------------------------------------------- -// -TBool CMSSettingItemDevices::IsProcessDone() const - { - LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::IsProcessDone" ) ); - TBool ret( EFalse ); - if ( EPhaseNotActive == iCreateAvCState ) - { - // try to start avcontroller - } - else if ( EPhaseCompleted == iCreateAvCState ) - { - ret = ETrue; - } - else - { - LOG( _L( "[MSGSPlugin]\t CMSSettingItemDevices::IsProcessDone \ - other branch" ) ); - } - return ret; - } - -// --------------------------------------------------------------------------- -// CMSSettingItemDevices::CycleError -// handles the error -// --------------------------------------------------------------------------- -// -TInt CMSSettingItemDevices::CycleError( TInt aError ) - { - TRACE( Print( _L( " CMSSettingItemDevices::CycleError \ - aError = %d " ), aError ) ); - - return aError; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/src/mssettingitemlist.cpp --- a/homesync/contentmanager/homesyncgsplugin/src/mssettingitemlist.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,495 +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: CMSSettingItemList class implementation -* -*/ - - -#include -#include // for RProperty -#include // for StringLoader -#include // for profile -#include // for profile -#include - -#include "cmsettingsfactory.h" -#include "cmcommonutils.h" -#include "cmsettings.h" -#include "cmdriveinfo.h" -#include "mserv.hlp.hrh" -#include "msengine.h" -#include "mssettingitemlist.h" -#include "mssettingitemmemory.h" // mmc name -#include "mssettingitemdevices.h" // source devices -#include "mssettingsview.h" -#include "msconstants.h" -#include "cmmediaserverfull.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KOfflineProfile = 5; - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CMSSettingItemList::NewL() -// Two phase constructor. -// -------------------------------------------------------------------------- -// -CMSSettingItemList* CMSSettingItemList::NewL( TInt aResourceId, - CMSSettingsView& aView ) - { - LOG(_L("[MediaServant]\t CMSSettingItemList::NewL")); - - CMSSettingItemList* self = CMSSettingItemList::NewLC( aResourceId, - aView ); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::NewLC() -// Two phase constructor. -// -------------------------------------------------------------------------- -// -CMSSettingItemList* CMSSettingItemList::NewLC( TInt aResourceId, - CMSSettingsView& aView ) - { - LOG(_L("[MediaServant]\t CMSSettingItemList::NewLC")); - - CMSSettingItemList* self = new ( ELeave ) CMSSettingItemList( - aView ); - CleanupStack::PushL( self ); - self->ConstructL( aResourceId ); - return self; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::CMSSettingItemList() -// -------------------------------------------------------------------------- -// -CMSSettingItemList::CMSSettingItemList( CMSSettingsView& aView ) - : iView( aView ) - { - LOG(_L("[MediaServant]\t CMSSettingItemList::CMSSettingItemList")); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::~CMSSettingItemList() -// -------------------------------------------------------------------------- -// -CMSSettingItemList::~CMSSettingItemList() - { - LOG(_L("[MediaServant]\t CMSSettingItemList::~CMSSettingItemList")); - - if ( iStoredServers ) - { - iStoredServers->ResetAndDestroy(); - iStoredServers->Close(); - delete iStoredServers; - } - - if ( iMSEngine ) - { - delete iMSEngine; - } - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::ConstructL() -// Second phase constructor. -// -------------------------------------------------------------------------- -// -void CMSSettingItemList::ConstructL( TInt aResourceId ) - { - LOG(_L("[MediaServant]\t CMSSettingItemList::ConstructL")); - - // Create engine - iMSEngine = CMSEngine::NewL(); - - // Set engine observer - iMSEngine->SetObserver( this ); - // Read memory manager setting - iMemoryManager = - iMSEngine->ServiceState( ECmServiceMemoryManager ); - - iSync = iMSEngine->ServiceState( ECmServiceContentManager ); - - // Get server list - iStoredServers = iMSEngine->GetMediaServersL(); - - CAknSettingItemList::ConstructFromResourceL( aResourceId ); - - // sets memory selection setting visibility - SetMemorySelectionL(); - - iListBox = ListBox(); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::OpenSelectedListboxItemL -// -------------------------------------------------------------------------- -// -void CMSSettingItemList::OpenSelectedListboxItemL() - { - LOG(_L("[MediaServant]\t CMSSettingItemList::OpenSelectedListboxItemL")); - - HandleListBoxEventL( ListBox(), EEventEnterKeyPressed ); - } - - -// -------------------------------------------------------------------------- -// CMSSettingItemList::HandleListBoxEventL() -// -------------------------------------------------------------------------- -// -void CMSSettingItemList::HandleListBoxEventL( CEikListBox *aListBox, - TListBoxEvent aEventType) - { - LOG(_L("[MediaServant]\t CMSSettingItemList::HandleListBoxEventL")); - - CAknSettingItemList::HandleListBoxEventL( aListBox, aEventType ); - - // UI selection is stored to actual settings variable - StoreSettingsL(); - - TInt listBoxItemIndex = iListBox->CurrentItemIndex(); - CAknSettingItemArray* itemArray = SettingItemArray(); - TInt realIndex = itemArray->ItemIndexFromVisibleIndex( - listBoxItemIndex ); - - if ( realIndex == EMSSettingsSync ) - { - iMSEngine->SetServiceState( ECmServiceContentManager, - iSync ); - // inform plugin about changed setting - TCmProgressInfo info; - info.iProcessedItems = 0, - info.iTotalItems = 0; - info.iService = ECmServiceNone; - - TCmProgressInfoPckg transferInfoPckg( info ); - - RProperty::Set( KCmPropertyCat, KCmProperty, - transferInfoPckg ); - - // we aren't allowed to set wlan scanning in offline mode - if ( GetCurrentProfileL() != KOfflineProfile ) - { - // Set wlan scanning parameters - TInt interval = ( iSync == ECmServiceStateDisabled ? - KWlanScanNetworkNever : KWlanScanNetworkInterval60 ); - - CmCommonUtils::SetWlanScanL( interval ); - } - } - - else if ( realIndex == EMSMemoryManager ) - { - iMSEngine->SetServiceState( ECmServiceMemoryManager, - iMemoryManager ); - } - else - { - LOG(_L("[MediaServant]\t CMSSettingItemList::\ - HandleListBoxEventL no such item")); - } - } - -// -------------------------------------------------------------------------- -// CAknSettingItem* CMSSettingItemList::CreateSettingItemL(TInt aIdentifier) -// Takes care of creating actual setting items. -// -------------------------------------------------------------------------- -// -CAknSettingItem* CMSSettingItemList::CreateSettingItemL( TInt aIdentifier ) - { - LOG(_L("[MediaServant]\t CMSSettingItemList::CreateSettingItemL")); - - CAknSettingItem* settingItem = NULL; - - // setting item is created according to aIdentifier - switch ( aIdentifier ) - { - case EMSSettingsSync: - { - LOG(_L("[MediaServant]\t List Item: EMSSettingsSync")); - settingItem = new (ELeave ) CAknEnumeratedTextPopupSettingItem( - aIdentifier, - reinterpret_cast (iSync) ); - break; - } - - case EMSSettingsSourceDevices: - { - LOG(_L("[MediaServant]\t List Item: EMSSettingsSourceDevices")); - settingItem = CMSSettingItemDevices::NewL ( - aIdentifier, - iDummyText, - *iMSEngine, - *iStoredServers ); - break; - } - - case EMSSettingsTargetDevices: - { - LOG(_L("[MediaServant]\t List Item: EMSSettingsTargetDevices")); - settingItem = CMSSettingItemDevices::NewL ( - aIdentifier, - iDummyText, - *iMSEngine, - *iStoredServers, - ETrue ); - break; - } - - case EMSSettingsMemory: - { - LOG(_L("[MediaServant]\t List Item: EMSSettingsMMC")); - settingItem = CMSSettingItemMemory::NewL ( - aIdentifier, - iDummyText, - *iMSEngine, - *this ); - break; - } - - case EMSMemoryManager: - { - LOG(_L("[MediaServant]\t List Item: EMSMemoryManager")); - settingItem = new ( ELeave ) CAknBinaryPopupSettingItem( - aIdentifier, - reinterpret_cast (iMemoryManager) ); - break; - } - - default: - { - LOG(_L("[MediaServant]\t No list item found")); - break; - } - } - return settingItem; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::EditItemL() -// Called by framework when item is opened -// -------------------------------------------------------------------------- -// -void CMSSettingItemList::EditItemL ( TInt aIndex, TBool aCalledFromMenu ) - { - CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); - - if ( iListBox->CurrentItemIndex() == EMSSettingsSourceDevices ) - { - CMSSettingItemDevices* item = static_cast - (SearchItemById( EMSSettingsSourceDevices )); - - if ( item->SettingAccepted() ) - { - TCmServerState state( ECmServerStateIdle ); - // List of unselected servers - RPointerArray unselectedServers; - - iMSEngine->ServerState( state ); - if ( state != ECmServerStateIdle ) - { - iMSEngine->StopOperation(); - } - iView.ClearCurrentNaviPaneText(); - - iMSEngine->DeleteMetadataL(); - - HBufC* naviText = StringLoader::LoadLC( - R_MS_PREPROCESSING_TEXT ); - iView.SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::SearchItemById -// Searches item from the itemarray by given ID -// -------------------------------------------------------------------------- -// -CAknSettingItem* CMSSettingItemList:: - SearchItemById( const TMSSettingItems aId ) const - { - LOG(_L("[MediaServant]\t CMSSettingItemList::SearchItemById")); - - CAknSettingItem* item = NULL; - CAknSettingItemArray* itemArray = SettingItemArray(); - TInt count = itemArray->Count(); - - for ( TInt index = 0; index < count; index++ ) - { - if ( itemArray->At( index )->Identifier() == aId ) - { - item = itemArray->At( index ); - // end loop - index = count; - } - } - return item; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CMSSettingItemList::SizeChanged() - { - LOG(_L("[MediaServant]\t CMSSettingItemList::SizeChanged")); - - ListBox()->SetRect( Rect() ); // Set rectangle of listbox. - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSSettingItemList::HandleResourceChange( TInt aType ) - { - LOG(_L("[MediaServant]\t CMSSettingItemList::HandleResourceChange")); - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect( iView.ClientRect() ); - } - - CCoeControl::HandleResourceChange( aType ); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::ReadyL() -// engine observer callback -// -------------------------------------------------------------------------- -// -#ifdef __DEBUG -void CMSSettingItemList::ReadyL( TCmService aService, TInt aError ) -#else -void CMSSettingItemList::ReadyL( TCmService aService, TInt /*aError*/ ) -#endif - { - LOG(_L("[MediaServant]\t CMSSettingItemList::ReadyL")); -#ifdef __DEBUG - TRACE(Print(_L("[MediaServant]\t CMSSettingItemList::\ - ReadyL error %d"), aError)); -#endif - - - switch ( aService ) - { - case ECmServiceDeleteMetadata: - { - iMSEngine->ExecuteFillPreProcessingL(); - break; - } - case ECmServicePreProcessingFill: - { - iView.ClearCurrentNaviPaneText(); - break; - } - default: - { - // do nothing - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSSettingItemList::MSEngine() -// -------------------------------------------------------------------------- -// -CMSEngine* CMSSettingItemList::MSEngine() - { - LOG(_L("[MediaServant]\t CMSSettingItemList::MSEngine")); - - return iMSEngine; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::GetCurrentProfileL() -// Reads current profile -// -------------------------------------------------------------------------- -// -TInt CMSSettingItemList::GetCurrentProfileL() const - { - LOG(_L("[MediaServant]\t CMSSettingItemList::GetCurrentProfileL")); - - TInt profile( 0 ); - CRepository* repository = CRepository::NewLC( KCRUidProfileEngine ); - repository->Get( KProEngActiveProfile, profile ); - CleanupStack::PopAndDestroy( repository ); - - return profile; - } - - -// --------------------------------------------------------------------------- -// CMSSettingItemList::SetMemorySelectionL -// --------------------------------------------------------------------------- -// -void CMSSettingItemList::SetMemorySelectionL() - { - LOG(_L("[MediaServant]\t CMSSettingItemList::SetMemorySelectionL")); - - TBool memoryCardFound( EFalse ); - RPointerArray driveArray; - CleanupClosePushL( driveArray ); - MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC(); - - // get available drives - settings->DriveListL( ControlEnv()->FsSession(), driveArray ); - settings->Close(); - CleanupStack::Pop(); // settings - - TInt driveCount = driveArray.Count(); - for ( TInt i = 0; i < driveCount; i++ ) - { - if ( driveArray[i]->DriveType() == DriveInfo::EDriveRemovable ) - { - memoryCardFound = ETrue; - i = driveCount; // break loop - } - } - if ( !memoryCardFound ) - { - CAknSettingItem* item = SearchItemById( EMSSettingsMemory ); - item->SetHidden( ETrue); - // visibility changed - HandleChangeInItemArrayOrVisibilityL(); - } - - driveArray.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &driveArray ); - } - -// --------------------------------------------------------------------------- -// CMSSettingItemList::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSSettingItemList::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSSettingItemList::GetHelpContext")); - - aContext.iMajor = KUidMediaServant; - aContext.iContext = KMSERV_HLP_SYNC_SETTINGS; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/src/mssettingitemmemory.cpp --- a/homesync/contentmanager/homesyncgsplugin/src/mssettingitemmemory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +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: CMSSettingItemMemory class implementation -* -*/ - - -#include -#include // StringLoader -#include // CSelectionItemList -#include - -#include "cmsettingsfactory.h" -#include "cmsettings.h" -#include "cmdriveinfo.h" -#include "mssettingitemmemory.h" -#include "mssettingitemlist.h" -#include "msconstants.h" -#include "msengine.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KArrayGranularity = 2; // memory list size - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::NewL -// -------------------------------------------------------------------------- -// -CMSSettingItemMemory* CMSSettingItemMemory::NewL( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - CMSSettingItemList& aParent ) - { - LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewL")); - - CMSSettingItemMemory* self = CMSSettingItemMemory::NewLC( - aIdentifier, - aText, - aMSEngine, - aParent ); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::NewLC -// -------------------------------------------------------------------------- -// -CMSSettingItemMemory* CMSSettingItemMemory::NewLC( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - CMSSettingItemList& aParent ) - { - LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewLC")); - - CMSSettingItemMemory* self = new (ELeave) CMSSettingItemMemory( - aIdentifier, - aText, - aMSEngine, - aParent ); - - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::ConstructL -// -------------------------------------------------------------------------- -// -void CMSSettingItemMemory::ConstructL() - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::ConstructL")); - - iItemArray = new ( ELeave ) CSelectionItemList( KArrayGranularity ); - // Create selection list - CreateSelectionListL(); - // set setting item secondary text - SetSettingItemTextL(); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::~CMSSettingItemMemory() -// -------------------------------------------------------------------------- -// -CMSSettingItemMemory::~CMSSettingItemMemory() - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::~CMSSettingItemMemory")); - - if ( iItemArray ) - { - iItemArray->ResetAndDestroy(); - delete iItemArray; - } - - iDriveArray.ResetAndDestroy(); - iDriveArray.Close(); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CMSSettingItemMemory::EditItemL( TBool /*aCalledFromMenu*/ ) - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::EditItemL")); - - if ( iItemArray->Count() ) - { - CAknSettingPage* dlg = new ( ELeave ) CAknCheckBoxSettingPage( - R_MS_MEMORYSELECTION_SETTING, iItemArray ); - - //store item before launch setting page - CSelectionItemList* tempItemArray = new ( ELeave ) - CSelectionItemList( KArrayGranularity ); - CleanupStack::PushL( tempItemArray ); - for ( TInt i = 0; i < iItemArray->Count(); i++ ) - { - HBufC* memoryName = ( *iItemArray )[i]->ItemText().AllocLC(); - TBool selected = ( *iItemArray )[i]->SelectionStatus(); - CSelectableItem* tempitem = new ( ELeave ) - CSelectableItem( *memoryName, selected ); - CleanupStack::PushL( tempitem ); - tempitem->ConstructL(); - tempItemArray->AppendL( tempitem ); // ownership transferred - CleanupStack::Pop( tempitem ); - CleanupStack::PopAndDestroy( memoryName ); - } - - // launch setting page - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::\ - EditItemL Press Ok to exit")); - SetStorageInformationL(); - SetSettingItemTextL(); - UpdateListBoxTextL(); - } - else - { - //restore item after press cancel key to exit setting page - LOG(_L("[MediaServant]\t CMSSettingItemMemory::\ - EditItemL Press Cancel to exit")); - if( iItemArray ) - { - iItemArray->ResetAndDestroy(); - } - - for ( TInt i = 0; i < tempItemArray->Count(); i++ ) - { - iItemArray->AppendL( ( *tempItemArray )[i] ); - //ownership transferred - } - } - - CleanupStack::PopAndDestroy( tempItemArray ); - } - } - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::SetSettingItemTextL -// Sets setting item secondary text according to selected items -// -------------------------------------------------------------------------- -// -void CMSSettingItemMemory::SetSettingItemTextL() - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::SetSettingItemTextL")); - - TInt count(0); - - // count selected items - for ( TInt i = 0; i < iItemArray->Count(); i++ ) - { - if ( (*iItemArray)[i]->SelectionStatus() ) - { - count++; - } - } - - HBufC* itemText = NULL; - // Check if there is no selected items - if ( count == 0 ) - { - itemText = StringLoader::LoadLC( R_MS_NO_MEMORY_IN_USE ); - } - // Check if only one item is selected - else if ( count == 1 ) - { - TInt itemCount = iItemArray->Count(); - for ( TInt index = 0; index < itemCount; index++ ) - { - CSelectableItem* item = (*iItemArray)[ index ]; - if ( item->SelectionStatus() ) - { - itemText = item->ItemText().AllocLC(); - index = itemCount; // break loop - } - } - } - // more than one item selected - else - { - itemText = StringLoader::LoadLC( R_MS_NOF_MEMORIES_IN_USE, count ); - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - } - - if ( itemText ) - { - // Set new value - SetExternalText( *itemText ); - LoadL(); - CleanupStack::PopAndDestroy( itemText ); - } - } - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::CMSSettingItemMemory -// -------------------------------------------------------------------------- -// -CMSSettingItemMemory::CMSSettingItemMemory( - TInt aIdentifier, - TDes& aText, - CMSEngine& aMSEngine, - CMSSettingItemList& aParent - ) : - CAknTextSettingItem( aIdentifier, aText ), - iMSEngine( aMSEngine ), - iParent( aParent ) - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::CMSSettingItemMemory")); - } - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::CreateSelectionListL -// Creates selection list using drivelist and stored drivelit as input -// -------------------------------------------------------------------------- -// -void CMSSettingItemMemory::CreateSelectionListL() - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::CreateSelectionListL")); - - RFs fileSession = iParent.ControlEnv()->FsSession(); - - MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC(); - settings->DriveListL( fileSession, iDriveArray ); - - RPointerArray storedDrives; - CleanupClosePushL( storedDrives ); - iMSEngine.GetDrivesL( storedDrives ); - - for ( TInt i = 0; i< iDriveArray.Count(); i++ ) - { - TDesC* memoryName = NULL; - - if ( iDriveArray[i]->DriveName().Length() ) - { - memoryName = iDriveArray[i]->DriveName().AllocLC(); - } - else - { - // use default name if drive has no name - memoryName = StringLoader::LoadLC( - R_MS_SETTINGS_DEFAULT_MEMORY_NAME ); - } - - TBool selected( EFalse ); - for ( TInt j = 0; j < storedDrives.Count(); j++) - { - if ( storedDrives[j]->DriveId() == iDriveArray[i]->DriveId() ) - { - selected = ETrue; - } - } - CSelectableItem* item = new ( ELeave ) CSelectableItem( *memoryName, - selected ); - CleanupStack::PushL( item ); - item->ConstructL(); - iItemArray->AppendL( item ); // ownership transferred - CleanupStack::Pop( item ); - CleanupStack::PopAndDestroy( memoryName ); - } - - storedDrives.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &storedDrives ); - settings->Close(); - CleanupStack::Pop(); // settings - } - -// -------------------------------------------------------------------------- -// CMSSettingItemMemory::SetStorageInformationL -// Sets drive information and quota -// -------------------------------------------------------------------------- -// -void CMSSettingItemMemory::SetStorageInformationL() - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::SetStorageInformationL")); - - RPointerArray activeDrives; - for ( TInt i = 0; i < iItemArray->Count(); i++ ) - { - if ( (*iItemArray)[i]->SelectionStatus() ) - { - TInt64 quota(0); - if ( iDriveArray[i]->DriveType() & DriveInfo::EDriveRemovable ) - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::\ - SetStorageInformationL set memory card quota")); - // memory card - quota = - ( iDriveArray[i]->DriveSize() * KMMCDefaultQuota ) / 100; - } - else - { - LOG(_L("[MediaServant]\t CMSSettingItemMemory::\ - SetStorageInformationL internal memory quota")); - // internal hd - quota = - ( iDriveArray[i]->DriveSize() * KHDDefaultQuota ) / 100; - - } - // add quota to drive info - iDriveArray[i]->SetDriveQuota( quota ); - // add selected drive to array - activeDrives.AppendL( iDriveArray[i] ); - } - } - - // store drive information - TRACE(Print(_L("[MediaServant]\t CMSSettingItemMMemory::\ - SetStorageInformationL drivecount = %d"), activeDrives.Count())); - iMSEngine.SetDrivesL( activeDrives ); - activeDrives.Reset(); - activeDrives.Close(); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/src/mssettingitems.cpp --- a/homesync/contentmanager/homesyncgsplugin/src/mssettingitems.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: Setting item class implementations -* -*/ - - -#include "mssettingitems.h" -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::CMSTextSettingItem -// -------------------------------------------------------------------------- -// -CMSTextSettingItem::CMSTextSettingItem( TInt aIdentifier, TDes& aText ) : - CAknTextSettingItem( aIdentifier, aText ) - { - LOG(_L("[MediaServant]\t CMSTextSettingItem::CMSTextSettingItem")); - } - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::SettingAccepted -// -------------------------------------------------------------------------- -// -TBool CMSTextSettingItem::SettingAccepted() - { - LOG(_L("[MediaServant]\t CMSTextSettingItem::SettingAccepted")); - - return iOKPressed; - } - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::SetAcceptState -// -------------------------------------------------------------------------- -// -void CMSTextSettingItem::SetAcceptState( TBool aState ) - { - LOG(_L("[MediaServant]\t CMSTextSettingItem::SetAcceptState")); - - iOKPressed = aState; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncgsplugin/src/mssettingsview.cpp --- a/homesync/contentmanager/homesyncgsplugin/src/mssettingsview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,333 +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: CMSSettingsView class implementation -* -*/ - - -#include -#include -#include -#include -#include -#include -#include - -#include "cmcommonutils.h" -#include "msconstants.h" -#include "mssettingitemlist.h" -#include "msgspluginuids.h" -#include "mssettingsview.h" -#include "msengine.h" -#include "msdebug.h" - -// CONSTANTS -_LIT( KMediaservantRscFile, "\\resource\\msgspluginsrc.rsc" ); -_LIT( KMSGSMifFileName, "\\resource\\apps\\msgsplugin.mif" ); - -// -------------------------------------------------------------------------- -// Two phased constructor. -// -------------------------------------------------------------------------- -// -CMSSettingsView* CMSSettingsView::NewL() - { - LOG(_L("[MediaServant]\t CMSSettingsView::NewL")); - - CMSSettingsView* self = CMSSettingsView::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// Two phased constructor. -// -------------------------------------------------------------------------- -// -CMSSettingsView* CMSSettingsView::NewLC() - { - LOG(_L("[MediaServant]\t CMSSettingsView::NewLC")); - - CMSSettingsView* self = new ( ELeave ) CMSSettingsView(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::CMSSettingsView() -// -------------------------------------------------------------------------- -// -CMSSettingsView::CMSSettingsView() - { - LOG(_L("[MediaServant]\t CMSSettingsView::CMSSettingsView")); - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSSettingsView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSSettingsView::ConstructL")); - - iCoeEnv = CEikonEnv::Static(); - // Load resource file - iResFileOffset = CmCommonUtils::LoadResourceFileL( - KMediaservantRscFile(), - *iCoeEnv ); - - BaseConstructL( R_MS_SETTINGS_VIEW ); - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::~CMSSettingsView() -// -------------------------------------------------------------------------- -// -CMSSettingsView::~CMSSettingsView() - { - LOG(_L("[MediaServant]\t CMSMainView::~CMSSettingsView")); - - ClearCurrentNaviPaneText(); - - if ( iResFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResFileOffset ); - } - - DoDeactivate(); - } - -// -------------------------------------------------------------------------- -// TUid CMSSettingsView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSSettingsView::Id() const - { - LOG(_L("[MediaServant]\t CMSSettingsView::Id")); - - return KMSGSImplementationUid; - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSSettingsView::HandleCommandL( TInt aCommand ) - { - TRACE(Print(_L("[MediaServant]\t CMSSettingsView::\ -HandleCommandL command = %d"), aCommand )); - - switch ( aCommand ) - { - case EAknCmdOpen: - { - iSettingItemList->OpenSelectedListboxItemL(); - break; - } - case EAknSoftkeyBack: - { - TCmServerState state; - iSettingItemList->MSEngine()->ServerState( state ); - if ( state != ECmServerStateIdle ) - { - iSettingItemList->MSEngine()->StopOperation(); - } - - CAknView* activeView = AppUi()->View( KMSMainViewId ); - CAknView* activeView2 = AppUi()->View( KGSMainViewUid ); - - if ( activeView ) - { - AppUi()->ActivateLocalViewL( KMSMainViewId ); - } - else if ( activeView2 ) - { - AppUi()->ActivateLocalViewL( KGSAppsPluginUid ); - } - else - { - LOG(_L("[MediaServant]\t CMSSettingsView::HandleCommandL \ - parent view not found")); - } - - break; - } - case EAknCmdHelp : - { - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::DoActivateL(...) -// -------------------------------------------------------------------------- -// -void CMSSettingsView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - LOG(_L("[MediaServant]\t CMSSettingsView::DoActivateL")); - - // Set title pane text to default - SetTitlePaneTextL( R_MS_GS_SETTINGS_VIEW_TITLE ); - - if ( !iSettingItemList ) - { - // create settings screen - iSettingItemList = CMSSettingItemList::NewL( R_MS_GENERAL_SETTINGS, - *this ); - iSettingItemList->SetMopParent( this ); - - // now control receives keyboard events - AppUi()->AddToStackL( *this, iSettingItemList ); - iSettingItemList->ActivateL(); - - } - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSSettingsView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSSettingsView::DoDeactivate")); - - if ( iSettingItemList ) - { - AppUi()->RemoveFromStack( iSettingItemList ); - } - - delete iSettingItemList; // Deletes the container class object. - iSettingItemList = NULL; - } - -// -------------------------------------------------------------------------- -// Method for getting caption of this plugin. -// -------------------------------------------------------------------------- -// -void CMSSettingsView::GetCaptionL( TDes& aCaption ) const - { - LOG(_L("[MediaServant]\t CMSSettingsView::GetCaptionL")); - - HBufC* pluginText = StringLoader::LoadLC( R_MS_GS_PLUGIN_TEXT ); - aCaption.Copy( *pluginText ); - CleanupStack::PopAndDestroy( pluginText ); - } - -// -------------------------------------------------------------------------- -// Creates a new icon of desired type. -// -------------------------------------------------------------------------- -// -CGulIcon* CMSSettingsView::CreateIconL( const TUid /*aIconType*/ ) - { - LOG(_L("[MediaServant]\t CMSSettingsView::CreateIconL")); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName() ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC( skin, - KAknsIIDDefault, - bitmap, - mask, - KMSGSMifFileName, - EMbmMsgspluginQgn_mserv_app_menu_icon, - EMbmMsgspluginQgn_mserv_app_menu_icon_mask ); - - CGulIcon* icon = CGulIcon::NewL(bitmap, mask); - CleanupStack::Pop(mask); - CleanupStack::Pop(bitmap); - bitmap = NULL; - mask = NULL; - - return icon; - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::SetNavigationPaneTextL() -// Sets navigation pane text. -// -------------------------------------------------------------------------- -// -void CMSSettingsView::SetNavigationPaneTextL(const TDesC& aText ) - { - LOG(_L("[MediaServant]\t CMSSettingsView::SetNavigationPaneTextL")); - - // old decorator is popped and deleted - ClearCurrentNaviPaneText(); - - if ( !iNaviPane ) - { - iNaviPane = static_cast - ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); - // ownership of decorator is transfered to application - } - - iNaviDecorator = iNaviPane->CreateNavigationLabelL( aText ); - iNaviPane->PushL( *iNaviDecorator ); - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::ClearCurrentNaviPaneText() -// Clears navi pane text. -// -------------------------------------------------------------------------- -// -void CMSSettingsView::ClearCurrentNaviPaneText() - { - LOG(_L("[MediaServant]\t CMSSettingsView::ClearCurrentNaviPaneText")); - - if ( iNaviDecorator ) - { - iNaviPane->Pop( iNaviDecorator ); - delete iNaviDecorator; - iNaviDecorator = NULL; - } - } - -// -------------------------------------------------------------------------- -// CMSSettingsView::SetTitlePaneTextL() -// Sets text to title pane. -// -------------------------------------------------------------------------- -void CMSSettingsView::SetTitlePaneTextL( TInt aResourceId ) - { - LOG(_L("[MediaServant]\t CMSSettingsView::SetTitlePaneTextL")); - - // Fetches pointer to the default title pane control. - CAknTitlePane* titlePane = static_cast( - StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - - // Makes and sets text which is used title pane. - if ( aResourceId == KMSDefaultTitleId ) - { - titlePane->SetTextToDefaultL(); - } - else - { - TBuf titleText( 0 ); - iCoeEnv->ReadResourceL( titleText, aResourceId ); - titlePane->SetTextL( titleText ); - } - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/BWINS/msappwizardu.def --- a/homesync/contentmanager/homesyncwizard/BWINS/msappwizardu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - ?NewL@CMSAppWizard@@SAPAV1@AAVCMSEngine@@@Z @ 1 NONAME ; class CMSAppWizard * CMSAppWizard::NewL(class CMSEngine &) - ?StartL@CMSAppWizard@@QAEHXZ @ 2 NONAME ; int CMSAppWizard::StartL(void) - ?NewLC@CMSAppWizard@@SAPAV1@AAVCMSEngine@@@Z @ 3 NONAME ; class CMSAppWizard * CMSAppWizard::NewLC(class CMSEngine &) - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/EABI/msappwizardu.def --- a/homesync/contentmanager/homesyncwizard/EABI/msappwizardu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _ZN12CMSAppWizard4NewLER9CMSEngine @ 1 NONAME - _ZN12CMSAppWizard5NewLCER9CMSEngine @ 2 NONAME - _ZN12CMSAppWizard6StartLEv @ 3 NONAME - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_graf_upnp_ext_renderer.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_graf_upnp_ext_renderer.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,527 +0,0 @@ - - - - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - 2005-08-31T11:03:11Z - 2005-08-31T11:03:17Z - Illustrator - - - - JPEG - 256 - 208 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgA0AEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F XYqp3FzbW0RluJUhiHWSRgqj6TQYql8fmryvK/pxaxYvIDQotzETXp0DYqmMNxBMvKGRZV/mRgw3 +WKr8VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdiqSa x5dvNRQhdd1CyX+W2MEY/wCCEXP/AIbFWCan+Rkl8/rnzFPNIRUPcx+sTX/L9QYKVJ5fyE12M1g1 G1l8PUEkf6lkxpUP/wAqh85WrcooopWHRoplU/8AD8MaVExeX/zIsPsi/jp/vmZmH/JNj4YqjIta /MGz/vZrxKf7/iLf8nFPjiqOtvPvmlNpJY5SNjzjUH/heOKprb/mHqx/vrWBv9Tmv6y2NqmMHn0N T1bEr7rJX8CoxtUfF5y05/tRTIfkpH/EsKouPzHpL/7tK/6yt/AHFUSmqac/2bhPpPH9dMVV0mhf 7Eit8iDiq/FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXnHm2NNZuri01DlLaRyM i2/N1j+BqAlVIBPucyYRADWSxuLyPo8H+8Ml3YeBtrmVKfezZKkIyLSvMtuP9D81aolOn1iRbkf8 OMHAFsouK+/M63/u9ftr2nQXVmkf3mEg4PDCeIoqPzh+Z0H9/p2lXoHa3kmhY/8AIzkK5HwgnjRK fmX5ki/3u8o3CgdWtbmG4r7haIfoweEvGqH81vLzgDUtF1S07E3FlyX6Cheo3yJxFPEHRef/AMpL s8TdW0Un7SzW8kDA7dSyJ+vI+GU8QTK2k/Lm+p9Uv7KRj2iulLf8Dz/hg4Sto8eVNJdQ8MknE9Cr Ky/qwJWnypEPsXBH+stf1EYq1/hudfsyofnUf1xV36EvF7K3yP8AWmKr0sb2PorD/VP9DiqqpvU6 tIPnX+OKqyXVyOrV+YGKqy3U3cA4qqLct3XFV4mB7HFVwkU4q3yGKt1GKuxV2KuxV2KuxV2KuxV2 KuxV2KvPNTH+5O7/AOM8n/EzmVHkGo80PJJHDE8sh4xxqXdtzRVFSdskhi0H5u/lpJcPbHzDaQzR sUdLhmgowNCKyhBkeIJosg0/zP5Z1Cn1DV7K8r09C4ilr/wDHDYRScKMKqijCqooxV0lrbzjjNEk q+DqGH44qgJ/JvlS5/vtItCT1ZYUQ/eoB7Yqgx+WnlJWL2ttLZyHq9tcTRn/AInT8MaVVXyZfQb2 PmfWbfwR7n1ox16LIp8fHI8ATZVBZfmNbf7z+a1uFH2YrqxhPj1kQq2ROILxFeutfmtbfaTRr5B4 fWIJD/xJMHhBPGqJ5+87QbXnlL1VHWW1vYm+6N1VvxyPgp41VPzXt49r7y9rFqf2nFsJox0/aR/f wweEU8StF+b/AJAchZ797SQ/7rubeeM9u/Ar38cj4ZTxBNbXzv5Hu6ehrVgzHopnjRv+BYq2DhK2 nEEllcJzt5ElT+aNgw/AnIpVfSXFXemMVb44q6mKt0xV2KuxV2KuxV2KuxV2KuxV2KvP9SH+5K7/ AOM0n/EzmVHkGo80v1Uf7ib3/jBL/wAQOSQ+O9KsbW78w+YBPCkwW4WgkUNSrP4j2zO7MxxkZ8QB 5fpdb2pklHhokc/0JlJ5T0OX7Vmg/wBWqf8AESM2UtDhP8IdbHXZh/EVW10F7Kn6N1G/06n2fqt1 JHT5bnKT2ZiPKx8W2PamUc6PwTi11z8yLL/eLzlqW3T60wu/Hr61a5VLsodJH726Pax6xCc2v5p/ nRaD/jsWOoEf8tVmkdev++AmVS7MyDlIFtj2tDrEpza/n/8AmfB/vb5f0u9p/wAss01vXr09Vpfb /PpUdDmHQH4t0e0sJ6kfBObX/nJm4T/jpeS76Hx+qXEV14/5MXtlR0+Uc4n726OrwnlIfcnNp/zk 7+XbU+vWuraZ4/WrM0H/ACKeXKjY5gj4N0ZxlyIPxT2x/Pz8ob6gh8y26E/8tCTW/wDyeSPI+IGf CWR2HnfybqVP0fr2n3ZPQQXUMh+5WOHiCKTbkCAQag7gjCqwnFVhOKqUiq6lXAZT1BFRiqWXPl3y /cf3+m2sh8WhjJ++lcCpXN+X/lB25rp4ikHR4ZJIyO37DDFW18qyQf7w67q9mOyxXjlO/VW5V64O EJtWWPz5bf7yea5io/YuraCevXYsQGyPhhPEVLUfO35l6HaNezfo/VrSD4rhRFJDMEHVhxbj89jT wwHEF4i9D8o+Z7PzNoFtrFqhiScESQsQWjkQ8XUkddxse4yiQoswU2eRV64ErIZfUZh4Yqq4q7FX Yq7FXYq7FXYq7FWBaiP9yV3/AMZpP+JHMuPINR5pfqw/3E3v/GCX/iBwofJHlSFpfMnmNVBZjcRh VG5JLSbDNj2Tzn8P0uo7Y/g+P6Get5K80JCJm0i8EZ35ehJ08Tttm18aHeHT8Eu4sj8l/lTfeYLd ry6n+oWauY1qnKV2XZqKSvEA7VP3ZRn1QgaG5bcWAy35JrrP5G6jBwbSbxLsMwV45h6TKCacuQLB gOp6HwrlcNcD9QpnPSnoU6sPyL0NYF+v39zLPQcjB6caA9wA6yE5VLXyvYBmNIOpY35y/Ka40S0f UNOnN5Yx7zo60ljH822zL49KZkYNWJmjsWnLpzEWOTBRb+2Zji2uFv7Yrad+WfJdvrH6RvLuwjub CxsruSZ5VBAmFpM8FPcOgb6MxNVKIoGrJH3i3L0ombIuog/caYlN5L8tzfb06Ef6i+n/AMQ44ZaP Ef4Qxjrsw/iKy38k6baNy02e805q1BtbmWM123+0fDKT2bh6Aj4t0e1cw5kH4Jpbf47sqfUPOmsI F+ytzN9bUUptSUUptlR7Lj0kW+PbM+sQmdv50/Oizpw8yWuoKvRbyxiTYU2LQhWPTrlR7Mn0l9jd HtmPWJ+aYwfm/wDm7bgC70jRtQA720k8DHp19QuK5UdBmH80t8e1sJ/nD4JhB+fnmGPbUvJFygH2 ns7yK4r7heKH6K5UdNmHOLdHX4Dykjov+ciPKYoL/SNa04/tNPZ1T6Gjd6j6MqMZDnGQ+DfHNjly lE/FkflX81fIvmu+bT9E1L6xfqjSvavDPE4RSAx/eIq7ch0OQEgW2mUk5JUu14/7hNQ/5hpv+TZx VF/84/8A/KCSf8xs3/EI8x8vNnHkza7uOMjivQ0ytku0mb1JJfYD+OKplirsVdirsVdirsVdirsV YLqA/wByN1/xmk/4kcy48g1Hml+rD/cTe/8AMPL/AMQOFD5u/I3VtO0n8xtfvdQj526zKnqU5GJn MoEgHt7ZlaGBlGYHl+l1nacxGUCfP9D6utrq2uoEntpVmhkFUkQhlI9iMBBBotAIO4VcCXYq7FVk 0Uc0TwyqHikUo6HoVYUIOINIIt5X5u/KyCwsZdQ0iV5I4AXntpaFgg3ZkYAdPA/fmywaziNSdfm0 vCLiwS20+a5njt4IzJPMwjijXcszGgA+ZzOlIAWXCiCTQ5l76fKUHl78uptLjANw9tdvdyj9uZ7O YMfkv2R7DOc/MHJn4ulivdxB6n8sMWn4etG/fwl4NLYyQzPDItJI2KOPAqaHOijISAI6vLTBiSDz DQt/bJMbXC39sUWuFv7Yra4W/tii1wt/bFbXC29sVtJfy1Xh+f8AqA/7VR/VDnO67+/Puet7K/xc e8/e+gScoc9LtdP+4XUP+Yab/k2cVRv/ADj/AP8AKCyf8x03/EI8x8vNnHkyLU7jjdzCvRjlbJFe WZfUluPYL+s4qn2KuxV2KuxV2KuxV2KuxVg9+P8Achdf8ZZP+JHMuPINR5oDVh/uIvv+YeX/AIgc KHyl+XgDeZfNKftGeMj5BpR/HNh2UfVP4fpdL23yh8f0PTNL1LVtLk9TT7qS3JNSEPwn/WU/CfpG baeOMuYdFDLKPIst0/8ANHXYQFvLeG7UdWFYnP0iq/8AC5iy0UTyNOTHXSHMWntr+aekuALm0nhY 9eHGRR9NUP4ZRLQy6EN8dfHqCmcX5g+VXFWumjPg0Un/ABqrZWdJk7mwazH3qj+evKqUrfA1/ljl P6lwDS5O5J1ePvQHmDzzoY0u4hs5vrVxPG0aIqsFHMFasWAFBXplmLSz4gTsGvNq4cJANlD/AJPe UBJdN5gukrHATHYqe8lKPJ/sQaD3+WQ7U1NDwx15uR2NpLPinkOT0fzSFOkzK37UdwKHv/osuanB 9Xy+8O81P0/P/cl4l520f6vq5nVaR3I5f7Ndm/gc3fZebix8PWLzfbODgy8Q5S+9j4tvbNk6i1wt vbFFrxbe2K2uFt7YotcLb2xW1wtvbFbYt5BXh/zkLqQ/7VX/ABrBnPa3+/Puew7J/wAWHvP3veSc odgl+uH/AHDX/wDzDTf8mzgVH/8AOP8A/wAoLJ/zHTf8QjyjLzZx5I7WrjjqNyK9JG/XlbJMfJUv qT3fsqfrOKsrxV2KuxV2KuxV2KuxV2KsKvx/p9z/AMZX/wCJHMuPINR5oDVx/uIvv+YeX/iBwofL P5bxBvN/mgAdGhP3l8z+y/qn8HSdun0w+P6HpAtvbNy85a4W3titrhbe2KLXC29sVtcLb2xW0fou hT6pqUFjCKNK1GfsqjdmPyGVZswxwMj0btNhllmIDq9+0uztrCxgsrVeEECBI19h3Puepzk8kzOR keZe7xYxCIjHkEJ5oP8AuMY9aLOaf9Gs2W6Yer5f7oNGsNQ+f+5kwnzrpIuNPd1WskB9RfkPtfhl 3Z2bgyjuls4/a+DxMJI5x3/W8+Ft7Z0zxdrhbe2KLXC29sVtcLb2xRa4W3titrhbe2K2wbyavD/n IvUx/wBqr/jWDOe1v9+fc9l2R/i0fefve5k5juyS/XD/ALhr/wD5h5f+IHFUx/5x/wD+UFk/5jpv +IR5Rl5s48lLzDccdYvBXpK/68rZJz+XcvO4vvZY/wBbYqzbFXYq7FXYq7FWN65+YGhaLN6N3BqT yVP9xpt9Mm3UiRITGfobFUnH55flkoH1jVJbM0BIurK9goGNBVpIVXr74qmNl+a/5Z3tBB5o0zk2 yrJdRRMTWlAshQ1xVLX1bSry8ne0vYLhWlYq0UqODyY0pxJ65lxOwaip6uP9xF9/zDy/8QOFD4/8 s+ZX0Lzb5glFuLhJnjV1LFCOPI7GjfqzP7L+qfw/S6rtfDxxiL7/AND0Gy/Mry7NQXMc1q3clQ6D 6VJb/hc3FvPS0cxy3T6y8yeWrugg1GAs3RXb02P+xficbaJYZjmE3jiR1DoQyHowNQfpGFqJVBbe 2KLXC29sVt6J5C0VbG1N9Kv+k3Q+CvVYuo/4Lr92c92lqeOXAOUfveu7F0fhw8SX1S+79rNYpM1j u0H5hBfTmUbkpPQfO2lGZGm+r5f7oOHrfo+f+5kgtStQysCKgihGY4LlkW8wvdNNtdywU2Rjx/1T uPwzrdPl8SAl3vnusw+FllDuP2dFIW3tlzjWuFt7Yra4W3tii1wtvbFbXC3xRbzfyyvD/nJDVB/2 qh/xCDOe1v8Afn3Pbdjf4tH3n73tZOUOzQGtn/cNf/8AMPL/AMQOKpn/AM4//wDKCyf8x03/ABCP KMvNnHklHmi4469fivSd/wBeVsk//KyXnc6j7JF+tsVehYq7FXYq7FWC+c/P11p17JpmmKgmjAE1 y45cWYVoi9KgHqa/LN52f2VHJDjmdjyDz/aXbEsU+CAFjmSxCLz75zjcsdUaUdkkht+P/CRo345n y7GwnlYdfHt/MOYiURH+annKJv3w0+aMdP8AR5kcj3YTla/7HKZdhw6SLkQ9oZdYfahrr8xtOu2K 6t5O0y+U/akd1Yn/AJ5yW0nif28x5dhy6SDlQ7fxnnEoP/EP5P3D8b3yU9qT1e0WBYxua/3c0Dd+ y5jy7HzDlRcmHbOA8yR8E20tPyfvj6Gm6vLpUzjgLe6aSFCTtwrOFVya9FkOYuTR5sfOJczFq8WT 6ZBEX3/ON35c3yzvJDJbXtzQteWjCIllrxPA80PX+XIYNTPEbHVlm08cg3fOv5nflvqfkTzD+jLm QXVpOnrWF6q8RJHUghl34up+0K+B750Ol1AyxsOl1GE45UWIcGzJpx7V7ae8tn5200kLfzRsyH7w RjTE0eadWfnbzfa09PUpXA7TcZa/TIGOGmmWDGej0b8q/MXmjzPr62d3Fbvp1svq3twEZXC9EUUb jV226dKntmJrdR4UL/iPJs0nZkMkxzoc30JbygAAdBnLvWphDL0xVR1i4iS2QO6rz9ZV5ECpFtKx pX2UnMjTjc/D/dBxNZ9I+P8AuZIm8hqDmO5bBvNNiElS4A6/A36xm67Jzc4fF5f2h0/05B7j+j9K Q8R4ZuXmG6DFXYq7FXYq8u09VX/nJMkAAtpZLEdz6dN/oGc/r/7/AOD2vYn+LD3l7UTmO7VL9bP+ 4e//AOYeX/iBxVNv+cf/APlBZP8AmOm/4hHlGXmzjyYr5vnp5k1IeFxJ/wASytkyf8nped1qnskP 63xV6birsVdirsVeMz20V/58ntbmrRTahJE4BoePqlevyzsozMNKJR5iAP2PCzgMmsMZcjkI+1GX UX5RfX7mx/xELK8tZXt54p5BGqSRsUZayotaMOoama6Gv1VAmAIP473az7L0hJAmYn8eSonkHQtR FdI8y2l3y+wqGOSvh8Uch8R2yf8ALEo/XjI/Hua/5CifoyA/j3oK9/J/zKtTBPazDsObq33FKfjl ke2sR5iQa5dhZhyMT+Pcx2//ACx88Q1P6NaVfGKSJ/wDcvwzIj2ngP8AF97TLsvUR/h+5i2seWtf sIXk1DTLm3gGzySwuse9B9ojj3pl8M+Oe0ZA/Fplp8kN5RI+D0b/AJx/80Xcsep+Vbh2nWwRL3Su bElIXYo8NTSipIoK+Aamc72ppxCdjkXp+zNQcmPfmFf/AJyY0KLUfJEGqKtZ9IuVbn4Q3FInH0v6 f3YOyclZeH+cPuT2nC8fF3F8uiD2zpeF57jXCDHhRxomw0ye+vbezgAM9zIsUYOw5OQoqfDfBMiM TI8gyhciAOZfRHkHynfeTtBSK9tY1a6cyS3sc8TLI/QLuVpxXanzzl9dmjlnYlt8Xo9HilijRG/w ZnbavY0HK4iU+BkT+BOa8ucnNrcI6hkYMp6EGoxVA+are4u7O3WCMyFDdFgu9A2nXUY+9nAzI08g Cb8v90GjPEkCvP8A3JZVPHUZjt7FPOGl3d7ol7b2UhhvWiY2sgANJV+JPtAihYUPtl+ly+HkEujj avTjLiMD1fNtv+ZHmy3bjMYZ2XZhLFxNRtvwKZ2vhAvDSwRTa2/Ne5G1zpyP4mOQr+DK368HgNZw DvTS2/NDQ5Npre4hPjRXX8Gr+GROAsDhKaW/njyvPSl6EY/syK6U+kin45E4pdzA45Jnb6tpdzT6 veQy16BJFY/cDkTEhiQXnVl/60kP+2Uf+IZzuv8A7/4Padif4sPeXsxOY7tUs8xn/cBqf/MJP/yb bFU8/wCcf/8AlBZP+Y6b/iEeUZebOPJgfnO6U+aNWodhdTL9KuQf1ZWyZd+SMvO81f2jh/W+KvWM VdirsVdirx63/wDJjH/tqP8A8njnXy/xP/kn+h4iH+Pf8lD/ALpJfzN/KO2mn1LXNHM0l9LcS3F1 Zn956hkkLOYgByBBatN8wdHq9hGXKnY6zB6pEd5eRtpckbtHIhR0JDIwoQR1BBza260yZJcWnmPy /aaZJBf3llLeQfWBHHNJHxQsRGRxK05IA2Y0eDITsDRcicp4xHcixaNsfzF/MS0p6WuXLU6etxn/ AOTqvkZaLCf4Qse0Mw5SLNm82a/5i/KXzLLrMyzTW0tqkbqixniZ4iahAB+GYkNPDFqYCPW/uLnH UzzaWZl0I+8JD/zj+7f8rPvFBPE6LKSvYkXcFD+OPbPIfjvbexeR/Hc9N/M9Vvfy71qGShJtDKf9 aIiQfiuavQms8fe7LWi8Evc+ThBnacLx3G2IMPCjjR2i3A0/V7K+IJFtPHKwHUhGBI+7Ks+HjhKP eC2Yc3BMS7i+pPL9/bXtirROlzZXKiqmjxup8Qf9vOGnAxNSFEPbwmJCwbBSvzB+V+o3BN35cuUh Vqk2V0z8R/xjlUO1PZh9OQZMLvNF/NjQ3MiaTcSAH+8sZFmr/sI2L/euKo7yl+YPmfUNbXRNdtJr Q+hdSLJdW728gZLaUBTyCDv4VxVUm/5yr8ssD6OmO38vO4Va/OiNiqEl/wCcm9DmH/HKAr/y9A/8 ysVSR9RPmS9nvLTQV+pytz9e5gi4JWnL9/Iijr4GuXw1OWP0ykPi0T02KXOMT8GMebYtFjmittPt 41mSpubiLmqsT0VFJpQeNKnOm7HyZskTKZuPIPNdrwxY5CMBUuZY+Ic3XC6XiXCHDwo4mxDjwrxI j8uwV/OmxH/aql/4k+cn2wP8I/zQ9b2Ibwf5x/Q+gic1ztUs8xH/AHAan/zCz/8AJtsVT7/nH/8A 5QWT/mOm/wCIR5Rl5s48nl3nKenmrWh4X1yP+SzZWyZz+QknO91n2jg/4k+KvYsVdirsVdirxe3l /wCQllf+1q4/5LnOvl/if/JP9DxUB/h3/JQ/7pkWq+fvL9rql3bStL6sE8kUlIyRyRyDvXxGarFp JmAPkHYZ9ZAZJA95YtY6FY+ePPn1qKAppVuqPeuw4mTh0Bp/P9nxoMyMuU6fDR+o8mnTYhqc230D n+PNM/zi0Fbi4S/jXe2CRsB0CMNvuOY3Zmajwn+K/m5nbGC4mY/hr5PMl072zePOcTLbWD0Pyj80 jpWe0P8AyXizAyf41j9x+4u20pvS5PfH7wlP/OPhr+aF5/2xJv8AqLt8p7Z+kfjvc/sbkfx3PRPM nDVLfUNAEzW6XyTWAmXdoxMDFyG43XlXrmhgSJAh3cgCCDyeSX//ADjt5wglY6b5hingSpRbpFDN 4CiR/wDMz6c20O0M8f4r99Otn2bgl/DXuJY/eflX+bFh6kj6ZbXsCVp6D8Hb3Cq1yx/4HMqHbGUf VGJ+Y/W4s+xcZ+mUh9v6khvbPzTpcfPVvLl7aqSeLAKVNPD1fRb/AIXMmHbcf4oke6j+pxJ9hz/h kD77H60x8tfmhqnliRXsrq4sUc1e2ubaRoCSBUsGRogdvtA198OXU6PP9fP3G/mxxabW4Po5e8V8 nrvlr/nKPTbkpBqlrBPJtyl06dC3/Ih2/wCN8wZ9k4p/3WSJ8j+z9Tmx7Wyw/vcch5gfr/W9B038 3vIOpABdSFrKesV0rQkfNyPT/wCGzDy9k6iH8N+7f9rmYu19PP8Air37fsT2LVrC8j9SxuormPqG hkWRafNScwJ45R+oEe9z4ZIyHpIPuSTUrDSZW5TWNtMwrRpIY3O/uynIM2O3clrY8ntLe3tSNy0U MUZ271VRiFLz7zT5qWUsgnN1L2AYso+np92bfR9j5cpuQ4Yef6A6jW9sYsIqJ4p+X6SwWRXkkaRz VmNSc7HFhjjiIx5B4zLnlkkZS5loQ5bwtfEuEOPCjibEOHhRxLPIi8fzssh/2qpf+JPnH9tf4z/m h7PsE3p/84/oe+E5rHcJb5hP+4HUv+YWf/k22Ksg/wCcf/8AlBZP+Y6b/iEeUZebOPJ4952np5v1 weGoXQ/5LNlbJn//ADjxJzvtc9o7f/iUmKvbMVdirsVdirw5GCfmsUHQ6qT9LSkn9edYTej/AMz9 DxwjWt/5KfpQ3mLTjJ5k1Qhal7yegHcmVsOnNYo/1R9zhaw/v5j+mfvepeSdGh0XSUgAH1iU+pct 4uR9n5KNs5zWajxZ306PYdn6TwcQB+o7lvzBYR37XsTiqvGin6VOQjMw4ZDoWyWMZDOJ5EAPKH0l opWjdaMhKn5jbOqhMSAI6vBZQYSMTzBpMtVg9D8pfM3astof+niLMOf+NY/cfuLt9Cb0mT3x+8MW /wCcd2r+Z95/2xZv+ou3yrtn6R+O92nY3I/juZDLq1fOYh5f9LLhT/nvTNDHmHdnk9KJzLalhOKr CcVS280LQryUzXenWtzKesk0Mbt97KTgVjGp/lB+XeoK/r6RHzf/AHYGckb12Vyyf8LgMQm2L3f/ ADjr5SWMjSr2806Rq1ZJCF/4GEwD78nCcofSSPcaa54oT+qIl7xaT3X5E+arVl/Q/mclRU8rpVqC fD93K/8Aw+ZMe0NRHbjPxo/e4k+zNPI3wV7rH3IO48qfnhZMwjljvbdKklJ5IS3ypNIf+SeXR7Sl /FDHL/NaJdkivTkyR/zkhvrnz1ArSa1oF+IgaeqJDID/AMjxBmdh7axx54+H+rX7HX5+wssuWTi/ rX+1L080aYF5XMN1aV/37byEf8FEJE/HM/H21p5cyY+8fqt12TsPUx5AS9x/XSKt9f0C4YLDqFuz t0j9RQ9f9UkN+GZuPW4J8px+bg5NDnhzhL5JiFUio3GZQpxDbdBhRbqDFUJ5K/8AJ3WX/bKl/wCJ PnGduf4z/mh7f2f/AMW/zj+h7wTmrd0lnmE/7gdS/wCYWb/k22Ksj/5x/wD+UFk/5jpv+IR5Rl5s 48nh/nqannPXx4ajd/8AJ98rZPRf+cbZOV/r3tFb/wDEpMVe64q7FXYq7FXgnq/8hh4/9ren/JXO r/5B/wCZ+h5Gv8N/z/0oPyxH5hl/MnzPqmpXcv6Bs9UvorOJqNG0guZFUFqEoIwNgaVNPDNbqdRW GMBzMRfup2uDRwOc5COUj87ewadqEUqgxurjxUg/qzTO5Rdm81xe6gjxlYkEPpSUNH5KeW/scskf SPi1QjU5Hvp5b+Z/mC18q6pbyXdpPJbXysVmgCmkkdAykMydip6+Phm97KyccDHrF5jtrQnxeMfx feEDN5o0zXfyg81S2PqAQS2YkWVeJBa5jp0J8MuyxI1OP3S+5jooGOmyA98fvSP/AJxxav5m3v8A 2xZv+oq3zH7Z+kfjvdn2PyP47kJp+sCb80rMdBJrkQ4/612Ns0Du3089rbP9uJT70FcIkUUh5NHs X6IUP+ST/GuTGQo4QhZPL0Z/u5mX/WAP6qZIZkcCFl8vXg+w6OPmQf1ZIZQjhQcukaknWBiP8mjf qrkhMI4SgpYpozSRGQ/5QI/XkrVRJxQsJxSsJxVA3ul6XekG9s4LkqKKZo0kIHWg5A4FSDUvy28j 6gzPdaTCzMCNuSqK+CA8PwxpWMXP5C+TBzksHubC4avGSF/TC19oRCT/AMFhgTHeJI92zGeOMxUg D790qufyV162SmleZZmY9RcgMo/5GLcN+OZcO0dRHlM/Hf77cLJ2Xpp84D4bfdSWXHkD80rSQRwt Zakg6ykelX6fUX/k3mXDtzOOfDL4fqLhZPZ/TnkZR+P7FDyP5d85w/mnZ6vqmkta2i2ktrJKnqNG p4u4YsyJ1bbNfrNSc+XjIranY6DRjT4+AG97e2E5Q5aW+YD/ALgtR/5hZv8Ak22Ksl/5x/8A+UFk /wCY6b/iEeUZebOPJ4D5+mp538wjw1O8/wCoh8rZPS/+cY35ah5g9orb/iUmKvfcVdirsVdir59u CI/zuEY2rqsZof8AKYN/HOoib0f+Y8rKNa3/AD1HSvP2n+X/ADn5m03V4Xawl1e+dZokEnH1Lh+S uhK1X5fdlOXsqWXHCcDvwR2+DlY+1Y4sk4TG3Gd/iy6PR/y415/rPl7zRJp9y4qkMcyoeR7+jOBL 9AOajLoc2P6ol2uLXYcn0yCPutD8/adp9vBpfmqNZVLm6u7izWZ5V29IfE7U4/F88xHLYf5huvM8 UBPmDzGt1CjchFDaRW5Ygf78BJ79OJy3DinOVQBJ8mrNlhCNzIA80mtLwXX5V+e7kRrEjTacERQB 8IuV3PiT3OdCdNLDkwxkblUr+Tz0dTHNDNKIqPpr5of/AJxq5H8yb1/2To84B9xdW1f15R2x9I9/ 63M7I6sM8oXM97+a2jtspfWoJGG9KC6Dkfhmgd0+z8VdirsVUbq9tLROdzMkSnpyIBPyHfCBapTN 5w0lDSISTHsVWg/4ah/DJjGWPEl9z+YFrBMI5bNzGy15KwJ60+yQP14fDXibTzd5Puv7+Mwk95It /vj5YOGQWwrpH5PvP7i7jRj0Al4tv/kv/TDxSC0F0nlKCReVvdHiehKhgfpBGPio4UDN5R1JamN4 5B4VIP4in45IZQvCgJ9B1iL7Vq7f6lH/AOIk5LjCKKXzQzRGksbRnwYEfryVoUCcVWE4qsJxVYTg VLfMB/3B6j/zCzf8mzirJ/8AnH//AJQWT/mOm/4hHlOXmzjyfOv5gy089+Yx4ape/wDUQ+VsnqH/ ADi0/LUPMX/GK2/4lJir6ExV2KuxV2KvnbzhfWmkfnkbu9kMVnBd2k8spVjRPRjZjRQSab9BnTaa JnpKHOj95eZ1JENXZ5WPuD1xfMf5XeYGHqXelX0jUAS6EPM7U+zMA34ZpvD1OLlxx91/odwZ6bLz 4Je+v0qdz+VP5c6gnqDSYVDj4ZLZ3jHzURsF/DLYdq6mH8Xzpqn2Rpp/w/IlKpvyQ0FEppuqahYk bqqyhkB/1eKn/hsyR23M/XCEvg4suwogeic4/H+xjmpf84/6m7c7XWo7hu31mN0I/wBkrS/qzPw+ 0OMc8fD7q/Y6/N7O5TyycXvv9qXeYfJOseU/yj83xai0L/WXsGheBiwIS6jBryVSPtZDLr8eo1GM wvbi5+5t03Z+TTYMgnW/Dy97H/8AnGILJ551B6/FFpkq07UkuLc9f+eeY3bB2Dn9kjmwD8rQz/mP 5c6s36QgJ7nZwSc0LuX2zirsVSfzRrb6VYBoqG5mbhFXcDapantkoRsoJefPcT3EplnkaWRursan MgBrVosKoPVErKn+r/E4qEF6eBLvTxVUhluYDWCV4j4oxU/hjSoXRPOvmtfzJttJbUppNPlRjJby UkB427uN3BYfEoOxwcAK8Reo/wCILyP7So49wQfwOA4gvGV6+aYD8NxbkKepUhvwNMicSeNHfo7R L6JZhbxSI42dVAP3ihyuyGVBBz+TdEl+ykkP+o5/425YfEK8IS+fyDGd4Lxl8A6A/iCP1ZLxUcKW XHkXWUqYmimHYBip/wCGAH45LxAjhSjVPJPme7sbmyitAJLiJ4g7yIEXmOPJmBOwrXYE4eMLRZh+ Xfk9vKflqPS5JxcXBkae4kUEJzegISu9AFA3ymUrLICnyh5zsNQ1L8yfMNlp9tLd3curXwjghQu7 f6Q/RVqcil9BfkR+WereT9MvrzWeMep6oYv9FVg3oxRciAzL8PNi5rStKDfrir1PFXYq7FXYq+f/ AM4vKrX/AJ8u5vW9D1LS3eM8eQZvjjqdxsPT7ZvtDqeDCAO8um1ejGTKST0DyLU7K+025NveJwfq jjdHA7oe/wCsZtsWYTGzqc+mljO/JTs9Z1Oyk52F3PaydQ0EjxtX5oRk5xifqALVAyB9JLIbD85f zH048YdcnlC7FbkJcdPEzK7fjmJLQ4J/wj4fscuOszw6n4/tZLp3/OTnnK2ot9Y2V6g6sFkhkP0q zL/wmY0+yMZ5Ehyodq5BzALvPf8AzkFY+bPI+o6DJo8ljeXgh9OVZlmiBinjlNarGwqqHscjp+zT iyCXFYH6mWftAZcZjVEoX/nGaRh5o191JDLpEhVhsQRKm4yvtc7Bu7LGxYl+T/8A5Mzy7/zFr/xE 5onbvtLFXYqwD84dRudM0nTtQWIy2cV16d6VFWVJEIVh4fEB+rLMXNjJjOm31pfW6XFrKssL9GX9 RHY+2XMEyiwqqtawzULipGwIOKtfoaFvsuy/MA/0xpVraBcfsOrexqDjSqL6LqCf7pLDxWjfqxpW OaP5d1o/mdHqZtJEsLVD6tw44LVrdkAXlTkeTDphCHo02FUFNgVNPKF6V1GWxLbSRNOqf8Y2RSR/ yMGVZRsziy3KGbsVdirsVWTLI0ZWN/TY7c6ciPkDtXwriqV+X/KXl7QFl/RdmkM9wxe6uj8c8zse TNLK1Xarb9aeGKpvirsVdirsVdiryP8AOS9stP8AMGmy3kywLe2zRwO+yloJCzgsdh/frmz0UTKB roXC1GSMZC9rYDrmmWur6VJE3FjxMltNXZZADxYHw8fbMqEjE21TgJxo8kD5K0u2ttFt7oIDc3SC WSWm9G3VQfADLdRlMpeTTpcIhHzKJ8xeXLPWbN0dVS8Vf9HuQPiVh0BPdT3H8crx5DE2G7JjExRe aeW/Ld5reoPbkmCG3/3rkIqVNacAP5jQ5scmoEY33uqx6UykR3PStP8AKHl2yTjHZJK1N5JgJWP/ AAVQPozAlnnLq7OGnhHkEx/JzT7bS/OHnkWi8Rb6VyhHUL6iiQrTw5Zh66RMI25GmgIk0wX8j0Zv zU0AKCT6spoPAW8hP4DNW5j7JxV2KqF/YWeoWc1lewrcWlwpSaFxVWU4gq8O8yfk95q8u3Umo+T7 iS6tD8RtQR66gfslT8EwHbv7ZfHIDzYGKR2X5l39jObTXNOZJozxl4AxyKR/NFJ3+kZYxZTp35ge VLoAfXRA56pOrR0/2RHD8cKsksdR0+6ANrdRTg9PSdX/AOIk4qmcWFCKjxVfL0xVJ9S1fSrIE3l5 Bb07SyKh+4kYqwrXPzT8vWqsljyv5xsOAKR193YfqBwKyD8n9N8yX2oXfm3WkMEVzB9W023IKj0m dZGdVO4UlFoT9r5ZRll0ZxD1TKmbsVdirsVdirsVdirsVdirsVdirxr/AJyh0V7nyZY6tGvJtMuw sp/liuV4E/8AIxYx9ObXsnJw5CO8Ot7Tx3AHuL5jh1O9gRkguJYkcEOqOygg9QQDvm+NHmHSxJHI vUvy/wBct7/RIrTkBdWQ9N467lAfgYDwpt8812ohUr73a6XJca6hks0sUMTzSsEijUs7saAKBUkn KHJeY+WfP2kaU2oi5gmYXd09xE8QVjxf9lgzJ0zKniJAcKGeIJTW4/N7RFQ+hZ3LvTYP6aCvzDPl fgFs/MjuTr8n9VmvNN/MbXbgqJH0WUsm9OTLMEUewEYXMLtAUAHK0kuKyo/8426W13+ZCXfGqada TzluwLgQD7/VOatzX1firsVdirsVS/V/L+h6zF6WqWEF4gFF9ZFZl/1WPxL9BwgkLTBtV/IPyRdl mszc6c56LFJ6iV91lDt/w2TGQseEMWvv+ccLxamw1uOTwSeBo/8AhkZ/1ZLxUcCBP5HfmRbMPquq WxUElTHczoR4Egxr+GS8UI4Vh/Kn84ASBfsQO4vn3/HHxQvCVT/lSX5l3TEXWq2/E05NLczvXt09 Nq4+KF4Ux07/AJxwlJDalrSqNuUdtCWJ8aO7LT/gcicqeFnXlz8oPI+husyWZvrpN1uL0iUg9ahK LGPnxrkDMlkIhmmQS7FXYq7FXYq7FXYq7FXYq7FXYq7FUPqGn2Oo2U1jfwJc2dwpjnglUMjqeoIO GMjE2OaJRBFF4r5m/wCcVvLl5M8/l/VJtK5GotZl+swj2QlkkUf6zNmzx9qSH1C3X5Ozon6TTAr/ AP5xq/NLSJvrOj3Npeun901tO0E30iVY1H/B5kjtLHLY2HHOgyR3DE/NPlb85YYWg1vStTe2TdzH EZYdt/ie3DIfpOXQzYjyIYTx5eUgWAziWGRopkaORdmRwVYfMHLuJp4W7Gy1DUbpLTT7aW8upDSO CBGkkY+yqCTkJTA5tkYE8numneS9Y8h/k9q6apbsnmPzhPbWVnpyjnMsMbGQgotTyYF6qP8AJrvt ml1mcTIA5B22mxGEd3p/5BflvqPlPRbu/wBYiEGq6oyf6OaFooIwSqtTozMxLD5d8w3Ieq4q7FXY q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FVG6srO7ThdQR3 CbjjKiuN+uzA+GEEhBFrbPTtPslZbO1htlY1YQxrGCffiBiSTzUABT/RNidS/SUkYlvVX04ZpPiM SH7SxV2Tl+1Tdu/QUCUZirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdi rsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirs VdirsVdir//Z - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_1.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_1.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - -]> - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_2.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_2.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_3.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_3.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_4.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_4.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_5.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_5.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_6.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_6.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_7.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_7.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_8.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_8.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_9.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_indi_upnp_search_9.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - -]> - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_current.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_current.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_locked_small.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_folder_locked_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ - - - - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - Adobe PDF library 6.66 - - - - - - - 2005-08-31T13:44:30+03:00 - 2005-08-31T12:00:58Z - Illustrator - 2005-08-31T13:44:30+03:00 - - - - JPEG - 256 - 256 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F XYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXY q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq 7FXYq7FULeapptlT65dRW5P2RI6qT8gTU5Tl1OPH9chH3ltx4Zz+kEoX/FPlv/q5W/8AyMXKP5R0 /wDPj8238lm/my+Tv8U+W/8Aq5W//Ixcf5R0/wDPj81/JZv5svk7/FPlv/q5W/8AyMXH+UdP/Pj8 1/JZv5svk7/FPlv/AKuVv/yMXH+UdP8Az4/NfyWb+bL5O/xT5b/6uVv/AMjFx/lHT/z4/NfyWb+b L5O/xT5b/wCrlb/8jFx/lHT/AM+PzX8lm/my+SJs9X0q9bjaXkM7fyRurN9wNcuxarFk+iUZe4tW TBOH1RI+CLy9qdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVSvzPrB0j Rbi9QAyqAsIPTm5oK/LrmF2hqvAwymOfT3uVo8Hi5BHo8Vurq4urh7i4kaWaQ8nkY1JOeeZMkpyM pGyXsYQERQFAKWQZuxV2KuxV2KuxVtWZGDKSrKaqw2II8MIJG4QRb0TyN53nnnTStUcySPta3Lfa J/kc969jnVdj9rykRiymyeR/QXn+0uzhEeJD4hn2dQ6J2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K uxV2KuxV2KuxV2KuxV2KsW/Mn/lGH/4yx/rzS9v/AOLH3h2fZH9/8C8lzhnq3Yq7FXYq7FXYq7FX YquikkikSWNisiEMjDqCDUHDGRBscwggEUXuOgarHquk218tA0q/vVH7Mg2cffnpGi1Iz4ozHXn7 +rxOqwHFkMe5MMymh2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVi35k/8ow/ /GWP9eaXt/8AxY+8Oz7I/v8A4F5LnDPVuxV2KuxV2KuxV2KuxV2Ksr8jebU0eZ7S8J+oTty5Dcxv 05U8COubvsftMac8M/ol9hdV2lofFHFH6h9r1WCeGeJZoJFlicVR0IKkexGdtCcZC4mwXmJRMTR2 K/JMXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYqxb8yf+UYf/jNH+s5pe3/APFj 7w7Psj+/+BeS5wz1bsVdirsVdirsVdirsVdirh1xQmGn6tqVgSbO5kg5faCMQD8x0OWYtVlxfRIx aMuCE/qAKbL5z8zHrfN/wKf805kHtrV/zz9n6nFPZ+H+b96qvnHzIet83/Ap/wA05We29X/PPyH6 mJ0GH+aqr5u8xH/j9b/gU/5pyB7c1n+qH5D9TE6DD/NVV816+f8Aj8b/AIFP6ZWe3dZ/qh+Q/UxO hw/zVVfNOu97tv8AgU/pkD2/rf8AVD8h+pidFi/mqq+Ztb/5am+5f6ZWfaDW/wCqH5D9TE6LF/NV F8yaz/y1N9y/0yB9odd/qh+Q/Ux/J4u5UHmLWP8AlpP3L/TIn2i13+qH5R/Uj8nj7l48w6t/y0n7 l/pkf9EWu/1Q/KP6kflMfc3/AIg1b/loP3L/AEwf6I9f/qh+Uf1I/KY+53+INW/5aD9y/wBMf9Ee v/1Q/KP6l/KY+5afMOr/APLSfuX+mH/RFrv9UPyj+pP5TH3Ktp5q1GGUGdhPF+0pABp7EAZn6L2q 1WOf7w+JDqCAD8CGGTQwkNtizG2uIrmBJ4jyjkHJTnpem1EM2MZIG4yDppwMSQeYVMuYuxV2KuxV 2KuxVjnn7/lHn/4yx/rznfan/Ez/AFg5/Zv978HmgzzJ6BeuRQqDAhcMiheMCFQZFC8YELxkVXjA xXjIqvGBivGRVUGBivGRVeMCF65FC8YELxkUKgwIXjIoXAYEOIxVacKVhySsk0An9HL7M1Pvz2D2 NJOgHlKX3ur1f1pjnVOM7FXYq7FXYq7FWOefv+Uef/jLH+vOd9qf8TP9YOf2b/e/B5oM8yegXrkU KgwIXDIoXjAhUGRQvGBC8ZFV4wMV4yKrxgYrxkVVBgYrxkVXjAheuRQvXAheMihUGBC8ZFC8HAhx OKrDhSsOFWSaB/xzx/rNnsHsZ/iA/rSdXq/rTHOrcZ2KuxV2KuxV2Ksc8/f8o8//ABlj/XnO+1P+ Jn+sHP7N/vfg80GeZPQLxkULxgQvGRQvGBC8ZFC8YELxgVUGRYrxgVeMiheMCF4yKF4yKF4wIXjI oXjAhUByKFwOBC8HAhdXArq4qtJwqtJwpZLoH/HOH+s2ev8AsZ/iA/rSdXq/rTHOrcV2KuxV2Kux V2Ksc8/f8o8//GWP9ec77U/4mf6wc/s3+9+DzQZ5k9AvGBC8ZFC8YELxkVXrgQvGRQvGBC8ZFC8Y EJZ5l816B5Y0xtS1u7S0thsnLd5G/kjQfEzewzJ0ehy6mfBijxH7vf3NeTJGAsvDvMn/ADlTemV4 vLWkRxxA0S61BmdmHj6MTIFP+zOdvo/YmNXmmb7o/rP6g67J2gf4R82Jy/8AOSH5ovIGS7tolBqU S2jIO/T4uR/HNrH2R0IH0yP+cWg63Im2jf8AOUvne1lX9J2NlqMH7QVXt5T8nVnQf8BmJqPYrSyH olOB+Y/HxZR10xzAL278uvzl8o+d6W1o7WWrheT6bc0DkDqYnHwyAe2/iBnFdrez2o0Xql6sf84f p7vu83NxaiM+XNnwOaFvXg4ELwcihcDgVcDgQurgQ6uKtE4UrScKWTeX/wDjnD/WbPXvY3/ER/Wk 6rV/WmWdW4rsVdirsVdirsVY55//AOUef/jLH+vOd9qf8TP9YOf2b/e/B5mM8yegXjAqoMiheMCF wyKF64CheMiheMCF4wIUNU1Sz0rTLrU71/TtLOJ5538EQcjTxO2wyeDDLLMQjvKRoMJSERZfF3n7 z1q/nLX5dTvnZYAWWxtK1SCGuyD3/mbuc9l7L7Mx6PEIQ5/xHvP45PP5sxySspp+X35P+bPOoNzZ IlnpStxfUbmoQkdVjUAtIR7beJzG7V7f0+i9MvVP+aP09zPDppZOXJ6jD/zida+mvreZXMn7RS0A X6KzHOYl7cyvbFt/W/465f8AJ/mxrzh/zjL5q0i0lvdEvI9bhiBZ7dYzBc0G54R8pFens1T2GbHs /wBssGWQjlicZPW7j89q+XxacmhlHcbvIbW6vLG8jubaR7a7tnDxSoSjo6GoII3BBzrpwjOJjIXE /a4YJBfan5PfmAPOvk6DUJ+I1S1b6tqSLsPVQAiQDwkUhvnUds8Y7f7K/JakwH0S3j7u74cndafL xxvqzkHNG3LwcCFwOBC4HArdcVdXFWicVWk4VZR5d/45o/12z172N/xEf1pOq1n1pnnVOK7FXYq7 FXYq7FWOef8A/lHn/wCMsf68532p/wATP9YOf2b/AHvweZjPMnoV4wIXjAheMiheMCF4yKF4wIXD IoXrgQ8p/wCclNbksfIMVhExDapdxxSU2rFEDK3/AA6pnVex+mE9WZn+CJPxO33W4OvnUK7y+bfL GiSa75j03R4yVa/uYoC46qrsAz/7FanPR9bqRgwzyH+GJLqMcOKQHe+6NM06y0zT7fT7GJYLO1jW KCJeiogoBnh2bLLJMzkblI2XoYxAFBGA5SleDgQ+RP8AnIryxbaJ+Yks9qgS31eBb4ouyiVmZJaf 6zJzP+tnrXslrJZtGBLnjPD8OY++vg6bWQ4Z+9kH/OKWsSQebtV0ktSC+shPT/iy2kUL/wALM2YH txpxLTwydYzr4SH7Az0MvUQ+ogc8wdmuBwKuBxQurgV3LFDuWKurilaThVlflz/jmL/rtnrnsb/i I/rSdTrPrTPOqcV2KuxV2KuxV2Ksc8//APKOv/xlj/XnO+1H+Jn+sHP7N/vfg8yGeZvQrxkULxgQ vGRQvGBC8YELwciheMCFwOBXhn/OVDN+jfLq1PEzXJK9iQsdP152/sSPXl90f0ur7S5ReX/kmqt+ aXl8MAR60hod9xC5B+g50/tGf8Bye4feHC0n94H2YDnjjvlwOBC8HAh81/8AOV3/ACkOhf8AMJL/ AMnc9I9h/wC5yf1h9zq+0PqDH/8AnGn/AMmhB/zCXP8AxEZn+2H+In+tFq0X94+uwc8lduuBwK2D gQu5YFdyxQ7lirq4pWk4VZb5a/45i/67Z657Hf4iP60nUaz+8TTOpcV2KuxV2KuxV2Ksb/MD/lHX /wCMsf68532o/wATP9YOf2b/AHvweZDPM3oV4wIXjAheMiheMCF4yKrgcCF4OBC8HIoeF/8AOVH/ ABz/AC7/AMZbr/iMedx7E/Xl90f0ur7S5ReY/kl/5NLQP+Msn/JiTOm9o/8AEcnuH+6Dh6T+8D7K Bzx13y8HAhcDgQ+bP+crf+Ug0L/mEl/5OZ6P7D/3OT+sPudV2h9QY/8A841/+TPg/wCYS4/4iM2H th/iJ/rRatF/ePrkHPJXcLgcCF1cCurirdcVdXFXVxVonFWXeWf+OWv+u2et+x3+Ij+tJ1Gt/vE1 zqXEdirsVdirsVdirG/zA/5R1/8AjLH+vOd9qP8AEz/WDn9m/wB78HmIzzR6FeMiq8YELwcCF4OR QuBwIXg4ELwcih5z5z/PPy95T8wT6Je2F3PcQLGzSw+lwIkQOKcnU9D4Z0XZ3s1m1WEZYyiAb530 +DhZtbHHLhILx784/wA1dH8822lxafaXFq1i8zSG44UYShAOPBm/kzr/AGf7EyaKUzOUZcVcr6W6 /V6kZQKHJiP5f+ZLXy15x03XLuJ5reyd3kiipzIaNk25EDq3jm27V0ctTp54okAy7/e4+DIITEj0 e7j/AJyk8of9WnUPuh/6qZwv+grUfz4fb+p2X8ow7iuH/OU3lD/q06h90H/VTH/QTqP58Pt/Uv8A KEO4t/8AQ1Hk/wD6tOofdB/1Uwf6CdR/Ph9v6kfyhDuLyj85vzK0rz3qenXenWs9qlnA8Ui3HCpL PyqODNnVez3Y+TQwlGZEuI3s4eqzjIQQlv5UedbDyb5vj1u+gluLdIJYjHBx51kAAPxFRmT252dP Wac4oEA2Dv5MNPlEJWXulj/zlD5RvL23tE0rUFe4kSJWYQ0BdgoJpJ75w+X2L1EImRnDYX1/U541 0SaovZgc41zW64q3XArdcVdXFWq4q1XCrMfK/wDxyl/12z1n2P8A8RH9aTp9b/eJtnUuI7FXYq7F XYq7FWN/mD/yjr/8ZY/15zvtR/ih/rBz+zf734PMBnmj0S8YELwcCFwORQvBwIXg4ELwciq4HAh8 ofn/AP8Akz9R/wCMVt/yYTPVfZb/ABGPvl95dBr/AO9LzrOhcN2KuxV2KuxV2KuxVMfLv/KQaZ/z Fwf8nFzH1f8Acz/qn7mUPqD74Bzwd6JdXArq4q3XFDq4q1XFLq4qzLyt/wAclf8AXbPWfZD/ABEf 1pOm1v8AeJvnUOI7FXYq7FXYq7FWNfmD/wAo4/8Axlj/AF5zvtR/ih/rB2HZv978HmAOeavQrwci hcDgQvBwKvBwIXg5FC4HAhcDgQ+Uvz+/8mdqP/GK2/5MJnqnst/iMffL7y6DX/3pedZ0LhuxV2Ku xV2KuxV2Kpj5d/5SDTP+YuD/AJOLmPq/7mf9U/cyh9Qfe1c8IejdXFW64FdXFXVxV1cVarhVmvlT /jkL/rt+vPV/ZD/Eh/Wk6bXf3icZ1DhuxV2KuxV2KuxVjX5hf8o4/wDxlj/XnPe0/wDih/rB2HZv 978Hl4OeaPQrwcCrgcCF4OBC4HIoXg4ELgcCrwcCHyl+fv8A5M7Uf+MVt/yYXPU/Zf8AxKPvl95e f1/96XnedC4bsVdirsVdirsVdiqYeXf+Ug0z/mLg/wCTi5j6v+6n/VP3MofUH3pXPCnpG64FdXFD q4q6uKurirq4pZt5S/446/67/rz1f2R/xIf1pOl1394nOdO4bsVdirsVdirsVY1+Yf8Ayjj/APGW P9ec97T/AOKH+sHYdmf3vweXA55q9EuBwIXg4ELgciq4HAheDgQvBwIXA4EPlT8/P/Jm6j/xitv+ TC56l7L/AOJR98vvLz+v/vS87zoXDdirsVdirsVdirsVTDy9/wAd/TP+YuD/AJOLmPq/7qf9U/cy h9QfeNc8LeldXFW64FdyxV3LFXVxVquFWc+Uf+OMv/GR/wBeeq+yP+JD+tJ0mu/vE6zp3DdirsVd irsVdirGfzE/5Rt/+Msf68572n/xQ/1g7Dsz+9+BeWg55s9EvBwKuByKFwOBC8HAhcDgVeDgQuBw IfKv59/+TM1D/jFbf8mFz1L2X/xKPvl95ef1/wDen4PPM6BwnYq7FXYq7FXYq7FUw8vf8d/TP+Yu D/k4uY+r/up/1T9zKH1B93Vzwx6Z1cVbrih1cVdXFXVxVquKWd+T/wDjjL/xkf8AXnqvsl/iQ/rS dHr/AO8+Cd50zhuxV2KuxV2KuxVjP5if8o2//GWP9ec97T/4of6wdh2Z/e/AvLAc82ejXA4ELgcC F4OBVwOBC4HAhcDgVeDgQ8c/Mj8ktf8ANXm261qzv7SCCdIlWOb1OYMcYQ14ow7Z2HZHtHi0unGK UZEi+VdT73V6nQyyTMgQxj/oWfzZ/wBXSw++b/qnmy/0Y6f+ZP7P1uP/ACZPvDf/AELL5s/6uth9 83/VPH/Rlp/5k/s/Wv8AJk+8O/6Fk82f9XWw++b/AKp4/wCjLT/zJ/Z+tf5Mn3hv/oWPzb/1dbD7 5v8Aqng/0Zaf+ZP7P1o/k2feG/8AoWLzb/1dbD75v+qeP+jPT/zJ/Z+tf5Nn3h3/AELD5t/6uun/ AHzf9U8f9Gen/mT+z9a/ybPvDf8A0LB5t/6uun/fN/1Twf6M9P8AzJ/Z+tf5Nn3hE6Z/zjV5rtNS tLp9UsGS3mjlZVM1SEcMQKx+2V5vbDBOEoiE9wR0/WmPZ0wQbD6Mrnnbt264q3XArq4odXFXVxS1 XCrPfJv/ABxV/wCMj/rz1P2S/wASH9aTo9f/AHnwTzOmcJ2KuxV2KuxV2KsY/MX/AJRp/wDjLH+v Oe9pv8UP9YOw7M/vfgXlYOebvRrgcCrwcCFwOBC4HAq4HAhcDgQuBwKvBwIXA4ENg4FXA4ELgcCt g4oXA4FbrgQ3XFW64FdXFW64odXFXVxV1cVariln/kz/AI4i/wDGR/156n7J/wCJD+tJ0Wv/ALz4 J7nSuE7FXYq7FXYq7FWMfmN/yjT/APGWP9ec/wC03+KH+sHYdmf33wLykHPN3pF4OBC4HAhcDgVc DgQuBwIXA4FXA4ELgcCrgcCFwOBC4HArYOKGwcCrq4FbrihuuBW+WNK6uKt1wIdXFXVxV1cVarhS 9B8lf8cNf+Mj/rz1H2T/AMSH9aToe0P734J9nSuE7FXYq7FXYq7FUu8xaQNW0i4sqhXcViY9A6mq /wBDmD2lo/zOCWPqeXv6N+mzeHMSeM3tjeWNy1tdxNDMnVGH4jxHuM8sz6eeKRhMcMg9VjyRmLib CkDlDNcDgQuBwIXA4FXA4ELgcCFwOBVwOBC4HArYOBC4HFVwOBDdcCt1xQ3XArdcVdXArdcUOrir q4q6uKuriqta2tzdzrBbRtLK3RV/WfAZfp9NkzTEMYMpFjOYiLOwen6Lpw07TYbWoLoKyMO7sanP XuytCNLp44uo5+883nNRl8SZkjc2DS7FXYq7FXYq7FXYqpT2trcALcQpMo6CRQw/EHK8mGE9pAS9 4tlGZjyNKH6G0j/lht/+RSf0yn8jg/mQ/wBKGfjz/nH5t/ofSP8Alht/+RSf0x/I4P5kP9KF8ef8 4/N36H0n/lit/wDkUn9MfyOD+ZD/AEoXx5/zj83fojSf+WKD/kUn9MfyOD+ZD/ShfHn/ADj83foj Sf8Alig/5FJ/TH8jg/mQ/wBKF8ef84/N36I0r/lig/5FJ/TH8jg/1OH+lC+NP+cfm3+idK/5YoP+ RSf0x/I4P9Th/pQvjT/nH5u/ROlf8scH/IpP6Y/kcH+pw/0oR40/5x+bv0Tpf/LHB/yLT+mP5DB/ qcP9KF8af84/N36K0v8A5Y4P+Raf0wfkMH+pw/0oXxp/zj83forS/wDljg/5Fp/TH8hg/wBTh/pQ vjT7z83forTP+WOD/kWn9MfyGn/1OH+lH6l8afefm3+i9M/5ZIP+Raf0x/Iaf/U4f6UfqXxp95+b v0Xpn/LJD/yLT+mP5DT/AOpw/wBKP1L40+8/N36L0z/lkh/5Fp/TH8hp/wDU4f6UfqXxp95+bv0X pn/LJD/yLT+mP5DT/wCpw/0o/UvjT7z83fovTf8Alkh/5Fp/TH8hp/8AU4f6UfqXxp95+bv0Xpv/ ACyQ/wDItP6Y/kNP/qcP9KP1L40+8/N36M03/lkh/wCRaf0x/Iaf/U4f6UfqXxp95+bv0Zpv/LJD /wAi0/pj+Q0/+pw/0o/UvjT7z83fozTf+WSH/kWn9MfyGn/1OH+lH6l8afefm79Gab/yyQ/8i0/p j+Q0/wDqcP8ASj9S+NPvPzVYbe3hBEMSRg9Qihf1ZdjwwxioREfcKYykTzKplrF2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux V2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV 2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2 KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K uxV2KuxV2Kv/2Q== - - - - - - - uuid:613db75f-bcf9-4a78-b76d-0d89ef07a31b - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_im_server.svg --- a/homesync/contentmanager/homesyncwizard/bitmaps/qgn_prop_im_server.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/data/cmsappwizard.rss --- a/homesync/contentmanager/homesyncwizard/data/cmsappwizard.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,590 +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: resource description -* -*/ - - - -// RESOURCE IDENTIFIER -NAME MSAW // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include // animation frames -#include - -// RESOURCE DEFINITIONS - -// --------------------------------------------------------------------------- -// RSS_SIGNATURE -// --------------------------------------------------------------------------- -RESOURCE RSS_SIGNATURE - { - } - -// --------------------------------------------------------------------------- -// TBUF -// --------------------------------------------------------------------------- -RESOURCE TBUF - { - buf = ""; - } - -//---------------------------------------------------------------------------- -// r_ms_softkeys_next_cancel_next -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_ms_softkeys_next_cancel_next - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;}, - CBA_BUTTON {id=EAknSoftkeyCancel; txt=text_softkey_cancel;}, - CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;} - }; - } - -//---------------------------------------------------------------------------- -// r_ms_softkeys_next_back_next -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_ms_softkeys_next_back_next - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;}, - CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;} - }; - } - -//---------------------------------------------------------------------------- -// r_ms_softkeys_done_back -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_ms_softkeys_done_back - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyDone; txt=text_softkey_done;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;}, - CBA_BUTTON {id=EAknSoftkeyDone; txt=text_softkey_done;} - }; - } - -//---------------------------------------------------------------------------- -// r_ms_softkeys_next_back_select -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_ms_softkeys_next_back_select - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyNext; txt=qtn_softkey_next;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back;} -#ifndef __SERIES60_31__ - , - CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent;/* txt=text_softkey_done;*/} -#endif - }; - } - -// --------------------------------------------------------------------------- -// r_ms_wizard_info_dialog -// --------------------------------------------------------------------------- -RESOURCE DIALOG r_ms_wizard_info_dialog - { - flags = EGeneralQueryFlags | - EEikDialogFlagNoTitleBar | - EEikDialogFlagNoBorder | - EEikDialogFlagNoShadow; - - buttons = r_ms_softkeys_next_cancel_next; - - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - bmpfile = ""; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -//---------------------------------------------------------------------------- -// r_ms_wizard_multiselection_dialog -//---------------------------------------------------------------------------- - -RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_ms_wizard_multiselection_dialog - { - flags = EGeneralQueryFlags; - - softkeys = r_ms_softkeys_next_back_select; - - items = - { - AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSingleGraphicPopupMenuListBox; - listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST - { - }; - heading = " "; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// r_ms_wizard_selection_dialog_8 -// resource for wizard step 8 -//---------------------------------------------------------------------------- - -RESOURCE AVKON_LIST_QUERY r_ms_wizard_selection_dialog_8 - { - flags = EGeneralQueryFlags; - softkeys = r_ms_softkeys_next_back_next; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - }; - heading = " "; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// r_ms_wizard_wait_dialog -// resource for wizard wait dialog -//---------------------------------------------------------------------------- - -RESOURCE DIALOG r_ms_wizard_wait_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_mserv_wizard_searching_devices; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - - -//---------------------------------------------------------------------------- -// Animation for server selection -//---------------------------------------------------------------------------- -// - -RESOURCE BMPANIM_DATA r_ms_animation_for_selection_dialog - { - frameinterval = 300; - playmode = EAknBitmapAnimationPlayModeCycle; - bmpfile = ""APP_RESOURCE_DIR"\\msappwizard.mif"; - frames = r_ms_animation_for_selection_dialog_images; - } - - -//---------------------------------------------------------------------------- -// Image frames for r_ms_ animation_for_selection_dialog_images -//---------------------------------------------------------------------------- -// - -RESOURCE ARRAY r_ms_animation_for_selection_dialog_images - { - items= - { - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_1 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_1_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_2 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_2_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_3 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_3_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_4 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_4_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_5 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_5_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_6 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_6_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_7 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_7_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_8 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_8_mask;}, - BMPANIM_FRAME {bmpid=EMbmMsappwizardQgn_indi_upnp_search_9 ; - maskid=EMbmMsappwizardQgn_indi_upnp_search_9_mask;} - }; - } - -//---------------------------------------------------------------------------- -// -// r_ms_automatic_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_automatic_text - { - buf = qtn_mserv_wizard_automatic; - } - -//---------------------------------------------------------------------------- -// -// r_ms_manual_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_manual_text - { - buf = qtn_mserv_wizard_manually; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_1 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_1 - { - buf = qtn_mserv_wizard_head_1; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_2 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_2 - { - buf = qtn_mserv_wizard_head_from_home_1; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_3 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_3 - { - buf = qtn_mserv_wizard_head_from_home_2; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_4 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_4 - { - buf = qtn_mserv_wizard_head_source_devices_1; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_5 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_5 - { - buf = qtn_mserv_wizard_head_source_devices_2; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_6 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_6 - { - buf = qtn_mserv_wizard_head_2; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_7 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_7 - { - buf = qtn_mserv_wizard_head_3; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_8 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_8 - { - buf = qtn_mserv_wizard_head_4; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_9 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_9 - { - buf = qtn_mserv_wizard_head_5; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_9_2 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_9_2 - { - buf = qtn_mserv_wizard_head_5; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_10 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_10 - { - buf = qtn_mserv_wizard_head_8; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_11 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_11 - { - buf = qtn_mserv_wizard_head_9; - } - -//---------------------------------------------------------------------------- -// -// r_ms_heading_step_12 -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_heading_step_12 - { - buf = qtn_mserv_wizard_head_10; - } - -//---------------------------------------------------------------------------- -// -// r_ms_step_1_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_step_1_body_text - { - buf = qtn_mserv_wizard_1; - } - - -//---------------------------------------------------------------------------- -// -// r_ms_step_2_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_step_2_body_text - { - buf = qtn_mserv_wizard_from_home; - } - -//---------------------------------------------------------------------------- -// -// r_ms_step_4_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_step_4_body_text - { - buf = qtn_mserv_wizard_source_devices; - } - -//---------------------------------------------------------------------------- -// -// r_ms_step_6_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_step_6_body_text - { - buf = qtn_mserv_wizard_2; - } - -//---------------------------------------------------------------------------- -// -// r_ms_step_8_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_step_8_body_text - { - buf = qtn_mserv_wizard_4; - } - -//---------------------------------------------------------------------------- -// -// r_ms_step_9_2_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_step_9_2_body_text - { - buf = qtn_mserv_wizard_no_target_devices_found; - } - -//---------------------------------------------------------------------------- -// -// r_ms_step_10_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_step_10_body_text - { - buf = qtn_mserv_wizard_8; - } - -//---------------------------------------------------------------------------- -// -// r_ms_last_step_body_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_last_step_body_text - { - buf = qtn_mserv_wizard_10; - } - -//---------------------------------------------------------------------------- -// -// r_ms_no_target_devices_selected_info -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_no_target_devices_selected_info - { - buf = qtn_mserv_wizard_no_target_devices_selected; - } - -//---------------------------------------------------------------------------- -// -// r_ms_wizard_captured_images -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_wizard_captured_images - { - buf = qtn_mserv_wizard_phone_images; - } - -//---------------------------------------------------------------------------- -// -// r_ms_wizard_other_images -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_wizard_other_images - { - buf = qtn_mserv_wizard_other_images; - } - -//---------------------------------------------------------------------------- -// -// r_ms_wizard_captured_videos -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_wizard_captured_videos - { - buf = qtn_mserv_wizard_phone_videos; - } - -//---------------------------------------------------------------------------- -// -// r_ms_wizard_other_videos -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_wizard_other_videos - { - buf = qtn_mserv_wizard_other_videos; - } - -//---------------------------------------------------------------------------- -// -// r_ms_wizard_music -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_wizard_music - { - buf = qtn_mserv_wizard_music; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/group/bld.inf --- a/homesync/contentmanager/homesyncwizard/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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 information file for project setup wizard -* -*/ - - -#include "../../../../group/upnpplatformvar.hrh" - -PRJ_EXPORTS -../inc/cmsappwizard.h |../../../../inc/cmsappwizard.h -// LOC export -UPNP_LOC_EXPORT(cmsappwizard.loc) - -PRJ_MMPFILES -./cmsappwizard.mmp - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE msappwizard.mif -OPTION HEADERFILE msappwizard.mbg -OPTION SOURCEDIR ../bitmaps -OPTION SOURCES -c8,8 qgn_graf_upnp_ext_renderer \ - -c8,8 qgn_prop_im_server \ - -c8,8 qgn_prop_folder_locked_small \ - -c8,8 qgn_prop_folder_current \ - -c8,8 qgn_indi_upnp_search_1 \ - -c8,8 qgn_indi_upnp_search_2 \ - -c8,8 qgn_indi_upnp_search_3 \ - -c8,8 qgn_indi_upnp_search_4 \ - -c8,8 qgn_indi_upnp_search_5 \ - -c8,8 qgn_indi_upnp_search_6 \ - -c8,8 qgn_indi_upnp_search_7 \ - -c8,8 qgn_indi_upnp_search_8 \ - -c8,8 qgn_indi_upnp_search_9 -END -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/group/cmsappwizard.mmp --- a/homesync/contentmanager/homesyncwizard/group/cmsappwizard.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +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 specification file -* -*/ - - -#include -#include - -TARGET msappwizard.dll -TARGETTYPE dll -UID 0x100000D8 0x1028290A - -CAPABILITY CAP_GENERAL_DLL - -// host process needs this size -EPOCSTACKSIZE 65536 - -VENDORID VID_DEFAULT - -// Include paths -USERINCLUDE ../inc -USERINCLUDE ../loc - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../inc - -START RESOURCE ../data/cmsappwizard.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END // RESOURCE - -SOURCEPATH ../src - -SOURCE cmsappwizard.cpp -SOURCE cmsmultiselectionpopup.cpp -SOURCE cmsselectionstorage.cpp - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY avkon.lib -LIBRARY AKNSKINS.lib -LIBRARY AknIcon.lib -LIBRARY eikdlg.lib -LIBRARY efsrv.lib -LIBRARY egul.lib -LIBRARY CommonEngine.lib -LIBRARY msengine.lib -LIBRARY cmcommon.lib -LIBRARY cmsettingsengine.lib -LIBRARY commdb.lib -LIBRARY upnpavcontrollerclient.lib -LIBRARY bafl.lib -LIBRARY ecom.lib -LIBRARY charconv.lib // ConvertToUnicodeFromUtf8 - -// Logging -DEBUGLIBRARY flogger.lib - - - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/inc/cmsappwizard.h --- a/homesync/contentmanager/homesyncwizard/inc/cmsappwizard.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,456 +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: Header file for the Setup wizard class -* -*/ - - - - -#ifndef CMSAPPWIZARD -#define CMSAPPWIZARD - -// INCLUDES -#include -#include -#include "upnpavdeviceobserver.h" - - -// FORWARD DECLARATIONS -class CCmMediaServerFull; -class CMSEngine; -class CMSSelectionStorage; -class CMSMultiselectionPopup; -class MUPnPAVController; - -// CLASS DECLARATION - -/** - * CMSAppWizard class - * Class implementing the functionality of the setup wizard - * - * @since S60 5.1 - * - * @lib msappwizard.lib - */ -NONSHARABLE_CLASS( CMSAppWizard ) : public CBase, - public MUPnPAVDeviceObserver, - public MProgressDialogCallback - { - - // Wizard steps - enum TWizardStep - { - EStep1 = 0, - EStep2, - EStep3, - EStep4, - EStep5, - EStep6, - EStep7, - EStep8, - EStep9, - EStep10, - EStep11, - EStep12, - ELastStep, - EWizardEnd, - ECancelWizard - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * @return CMSAppWizard pointer - */ - IMPORT_C static CMSAppWizard* NewL( CMSEngine& aMSEngine ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * @return CMSAppWizard pointer - */ - IMPORT_C static CMSAppWizard* NewLC( CMSEngine& aMSEngine ); - - /** - * Destructor. - */ - virtual ~CMSAppWizard(); - - - public: - - /** - * Starts wizard - * @since S60 5.1 - * @return TInt, sk button, 0 if cancelled - */ - IMPORT_C TInt StartL(); - - - - public: // Methods from MProgressDialogCallback - - /** - * Handles the situation when the dialog - * is dismissed. - * - * @since S60 5.1 - * @param aButtonId The identifier of the button, with which the - * dialog was dismissed. - * @return None - */ - void DialogDismissedL( TInt aButtonId ); - - - private: - - /** - * Show the information note with OK BACK buttons - * - * @since S60 5.1 - * @param aMain, resource ID - * @param aHeading, heading text - * @return keycode of the button user has pressed. - */ - TInt ShowInfoStepL( TInt aMain, TPtr aHeading ); - - /** - * Show the UI dialog with selection list - * - * @since S60 5.1 - * @param aMain, resource ID - * @param aHeading, heading text - * @return keycode of the button user has pressed. - */ - TInt ShowListStepL( TInt aMain, TPtr aHeading ); - - /** - * Shows the step for setting shared content - * - * @since S60 5.1 - * @param aItemArray, item array - * @param aResultArray, selected indexes - * @param aHeading, heading text - * @return keycode of the button user has pressed. - */ - TInt ShowMultiselectionStepL( CDesCArrayFlat& aItemArray, - CArrayFix& aResultArray, - TPtr aHeading ); - - /** - * Determines the next wizard step - * - * @since S60 5.1 - * @param aSelection, forward / backward - */ - void SetNextStep( const TInt aDirection ); - - /** - * Cancels device search operation. - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelDeviceSearch(); - - /** - * Creates AV controller. - * - * @since S60 5.1 - * @param None - * @return operation success. KErrNone if succesfull - */ - TInt CreateAvControllerL(); - - /** - * Updates multiselection dialog content. - * - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateDevicePopupDlgL(); - - /** - * Show the UI dialog with selection list - * - * @since S60 5.1 - * @param aServer, server name - * @param aServerIndex, server array index - * @return comparison result. - */ - TInt MatchFoundServer( TDesC8& aServer, TInt &aServerIndex ); - - /** - * Sets server state to deleted if needed - * And updates server name - * - * @since S60 5.1 - * @param None - * @return None - */ - void CheckAndSetServerStateL(); - - /** - * Fetches devices from AVController and calls - * DeviceDiscovered-callback for each of them. - * - * @since S60 5.1 - * @param None - * @return None - */ - void FetchAlreadyDiscoveredDevicesL(); - - /** - * Close wait dialog - * - * @since S60 5.1 - * @param None - * @return None - */ - void CloseWaitDialog(); - - /** - * Creates multiselection store list items according - * to default store rule - * - * @since S60 5.1 - * @param None - * @return CDesCArrayFlat, item array - */ - CDesCArrayFlat* CreateMultiselectionStoreListItemsLC(); - - /** - * Creates multiselection store list items according - * to UI spec string - * - * @since S60 5.1 - * @param None - * @return CDesCArrayFlat, item array - */ - CDesCArrayFlat* CreateMultiselectionUIStoreListStringLC(); - - - /** - * Creates server name list for device selection dialog - * - * @since S60 5.1 - * @param aServerArray, server list - * @return None - */ - void CreateServerNameListL( - RPointerArray& aServerArray); - - /** - * Creates multiselection fill list items - * - * @since S60 5.1 - * @param None - * @return CDesCArrayFlat, item array - */ - CDesCArrayFlat* CreateMultiselectionFillListItemsLC(); - - /** - * Shows wait note until first device appears - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt ShowWaitNoteL(); - - /** - * Shows info note - * - * @since S60 5.1 - * @param None - * @return None - */ - void ShowInfoNoteL( TInt aBodyTextResource ); - - /** - * Adds device name to device name list - * - * @since S60 5.1 - * @param aDevice, upnp device - * @return None - */ - void AddDeviceNameL( const CUpnpAVDevice& aDevice ); - - public: // Functions from base classes - - /** - * Notifies that a new UPnP device was discovered. - * - * @since S60 5.1 - * @param aDevice, upnp device - * @return None - */ - void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ); - - /** - * Notifies that a new UPnP device was discovered. - * - * @since S60 5.1 - * @param aDevice, upnp device - * @return None - */ - void UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice ); - - /** - * Notifies that a UPnP device was dissapeared. - * - * @since S60 5.1 - * @param aDevice, upnp device - * @return None - */ - void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); - - /** - * Notifies that a UPnP device was dissapeared. - * - * @since S60 5.1 - * @param aDevice, upnp device - * @return None - */ - void UPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice ); - - /** - * Notifies lost in WLAN connection - * - * @since S60 5.1 - * @param None - * @return None - */ - void WLANConnectionLost(); - - /** - * Sets system update id to zero - * @since S60 5.1 - * @param None - * @return None - */ - void ClearServersSystemUpdateId(); - - private: - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * @return None - */ - CMSAppWizard( CMSEngine& aMSEngine ); - - private: - - /** - * Resource file offset - */ - TInt iResFileOffset; - /** - * Control environment for file server access - */ - CEikonEnv* iCoeEnv; - /** - * The position of the wizard - */ - TInt iStep; - /** - * Flag for indicating device search cancel - */ - TBool iUserCancelledSearch; - /** - * selection popup for category and device selection - */ - CMSMultiselectionPopup* iMultiSelectionDlg; // owned - /** - * wait dialog - */ - CAknWaitDialog* iWaitDialog; // owned - /** - * wait sheduler - */ - CActiveSchedulerWait iWait; // owned - /** - * list of new servers - */ - RPointerArray iMediaServers; // owned - /** - * list of previously stored servers - */ - RPointerArray* iOriginalServers; // owned - /** - * list of upload capable servers - */ - RPointerArray iStoreServers; // owned - /** - * List of server names - */ - CDesCArrayFlat* iDeviceNameArray; // owned - /** - * The storage for the user selections - */ - CMSSelectionStorage* iSelections; // owned - /** - * application engine - */ - CMSEngine* iMSEngine; // not owned - /** - * Step count - */ - TInt iMaxSteps; - /** - * AV controller - */ - MUPnPAVController* iAvController; // owned - /** - * File server session - */ - RFs iFileSession; - /** - * found drives - */ - RPointerArray iDriveArray; // owned - /** - * Selected drives indexes - */ - RArray iDriveIndexes; - /** - * Flag for wlan lost - */ - TBool iWLanLost; - /** - * Upload capable server found -flag - */ - TBool iUploadServerFound; - }; - -#endif // CMSAPPWIZARD - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/inc/cmsmultiselectionpopup.h --- a/homesync/contentmanager/homesyncwizard/inc/cmsmultiselectionpopup.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +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: CMSMultiselectionPopup class definition -* -*/ - - -#ifndef CMSMULTISELECTIONPOPUP_H -#define CMSMULTISELECTIONPOPUP_H - -// INCLUDES -#include -#include -#include - -// CLASS DECLARATION - -/** - * CMSMultiselectionPopup dialog class - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSMultiselectionPopup ) : public CAknListQueryDialog - { -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aItemArray, list item array - * @param aSelectionIndexArray, currently selected items - * @param aHeading, popup heading - * @return CMSMultiselectionPopup* the new CMSMultiselectionPopup object - */ - static CMSMultiselectionPopup* NewL( - CDesCArrayFlat* aItemArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const TDesC& aHeading ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aItemArray, list item array - * @param aSelectionIndexArray, currently selected items - * @param aHeading, popup heading - * @return CMSMultiselectionPopup* the new CMSMultiselectionPopup object - */ - static CMSMultiselectionPopup* NewLC( - CDesCArrayFlat* aItemArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const TDesC& aHeading ); - - /** - * Destructor. - */ - virtual ~CMSMultiselectionPopup(); - -public: - - /** - * Updates the list of items - * - * @since S60 5.1 - * @param aItemArray, list item array - * @return None - */ - void UpdateAndDrawPopupL( CDesCArrayFlat* aItemArray ); - -protected: - -// From base class CAknSelectionListDialog - - /** - * From CAknSelectionListDialog - * See base class defition - */ - void PreLayoutDynInitL(); - - /** - * From CAknSelectionListDialog - * See base class defition - */ - TBool OkToExitL( TInt aButtonId ); - - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aSelectionIndexArray, selected indexes - * @param aHeading, popup heading - * @return None - */ - CMSMultiselectionPopup( - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const TDesC& aHeading ); - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aItemArray, list items - * @param aSelectionIndexArray, selected indexes - * @return None - */ - void ConstructL( CDesCArrayFlat* aItemArray, - CListBoxView::CSelectionIndexArray* - aSelectionIndexArray); - - /** - * Loads a possibly skinned icon and adds it to icon array - * - * @since S60 5.1 - * @param CAknIconArray, array of icons - * @param MAknsSkinInstance, skin instance - * @param TDesC, reference to icon file - * @param TAknsItemID, skinned icon id - * @param TInt, bitmap id - * @param TInt, bitmap mask id - * @return None - */ - void AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ) const; - - /** - * Creates listbox items and sets item array - * - * @since S60 5.1 - */ - void CreateAndSetListboxItemsL(); - -private: - - /** - * Dialog listbox - */ - CEikListBox* iListBox; // owned - /** - * Item array - */ - CDesCArrayFlat* iItemArray; // not owned - /** - * Selected item indexes - */ - CArrayFix* iSelectionIndexes;// not owned - /** - * Dialog title - */ - TPtrC iHeading; - }; -#endif - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/inc/cmsselectionstorage.h --- a/homesync/contentmanager/homesyncwizard/inc/cmsselectionstorage.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +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: Header file for the selection storage class -* -*/ - - - -#ifndef CMSSELECTIONSTORAGE -#define CMSSELECTIONSTORAGE - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CCmStoreRuleContainer; -class CCmFillRuleContainer; -class CMSEngine; -class CCmMediaServerFull; -class CCmStoreRule; -class CCmFillRule; - -// CLASS DECLARATION - -/** - * CMSSelectionStorage class - * Class implementing the storage for MediaServant wizard - * - * @since S60 5.1 - * - */ -NONSHARABLE_CLASS( CMSSelectionStorage ) : public CBase - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * @param aServers, mediaserver list - * @param aFs, file server session - * @return CMSSelectionStorage pointer - */ - static CMSSelectionStorage* NewL( - CMSEngine& aMSEngine, - RPointerArray& aServers, - RFs& aFs ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * @param aServers, mediaserver list - * @param aFs, file server session - * @return CMSSelectionStorage pointer - */ - static CMSSelectionStorage* NewLC( - CMSEngine& aMSEngine, - RPointerArray& aServers, - RFs& aFs ); - /** - * Destructor. - */ - virtual ~CMSSelectionStorage(); - -public: - - /** - * Stores the media categories, selected devices and store operation - * type. - * - * @since S60 5.1 - * @param None - * @return None - */ - void StoreMSSettingsL(); - - /** - * Sets fill list selections. - * - * @since S60 5.1 - * @param aSelections, selection array. - * @return None - */ - void SetFillListSelections( CArrayFix& aSelections ); - - /** - * Sets the store list selections. - * - * @since S60 5.1 - * @param aSelections, selection array. - * @return None - */ - void SetStoreListSelections( CArrayFix& aSelections ); - - /** - * Resets store list selections - * - * @since S60 5.1 - * @param None - * @return None - */ - void ClearStoreListSelections(); - - /** - * Sets the automatic/manual sync selection. - * - * @since S60 5.1 - * @param aSelection, service state manual/automatic - * @return None - */ - void SetAutoManualSelection( TBool aSelection ); - - /** - * Returns the automatic/manual sync selection. - * - * @since S60 5.1 - * @param None - * @return automatic selection on/off. - */ - TBool AutoManualSelection(); - - /** - * Stores drive information - * - * @since S60 5.1 - * @param None - * @return None - */ - void SetDriveInformationL(); - - /** - * Sets the selected servers for store rules. - * - * @since S60 5.1 - * @param aSelectedIndexes, selected server indexes - * @param aServers, mediaserver list - * @return None - */ - void SetServersForStoreRulesL( - CArrayFix& aSelectedIndexes, - RPointerArray& aServers ); - - /** - * Sets the selected servers for fill rules. - * - * @since S60 5.1 - * @param aSelectedIndexes, selected server indexes - * @return None - */ - void SetServersForFillRulesL( CArrayFix& aSelectedIndexes ); - -private: - - /** - * Removes the selected servers for store rule. - * - * @since S60 5.1 - * @param aRule, store rule - * @return None - */ - void RemoveServersFromStoreRuleL( CCmStoreRule* aRule ); - - /** - * Removes the selected servers for fill rule. - * - * @since S60 5.1 - * @param aRule, fill rule - * @return None - */ - void RemoveServersFromFillRuleL( CCmFillRule* aRule ); - - /** - * Set wlan scanning on/off - * - * @since S60 5.1 - * @param None - * @return None - */ - void SetWlanScanL(); - - /** - * Sets the selected servers for store rule. - * - * @since S60 5.1 - * @param aRule, store rule - * @param aSelectedIndexes, selected server indexes, - * @param aServers, mediaserver list - * @return None - */ - void SetServersForStoreRuleL( - CCmStoreRule* aRule, - CArrayFix& aSelectedIndexes, - RPointerArray& aServers ); - - /** - * Sets the selected servers for fill rule. - * - * @since S60 5.1 - * @param aRule, fill rule - * @param aSelectedIndexes, selected server indexes - * @return None - */ - void SetServersForFillRuleL( CCmFillRule* aRule, - CArrayFix& aSelectedIndexes ); - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * @param aServers, mediaserver list - * @param aFs, file server session - * @return None - */ - CMSSelectionStorage( CMSEngine& aMSEngine, - RPointerArray& aServers, - RFs& aFs ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -private: - - /** - * application engine - */ - CMSEngine& iMSEngine; - /** - * Users selected Automatic or Manual synchronization type. - * Efalse = Manual, ETrue = Automatic - */ - TBool iServiceState; - /** - * Selected store lists - */ - CArrayFix* iSelectedStoreLists; // owned - - /** - * Selected fill lists - */ - CArrayFix* iSelectedFillLists; // owned - - /** - * Store rules - */ - CCmStoreRuleContainer* iStoreRules; // owned - - /** - * Fill rules - */ - CCmFillRuleContainer* iFillRules; // owned - - /** - * Mediaserver array - */ - RPointerArray& iServers; - - /** - * file session - */ - RFs& iFs; - - }; - -#endif // CMSSELECTIONSTORAGE \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/loc/cmsappwizard.loc --- a/homesync/contentmanager/homesyncwizard/loc/cmsappwizard.loc Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* -* Copyright (c) 2007 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: This file includes localization strings -* -*/ - - -// LOCALISATION STRINGS - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_1 "Setup wizard 1/%N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_1 "Media Sync application can be used for synchronizing media from and to home devices. Please run the wizard within range of your WLAN." - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:2.1 -// -#define qtn_mserv_wizard_head_from_home_1 "Sync from home 2/%N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_from_home "Select the media you want to synchronize from home. You can edit the choices later in \"From home\" view." - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:2.1 -// -#define qtn_mserv_wizard_head_from_home_2 "Sync from home 3/%N" - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:2.1 -// -#define qtn_mserv_wizard_head_source_devices_1 "Source device(s) 4/%N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_source_devices "Select the device(s) from which to synchronise media. You can later add and remove sync devices in settings." - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:2.1 -// -#define qtn_mserv_wizard_head_source_devices_2 "Source device(s) 5/%N" - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_2 "Sync to home 6/%N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_2 "Select the media categories you want to synchronize to home. You can edit the choices later in \"To home\" view." - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_3 "Sync to home 7/%N" - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_4 "Target device(s) 8/%N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_4 "Select the device(s) to which to synchronise media. You can later add and remove sync devices in settings." - - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1/opt2 -//r:1.0 -// -#define qtn_mserv_wizard_head_5 "Target device(s) 9/%N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:2.1 -// -#define qtn_mserv_wizard_no_target_devices_found "There were no devices supporting upload found. Your selections of media categories to be synchronized to home are no longer valid." - -//d:Target devices not selected -//l:popup_info_list_pane_t1 -//r:2.1 -// -#define qtn_mserv_wizard_no_target_devices_selected "You didn’t select any target devices. Your selections of media categories to be synchronized to home are no longer valid." - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_8 "Synchronization 10/%N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_8 "Select whether you want to start synchronizing manually or let it run periodically while you are within the range of your WLAN." - -//d:Header for wizard step -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_9 "Synchronization 11/%N" - -//d:Syncronization setting value ( automatic mode ) -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_wizard_automatic "Automatically" - -//d:Syncronization setting value ( manual mode ) -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_wizard_manually "Manually" - -//d:Header for wizard step -//d:Parameters maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_10 "Setup wizard %0N/%1N" - -//d:Message for wizard step -//l:popup_info_list_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_10 "Initial refresh of your home media library will start now. Exiting the application will not stop the refreshing." - -//d:Search devices -//l:popup_note_wait_window -//r:2.1 -// -#define qtn_mserv_wizard_searching_devices "Searching for compatible devices" - -//d:Category to be synced from server to home -//l:list_single_graphic_pane_t1_cp2 -//r:2.1 -// -#define qtn_mserv_wizard_latest_images "Latest images" - -//d:Category to be synced from server to home -//l:list_single_graphic_pane_t1_cp2 -//r:2.1 -// -#define qtn_mserv_wizard_latest_music "Latest music" - -//d:Category to be synced from server to home -//l:list_single_graphic_pane_t1_cp2 -//r:2.1 -// -#define qtn_mserv_wizard_latest_videos "Latest videos" - -//d:Header for wizard step 8 -//d:Parameter maximum length: 2 characters -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_wizard_head_8_2 "Synchronization 6/%N" - -//d:List item -//d:Captures image category -//l:list_single_graphic_pane_t1_cp2 -//r:2.0 -// -#define qtn_mserv_wizard_phone_images "Captured images" - -//d:List item -//d:Other images category -//l:list_single_graphic_pane_t1_cp2 -//r:2.0 -// -#define qtn_mserv_wizard_other_images "Other images" - -//d:List item -//d:Captures videos category -//l:list_single_graphic_pane_t1_cp2 -//r:2.0 -// -#define qtn_mserv_wizard_phone_videos "Captured videos" - -//d:List item -//d:Other videos category -//l:list_single_graphic_pane_t1_cp2 -//r:2.0 -// -#define qtn_mserv_wizard_other_videos "Other videos" - -//d:List item -//d:Music category -//l:list_single_graphic_pane_t1_cp2 -//r:2.0 -// -#define qtn_mserv_wizard_music "Music" - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/src/cmsappwizard.cpp --- a/homesync/contentmanager/homesyncwizard/src/cmsappwizard.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1254 +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: Implementation of setup Wizard -* -*/ - - -// INCLUDE FILES -#include -#include -#include "upnpavdevice.h" -#include "upnpavcontroller.h" -#include "upnpavcontrollerfactory.h" -#include -#include -#include - -#include "cmdriveinfo.h" -#include "cmmediaserverfull.h" -#include "cmstorerulecontainer.h" -#include "cmstorerule.h" -#include "cmfillrulecontainer.h" -#include "cmfillrule.h" -#include "cmsappwizard.h" -#include "msengine.h" -#include "cmsmultiselectionpopup.h" -#include "cmsselectionstorage.h" -#include "msconstants.h" -#include "msdebug.h" -#include "upnpavdevicelist.h" - -// CONSTANTS -_LIT( KMSSetupWizardRscFile, "\\resource\\apps\\cmsappwizard.rsc" ); -#ifdef _DEBUG -_LIT( KPanicedUnit, "MSAPPWIZARD" ); -#endif // _DEBUG - -const TInt KArrayGranularity = 3; -const TInt KFillListGranularity = 3; -const TInt KStoreListGranularity = 5; - - -// -------------------------------------------------------------------------- -// CMSAppWizard::CMSAppWizard -// -------------------------------------------------------------------------- -// -CMSAppWizard::CMSAppWizard( CMSEngine& aMSEngine ) - { - iMSEngine = &aMSEngine; - iMaxSteps = ELastStep; - LOG(_L("[MSAppWizard]\t CMSAppWizard::CMSAppWizard")); - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CMSAppWizard::ConstructL() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::ConstructL begin")); - - iCoeEnv = CEikonEnv::Static(); - iFileSession = iCoeEnv->FsSession(); - - // Load resource file - TFileName rscFileName( KMSSetupWizardRscFile ); - User::LeaveIfError( CompleteWithAppPath( rscFileName ) ); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( iFileSession, rscFileName ); - // Check if the resource file exists or not - if ( !BaflUtils::FileExists( iFileSession, rscFileName ) ) - { - User::Leave( KErrNotFound ); - } - - TInt err(KErrNone); - TRAP( err, iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ) ); - User::LeaveIfError( err ); - - iSelections = CMSSelectionStorage::NewL( *iMSEngine, - iMediaServers, - iFileSession ); - - iDeviceNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity ); - - // original servers - iOriginalServers = iMSEngine->GetMediaServersL(); - ClearServersSystemUpdateId(); - - // Start searching servers - TInt error = CreateAvControllerL(); - if ( !error && iAvController ) - { - // Process devices that AVController has already discovered. - FetchAlreadyDiscoveredDevicesL(); - } - -#if _DEBUG - RDebug::Printf("[MSAppWizard]\t CMSAppWizard::ConstructL: %s, %s\n",\ -__DATE__,__TIME__); -#endif - LOG( _L("[MSAppWizard]\t CMSAppWizard::ConstructL end") ); - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::NewL() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CMSAppWizard* CMSAppWizard::NewL( CMSEngine& aMSEngine ) - { - LOG( _L("[MSAppWizard]\t CMSAppWizard::NewL begin") ); - - CMSAppWizard* self = CMSAppWizard::NewLC( aMSEngine ); - - CleanupStack::Pop( self ); - LOG( _L("[MSAppWizard]\t CMSAppWizard::NewL end") ); - return self; - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::NewLC() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CMSAppWizard* CMSAppWizard::NewLC( CMSEngine& aMSEngine ) - { - LOG( _L("[MSAppWizard]\t CMSAppWizard::NewLC begin") ); - - CMSAppWizard* self = new ( ELeave) CMSAppWizard( aMSEngine ); - CleanupStack::PushL( self ); - - self->ConstructL(); - - LOG( _L("[MSAppWizard]\t CMSAppWizard::NewLC end") ); - return self; - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -CMSAppWizard::~CMSAppWizard() - { - LOG( _L("[MSAppWizard]\t CMSAppWizard::~CMSAppWizard begin") ); - - // stop device search - CancelDeviceSearch(); - - // UnLoad resource file - iCoeEnv->DeleteResourceFile( iResFileOffset ); - - if ( iOriginalServers ) - { - iOriginalServers->ResetAndDestroy(); - iOriginalServers->Close(); - delete iOriginalServers; - } - - if ( iDeviceNameArray ) - { - iDeviceNameArray->Reset(); - delete iDeviceNameArray; - } - - iDriveIndexes.Close(); - - iDriveArray.ResetAndDestroy(); - iDriveArray.Close(); - - iStoreServers.Reset(); - iStoreServers.Close(); - - iMediaServers.ResetAndDestroy(); - iMediaServers.Close(); - - delete iSelections; - - if ( iAvController ) - { - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - } - - CloseWaitDialog(); - - if ( iWait.IsStarted() ) - { - iWait.AsyncStop(); - } - - LOG( _L("[MSAppWizard]\t CMSAppWizard::~CMSAppWizard end") ); - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::StartL -// The main loop of setup wizard -// -------------------------------------------------------------------------- -// - -EXPORT_C TInt CMSAppWizard::StartL() - { - LOG( _L("[MSAppWizard]\t CMSAppWizard::StartL begin") ); - TInt ret(KErrNone); - do - { - switch ( iStep ) - { - case EStep1: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_1, ELastStep ); - ret = ShowInfoStepL( iStep, head->Des() ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep2: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_2, ELastStep ); - ret = ShowInfoStepL( iStep, head->Des() ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep3: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_3, ELastStep ); - - CDesCArrayFlat* itemArray = - CreateMultiselectionFillListItemsLC(); - - CArrayFix* resultArray = - new (ELeave) CArrayFixFlat( KFillListGranularity ); - CleanupStack::PushL( resultArray ); - - ret = ShowMultiselectionStepL( *itemArray, - *resultArray, - head->Des() ); - // keep selection safe - iSelections->SetFillListSelections( *resultArray ); - CleanupStack::Pop( resultArray ); - CleanupStack::PopAndDestroy( itemArray ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep4: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_4, ELastStep ); - ret = ShowInfoStepL( iStep, head->Des() ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep5: - { - CreateServerNameListL( iMediaServers ); - - if ( iDeviceNameArray->Count() == 0 ) - { - // no devices yet - show wait note - ShowWaitNoteL(); - // wait here for the first device before - // showing device selection - iWait.Start(); - } - if ( !iUserCancelledSearch ) - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_5, ELastStep ); - - CArrayFix* selectedIndexes = - new (ELeave) CArrayFixFlat( KArrayGranularity ); - CleanupStack::PushL( selectedIndexes ); - ret = ShowMultiselectionStepL( *iDeviceNameArray, - *selectedIndexes, - head->Des() ); - iSelections->SetServersForFillRulesL( *selectedIndexes ); - CleanupStack::PopAndDestroy( selectedIndexes ); - CleanupStack::PopAndDestroy( head ); - } - else - { - ret = KErrCancel; - } - - break; - } - case EStep6: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_6, ELastStep ); - ret = ShowInfoStepL( iStep, head->Des() ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep7: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_7, ELastStep ); - //used CreateMultiselectionStoreListItemsLC before, modify then to - //make it the same with UI spec - CDesCArrayFlat* itemArray = - CreateMultiselectionUIStoreListStringLC(); - - CArrayFix* resultArray = - new (ELeave) CArrayFixFlat( KStoreListGranularity ); - CleanupStack::PushL( resultArray ); - - ret = ShowMultiselectionStepL( *itemArray, - *resultArray, - head->Des() ); - // keep selection safe - iSelections->SetStoreListSelections( *resultArray ); - CleanupStack::Pop( resultArray ); - CleanupStack::PopAndDestroy( itemArray ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep8: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_8, ELastStep ); - ret = ShowInfoStepL( iStep, head->Des() ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep9: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_9, ELastStep ); - - // Clear previous store servers - iStoreServers.Reset(); - - // copy those media servers to store servers list, - // where copy capability is active - for ( TInt index=0; index < iMediaServers.Count(); index++ ) - { - if ( iMediaServers.operator[](index)->CopyCapability() ) - { - iStoreServers.AppendL( - iMediaServers.operator[]( index ) ); - } - } - - // append items to iDeviceNameArray - CreateServerNameListL( iStoreServers ); - - CArrayFix* selectedIndexes = - new (ELeave) CArrayFixFlat( KArrayGranularity ); - CleanupStack::PushL( selectedIndexes ); - - if ( iDeviceNameArray->Count() ) - { - ret = ShowMultiselectionStepL( *iDeviceNameArray, - *selectedIndexes, - head->Des() ); - if ( ret > 0 && selectedIndexes->Count() == 0 ) - { - ShowInfoNoteL( R_MS_NO_TARGET_DEVICES_SELECTED_INFO ); - // clear store list selections - iSelections->ClearStoreListSelections(); - } - iSelections->SetServersForStoreRulesL( *selectedIndexes, - iStoreServers ); - } - else // no devices available - show info note - { - ret = ShowInfoStepL( iStep, head->Des() ); - if ( ret > KErrNone ) - { - // clear store list selections - iSelections->ClearStoreListSelections(); - iSelections->SetServersForStoreRulesL( - *selectedIndexes, - iStoreServers ); - } - } - - CleanupStack::PopAndDestroy( selectedIndexes ); - CleanupStack::PopAndDestroy( head ); - break; - } - - case EStep10: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_10, ELastStep ); - ret = ShowInfoStepL( iStep, head->Des() ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep11: - { - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_11, ELastStep ); - ret = ShowListStepL( R_MS_WIZARD_SELECTION_DIALOG_8, - head->Des() ); - CleanupStack::PopAndDestroy( head ); - break; - } - case EStep12: - { - // two parameters - CArrayFix* stepArray = - new ( ELeave ) CArrayFixFlat(2); - CleanupStack::PushL( stepArray ); - stepArray->AppendL( ELastStep ); - stepArray->AppendL( ELastStep ); - HBufC* head = StringLoader::LoadLC( - R_MS_HEADING_STEP_12, *stepArray ); - ret = ShowInfoStepL( iStep, head->Des() ); - CleanupStack::PopAndDestroy( head ); - CleanupStack::PopAndDestroy( stepArray ); - break; - } - case ELastStep: - { - // stop device search - CancelDeviceSearch(); - - // set remove status and name to old servers - CheckAndSetServerStateL(); - // clear ids again because there might be new unselected servers - ClearServersSystemUpdateId(); - - iMSEngine->SetMediaServersL( *iOriginalServers ); - - // Set used drives - iSelections->SetDriveInformationL(); - - iSelections->StoreMSSettingsL(); - - ret = ELastStep; // stop looping - break; - } - case ECancelWizard: - { - // stop device search - CancelDeviceSearch(); - - // Wizard is cancelled, do not start information refreshing - ret = KErrNone; - break; - } - default : - { - LOG( _L("[MSAppWizard]\t CMSAppWizard::StartL: default!") ); - __ASSERT_DEBUG( EFalse, User::Panic( KPanicedUnit, 0 ) ); - break; - } - } - - SetNextStep( ret ); - } - while ( iStep != EWizardEnd ); - - LOG(_L("[MSAppWizard]\t CMSAppWizard::StartL end")); - - return ret; - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::DialogDismissedL -// --------------------------------------------------------------------------- -// -void CMSAppWizard::DialogDismissedL( TInt aButtonId ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::DialogDismissedL")); - if( aButtonId != EAknSoftkeyDone ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::DialogDismissedL CANCEL")); - if ( aButtonId == EAknSoftkeyCancel ) - { - iUserCancelledSearch = ETrue; - } - } - if ( iWait.IsStarted() ) - { - iWait.AsyncStop(); - } - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::ShowInfoNoteL -// -------------------------------------------------------------------------- -// -void CMSAppWizard::ShowInfoNoteL( TInt aBodyTextResource ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoNoteL")); - CAknInformationNote* dlg = new(ELeave)CAknInformationNote( ETrue ); - CleanupStack::PushL( dlg ); - HBufC* noteText = StringLoader::LoadLC( aBodyTextResource ); - dlg->ExecuteLD( *noteText ); - CleanupStack::PopAndDestroy( noteText ); - CleanupStack::Pop( dlg ); - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::AddDeviceNameL -// -------------------------------------------------------------------------- -// -void CMSAppWizard::AddDeviceNameL( const CUpnpAVDevice& aDevice ) - { - CUpnpAVDevice* device = const_cast ( &aDevice ); - - HBufC* devName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - device->FriendlyName() ); - CleanupStack::PushL( devName ); - TRACE(Print(_L("[MSAppWizard]\t device Name= %S"), devName )); - iDeviceNameArray->AppendL( *devName ); - CleanupStack::PopAndDestroy( devName ); - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::ShowInfoStepL -// -// -------------------------------------------------------------------------- -// -TInt CMSAppWizard::ShowInfoStepL( TInt aStep, TPtr aHeading ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoStepL")); - TInt returnValue( KErrNone ); - - CAknMessageQueryDialog* dlg = new (ELeave) - CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); - CleanupStack::PushL( dlg ); - - dlg->PrepareLC( R_MS_WIZARD_INFO_DIALOG ); - - // do number conversion - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading ); - - dlg->SetHeaderTextL( aHeading ); - HBufC* body = NULL; - switch ( aStep ) - { - case EStep1: - { - body = StringLoader::LoadLC( R_MS_STEP_1_BODY_TEXT ); - break; - } - case EStep2: - { - body = StringLoader::LoadLC( R_MS_STEP_2_BODY_TEXT ); - break; - } - case EStep4: - { - body = StringLoader::LoadLC( R_MS_STEP_4_BODY_TEXT ); - break; - } - case EStep6: - { - body = StringLoader::LoadLC( R_MS_STEP_6_BODY_TEXT ); - break; - } - case EStep8: - { - body = StringLoader::LoadLC( R_MS_STEP_8_BODY_TEXT ); - break; - } - case EStep9: - { - body = StringLoader::LoadLC( R_MS_STEP_9_2_BODY_TEXT ); - break; - } - case EStep10: - { - body = StringLoader::LoadLC( R_MS_STEP_10_BODY_TEXT ); - break; - } - case EStep12: - { - body = StringLoader::LoadLC( R_MS_LAST_STEP_BODY_TEXT ); - break; - } - default: - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowInfoStepL \ - Step not found")); - break; - } - } - - if ( body ) // long body text - { - dlg->SetMessageTextL( *body ); - CleanupStack::PopAndDestroy( body ); - } - - returnValue = dlg->RunLD(); - CleanupStack::Pop( dlg ); - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::ShowListStepL -// Show the UI dialog with selection list -// -------------------------------------------------------------------------- -// -TInt CMSAppWizard::ShowListStepL( TInt aMain, TPtr aHeading ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowListStepL begin")); - TInt returnValue(KErrNone); - - TBool currSelection = iSelections->AutoManualSelection(); - - CDesCArrayFlat* storeTypeSelection = new (ELeave) CDesCArrayFlat( - KArrayGranularity ); - CleanupStack::PushL( storeTypeSelection ); - - HBufC* itemText1 = StringLoader::LoadLC( R_MS_AUTOMATIC_TEXT ); - HBufC* itemText2 = StringLoader::LoadLC( R_MS_MANUAL_TEXT ); - - storeTypeSelection->AppendL( *itemText1 ); - storeTypeSelection->AppendL( *itemText2 ); - - CleanupStack::PopAndDestroy(2, itemText1 ); - - CAknListQueryDialog* dlg = new - ( ELeave ) CAknListQueryDialog( &currSelection ); - - dlg->PrepareLC( aMain ); - - // do number conversion - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading ); - - dlg->SetHeaderTextL( aHeading ); - dlg->SetItemTextArray( storeTypeSelection ); - dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); - - CListBoxView* listBoxView = dlg->ListBox()->View(); - listBoxView->SetCurrentItemIndex( currSelection ); - - returnValue = dlg->RunLD(); - - TRACE( - Print( _L("MSAppWizard]\t ShowListStepL exit dlg: %d" ), - returnValue ) ); - iSelections->SetAutoManualSelection( currSelection ); - - CleanupStack::PopAndDestroy( storeTypeSelection ); - - LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowListStepL ends")); - return returnValue; - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::ShowMultiselectionStepL -// Show the multiselection popup dialog for setting content to share -// -------------------------------------------------------------------------- -// -TInt CMSAppWizard::ShowMultiselectionStepL( CDesCArrayFlat& aItemArray, - CArrayFix& aResultArray, - TPtr aHeading - ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::ShowMultiselectionStepL")); - TInt returnValue(KErrNone); - - // do number conversion - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aHeading ); - - iMultiSelectionDlg = CMSMultiselectionPopup::NewL( - &aItemArray, - &aResultArray, - aHeading ); - - iMultiSelectionDlg->PrepareLC( R_MS_WIZARD_MULTISELECTION_DIALOG ); - - // For Device selection - if ( iStep == EStep5 || iStep == EStep9 ) - { -#ifndef __WINS__ - iMultiSelectionDlg->QueryHeading()->SetHeaderAnimationL( - R_MS_ANIMATION_FOR_SELECTION_DIALOG ); -#endif - if ( iStep == EStep9 ) // no upload servers found - { - HBufC* defaultText = - StringLoader::LoadLC( R_MS_STEP_9_2_BODY_TEXT ); - iMultiSelectionDlg->ListBox()->View()->SetListEmptyTextL( - *defaultText ); - CleanupStack::PopAndDestroy( defaultText ); - } - } - - returnValue = iMultiSelectionDlg->RunLD(); - iMultiSelectionDlg = NULL; - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::ShowWaitNoteL -// -------------------------------------------------------------------------- -// -TInt CMSAppWizard::ShowWaitNoteL() - { - TInt returnValue( 0 ); - - iUserCancelledSearch = EFalse; - iWLanLost = EFalse; - iWaitDialog = new ( ELeave ) CAknWaitDialog( - ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) ); - iWaitDialog->SetCallback( this ); - iWaitDialog->ExecuteLD( R_MS_WIZARD_WAIT_DIALOG ); - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::SetNextStep -// Calculates the next step in wizard -// -------------------------------------------------------------------------- -// -void CMSAppWizard::SetNextStep( const TInt aDirection ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::SetNextStep")); - - if ( aDirection > 0 || EEikBidOk == aDirection ) - { - iStep++; - } - else if ( iStep <= 0 ) - { - iStep = ECancelWizard; - } - else - { - iStep--; - } - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::CancelDeviceSearch -// -// -------------------------------------------------------------------------- -// -void CMSAppWizard::CancelDeviceSearch() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::CancelDeviceSearch")); - - if ( iAvController ) - { - iAvController->RemoveDeviceObserver(); - iAvController->Release(); - iAvController = NULL; - } - } - -// -------------------------------------------------------------------------- -// CMSAppWizard::CreateAvControllerL -// -// -------------------------------------------------------------------------- -// -TInt CMSAppWizard::CreateAvControllerL() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL begins")); - - TInt retVal(KErrNone); - - - iMediaServers.ResetAndDestroy(); - iMediaServers.Close(); - - - if( iDeviceNameArray ) - { - iDeviceNameArray->Reset(); - delete iDeviceNameArray; - iDeviceNameArray = NULL; - iDeviceNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity ); - } - - if( iAvController ) - { - iAvController->Release(); - iAvController = NULL; - } - - LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL before")); - TRAP( retVal, - iAvController = UPnPAVControllerFactory::NewUPnPAVControllerL() ); - - LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL afterr")); - - if( retVal != KErrNone ) - { - TRACE( Print( - _L("[MediaServant]\t AvController create FAILED, \ - err = %d"), retVal) - ); - if( retVal == KErrCancel ) - { - //operation cancelled, return to dialog 4/8 - CloseWaitDialog(); - } - } - else - { - iAvController->SetDeviceObserver( *this ); - } - - LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateAvControllerL ends")); - return retVal; - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::UpdateDevicePopupDlgL -// Updates popup data with found device -// --------------------------------------------------------------------------- -// -void CMSAppWizard::UpdateDevicePopupDlgL() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::UpdateDevicePopupDlgL begins")); - - iMultiSelectionDlg->UpdateAndDrawPopupL( iDeviceNameArray ); - LOG(_L("[MSAppWizard]\t CMSAppWizard::UpdateDevicePopupDlgL ends")); - } - - -// --------------------------------------------------------------------------- -// CMSAppWizard::UPnPDeviceDiscovered -// Returns discovered device from UPnP AV control point -// --------------------------------------------------------------------------- -// -void CMSAppWizard::UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[MediaServant]\t CMSSettingItemDevices::\ - UPnPDeviceDiscovered")); - - TRAP_IGNORE( UPnPDeviceDiscoveredL(aDevice) ); - } - - -// --------------------------------------------------------------------------- -// CMSAppWizard::UPnPDeviceDiscoveredL -// -// --------------------------------------------------------------------------- -// -void CMSAppWizard::UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDiscoveredL begins")); - - CUpnpAVDevice* device = const_cast ( &aDevice ); - - if( device->DeviceType() == CUpnpAVDevice::EMediaServer && - device->SearchCapability() && - device->DlnaCompatible() ) - { - LOG(_L("[MSAppWizard]\t Found device is Media server!")); - CCmMediaServerFull* tempServer = CCmMediaServerFull::NewL(); - CleanupStack::PushL( tempServer ); - tempServer->SetUDNL( device->Uuid() ); - tempServer->SetMediaServerNameL( device->FriendlyName() ); - tempServer->SetSystemUpdateID( -1 ); - tempServer->SetCopyCapability( aDevice.CopyCapability() ); - - TTime timeStamp; - timeStamp.HomeTime(); - tempServer->SetVisibleDate( timeStamp ); - iMediaServers.AppendL( tempServer ); - - if ( iStep == EStep9 ) - { - // Add only store servers in step EStep9 - if ( tempServer->CopyCapability() ) - { - iStoreServers.AppendL( tempServer ); - AddDeviceNameL( aDevice ); - } - } - else - { - AddDeviceNameL( aDevice ); - } - - CleanupStack::Pop( tempServer ); - } - else - { - LOG(_L("[MSAppWizard]\t Found device is NOT Dlna compliant \ - Media server!")); - return; - } - - if ( iWaitDialog ) - { - CloseWaitDialog(); - } - // Ensure that we are in device selection step before adding items - // to the dialog - else if( iMultiSelectionDlg && ( iStep == EStep5 || iStep == EStep9 )) - { - //update device list for UI - UpdateDevicePopupDlgL(); - } - - LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDiscoveredL ends")); - - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::UPnPDeviceDisappeared -// Returns disappeared device from UPnP AV control point. -// --------------------------------------------------------------------------- -// -void CMSAppWizard::UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[MediaServant]\t CMSSettingItemDevices::\ - UPnPDeviceDisappeared")); - - TRAP_IGNORE( UPnPDeviceDisappearedL( aDevice ) ); - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::UPnPDeviceDisappearedL -// -// --------------------------------------------------------------------------- -// -void CMSAppWizard::UPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL begins")); - TPtrC8 ptr( aDevice.Uuid() ); - TInt serverIndex(0); - - if (!ptr.Compare(_L8("ConnectionLost"))) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::\ - UPnPDeviceDisappearedL: Connection lost!")); - } - - TPtrC8 serverUid = aDevice.Uuid(); - - if( MatchFoundServer( serverUid, serverIndex ) == KErrNone ) - { - // remove server and update screen - LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL, MATCH")); - delete (iMediaServers)[serverIndex]; - (iMediaServers)[serverIndex] = NULL; - iMediaServers.Remove( serverIndex ); - iDeviceNameArray->Delete( serverIndex ); - - if( iMultiSelectionDlg && ( iStep == EStep5 || iStep == EStep9 ) ) - { - UpdateDevicePopupDlgL(); - } - } - - LOG(_L("[MSAppWizard]\t CMSAppWizard::DeviceDisappearedL ends")); - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::WLANConnectionLost -// Called when wlan connection is lost -// --------------------------------------------------------------------------- -// -void CMSAppWizard::WLANConnectionLost() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::WLANConnectionLost")); - iWLanLost = ETrue; - TRAP_IGNORE( DialogDismissedL( EAknSoftkeyCancel ) ); - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::MatchFoundServer -// returns KErrNone if match found -// --------------------------------------------------------------------------- -// -TInt CMSAppWizard::MatchFoundServer( TDesC8& aUid, TInt &aServerIndex ) - { - TInt retVal( KErrNotFound ); - TInt devicecount = iMediaServers.Count(); - - for( TInt i=0; iMediaServer().Compare( aUid ); - - if ( retVal == KErrNone ) - { - aServerIndex = i; - i = devicecount; // break from the for loop - } - } - return retVal; - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::CheckAndSetServerStateL -// sets remove state to server if it is old one -// also update the server name -// --------------------------------------------------------------------------- -// -void CMSAppWizard::CheckAndSetServerStateL() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::CheckAndSetServerStateL")); - - TKeyArrayFix sortKey( 0, ECmpNormal ); - - // set remove status to all original servers - for ( TInt ind = 0; ind < iOriginalServers->Count(); ind++ ) - { - CCmMediaServerFull* tempServer = (*iOriginalServers)[ind]; - tempServer->SetIsActive( KServerRemoved ); - tempServer->SetStoreUsage( EFalse ); - tempServer->SetFillUsage( EFalse ); - } - - // Change found servers statuses - for ( TInt i = 0; i < iMediaServers.Count(); i++ ) - { - CCmMediaServerFull* newServer = iMediaServers[i]; - TBool found( EFalse ); - TInt iterations = iOriginalServers->Count(); - for ( TInt j = 0; j < iterations; j++ ) - { - CCmMediaServerFull* origServer = (*iOriginalServers)[j]; - { - if ( origServer->MediaServer() == newServer->MediaServer()) - { - origServer->SetIsActive( newServer->IsActive() ); - origServer->SetStoreUsage( newServer->StoreUsage() ); - origServer->SetFillUsage( newServer->FillUsage() ); - found = ETrue; - j = iterations; // break loop - //update the server name - origServer->SetMediaServerNameL( - newServer->MediaServerName() ); - } - } - } - if ( !found ) - { - // append new server to the server list - iOriginalServers->Append( newServer ); - - iMediaServers.Remove( i ); - // reduce index because of the server remove to - // check all items - i--; - } - } - - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::ClearServersSystemUpdateId -// clears system update ids of unselected servers -// --------------------------------------------------------------------------- -// -void CMSAppWizard::ClearServersSystemUpdateId() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::ClearServersSystemUpdateId")); - - for ( TInt ind = 0; ind < iOriginalServers->Count(); ind++ ) - { - CCmMediaServerFull* server = (*iOriginalServers)[ind]; - if ( !server->IsActive() ) - { - server->SetSystemUpdateID( -1 ); - } - } - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::FetchAlreadyDiscoveredDevicesL -// Fetches devices from AVController and calls -// DeviceDiscovered-callback for each of them. -// --------------------------------------------------------------------------- -// -void CMSAppWizard::FetchAlreadyDiscoveredDevicesL() - { - LOG( _L("[MSAppWizard]\t CMSAppWizard::FetchAlreadyDiscoveredDevicesL") ); - - // If iAvController is not created, this method is unusable. - // Call CreateAvControllerL first. - User::LeaveIfNull( iAvController ); - - // Fetch already found devices from AVController. - CUpnpAVDeviceList* discoveredDevices = - iAvController->GetMediaServersL(); - CleanupStack::PushL( discoveredDevices ); - - if ( discoveredDevices && discoveredDevices->Count() > 0 ) - { - // the AVController already has some devices. - LOG(_L("[MSAppWizard]\t CMSAppWizard::FetchAlreadyDiscoveredDevicesL:\ - AVController has already discovered devices")); - - // process the already existing devices - for ( TInt i = 0 ; i < discoveredDevices->Count() ; i++ ) - { - UPnPDeviceDiscovered( - *( discoveredDevices->operator[](i) ) ); - } - } - - // clean up - CleanupStack::PopAndDestroy( discoveredDevices ); - discoveredDevices = NULL; - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::CloseWaitDialog -// Close wait dialog -// --------------------------------------------------------------------------- -void CMSAppWizard::CloseWaitDialog() - { - LOG( _L("[MSAppWizard]\t CMSAppWizard::CloseWaitDialog") ); - if ( iWaitDialog ) - { - TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); - iWaitDialog = NULL; - } - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::CreateMultiselectionFillListItemsLC -// --------------------------------------------------------------------------- -CDesCArrayFlat* CMSAppWizard::CreateMultiselectionFillListItemsLC() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard:: \ - CreateMultiselectionFillListItemsLC")); - - CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat( - KFillListGranularity ); - CleanupStack::PushL( itemArray ); - - // Read fill lists from engine - CCmFillRuleContainer* listContainer = iMSEngine->FillRulesL(); - - for ( TInt index = 0; index < listContainer->FillRuleCount(); index++ ) - { - CCmFillRule* rule = listContainer->FillRule( index ); - HBufC* itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - rule->Name() ); - CleanupStack::PushL( itemText ); - - itemArray->AppendL( *itemText ); - - CleanupStack::PopAndDestroy( itemText ); - } - - delete listContainer; - listContainer = NULL; - - return itemArray; - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::CreateMultiselectionStoreListItemsLC -// --------------------------------------------------------------------------- -CDesCArrayFlat* CMSAppWizard::CreateMultiselectionStoreListItemsLC() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard:: \ - CreateMultiselectionStoreListItemsLC")); - - CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat( - KFillListGranularity ); - CleanupStack::PushL( itemArray ); - - // Read store lists from engine - CCmStoreRuleContainer* listContainer = iMSEngine->StoreRulesL(); - - for ( TInt index = 0; index < listContainer->StoreRuleCount(); index++ ) - { - CCmStoreRule* rule = listContainer->StoreRule( index ); - HBufC* itemText = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - rule->Name() ); - CleanupStack::PushL( itemText ); - - itemArray->AppendL( *itemText ); - - CleanupStack::PopAndDestroy( itemText ); - } - - delete listContainer; - listContainer = NULL; - - return itemArray; - } - - -// --------------------------------------------------------------------------- -// CMSAppWizard::CreateMultiselectionUIStoreListStringLC -// --------------------------------------------------------------------------- -CDesCArrayFlat* CMSAppWizard::CreateMultiselectionUIStoreListStringLC() - { - LOG(_L("[MSAppWizard]\t CMSAppWizard:: \ - CreateMultiselectionUIStoreListStringLC")); - - CDesCArrayFlat* itemArray = new (ELeave) CDesCArrayFlat( - KStoreListGranularity ); - CleanupStack::PushL( itemArray ); - - HBufC* capturedPic = StringLoader::LoadLC( R_MS_WIZARD_CAPTURED_IMAGES ); - HBufC* otherPic = StringLoader::LoadLC( R_MS_WIZARD_OTHER_IMAGES ); - HBufC* capturedVideo = StringLoader::LoadLC( R_MS_WIZARD_CAPTURED_VIDEOS ); - HBufC* otherVideo = StringLoader::LoadLC( R_MS_WIZARD_OTHER_VIDEOS ); - HBufC* music = StringLoader::LoadLC( R_MS_WIZARD_MUSIC ); - - itemArray->AppendL( *capturedPic ); - itemArray->AppendL( *otherPic ); - itemArray->AppendL( *capturedVideo ); - itemArray->AppendL( *otherVideo ); - itemArray->AppendL( *music ); - - CleanupStack::PopAndDestroy( 5 ); - - return itemArray; - } - -// --------------------------------------------------------------------------- -// CMSAppWizard::CreateServerNameListL -// --------------------------------------------------------------------------- -void CMSAppWizard::CreateServerNameListL( - RPointerArray& aServerArray ) - { - LOG(_L("[MSAppWizard]\t CMSAppWizard::CreateServerNameListL")); - - // reset previous names - iDeviceNameArray->Reset(); - - for ( TInt i = 0; i < aServerArray.Count(); i++ ) - { - CCmMediaServerFull* server = aServerArray[i]; - HBufC* name = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - server->MediaServerName() ); - CleanupStack::PushL( name ); - iDeviceNameArray->AppendL( *name ); - CleanupStack::PopAndDestroy( name ); - } - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/src/cmsmultiselectionpopup.cpp --- a/homesync/contentmanager/homesyncwizard/src/cmsmultiselectionpopup.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,300 +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: Multiselection popup implementation -* -*/ - - -// INCLUDE FILES -#include -#include -#include - -#include "cmsmultiselectionpopup.h" -#include "msdebug.h" - -// Format string for listbox items -_LIT(KItemFormatString, "1\t%S"); - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::NewL -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup* CMSMultiselectionPopup::NewL( - CDesCArrayFlat* aItemArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const TDesC& aHeading ) - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewL begin")); - - CMSMultiselectionPopup* self = - CMSMultiselectionPopup::NewLC( aItemArray, - aSelectionIndexArray, - aHeading ); - CleanupStack::Pop( self ); - - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewL end")); - return self; - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::NewLC -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup* CMSMultiselectionPopup::NewLC( - CDesCArrayFlat* aItemArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const TDesC& aHeading ) - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewLC begin")); - - CMSMultiselectionPopup* self = - new(ELeave) CMSMultiselectionPopup( NULL, - aHeading ); - - CleanupStack::PushL(self); - self->ConstructL( aItemArray, aSelectionIndexArray ); - - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::NewLC end")); - return self; - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::ConstructL -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::ConstructL( - CDesCArrayFlat* aItemArray, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ) - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\ - ConstructL begin")); - - iItemArray = aItemArray; - - iSelectionIndexes = aSelectionIndexArray; - - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\ - ConstructL end")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::CMSMultiselectionPopup -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup::CMSMultiselectionPopup( - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const TDesC& aHeading ) - : CAknListQueryDialog( aSelectionIndexArray ), - iHeading( aHeading ) - - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \ - CMSMultiselectionPopup")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::~CMSMultiselectionPopup -// --------------------------------------------------------------------------- -// -CMSMultiselectionPopup::~CMSMultiselectionPopup() - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\ - CMSMultiselectionPopup")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::UpdateAndDrawPopup -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::UpdateAndDrawPopupL( - CDesCArrayFlat* aItemArray ) - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \ - UpdateAndDrawPopupL begin")); - - iItemArray = aItemArray; - - if ( iItemArray->Count() ) - { - CreateAndSetListboxItemsL(); - } - - Layout(); - SizeChanged(); - iListBox->DrawNow(); - - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \ - UpdateAndDrawPopupL ends")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::AppendIconToArrayL -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId) const - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \ - AppendIconToArrayL begin")); - - __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC(aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId); - - CGulIcon* icon = CGulIcon::NewL(bitmap, mask); - icon->SetBitmapsOwnedExternally(EFalse); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop(2); // mask, bitmap - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL(icon); - - aArray->AppendL(icon); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(icon); - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \ - AppendIconToArrayL end")); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::OkToExitL(TInt aButtonId) -// --------------------------------------------------------------------------- -// -TBool CMSMultiselectionPopup::OkToExitL(TInt aButtonId) - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\ -OkToExitL begin")); - - if ( aButtonId == EAknSoftkeyNext || aButtonId == EAknSoftkeyBack ) - { - LOG(_L("[MSAppWizard]\t CUPnPAppMultiselectionPopup::\ -OkToExitL: Next or Back")); - - const CListBoxView::CSelectionIndexArray* selected = - ListBox()->SelectionIndexes(); - - if ( iSelectionIndexes ) - { - TInt selectCount = selected->Count(); - iSelectionIndexes->Reset(); - for ( TInt i = 0; i < selectCount; i++ ) - { - iSelectionIndexes->AppendL( selected->At( i ) ); - } - } - } - - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\ -OkToExitL end")); - return ETrue; - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::CreateAndSetListboxItemsL() -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::CreateAndSetListboxItemsL() - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup::\ - CreateAndSetListboxItemsL")); - - TInt itemCount = iItemArray->Count(); - - CDesCArrayFlat* listItems = new (ELeave) CDesCArrayFlat( 5 ); - CleanupStack::PushL( listItems ); - - for ( TInt i = 0; i < itemCount; i++) - { - TPtrC itemStr = iItemArray->MdcaPoint(i); - HBufC* item = HBufC::NewLC( itemStr.Size() + - sizeof( KItemFormatString ) ); - item->Des().Format( KItemFormatString, &itemStr ); - - listItems->AppendL( *item ); - CleanupStack::PopAndDestroy( item ); - } - SetItemTextArray( listItems ); - CleanupStack::Pop( listItems ); - } - -// --------------------------------------------------------------------------- -// CMSMultiselectionPopup::PreLayoutDynInitL() -// --------------------------------------------------------------------------- -// -void CMSMultiselectionPopup::PreLayoutDynInitL() - { - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \ - PreLayoutDynInitL begin")); - - // two icons - CAknIconArray* icons = new (ELeave) CAknIconArray(2); - CleanupStack::PushL( icons ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName() ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOn, - EMbmAvkonQgn_indi_checkbox_on, - EMbmAvkonQgn_indi_checkbox_on_mask ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOff, - EMbmAvkonQgn_indi_checkbox_off, - EMbmAvkonQgn_indi_checkbox_off_mask ); - - - CAknListQueryDialog::SetIconArrayL(icons); - - CleanupStack::Pop(icons); - - iListBox = ListBox(); - - CAknFilteredTextListBoxModel* model = STATIC_CAST( - CAknFilteredTextListBoxModel*, - iListBox->Model()); - - // create listbox items if any - if ( iItemArray->Count() ) - { - CreateAndSetListboxItemsL(); - } - - SetHeaderTextL( iHeading ); - - iListBox->ActivateL(); - - CAknListQueryDialog::PreLayoutDynInitL(); - - LOG(_L("[MSAppWizard]\t CMSMultiselectionPopup:: \ - PreLayoutDynInitL end")); - } - -// End of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/homesyncwizard/src/cmsselectionstorage.cpp --- a/homesync/contentmanager/homesyncwizard/src/cmsselectionstorage.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,454 +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: Implementation of setup wizard selection storage -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include - -#include "cmsettingsfactory.h" -#include "cmmediaserverfull.h" -#include "cmdriveinfo.h" -#include "cmsettings.h" -#include "cmsselectionstorage.h" -#include "msengine.h" -#include "cmstorerulecontainer.h" -#include "cmfillrulecontainer.h" -#include "cmstorerule.h" -#include "cmfillrule.h" -#include "msconstants.h" -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::NewL -// -------------------------------------------------------------------------- -// -CMSSelectionStorage* CMSSelectionStorage::NewL( - CMSEngine& aMSEngine, - RPointerArray& aServers, - RFs& aFs ) - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::NewL")); - - CMSSelectionStorage* self = CMSSelectionStorage::NewLC( aMSEngine, - aServers, - aFs ); - - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::NewLC -// -------------------------------------------------------------------------- -// -CMSSelectionStorage* CMSSelectionStorage::NewLC( - CMSEngine& aMSEngine, - RPointerArray& aServers, - RFs& aFs ) - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::NewLC")); - - CMSSelectionStorage* self = new (ELeave) CMSSelectionStorage( aMSEngine, - aServers, - aFs ); - CleanupStack::PushL(self); - self->ConstructL( ); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::CMSSelectionStorage -// -------------------------------------------------------------------------- -// -CMSSelectionStorage::CMSSelectionStorage( - CMSEngine& aMSEngine, - RPointerArray& aServers, - RFs& aFs ) : - iMSEngine( aMSEngine ), iServers( aServers ), iFs( aFs ) - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::CMSSelectionStorage")); - - // remove fill & store usage flag from every server - for ( TInt i = 0; i < iServers.Count(); i++ ) - { - CCmMediaServerFull* server = iServers[i]; - server->SetStoreUsage( EFalse ); - server->SetStoreUsage( EFalse ); - server->SetIsActive( EFalse ); - } - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::ConstructL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::ConstructL() - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::ConstructL")); - - iStoreRules = iMSEngine.StoreRulesL(); - iFillRules = iMSEngine.FillRulesL(); - iServiceState = ETrue; // default: manual sync - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::~CMSSelectionStorage -// -------------------------------------------------------------------------- -// -CMSSelectionStorage::~CMSSelectionStorage() - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::~CMSSelectionStorage")); - - delete iSelectedFillLists; - delete iSelectedStoreLists; - delete iStoreRules; - delete iFillRules; - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::StoreMSSettingsL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::StoreMSSettingsL() - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::StoreMSSettingsL begins")); - - // Set store rules - iMSEngine.SetStoreRulesL( iStoreRules ); - - // Set fill rules - iMSEngine.SetFillRulesL( iFillRules ); - - // Set syncrhronization state - - // if ETrue -> MANUAL mode - // if EFalse -> AUTOMATIC mode - if( iServiceState ) - { - iMSEngine.SetServiceState( ECmServiceContentManager, - ECmServiceStateDisabled ); - } - else - { - iMSEngine.SetServiceState( ECmServiceContentManager, - ECmServiceStateAutomatic ); - // Set wlan scanning on if AUTOMATIC mode - SetWlanScanL(); - } - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::StoreMSSettingsL ends")); - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetWlanScanL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetWlanScanL() - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::SetWlanScanL")); - - // open commsdb - CCommsDatabase* commsDb = CCommsDatabase::NewL(); - CleanupStack::PushL( commsDb ); -#ifndef __WINS__ - // open wlan table - CCommsDbTableView* view = commsDb->OpenViewMatchingUintLC - ( - TPtrC( WLAN_DEVICE_SETTINGS ), - TPtrC( WLAN_DEVICE_SETTINGS_TYPE ), KWlanUserSettings - ); - - User::LeaveIfError( view->GotoFirstRecord() ); - User::LeaveIfError( view->UpdateRecord() ); - - // set scan interval - view->WriteUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), - KWlanScanNetworkInterval60 ); - User::LeaveIfError( view->PutRecordChanges() ); - - CleanupStack::PopAndDestroy( view ); -#endif - CleanupStack::PopAndDestroy( commsDb ); - -#ifndef __WINS__ - CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL(); - CleanupStack::PushL( wlanMgmtClient ); - // notify about changes - wlanMgmtClient->NotifyChangedSettings(); - CleanupStack::PopAndDestroy( wlanMgmtClient ); - #endif - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetServersForFillRulesL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetServersForFillRulesL( - CArrayFix& aSelectedIndexes) - { - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::SetServersForFillRulesL ")); - - // set server activity anyway - for ( TInt idx = 0; idx < aSelectedIndexes.Count(); idx++ ) - { - CCmMediaServerFull* server = iServers[aSelectedIndexes.At(idx)]; - server->SetFillUsage( ETrue ); - server->SetIsActive( ETrue ); - } - - // Get fill list count - TInt fillrulecount = iFillRules->FillRuleCount(); - - // remove all servers from store lists and set unselected - for ( TInt index = 0; index < fillrulecount; index++ ) - { - CCmFillRule* rule = iFillRules->FillRule( index ); - // remove list selection - rule->SetSelected( ECmUnSelected ); - // remove servers - RemoveServersFromFillRuleL( rule ); - } - - // set selected servers for selected lists - for( TInt i=0; iCount(); i++ ) - { - TInt index = (*iSelectedFillLists)[i]; - CCmFillRule* rule = iFillRules->FillRule(index); - rule->SetSelected( ECmSelected ); - - SetServersForFillRuleL( rule, aSelectedIndexes ); - } - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetServersForFillRuleL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetServersForFillRuleL( CCmFillRule* aRule, - CArrayFix& aSelectedIndexes ) - { - LOG(_L("[MSAppWizard]\t SetServersForFillRuleL")); - TInt ruleServerCount = aRule->MediaServerCount(); - - for ( TInt iy = 0; iy < aSelectedIndexes.Count(); iy++ ) - { - CCmMediaServerFull* server = iServers[aSelectedIndexes.At(iy)]; - - TPtrC8 serverUDN = server->MediaServer(); - aRule->AddMediaServerL( serverUDN ); - server->SetIsActive( KServerActive ); - } - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetServersForStoreRulesL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetServersForStoreRulesL( - CArrayFix& aSelectedIndexes, - RPointerArray& aServers ) - { - - // set server activity anyway - for ( TInt idx = 0; idx < aSelectedIndexes.Count(); idx++ ) - { - CCmMediaServerFull* server = aServers[aSelectedIndexes.At(idx)]; - server->SetStoreUsage( ETrue ); - server->SetIsActive( ETrue ); - } - - // remove all servers from store lists and set unselected - for ( TInt index = 0; index < iStoreRules->StoreRuleCount(); index++ ) - { - CCmStoreRule* rule = iStoreRules->StoreRule( index ); - // remove list selection - rule->SetSelected( ECmUnSelected ); - RemoveServersFromStoreRuleL( rule ); - } - - // set selected servers for selected lists - for ( TInt i = 0; i < iSelectedStoreLists->Count(); i++ ) - { - TInt selectionValue = iSelectedStoreLists->At( i ); - - CCmStoreRule* rule = iStoreRules->StoreRule( selectionValue ); - rule->SetSelected( ECmSelected ); - //...and set selected servers to list - SetServersForStoreRuleL( rule, aSelectedIndexes, aServers ); - } - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetServersForStoreRuleL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetServersForStoreRuleL( - CCmStoreRule* aRule, - CArrayFix& aSelectedIndexes, - RPointerArray& aServers ) - { - LOG(_L("[MSAppWizard]\t SetServersForStoreRuleL")); - - for ( TInt iy = 0; iy < aSelectedIndexes.Count(); iy++ ) - { - CCmMediaServerFull* server = aServers[aSelectedIndexes.At(iy)]; - TPtrC8 serverUDN = server->MediaServer(); - aRule->AddMediaServerL( serverUDN ); - server->SetIsActive( KServerActive ); - } - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::RemoveServersFromFillRuleL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::RemoveServersFromFillRuleL( CCmFillRule* aRule ) - { - //Remove old servers from the rule - LOG(_L("[MSAppWizard]\t RemoveServersFromFillRuleL")); - TInt ruleServerCount = aRule->MediaServerCount(); - for ( TInt index = ruleServerCount-1; index >= 0; index-- ) - { - const TDesC8& ruleServerUDN = aRule->MediaServerL( index ); - aRule->DeleteMediaServer( ruleServerUDN ); - } - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::RemoveServersFromStoreRuleL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::RemoveServersFromStoreRuleL( CCmStoreRule* aRule ) - { - //Remove old servers from the rule - LOG(_L("[MSAppWizard]\t RemoveServersFromStoreRuleL")); - TInt ruleServerCount = aRule->MediaServerCount(); - for ( TInt index = ruleServerCount-1; index >= 0; index-- ) - { - const TDesC8& ruleServerUDN = aRule->MediaServerL( index ); - aRule->DeleteMediaServer( ruleServerUDN ); - } - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetStoreListSelections -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetStoreListSelections( CArrayFix& aSelections ) - { - if ( iSelectedStoreLists ) - { - delete iSelectedStoreLists; - iSelectedStoreLists = NULL; - } - - iSelectedStoreLists = &aSelections; - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::ClearStoreListSelections -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::ClearStoreListSelections() - { - iSelectedStoreLists->Reset(); - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetFillListSelections -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetFillListSelections( - CArrayFix& aSelections ) - { - if ( iSelectedFillLists ) - { - delete iSelectedFillLists; - iSelectedFillLists = NULL; - } - - iSelectedFillLists = &aSelections; - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetAutoManualSelection -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetAutoManualSelection( TBool aSelection ) - { - iServiceState = aSelection; - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::AutoManualSelection -// -------------------------------------------------------------------------- -// -TBool CMSSelectionStorage::AutoManualSelection() - { - return iServiceState; - } - -// -------------------------------------------------------------------------- -// CMSSelectionStorage::SetDriveInformationL -// -------------------------------------------------------------------------- -// -void CMSSelectionStorage::SetDriveInformationL() - { - LOG(_L("[MSAppWizard]\t SetDriveInformationL")); - - MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC(); - RPointerArray driveArray; - CleanupClosePushL( driveArray ); - - settings->DriveListL( iFs, driveArray ); - - TInt64 quota(0); - - for ( TInt i = 0; i < driveArray.Count(); i++ ) - { - if ( driveArray[i]->DriveType() == DriveInfo::EDriveRemovable ) - { - // mmc - quota = ( driveArray[i]->DriveSize() * KMMCDefaultQuota ) / 100; - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::\ - SetDriveInformationL memory card quota set")); - } - else - { - // internal hd - quota = ( driveArray[i]->DriveSize() * KHDDefaultQuota ) / 100; - LOG(_L("[MSAppWizard]\t CMSSelectionStorage::\ - SetDriveInformationL mass memory quota set")); - } - - // set quota - driveArray[i]->SetDriveQuota( quota ); - } - - - iMSEngine.SetDrivesL( driveArray ); - driveArray.ResetAndDestroy(); - CleanupStack::PopAndDestroy( &driveArray ); - settings->Close(); - CleanupStack::Pop(); // settings - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/aif/qgn_mserv_app_context_icon.svg --- a/homesync/contentmanager/mediaservant/aif/qgn_mserv_app_context_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/bwins/msengineu.def --- a/homesync/contentmanager/mediaservant/applicationengine/bwins/msengineu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -EXPORTS - ?DeleteDeletedMediaserversL@CMSEngine@@QAEXXZ @ 1 NONAME ; void CMSEngine::DeleteDeletedMediaserversL(void) - ?DeleteFilledFilesL@CMSEngine@@QAEHXZ @ 2 NONAME ; int CMSEngine::DeleteFilledFilesL(void) - ?DeleteMetadataL@CMSEngine@@QBEXXZ @ 3 NONAME ; void CMSEngine::DeleteMetadataL(void) const - ?DriveSelectionStatus@CMSEngine@@QAEHXZ @ 4 NONAME ; int CMSEngine::DriveSelectionStatus(void) - ?ExecuteFillPreProcessingL@CMSEngine@@QAEHXZ @ 5 NONAME ; int CMSEngine::ExecuteFillPreProcessingL(void) - ?ExecuteStorePreProcessingL@CMSEngine@@QAEHXZ @ 6 NONAME ; int CMSEngine::ExecuteStorePreProcessingL(void) - ?ExecuteSyncL@CMSEngine@@QAEHXZ @ 7 NONAME ; int CMSEngine::ExecuteSyncL(void) - ?FillRulesL@CMSEngine@@QAEPAVCCmFillRuleContainer@@XZ @ 8 NONAME ; class CCmFillRuleContainer * CMSEngine::FillRulesL(void) - ?GetAppWizardState@CMSEngine@@QAEHAAH@Z @ 9 NONAME ; int CMSEngine::GetAppWizardState(int &) - ?GetDrivesL@CMSEngine@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 10 NONAME ; void CMSEngine::GetDrivesL(class RPointerArray &) - ?GetFillListItemsL@CMSEngine@@QAEPAV?$RPointerArray@VCCmBaseListItem@@@@AAVTDesC8@@@Z @ 11 NONAME ; class RPointerArray * CMSEngine::GetFillListItemsL(class TDesC8 &) - ?GetFilteredMetadataL@CMSEngine@@QAEXAAPAVCCmSqlPropertyCollector@@@Z @ 12 NONAME ; void CMSEngine::GetFilteredMetadataL(class CCmSqlPropertyCollector * &) - ?GetItemCountsL@CMSEngine@@QBEHW4TCmService@@ABVTDesC8@@AAHAA_J@Z @ 13 NONAME ; int CMSEngine::GetItemCountsL(enum TCmService, class TDesC8 const &, int &, long long &) const - ?GetMediaServersL@CMSEngine@@QAEPAV?$RPointerArray@VCCmMediaServerFull@@@@XZ @ 14 NONAME ; class RPointerArray * CMSEngine::GetMediaServersL(void) - ?GetStoreListItemsL@CMSEngine@@QAEPAV?$RPointerArray@VCCmBaseListItem@@@@AAVTDesC8@@@Z @ 15 NONAME ; class RPointerArray * CMSEngine::GetStoreListItemsL(class TDesC8 &) - ?GetTransferInfo@CMSEngine@@QBEXW4TCmService@@AAH1@Z @ 16 NONAME ; void CMSEngine::GetTransferInfo(enum TCmService, int &, int &) const - ?LastSyncTime@CMSEngine@@QBE?AVTTime@@XZ @ 17 NONAME ; class TTime CMSEngine::LastSyncTime(void) const - ?NewL@CMSEngine@@SAPAV1@XZ @ 18 NONAME ; class CMSEngine * CMSEngine::NewL(void) - ?NewLC@CMSEngine@@SAPAV1@XZ @ 19 NONAME ; class CMSEngine * CMSEngine::NewLC(void) - ?PreProcessFillListL@CMSEngine@@QBEHABVTDesC8@@@Z @ 20 NONAME ; int CMSEngine::PreProcessFillListL(class TDesC8 const &) const - ?ScanMediaServersL@CMSEngine@@QAEHXZ @ 21 NONAME ; int CMSEngine::ScanMediaServersL(void) - ?ServerState@CMSEngine@@QAEXAAW4TCmServerState@@@Z @ 22 NONAME ; void CMSEngine::ServerState(enum TCmServerState &) - ?ServiceState@CMSEngine@@QAE?AW4TCmServiceState@@W4TCmService@@@Z @ 23 NONAME ; enum TCmServiceState CMSEngine::ServiceState(enum TCmService) - ?SetAppWizardState@CMSEngine@@QAEHXZ @ 24 NONAME ; int CMSEngine::SetAppWizardState(void) - ?SetDrivesL@CMSEngine@@QAEXV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 25 NONAME ; void CMSEngine::SetDrivesL(class RPointerArray) - ?SetFillFileStatusesL@CMSEngine@@QAEXPBV?$RPointerArray@VCCmBaseListItem@@@@@Z @ 26 NONAME ; void CMSEngine::SetFillFileStatusesL(class RPointerArray const *) - ?SetFillRulesL@CMSEngine@@QAEXPAVCCmFillRuleContainer@@@Z @ 27 NONAME ; void CMSEngine::SetFillRulesL(class CCmFillRuleContainer *) - ?SetMediaServersL@CMSEngine@@QAEHAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 28 NONAME ; int CMSEngine::SetMediaServersL(class RPointerArray &) - ?SetObserver@CMSEngine@@QAEXPAVMMSEngineObserver@@@Z @ 29 NONAME ; void CMSEngine::SetObserver(class MMSEngineObserver *) - ?SetObserver@CMSEngineAO@@QAEXPAVMMSEngineObserver@@@Z @ 30 NONAME ; void CMSEngineAO::SetObserver(class MMSEngineObserver *) - ?SetServiceState@CMSEngine@@QAEHW4TCmService@@W4TCmServiceState@@@Z @ 31 NONAME ; int CMSEngine::SetServiceState(enum TCmService, enum TCmServiceState) - ?SetStoreRulesL@CMSEngine@@QAEXPAVCCmStoreRuleContainer@@@Z @ 32 NONAME ; void CMSEngine::SetStoreRulesL(class CCmStoreRuleContainer *) - ?StopOperation@CMSEngine@@QAEXXZ @ 33 NONAME ; void CMSEngine::StopOperation(void) - ?StoreRulesL@CMSEngine@@QAEPAVCCmStoreRuleContainer@@XZ @ 34 NONAME ; class CCmStoreRuleContainer * CMSEngine::StoreRulesL(void) - ?UpdateFillListsL@CMSEngine@@QBEXXZ @ 35 NONAME ; void CMSEngine::UpdateFillListsL(void) const - ?GetFilledFilesSize@CMSEngine@@QAEXAA_JH@Z @ 36 NONAME ; void CMSEngine::GetFilledFilesSize(long long &, int) - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/eabi/msengineu.def --- a/homesync/contentmanager/mediaservant/applicationengine/eabi/msengineu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -EXPORTS - _ZN9CMSEngine10FillRulesLEv @ 1 NONAME - _ZN9CMSEngine10GetDrivesLER13RPointerArrayI12CCmDriveInfoE @ 2 NONAME - _ZN9CMSEngine10SetDrivesLE13RPointerArrayI12CCmDriveInfoE @ 3 NONAME - _ZN9CMSEngine11ServerStateER14TCmServerState @ 4 NONAME - _ZN9CMSEngine11SetObserverEP17MMSEngineObserver @ 5 NONAME - _ZN9CMSEngine11StoreRulesLEv @ 6 NONAME - _ZN9CMSEngine12ExecuteSyncLEv @ 7 NONAME - _ZN9CMSEngine12ServiceStateE10TCmService @ 8 NONAME - _ZN9CMSEngine13SetFillRulesLEP20CCmFillRuleContainer @ 9 NONAME - _ZN9CMSEngine13StopOperationEv @ 10 NONAME - _ZN9CMSEngine14SetStoreRulesLEP21CCmStoreRuleContainer @ 11 NONAME - _ZN9CMSEngine15SetServiceStateE10TCmService15TCmServiceState @ 12 NONAME - _ZN9CMSEngine16GetMediaServersLEv @ 13 NONAME - _ZN9CMSEngine16SetMediaServersLER13RPointerArrayI18CCmMediaServerFullE @ 14 NONAME - _ZN9CMSEngine17GetAppWizardStateERi @ 15 NONAME - _ZN9CMSEngine17GetFillListItemsLER6TDesC8 @ 16 NONAME - _ZN9CMSEngine17ScanMediaServersLEv @ 17 NONAME - _ZN9CMSEngine17SetAppWizardStateEv @ 18 NONAME - _ZN9CMSEngine18DeleteFilledFilesLEv @ 19 NONAME - _ZN9CMSEngine18GetStoreListItemsLER6TDesC8 @ 20 NONAME - _ZN9CMSEngine20DriveSelectionStatusEv @ 21 NONAME - _ZN9CMSEngine20GetFilteredMetadataLERP23CCmSqlPropertyCollector @ 22 NONAME - _ZN9CMSEngine20SetFillFileStatusesLEPK13RPointerArrayI15CCmBaseListItemE @ 23 NONAME - _ZN9CMSEngine25ExecuteFillPreProcessingLEv @ 24 NONAME - _ZN9CMSEngine26DeleteDeletedMediaserversLEv @ 25 NONAME - _ZN9CMSEngine26ExecuteStorePreProcessingLEv @ 26 NONAME - _ZN9CMSEngine4NewLEv @ 27 NONAME - _ZN9CMSEngine5NewLCEv @ 28 NONAME - _ZNK9CMSEngine12LastSyncTimeEv @ 29 NONAME - _ZNK9CMSEngine14GetItemCountsLE10TCmServiceRK6TDesC8RiRx @ 30 NONAME - _ZNK9CMSEngine15DeleteMetadataLEv @ 31 NONAME - _ZNK9CMSEngine15GetTransferInfoE10TCmServiceRiS1_ @ 32 NONAME - _ZNK9CMSEngine16UpdateFillListsLEv @ 33 NONAME - _ZNK9CMSEngine19PreProcessFillListLERK6TDesC8 @ 34 NONAME - _ZTI9CMSEngine @ 35 NONAME ; ## - _ZTV9CMSEngine @ 36 NONAME ; ## - _ZN9CMSEngine18GetFilledFilesSizeERxi @ 37 NONAME - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/group/bld.inf --- a/homesync/contentmanager/mediaservant/applicationengine/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 information file for project Application Engine -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../inc/msengine.h |../../../../../inc/msengine.h -../inc/msengineobserver.h |../../../../../inc/msengineobserver.h - -PRJ_MMPFILES -msengine.mmp - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/group/msengine.mmp --- a/homesync/contentmanager/mediaservant/applicationengine/group/msengine.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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 project Application Engine -* -*/ - - -#include - -TARGET MSEngine.dll -TARGETTYPE dll -UID 0x1000008d 0x1028290C - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -USERINCLUDE ../inc -USERINCLUDE ../../../../group - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -SOURCEPATH ../src -SOURCE msengine.cpp -SOURCE msengineao.cpp - -LIBRARY euser.lib -LIBRARY cmclient.lib - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/inc/msengine.h --- a/homesync/contentmanager/mediaservant/applicationengine/inc/msengine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,421 +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: file sharing engine class definition -* -*/ - - - -#ifndef __MSENGINE_H__ -#define __MSENGINE_H__ - - -// Include Files -#include -#include "contentmanager.h" -#include "cmbaselistitem.h" - -// FORWARD DECLARATIONS -class CMSEngineAO; -class MMSEngineObserver; -class CCmBaseListitem; -class CCmSqlPropertyCollector; - -// CLASS DECLARATION - -/** - * Media Servant engine class for Media Servant application - * - * @lib msengine.lib - * - * @since S60 5.1 - */ -class CMSEngine : public CBase - { -public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CMSEngine* NewL(); - - /** - * Two-phased constructor. - */ - IMPORT_C static CMSEngine* NewLC(); - - /** - * Destructor. - */ - virtual ~CMSEngine(); - - /** - * Scans media servers on the network - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - IMPORT_C TInt ScanMediaServersL(); - - /** - * Start store & fill operations - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - IMPORT_C TInt ExecuteSyncL(); - - /** - * Preprocesses files - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - IMPORT_C TInt ExecuteStorePreProcessingL(); - - /** - * Preprocesses files - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - IMPORT_C TInt ExecuteFillPreProcessingL(); - - /** - * Cancels current operation - * - * @since S60 5.1 - * @param None - * @return None - */ - IMPORT_C void StopOperation(); - - /** - * Sets observer for active object - * - * @since S60 5.1 - * @param MMSEngineObserver*, observer class - * @return None - */ - IMPORT_C void SetObserver( MMSEngineObserver* aObserver ); - - /** - * Gets fill rules - * - * @since S60 5.1 - * @param None - * @return pointer to fill rule container object - */ - IMPORT_C CCmFillRuleContainer* FillRulesL(); - /** - * Get filled files size - * @since S60 5.1 - * @param aSize reference to filled files size - * @param aID id of fill rule - */ - IMPORT_C void GetFilledFilesSize( TInt64& aSize, const TInt aID ); - - /** - * Sets Fill rules - * - * @since S60 5.1 - * @param aFillRules reference to fill rule container object - * @return None - */ - IMPORT_C void SetFillRulesL( CCmFillRuleContainer* aFillRules ); - - /** - * Gets store rules - * - * @since S60 5.1 - * @param None - * @return pointer to store rule container object - */ - IMPORT_C CCmStoreRuleContainer* StoreRulesL(); - - /** - * Sets Store rules - * - * @since S60 5.1 - * @param aStoreRules reference to store rule container object - * @return None - */ - IMPORT_C void SetStoreRulesL( CCmStoreRuleContainer* aStoreRules ); - - /** - * Reads server state - * - * @since S60 5.1 - * @param aState, server state - * @return None - */ - IMPORT_C void ServerState( TCmServerState& aState ); - - /** - * Gets service state - * - * @since S60 5.1 - * @param aService, service type - * @return TCmServiceState, service state - */ - IMPORT_C TCmServiceState ServiceState( const TCmService aService ); - - /** - * Sets service state - * - * @since S60 5.1 - * - * @param aService, service type - * @param aState, service state - * @return TInt, error - */ - IMPORT_C TInt SetServiceState( const TCmService aService, - TCmServiceState aState ); - - /** - * Gets media servers - * - * @since S60 5.1 - * @param None - * @return RPointerArray*, mediaservers - */ - IMPORT_C RPointerArray* GetMediaServersL(); - - /** - * Sets media servers - * - * @since S60 5.1 - * @param aMediaServers, mediaservers - * @return KErrNone if successfull - */ - IMPORT_C TInt SetMediaServersL( - RPointerArray& aMediaServers ); - - /** - * Deletes filled files - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - IMPORT_C TInt DeleteFilledFilesL(); - - /** - * Gets store list items - * - * @since S60 5.1 - * @param aRuleName, name of the rule. - * @return RPointerArray*, store list items - */ - IMPORT_C RPointerArray* GetStoreListItemsL( - TDesC8& aRuleName); - - /** - * Gets fill list items - * - * @since S60 5.1 - * @param aRuleName, name of the rule. - * @return RPointerArray*, fill list items - */ - IMPORT_C RPointerArray* GetFillListItemsL( - TDesC8& aRuleName); - - /** - * Returns item count for a list of a service (fill or store) - * - * @since S60 5.1 - * @param aService defines the service - * @param aListName list name - * @param aCount, item count - * @param aSize, size in MBs - * @return item count (fill case in bytes, store case number of items) - */ - IMPORT_C TInt GetItemCountsL( const TCmService aService, - const TDesC8& aListName, - TInt& aCount, - TInt64& aSize ) const; - - /** - * Preprocesses a fill list - * - * @since S60 5.1 - * @param aListName, list name to be preprocessed - * @return TInt, error code - */ - IMPORT_C TInt PreProcessFillListL( const TDesC8& aListName ) const; - - /** - * Updates fill lists - * - * @since S60 5.1 - * @param None - * @return None - */ - IMPORT_C void UpdateFillListsL() const; - - /** - * Deletes metadata collected from given servers - * - * @since S60 5.1 - * @param None - * @return None - */ - IMPORT_C void DeleteMetadataL() const; - - /** - * Gets app wizard state information. - * - * @since S60 5.1 - * @param aErrorCode defines operation success information - * @return ETrue if application wizard first run has been executed. - */ - IMPORT_C TBool GetAppWizardState( TInt& aErrorCode ); - - /** - * Sets app wizard state information. - * - * @since S60 5.1 - * @param None - * @return KErrNone if successfull. - */ - IMPORT_C TInt SetAppWizardState(); - - /** - * Gets last sync time - * - * @since S60 5.1 - * @param None - * @return last sync time - */ - IMPORT_C TTime LastSyncTime() const; - - /** - * Sets fill file statuses - * - * @since S60 5.1 - * @param aItems reference to item array containing statuses - * @return None - */ - IMPORT_C void SetFillFileStatusesL( - const RPointerArray* aItems ); - - /** - * Get transfer item count and time for a service - * - * @since S60 5.1 - * @param aService defines the service - * @param aItemCount returns count - * @param aTimeInSec returns time - * @return None - */ - IMPORT_C void GetTransferInfo( const TCmService aService, - TInt& aItemCount, - TInt& aTimeInSec ) const; - - /** - * Deletes media servers from db ( servers with deleted status ) - * - * @since S60 5.1 - * @param None - * @return None - */ - IMPORT_C void DeleteDeletedMediaserversL(); - - /** - * Sets drives - * - * @since S60 5.1 - * @param aDrives, drive info array - * @return None - */ - IMPORT_C void SetDrivesL( RPointerArray aDrives ); - - /** - * Gets drives - * - * @since S60 5.1 - * @param aDrives, drives on return - * @return None - */ - IMPORT_C void GetDrivesL( RPointerArray& aDrives ); - - /** - * Gets drive selection info - * - * @since S60 5.1 - * @param None - * @return TBool, ETrue if drive(s) selected, EFalse otherwise - */ - IMPORT_C TBool DriveSelectionStatus(); - - /** - * Gets metadata - * - * @since S60 5.1 - * @param aCollector, group of metadata categories - * @return None - */ - IMPORT_C void GetFilteredMetadataL( - CCmSqlPropertyCollector*& aCollector ); - -private: - - /** - * Opens Content Manager session - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt OpenServerSession(); - - /** - * Closes Content Manager session - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt CloseServerSession(); - - /** - * Performs the first phase of two phase construction. - */ - CMSEngine(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -private: - - /** - * Active object for asynchronous file sharing - */ - CMSEngineAO* iAO; // owned - /** - * mediaserver session handle - */ - RContentManager iCMServer; // owned - }; - -#endif // __MSENGINE_H__ - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/inc/msengineao.h --- a/homesync/contentmanager/mediaservant/applicationengine/inc/msengineao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +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: file sharing engine active object class definition -* -*/ - - - -#ifndef __MSENGINEAO_H__ -#define __MSENGINEAO_H__ - - -// Include Files -#include "contentmanager.h" - -// FORWARD DECLARATIONS -class CMSEngine; -class MMSEngineObserver; - - -// CLASS DECLARATION -/** - * Active object class for MSEngine - * - * @lib msengine.lib - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSEngineAO ): public CActive - { -private: - // Active object states - enum TMSEngineAOState - { - EMSEngineStateNone = 0, - EMSEngineHarvest, - EMSEngineFill, - EMSEngineStore, - EMSEngineDeleteFiles, - EMSEnginePreprocess, - EMSEngineGetMetadata, - EMSEnginePreprocessList, - EMSEngineDeleteMetadata, - EMSUpdateFillLists - }; - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param CMSEngine*, pointer to mediaservant engine. - * @return 5.1 - */ - static CMSEngineAO* NewL( CMSEngine* aEngine ); - - /** - * Destructor. - */ - virtual ~CMSEngineAO(); - - /** - * Scans media Servers - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt ScanMediaServersL(); - - /** - * Start fill operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void ExecuteFillL(); - - /** - * Start store operation - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - TInt ExecuteStoreL(); - - /** - * Sets observer for active object - * - * @since S60 5.1 - * @param MMSEngineObserver*, pointer to the observer object. - * @return None - */ - IMPORT_C void SetObserver(MMSEngineObserver* aObserver); - - /** - * Cancels current operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void StopOperation(); - - /** - * Informs server that application is shutting down - * - * @since S60 5.1 - * @param None - * @return None - */ - void ApplicationExit(); - - /** - * Deletes filled files - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - TInt DeleteFilledFilesL(); - - /** - * Preprocesses file information for store. - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt ExecuteStorePreProcessingL(); - - /** - * Preprocesses file information for fill. - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt ExecuteFillPreProcessingL(); - - /** - * Gets metadata - * - * @since S60 5.1 - * @param aCollector, group of metadata categories - * @return None - */ - void GetFilteredMetadataL( CCmSqlPropertyCollector*& aCollector ); - - /** - * Preprocesses one fill list. - * - * @since S60 5.1 - * @param aListName, list name to be preprocessed - * @return TInt, error code - */ - TInt PreProcessFillListL( const TDesC8& aListName ); - - /** - * Update fill lists. - * - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateFillListsL(); - - /** - * Deletes metadata collected from given servers. - * - * @since S60 5.1 - * @param aServerList, list of servers - * @return None - */ - void DeleteMetadataL(); - -protected: - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - virtual void RunL(); - - /** - * From CActive - * See base class definition - */ - virtual void DoCancel(); - -private: - - /** - * C++ default constructor. - * @param aEngine*, pointer to mediaservant engine - */ - CMSEngineAO( CMSEngine* aEngine ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Opens Content Manager session - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - TInt OpenServerSession(); - - /** - * Closes Content Manager session - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - TInt CloseServerSession(); - -private: - - /** - * file sharing engine pointer - */ - CMSEngine* iEngine; // not owned - - /** - * mediaserver session handle - */ - RContentManager iContentManager; // owned - - /** - * engine observer - */ - MMSEngineObserver* iObserver; // not owned - - /** - * current operation - */ - TCmService iCurrentService; - - /** - * Active object state - */ - TMSEngineAOState iState; - }; - -#endif // __MSENGINEAO_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/inc/msengineobserver.h --- a/homesync/contentmanager/mediaservant/applicationengine/inc/msengineobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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: Observer class definition -* -*/ - - -#ifndef __MSENGINEOBSERVER_H__ -#define __MSENGINEOBSERVER_H__ - -// INCLUDE FILES -#include -#include "cmcommon.h" - -/** - * File sharing observer definition - * - * @lib msengine.lib - * - * @since S60 5.1 - */ -class MMSEngineObserver - { - public: - /** - * Function informs when process is ready - * - * @since S60 5.1 - * @param aService, completed service - * @param aError, error code - * @return None - */ - virtual void ReadyL( TCmService aService, TInt aError ) = 0; - }; - -#endif //__MSENGINEOBSERVER_H__ - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/src/msengine.cpp --- a/homesync/contentmanager/mediaservant/applicationengine/src/msengine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,550 +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: CUPnPFileSharingEngine class implementation -* -*/ - - - -// Include Files -#include "contentmanager.h" -#include "msengine.h" -#include "msengineao.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSEngine::CMSEngine -// -------------------------------------------------------------------------- -// -CMSEngine::CMSEngine() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::CMSEngine") ); - } - - -// -------------------------------------------------------------------------- -// CMSEngine::NewLC -// -------------------------------------------------------------------------- -// -EXPORT_C CMSEngine* CMSEngine::NewLC() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::NewLC") ); - - CMSEngine* self = new (ELeave) CMSEngine; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CMSEngine::NewL -// -------------------------------------------------------------------------- -// -EXPORT_C CMSEngine* CMSEngine::NewL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::NewL") ); - - CMSEngine* self = CMSEngine::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CMSEngine::ConstructL -// -------------------------------------------------------------------------- -// -void CMSEngine::ConstructL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::ConstructL") ); - - // Open Content manager server - OpenServerSession(); - - // Create active object - iAO = CMSEngineAO::NewL( this ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::~CMSEngine -// -------------------------------------------------------------------------- -// -CMSEngine::~CMSEngine() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::~CMSEngine") ); - - TCmServerState state; - ServerState( state ); - - if ( state != ECmServerStateIdle ) - { - LOG( _L( "[MediaServant]\t CMSEngine::\ - ~CMSEngine cancel operation" ) ); - - // notify server that observer is shutting down - if( iAO ) - { - iAO->ApplicationExit(); - } - } - - // Close Content manager server - CloseServerSession(); - - delete iAO; - } - -// -------------------------------------------------------------------------- -// CMSEngine::ScanMediaServersL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::ScanMediaServersL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::ScanMediaServersL") ); - - TInt error = iAO->ScanMediaServersL(); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::ExecuteSyncL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::ExecuteSyncL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::ExecuteSyncL") ); - - // Fill will be started when store is ready. - TInt error = iAO->ExecuteStoreL(); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::ExecuteStorePreProcessingL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::ExecuteStorePreProcessingL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::ExecuteStorePreProcessingL") ); - - TInt error = iAO->ExecuteStorePreProcessingL(); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::ExecuteFillPreProcessingL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::ExecuteFillPreProcessingL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::ExecuteFillPreProcessingL") ); - - TInt error = iAO->ExecuteFillPreProcessingL(); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetStoreListItemsL -// -------------------------------------------------------------------------- -// -EXPORT_C RPointerArray* CMSEngine::GetStoreListItemsL( - TDesC8& aRuleName) - { - LOG(_L("[MediaServant ENG]\t CMSEngine::GetStoreListItemsL")); - - RPointerArray* storeListItems = NULL; - if ( &iCMServer ) - { - storeListItems = iCMServer.ListItemsL( aRuleName, ECmServiceStore ); - } - - return storeListItems; - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetFillListItemsL -// -------------------------------------------------------------------------- -// -EXPORT_C RPointerArray* CMSEngine::GetFillListItemsL( - TDesC8& aRuleName) - { - LOG(_L("[MediaServant ENG]\t CMSEngine::GetFillListItemsL")); - - RPointerArray* fillListItems = NULL; - - fillListItems = iCMServer.ListItemsL( aRuleName, ECmServiceFill ); - - return fillListItems; - } - -// -------------------------------------------------------------------------- -// CMSEngine::StopOperation -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::StopOperation() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::StopOperation") ); - - iAO->StopOperation(); - } - -// -------------------------------------------------------------------------- -// CMSEngine::FillRulesL -// -------------------------------------------------------------------------- -// -EXPORT_C CCmFillRuleContainer* CMSEngine::FillRulesL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::FillRulesL") ); - - return ( iCMServer.FillRulesL() ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::StoreRulesL -// -------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRuleContainer* CMSEngine::StoreRulesL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::StoreRulesL") ); - - return ( iCMServer.StoreRulesL() ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::SetStoreRulesL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::SetStoreRulesL( CCmStoreRuleContainer* aStoreRules ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::SetStoreRulesL") ); - - iCMServer.SetStoreRulesL( *aStoreRules ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::SetFillRulesL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::SetFillRulesL( CCmFillRuleContainer* aFillRules ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::SetFillRulesL") ); - - iCMServer.SetFillRulesL( *aFillRules ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetFilledFilesSize -// Get filled files size -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::GetFilledFilesSize( TInt64& aSize, const TInt aID ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::GetFilledFilesSize") ); - - iCMServer.GetFilledFilesSize( aSize, aID ); - } - -// CMSEngine::ServerState -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::ServerState( TCmServerState& aState ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::ServerState") ); - - aState = iCMServer.ServerState(); - } - -// ------------------------------------------------------------------------- -// CMSEngine::ServiceState -// -------------------------------------------------------------------------- -EXPORT_C TCmServiceState CMSEngine::ServiceState( const TCmService aService ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::ServiceState") ); - - TCmServiceState state; - - state = iCMServer.ServiceState( aService ); - - return state; - } - -// ------------------------------------------------------------------------- -// CMSEngine::SetServiceState -// -------------------------------------------------------------------------- -EXPORT_C TInt CMSEngine::SetServiceState( const TCmService aService, - TCmServiceState aState ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::SetServiceState") ); - - TInt error = iCMServer.SetServiceState( aService, aState ); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::MediaServersL -// -------------------------------------------------------------------------- -// -EXPORT_C RPointerArray* - CMSEngine::GetMediaServersL() - { - LOG(_L("[MediaServant ENG]\t CMSEngine::GetMediaServersL")); - - return ( iCMServer.MediaserversL() ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::SetMediaServersL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::SetMediaServersL( - RPointerArray& aMediaServers ) - { - - LOG( _L("[MediaServant ENG]\t CMSEngine::SetMediaServersL") ); - - TInt error = iCMServer.SetMediaserversL( aMediaServers ); - - return error; - } - - -// -------------------------------------------------------------------------- -// CMSEngine::DeleteDeletedMediaserversL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::DeleteDeletedMediaserversL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::DeleteDeletedMediaserversL") ); - - iCMServer.DeleteDeletedMediaserversL(); - } - - -// -------------------------------------------------------------------------- -// CMSEngine::DeleteFilledFiles -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::DeleteFilledFilesL() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::DeleteFilledFilesL") ); - - TInt error = iAO->DeleteFilledFilesL(); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetItemCountsL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::GetItemCountsL( const TCmService aService, - const TDesC8& aListName, - TInt& aCount, - TInt64& aSize ) const - { - LOG( _L("[MediaServant ENG]\t CMSEngine::GetItemCountsL") ); - - TInt error = iCMServer.GetItemCountsL( aService, - aListName, - aCount, - aSize ); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetFilteredMetadataL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::GetFilteredMetadataL( - CCmSqlPropertyCollector*& aCollector ) - { - LOG(_L("[MediaServant ENG]\t CMSEngine::GetFilteredMetadataL")); - - iAO->GetFilteredMetadataL( aCollector ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::PreProcessFillList -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::PreProcessFillListL( const TDesC8& aListName ) const - { - LOG( _L("[MediaServant ENG]\t CMSEngine::PreProcessFillList") ); - - TInt error = iAO->PreProcessFillListL( aListName ); - - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::UpdateFillListsL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::UpdateFillListsL() const - { - LOG( _L("[MediaServant ENG]\t CMSEngine::UpdateFillListsL") ); - - iAO->UpdateFillListsL(); - } - -// -------------------------------------------------------------------------- -// CMSEngine::DeleteMetaDataL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::DeleteMetadataL() const - { - LOG( _L("[MediaServant ENG]\t CMSEngine::DeleteMetaDataL") ); - - iAO->DeleteMetadataL(); - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetAppWizardState -// -------------------------------------------------------------------------- -// -EXPORT_C TBool CMSEngine::GetAppWizardState( TInt& /*aErrorCode*/ ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::GetAppWizardState") ); - - TBool retVal = iCMServer.AppWizardState(); - - return retVal; - } - - -// -------------------------------------------------------------------------- -// CMSEngine::SetAppWizardStateL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CMSEngine::SetAppWizardState() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::SetAppWizardState") ); - - TInt retVal = iCMServer.SetAppWizardState(); - - return retVal; - } - -// -------------------------------------------------------------------------- -// CMSEngine::SetObserver -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::SetObserver( MMSEngineObserver* aObserver ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::SetObserver") ); - - iAO->SetObserver( aObserver ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::LastSyncTime -// -------------------------------------------------------------------------- -// -EXPORT_C TTime CMSEngine::LastSyncTime() const - { - LOG( _L("[MediaServant ENG]\t CMSEngine::LastSyncTime") ); - - return ( iCMServer.LastSyncTime() ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::SetFillFileStatusesL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::SetFillFileStatusesL( - const RPointerArray* aItems ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::SetFillFileStatusesL") ); - - iCMServer.SetFillFileStatusesL( *aItems ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetTransferInfo -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::GetTransferInfo( const TCmService aService, - TInt& aItemCount, - TInt& aTimeInSec ) const - { - LOG( _L("[MediaServant ENG]\t CMSEngine::GetTransferInfo") ); - - iCMServer.GetTransferInfo( aService, - aItemCount, - aTimeInSec ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::SetDrivesL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::SetDrivesL( RPointerArray aDrives ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::SetDrivesL") ); - - iCMServer.SetDrivesL( aDrives ); - } - - -// -------------------------------------------------------------------------- -// CMSEngine::GetDrivesL -// -------------------------------------------------------------------------- -// -EXPORT_C void CMSEngine::GetDrivesL( RPointerArray& aDrives ) - { - LOG( _L("[MediaServant ENG]\t CMSEngine::GetDrivesL") ); - - iCMServer.GetDrivesL( aDrives ); - } - -// -------------------------------------------------------------------------- -// CMSEngine::DriveSelectionStatus -// -------------------------------------------------------------------------- -// -EXPORT_C TBool CMSEngine::DriveSelectionStatus() - { - LOG(_L("[MediaServant ENG]\t CMSEngine::DriveSelectionStatus")); - - return iCMServer.DriveSelectionStatus(); - } - -// -------------------------------------------------------------------------- -// CMSEngine::OpenServerSession -// -------------------------------------------------------------------------- -// -TInt CMSEngine::OpenServerSession() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::OpenServerSession") ); - TInt error = iCMServer.Connect(); - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::CloseServerSession -// -------------------------------------------------------------------------- -// -TInt CMSEngine::CloseServerSession() - { - LOG( _L("[MediaServant ENG]\t CMSEngine::CloseServerSession") ); - - return ( iCMServer.Close() ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/applicationengine/src/msengineao.cpp --- a/homesync/contentmanager/mediaservant/applicationengine/src/msengineao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,536 +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: CMSEngineAO class implementation -* -*/ - - - -// Include Files -#include "msengineobserver.h" -#include "msengineao.h" -#include "msengine.h" -#include "msdebug.h" - - -// --------------------------------------------------------------------------- -// CMSEngineAO::CMSEngineAO -// --------------------------------------------------------------------------- -// -CMSEngineAO::CMSEngineAO( CMSEngine* aEngine ) - : CActive( CActive::EPriorityStandard ), - iEngine( aEngine ) - { - LOG( _L( "[MediaServant ENG]\t CMSEngineAO::CMSEngineAO" ) ); - } - - -// --------------------------------------------------------------------------- -// CMSEngineAO::NewL -// --------------------------------------------------------------------------- -// -CMSEngineAO* CMSEngineAO::NewL( CMSEngine* aEngine ) - { - LOG(_L("[MediaServant ENG]\t CMSEngineAO::NewL")); - - CMSEngineAO* self = new ( ELeave ) CMSEngineAO( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMSEngineAO::ConstructL -// --------------------------------------------------------------------------- -// -void CMSEngineAO::ConstructL() - { - LOG( _L("[MediaServant]\t CMSEngineAO::ConstructL") ); - - // Add this active object to the active scheduler. - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::~CMSEngineAO -// --------------------------------------------------------------------------- -// -CMSEngineAO::~CMSEngineAO() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::~CMSEngineAO") ); - - // cancel any ongoing operation - Cancel(); - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::RunL -// --------------------------------------------------------------------------- -// -void CMSEngineAO::RunL() - { - TRACE( Print( _L("[MediaServant ENG]\t CMSEngineAO::RunL \ - iStatus = %d" ), iStatus.Int() ) ); - - switch ( iState ) - { - case EMSEngineStore: - { - // stop if error occurs - if ( iStatus.Int() == KErrNone ) - { - LOG(_L("[MediaServant ENG]\t CMSEngineAO::RunL start store")); - // Store ok, continue by executing fill operation. - ExecuteFillL(); - } - else - { - // Close server session due to error. - CloseServerSession(); - // Inform the observer about error. - iObserver->ReadyL( iCurrentService, iStatus.Int() ); - } - break; - } - case EMSEngineFill: - // fall through - case EMSEngineHarvest: - // fall through - case EMSEngineDeleteFiles: - // fall through - case EMSEnginePreprocess: - // fall through - case EMSEngineGetMetadata: - // fall through - case EMSEnginePreprocessList: - // fall through - case EMSEngineDeleteMetadata: - // fall through - case EMSUpdateFillLists: - { - CloseServerSession(); - // report for application - iObserver->ReadyL( iCurrentService, iStatus.Int() ); - LOG( _L("[MediaServant ENG]\t CMSEngineAO::RunL close session") ); - break; - } - default: - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::RunL \ - not valid state") ); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::DoCancel -// --------------------------------------------------------------------------- -// -void CMSEngineAO::DoCancel() - { - LOG( _L( "[MediaServant ENG]\t CMSEngineAO::DoCancel" ) ); - - iContentManager.Cancel(); - } - - -// --------------------------------------------------------------------------- -// CMSEngineAO::ScanMediaServersL -// --------------------------------------------------------------------------- -// -TInt CMSEngineAO::ScanMediaServersL() - { - LOG( _L( "[MediaServant ENG]\t CMSEngineAO::ScanMediaServersL" ) ); - - // Open content manager session. - TInt error = OpenServerSession(); - - if ( !error ) - { - // Session created. Update state variables and execute service. - iCurrentService = ECmServiceHarvest; - iState = EMSEngineHarvest; - iContentManager.ExecuteService( ECmServiceHarvest, iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - - return error; - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::ExecuteFillL -// --------------------------------------------------------------------------- -// -void CMSEngineAO::ExecuteFillL() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteFillL") ); - - // Update state variables and execute fill service. - iCurrentService = ECmServiceFill; - iState = EMSEngineFill; - iContentManager.ExecuteService( ECmServiceFill, iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::ExecuteStoreL -// --------------------------------------------------------------------------- -// -TInt CMSEngineAO::ExecuteStoreL() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteStoreL") ); - - iCurrentService = ECmServiceStore; - iState = EMSEngineStore; - - // Open content manager session. - TInt error = OpenServerSession(); - - if ( !error ) - { - iContentManager.ExecuteService( ECmServiceStore, iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - - return error; - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::DeleteFilledFilesL() -// --------------------------------------------------------------------------- -// -TInt CMSEngineAO::DeleteFilledFilesL() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::DeleteFilledFilesL") ); - - // Open content manager session. - TInt error = OpenServerSession(); - iState = EMSEngineDeleteFiles; - if ( !error ) - { - // Session created. Update state variables and execute service. - iCurrentService = ECmServiceDeleteFilledFiles; - iState = EMSEngineDeleteFiles; - error = iContentManager.ExecuteService( ECmServiceDeleteFilledFiles, - iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - - return error; - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::ExecuteStorePreProcessingL() -// --------------------------------------------------------------------------- -// -TInt CMSEngineAO::ExecuteStorePreProcessingL() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteStorePreProcessingL") ); - - // Open content manager session. - TInt error = OpenServerSession(); - - if ( !error ) - { - iCurrentService = ECmServicePreProcessingStore; - iState = EMSEnginePreprocess; - error = iContentManager.ExecuteService( ECmServicePreProcessingStore, - iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - return error; - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::ExecuteFillPreProcessingL() -// --------------------------------------------------------------------------- -// -TInt CMSEngineAO::ExecuteFillPreProcessingL() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::ExecuteFillPreProcessingL") ); - - // Open content manager session. - TInt error = OpenServerSession(); - - if ( !error ) - { - iCurrentService = ECmServicePreProcessingFill; - iState = EMSEnginePreprocess; - error = iContentManager.ExecuteService( ECmServicePreProcessingFill, - iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngine::GetFilteredMetadataL -// -------------------------------------------------------------------------- -// -void CMSEngineAO::GetFilteredMetadataL( - CCmSqlPropertyCollector*& aCollector ) - { - LOG(_L("[MediaServant ENG]\t CMSEngine::GetFilteredMetadataL")); - - // Open content manager session. - User::LeaveIfError( OpenServerSession() ); - - iCurrentService = ECmServiceFill; - iState = EMSEngineGetMetadata; - iContentManager.GetFilteredMetadataL( iCurrentService, - aCollector, - iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - -// -------------------------------------------------------------------------- -// CMSEngineAO::PreProcessFillList -// -------------------------------------------------------------------------- -// -TInt CMSEngineAO::PreProcessFillListL( const TDesC8& aListName ) - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::PreProcessFillListL") ); - - // Open content manager session. - TInt error = OpenServerSession(); - - if ( !error ) - { - iCurrentService = ECmServicePreProcessingFilllist; - iState = EMSEnginePreprocessList; - error = iContentManager.PreProcessFillList( aListName, iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - return error; - } - -// -------------------------------------------------------------------------- -// CMSEngineAO::UpdateFillListsL -// -------------------------------------------------------------------------- -// -void CMSEngineAO::UpdateFillListsL() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::UpdateFillListsL") ); - - // Open content manager session. - User::LeaveIfError( OpenServerSession() ); - - iCurrentService = ECmServiceUpdateFillLists; - iState = EMSUpdateFillLists; - iContentManager.UpdateFillListsL( iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - -// -------------------------------------------------------------------------- -// CMSEngineAO::DeleteMetadataL -// -------------------------------------------------------------------------- -// -void CMSEngineAO::DeleteMetadataL() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::DeleteMetadataL") ); - - // Open content manager session. - User::LeaveIfError( OpenServerSession() ); - - iCurrentService = ECmServiceDeleteMetadata; - iState = EMSEngineDeleteMetadata; - iContentManager.DeleteMetadataL( iStatus ); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - else - { - // Enable active object - SetActive(); - } - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::OpenServerSession -// --------------------------------------------------------------------------- -// -TInt CMSEngineAO::OpenServerSession() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::OpenServerSession") ); - - TInt error( KErrInUse ); - // Enable active object - if ( !IsActive() ) - { - error = iContentManager.Connect(); - } - - return error; - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::CloseServerSession -// --------------------------------------------------------------------------- -// -TInt CMSEngineAO::CloseServerSession() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::CloseServerSession") ); - - TInt error = KErrNone; - iContentManager.Close(); - - return error; - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::ApplicationExit -// --------------------------------------------------------------------------- -// -void CMSEngineAO::ApplicationExit() - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::ApplicationExit") ); - - if ( !IsActive() ) - { - OpenServerSession(); - } - iContentManager.ApplicationExit(); - if ( IsActive() || iContentManager.Handle() ) - { - CloseServerSession(); - } - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::StopOperation -// --------------------------------------------------------------------------- -// -void CMSEngineAO::StopOperation() - { - LOG(_L("[MediaServant ENG]\t CMSEngineAO::StopOperation")); - - if ( IsActive() ) - { - LOG(_L("[MediaServant ENG]\t CMSEngineAO::StopOperation active \ - cancelled")); - Cancel(); - } - else - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::StopOperation \ - contentmanager cancelled") ); - // This is used to cancel scheduler initiated operation - // Open server session first - OpenServerSession(); - iContentManager.Cancel(); - } - - LOG( _L("[MediaServant ENG]\t CMSEngineAO::StopOperation Server \ - cancelled") ); - CloseServerSession(); - } - -// --------------------------------------------------------------------------- -// CMSEngineAO::SetObserver -// --------------------------------------------------------------------------- -// -void CMSEngineAO::SetObserver( MMSEngineObserver* aObserver ) - { - LOG( _L("[MediaServant ENG]\t CMSEngineAO::SetObserver") ); - - iObserver = aObserver; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_context_icon.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_context_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_menu_icon.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_app_menu_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_from_home.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_from_home.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_icon.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_context_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_fill_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_fill_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home_inactive.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_from_home_inactive.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_image_list_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_image_list_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music_list_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_music_list_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_images.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_images.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_videos.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_other_videos.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_icon.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_note_icon.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_partial_note_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_images.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_images.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_videos.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_phone_videos.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_check.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_check.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_uncheck.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_red_uncheck.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_removed_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_removed_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_skipped_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_skipped_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_store_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_store_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_from_home.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_from_home.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_full.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_full.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_stop.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_stop.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_to_home.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_sync_to_home.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home_inactive.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_to_home_inactive.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_unavailable_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_unavailable_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_video_list_small.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_video_list_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_check.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_check.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_uncheck.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_white_uncheck.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_check.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_check.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_uncheck.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_mserv_yellow_uncheck.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_audio.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_audio.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_image.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_image.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_video.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_file_video.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_icon_sub.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_icon_sub.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_music.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_music.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_images.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_images.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_videos.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_other_videos.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_images.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_images.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_videos.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_mserv_phone_videos.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/bitmaps/qgn_prop_skipped.svg --- a/homesync/contentmanager/mediaservant/bitmaps/qgn_prop_skipped.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/data/mediaservant.rh --- a/homesync/contentmanager/mediaservant/data/mediaservant.rh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +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: Resource header -* -*/ - - -STRUCT FILL_RULE - { - WORD item; - WORD value; - WORD addinfo; - } - -STRUCT TEMPLATE_ITEMS - { - STRUCT items[]; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/data/mediaservant.rss --- a/homesync/contentmanager/mediaservant/data/mediaservant.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3287 +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: Resource definitions for project MediaServant -* -*/ - - -NAME MESE // 4 letter ID - -#include -#include -#include -#include -#include -#include -#include - -#include -#include "cmcommontypes.h" -#include "mediaservant.rh" -#include "mediaservant.hrh" - -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF { buf="MediaServant"; } - -RESOURCE EIK_APP_INFO - { - } - -//---------------------------------------------------- -// -// r_localisable_app_info -// -//---------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info - { - short_caption = qtn_mserv_title_media_servant; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_mserv_title_media_servant; -#ifdef __SCALABLE_ICONS - number_of_icons = 1; - #ifdef RD_APPS_TO_EXES - icon_file = "\\resource\\apps\\MediaServant_aif.mif"; - #endif //RD_APPS_TO_EXES -#else - #ifdef RD_APPS_TO_EXES - number_of_icons = 2; - icon_file = "\\resource\\apps\\MediaServant_aif.mbm"; - #endif //RD_APPS_TO_EXES -#endif - - }; - } - -//---------------------------------------------------- -// -// r_ms_main_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_main_view - { - menubar = r_ms_menubar_main_view; - // required to define something here but cba will be - // changed dynamically - cba = R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT; - } - -//---------------------------------------------------- -// -// r_ms_fill_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_fill_view - { - menubar = r_ms_menubar_fill_view; - // required to define something here but cba will be - // changed dynamically - cba = R_AVKON_SOFTKEYS_SELECTION_LIST; - } - -//---------------------------------------------------- -// -// r_fill_edit_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_fill_edit_view - { - menubar = r_ms_menubar_fill_edit_view; - cba = r_ms_softkeys_options_done__change; - } - -//---------------------------------------------------- -// -// r_ms_store_list_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_store_list_view - { - menubar = r_ms_menubar_store_list_view; - cba = r_ms_softkeys_options_back__toggle; - } - -//---------------------------------------------------- -// -// r_ms_store_settings_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_store_settings_view - { - menubar = r_ms_menubar_store_settings_view; - cba = r_ms_softkeys_options_done__change; - } - -//---------------------------------------------------- -// -// r_ms_browse_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_browse_view - { - menubar = r_ms_menubar_store_browse_view; - cba = R_AVKON_SOFTKEYS_SELECTION_LIST; - } - -//---------------------------------------------------- -// -// r_ms_fill_browse_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_ms_fill_browse_view - { - menubar = r_ms_menubar_browse_view; - cba = R_AVKON_SOFTKEYS_SELECTION_LIST; - } - -//---------------------------------------------------------------------------- -// -// r_ms_multiselection_dialog -// -//---------------------------------------------------------------------------- - -RESOURCE DIALOG r_ms_multiselection_dialog - { - flags = EAknDialogMultiselectionList; - buttons = r_ms_softkeys_ok_cancel__change; - - items = - { - DLG_LINE - { - type = EAknCtSingleGraphicListBox; - id = EMultiSelectionListBoxId; - control = LISTBOX - { - flags = EAknListBoxMultiselectionList; - }; - }, - DLG_LINE - { - itemflags = EEikDlgItemNonFocusing; - id = EFindControl; - type = EAknCtSelectionListPopupFind; - } - }; - } - -//---------------------------------------------------- -// -// r_ms_menubar_main_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_main_view - { - titles = - { - MENU_TITLE { menu_pane = r_app_menu; }, - MENU_TITLE { menu_pane = r_main_view_menu; } - }; - } - - -//---------------------------------------------------- -// -// r_ms_menubar_fill_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_store_list_view - { - titles = - { - MENU_TITLE { menu_pane = r_app_menu; }, - MENU_TITLE { menu_pane = r_ms_store_list_menu; } - }; - } - -//---------------------------------------------------- -// -// r_ms_menubar_fill_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_fill_view - { - titles = - { - MENU_TITLE { menu_pane = r_app_menu; }, - MENU_TITLE { menu_pane = r_fill_view_menu; } - }; - } - -//---------------------------------------------------- -// -// r_ms_menubar_fill_edit_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_fill_edit_view - { - titles = - { - MENU_TITLE { menu_pane = r_app_menu; }, - MENU_TITLE { menu_pane = r_ms_fill_edit_menu; } - }; - } - -//---------------------------------------------------- -// -// r_ms_menubar_store_settings_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_store_settings_view - { - titles = - { - MENU_TITLE { menu_pane = r_app_menu; }, - MENU_TITLE { menu_pane = r_ms_store_list_edit_menu; } - }; - } - -//---------------------------------------------------- -// -// r_ms_menubar_store_browse_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_store_browse_view - { - titles = - { - MENU_TITLE { menu_pane = r_app_menu; } - }; - } - -//---------------------------------------------------- -// -// r_ms_menubar_browse_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_ms_menubar_browse_view - { - titles = - { - MENU_TITLE { menu_pane = r_app_menu; }, - MENU_TITLE { menu_pane = r_ms_fill_browse_menu; } - }; - } - -//---------------------------------------------------- -// -// r_app_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_app_menu - { - items = - { - MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, - MENU_ITEM { command = EEikCmdExit; txt = qtn_options_exit; } - - }; - } - -//---------------------------------------------------- -// -// r_ms_fill_browse_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_fill_browse_menu - { - items = - { - MENU_ITEM - { - command = EMSCmdLock; - txt = qtn_mserv_options_lock_on_phone; - }, - MENU_ITEM - { - command = EMSCmdUnLock; - txt = qtn_mserv_options_unlock; - }, - MENU_ITEM - { - command = EMSCmdRandomize; - txt = qtn_mserv_options_randomiza; - }, - MENU_ITEM - { - command = EMSCmdMark; - cascade = r_ms_mark_menupane; - txt = qtn_options_list; - } - }; - } - -//---------------------------------------------------- -// -// r_ms_fill_edit_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_fill_edit_menu - { - items = - { - MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; }, - MENU_ITEM - { - command = EMSCmdRemoveRule; - txt = qtn_mserv_options_remove_rule; - } - }; - } - -//---------------------------------------------------- -// -// r_view_main_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_main_view_menu - { - items = - { - MENU_ITEM { command = EMSCmdSelect; txt = qtn_mserv_options_select; }, - MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_open; }, - MENU_ITEM { command = EMSCmdStartHarvest; txt = qtn_mserv_options_refresh; }, - MENU_ITEM { command = EMSCmdStopHarvest; txt = qtn_mserv_options_refresh_stop; }, - MENU_ITEM { command = EMSCmdSettings; txt = qtn_mserv_options_sync_settings; }, - MENU_ITEM { command = EMSCmdRunWizard; txt = qtn_mserv_options_run_wizard; } - }; - } - -//---------------------------------------------------- -// -// r_fill_view_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_fill_view_menu - { - items = - { - MENU_ITEM { command = EMSCmdActivate; txt = qtn_mserv_options_select; }, - MENU_ITEM { command = EMSCmdDeActivate; txt = qtn_mserv_options_unselect; }, - MENU_ITEM { command = EMSCmdEditRule; txt = qtn_mserv_options_edit; }, - MENU_ITEM { command = EMSCmdBrowse; txt = qtn_mserv_options_browse; }, - MENU_ITEM - { - cascade = r_ms_new_list; - command = EAknDummyForProcessCommands; - txt = qtn_mserv_options_new_list; - }, - MENU_ITEM { command = EMSCmdReorder; txt = qtn_mserv_options_reorder; }, - MENU_ITEM { command = EMSCmdDelete; txt = qtn_mserv_options_delete; } - }; - } - -//---------------------------------------------------- -// -// r_ms_new_list -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_new_list - { - items = - { - MENU_ITEM { command = EMSCmdNewImageList; txt = qtn_mserv_options_new_image; }, - MENU_ITEM { command = EMSCmdNewVideoList; txt = qtn_mserv_options_new_video; }, - MENU_ITEM { command = EMSCmdNewMusicList; txt = qtn_mserv_options_new_music; } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_mark_menupane -// Menu for marking -// -//----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_mark_menupane - { - items = - { - MENU_ITEM - { - command = EAknCmdMark; - txt = qtn_options_list_mark_one; - }, - MENU_ITEM - { - command = EAknCmdUnmark; - txt = qtn_options_list_unmark_one; - }, - MENU_ITEM - { - command = EAknMarkAll; - txt = qtn_options_list_mark_all; - }, - MENU_ITEM - { - command = EAknUnmarkAll; - txt = qtn_options_list_unmark_all; - } - }; - } - -//--------------------------------------------------------------------------- -// -// r_ms_store_list_menu -// -//--------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_store_list_menu - { - items = - { - MENU_ITEM - { - command = EMSStoreCmdActivate; - txt = qtn_mserv_options_select; - }, - MENU_ITEM - { - command = EMSStoreCmdDeActivate; - txt = qtn_mserv_options_unselect; - }, - MENU_ITEM - { - command = EMSStoreCmdEdit; - txt = qtn_mserv_options_edit; - }, - MENU_ITEM - { - command = EMSCmdBrowse; - txt = qtn_mserv_options_browse; - } - }; - } - -//---------------------------------------------------- -// -// r_ms_store_list_edit_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_store_list_edit_menu - { - items = - { - MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; } - }; - } - -//---------------------------------------------------- -// -// r_ms_setting_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_ms_setting_menu - { - items = - { - MENU_ITEM { command = EAknCmdOpen; txt = qtn_options_change; } - }; - } - - -RESOURCE LISTBOX r_main_view_listbox - { - flags = EAknListBoxSelectionList; - } - -RESOURCE LISTBOX r_fill_view_listbox - { - flags = EAknListBoxSelectionList; - } - -RESOURCE LISTBOX r_fill_edit_view_listbox - { - flags = EAknListBoxSelectionList; - } - -RESOURCE LISTBOX r_store_list_view_listbox - { - flags = EAknListBoxMultiselectionList; - } - -RESOURCE LISTBOX r_browse_view_listbox - { - flags = EAknListBoxSelectionList | EAknListBoxMarkableList; - } - -/************************** FILL RULE SETTINGS *****************************/ - -//---------------------------------------------------- -// -// r_ms_image_fill_rules -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_ITEM_LIST r_ms_image_fill_rules - { - flags= EAknSettingItemIncludeHiddenInOrdinal; - initial_number = 1; - items = - { - AVKON_SETTING_ITEM - { - identifier = EMSListName; - setting_page_resource = r_ms_fill_rule_list_name_setting_page; - name = qtn_mserv_rule_list_name; - }, - AVKON_SETTING_ITEM - { - identifier = EMSAmount; - setting_page_resource = r_ms_fill_rule_amount_setting_page; - name = qtn_mserv_rule_amount; - }, - AVKON_SETTING_ITEM - { - identifier = EMSStartingWith; - setting_page_resource = r_ms_starting_with_setting_page; - associated_resource = r_ms_starting_with_popup_texts; - name = qtn_mserv_rule_start_with; - }, - AVKON_SETTING_ITEM - { - identifier = EMSShrinkImages; - setting_page_resource = r_ms_shrink_images_setting_page; - associated_resource = r_ms_shrink_images_popup_texts; - name = qtn_mserv_rule_shrink_image; - }, - AVKON_SETTING_ITEM - { - identifier = EMSDateFrom; - setting_page_resource = r_ms_fill_rule_date_from_setting_page; - name = qtn_mserv_rule_from; - }, - AVKON_SETTING_ITEM - { - identifier = EMSDateUntil; - setting_page_resource = r_ms_fill_rule_date_until_setting_page; - name = qtn_mserv_rule_until; - }, - AVKON_SETTING_ITEM - { - identifier = EMSServers; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_storage; - }, - AVKON_SETTING_ITEM - { - identifier = EMSFreeText; - setting_page_resource = r_ms_fill_rule_free_text_setting_page; - name = qtn_mserv_rule_free_text; - }, - AVKON_SETTING_ITEM - { - identifier = EMSAddMoreRules; - setting_page_resource = r_ms_fill_rule_free_text_setting_page; - name = qtn_mserv_rule_add; - } - }; - } - - -//---------------------------------------------------- -// -// r_ms_video_fill_rules -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_ITEM_LIST r_ms_video_fill_rules - { - flags= EAknSettingItemIncludeHiddenInOrdinal; - initial_number = 1; - items = - { - AVKON_SETTING_ITEM - { - identifier = EMSListName; - setting_page_resource = r_ms_fill_rule_list_name_setting_page; - name = qtn_mserv_rule_list_name; - }, - AVKON_SETTING_ITEM - { - identifier = EMSAmount; - setting_page_resource = r_ms_fill_rule_amount_setting_page; - name = qtn_mserv_rule_amount; - }, - AVKON_SETTING_ITEM - { - identifier = EMSStartingWith; - setting_page_resource = r_ms_starting_with_setting_page; - associated_resource = r_ms_starting_with_popup_texts; - name = qtn_mserv_rule_start_with; - }, - AVKON_SETTING_ITEM - { - identifier = EMSTitleName; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_name; - }, - AVKON_SETTING_ITEM - { - identifier = EMSMinFileSize; - setting_page_resource = r_ms_min_file_size_setting_page; - name = qtn_mserv_rule_file_size_min; - }, - AVKON_SETTING_ITEM - { - identifier = EMSMaxFileSize; - setting_page_resource = r_ms_max_file_size_setting_page; - name = qtn_mserv_rule_file_size_max; - }, - AVKON_SETTING_ITEM - { - identifier = EMSDateFrom; - setting_page_resource = r_ms_fill_rule_date_from_setting_page; - name = qtn_mserv_rule_from; - }, - AVKON_SETTING_ITEM - { - identifier = EMSDateUntil; - setting_page_resource = r_ms_fill_rule_date_until_setting_page; - name = qtn_mserv_rule_until; - }, - AVKON_SETTING_ITEM - { - identifier = EMSServers; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_storage; - }, - AVKON_SETTING_ITEM - { - identifier = EMSFreeText; - setting_page_resource = r_ms_fill_rule_free_text_setting_page; - name = qtn_mserv_rule_free_text; - }, - AVKON_SETTING_ITEM - { - identifier = EMSAddMoreRules; - setting_page_resource = r_ms_fill_rule_free_text_setting_page; - name = qtn_mserv_rule_add; - } - }; - } - -//---------------------------------------------------- -// -// r_ms_audio_fill_rules -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_ITEM_LIST r_ms_audio_fill_rules - { - flags= EAknSettingItemIncludeHiddenInOrdinal; - initial_number = 1; - items = - { - AVKON_SETTING_ITEM - { - identifier = EMSListName; - setting_page_resource = r_ms_fill_rule_list_name_setting_page; - name = qtn_mserv_rule_list_name; - }, - AVKON_SETTING_ITEM - { - identifier = EMSAmount; - setting_page_resource = r_ms_fill_rule_amount_setting_page; - name = qtn_mserv_rule_amount; - }, - AVKON_SETTING_ITEM - { - identifier = EMSStartingWith; - setting_page_resource = r_ms_starting_with_setting_page; - associated_resource = r_ms_starting_with_popup_texts; - name = qtn_mserv_rule_start_with; - }, - AVKON_SETTING_ITEM - { - identifier = EMSGenre; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_genre; - }, - AVKON_SETTING_ITEM - { - identifier = EMSArtist; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_artist; - }, - AVKON_SETTING_ITEM - { - identifier = EMSAlbum; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_album; - }, - AVKON_SETTING_ITEM - { - identifier = EMSTrack; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_track; - }, - AVKON_SETTING_ITEM - { - identifier = EMSServers; - setting_page_resource = r_ms_fill_rule_servers_setting_page; - name = qtn_mserv_rule_storage; - }, - AVKON_SETTING_ITEM - { - identifier = EMSFreeText; - setting_page_resource = r_ms_fill_rule_free_text_setting_page; - name = qtn_mserv_rule_free_text; - }, - AVKON_SETTING_ITEM - { - identifier = EMSTrackLength; - setting_page_resource = r_ms_track_length_setting_page; - associated_resource = r_ms_track_length_popup_texts; - name = qtn_mserv_rule_track_length; - }, - AVKON_SETTING_ITEM - { - identifier = EMSFileSize; - setting_page_resource = r_ms_file_size_setting_page; - associated_resource = r_ms_file_size_popup_texts; - name = qtn_mserv_rule_file_size; - }, - AVKON_SETTING_ITEM - { - identifier = EMSAddMoreRules; - setting_page_resource = r_ms_fill_rule_free_text_setting_page; - name = qtn_mserv_rule_add; - } - }; - } - -/*************************** LIST NAME SETTING *****************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_free_text_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_list_name_setting_page - { - label = qtn_mserv_rule_list_name; - type = EEikCtEdwin; - editor_resource_id = r_ms_fill_rule_free_text_editor; - } - -/**************************** AMOUNT SETTING *******************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_amount_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_amount_setting_page - { - label = qtn_mserv_sett_amount; - type = EAknCtPopupSettingList; - editor_resource_id = r_ms_fill_rule_amount_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_amount_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_fill_rule_amount_editor - { - } - -/************************** SHRINK IMAGES SETTING ****************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_shrink_images_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_shrink_images_setting_page - { - type = EAknCtPopupSettingList; - label = qtn_mserv_sett_shrink_image; - editor_resource_id = r_ms_shrink_images_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_shrink_images_popup_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_shrink_images_popup_texts - { - setting_texts_resource = r_ms_shrink_images_texts; - popped_up_texts_resource = r_ms_shrink_images_on_off_texts; - } - -//----------------------------------------------------------------------------- -// -// r_ms_shrink_images_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_shrink_images_editor - { - } - -//----------------------------------------------------------------------------- -// -// r_ms_shrink_images_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_shrink_images_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSShrinkScreenSize; - text = qtn_mserv_value_screen_size; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSShrinkingOff; - text = qtn_mserv_value_no_shrinking; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_shrink_images_on_off_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_shrink_images_on_off_texts - { - items = - { - LBUF { txt = qtn_mserv_value_screen_size; }, - LBUF { txt = qtn_mserv_value_no_shrinking; } - - }; - } - -/************************** STARTING_WITH SETTING ****************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_starting_with_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_starting_with_setting_page - { - type = EAknCtPopupSettingList; - label = qtn_mserv_sett_start_with; - editor_resource_id = r_ms_starting_with_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_starting_with_popup_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_starting_with_popup_texts - { - setting_texts_resource = r_ms_starting_with_texts; - popped_up_texts_resource = r_ms_starting_with_item_texts; - } - -//----------------------------------------------------------------------------- -// -// r_ms_starting_with_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_starting_with_editor - { - } - -//----------------------------------------------------------------------------- -// -// r_ms_starting_with_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_starting_with_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = ECmLatest; - text = qtn_mserv_value_start_latest; - }, - AVKON_ENUMERATED_TEXT - { - value = ECmOldest; - text = qtn_mserv_value_start_oldest; - }, - AVKON_ENUMERATED_TEXT - { - value = ECmRandom; - text = qtn_mserv_value_random; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_starting_with_item_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_starting_with_item_texts - { - items = - { - - LBUF { txt = qtn_mserv_value_start_latest; }, - LBUF { txt = qtn_mserv_value_start_oldest; }, - LBUF { txt = qtn_mserv_value_random; } - }; - } - -/**************************** Date FROM *******************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_date_from_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_date_from_setting_page - { - label = qtn_mserv_sett_from; - type = EEikCtDateEditor; - editor_resource_id = r_ms_fill_rule_date_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_date_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE DATE_EDITOR r_ms_fill_rule_date_editor - { - minDate = DATE { year=1900; }; - maxDate = DATE { year=2050; }; - flags=0; - } - -/**************************** Date UNTIL *******************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_date_until_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_date_until_setting_page - { - label = qtn_mserv_sett_until; - type = EEikCtDateEditor; - editor_resource_id = r_ms_fill_rule_date_editor; - } - - -/**************************** SERVER SETTING *******************************/ - - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_servers_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_servers_setting_page - { - label = qtn_mserv_sett_source_devices; - type = EAknSetListBox; - editor_resource_id = r_ms_fill_rule_servers_editor; - softkey_resource = r_ms_softkeys_ok_cancel__select; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_servers_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE LISTBOX r_ms_fill_rule_servers_editor - { - flags = EEikListBoxMultipleSelection; - } - - -/**************************** FREE TEXT *******************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_free_text_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_fill_rule_free_text_setting_page - { - label = qtn_mserv_sett_free_text; - type = EEikCtEdwin; - editor_resource_id = r_ms_fill_rule_free_text_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_free_text_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE EDWIN r_ms_fill_rule_free_text_editor - { - maxlength = 128; - lines = 2; - } - -/**************************** TRACK LENGTH *******************************/ - -///----------------------------------------------------------------------------- -// -// r_ms_track_length_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_track_length_setting_page - { - type = EAknCtPopupSettingList; - label = qtn_mserv_sett_track_length; - editor_resource_id = r_ms_track_length_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_track_length_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_track_length_editor - { - } - -//----------------------------------------------------------------------------- -// -// r_ms_track_length_popup_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_track_length_popup_texts - { - setting_texts_resource = r_ms_track_length_texts; - popped_up_texts_resource = r_ms_track_length_item_texts; - } - -//----------------------------------------------------------------------------- -// -// r_ms_track_length_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_track_length_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLenAny; - text = qtn_mserv_value_any_track_length; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLenLess_1; - text = qtn_mserv_value_less_1; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLen_16; - text = qtn_mserv_value_16_min; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLen_68; - text = qtn_mserv_value_68_min; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLen_830; - text = qtn_mserv_value_830_min; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLenMore_4; - text = qtn_mserv_value_more_4; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_track_length_item_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_track_length_item_texts - { - items = - { - LBUF { txt = qtn_mserv_value_any_track_length; }, - LBUF { txt = qtn_mserv_value_less_1; }, - LBUF { txt = qtn_mserv_value_16_min; }, - LBUF { txt = qtn_mserv_value_68_min; }, - LBUF { txt = qtn_mserv_value_830_min; }, - LBUF { txt = qtn_mserv_value_more_4; } - }; - } - -/**************************** FILE SIZE *******************************/ - -///----------------------------------------------------------------------------- -// -// r_ms_file_size_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_file_size_setting_page - { - type = EAknCtPopupSettingList; - label = qtn_mserv_sett_file_size; - editor_resource_id = r_ms_file_size_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_file_size_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_file_size_editor - { - } - -//----------------------------------------------------------------------------- -// -// r_ms_file_size_popup_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_file_size_popup_texts - { - setting_texts_resource = r_ms_file_size_texts; - popped_up_texts_resource = r_ms_file_size_item_texts; - } - -//----------------------------------------------------------------------------- -// -// r_ms_file_size_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_file_size_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLenAny; - text = qtn_mserv_value_any_file_size; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFileSizeLess_1_mb; - text = qtn_mserv_value_less_1_mb; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFileSize_15_mb; - text = qtn_mserv_value_15_mb; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFileSize_510_mb; - text = qtn_mserv_value_510_mb; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFileSize_1050_mb; - text = qtn_mserv_value_1050_mb; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFileSizeMore_10; - text = qtn_mserv_value_more_50; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_file_size_item_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_file_size_item_texts - { - items = - { - LBUF { txt = qtn_mserv_value_any_file_size; }, - LBUF { txt = qtn_mserv_value_less_1_mb; }, - LBUF { txt = qtn_mserv_value_15_mb; }, - LBUF { txt = qtn_mserv_value_510_mb; }, - LBUF { txt = qtn_mserv_value_1050_mb; }, - LBUF { txt = qtn_mserv_value_more_50; } - }; - } - -/**************************** MIN FILE SIZE *****************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_min_file_size_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_min_file_size_setting_page - { - label = qtn_mserv_sett_file_size_min; - type = EAknCtPopupSettingList; - editor_resource_id = r_ms_fill_rule_file_size_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_file_size_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_fill_rule_file_size_editor - { - } - -/**************************** MAX FILE SIZE *********************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_fill_rule_max_file_size_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_max_file_size_setting_page - { - label = qtn_mserv_sett_file_size_max; - type = EAknCtPopupSettingList; - editor_resource_id = r_ms_fill_rule_file_size_editor; - } - -/**************************** STORE LIST RULES ****************************/ -/**************************************************************************/ - - -/**************************** STORE SERVERS ****************************/ - -//---------------------------------------------------- -// -// r_ms_store_settings_list -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_ITEM_LIST r_ms_store_settings_list - { - flags= EAknSettingItemIncludeHiddenInOrdinal; - initial_number = 1; - items = - { - AVKON_SETTING_ITEM - { - identifier = EMSSourceServers; - setting_page_resource = r_ms_store_settings_location_setting_page; - name = qtn_mserv_item_target_devices; - }, - AVKON_SETTING_ITEM - { - identifier = EMSKeepOnPhone; - setting_page_resource = r_ms_store_list_keep_on_phone_setting_page; - associated_resource = r_ms_store_list_keep_on_phone_popup_texts; - name = qtn_mserv_item_local_copy; - } - }; - } - - -//----------------------------------------------------------------------------- -// -// r_ms_store_settings_location_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_store_settings_location_setting_page - { - label = qtn_mserv_sett_target_devices; - type = EAknSetListBox; - editor_resource_id = r_ms_store_settings_source_editor; - softkey_resource = r_ms_softkeys_ok_cancel__select; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_settings_source_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE LISTBOX r_ms_store_settings_source_editor - { - flags = EEikListBoxMultipleSelection; - } - - -/**************************** KEEP ON PHONE ****************************/ - -//----------------------------------------------------------------------------- -// -// r_ms_store_list_keep_on_phone_setting_page -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_ms_store_list_keep_on_phone_setting_page - { - label = qtn_mserv_item_local_copy; - type = EAknCtPopupSettingList; - editor_resource_id = r_ms_store_list_keep_on_phone_editor; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_list_keep_on_phone_popup_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_ms_store_list_keep_on_phone_popup_texts - { - setting_texts_resource = r_ms_keep_on_phone_texts; - popped_up_texts_resource = r_ms_keep_on_phone_item_texts; - } - -//----------------------------------------------------------------------------- -// -// r_ms_keep_on_phone_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_keep_on_phone_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSDontKeep; - text = qtn_mserv_item_no_local; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSKeep; - text = qtn_mserv_item_yes_local; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSKeepOriginalSize; - text = qtn_mserv_item_original_size; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSKeepScreenSize; - text = qtn_mserv_item_screen_size; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_item_texts -// -//----------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_keep_on_phone_item_texts - { - items = - { - LBUF { txt = qtn_mserv_item_no_local; }, - LBUF { txt = qtn_mserv_item_yes_local; }, - LBUF { txt = qtn_mserv_item_original_size; }, - LBUF { txt = qtn_mserv_item_screen_size; } - }; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_list_keep_on_phone_editor -// -//----------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_ms_store_list_keep_on_phone_editor - { - } - - -/**************************** QUERIES *********************************/ -/**********************************************************************/ - - -//----------------------------------------------------------------------------- -// -// r_mserv_template_query -// -//----------------------------------------------------------------------------- -// -RESOURCE AVKON_LIST_QUERY r_mserv_template_query - { - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - heading = " "; // defined dynamically - listbox = AVKON_LIST_QUERY_LIST - { - // array items defined dynamically - }; - }; - } - }; - } - - -//----------------------------------------------------------------------------- -// -// r_mserv_delete_files_query -// -//----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_mserv_delete_files_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - label = qtn_mserv_lists_edited; - }; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_mserv_delete_list_query -// -//----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_mserv_delete_list_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - label = qtn_mserv_conf_delete_list; - }; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_mserv_data_query -// -//----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_mserv_data_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EMSDataQueryId; - control = AVKON_DATA_QUERY - { - layout = ENumberLayout; - control = AVKON_INTEGER_EDWIN - { - min = 0; - max = 32767; - }; - }; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_mserv_time_query -// -//----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_mserv_time_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = ETimeLayout; - control = TIME_EDITOR - { - minTime = TIME{minute=0;hour=0;}; - maxTime = TIME{minute=59;hour=23;}; - }; - }; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_mserv_mmc_query -// -//----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_mserv_mmc_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - label = qtn_mserv_conf_used_memory; - }; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_mserv_video_rule_query -// -//----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_mserv_video_rule_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - label = qtn_mserv_qry_add_video_date; - }; - } - }; - } - -//----------------------------------------------------------------------------- -// -// r_main_sync_now_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_main_sync_now_text - { - buf = qtn_mserv_sync_now; - } - -//----------------------------------------------------------------------------- -// -// r_main_stop_sync_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_main_stop_sync_text - { - buf = qtn_mserv_sync_stop; - } - -//----------------------------------------------------------------------------- -// -// r_main_to_home_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_main_to_home_text - { - buf = qtn_mserv_to_home; - } - -//----------------------------------------------------------------------------- -// -// r_main_from_home_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_main_from_home_text - { - buf = qtn_mserv_from_home; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_view_title -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_fill_view_title - { - buf = qtn_mserv_title_from_home; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_list_view_title -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_list_view_title - { - buf = qtn_mserv_title_to_home; - } - -//----------------------------------------------------------------------------- -// -// r_ms_navi_sync_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_navi_sync_text - { - buf = qtn_mserv_navi_sync; - } - -//----------------------------------------------------------------------------- -// -// r_ms_navi_refreshing_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_navi_refreshing_text - { - buf = qtn_mserv_navi_refreshing; - } - -//----------------------------------------------------------------------------- -// -// r_ms_add_rule_query_heading -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_add_rule_query_heading - { - buf = qtn_mserv_head_add_rule; - } - -//----------------------------------------------------------------------------- -// -// r_ms_edit_image_rule_view_title -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_edit_image_rule_view_title - { - buf = qtn_mserv_title_edit_rules_image; - } - -//----------------------------------------------------------------------------- -// -// r_ms_edit_video_rule_view_title -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_edit_video_rule_view_title - { - buf = qtn_mserv_title_edit_rules_video; - } - -//----------------------------------------------------------------------------- -// -// r_ms_edit_music_rule_view_title -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_edit_music_rule_view_title - { - buf = qtn_mserv_title_edit_rules_music; - } - -//----------------------------------------------------------------------------- -// -// r_ms_amount_query_heading -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_amount_query_heading - { - buf = qtn_mserv_head_amount_count; - } - -//----------------------------------------------------------------------------- -// -// r_ms_size_query_heading -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_size_query_heading - { - buf = qtn_mserv_head_amount_mb; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_amount_unlimited -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_amount_unlimited - { - buf = qtn_mserv_value_amount_unlimited; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_amount_mb_number -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_amount_mb_number - { - buf = qtn_mserv_value_amount_mb_list; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_amount_mb_page -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_amount_mb_page - { - buf = qtn_mserv_value_amount_mb; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_amount_count_page -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_amount_count_page - { - buf = qtn_mserv_value_amount_count; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_amount_one_item -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_amount_one_item - { - buf = qtn_mserv_value_amount_item_1_list; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_amount_0_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_amount_0_items - { - buf = qtn_mserv_value_amount_item_0_list; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_amount_count_number -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_amount_count_number - { - buf = qtn_mserv_value_amount_item_list; - } - - -//----------------------------------------------------------------------------- -// -// r_ms_rule_name_setting -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_name_setting - { - buf = qtn_mserv_sett_name; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_genre_setting -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_genre_setting - { - buf = qtn_mserv_sett_genre; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_artist_setting -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_artist_setting - { - buf = qtn_mserv_sett_artist; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_album_setting -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_album_setting - { - buf = qtn_mserv_sett_album; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_track_setting -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_track_setting - { - buf = qtn_mserv_sett_track; - } - -//----------------------------------------------------------------------------- -// -// r_ms_file_size_item_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_file_size_item_text - { - buf = qtn_mserv_min_list; - } - -//----------------------------------------------------------------------------- -// -// r_ms_min_file_size_page_item_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_min_file_size_page_item_text - { - buf = qtn_mserv_value_min_mb; - } - -//----------------------------------------------------------------------------- -// -// r_ms_max_file_size_page_item_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_max_file_size_page_item_text - { - buf = qtn_mserv_value_max_mb; - } - -//----------------------------------------------------------------------------- -// -// r_ms_all_in_sync_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_all_in_sync_text - { - buf = qtn_mserv_in_sync; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_one_new_item_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_sync_one_new_item_text - { - buf = qtn_mserv_one_item; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_new_items_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_sync_new_items_text - { - buf = qtn_mserv_new_items; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_time_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_sync_time_text - { - buf = qtn_mserv_sync_time; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_time_one_min_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_sync_time_one_min_text - { - buf = qtn_mserv_sync_time_one; - } - -//----------------------------------------------------------------------------- -// -// r_ms_sync_waiting_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_sync_waiting_text - { - buf = qtn_mserv_waiting_sync; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_title_item_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_title_item_text - { - buf = qtn_mserv_n_names; - } - - -//----------------------------------------------------------------------------- -// -// r_ms_rule_genre_item_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_genre_item_text - { - buf = qtn_mserv_n_genre; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_genre_item_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_artist_item_text - { - buf = qtn_mserv_n_artists; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_genre_album_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_album_item_text - { - buf = qtn_mserv_n_album; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_genre_track_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_track_item_text - { - buf = qtn_mserv_n_tracks; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_list_any_name -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_list_any_name - { - buf = qtn_mserv_value_list_any_name; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_any_name -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_any_name - { - buf = qtn_mserv_value_any_name; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_any_file_size -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_any_file_size - { - buf = qtn_mserv_value_any_file_size; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_list_any_genre -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_list_any_genre - { - buf = qtn_mserv_value_list_any_genre; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_any_genre -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_any_genre - { - buf = qtn_mserv_value_any_genre; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_list_any_artist -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_list_any_artist - { - buf = qtn_mserv_value_list_any_artist; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_any_artist -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_any_artist - { - buf = qtn_mserv_value_any_artist; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_list_any_album -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_list_any_album - { - buf = qtn_mserv_value_list_any_album; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_any_album -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_any_album - { - buf = qtn_mserv_value_any_album; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_list_any_track -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_list_any_track - { - buf = qtn_mserv_value_list_any_track; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_any_track -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_any_track - { - buf = qtn_mserv_value_any_track; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_list_any_source_device -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_list_any_source_device - { - buf = qtn_mserv_value_list_any_source_device; - } - -//----------------------------------------------------------------------------- -// -// r_ms_value_any_source_device -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_value_any_source_device - { - buf = qtn_mserv_value_any_source_device; - } - -//----------------------------------------------------------------------------- -// -// r_ms_n_items_to_be_synced -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_n_items_to_be_synced - { - buf = qtn_mserv_navi_new_items; - } - -//----------------------------------------------------------------------------- -// -// r_ms_1_item_to_be_synced -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_1_item_to_be_synced - { - buf = qtn_mserv_navi_one_new_item; - } - -//----------------------------------------------------------------------------- -// -// r_ms_no_items_to_be_synced -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_no_items_to_be_synced - { - buf = qtn_mserv_navi_no_new_items; - } - -//----------------------------------------------------------------------------- -// -// r_ms_navi_list_size -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_navi_list_size - { - buf = qtn_mserv_navi_list_size; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_browse_navi_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_browse_navi_items - { - buf = qtn_mserv_navi_items_store_browse; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_browse_navi_1_item -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_browse_navi_1_item - { - buf = qtn_mserv_navi_items_store_browse1; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_browse_navi_0_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_browse_navi_0_items - { - buf = qtn_mserv_navi_items_store_browse_none; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_list_browse_navi_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_fill_list_browse_navi_items - { - buf = qtn_mserv_navi_items_fill_list; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_list_browse_navi_1_item -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_fill_list_browse_navi_1_item - { - buf = qtn_mserv_navi_items_fill_list1; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_list_browse_navi_0_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_fill_list_browse_navi_0_items - { - buf = qtn_mserv_navi_items_fill_list_no_items; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_navi_many_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_navi_many_items - { - buf = qtn_mserv_navi_rules_amount; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_navi_1_item -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_navi_1_item - { - buf = qtn_mserv_navi_rules_amount1; - } - -//----------------------------------------------------------------------------- -// -// r_ms_rule_navi_0_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_rule_navi_0_items - { - buf = qtn_mserv_navi_rules_amount0; - } - -//----------------------------------------------------------------------------- -// -// r_ms_wait_randomize -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_wait_randomize - { - buf = qtn_mserv_wait_randomize; - } - -//----------------------------------------------------------------------------- -// -// r_ms_wait_getting_data_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_wait_getting_data_text - { - buf = qtn_mserv_wait_getting_data; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_store_list_1 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_store_list_1 - { - buf = qtn_mserv_store_check_phone_images; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_store_list_2 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_store_list_2 - { - buf = qtn_mserv_store_check_other_images; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_store_list_3 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_store_list_3 - { - buf = qtn_mserv_store_check_phone_videos; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_store_list_4 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_store_list_4 - { - buf = qtn_mserv_store_check_other_videos; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_store_list_5 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_store_list_5 - { - buf = qtn_mserv_store_check_music; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_title_phone_images -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_title_phone_images - { - buf = qtn_mserv_title_phone_images; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_title_images -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_title_images - { - buf = qtn_mserv_title_other_images; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_title_phone_videos -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_title_phone_videos - { - buf = qtn_mserv_title_phone_videos; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_title_videos -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_title_videos - { - buf = qtn_mserv_title_other_videos; - } - -//----------------------------------------------------------------------------- -// -// r_ms_store_title_music -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_store_title_music - { - buf = qtn_mserv_title_music; - } - -//----------------------------------------------------------------------------- -// -// r_ms_no_selected_items -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_no_selected_items - { - buf = qtn_selec_sett_val_field_none; - } - -//----------------------------------------------------------------------------- -// -// r_ms_item_devices -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_item_devices - { - buf = qtn_mserv_n_servers; - } - -//----------------------------------------------------------------------------- -// -// r_ms_access_error_note -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_access_error_note - { - buf = qtn_mserv_access_error; - } - -//----------------------------------------------------------------------------- -// -// r_ms_access_error_note_sync -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_access_error_note_sync - { - buf = qtn_mserv_access_error_sync; - } - -//----------------------------------------------------------------------------- -// -// r_ms_error_memory_full -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_error_memory_full - { - buf = qtn_memlo_not_enough_memory; - } - -//----------------------------------------------------------------------------- -// -// r_ms_text_target_device_needed -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_text_target_device_needed - { - buf = qtn_mserv_no_target_devices; - } - -//----------------------------------------------------------------------------- -// -// r_ms_last_sync_min -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_last_sync_min - { - buf = qtn_mserv_navi_last_sync_min_one; - } - -//----------------------------------------------------------------------------- -// -// r_ms_last_sync_mins -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_last_sync_mins - { - buf = qtn_mserv_navi_last_sync_min; - } - -//----------------------------------------------------------------------------- -// -// r_ms_last_sync_hour -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_last_sync_hour - { - buf = qtn_mserv_navi_last_sync_hour_one; - } - -//----------------------------------------------------------------------------- -// -// r_ms_last_sync_hours -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_last_sync_hours - { - buf = qtn_mserv_navi_last_sync_hour; - } - -//----------------------------------------------------------------------------- -// -// r_ms_last_sync_day -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_last_sync_day - { - buf = qtn_mserv_navi_last_sync_day_one; - } - -//----------------------------------------------------------------------------- -// -// r_ms_last_sync_days -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_last_sync_days - { - buf = qtn_mserv_navi_last_sync_day; - } - -//----------------------------------------------------------------------------- -// -// r_ms_fill_view_title_reorder_mode -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_fill_view_title_reorder_mode - { - buf = qtn_mserv_title_reorder; - } - -//----------------------------------------------------------------------------- -// -// r_ms_preprocessing_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_preprocessing_text - { - buf = qtn_mserv_wait_preprocessing; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_fill_list_1 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_fill_list_1 - { - buf = qtn_mserv_def_latest_org; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_fill_list_2 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_fill_list_2 - { - buf = qtn_mserv_def_latest_videos; - } - -//----------------------------------------------------------------------------- -// -// r_ms_default_fill_list_3 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_default_fill_list_3 - { - buf = qtn_mserv_def_recent_music; - } - -//----------------------------------------------------------------------------- -// -// r_ms_memory_card_needed_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_memory_card_needed_text - { - buf = qtn_mserv_memory_card_needed; - } - -//----------------------------------------------------------------------------- -// -// r_ms_insert_memory_card_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_insert_memory_card_text - { - buf = qtn_mserv_mcard_error; - } - -//----------------------------------------------------------------------------- -// -// r_ms_error_devices_not_found -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_error_devices_not_found - { - buf = qtn_mserv_error_not_found; - } - -//----------------------------------------------------------------------------- -// -// r_ms_error_sync_interrupted -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_error_sync_interrupted - { - buf = qtn_mserv_error_sync_interrupted; - } - -//----------------------------------------------------------------------------- -// -// r_ms_file_size_mb -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_file_size_mb - { - buf = qtn_size_mb; - } - -//----------------------------------------------------------------------------- -// -// r_ms_file_size_kb -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_file_size_kb - { - buf = qtn_size_kb; - } - -//----------------------------------------------------------------------------- -// -// r_ms_plugin_listbox_primary_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_plugin_listbox_primary_text - { - buf = qtn_mserv_grid_media_servant_home_media; - } - -//----------------------------------------------------------------------------- -// -// r_ms_plugin_text_auto_sync -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_plugin_text_auto_sync - { - buf = qtn_mserv_main_sync_auto; - } - -//----------------------------------------------------------------------------- -// -// r_ms_plugin_synchronizing -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_plugin_synchronizing - { - buf = qtn_mserv_main_sync; - } - -//----------------------------------------------------------------------------- -// -// r_ms_plugin_harvesting -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_plugin_harvesting - { - buf = qtn_mserv_main_refreshing; - } - -//----------------------------------------------------------------------------- -// -// r_ms_plugin_listbox_secondary_text_1 -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_plugin_text_manual_sync - { - buf = qtn_mserv_main_sync_manual; - } - -//----------------------------------------------------------------------------- -// -// r_ms_custom_list_image_name -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_custom_list_image_name - { - buf = qtn_mserv_options_new_image; - } - -//----------------------------------------------------------------------------- -// -// r_ms_custom_list_video_name -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_custom_list_video_name - { - buf = qtn_mserv_options_new_video; - } - -//----------------------------------------------------------------------------- -// -// r_ms_custom_list_music_name -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_custom_list_music_name - { - buf = qtn_mserv_options_new_music; - } - -//----------------------------------------------------------------------------- -// -// r_ms_list_nothing_selected -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_list_nothing_selected - { - buf = qtn_mserv_nothing_selected; - } - -//----------------------------------------------------------------------------- -// -// r_ms_navi_content_refreshed -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_ms_navi_content_refreshed - { - buf = qtn_mserv_navi_refresh_completed; - } - -// CBA definitions - -//----------------------------------------------------------------------------- -// -// r_ms_softkeys_options_done__change -// -//----------------------------------------------------------------------------- -// -RESOURCE CBA r_ms_softkeys_options_done__change - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOptions; // left sk - txt = text_softkey_option; - }, - CBA_BUTTON - { - id = EAknSoftkeyDone; // right sk - txt = text_softkey_done; - }, - CBA_BUTTON - { - id = EAknCmdOpen; // middle sk - txt = qtn_options_change; - } - }; - } - -// --------------------------------------------------------------------------- -// r_softkeys_drop_empty -// --------------------------------------------------------------------------- -RESOURCE CBA r_softkeys_drop_empty - { - buttons = - { - CBA_BUTTON - { - id = EMSCmdDrop; - txt = qtn_mserv_skey_drop; - }, - CBA_BUTTON - { - id = EAknSoftkeyEmpty; - } - }; - } - -// --------------------------------------------------------------------------- -// r_softkeys_grab_done -// --------------------------------------------------------------------------- -RESOURCE CBA r_softkeys_grab_done - { - buttons = - { - CBA_BUTTON - { - id = EMSCmdGrab; - txt = qtn_mserv_skey_grab; - }, - CBA_BUTTON - { - id = EAknSoftkeyDone; - txt = text_softkey_done; - } - }; - } - -// -------------------------------------------------------------------------- -// r_ms_softkeys_options_empty -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_options_empty - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOptions; - txt = text_softkey_option; - }, - CBA_BUTTON - { - id = EAknSoftkeyEmpty; - } - }; - } - -// -------------------------------------------------------------------------- -// r_ms_softkeys_options_back__toggle -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_options_back__toggle - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOptions; // left sk - txt = text_softkey_option; - }, - CBA_BUTTON - { - id = EAknSoftkeyBack; // right sk - txt = text_softkey_back; - }, - CBA_BUTTON - { - id = EAknSoftkeyForwardKeyEvent; // middle softkey - } - }; - } - - -// -------------------------------------------------------------------------- -// r_ms_softkeys_options_back__deactivate -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_options_back__deactivate - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOptions; // left sk - txt = text_softkey_option; - }, - CBA_BUTTON - { - id = EAknSoftkeyBack; // right sk - txt = text_softkey_back; - }, - CBA_BUTTON - { - id = EAknSoftkeyForwardKeyEvent; // middle sk - txt = qtn_mserv_msk_unselect; - } - }; - } - -// -------------------------------------------------------------------------- -// r_ms_softkeys_options_back__activate -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_options_back__activate - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOptions; // left sk - txt = text_softkey_option; - }, - CBA_BUTTON - { - id = EAknSoftkeyBack; // right sk - txt = text_softkey_back; - }, - CBA_BUTTON - { - id = EAknSoftkeyForwardKeyEvent; // middle sk - txt = qtn_msk_select; - } - }; - } - -// -------------------------------------------------------------------------- -// r_ms_softkeys_ok_cancel__change -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_ok_cancel__change - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOk; // left sk - txt = text_softkey_ok; - }, - CBA_BUTTON - { - id = EAknSoftkeyCancel; // right sk - txt = text_softkey_cancel; - } -#ifndef __SERIES60_31__ - , - CBA_BUTTON - { - id = EAknSoftkeyChange; // middle sk - bmpfile=""APP_RESOURCE_DIR"\\avkon2.mif"; - bmpid=EMbmAvkonQgn_prop_msk_select; - bmpmask=EMbmAvkonQgn_prop_msk_select_mask; - } -#endif - }; - } - -// -------------------------------------------------------------------------- -// r_ms_softkeys_ok_cancel__select -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_ok_cancel__select - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOk; // left sk - txt = text_softkey_ok; - }, - CBA_BUTTON - { - id = EAknSoftkeyCancel; // right sk - txt = text_softkey_cancel; - } -#ifndef __SERIES60_31__ - , - CBA_BUTTON - { - id = EAknSoftkeySelect; - } -#endif - }; - } - -// -------------------------------------------------------------------------- -// r_ms_softkeys_options_back__open -// -------------------------------------------------------------------------- -RESOURCE CBA r_ms_softkeys_options_back__open - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyOptions; // left sk - txt = text_softkey_option; - }, - CBA_BUTTON - { - id = EAknSoftkeyBack; // right sk - txt = text_softkey_back; - } -#ifndef __SERIES60_31__ - , - CBA_BUTTON - { - id = EAknSoftkeyOpen; // middle sk - txt = text_softkey_open; - } -#endif - }; - } - -/*********************** DEFAULT LIST RULES ***********************/ - -// --------------------------------------------------------------------------- -// r_ms_default_image_list_rules -// --------------------------------------------------------------------------- -// -RESOURCE TEMPLATE_ITEMS r_ms_default_image_list_rules - { - items = - { - FILL_RULE { item = EMSAmount; value = 50; addinfo = EMbits; }, - FILL_RULE { item = EMSStartingWith; value = ECMLatest; }, - FILL_RULE { item = EMSShrinkImages; value = EMSShrinkingOff; }, - FILL_RULE { item = EMSDateFrom; }, - FILL_RULE { item = EMSDateUntil; } - }; - } - -// --------------------------------------------------------------------------- -// r_ms_default_video_list_rules -// --------------------------------------------------------------------------- -// -RESOURCE TEMPLATE_ITEMS r_ms_default_video_list_rules - { - items = - { - FILL_RULE { item = EMSAmount; value = 50; addinfo = EMbits; }, - FILL_RULE { item = EMSStartingWith; value = ECMLatest; }, - FILL_RULE { item = EMSTitleName; }, - FILL_RULE { item = EMSMinFileSize; }, - FILL_RULE { item = EMSMaxFileSize; } - }; - } - -// --------------------------------------------------------------------------- -// r_ms_default_music_list_rules -// --------------------------------------------------------------------------- -// -RESOURCE TEMPLATE_ITEMS r_ms_default_music_list_rules - { - items = - { - FILL_RULE { item = EMSAmount; value = 200; addinfo = EMbits;}, - FILL_RULE { item = EMSStartingWith; value = ECMLatest; }, - FILL_RULE { item = EMSGenre; }, - FILL_RULE { item = EMSArtist; }, - FILL_RULE { item = EMSAlbum; }, - FILL_RULE { item = EMSTrack; } - }; - } - -/*********************** RULES ***************************/ - -// --------------------------------------------------------------------------- -// r_ms_image_rule_list -// --------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_image_rule_list - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSServers; - text = qtn_mserv_rule_storage; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFreeText; - text = qtn_mserv_rule_free_text; - } - }; - } - - -// --------------------------------------------------------------------------- -// r_ms_video_rule_list -// --------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_video_rule_list - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSServers; - text = qtn_mserv_rule_storage; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFreeText; - text = qtn_mserv_rule_free_text; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSDateFrom; - text = qtn_mserv_rule_from; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSDateUntil; - text = qtn_mserv_rule_until; - } - }; - } - -// --------------------------------------------------------------------------- -// r_ms_music_rule_list -// --------------------------------------------------------------------------- -// -RESOURCE ARRAY r_ms_music_rule_list - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EMSServers; - text = qtn_mserv_rule_storage; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFreeText; - text = qtn_mserv_rule_free_text; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSTrackLength; - text = qtn_mserv_rule_track_length; - }, - AVKON_ENUMERATED_TEXT - { - value = EMSFileSize; - text = qtn_mserv_rule_file_size; - } - }; - } - - -/************** FOR DEBUGGING **************/ - -//----------------------------------------------------------------------------- -// -// r_active_object_error_note_text -// -//----------------------------------------------------------------------------- -// -RESOURCE TBUF r_active_error_note_text - { - buf = "Failed with error: "; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/data/mediaservant_reg.rss --- a/homesync/contentmanager/mediaservant/data/mediaservant_reg.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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: Resource definitions for project MediaServant -* -*/ - - -#include // APP_REGISTRATION_INFO. -#include // APP_RESOURCE_DIR. -#include // R_LOCALISABLE_APP_INFO. -#include "mediaservantuid.h" - -UID2 KUidAppRegistrationResourceFile -UID3 KMediaServantUID3 - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "MediaServant"; // Filename of application binary (without extension). - localisable_resource_file = APP_RESOURCE_DIR"\\MediaServant"; - localisable_resource_id = R_LOCALISABLE_APP_INFO; - hidden = KAppIsHidden; - } diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/group/bld.inf --- a/homesync/contentmanager/mediaservant/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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 information file for project MediaServant -* -*/ - - -#include "../../../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -// Help exports -#include "../help/group/bld.inf" - -PRJ_EXPORTS -../inc/msconstants.h |../../../../inc/msconstants.h -// LOC export -UPNP_LOC_EXPORT(mediaservant.loc) - -PRJ_MMPFILES - -mediaservant.mmp -#include "../plugin/group/bld.inf" - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE mediaservant.mif -OPTION HEADERFILE mediaservant.mbg -OPTION SOURCEDIR ../bitmaps -OPTION SOURCEFILE iconlist.txt -END - -START EXTENSION s60/mifconv -OPTION TARGETFILE MediaServant_aif.mif -OPTION SOURCEDIR ../aif -OPTION SOURCES -c8,8 qgn_mserv_app_context_icon -END - -PRJ_TESTMMPFILES - - -PRJ_TESTEXPORTS diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/group/iconlist.txt --- a/homesync/contentmanager/mediaservant/group/iconlist.txt Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ --c8,8 qgn_mserv_app_menu_icon.svg --c8,8 qgn_mserv_context_icon.svg --c8,8 qgn_mserv_fill_small.svg --c8,8 qgn_mserv_from_home.svg --c8,8 qgn_mserv_from_home_inactive.svg --c8,8 qgn_mserv_image_list_small.svg --c8,8 qgn_mserv_music.svg --c8,8 qgn_mserv_music_list_small.svg --c8,8 qgn_mserv_other_images.svg --c8,8 qgn_mserv_other_videos.svg --c8,8 qgn_mserv_partial_icon.svg --c8,8 qgn_mserv_partial_note_icon.svg --c8,8 qgn_mserv_phone_images.svg --c8,8 qgn_mserv_phone_videos.svg --c8,8 qgn_mserv_red_check.svg --c8,8 qgn_mserv_red_uncheck.svg --c8,8 qgn_mserv_removed_small.svg --c8,8 qgn_mserv_skipped_small.svg --c8,8 qgn_mserv_store_small.svg --c8,8 qgn_mserv_sync.svg --c8,8 qgn_mserv_sync_stop.svg --c8,8 qgn_mserv_to_home.svg --c8,8 qgn_mserv_to_home_inactive.svg --c8,8 qgn_mserv_unavailable_small.svg --c8,8 qgn_mserv_white_check.svg --c8,8 qgn_mserv_white_uncheck.svg --c8,8 qgn_mserv_video_list_small.svg --c8,8 qgn_mserv_yellow_check.svg --c8,8 qgn_mserv_yellow_uncheck.svg --c8,8 qgn_prop_file_audio.svg --c8,8 qgn_prop_file_video.svg --c8,8 qgn_prop_file_image.svg --c8,8 qgn_prop_skipped.svg \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/group/mediaservant.mmp --- a/homesync/contentmanager/mediaservant/group/mediaservant.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +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 project MediaServant -* -*/ - - -#include -#include -#include "../inc/mediaservantuid.h" - -TARGET mediaservant.exe -TARGETTYPE exe -UID 0x100039CE KMediaServantUID3 - -// Minimum heap size 4kB, maximum heap size 8MB, stack size 32kB -EPOCHEAPSIZE 4096 8388608 -EPOCSTACKSIZE 32768 - -CAPABILITY CAP_APPLICATION -VENDORID VID_DEFAULT - -USERINCLUDE . -USERINCLUDE ../inc -USERINCLUDE ../help/inc -USERINCLUDE ../applicationengine/inc - -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../inc - -SOURCEPATH ../src -SOURCE msapp.cpp -SOURCE msappui.cpp -SOURCE msdocument.cpp -SOURCE msbaseview.cpp -SOURCE msmainview.cpp -SOURCE msbasecontainer.cpp -SOURCE msmaincontainer.cpp - -SOURCE msfillrulecontroller.cpp -SOURCE msfillview.cpp -SOURCE msfillcontainer.cpp -SOURCE msfillruleeditview.cpp -SOURCE msfillruleeditlist.cpp -SOURCE msruleamountsetting.cpp -SOURCE msrulemultiselectionsetting.cpp -SOURCE msrulefilesizesetting.cpp -SOURCE msruleserverssetting.cpp -SOURCE msmultiselectiondialog.cpp - -SOURCE msstorelistcontroller.cpp -SOURCE msstorelistview.cpp -SOURCE msstorelistcontainer.cpp -SOURCE msstoresettingsview.cpp -SOURCE msstoresettingslist.cpp -SOURCE msstoreserverssetting.cpp -SOURCE msstorekeeponphonesetting.cpp - -SOURCE msparameteragent.cpp -SOURCE mspropertywatcher.cpp - -SOURCE msitembrowser.cpp -SOURCE msbrowseview.cpp -SOURCE msbrowsecontainer.cpp -SOURCE msfillbrowseview.cpp -SOURCE msfillbrowsecontainer.cpp - -SOURCE msmultiselectionsettingpage.cpp -SOURCE mssettingitems.cpp -SOURCE msmemorycardmonitor.cpp -SOURCE msmetadatacollector.cpp - - -START RESOURCE ../data/mediaservant.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END // RESOURCE - -LIBRARY euser.lib apparc.lib cone.lib PlatformEnv.lib -LIBRARY avkon.lib bafl.lib eikcore.lib eikcoctl.lib eikctl.lib -LIBRARY AKNSKINS.lib -LIBRARY egul.lib -LIBRARY AknIcon.lib -LIBRARY CommonEngine.lib -LIBRARY msengine.lib -LIBRARY cmcommon.lib -LIBRARY efsrv.lib // file server -LIBRARY flogger.lib -LIBRARY hlplch.lib // help -LIBRARY eikdlg.lib // multiselection dialog -LIBRARY upnpipserversutils.lib // UPnPString -LIBRARY msappwizard.lib // for app wizard -LIBRARY cmsettingsengine.lib // drive settings -LIBRARY charconv.lib // ConvertToUnicodeFromUtf8 - -// upnp -LIBRARY upnpavcontrollerclient.lib -LIBRARY AVControlFramework.lib -LIBRARY upnpserviceframework.lib - -// ECom -LIBRARY ecom.lib - -#ifdef __CLEANUP_SUPPORT - -LIBRARY SQLiteClient.lib -#endif // __CLEANUP_SUPPORT - -START RESOURCE ../data/mediaservant_reg.rss -DEPENDS mediaservant.rsg -// Do not change the UID 10003a3f below. -TARGETPATH /private/10003a3f/apps -END diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/help/data/xhtml.zip Binary file homesync/contentmanager/mediaservant/help/data/xhtml.zip has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/help/group/bld.inf --- a/homesync/contentmanager/mediaservant/help/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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: -* Export help related files. -* -*/ - -#include -PRJ_EXPORTS -:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite -:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite - -../inc/mserv.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/mserv.hlp.hrh) -../rom/mediaservanthelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(mediaservanthelps_variant.iby) diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/help/inc/mserv.hlp.hrh --- a/homesync/contentmanager/mediaservant/help/inc/mserv.hlp.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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: Help header for project Media Servant -* -*/ - -// mserv.hlp.hrh -// - -// -// File generated by CSXHelp Utilities on 2009-04-17 -// - -#ifndef __MSERV_HLP_HRH__ -#define __MSERV_HLP_HRH__ - -_LIT(KMSERV_HLP_FILL_BROWSE, "MSERV_HLP_FILL_BROWSE"); // -_LIT(KMSERV_HLP_FILE_BROWSE, "MSERV_HLP_FILE_BROWSE"); // -_LIT(KMSERV_HLP_FILL_LIST, "MSERV_HLP_FILL_LIST"); // -_LIT(KMSERV_HLP_EDIT_RULES, "MSERV_HLP_EDIT_RULES"); // -_LIT(KMSERV_HLP_MAIN_VIEW, "MSERV_HLP_MAIN_VIEW"); // -_LIT(KMSERV_HLP_STORE_LIST, "MSERV_HLP_STORE_LIST"); // -_LIT(KMSERV_HLP_STORE_SETTINGS, "MSERV_HLP_STORE_SETTINGS"); // -_LIT(KMSERV_HLP_SYNC_SETTINGS, "MSERV_HLP_SYNC_SETTINGS"); // - -#endif diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/help/rom/mediaservanthelps_variant.iby --- a/homesync/contentmanager/mediaservant/help/rom/mediaservanthelps_variant.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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: mediaservanthelps_variant.iby -* -*/ - -#ifndef __MEDIASERVANTHELPS_VARIANT_IBY__ -#define __MEDIASERVANTHELPS_VARIANT_IBY__ - -#if defined(FF_S60_HELPS_IN_USE) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\contents.zip) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\index.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\keywords.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x1028290B\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x1028290B\meta.xml) -#endif - -#endif \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/mediaservant.hrh --- a/homesync/contentmanager/mediaservant/inc/mediaservant.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +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: Resource headers for project Media Servant -* -*/ - - -#ifndef MEDIASERVANT_HRH -#define MEDIASERVANT_HRH - -enum TMSCommandIds - { - EMSCmdSelect = 1, - EMSCmdStartHarvest, - EMSCmdStopHarvest, - EMSCmdSettings, - EMSCmdRunWizard, - EMSCmdActivate, - EMSCmdDeActivate, - EMSCmdEditRule, - EMSCmdBrowse, - EMSCmdReorder, - EMSCmdDrop, - EMSCmdGrab, - EMSCmdDelete, - EMSCmdNewImageList, - EMSCmdNewVideoList, - EMSCmdNewMusicList, - EMSCmdRemoveRule - }; - -enum TMSStoreListCommands - { - EMSStoreCmdActivate = 1, - EMSStoreCmdDeActivate, - EMSStoreCmdEdit - }; - -enum TMSFillBrowseCommands - { - - EMSCmdLock = 1, - EMSCmdUnLock, - EMSCmdRandomize, - EMSCmdMark - }; - -enum TMSListboxItems - { - EStoreAndFill = 0, - EFillToPhone, - EStoreToNetwork - }; - -enum TMSFillEditItems - { - EMSListName = 0, - EMSShrinkImages, - EMSAmount, - EMSStartingWith, - EMSDateFrom, - EMSDateUntil, - EMSServers, - EMSFreeText, - EMSTitleName, - EMSMinFileSize, - EMSMaxFileSize, - EMSGenre, - EMSArtist, - EMSAlbum, - EMSTrack, - EMSTrackLength, - EMSFileSize, - EMSAddMoreRules - }; - -enum TMSStoreListListboxItems - { - EMSStoreImages = 0, - EMSStoreOtherImages, - EMSStorePhoneVideos, - EMSStoreOtherVideos, - EMSStoreMusic - }; - -enum TMSStoreSettingsItems - { - EMSSourceServers = 0, - EMSKeepOnPhone - }; - -enum TMSStoreKeepOnPhone - { - EMSDontKeep = 0, - EMSKeep, - EMSKeepOriginalSize, - EMSKeepScreenSize - }; - -enum TMSReorderState - { - EMSFillNormal, - EMSFillReorderActive, - EMSFillGrabActive - }; - -enum TMSTrackLengthStates - { - EMSTrackLenAny = 0, - EMSTrackLenLess_1, - EMSTrackLen_16, - EMSTrackLen_68, - EMSTrackLen_830, - EMSTrackLenMore_4 - }; - -enum TMSFileSizeStates - { - EMSFileSizeAny = 0, - EMSFileSizeLess_1_mb, - EMSFileSize_15_mb, - EMSFileSize_510_mb, - EMSFileSize_1050_mb, - EMSFileSizeMore_10 - }; - -enum TMSFileSizeSettingItems - { - EMSAny = 0, - EMSSetSize - }; - -enum TMSFillListTemplates - { - EMSNoTemplate = 0, - EMSDefaultImageList, - EMSDefaultVideoList, - EMSDefaultMusicList, - EMSImageTemplateLatestImages, - EMSImageTemplateMyPhoneCaptures, - EMSImageTemplateLatest, - EMSImageTemplateLatestOriginals, - EMSImageTemplateCustom, - EMSVideoTemplateLatest, - EMSVideoTemplateSelectedVideos, - EMSVideoTemplateLatestEpisodes, - EMSVideoTemplateCustom, - EMSMusicTemplateRecentMusic, - EMSMusicTemplateSelectedAlbums, - EMSMusicTemplateSelectedTracks, - EMSMusicTemplateSelectedArtist, - EMSMusicTemplateRandom, - EMSMusicTemplateCustom - }; - -// Rule edit list items - -enum TMSShrinkImages - { - EMSShrinkScreenSize = 0, - EMSShrinkingOff - }; - -enum TMSMultiselectionDialog - { - EMultiSelectionListBoxId = 1 - }; - -// Queries -enum TMSQueryID - { - EMSDataQueryId = 1 - }; - -// Browse -enum TMSBrowseTarget - { - EMSStoredItems = 0, - EMSFillItems, - EMSLog - }; -#endif // MEDIASERVANT_HRH diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/mediaservantuid.h --- a/homesync/contentmanager/mediaservant/inc/mediaservantuid.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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: UID definition for Media Servant -* -*/ - - -#ifndef __MEDIASERVANTUID_H -#define __MEDIASERVANTUID_H - -// INCLUDES - -// CONSTANTS -#define KMediaServantUID3 0x1028290B // MediaServant app UID - -#endif // __MEDIASERVANTUID_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msapp.h --- a/homesync/contentmanager/mediaservant/inc/msapp.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +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: Definition for cmediaservant class -* -*/ - - -#ifndef C_CMSAPP_H -#define C_CMSAPP_H - - -// INCLUDES -#include - -/** - * CMediaServant application class. - * Provides factory to create concrete document object. - * - * @since S60 5.1 - */ -class CMediaServantApp : public CAknApplication - { - -private: - - /** - * Creates CCDSDocument document object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * Returns application's UID (KMediaServantUID3). - * @return The value of KMediaServantUID3. - */ - TUid AppDllUid() const; - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - }; - -#endif // C_CMSAPP_H - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msappui.h --- a/homesync/contentmanager/mediaservant/inc/msappui.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +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: Definition for MediaServant appui class -* -*/ - - -#ifndef C_CMSAPPUI_H -#define C_CMSAPPUI_H - -// INCLUDES -#include -#include -#include -#include - -#include "msparameteragent.h" -#include "msfillrulecontroller.h" - -// FORWARD DECLARATIONS -class CMSEngine; -class CMSStoreListController; -class CCmDriveInfo; -class CMSGSInterface; - -/** - * Application UI class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSAppUi ): public CAknViewAppUi - { - - public: - - - /** - * Destructor. - */ - ~CMSAppUi(); - - /** - * Changes active view according to parameters. - * @since S60 3.1 - * @param aOldView current view - * @param aNewView new view - */ - void ChangeViewL(const TUid& aOldView, const TUid& aNewView); - - /** - * Returns fill rule controller - * @since S60 3.1 - * @return CMSFillRuleController, controller pointer - */ - CMSFillRuleController* FillRuleController(); - - /** - * Returns store rule controller - * @since S60 5.0 - * @return CCmStoreListController, pointer to controller - */ - CMSStoreListController* StoreListController(); - - /** - * Refresh store and fill lists - * @since S60 3.1 - */ - void RefreshListsL(); - - /** - * File server session - * @since S60 3.1 - * return RFs, file server session - */ - RFs& FsSession(); - - /** - * Returns msengine - * @since S60 3.1 - * @return CMSEngine, pointer to engine - */ - CMSEngine* MSEngine(); - - /** - * Reads memory info - * @since S60 3.1 - * @param aCapasity, size of memory - * @param aFreeSpace, free space of memory - * @return TInt, error code - */ - TInt ReadMMCInfoL( TInt64& aCapasity, TInt64& aFreeSpace ); - /** - * Get Filled Files Size - * @since S60 3.1 - * @param aSize, size of filled files - * @param aID, fill rule ID - */ - void GetFilledFilesSize( TInt64& aSize, const TInt aID ); - - /** - * Returns pointer to parameter agent - * @since S60 3.1 - * @return CMSParameterAgent, parameter agent - */ - CMSParameterAgent* ParameterAgent(); - - /** - * drive selection indicator - * @since S60 3.1 - * @return TBool, ETrue if selected, EFalse otherwise - */ - TBool DriveSelectedL(); - - /** - * drive selection indicator - * @since S60 3.1 - * @return TBool, ETrue if selected, EFalse otherwise - */ - CMSGSInterface* SettingsPlugin(); - - /** - * Compares IDs of two drives - * @since S60 3.1 - * @return TBool, ETrue if match, EFalse otherwise - */ - - static TBool CompareIds( const CCmDriveInfo& aStoredDrive, - const CCmDriveInfo& aDrive ); - - /** - * Start wizard - * - * @since S60 5.1 - * @return TInt, wizard exit code - */ - TInt RunWizardL(); - -protected: - -// From base class CAknViewAppUi - - /** - * From CAknViewAppUi - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - -private: - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Checks if selected memory is on the device - * @since S60 3.1 - * @return TBool, ETrue if found, EFalse otherwise - */ - TBool MemoryAttachedL(); - - - /** - * Loads gs plugin ( settings view ) - * @since S60 3.1 - */ - void LoadSettingsPluginL(); - - /** - * Check memory selected status, if none of drives have been selected - * the mass memory will be selected as default drive - * @since S60 3.2 - */ - void CheckDrivesSelectedL(); - -private: - - /** - * view which is currently active - */ - TInt iActiveView; - /** - * focus index of main view - */ - TInt iMainFocusIndex; - /** - * pointer to application engine - */ - CMSEngine* iMSEngine; // owned - /** - * parameter class - */ - CMSParameterAgent* iParameterAgent; // owned - /** - * fill list controller - */ - CMSFillRuleController* iFillRuleController; // owned - /** - * store list controller - */ - CMSStoreListController* iStoreListController; // owned - /** - * GS plugin ( settings view ) - */ - CMSGSInterface* iPlugin; // owned - }; -#endif // C_CMSAPPUI_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msbasecontainer.h --- a/homesync/contentmanager/mediaservant/inc/msbasecontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +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: Definition for MediaServant document class -* -*/ - - - -#ifndef __MSBASECONTAINER_H__ -#define __MSBASECONTAINER_H__ - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class CEikListBox; -class CEikTextListBox; -class CEikColumnListBox; -class CEikFormattedCellListBox; -class CTextListBoxModel; -class CAknIconArray; - -// CLASS DECLARATION - -/** - * CMSBaseContainer container control class. - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSBaseContainer ): public CCoeControl - { - - public: - - /** - * CMSBaseContainer default constructor. - */ - CMSBaseContainer(); - - /** - * ~CMSBaseContainer - * Destructor. - */ - virtual ~CMSBaseContainer(); - - /** - * Shows note - * @since S60 3.1 - * @param aResource, text to be shown - * @param aError, error code - * @return None - */ - void ShowNoteL ( TInt aResource, TInt aError ); - - /** - * Sets default context pane icon - * @since S60 3.1 - * @param None - * @return None - */ - void SetDefaultContextPaneIconL(); - - protected: - - /** - * SetListBoxFromResourceL - * Sets listbox from resource using ConstructFromResourceL() of - * CEikColumnListBox class. - * @since S60 3.1 - * @param aListBox Pointer of listbox. - * @param aResourceId Resource ID of listbox. - * @return None - */ - void SetListBoxFromResourceL( - CEikColumnListBox* aListBox, - const TInt aResourceId ); - - /** - * SetListBoxFromResourceL - * Sets listbox from resource using ConstructFromResourceL() of - * CEikFormattedCellListBox class. - * @since S60 3.1 - * @param aListBox Pointer of listbox. - * @param aResourceId Resource ID of listbox. - * @return None - */ - void SetListBoxFromResourceL( - CEikFormattedCellListBox* aListBox, - const TInt aResourceId ); - - /** - * CreateScrollbarL - * Creates scrollbar. - * @since S60 3.1 - * @param aListBox Pointer of created listbox. - * @return None - */ - void CreateScrollbarL( CEikListBox* aListBox ); - - /** - * CreateFindBoxL - * Creates FindBox and returns it's pointer. - * @since S60 3.1 - * @param aListBox Pointer of listbox. - * @param aModel Pointer of model. - * @param aStyle Style of FindBox. - * @return Pointer of CAknSearchField. - */ - CAknSearchField* CreateFindBoxL( - CEikListBox* aListBox, - CTextListBoxModel* aModel, - CAknSearchField::TSearchFieldStyle aStyle ); - - /** - * Appends item to listbox array - * @since S60 3.1 - * @param aListBox, pointer of listbox - * @param aModel, listbox model - * @param aIcon, icon index with "\t" - * @param aID, skinned icon id - * @param aBitmapId, bitmap id - * @param aMaskId, bitmap mask id - * @return None - */ - void AppendItemToListBoxArrayL( CEikListBox* aListBox, - CTextListBoxModel* aModel, - TInt aIconIndex, - TDesC& aPrimaryText, - TDesC& aSecondaryText ); - - /** - * Appends item to listbox array - * @since S60 3.1 - * @param aListBox, pointer of listbox - * @param aModel, listbox model - * @param aIconIndex, icon index - * @param aItemText, text to be displayed - * @return None - */ - void AppendItemToListBoxArrayL( CEikListBox* aListBox, - CTextListBoxModel* aModel, - TInt aIconIndex, - TDesC& aItemText ); - - /** - * Loads a possibly skinned icon and adds it to icon array - * @since S60 3.1 - * @param aArray, array of icons - * @param aSkin, skin instance - * @param aMbmFile, reference to icon file - * @param aID, skinned icon id - * @param aBitmapId, bitmap id - * @param aMaskId, bitmap mask id - * @return None - */ - void AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId); - - /** - * Sets context pane icon - * @since S60 3.1 - * @param aIconBitmap, bitmap - * @param aIconmask, bitmap mask - * @return None - */ - void SetContextPaneIconL( const CFbsBitmap* aIconBitmap, - const CFbsBitmap* aIconMask ); - - private: - - /** - * control environment - */ - CCoeEnv* iCoeEnv; - }; - -#endif // __MSBASECONTAINER_H__ - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msbaseview.h --- a/homesync/contentmanager/mediaservant/inc/msbaseview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2007 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: Definition for MediaServant base view class -* -*/ - - - -#ifndef __MSBASEVIEW_H__ -#define __MSBASEVIEW_H__ - -// INCLUDES -#include - - -// FORWARD DECLARATIONS -class CAknTitlePane; -class CAknNavigationDecorator; -class CAknNavigationControlContainer; -class CMSAppUi; - -// CLASS DECLARATION - -/** -* CMSBaseView base view class. -*/ -NONSHARABLE_CLASS( CMSBaseView ) : public CAknView - { - - protected: // Constructors and destructor - - /** - * CMSBaseView - * Default constructor. - */ - CMSBaseView(); - - /** - * ~CMSBaseView - * Destructor. - */ - virtual ~CMSBaseView(); - - public: // New functions - - /** - * SetTitlePaneTextL - * Sets text by resource ID in title pane. - * @since S60 3.1 - * @param aResourceId The ID of outline number to displayed next. - */ - void SetTitlePaneTextL( const TInt aResourceId ); - - /** - * SetTitlePaneTextL - * Sets text by resource ID in title pane. - * @since S60 3.1 - * @param aText, title text - */ - void SetTitlePaneTextL( const TDesC& aText ); - - /** - * SetNavigationPaneTextL - * Sets Navigation pane text. - * @since S60 3.1 - * @param aText, text to be shown - */ - void SetNavigationPaneTextL( const TDesC& aText ); - - /** - * ClearCurrentNaviPaneText - * Clears current navi pane text - * @since S60 3.1 - */ - void ClearCurrentNaviPaneText(); - - /** - * Cancels async operation - * @Since S60 3.1 - * @param aAppUi, pointer to cmsappui class - */ - void CancelAsyncOperation( CMSAppUi* aAppUi ); - - private: - - /** - * iNaviPane - */ - CAknNavigationControlContainer* iNaviPane; // not owned - /** - * navi decorator - */ - CAknNavigationDecorator* iNaviDecorator; - }; - -#endif // __MSBASEVIEW_H__ - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msbrowsecontainer.h --- a/homesync/contentmanager/mediaservant/inc/msbrowsecontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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: Definition for MediaServant browse container class -* -*/ - - -#ifndef C_MSBROWSECONTAINER_H -#define C_MSBROWSECONTAINER_H - -// INCLUDES -#include - -#include "msbasecontainer.h" -#include "msitembrowser.h" - -// FORWARD DECLARATIONS - -class CMSAppUi; -class CMSBrowseView; - - -/** - * CMSBrowseContainer class - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSBrowseContainer ): public CMSItemBrowser - { -public: - /** - * Constructor. - */ - CMSBrowseContainer( CMSAppUi& aAppUi, CMSBrowseView& aView ); - - /** - * Destructor. - */ - virtual ~CMSBrowseContainer(); - -protected: - -// From base class CoeControl - - /** - * From CoeControl - * See base class definition - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - - /** - * From CoeControl - * See base class definition - */ - void HandleResourceChange(TInt aType); - -// From base class CMSItemBrowser - - /** - * From CMSItemBrowser - * See base class definition - */ - void GetBrowseDataL(); - -private: - - /** - * containers view - */ - CMSBrowseView* iView; // not owned - - }; - -#endif // C_MSBROWSECONTAINER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msbrowseview.h --- a/homesync/contentmanager/mediaservant/inc/msbrowseview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +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: Definition for MediaServant browse view class -* -*/ - - - - - -#ifndef C_MSBROWSEVIEW_H -#define C_MSBROWSEVIEW_H - -// INCLUDES -#include "msbaseview.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSBrowseContainer; - -/** - * CMSBrowseView view class. Main view is visible when - * application is launched - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSBrowseView ): public CMSBaseView - { - public: - /** - * Constructor. - */ - CMSBrowseView( CMSAppUi& aAppUi ); - - /** - * Symbian default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CMSBrowseView(); - - /** - * Solves title pane text by media type - * @since S60 3.2 - * @param aMediaType, mediatype - */ - void SetTitlePaneTextL( TCmMediaType aMediaType ); - - protected: - -// From base class CAknView - - /** - * From CAknView returns Uid of View - * See base class definition - */ - TUid Id() const; - - /** - * From CAknView - * See base class definition - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - - /** - * view's container - */ - CMSBrowseContainer* iContainer; // owned - }; - -#endif // C_MSBROWSEVIEW_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msconstants.h --- a/homesync/contentmanager/mediaservant/inc/msconstants.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +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: Constant definitions -* -*/ - - -#ifndef MSCONSTANTS_H -#define MSCONSTANTS_H - - -// INCLUDE FILES -#include - - -// MediaServant UIDs -const TUid KUidMediaServant = { 0x1028290B }; - -//const TInt KMSMainViewIdValue = 1; -const TUid KMSMainViewId = { 0x10282913 }; -//const TInt KMSFillViewIdValue = 2; -const TUid KMSFillViewId = { 0x10282914 }; -//const TInt KMSSettingsViewIdValue = 3; -//const TUid KMSSettingsViewId = { 0x10282915 }; -//const TInt KMSFillEditViewIdValue = 4; -const TUid KMSFillEditViewId = { 0x10282915 }; -//const TInt KMSStoreListViewIdValue = 5; -const TUid KMSStoreListViewId = { 0x10282916 }; -//const TInt KMSStoreSettingsViewIdValue = 6; -const TUid KMSStoreSettingsViewId = { 0x10282917 }; -//const TInt KMSBrowseViewIdValue = 7; -const TUid KMSBrowseViewId = { 0x10282918 }; -//const TInt KMSFillBrowseViewIdValue = 8; -const TUid KMSFillBrowseViewId = { 0x10282919 }; - -// Listbox format strings - -// Single graphic style listbox -_LIT( KSingleGraphicStyleFormatString, "%d\t%S\t%d\t" ); -// Single graphic style listbox - no trailing icons -_LIT( KSingleGraphicStyleFormatStringNoTrailIcons, "%d\t%S\t\t" ); -// Single graphic style listbox -_LIT( KSingleStyleFormatString, "\t%S\t\t" ); -// Double large graphic style listbox -_LIT( KDoubleLargeGraphicStyleFormatString, "%d\t%S\t%S\t"); -// Double large graphic style listbox (no secondary text) -_LIT(KDoubleLargeGraphicStyleFormatStringEmpty, "%d\t%S\t\t"); -// Signle graphic style lis -_LIT( KItemFormatString, "1\t%S"); - -// Icon files -_LIT( KAvkonMifFileName, "\\resource\\apps\\avkon2.mif" ); -_LIT( KMSMifFileName, "\\resource\\apps\\mediaservant.mif" ); - -// TITLE PANE -// CONSTANTS -const TInt KMSTitleBufLength = 256 ; // for lenght. -const TInt KMSDefaultTitleId = 0; - -// Setting item secondary text delimiter -_LIT( KDelimiter, ","); - -// Time format strings -_LIT(KDefaultFromDate, "19000000:000000.000000"); // 01.01.1900 - -// File sizes -const TInt KMSSize_0_MB = 0; -const TInt KMSSize_1_MB = KMega; -const TInt KMSSize_5_MB = 5*KMega; -const TInt KMSSize_10_MB = 10*KMega; -const TInt KMSSize_50_MB = 50*KMega; - -// Track lengths [s] -const TInt KMSTrackLength_0_min = 0; -const TInt KMSTrackLength_1_min = 60; -const TInt KMSTrackLength_6_min = 360; -const TInt KMSTrackLength_8_min = 480; -const TInt KMSTrackLength_30_min = 1800; - -// Listbox tabulator defitions -_LIT(KSlashT, "\t"); -_LIT(KZeroSlashT, "0\t"); -_LIT(KSPaceT, " "); - - -// Array granularities -const TInt KMetadataArrayGranularity = 5; - -// Default quota size [%] -const TInt KHDDefaultQuota = 75; -const TInt KMMCDefaultQuota = 90; - -// Default fill list size [MB] -const TInt KDefaultListSize50 = 50; -const TInt KDefaultListSize200 = 200; - -// Server statuses -const TUint KServerNotActive = 0; -const TUint KServerActive = 1; -const TUint KServerRemoved = 2; - -// Settings plugin -const TUid settinsPluginUid = { 0x10282912 }; - -#endif // MSCONSTANTS_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msdocument.h --- a/homesync/contentmanager/mediaservant/inc/msdocument.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +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: Definition for MediaServant document class -* -*/ - - -#ifndef C_CMSDOCUMENT_H -#define C_CMSDOCUMENT_H - - -// INCLUDES -#include - -/** - * CMSDocument application class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSDocument ) : public CAknDocument - { - - public: - - /** - * Two-phased constructor. - */ - static CMSDocument* NewL( CEikApplication& aApp ); - - /** - * Two-phased constructor. - */ - static CMSDocument* NewLC( CEikApplication& aApp ); - - /** - * Destructor. - */ - virtual ~CMSDocument(); - - private: - - /** - * Symbian default constructor. - */ - CMSDocument( CEikApplication& aApp ); - - /** - * Symbian second phase constructor can leave. - */ - void ConstructL(); - -// From base class CEikDocument - - /** - * From CEikDocument - * See base class definition - */ - CEikAppUi* CreateAppUiL(); - }; - -#endif // C_CMSDOCUMENT_H - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msfillbrowsecontainer.h --- a/homesync/contentmanager/mediaservant/inc/msfillbrowsecontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +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: Definition for MediaServant fill list browse container class -* -*/ - - -#ifndef C_MSFILLBROWSECONTAINER_H -#define C_MSFILLBROWSECONTAINER_H - -// INCLUDES -#include - -#include "msengineobserver.h" -#include "msbasecontainer.h" -#include "msitembrowser.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSFillBrowseView; -class CCmFillRule; - - -/** - * CMSFillBrowseContainer class - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillBrowseContainer ): public CMSItemBrowser, - public MMSEngineObserver - { - public: - - /** - * Default constructor. - */ - CMSFillBrowseContainer( CMSAppUi& aAppUi, - CMSFillBrowseView& aView ); - - /** - * Destructor. - */ - virtual ~CMSFillBrowseContainer(); - - /** - * Randomizes list - * @since S60 5.1 - * @param None - * @return None - */ - void RandomizeListL(); - - /** - * Checks if current list has random rule - * @since S60 5.1 - * @param None - * @return TBool, ETrue if random rule exists - */ - TBool HasListRandomRule(); - - /** - * Sets file statuses - * @Since S60 5.1 - * @param None - * @return None - */ - void SetFileStatusesL(); - - /** - * Sets status of files - * @param aStatus, file status - * @return None - */ - void SetStatusOfFiles( TCmListItemStatus aStatus ); - - protected: - -// From base class MMSEngineObserver - - /** - * From MMSEngineObserver - * See base class definition - */ - void ReadyL( TCmService aService, TInt aError ); - -// From base class CoeControl - - /** - * From CoeControl - * See base class definition - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - -// From base class CMSItemBrowser - - /** - * Gets browse data from server - * See base class definition - */ - void GetBrowseDataL(); - - private: - - /** - * Detects the KEikDynamicLayoutVariantSwitch - * message and re-layouts controls from this. - * @since S60 5.1 - * @param aType, change type - * @return None - */ - void HandleResourceChange(TInt aType); - - /** - * Checks if file status has been changed - * @Since S60 5.1 - * @param None - * @return TBool, ETrue if changed, EFalse otherwise - */ - TBool CheckIfStatusChanged(); - - /** - * Creates and sets navi pane text - * @Since S60 5.1 - * @param aCount, item count - * @param aSize, list size - * @return None - */ - void CreateAndSetNaviPaneTextL( TUint32 aCount, TUint32 aSize ); - - private: - /** - * selected rule - */ - CCmFillRule* iRule; // not owned - /** - * containers view - */ - CMSFillBrowseView* iView; // not owned - /** - * array of item status - * list order can't be changed so we don't have to copy - * whole item - */ - RArray iStatusArray; - - }; - - - -#endif // C_MSFILLBROWSECONTAINER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msfillbrowseview.h --- a/homesync/contentmanager/mediaservant/inc/msfillbrowseview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +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: Definition for MediaServant browse view class -* -*/ - - - - - -#ifndef C_MSFILLBROWSEVIEW_H -#define C_MSFILLBROWSEVIEW_H - -// INCLUDES -#include // listbox observer -#include "msbaseview.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSFillBrowseContainer; - -/** - * CMSBrowseView view class. Main view is visible when - * application is launched - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillBrowseView ) : public CMSBaseView - { - public: - /** - * Constructor. - */ - CMSFillBrowseView( CMSAppUi& aAppUi ); - - /** - * Symbian default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CMSFillBrowseView(); - - protected: - -// From base class CAknView - - /** - * From CAknView returns Uid of View - * See base class definition - */ - TUid Id() const; - - /** - * From CAknView activate the view - * See base class definition - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - /** - * From MEikMenuObserver - * See base class definition - */ - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - /** - * view's container - */ - CMSFillBrowseContainer* iContainer; // owned - /** - * Marked item indexes - */ - const CListBoxView::CSelectionIndexArray* iSelections; // not owned - }; - -#endif // C_MSFillBROWSEVIEW_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msfillcontainer.h --- a/homesync/contentmanager/mediaservant/inc/msfillcontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,323 +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: Definition for MediaServant fill list container class -* -*/ - - -#ifndef C_MSFILLCONTAINER_H -#define C_MSFILLCONTAINER_H - -// INCLUDES -#include -#include "msbasecontainer.h" -#include "mediaservant.hrh" - -// FORWARD DECLARATIONS -class CAknColumnListBox; -class CAknIconArray; -class CMSAppUi; -class CCmFillRule; -class CMSFillRuleController; -class CMSFillView; -class CMSFillList; - -/** - * CMSFillContainer class - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillContainer ): public CMSBaseContainer - { - private: - - // icon enumerations - enum TMSListBoxIcons - { - EMSSelectedFits = 0, - EMSUnselectedFits, - EMSSelectedPartiallyFits, - EMSUnselectedPartiallyFits, - EMSSelectedDoesntFit, - EMSUnSelectedDoesntFit, - EVideoType, - EImageType, - EAudioType, - EMark, - EIconCount - }; - - public: - - /** - * Constructor. - */ - CMSFillContainer( CMSAppUi& aAppUi, CMSFillView& aView ); - - /** - * Symbian default constructor. - */ - void ConstructL( TRect aRect ); - - /** - * Destructor. - */ - virtual ~CMSFillContainer(); - - /** - * Updates listbox data - * @since S60 5.1 - */ - void UpdateListBoxDataL(); - - /** - * sets fill rule activity - * @since S60 5.1 - */ - void SetFillRules(); - - /** - * Highlighted item index - * @since S60 5.1 - * @return TInt, highlighted item index - */ - TInt SelectedItemIndex(); - - /** - * Count of list items - * @since S60 5.1 - * @return TInt, item count - */ - TInt ListItemCount(); - - /** - * Sets reorder mode states - * @since S60 5.1 - * @param aState, reordering state - */ - void SetReorderStateL( TMSReorderState aState ); - - /** - * Deletes current rule - * @since S60 5.1 - */ - void DeleteRuleL(); - - /** - * Checks if the list already have rule with this name - * @since S60 5.1 - * @param aName, rule name - * @TInt number of dublicates - */ - TInt CheckIfDublicateNames( const TDesC& aName ); - - /** - * Toggles list item - * @since S60 5.1 - */ - void ChangeListActivityL(); - - /** - * Checks if item is selected - * @since S60 5.1 - * @return TBool, ETrue if activated - */ - TBool IsCurrentListItemActive(); - - /** - * Checks if user has changed list selections - * @since S60 5.1 - * @return TBool, ETrue if changed - */ - TBool HasListSelectionsChanged(); - - /** - * Updates fill list size on navi pane - * @since S60 5.1 - */ - void UpdateNaviTextL(); - - /** - * Checks if list(s) have been deleted - * @since S60 5.1 - * @return TBool, ETrue if deleted, EFalse otherwise - */ - TBool IsListDeleted(); - - /** - * Handles pointer event on touchscreen - * @param aPointerEvent, touchscreen key event - */ - void HandlePointerEventL ( const TPointerEvent& aPointerEvent ); - - protected: - -// From base class CCoeControl - - /** - * From CoeControl - * See base class definition - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - - /** - * From CoeControl - * See base class definition - */ - CCoeControl* ComponentControl(TInt aIndex) const; - - /** - * From CoeControl - * See base class definition - */ - TInt CountComponentControls() const; - - /** - * From CoeControl - * See base class definition - */ - void SizeChanged(); - - /** - * From CoeControl - * See base class definition - */ - void HandleResourceChange(TInt aType); - - /** - * From CoeControl - * See base class definition - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** - * From CoeControl - * See base class definition - */ - void HandleDragAndDropEventsL( const TPointerEvent& aPointerEvent ); - - private: - - - /** - * Handles up/down keys during reordering - * @since S60 5.1 - * @param aKeyEvent Key event. - * @param aType Type of key event( EEventKey, EEventKeyUp or - * EEventKeyDown ). - */ - TKeyResponse HandleReorderKeyEventL(const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** - * Moves item on the list - * @since S60 5.1 - * @param aDirection, moving direction - */ - void MoveItem( TInt aDirection ); - - /** - * Sets rule activity according to checkbox states on the list - * @since S60 5.1 - */ - void StoreSelectionStatus(); - - /** - * Gets icon for the list - * @since S60 5.1 - * @param aListName, name of the list - * @param aIndex, item index - * @param aListSize, list size in bytes - */ - TInt ListItemIconIndex( TInt aIndex, - TInt64 aListSize, - TInt64& aFreeSpace ); - - /** - * Calculates fill quota based on selected drives - * @since S60 5.1 - */ - void CalculateFillQuotaL(); - - private: - - /** - * Listbox control - */ - CAknColumnListBox* iListBox; - /** - * Pointer to application ui - */ - CMSAppUi& iMSAppUi; // not owned - /** - * Reorder state - */ - TMSReorderState iReorderState; - /** - * Pointer array to rules - */ - RPointerArray* iFillListArray; // not owned - /** - * Fill rule controller - */ - CMSFillRuleController* iFillRuleController;// not owned - /** - * Parent view - */ - CMSFillView& iView; - /** - * Size of selected lists - */ - TInt64 iSizeOfSelectedLists; - /** - * Selected items on view activation - */ - RArray iSelectedLists; - /** - * Context pane icon - */ - CFbsBitmap* iIcon; // not owned - /** - * Context pane icon mask - */ - CFbsBitmap* iIconMask; // not owned - /** - * Selection indexes - */ - const CListBoxView::CSelectionIndexArray* - iSelectedIndexes; // not owned - /** - * MMC free space ( for navi pane text ) - */ - TInt64 iFreeMemory; - /** - * MMC quota ( set by user ) - */ - TInt64 iQuota; - /** - * List delete flag - */ - TBool iListDeleted; - /** - * Previous listbox selection - */ - TInt iPreviousItemIndex; - /** - * Index of an item that is dragged - */ - TInt iDragItemIndex; - }; - -#endif // C_MSMAINCONTAINER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msfillrulecontroller.h --- a/homesync/contentmanager/mediaservant/inc/msfillrulecontroller.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +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: Definition for MediaServant fill list controller class -* -*/ - - - - - -#ifndef C_MSFILLRULECONTROLLER_H -#define C_MSFILLRULECONTROLLER_H - -// INCLUDES -#include -#include "cmcommontypes.h" - - -// FORWARD DECLARATIONS -class CMSEngine; -class CCmFillRuleContainer; -class CCmFillRule; -class CMSFillList; - -/** - * CMSFillRuleController class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillRuleController ): public CBase - { - public: - - /** - * two-phase constructor. - */ - static CMSFillRuleController* NewL( CMSEngine& aMSEngine ); - - /** - * two-phase constructor. - */ - static CMSFillRuleController* NewLC( CMSEngine& aMSEngine ); - - /** - * Destructor. - */ - virtual ~CMSFillRuleController(); - - /** - * Returns rule pointer array - * @since S60 5.1 - * @return RPointerArray, pointer array - */ - RPointerArray* FillListArray(); - - /** - * Initialises container - * @since S60 5.1 - */ - void InitializeRuleContainersL(); - - /** - * Creates default fill lists - * @since S60 5.1 - */ - void CreateFillRulesL(); - - /** - * Deletes current rule - * @since S60 5.1 - * @param TInt, index to be deleted - */ - void DeleteRuleL( TInt aCurrentIndex ); - - /** - * Adds new rule - * @since S60 5.1 - * @param aRule, new fill rule - */ - void AddRuleL( CCmFillRule* aRule ); - - /** - * Changes priorites of two rules - * @since S60 5.1 - * @param aTotalItem, items on the list - * @param aCurrentItem, selected item - * @param aDirection, move direction - */ - void ChangePriority( TUint aTotalItem, - TUint aCurrentItem, - TInt aDirection ); - - /** - * Saves rules to server - * @since S60 5.1 - */ - void SaveRulesL(); - - /** - * Reads rule container and recreates rule array - * @since S60 5.1 - */ - void UpdateArrayL(); - - /** - * Checks priority changes - * @since S60 5.1 - * @return TBool, ETrue if changed, EFalse otherwise - */ - TBool HasPriorityChangedL(); - - /** - * Checks activity changes - * @since S60 5.1 - * @param aStatus, status to be checked - * @return TBool, ETrue if changed, EFalse otherwise - */ - TBool HasSelectionsChanged( TCmFillRuleStatus aStatus ); - - /** - * Restores original list selections - * @since S60 5.1 - */ - void RestoreOriginalSelections(); - - private: - - /** - * Constructor. - */ - CMSFillRuleController( CMSEngine& aMSEngine ); - - /** - * ConstructL - * Second phase constructor. - */ - void ConstructL(); - - /** - * Sets priorities of rules (if deleted or added) - * @since S60 5.1 - */ - void SetPriorities(); - - /** - * Sort function that arranges pointers by rule priority - * @since S60 5.1 - * @param rule1, rule to be sorted - * @param rule2, rule to be sorted - */ - static TInt compare ( const CMSFillList& rule1, - const CMSFillList& rule2); - - - private: - - /** - * pointer to application engine - */ - CMSEngine* iMSEngine; // not owned - /** - * Fill rules - */ - CCmFillRuleContainer* iRuleContainer; // owned - /** - * Pointer array to fillrules - */ - RPointerArray iFillListArray; // owned - - }; - - - -/**************** FILL LIST CLASS ******************/ - - -/** - * CMSFillList class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillList ) : public CBase - { - public: - - /** - * NewL - * 2-phase constructor. - */ - static CMSFillList* NewL( CMSEngine& aMSEngine, - CCmFillRule& aFillList ); - - /** - * NewL - * 2-phase constructor. - */ - static CMSFillList* NewLC( CMSEngine& aMSEngine, - CCmFillRule& aFillList ); - - /** - * Destructor. - */ - virtual ~CMSFillList(); - - /** - * Fill list - * @since S60 5.1 - * @return CCmFillRule, fill list - */ - CCmFillRule* List(); - - /** - * List Size - * @since S60 5.1 - * @return TUint32, List size in bytes - */ - TUint32 ListSize(); - - /** - * List's item count - * @since S60 5.1 - * @return TUint64, item count - */ - TUint32 ItemCount(); - - /** - * Priority - * @since S60 5.1 - * @return TInt, List priority - */ - TInt Priority() const; - - /** - * Original selection status - * @since S60 5.1 - * @return TCmFillRuleStatus, selection status - */ - TCmFillRuleStatus OriginalSelectionStatus(); - - private: - - /** - * Constructor. - */ - CMSFillList( CMSEngine& aMSEngine, CCmFillRule& aFillList ); - - /** - * ConstructL - * Second phase constructor. - */ - void ConstructL(); - - private: - /** - * Fill list size ( in bytes ) - */ - TUint32 iListSize; - /** - * List item count - */ - TUint32 iItemCount; - /** - * MS Engine - */ - CMSEngine* iMSEngine; // not owned - /** - * Fill list - */ - CCmFillRule* iFillList; // not owned - /** - * Original selection state - */ - TCmFillRuleStatus iSelected; - }; -#endif // C_MSFILLRULECONTROLLER_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msfillruleeditlist.h --- a/homesync/contentmanager/mediaservant/inc/msfillruleeditlist.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,569 +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: Definition for MediaServant fill rule editor class -* -*/ - - -#ifndef C_MSFILLRULEEDITLIST_H -#define C_MSFILLRULEEDITLIST_H - -// INCLUDES -#include - -#include "cmcommontypes.h" -#include "msengineobserver.h" -#include "msparameteragent.h" -#include "mediaservant.hrh" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSFillRuleEditView; -class CCmFillRuleContainer; -class CCmFillRule; -class CCmMediaServerFull; -class CSelectionItemList; -class CMSMetadataCollector; -class CCmSqlPropertyContainer; - -// CLASS DECLARATION - -/** - * CMSFillRuleEditList general class. This class is used to - * create setting items to several setting item lists. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillRuleEditList ): public CAknSettingItemList, - public MMSEngineObserver - { - // process states - enum TMSFillStates - { - EMSIdle = 0, - EMSFillPreprocess, - EMSFetchMetadata - }; - - public: // Constructor and destructor - - /** - * two-phase constructor. - */ - static CMSFillRuleEditList* NewL( CMSAppUi& aAppUi, - CMSFillRuleEditView& aView ); - - /** - * two-phase constructor. - */ - static CMSFillRuleEditList* NewLC( CMSAppUi& aAppUi, - CMSFillRuleEditView& aView ); - - /** - * Destructor. - */ - virtual ~CMSFillRuleEditList(); - - /** - * Opens the selected listbox item - * @since S60 5.1 - */ - void OpenSelectedListboxItemL(); - - /** - * Removes rule - * @since S60 5.1 - */ - void RemoveCurrentRuleL(); - - /** - * Tests if rule is additional - * @since S60 5.1 - * @return TBool, ETrue if additional - */ - TBool IsCurrentRuleAdditional(); - - /** - * List media type - * @since S60 5.1 - * @return TCmMediaType, media type of the list - */ - TCmMediaType ListMediaType(); - - /** - * List media type - * @since S60 5.1 - * @param aName name of fill rule - * @return TBool, whether names are same - */ - TBool CheckSameNameL( const TDesC& aName ) const; - -// From base class CAknSettingItemList - - /** - * From CAknSettingItemList - * See base class definition - */ - void ActivateL(); - - protected: - -// From base class CAknSettingItemList - - /** - * From CAknSettingItemList - * See base class definition - */ - CAknSettingItem* CreateSettingItemL( TInt aSettingId ); - - /** - * From CAknSettingItemList - * See base class definition - */ - void HandleListBoxEventL ( CEikListBox *aListBox, - TListBoxEvent aEventType); - - /** - * From CAknSettingItemList - * See base class definition - */ - void EditItemL (TInt aIndex, TBool aCalledFromMenu); - -// From base class CCoeControl - - /** - * From CCoeControl - * See base class definition - */ - void SizeChanged(); - - /** - * From CCoeControl - * See base class definition - */ - void HandleResourceChange( TInt aType ); - - /** - * From CCoeControl - * See base class definition - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - -// From base class MMSEngineObserver - - /** - * From MMSEngineObserver - * See base class definition - */ - void ReadyL( TCmService aService, TInt aError ); - - private: - - /** - * Reads rules associated to the template - * @since S60 5.1 - * @param aTemplate, Template ID - */ - void ReadTemplateRulesL( TInt aTemplate ); - - /** - * Adds fill rule to the list - * @since S60 5.1 - */ - void AddFillRuleL(); - - /** - * Sets default value defined by template - * @since S60 5.1 - * @param aId, setting id - * @param aValue, default value - */ - void SetDefaultValue( TInt aId, TInt aValue ); - - /** - * Sets list type - * @since S60 5.1 - * @param aType, command id - */ - void SetListType( TInt aType ); - - /** - * Get values for the setting list - * @since S60 5.1 - */ - void GetRuleValuesL(); - - /** - * Deletes rule - * @since S60 5.1 - * @param aField, metadatafield to be deleted - */ - void DeleteRule( TCmMetadataField aField ); - - /** - * Get values for the setting list - * @since S60 5.1 - * @param aField, metadatafield to be deleted - * @param aType, operator - */ - void DeleteRule( TCmMetadataField aField, TCmOperatorType aType ); - - /** - * Adds additinal rules to fill list - * @since S60 5.1 - * @param aArray, item array - * @param aField, metadatafield to be added - * @param aOperator, operator type - */ - void AddAdditionalRuleL( CDesCArray* aArray, - TCmMetadataField aField, - TCmOperatorType aOperator ); - - /** - * Adds additinal rules to fill list - * @since S60 5.1 - * @param aArray, item array - * @param aField, metadatafield to be added - * @param aOperator, operator type - */ - void AddAdditionalRuleL( RArray& aArray, - TCmMetadataField aField, - TCmOperatorType aOperator ); - - /** - * Adds additinal rules to fill list - * @since S60 5.1 - * @param aArray, item array - * @param aField, metadatafield to be added - * @param aOperator, operator type - */ - void AddAdditionalRuleL( TCmMetadataField aMetadataField, - TCmOperatorType aOperator, - TInt aValue ); - - /** - * Appends item to the list - * @since S60 5.1 - * @param aArray, item array - * @param aParam, item - */ - void AppendItemToListL( RArray* aArray, TInt aParam ); - - /** - * Sets audio file size selection - * @since S60 5.1 - */ - void SetAudioFileSizeSelection(); - - /** - * Sets audio file size selection - * @since S60 5.1 - */ - void SaveTrackFileSizeL(); - - /** - * Sets audio file duration selection - * @since S60 5.1 - */ - void SetAudioFileDurationSelection(); - - /** - * Sets audio file size selection - * @since S60 5.1 - */ - void SaveTrackDurationL(); - - /** - * Sets modified additional rules visible - * @since S60 5.1 - */ - void DisplayModifiedAdditionalRules(); - - /** - * Searches item from the list be item ID - * @since S60 5.1 - * @param aId, item id - * @return CAknSettingItem, item pointer - */ - CAknSettingItem* SearchItemById( TMSFillEditItems aId ); - - /** - * Sets shrinking status to image list - * @since S60 5.1 - */ - void SetShrinkingStatus(); - - /** - * Initializes parameters - * @since S60 5.1 - */ - void InitializeValues(); - - /** - * Sets navi pane text - * @since S60 5.1 - */ - void CreateAndSetNaviPaneTextL(); - - /** - * Saves values to rule container - * @since S60 5.1 - */ - void SaveValueL( CAknSettingItem* aItem ); - - /** - * Checks current item setting page acceptance - * @since S60 5.1 - * @param aItem, edited item - * @return TBool, ETrue if accepted EFalse if cancelled - */ - TBool CheckSettingPageAcceptance( CAknSettingItem* aItem ); - - /** - * Constructs setting list and starts getting data from server - * @since S60 5.1 - */ - void ConstructListAndStartDataReadingL(); - - /** - * Starts list preprocessing - * @since S60 5.1 - */ - void PreprocessListL(); - - /** - * Saves list values from visible setting items - * @since S60 5.1 - */ - void SaveListValuesL(); - - /** - * Creates selection list for server setting - * @since S60 5.1 - */ - void CreateServerSettingListL(); - - /** - * Adds selected servers to rule - * @since S60 5.1 - */ - void HandleServerSelectionL(); - - /** - * Deletes servers from rule - * @since S60 5.1 - */ - void DeleteAllServersFromRuleL(); - - /** - * Saves and preprocesses list - * @since S60 5.1 - * @param aItem, item to be processed - */ - void SaveAndPreprocesslistL( CAknSettingItem* aItem ); - - /** - * Gets mediaservers and removes not active servers - * @since S60 5.1 - */ - void GetServersAndCheckActivityL(); - - /** - * Updates multiselection setting items - * @since S60 5.1 - */ - void UpdateSettingItemsL(); - - /** - * Handles list name change - * @since S60 5.1 - * @param aItem, name setting item - */ - void HandleListNameL( CAknSettingItem* aItem ); - - private: - - /** - * ConstructL - * Second phase constructor. - * @param aAppUi : application ui reference - * @param aView : view reference - */ - void ConstructL( CMSAppUi& aAppUi, - CMSFillRuleEditView& aView ); - - /** - * Constructor. - */ - CMSFillRuleEditList(); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - /** - * amount of files - */ - TInt iAmount; - /** - * servers - */ - TBuf iSettingText; - /** - * pointer to view - */ - CMSFillRuleEditView* iView; // not owned - /** - * Fill rule - */ - CCmFillRule* iRule; // not owned - /** - * MediaServers - */ - RPointerArray* iServers; //owned - /** - * Image shrinking - */ - TMSShrinkImages iShrinkImages; - /** - * Starting with setting - */ - TInt iStartWith; - /** - * date from - */ - TTime iDateFrom; - /** - * date until - */ - TTime iDateUntil; - /** - * free text - */ - TBuf iFreeText; - /** - * list name - */ - TBuf iListName; - /** - * rule template - */ - TMSTemplate iRuleTemplate; - /** - * array of visible rules - */ - RArray iVisibleRules; - /** - * limit type (pieces or MBs ) - */ - TCmLimitType iLimitType; - /** - * Dummy text buffer for "Add more rules" - */ - TBuf<10> iDummyText; - /** - * Track lenght - */ - TInt iTrackLengthEnum; - /** - * Track lenght - */ - TInt iMinTrackLength; - /** - * Track lenght - */ - TInt iMaxTrackLength; - /** - * File size - */ - TInt iFileSize; - /** - * File size enumeration - */ - TInt iFileSizeEnum; - /** - * Min file size - */ - TInt iMinFileSize; - /** - * Min file size set - */ - TInt iMinFileSizeSet; - /** - * Max file size - */ - TInt iMaxFileSize; - /** - * Max file size set - */ - TInt iMaxFileSizeSet; - /** - * Previously selected rule identifier - */ - TInt iPreviousRuleIdentifier; - /** - * array of metadata video titles - */ - CCmSqlPropertyContainer* iMetadataTitles; //owned - /** - * Selected video title array - */ - RArray iVideoTitleArray; //owned - /** - * Selected artist array - */ - RArray iArtistArray; //owned - /** - * Selected genre array - */ - RArray iGenreArray; //owned - /** - * Selected album array - */ - RArray iAlbumArray; //owned - /** - * Selected track array - */ - RArray iTrackArray; //owned - /** - * List media type - */ - TCmMediaType iMediaType; - /** - * New list indicator - */ - TBool iNewList; - /** - * Metadata request state - */ - TMSFillStates iState; - /** - * Selected list index from CMSFillView - */ - TInt iSelectedList; - /** - * setting page item array (servers) - */ - CSelectionItemList* iServerArray; // owned - /** - * metadata collector - */ - CMSMetadataCollector* iMetadataCollector; // owned - }; - -#endif // C_MSFILLRULEEDITLIST_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msfillruleeditview.h --- a/homesync/contentmanager/mediaservant/inc/msfillruleeditview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +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: Definition for MediaServant Fill rule edit view class -* -*/ - - - - - -#ifndef C_MSFILLRULEEDITVIEW_H -#define C_MSFILLRULEEDITVIEW_H - -// INCLUDES -#include "msengineobserver.h" -#include "msbaseview.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSEngine; -class CMSFillRuleEditList; - -/** - * CMSFillRuleEditView class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillRuleEditView ): public CMSBaseView - { - - public: - - /** - * Constructor. - */ - CMSFillRuleEditView( CMSAppUi& aAppUi ); - - /** - * Default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CMSFillRuleEditView(); - - /** - * Function shows a template query - * - * @since S60 5.1 - * @param aResourceId, Query id - * @param aQueryHeading, Query header id - * @param aRuleNames, Query rule names - * @param aSelected, Selected rule index - * @return TInt, returns ETrue, if an item has been selected, - * EFalse, if query has been cancelled - */ - TBool ShowTemplateQueryL( TInt aResourceId, - TInt aQueryHeading, - CDesCArray* aRuleNames, - TInt &aSelected ); - - /** - * Function shows a query - * - * @since S60 5.1 - * @param aResourceId, Query id - * @return TInt, returns ETrue, if yes has been selected, - * otherwise EFalse - */ - TBool ShowQueryL( TInt aResourceId ); - - protected: - -// From base class CAknView - - /** - * From CAknView - * See base class definition - */ - TUid Id() const; - - /** - * From CAknView - * See base class definition - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - /** - * From MEikMenuObserver - * See base class definition - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - /** - * Views container class - */ - CMSFillRuleEditList* iContainer; // owned - /** - * application engine - */ - CMSEngine* iMSEngine; // not owned - }; - -#endif // C_MSFILLRULEEDITVIEW_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msfillview.h --- a/homesync/contentmanager/mediaservant/inc/msfillview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +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: Definition for MediaServant Fill List view class -* -*/ - - - - - -#ifndef C_MSFILLVIEW_H -#define C_MSFILLVIEW_H - -// INCLUDES -#include "msengineobserver.h" -#include "msbaseview.h" - - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSFillContainer; -class CMSEngine; - -/** - * CMSFillView class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSFillView ): public CMSBaseView, - public MMSEngineObserver - { - - public: - - /** - * Constructor. - */ - CMSFillView( CMSAppUi& aAppUi ); - - /** - * default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CMSFillView(); - - /** - * ListBox focus index - * @since S60 5.1 - * @return TInt, focus index - */ - TInt FocusIndex() const; - - /** - * Changes cba according to selection status - * @since S60 3.2 - * @param aSelected, ETrue if selected - */ - void SetCbaL( TBool aSelected ); - - /** - * Shows 'updating lists' text on navi pane - * @Since S60 5.1 - */ - void ShowNaviTextL(); - - /** - * Sets iListUnSelected if selections changed - * @Since S60 5.1 - */ - void SetListUnselected(); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - protected: - -// From base class CAknView - - /** - * From CAknView - * See base class definition - */ - TUid Id() const; - - /** - * From CAknView - * See base class definition - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - -// From base class MMSEngineObserver - - /** - * From MMSEngineObserver - * See base class definition - */ - void ReadyL( TCmService aService, TInt aError ); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - * See base class definition - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - private: - - /** - * Opens template query - * @Since S60 5.1 - * @param aCommand, template type - */ - void ShowTemplateQueryL( TInt aCommand ); - - /** - * Shows delete filled files query - * @Since S60 5.1 - */ - void DoDeleteQueryL(); - - /** - * Checks if priority or activity has been changed - * @Since S60 5.1 - */ - void CheckAndHandleChangesL(); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - /** - * Views container - */ - CMSFillContainer* iContainer; // owned - /** - * Focus index - */ - TInt iFocusIndex; - /** - * Next view id - */ - TUid iNextView; - /** - * flag for list selection changes - */ - TBool iNewListSelected; - /** - * flag for list selection changes - */ - TBool iListUnSelected; - }; - -#endif // C_MSFILLVIEW_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msitembrowser.h --- a/homesync/contentmanager/mediaservant/inc/msitembrowser.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +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: Definition for MediaServant item browser base class -* -*/ - - - -#ifndef C_MSITEMBROWSER_H -#define C_MSITEMBROWSER_H - -// INCLUDES -#include -#include "cmcommon.h" // service types -#include "cmcommontypes.h" -#include "msbasecontainer.h" - -// FORWARD DECLARATIONS -class CAknIconArray; -class CMSAppUi; -class CCmBaseListItem; - -/** - * CMSItemBrowser class - * @since S60 5.1 - */ -class CMSItemBrowser : public CMSBaseContainer, - public MEikListBoxObserver - { - // Icon enumerations - enum TMSListBoxIcons - { - EMarkIcon = 0, - EIconImage, - EIconAudio, - EIconVideo, - EIconCount - }; - - public: - - /** - * Symbian default constructor. - */ - void ConstructL( TRect aRect ); - - /** - * Destructor - */ - virtual ~CMSItemBrowser(); - - /** - * Sets current file status - * @since S60 5.1 - * @param aIndex, item index - * @param TCmListItemStatus, file status - */ - void SetFileStatus( TInt aIndex, TCmListItemStatus aStatus ); - - /** - * Gets current file status - * @since S60 5.1 - * @param aIndex, item index - * @return TCmListItemStatus, file status - */ - TCmListItemStatus FileStatus( TInt aIndex ); - - /** - * Return pointer to listbox - * @since S60 5.1 - * @return CEikListbox, listbox - */ - CEikListBox* ListBox(); - - protected: - - /** - * Updates listbox data - * @since S60 5.1 - */ - void UpdateListBoxDataL(); - - /** - * Gets browse data from server - * @since S60 5.1 - */ - virtual void GetBrowseDataL() = 0; - -// From base class CCoeControl - - /** - * From CCoeControl - * See base class definition - */ - CCoeControl* ComponentControl(TInt aIndex) const; - - /** - * From CCoeControl - * See base class definition - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl - * See base class definition - */ - void SizeChanged(); - - /** - * From CCoeControl - * See base class definition - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - -// From base class MEikListBoxObserver - - /** - * From MEikListBoxObserver - * See base class definition - */ - void HandleListBoxEventL( - CEikListBox* aListBox, - TListBoxEvent aEventType ); - - protected: - - /** - * Listbox control - */ - CEikFormattedCellListBox* iListBox; // owned - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - /** - * Item array - */ - RPointerArray* iItemArray; - /** - * Internal array for listbox item texts - */ - CDesCArrayFlat* iInternalItemArray; - /** - * Next item index for thumbnail loading - */ - TInt iNextItemIndex; - /** - * Icon count for thumbnails - */ - TInt iIconCount; - /** - * Mediatype of selected rule - */ - TCmMediaType iMediaType; - }; - -#endif // C_MSITEMBROWSER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msmaincontainer.h --- a/homesync/contentmanager/mediaservant/inc/msmaincontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,374 +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: Definition for MediaServant main container class -* -*/ - - -#ifndef C_MSMAINCONTAINER_H -#define C_MSMAINCONTAINER_H - -// INCLUDES -#include -#include // listbox observer -#include "cmcommon.h" // service types -#include "msengineobserver.h" -#include "msbasecontainer.h" -#include "mspropertywatcher.h" -#include "msmemorycardmonitor.h" //mmc event observer - -// FORWARD DECLARATIONS -class CAknIconArray; -class CMSAppUi; -class CMSEngine; -class MMSEngineObserver; -class CMSMainView; - - -/** - * CMSMainContainer class - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSMainContainer ): public CMSBaseContainer, - public MEikListBoxObserver, - public MMSEngineObserver, - public MMSPropertyObserver, - public MMSMemoryCardObserver - { - // Icon enumerations - enum TMSListBoxIcons - { - EIconSync = 0, - EIconSyncStop, - EIconToHome, - EIconToHomeInactive, - EIconFromHome, - EIconFromHomeInactive, - EIconCount - }; - // Synchronization states - enum TMSSyncState - { - ESyncNotRunning = 0, - ESyncRunning, - ESyncWaiting - }; - - // Update steps - enum TMSUpdateStep - { - EFirstStep = 0, - ESecondStep, - EThirdStep, - EForthStep, - EEndStep - }; - - public: - /** - * Constructor. - */ - CMSMainContainer( CMSAppUi& aAppUi, - CMSMainView& aView ); - - /** - * Symbian default constructor. - */ - void ConstructL( TRect aRect ); - - /** - * Destructor. - */ - virtual ~CMSMainContainer(); - - /** - * sets manual wizard execution info - * @param appWizardRun, wizard executed - * @since S60 5.1 - */ - void SetManualWizardInfo( TBool aAppWizardRun ); - - /** - * Shows refresh indiction on navi pane - * @since S60 5.1 - */ - void ShowRefreshIndicationL(); - - /** - * sets refresh state - * @since S60 5.1 - */ - void StopRefreshL(); - - /** - * return highlighted item index - * @since S60 5.1 - */ - TInt SelectedItemIndex(); - - /** - * Opens the selected listbox item - * @since S60 5.1 - */ - void OpenSelectedListboxItemL(); - - /** - * Starts asynchronous metadata delete - * @since S60 5.1 - */ - void StartMetadataDeleteL(); - - void RunHarvest(); - // From base class MMSMemoryCardObserver - - /** - * From MMSMemoryCardObserver - * See base class definition - */ - void MemoryCardChangedL( TMemoryCardEvent aEvent ); - protected: - -// From base class CCoeControl - - /** - * From CCoeControl - * See base class definition - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - - /** - * From CCoeControl - * See base class definition - */ - CCoeControl* ComponentControl(TInt aIndex) const; - - /** - * From CCoeControl - * See base class definition - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl - * See base class definition - */ - void SizeChanged(); - - /** - * From CCoeControl - * See base class definition - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** - * From CCoeControl - * See base class definition - */ - void HandleResourceChange( TInt aType ); - -// From base class MEikListBoxObserver - - /** - * From MEikListBoxObserver - * See base class definition - */ - void HandleListBoxEventL( CEikListBox* aListBox, - TListBoxEvent aEventType ); - -// From base class MMSEngineObserver - - /** - * From MMSEngineObserver - * See base class definition - */ - void ReadyL( TCmService aService, TInt aError ); - -// From base class MMSPropertyObserver - - /** - * From MMSPropertyObserver - * See base class definition - */ - void PropertyChangedL( TCmService aService, - TInt aTotalItems, - TInt aProcessedItems, - TInt /*aItemsToBeProcessed*/ ); - - - private: - - /** - * Updates listbox data - * @since S60 5.1 - */ - void UpdateListBoxDataL(); - - /** - * Starts sync operation - * @since S60 5.1 - */ - void StartSyncL(); - - /** - * Shows error note - * @since S60 5.1 - * @param aTextResource, error text resource - */ - void ShowErrorNoteL( TInt aTextResource ); - - /** - * Shows last synchronization time on navi pane - * @since S60 5.1 - */ - void SetNaviTextLastSyncL(); - - /** - * Callback for periodic timer - * @since S60 5.1 - * @param TAny, callback observer - */ - static TInt TimerCallbackL(TAny* aObject); - - /** - * Callback for navi pane timer - * @since S60 5.1 - * @param TAny, callback observer - */ - static TInt NaviTimerCallbackL(TAny* aObject); - - /** - * Static callback method for update list box data - * @since S60 5.1 - * @param TAny, callback observer - * @return - */ - static TInt BackgroundUpdateListL( TAny* aObject ); - - /** - * Supdate list box data step by step - * @since S60 5.1 - * @return - */ - TInt UpdateListByStepL(); - - /** - * Checks if fill list is selected - * - * @since S60 5.1 - * @param None - * @return TBool, ETrue if list is selected, EFalse otherwise - */ - TBool CheckIfFillListSelected(); - - /** - * Shows 'refresh completed' text in navi pane - * - * @since S60 5.1 - * @param None - * @return None - */ - void ShowRefreshCompleteTextL(); - - private: - - /** - * Listbox control - */ - CEikFormattedCellListBox* iListBox; // owned - - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - - /** - * active refresh operation indicator - */ - TBool iRefreshRunning; - - /** - * active sync operation indicator - */ - TMSSyncState iSyncRunning; - - /** - * active preprocess operation indicator - */ - TBool iPreprocessRunning; - - /** - * containers view - */ - CMSMainView* iView; // not owned - - /** - * Transfer time - */ - TInt iTransferTime; - /** - * Count of items to be stored - */ - TInt iItemsToBeStored; - /** - * Count of items to be filled - */ - TInt iItemsToBeFilled; - /** - * Progress watcher - */ - CMSPropertyWatcher* iMSPropertyWatcher; // owned - - /** - * MemoryCard monitor - */ - CMSMemoryCardMonitor* iMemoryCardMonitor; // owned - - /** - * Wizard execution flag - */ - TBool iAppWizardRun; - - /** - * Last sync timer - */ - CPeriodic* iPeriodic; // Owned - - /** - * Navi pane text timer - */ - CPeriodic* iNaviTimer; // Owned - - /** - * Idle time active object, Owend - */ - CIdle* iUpdateList; // Owned - - /** - * the count of requests for refresh UI - */ - TInt iRequestCt; - - /** - * current step of update list box - */ - TMSUpdateStep iCurStep; - - /** - * Fill list selection status - */ - TBool iFillListSelected; - }; - -#endif // C_MSMAINCONTAINER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msmainview.h --- a/homesync/contentmanager/mediaservant/inc/msmainview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +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: Definition for MediaServant main view class -* -*/ - - - - - -#ifndef C_MSMAINVIEW_H -#define C_MSMAINVIEW_H - -// INCLUDES -#include "msbaseview.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSMainContainer; -class CMSEngine; -class CMSSettingsView; -class CGSPluginInterface; - -/** - * CMSMainView view class. Main view is visible when - * application is launched - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSMainView ): public CMSBaseView - { - public: - /** - * Constructor. - */ - CMSMainView( CMSAppUi& aAppUi ); - - /** - * Symbian default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CMSMainView(); - - /** - * Changes cba according to hinghlighted item index - * @since S60 3.2 - * @param aHighlightedIndex, highlighted item index - */ - void SetCbaL( TInt aHighlightedIndex ); - - /** - * ListBox focus index - * @since S60 5.1 - * @return TInt, focus index - */ - TInt FocusIndex() const; - - /** - * Checks if MMC card has been changed - * @since S60 5.1 - */ - void CheckMemoryCardL(); - - protected: - -// From base class CAknView - - /** - * From CAknView - * See base class definition - */ - TUid Id() const; - - /** - * From CAknView - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknView - * See base class definition - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - */ - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - - private: - - /** - * Show memory card query and handles selection - * @since S60 5.1 - * @param RPointerArray&, stored drive array - * @param RPointerArray&, device drive array - * @param TInt, mmc drive index - */ - void ShowAndHandleMMCQueryL( - RPointerArray& aStoredArray, - RPointerArray& aDriveArray, - TInt index ); - - /** - * Starts the wizard when run first time, callback for CIdle - * @since S60 5.1 - * @param aPtr, Pointer to this class - * @return TBool, EFalse because of one time call - */ - static TBool InitializeWizardL( TAny* aPtr ); - - /** - * Starts the new memory card dialog when new - * memory card inserted, callback for CIdle - * @since S60 5.1 - * @param aPtr, Pointer to this class - */ - static TInt InitializeMemoryCardL( TAny* aPtr ); - - /** - * Do starts the wizard when run first time - * @since S60 5.1 - * @return TBool, EFalse because of one time call - */ - TBool DoInitializeWizardL(); - - /** - * Do starts the new memory card dialog when new - * memory card inserted - * @since S60 5.1 - * @return TBool, EFalse because of one time call - */ - void DoInitializeMemoryCardL(); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi* iAppUi; // not owned - - /** - * view's container - */ - CMSMainContainer* iContainer; // owned - - /** - * Check MMC indicator - */ - TBool iCheckMMC; - /** - * Idle loop to initialize wizard - */ - CIdle* iIdle; - - /** - * Flag for wizard initialization - */ - TBool iWizardInitialization; - }; - -#endif // C_MSMAINVIEW_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msmemorycardmonitor.h --- a/homesync/contentmanager/mediaservant/inc/msmemorycardmonitor.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +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: Definition for CMSMemoryCardMonitor class -* -*/ - - -#ifndef __MSMMCMONITOR_H__ -#define __MSMMCMONITOR_H__ - -#include -#include - -// Memory card events -enum TMemoryCardEvent - { - EMemoryCardInsert = 0, //Insert memorycard - EMemoryCardRemove, //Remove memorycard - EMemoryCardOthers //Other event such as write, read, etc. - }; - -/** - * Observer class for memory slot events - * - * @since S60 5.1 - */ -class MMSMemoryCardObserver - { - public: - /** - * Implement this method to be notified when Memory Card status - * changes. - * - * @since S60 5.1 - * @param aEvent, memory slot event - * @return None; - */ - virtual void MemoryCardChangedL( TMemoryCardEvent aEvent ) = 0; - }; - -/** - * Memory card monitor class - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSMemoryCardMonitor ) : public CActive - { - public: - - /** - * two-phase constructor - * - * @since S60 5.1 - * @param aObserver, memorycard - * @param aFs, file server session - * @return pointer to CMSMemoryCardMonitor - */ - static CMSMemoryCardMonitor* NewL( MMSMemoryCardObserver* aObserver, - RFs& aFs ); - - /** - * two-phase constructor - * - * @since S60 5.1 - * @param aObserver, memorycard - * @param aFs, file server session - * @return pointer to CMSMemoryCardMonitor - */ - static CMSMemoryCardMonitor* NewLC( MMSMemoryCardObserver* aObserver, - RFs& aFs ); - - /** - * Destructor - */ - virtual ~CMSMemoryCardMonitor(); - - /** - * Start monitoring memory card slot - * - * @since S60 5.1 - * @param None - * @return None - */ - void StartMonitor(); - - protected: - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - - /** - * From CActive - * See base class definition - */ - TInt RunError( TInt aError ); - - private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aObserver, memorycard - * @param aFs, file server session - * @return None; - */ - CMSMemoryCardMonitor( MMSMemoryCardObserver* aObserver, RFs& aRfs ); - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aObserver, memorycard - * @param aFs, file server session - * @return None - */ - void ConstructL(); - - /** - * Checks if memory card is available - * - * @since S60 5.1 - * @return TBool, ETrue if found, EFalse otherwise - */ - TBool MemoryCardExist() const; - - private: - - /** - * Memorycard observer class - */ - MMSMemoryCardObserver* iObserver; // not owned - - /** - * Reference to file server session - */ - RFs& iFsSession; - - /** - * Memorycard exist or not - */ - TBool iMemoryCardExist; - }; - -#endif // __MSMMCMONITOR_H__ - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msmetadatacollector.h --- a/homesync/contentmanager/mediaservant/inc/msmetadatacollector.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +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: CMSMetadataCollector class definition -* -*/ - - -#ifndef __CMSMETADATACOLLECTOR_H -#define __CMSMETADATACOLLECTOR_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSMetadataCollector; -class CCmSqlPropertyContainer; -class CCmSqlPropertyCollector; - -/** - * CMSMetadataCollector class - * Collects metadata - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSMetadataCollector ): public CBase - { - private: - // Container types - enum TMSContainerTypes - { - ETracks = 0, - EArtists, - EGenres, - EAlbums - }; - - public: - - /** - * two-phase constructor - * - * @Since S60 5.1 - * @param aAppUi, application ui - * @param aMediaType, mediatype - * @param aGenreArray, genre container - * @param aArtistArray, artist container - * @param aAlbumArray, album container - * @param aTrackArray, track/video title container - * @return pointer to CMSMetadataCollector class - */ - IMPORT_C static CMSMetadataCollector* NewL( CMSAppUi& aAppUi, - TCmMediaType aMediaType, - RArray& aGenreArray, - RArray& aArtistArray, - RArray& aAlbumArray, - RArray& aTrackArray ); - - /** - * two-phase constructor - * - * @Since S60 5.1 - * @param aAppUi, application ui - * @param aMediaType, mediatype - * @param aGenreArray, genre container - * @param aArtistArray, artist container - * @param aAlbumArray, album container - * @param aTrackArray, track/video title container - * @return pointer to CMSMetadataCollector class - */ - IMPORT_C static CMSMetadataCollector* NewLC( CMSAppUi& aAppUi, - TCmMediaType aMediaType, - RArray& aGenreArray, - RArray& aArtistArray, - RArray& aAlbumArray, - RArray& aTrackArray ); - - /** - * Destructor. - */ - virtual ~CMSMetadataCollector(); - - public: - - /** - * Starts collecting metadata items - * - * @since S60 5.1 - * @param None - * @return None - */ - void GetFilteredMetadataL(); - - /** - * Returns genre array - * - * @since S60 5.1 - * @param None - * @return CCmSqlPropertyContainer, genre container - */ - CCmSqlPropertyContainer* Genres(); - - /** - * Returns artist array - * - * @since S60 5.1 - * @param None - * @return CCmSqlPropertyContainer, artist container - */ - CCmSqlPropertyContainer* Artists(); - - /** - * Returns album array - * - * @since S60 5.1 - * @param None - * @return CCmSqlPropertyContainer, album container - */ - CCmSqlPropertyContainer* Albums(); - - /** - * Returns track/video title array - * @since S60 5.1 - * @param None - * @return CCmSqlPropertyContainer, track container - */ - CCmSqlPropertyContainer* Tracks(); - - protected: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aAppUi, application ui - * @param aMediaType, mediatype - * @param aGenreArray, genre container - * @param aArtistArray, artist container - * @param aAlbumArray, album container - * @param aTrackArray, track/video title container - * @return None - */ - CMSMetadataCollector( CMSAppUi& aAppUi, - TCmMediaType aMediaType, - RArray& aGenreArray, - RArray& aArtistArray, - RArray& aAlbumArray, - RArray& aTrackArray ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - private: - /** - * Deletes all items from containers - * - * @since S60 5.1 - * @param None - * @return None - */ - - void DeleteAllItems(); - /** - * Adds container to collector - * - * @since S60 5.1 - * @param None - * @return None - */ - void AddContainersL(); - - private: - /** - * Application UI - */ - CMSAppUi* iMSAppUi; // not owned - /** - * MediaType indicator - */ - TCmMediaType iMediaType; - /** - * Artist container - */ - CCmSqlPropertyContainer* iGenreContainer; // not owned - /** - * Artist container - */ - CCmSqlPropertyContainer* iArtistContainer; // not owned - /** - * Artist container - */ - CCmSqlPropertyContainer* iAlbumContainer; // not owned - /** - * Artist container - */ - CCmSqlPropertyContainer* iTrackContainer; // not owned - /** - * Container of MetadataContainers - */ - CCmSqlPropertyCollector* iMetadataCollector; // owned - /** - * Selected genre array - */ - RArray* iGenreArray; //owned - /** - * Selected artist array - */ - RArray* iArtistArray; //owned - /** - * Selected album array - */ - RArray* iAlbumArray; //owned - /** - * Selected track array - */ - RArray* iTrackArray; //owned - - }; - -#endif // __CMSMETADATACOLLECTOR_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msmultiselectiondialog.h --- a/homesync/contentmanager/mediaservant/inc/msmultiselectiondialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +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: CMSMultiselectionDialog class implementation -* -*/ - - -#ifndef MSMULTISELECTIONDIALOG_H -#define MSMULTISELECTIONDIALOG_H - -// INCLUDES -#include -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CAknColumnListBox; -class CAknSearchField; -class CSelectionItemList; -class CAknTitlePane; - -// CLASS DECLARATION - -/** - * CMSMultiselectionDialog dialog class - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSMultiselectionDialog ) : - public CAknSelectionListDialog - { - public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aItemArray, list of items - * @param aTitle, dialog title - */ - static CMSMultiselectionDialog* NewL( - CSelectionItemList* aItemArray, - const TDesC& aTitle ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aItemArray, list of items - * @param aTitle, dialog title - */ - static CMSMultiselectionDialog* NewLC( - CSelectionItemList* aItemArray, - const TDesC& aTitle ); - - /** - * Destructor. - */ - virtual ~CMSMultiselectionDialog(); - - - protected: // New functions - - void ConstructL( const TDesC& aTitle ); - - /** - * Loads a possibly skinned icon and adds it to icon array - * - * @since S60 5.1 - * @param aArray, array of icons - * @param aSkin, skin instance - * @param aMbmFile, reference to icon file - * @param aID, skinned icon id - * @param aBitmapId, bitmap id - * @param aMaskId, bitmap mask id - */ - void AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId) const; - - - /** - * Appends first item ("share all files") to the listbox - * - * @since S60 5.1 - * @param CDesCArray, listbox array - * @return None - */ - void AppendShareAllSelectionL(CDesCArray* aListBoxArray) const; - - - protected: - -// From base class CAknSelectionListDialog - - /** - * From CAknSelectionListDialog - * See base class definition - */ - void PreLayoutDynInitL(); - - /** - * From CAknSelectionListDialog - * See base class definition - */ - TBool OkToExitL( TInt aButtonId ); - - - private: - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aItemArray, list item array - * @return None - */ - CMSMultiselectionDialog( CSelectionItemList* aItemArray ); - - /** - * Generates text array for listbox - * - * @since S60 5.1 - * @param None - * @return None - */ - void GenerateInternalArrayL(); - - /** - * Sets checkbox statas - * - * @since S60 5.1 - * @param None - * @return None - */ - void SetAllSelectionsL(); - - /** - * Deselects other items if first one is selected - * - * @since S60 5.1 - * @param None - * @return None - */ - void HandleSelectionsL(); - - /** - * Updates item array selections - * - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateAllSelectionsL(); - - /** - * handle for the pointer device input - * - * @since S60 5.1 - * @param aPointerEvent, pointerevent - * @return None - */ - void HandlePointerEventL( const TPointerEvent& aPointerEvent ); - - - /** - * Handeles selection key press - * - * @since S60 5.1 - * @param None - * @return None - */ - void HandleSelectionKeyPressL(); - - private: - - /** - * dialog control - */ - CAknColumnListBox* iListBox; // owned - - /** - * title pane - */ - CAknTitlePane* iTitlePane; // not owned - - /** - * previous view title - */ - HBufC* iPreviousTitle; // owned - - /** - * selected item - needed for creation of CAknSelectionListDialog - */ - TInt iSelectedItem; - - /** - * array for listbox items - */ - CSelectionItemList* iItemArray; // not owned - - /** - * internal array for listbox item texts - */ - CDesCArrayFlat* iInternalItemArray; // owned - - /** - * First item selection status - */ - TBool iFirstItemSelected; - /** - * iNaviPane - */ - CAknNavigationControlContainer* iNaviPane; // not owned - - /** - * navi decorator - */ - CAknNavigationDecorator* iNaviDecorator; // owned - }; - -#endif // MSMULTISELECTIONDIALOG_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msmultiselectionsettingpage.h --- a/homesync/contentmanager/mediaservant/inc/msmultiselectionsettingpage.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +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: Definition for MediaServant multiselection setting page -* -*/ - - -#ifndef C_MSMULTISELECTIONSETTINGPAGE_H -#define C_MSMULTISELECTIONSETTINGPAGE_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CSelectionItemList; - - -// CLASS DECLARATION - -/** -* CMSMultiselectionSettingPage class. -*/ -NONSHARABLE_CLASS( CMSMultiselectionSettingPage ): - public CAknCheckBoxSettingPage - { - public: // Constructor and destructor - - /** - * two-phase constructor. - * - * @since S60 5.1 - * @param aIdentifier, setting page resource id - * @param aItemArray, item list - * @param aFirstItemSwitch, set ETrue if 'any' item is shown, EFalse - * otherwise - * @return pointer to CMSMultiselectionSettingPage - */ - static CMSMultiselectionSettingPage* NewL( TInt aIdentifier, - CSelectionItemList& aItemArray, - TBool aFirstItemSwitch ); - - /** - * two-phase constructor. - * - * @since S60 5.1 - * @param aIdentifier, setting page resource id - * @param aItemArray, item list - * @param aFirstItemSwitch, set ETrue if 'any' item is shown, EFalse - * otherwise - * @return pointer to CMSMultiselectionSettingPage - */ - static CMSMultiselectionSettingPage* NewLC( TInt aIdentifier, - CSelectionItemList& aItemArray, - TBool aFirstItemSwitch ); - /** - * Destructor. - */ - virtual ~CMSMultiselectionSettingPage(); - - - protected: - -// From base class CAknCheckboxSettingPage - - /** - * From CAknCheckboxSettingPage - * See base class definition - */ - void SelectCurrentItemL(); - - /** - * From CAknCheckboxSettingPage - * See base class definition - */ - TBool OkToExitL(TInt aButtonId); - - private: - - /** - * Deselects other items if first one is selected - * @since S60 5.1 - * @param None - * @return None - */ - void HandleSelectionsL(); - - private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aIdentifier, setting page resource id - * @param aItemArray, item list - * @param aFirstItemSwitch, set ETrue if 'any' item is shown, EFalse - * otherwise - * @return None - */ - CMSMultiselectionSettingPage( - TInt aIdentifier, - CSelectionItemList& aItemArray, - TBool aFirstItemSwitch - ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Updates selections to item list - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateAllSelections(); - - /** - * handle for the pointer device input - * @since S60 5.1 - * @param None - * @return None - */ - void HandlePointerEventL (const TPointerEvent &aPointerEvent); - - private: - /** - * setting page item array (servers) - */ - CSelectionItemList* iItemArray; // not owned - /** - * Flag for indicating that special selection is needed - */ - TBool iFirstItemSwitch; - }; - -#endif // C_MSMULTISELECTIONSETTINGPAGE_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msparameteragent.h --- a/homesync/contentmanager/mediaservant/inc/msparameteragent.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +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: CMSParameterAgent class definition -* -*/ - - -#ifndef C_MSPARAMETERAGENT_H -#define C_MSPARAMETERAGENT_H - -// INCLUDES -#include -#include "mediaservant.hrh" - -// template parameters -struct TMSTemplate - { - TInt templateType; // mediatype - TInt selectedTemplate; // selected template - TBuf templateName; // template name - }; - -// FORWARD DECLARATIONS - -/** - * CMSParameterAgent class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSParameterAgent ): public CBase - { - - public: - - /** - * Constructor. - */ - CMSParameterAgent(); - - /** - * Destructor. - */ - virtual ~CMSParameterAgent(); - - /** - * Sets selected rule template - * - * @since S60 5.1 - * @param aTemplate, selected template - * @return None - */ - void SetRuleTemplate( TMSTemplate aTemplate ); - - /** - * Returns selected rule template - * - * @since S60 5.1 - * @return TMSRuleTemplate, selected template - * @return None - */ - TMSTemplate GetRuleTemplate() const; - - /** - * Sets selected index of main view - * - * @since S60 5.1 - * @param aIndex, selected listbox item index - * @return None - */ - void SetMainViewFocusIndex( TInt aIndex ); - - /** - * Returns focus index of main view. - * - * @since S60 5.1 - * @return TInt, focus index of main view - * @return None - */ - TInt MainViewFocusIndex() const; - - /** - * Sets selected index of fill view - * - * @since S60 5.1 - * @param aIndex, selected listbox item index - * @return None - */ - void SetFillViewFocusIndex( TInt aIndex ); - - /** - * Returns focus index of fill view. - * - * @since S60 5.1 - * @return TInt, focus index of fill view - * @return None - */ - TInt FillViewFocusIndex() const; - - /** - * Sets selected index of store view - * - * @since S60 5.1 - * @param aIndex, selected listbox item index - * @return None - */ - void SetStoreViewFocusIndex( TInt aIndex ); - - /** - * Returns focus index of store view. - * - * @since S60 5.1 - * @param None - * @return TInt, focus index of store view - */ - TInt StoreViewFocusIndex() const; - - /** - * Sets uid of current view - * - * @since S60 5.1 - * @param aViewId, view id - * @return None - */ - void SetPreviousViewId( TUid aViewId ); - - /** - * Returns uid of previous view. - * - * @since S60 5.1 - * @param None - * @return TUid, focus index of previous view - */ - TUid PreviousViewId() const; - - /** - * Sets browse target - * - * @since S60 5.1 - * @param aBrowseTarget, browse target - * @return None - */ - void SetBrowseTarget( TMSBrowseTarget aBrowseTarget ); - - /** - * Gets browse target - * - * @since S60 5.1 - * @param None - * @return TMSBrowseTarget, browse target - */ - TMSBrowseTarget GetBrowseTarget() const; - - private: - - /** - * previous view focus index - */ - TInt iPreviousFocusIndex; - /** - * previous view focus index - */ - TUid iPreviousViewId; - /** - * selected template - */ - TMSTemplate iTemplate; - /** - * Browse target - */ - TMSBrowseTarget iBrowseTarget; - /** - * Main view focus index - */ - TInt iMainViewFocusIndex; - /** - * Fill view focus index - */ - TInt iFillViewFocusIndex; - /** - * Store view focus index - */ - TInt iStoreViewFocusIndex; - }; - -#endif // C_MSPARAMETERAGENT_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/mspropertywatcher.h --- a/homesync/contentmanager/mediaservant/inc/mspropertywatcher.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +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: CMSPropertyWatcher class defition -* -*/ - - - -#ifndef __MSPROPERTYWATCHER_H__ -#define __MSPROPERTYWATCHER_H__ - - -// Include Files -#include -#include -#include "cmcommon.h" - -// FORWARD DECLARATIONS -class MMSPropertyObserver; - -// CLASS DECLARATION -/** - * Active object class for MSEngine - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSPropertyWatcher ): public CActive - { - - public: - - /** - * Two-phased constructor. - */ - static CMSPropertyWatcher* NewL(); - - /** - * Two-phased constructor. - */ - static CMSPropertyWatcher* NewLC(); - - /** - * Destructor. - */ - virtual ~CMSPropertyWatcher(); - - /** - * Sets property observer - * @since S60 5.1 - * @param aObserver, property observer - * @return None - */ - void SetObserver( MMSPropertyObserver* aObserver ); - - /** - * Starts listening property - * @since S60 5.1 - * @param None - * @return None - */ - void StartL(); - - /** - * Stops listening property - * @since S60 5.1 - * @param None - * @return None - */ - void Stop(); - - protected: - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - virtual void RunL(); - - /** - * From CActive - * See base class definition - */ - virtual void DoCancel(); - - /** - * From CActive - * See base class definition - */ - TInt RunError( TInt aError ); - - private: - - /** - * Performs the first phase of two phase construction. - */ - CMSPropertyWatcher(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - - private: - - /** - * property - */ - RProperty iProgressInfo; - /** - * property observer - */ - MMSPropertyObserver* iObserver; // not owned - - }; - - - - -/** - * Property observer - * @since Series 60 3.1 - */ -class MMSPropertyObserver - { - public: - - /** - * Informs about property changes - * @param aService, completed service - * @param aError, error code - * @since S60 5.1 - */ - virtual void PropertyChangedL( TCmService aService, - TInt aTotalItems, - TInt aProcessedItems, - TInt aItemsToBeProcessed ) = 0; - }; - -#endif // __MSPROPERTYWATCHER_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msruleamountsetting.h --- a/homesync/contentmanager/mediaservant/inc/msruleamountsetting.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +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: CMSRuleAmountSetting class definition -* -*/ - - -#ifndef C_MSRULEAMOUNTSETTING_H -#define C_MSRULEAMOUNTSETTING_H - -// INCLUDES -#include "mssettingitems.h" - - -// CLASS DECLARATION - -/** - * CMSRuleAmountSetting class. This class is used when - * transfer time is modified - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSRuleAmountSetting ): - public CMSEnumeratedTextPopupSettingItem - { - public: - - /** - * Constructor. - */ - CMSRuleAmountSetting( TInt aIdentifier, - TInt &aLimitType, - TInt &aValue ); - - /** - * Destructor. - */ - virtual ~CMSRuleAmountSetting(); - - - protected: - -// From base class CAknSettingItem - - /** - * From CAknSettingItem - * See base class definition - */ - void EditItemL( TBool aCalledFromMenu ); - - /** - * From CAknSettingItem - * See base class definition - */ - void CompleteConstructionL(); - - private: - - /** - * Limit type - */ - TInt& iLimitType; - - /** - * Amount of files - */ - TInt& iValue; - - /** - * Button event on setting page - */ - TAknSettingPageEvent iSettingPageEvent; - }; - -#endif // C_MSRULEAMOUNTSETTING_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msrulefilesizesetting.h --- a/homesync/contentmanager/mediaservant/inc/msrulefilesizesetting.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +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: CMSRuleFileSizeSetting class definition -* -*/ - - -#ifndef C_MSRULEFILESIZESETTING_H -#define C_MSRULEFILESIZESETTING_H - -// INCLUDES -#include "mssettingitems.h" - -// CLASS DECLARATION - -/** - * CMSRuleFileSizeSetting class. This class is used when - * transfer time is modified - * - * @since S60 5.1 -*/ -NONSHARABLE_CLASS( CMSRuleFileSizeSetting ): - public CMSEnumeratedTextPopupSettingItem - { - public: - - /** - * Constructor. - * - * @since S60 5.1 - * @param aIdentifier, resource identifier - * @param aType, setting type ( min / max size ) - * @param aSelection, selection index - * @param aValue, size value - * @return None - */ - CMSRuleFileSizeSetting( - TInt aIdentifier, - TInt aType, - TInt &aSelection, - TInt &aValue - ); - - /** - * Destructor. - */ - virtual ~CMSRuleFileSizeSetting(); - - - protected: - -// From base class CAknSettingItem - - /** - * From CAknSettingItem - * See base class definition - */ - void EditItemL( TBool aCalledFromMenu ); - - /** - * From CAknSettingItem - * See base class definition - */ - void CompleteConstructionL(); - - private: - - /** - * Setting type Min/Max - */ - TInt iType; - - /** - * File size in MBs - */ - TInt& iValue; - }; - -#endif // C_MSRULEFILESIZESETTING_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msrulemultiselectionsetting.h --- a/homesync/contentmanager/mediaservant/inc/msrulemultiselectionsetting.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +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: Definition for multiselection setting class -* -*/ - - -#ifndef C_MSRULEMULTISELECTIONSETTING -#define C_MSRULEMULTISELECTIONSETTING - -// INCLUDES -#include "mssettingitems.h" - -// FORWARD DECLARATIONS -class CSelectionItemList; -class CCmSqlPropertyContainer; - -// CLASS DECLARATION - -/** - * CMSRuleMultiSelectionSetting class. This class is used when - * server list is modified - * - * @Since S60 5.1 -*/ -NONSHARABLE_CLASS( CMSRuleMultiselectionSetting ): public CMSTextSettingItem - { - public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aIdentifier, resource identifier - * @param aFirstPopupItemResource, first list item text resource id - * @param aAnyItemTextRestource, 'any' item text resource - * @param aMetadataArray, metadata list - * @param aArray, selection list - * @param aItemTextResource, item text resource when multiple - * items selected - * @param aText, dummy parameter - needed in item creation - * @return None - */ - static CMSRuleMultiselectionSetting* NewL( TInt aIdentifier, - TInt aTitleResource, - TInt aFirstPopupItemResource, - TInt aAnyItemTextResource, - CCmSqlPropertyContainer* aMetadataArray, - RArray* aArray, - TInt aItemTextResource, - TDes& aText); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aIdentifier, resource identifier - * @param aFirstPopupItemResource, first list item text resource id - * @param aAnyItemTextRestource, 'any' item text resource - * @param aMetadataArray, metadata list - * @param aArray, selection list - * @param aItemTextResource, item text resource when multiple - * items selected - * @param aText, dummy parameter - needed in item creation - * @return None - */ - static CMSRuleMultiselectionSetting* NewLC( TInt aIdentifier, - TInt aTitleResource, - TInt aFirstPopupItemResource, - TInt aAnyItemTextResource, - CCmSqlPropertyContainer* aMetadataArray, - RArray* aArray, - TInt aItemTextResource, - TDes& aText); - - /** - * Destructor. - */ - virtual ~CMSRuleMultiselectionSetting(); - - /** - * Creates item list and updates listbox text - */ - void CreateItemListL(); - - protected: - -// From base class CAknSettingItem - - /** - * From CAknSettingItem - * See base class definition - */ - void EditItemL( TBool aCalledFromMenu ); - - private: - - /** - * Creates selection list for setting page - * - * @since S60 5.1 - * @param None - * @return None - */ - void CreateSelectionItemListL(); - - /** - * Appends selected items to the list - * - * @since S60 5.1 - * @param None - * @return None - */ - void AppendSelectedItemsToListL(); - - /** - * Sets setting item text - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void SetSettingItemTextL(); - - private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aIdentifier, resource identifier - * @param aFirstPopupItemResource, first list item text resource id - * @param aAnyItemTextRestource, 'any' item text resource - * @param aMetadataArray, metadata list - * @param aArray, selection list - * @param aItemTextResource, item text resource when multiple - * items selected - * @param aText, dummy parameter - needed in item creation - * @return None - */ - CMSRuleMultiselectionSetting( - TInt aIdentifier, - TInt aTitleResource, - TInt aFirstPopupItemResource, - TInt aAnyItemTextResource, - CCmSqlPropertyContainer* aMetadataArray, - RArray* aArray, - TInt aItemTextResource, - TDes& aText - ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - private: - - /** - * selected item count - */ - TInt iSelectedItemCount; - /** - * item text resource - */ - TInt iItemTextResource; - - /** - * setting item text - */ - TDesC& iText; - /** - * item array for selection dialog - */ - CSelectionItemList* iItemArray; // owned - /** - * Server name string (external set) - */ - HBufC16* iSettingText; // owned - /** - * list of selected items - */ - RArray* iList; // not owned - /** - * array of metadata items - */ - CCmSqlPropertyContainer* iMetadataArray; // not owned - /** - * title resource for multiselection dialog - */ - TInt iTitleResource; - /** - * first item resource for multiselection dialog - */ - TInt iFirstPopupItemResource; - /** - * secondary text resource - */ - TInt iAnyItemTextResource; - /** - * Last selected item index - */ - TInt iSelectedItemIndex; - }; - -#endif // C_MSRULEMULTISELECTIONSETTING - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msruleserverssetting.h --- a/homesync/contentmanager/mediaservant/inc/msruleserverssetting.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +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: CMSRuleServersSetting class definition -* -*/ - - -#ifndef C_MSRULESERVERSSETTING_H -#define C_MSRULESERVERSSETTING_H - -// INCLUDES -#include "mssettingitems.h" - -// FORWARD DECLARATIONS -class CSelectionItemList; - - -// CLASS DECLARATION - -/** - * CMSRuleServersSetting class. This class is used when - * server list is modified - * - * - * @Since S60 5.1 -*/ -NONSHARABLE_CLASS( CMSRuleServersSetting ): public CMSTextSettingItem - { - public: - - /** - * Two-phased constructor. - * - * @Since S60 5.1 - * @param aIdentifier, setting resource id - * @param aText, dummy text - needed on creation - * @param aDefaultItemTextResource - * @param aSecondaryTextResource, resource id for - * text 'no items' case - */ - static CMSRuleServersSetting* NewL( TInt aIdentifier, - CSelectionItemList& aServerList, - TDes& aText, - TInt aSecondaryTextResource ); - - /** - * Two-phased constructor. - * - * @Since S60 5.1 - * @param aIdentifier, setting resource id - * @param aText, dummy text - needed on creation - * @param aDefaultItemTextResource - * @param aSecondaryTextResource, resource id for - * text 'no items' case - */ - static CMSRuleServersSetting* NewLC( TInt aIdentifier, - CSelectionItemList& aServerList, - TDes& aText, - TInt aSecondaryTextResource ); - - /** - * Destructor. - */ - virtual ~CMSRuleServersSetting(); - - /** - * ConstructL - * Second phase constructor. - */ - void ConstructL(); - - protected: // From CAknSettingItem - - /** - * This method activates the transfer "setting page" - */ - void EditItemL( TBool aCalledFromMenu ); - - protected: // New functions - - /** - * Counts selected items - * @since S60 3.1 - * @return TInt, item count - */ - TInt CountSelectedItems(); - - /** - * Sets setting item secondary text according to selected devices - * @since S60 3.1 - */ - void SetSettingItemTextL(); - - protected: - - /** - * Constructor. - */ - CMSRuleServersSetting( - TInt aIdentifier, - CSelectionItemList& aServerList, - TDes& aText, - TInt aSecondaryTextResource - ); - - protected: - /** - * Server name string - */ - TDesC& iText; - /** - * setting page item array (servers) - */ - CSelectionItemList& iItemArray; - /** - * Server name string (external set) - */ - HBufC16* iSettingText; // owned - /** - * Selected item count - */ - TInt iSelectedItemCount; - /** - * Default item secondary text resource - */ - TInt iSecondaryTextResource; - }; - -#endif // C_MSRULESERVERSSETTING_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/mssettingitems.h --- a/homesync/contentmanager/mediaservant/inc/mssettingitems.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,218 +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: Definition for MediaServant fill rule editor class -* -*/ - - -#ifndef C_MSSETTINGITEMS_H -#define C_MSSETTINGITEMS_H - -#include - -// CLASS DECLARATIONS - -/** - * CMSTextSettingItem - * Text setting item class - * - * @Since S60 5.1 - */ -class CMSTextSettingItem : public CAknTextSettingItem - { - public: - /** - * Constructor - * - * @Since S60 5.1 - * @param aIdentifier, resource id - * @param aText, setting item text - * @return None - */ - CMSTextSettingItem( TInt aIdentifier, TDes& aText ); - - protected: - -// From base class MAknSettingPageObserver - - /** - * From MAknSettingPageObserver - * See base class definition - */ - void HandleSettingPageEventL ( CAknSettingPage* aSettingPage, - TAknSettingPageEvent aEventType ); - public: - - /* Setting page acceptance status - * @since S60 5.1 - * @param None - * @return TBool, ETrue if accepted EFalse if cancelled - */ - TBool SettingAccepted(); - - /** - * Sets setting page accept state - * @since S60 5.1 - * @param aState, ETrue if accepted - * @return None - */ - void SetAcceptState( TBool aState ); - - /** - * Gets settingitem text - * @since S60 5.1 - * @param None - * @return TPtr&, setting item text - */ - TPtr& Text(); - - /** - * Sets settingitem text - * @since S60 5.1 - * @param text, new text - * @return None - */ - void SetText( TDesC& text ); - - private: - - /* - * Setting page acceptance status - */ - TBool iOKPressed; - }; - -/** - * CMSEnumeratedTextPopupSettingItem - * Enumerated text popup setting item class - * - * @Since S60 5.1 - */ -class CMSEnumeratedTextPopupSettingItem : - public CAknEnumeratedTextPopupSettingItem - { - public: - - /* - * Constructor - * - * @Since S60 5.1 - * @param aIdentifier, resource id - * @param aValue, selected value - * @return None - */ - CMSEnumeratedTextPopupSettingItem( TInt aResourceId, TInt& aValue ); - - protected: - -// From base class MAknSettingPageObserver - - /** - * From MAknSettingPageObserver - * See base class definition - */ - void HandleSettingPageEventL ( CAknSettingPage* aSettingPage, - TAknSettingPageEvent aEventType ); - public: - /* Setting page acceptance status - * @since S60 5.1 - * @return TBool, ETrue if accepted EFalse if cancelled - */ - TBool SettingAccepted(); - - /** - * Sets setting page accept state - * @since S60 5.1 - * @param aState, ETrue if accepted - */ - void SetAcceptState( TBool aState ); - - private: - /* - * Setting page acceptance status - */ - TBool iOKPressed; - }; - -/** - * CMSTimeOrDateSettingItem - * Time and date setting item class - * - * @since S60 5.1 - */ -class CMSTimeOrDateSettingItem : public CAknTimeOrDateSettingItem - { - public: - /* - * Constructor - * - * @Since S60 5.1 - * @param aIdentifier, resource id - * @param aMode, time or date mode - * @param aTime, time value - * @return None - */ - CMSTimeOrDateSettingItem( TInt aCMSIdentifier, - TInt aIdentifier, - CAknTimeOrDateSettingItem::TAknTimeOrDateSettingItemMode aMode, - TTime& aTime ); - - protected: - -// From base class MAknSettingPageObserver - - /** - * From MAknSettingPageObserver - * See base class definition - */ - void HandleSettingPageEventL ( CAknSettingPage* aSettingPage, - TAknSettingPageEvent aEventType ); - public: - /* Setting page acceptance status - * @since S60 5.1 - * @return TBool, ETrue if accepted EFalse if cancelled - */ - TBool SettingAccepted(); - - /** - * Sets setting page accept state - * @since S60 5.1 - * @param aState, ETrue if accepted - */ - void SetAcceptState( TBool aState ); - - /** - * This launches the setting page for Time or Date editing - * @since S60 5.1 - * @param aState, ETrue if from menu called - */ - void EditItemL( TBool aCalledFromMenu ); - - private: - /* - * Setting page acceptance status - */ - TBool iOKPressed; - /* - * Internal time - */ - TTime& iCMSInternalTime; - /* - * Resource identifier(From / Util) - */ - TInt iCMSIdentifier; - - }; - -#endif // C_MSSETTINGITEMS_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msstorekeeponphonesetting.h --- a/homesync/contentmanager/mediaservant/inc/msstorekeeponphonesetting.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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: CMSStoreKeepOnPhoneSetting class definition -* -*/ - - -#ifndef C_MSSTOREKEEPONPHONESETTING_H -#define C_MSSTOREKEEPONPHONESETTING_H - -// INCLUDES -#include -#include "cmcommontypes.h" -#include "mediaservant.hrh" - -// FORWARD DECLARATIONS -class CMSAppUi; - - -// CLASS DECLARATION - -/** - * CMSStoreKeepOnPhoneSetting class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSStoreKeepOnPhoneSetting ): - public CAknEnumeratedTextPopupSettingItem - { - public: - - /** - * Constructor. - * - * @since S60 5.1 - * @param aSettingPageResourceId, setting page resource - * @param aMediaType, mediatype - * @param aSelection, selection index - * return None - */ - CMSStoreKeepOnPhoneSetting( - TInt aSettingPageResourceId, - TCmMediaType aMediaType, - TInt& aSelection - ); - - /** - * Destructor. - */ - virtual ~CMSStoreKeepOnPhoneSetting(); - - - protected: - -// From base class CAknSettingItem - - /** - * From CAknSettingItem - * See base class definition - */ - void CompleteConstructionL(); - - private: - - /** - * media type - */ - TCmMediaType iMediaType; - }; - -#endif // C_MSSTOREKEEPONPHONESETTING_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msstorelistcontainer.h --- a/homesync/contentmanager/mediaservant/inc/msstorelistcontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +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: Definition for MediaServant store list container class -* -*/ - - -#ifndef C_MSSTORELISTCONTAINER_H -#define C_MSSTORELISTCONTAINER_H - -// INCLUDES -#include -#include "msbasecontainer.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CCmStoreRuleContainer; -class CMSStoreListView; - - -/** - * CMSStoreListContainer class definition - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSStoreListContainer ): public CMSBaseContainer, - public MEikListBoxObserver - { - private: - // Icon enumerations - enum TMSListBoxIcons - { - EIconCheckboxOn = 0, - EIconCheckboxOff, - EIconCount - }; - - public: - /** - * Constructor. - * - * @since S60 5.1 - * @param aAppUi, application UI - * @param aView, store list view - * @return None - */ - CMSStoreListContainer( CMSAppUi& aAppUi, CMSStoreListView& aView ); - - /** - * Symbian default constructor. - */ - void ConstructL( TRect aRect ); - - /** - * Destructor. - */ - virtual ~CMSStoreListContainer(); - - public: - - /** - * Highlighted item index - * @since S60 5.1 - * @param None - * @return TInt, highlighted item index - */ - TInt SelectedItemIndex(); - - /** - * Sends store rules to server - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateRulesToServerL(); - - /** - * Counts new list items - * @Since S60 5.2 - * @param None - * @return TInt, item count - */ - TInt ListItemCountL(); - - /** - * Return current item's selection status - * @Since S60 5.1 - * @param None - * @return TBool, ETrue if selected, EFalse othwerwise - */ - TBool CurrentListItemSelectionStatus(); - - /** - * Toggles highlighted item's selection - * @Since S60 5.1 - * @param None - * @return None - */ - void ToggleCurrentItemL(); - - /** - * Sets selection statuses to store lists - * @since S60 5.1 - * @param None - * @return None - */ - void SetServerSelectionsL(); - - protected: - -// From base class CoeControl - - /** - * From CoeControl - * See base class definition - */ - void GetHelpContext( TCoeHelpContext& aContext ) const; - - /** - * From CoeControl - * See base class definition - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * From CoeControl - * See base class definition - */ - TInt CountComponentControls() const; - - /** - * From CoeControl - * See base class definition - */ - void SizeChanged(); - - /** - * From CoeControl - * See base class definition - */ - void HandleResourceChange(TInt aType); - - /** - * From CoeControl - * See base class definition - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** - * From CoeControl - * See base class definition - */ - void HandlePointerEventL( const TPointerEvent& aPointerEvent ); - -// From base class MEikListBoxObserver - - /** - * From MEikListBoxObserver - * See base class definition - */ - void HandleListBoxEventL( CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ); - - - private: - - /** - * Updates listbox data - * @since S60 5.1 - * @param None - * @return None - */ - void UpdateListBoxDataL(); - - /** - * Checks if servers are not set and shows info note - * @since S60 5.1 - * @param None - * @return None - */ - void CheckServersAndShowNoteL(); - - private: - - /** - * Listbox control - */ - CAknColumnListBox* iListBox; // owned - /** - * pointer to AppUi object - */ - CMSAppUi& iMSAppUi; // not owned - /** - * All store rules - */ - CCmStoreRuleContainer* iStoreRuleContainer;// not owned - /** - * list selection indexes - */ - CArrayFix* iSelectionArray; // owned - /* - * Containers view - */ - CMSStoreListView& iView; - /** - * Context pane icon - */ - CFbsBitmap* iIcon; // not owned - /** - * Context pane icon mask - */ - CFbsBitmap* iIconMask; // not owned - }; - -#endif // C_MSSTORELISTCONTAINER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msstorelistcontroller.h --- a/homesync/contentmanager/mediaservant/inc/msstorelistcontroller.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +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: StoreListController class definition -* -*/ - - - - - -#ifndef C_MSSTORELISTCONTROLLER_H -#define C_MSSTORELISTCONTROLLER_H - -// INCLUDES -#include -#include "cmcommontypes.h" - - -// FORWARD DECLARATIONS -class CMSEngine; -class CCmStoreRuleContainer; -class CCmStoreRule; - -/** - * CMSStoreListController class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSStoreListController ): public CBase - { - public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * return pointer to CMSStoreListController - */ - static CMSStoreListController* NewL( CMSEngine& aMSEngine ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * return pointer to CMSStoreListController - */ - static CMSStoreListController* NewLC( CMSEngine& aMSEngine ); - - /** - * Destructor. - */ - virtual ~CMSStoreListController(); - - /** - * Returns store list container - * @since S60 5.1 - * @return CCmStoreRuleContainer, list container - */ - CCmStoreRuleContainer* StoreListContainer(); - - /** - * Reads list container and re-creates rule array - * @since S60 5.1 - */ - void UpdateListsL(); - - private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aMSEngine, application engine - * @return None - */ - CMSStoreListController( CMSEngine& aMSEngine ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Creates default store rules - * Since S60 5.1 - * @param None - * @return None - */ - void CreateStoreRulesL(); - - /** - * Changes names of store rules - * @since S60 5.1 - * @param None - * @return None - */ - void ChangeStoreRuleNamesL( void ); - - private: - - /** - * pointer to application engine - */ - CMSEngine* iMSEngine; // not owned - /** - * Fill rules - */ - CCmStoreRuleContainer* iStoreListContainer; // owned - }; - - -#endif // C_MSSTORELISTCONTROLLER_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msstorelistview.h --- a/homesync/contentmanager/mediaservant/inc/msstorelistview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +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: CMSStoreListView class definition -* -*/ - - - - - -#ifndef C_MSSTORELISTVIEW_H -#define C_MSSTORELISTVIEW_H - -// INCLUDES -#include "msengineobserver.h" -#include "msbaseview.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSStoreListContainer; -//class CMSEngine; - -/** - * CMSStoreListView view class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSStoreListView ): public CMSBaseView, - public MMSEngineObserver - { - - public: - - /** - * Constructor. - * - * @since S60 5.1 - * @param aAppUi, application UI - * @return None - */ - CMSStoreListView( CMSAppUi& aAppUi ); - - /** - * Symbian default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CMSStoreListView(); - - /** - * ListBox focus index - * @since S60 v3.1 - * @return TInt, focus index - */ - TInt FocusIndex() const; - - /** - * Creates and sets navi pane text - * @since S60 3.2 - */ - void CreateAndSetNaviTextL(); - - /** - * Returns store list preprocessing state - * @since S60 5.1 - * @return TBool, ETrue if preprocessing, otherwise EFalse - */ - TBool PreProcessing(); - - protected: - -// From base class CAknView - - /** - * From CAknView - * See base class definition - */ - TUid Id() const; - - /** - * From CAknView activate the view - * See base class definition - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView activate the view - * See base class definition - */ - void DoDeactivate(); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - /** - * From MEikMenuObserver - * See base class definition - */ - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - -// From base class MMSEngineObserver - - /** - * From MMSEngineObserver - * See base class definition - */ - void ReadyL( TCmService aService, TInt aError ); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi& iAppUi; // not owned - /** - * view's container - */ - CMSStoreListContainer* iContainer; // owned - /** - * Focus index - */ - TInt iFocusIndex; - /** - * preprocessing state - */ - TBool iPreprocessingState; - }; - -#endif // C_MSSTORELISTVIEW_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msstoreserverssetting.h --- a/homesync/contentmanager/mediaservant/inc/msstoreserverssetting.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +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: CMSStoreServersSetting class definition -* -*/ - - -#ifndef C_MSSTORESERVERSSETTING_H -#define C_MSSTORESERVERSSETTING_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CMSAppUi; -class CCmMediaServerFull; -class CMSAppUi; -class CSelectionItemList; -class CCmStoreRule; - - -// CLASS DECLARATION - -/** - * CMSStoreServersSetting class. This class is used when - * server list is modified - * - * @since S60 5.1 -*/ -NONSHARABLE_CLASS( CMSStoreServersSetting ): public CAknTextSettingItem - { - public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aIdentifier, setting resource id - * @param aAppUi, application UI - * @param aText, dummy - just for setting creation - * @return pointer to CMSStoreServersSetting - */ - static CMSStoreServersSetting* NewL( TInt aIdentifier, - CCmStoreRule* aRule, - CMSAppUi& aAppUi, - TDes& aText ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aIdentifier, setting resource id - * @param aAppUi, application UI - * @param aText, dummy - just for setting creation - * @return None - */ - static CMSStoreServersSetting* NewLC( TInt aIdentifier, - CCmStoreRule* aRule, - CMSAppUi& aAppUi, - TDes& aText ); - - /** - * Destructor. - */ - virtual ~CMSStoreServersSetting(); - - - protected: - - /** - * Creates selection list for setting page - * @since S60 3.1 - */ - void CreateSelectionItemListL(); - - /** - * Counts selected items - * @since S60 3.1 - * @return TInt, item count - */ - TInt CountSelectedItems(); - - /** - * Sets setting item secondary text according to selected devices - * @since S60 3.1 - */ - void SetSettingItemTextL(); - -// From base class CAknSettingItem - - /** - * From CAknSettingItem - * See base class definition - */ - void EditItemL( TBool aCalledFromMenu ); - - - private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aIdentifier, setting resource id - * @param aAppUi, application UI - * @param aText, dummy - just for setting creation - * @return None - */ - CMSStoreServersSetting( - TInt aIdentifier, - CCmStoreRule* aRule, - CMSAppUi& aAppUi, - TDes& aText - ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - - /** - * Deletes all servers from rule - * - * @since S60 5.1 - */ - void DeleteAllServersFromRuleL(); - - private: - - /** - * server list - */ - RPointerArray* iServers; // owned - /** - * current rule - */ - CCmStoreRule* iRule; // not owned - /** - * application ui - */ - CMSAppUi& iAppUi; - /** - * setting page item array (servers) - */ - CSelectionItemList* iItemArray; // owned - /** - * Server name string (external set) - */ - HBufC* iSettingText; // owned - /** - * Selected item count - */ - TInt iSelectedItemCount; - }; - -#endif // C_MSSTORESERVERSSETTING_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msstoresettingslist.h --- a/homesync/contentmanager/mediaservant/inc/msstoresettingslist.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +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: CMSStoreSettingsList class definition -* -*/ - - -#ifndef C_MSSTORESETTINGSLIST_H -#define C_MSSTORESETTINGSLIST_H - -// INCLUDES -#include -#include "msengineobserver.h" -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CCmStoreRuleContainer; -class CCmStoreRule; -class CCmMediaServerFull; -class CMSStoreSettingsView; - -// CLASS DECLARATION - -/** - * CMSStoreSettingsList general class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSStoreSettingsList ): public CAknSettingItemList, - public MMSEngineObserver - { - public: - - /** - * Two-phased constructor. - * - * @since S60 5.1. - * @param aResourceId : resource ID of setting page. - * @param aAppUi, application UI - * @param aView, store settings view - * @return pointer to CMSStoreSettingsList - */ - static CMSStoreSettingsList* NewL( TInt aResourceId, - CMSAppUi& aAppUi, - CMSStoreSettingsView& aView ); - - /** - * Two-phased constructor. - * - * @since S60 5.1. - * @param aResourceId : resource ID of setting page. - * @param aAppUi, application UI - * @param aView, store settings view - * @return pointer to CMSStoreSettingsList - */ - static CMSStoreSettingsList* NewLC( TInt aResourceId, - CMSAppUi& aAppUi, - CMSStoreSettingsView& aView ); - - /** - * Destructor. - */ - virtual ~CMSStoreSettingsList(); - - /** - * Opens the selected listbox item - * @since S60 5.1 - * @param None - * @return None - */ - void OpenSelectedListboxItemL(); - - protected: - -// From base class CAknSettingItemList - - /** - * From CAknSettingItemList - * See base class definition - */ - CAknSettingItem* CreateSettingItemL( TInt aSettingId ); - - /** - * From CAknSettingItemList - * See base class definition - */ - void HandleListBoxEventL ( CEikListBox *aListBox, - TListBoxEvent aEventType ); - -// From base class CCoeControl - - /** - * From CCoeControl - * See base class definition - */ - void SizeChanged(); - - /** - * From CoeControl - * See base class definition - */ - void HandleResourceChange( TInt aType ); - - /** - * From CoeControl - * See base class definition - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - -// From base class MMSEngineObserver - - /** - * From MMSEngineObserver - * See base class definition - */ - void ReadyL( TCmService aService, TInt aError ); - - private: - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aResourceId, settinglist resource id - * @return None - */ - void ConstructL( TInt aResourceId ); - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aAppUi, application UI - * @param aView, store settings view - * @return None - */ - CMSStoreSettingsList( CMSAppUi& aAppUi, CMSStoreSettingsView& aView ); - - /** - * Reads rule status - * @since S60 5.1 - */ - void ReadRuleStatus(); - - /** - * Saves 'keep on phone' setting to rule - * @since S60 5.1 - */ - void SaveKeepOnPhoneSetting(); - - /** - * Sets title pane text accordin to media type - * @since S60 5.1 - */ - void SetTitlePaneTextL(); - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi& iAppUi; // not owned - /** - * dummy text needed by CAknTextSettingItem - */ - TBuf iDummyText; - /** - * All store rules - */ - CCmStoreRuleContainer* iStoreRuleContainer; // not owned - /** - * Store rule - */ - CCmStoreRule* iStoreRule; // not owned - /** - * Keep on phone setting - */ - TInt iKeepOnPhone; - /** - * Media type - */ - TCmMediaType iMediaType; - /** - * Wait note - */ - CAknWaitDialog* iWaitNoteDialog;// owned - /** - * Parent view - */ - CMSStoreSettingsView& iView; - }; - -#endif // C_MSSTORESETTINGSLIST_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/inc/msstoresettingsview.h --- a/homesync/contentmanager/mediaservant/inc/msstoresettingsview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +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: CMSStoreSettingsView class definition -* -*/ - - - - - -#ifndef C_MSSTORESETTINGSVIEW_H -#define C_MSSTORESETTINGSVIEW_H - -// INCLUDES -#include "msbaseview.h" - -// FORWARD DECLARATIONS -class CMSAppUi; -class CMSEngine; -class CMSStoreSettingsList; - -/** - * CMSStoreSettingsView class. - * - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CMSStoreSettingsView ) : public CMSBaseView - { - - public: - - /** - * Constructor. - * - * @since S60 5.1 - * @param aAppUi, application UI - * @return None - */ - CMSStoreSettingsView( CMSAppUi& aAppUi ); - - /** - * default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - virtual ~CMSStoreSettingsView(); - - protected: - -// From base class CAknView - - /** - * From CAknView - * See base class definition - */ - TUid Id() const; - - /** - * From CAknView - * See base class definition - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - -// From base class MEikMenuObserver - - /** - * From MEikMenuObserver - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - - private: - - /** - * pointer to AppUi object - */ - CMSAppUi& iAppUi; // not owned - /** - * Views container class - */ - CMSStoreSettingsList* iContainer; // owned - }; - -#endif // C_MSSTORESETTINGSVIEW_H - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/loc/mediaservant.loc --- a/homesync/contentmanager/mediaservant/loc/mediaservant.loc Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1433 +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: Localization strings for project MediaServant -* -*/ - - -//d:Item primary text on Home Media listbox -//d:Name of application -//l:list_double_large_graphic_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_grid_media_servant_home_media "Media Sync" - -//d:Item secondary text on Home Media listbox -//d:Synchronization will be done automatically -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_main_sync_auto "Automatic sync" - -//d:Item secondary text on Home Media listbox -//d:Synchronization will be done manually -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_main_sync_manual "Manual sync" - -//d:Item secondary text on Home Media listbox -//d:Synchronization is ongoing -//d:Parameter maximum length: 3 characters -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_main_sync "Synchronizing %N%" - -//d:Item secondary text on Home Media listbox -//d:Refresh is ongoing -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_main_refreshing "Refreshing" - -//d:Application title -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_media_servant "Media Sync" - - -// NOTES - -//d:Info note -//d:Target devices not selected -//l:popup_note_window -//r:2.1 -// -#define qtn_mserv_no_target_devices "You first need to set a target device where to synchronize." - -//d:Error note -//d:User can't enter to other views if refresh operation is ongoing -//l:popup_note_window/opt2 -//r:1.0 -// -#define qtn_mserv_access_error "Access is denied while refreshing is active" - -//d:Error note -//d:User can't enter to other views if synronization is ongoing -//l:popup_note_window/opt2 -//r:2.0 -// -#define qtn_mserv_access_error_sync "Access is denied while synchronizing is active" - -//d:Error note -//d:User can't enter to fill list view if memory card is not inserted -//l:popup_note_window/opt2 -//r:1.0 -// -#define qtn_mserv_mcard_error "Insert a memory card" - -//d:Fill list deactivation note -//d:Asks user if he wants to remove files on next synchronization -//l:popup_note_window -//r:2.0 -// -#define qtn_mserv_lists_edited "You unselected some lists. Their files are removed on next sync." - -//d:Information note -//d:Automatic sync is not performed if there is no access point selected -//l:popup_note_window -//r:1.0 -// -#define qtn_mserv_info_no_ap "Only manual sync allowed when no default access point is defined." - -//d:Confirmation query -//d:New memory card inserted -//l:popup_note_window/opt2 -//r:1.0 -// -#define qtn_mserv_conf_used_memory "New memory card inserted. Use this for Media Sync?" - -//d:Confirmation query -//d:New memory card inserted -//l:popup_note_window -//r:2.1 -// -#define qtn_mserv_qry_add_video_date "Some media servers don't support search by date which concludes to an empty result. Add anyway?" - -//d:Confirmation query -//d:Delete current list -//l:popup_note_window/opt2 -//r:1.0 -// -#define qtn_mserv_conf_delete_list "Delete list and its content on phone?" - -//d:Error note -//d:Devices not found during device search -//l:popup_note_window/opt2 -//r:1.0 -// -#define qtn_mserv_error_not_found "Device(s) not found" - -//d:Error note -//d:Syncronization interrupted -//l:popup_note_window/opt2 -//r:1.0 -// -#define qtn_mserv_error_sync_interrupted "Sync. interrupted" - -//d:Error note -//d:All target devices not found so syncronization is done only partially -//l:popup_note_window -//r:2.1 -// -#define qtn_mserv_soft_partial "All target devices were not accessible for storing." - -// TITLE PANE - -//d:Fill list view title -//d:List reordering mode is active -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_reorder "Reorder list" - -//d:Fill list view title -//d:Files are moved from PC to phone -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_from_home "From Home" - -//d:store list view title -//d:Files are moved from phone to PC -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_to_home "To Home" - -//d:Fill list edit view -//d:List type is image -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_edit_rules_image "Image list" - -//d:Fill list edit view -//d:List type is video -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_edit_rules_video "Video list" - -//d:Fill list edit view -//d:List type is music -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_edit_rules_music "Music list" - -//d:Store browse view title -//d:list type is phone videos -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_phone_videos "Captured videos" - -//d:Store browse view title -//d:list type is other videos -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_other_videos "Other videos" - -//d:Store browse view title -//d:list type is music -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_music "Music" - -//d:Store settings view title -//d:list type is phone images -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_phone_images "Captured images" - -//d:Store settings view title -//d:list type is other images -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_title_other_images "Other images" - -//d:Multiselection view title ( video title setting ) -//d:Video title selection -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_sett_name "Name" - -//d:Setting page text -//d:Genre selection -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_sett_genre "Genre" - -//d:Setting page text -//d:Artist name selection -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_sett_artist "Artist" - -//d:Setting page text -//d:Album name selection -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_sett_album "Album" - -//d:Setting page text -//d:Track name selection -//l:title_pane_t2/opt9 -//r:1.0 -// -#define qtn_mserv_sett_track "Track" - - -// OPTIONS MENU - -//d:Menu text in main view -//d:Starts/stops sync operation -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_select "Select" - -//d:Menu text in main view -//d:Starts updating metadata between phone and servers -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_refresh "Refresh information" - -//d:Menu text in main view -//d:Stops updating metadata between phone and servers -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_refresh_stop "Stop refreshing" - -//d:Menu text in main view -//d:Opens general settings view -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_sync_settings "Sync Settings" - -//d:Menu text in main view -//d:Opens settings wizard -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_run_wizard "Run Wizard" - -//d:Menu text in fill list view -//d:Deselects current fill list -//l:list_single_pane_t1_cp2 -//r:2.0 -// -#define qtn_mserv_options_unselect "Unselect" - -//d:Menu text in fill view -//d:Opens fill list editor view -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_edit "Edit" - -//d:Menu text in store list view -//d:Opens file browse view -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_browse "Show files" - -//d:Menu text in fill rule edit view -//d:Removes current rule -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_remove_rule "Remove rule" - -//d:Menu text in browse view -//d:Locs file so that it can't be deleted on next synchronization -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_lock_on_phone "Lock on phone" - -//d:Menu text in browse view -//d:Unlocks file so it can be deleted on next synchronization -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_unlock "Unlock" - -//d:Menu text in browse view -//d:Fetches new files to the list -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_randomiza "Randomize again" - -//d:Menu text in fill view -//d:Creates new fill list -//l:list_single_pane_t1_cp2/opt3 -//r:1.0 -// -#define qtn_mserv_options_new_list "New list" - -//d:Submenu text in fill view -//d:New image list -//l:list_single_popup_submenu_pane_t1 -//r:1.0 -// -#define qtn_mserv_options_new_image "Image" - -//d:Submenu text in fill view -//d:New video list -//l:list_single_popup_submenu_pane_t1 -//r:1.0 -// -#define qtn_mserv_options_new_video "Video" - -//d:Submenu text in fill view -//d:New music list -//l:list_single_popup_submenu_pane_t1 -//r:1.0 -// -#define qtn_mserv_options_new_music "Music" - -//d:Menu text in fill view -//d:User can reorder fill list -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_reorder "Change priority" - -//d:Menu text in fill view -//d:Deletes fill list -//l:list_single_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_options_delete "Delete" - - -// QUERIES - - -//d:Add rule -//l:heading_pane_t1 -//r:1.0 -// -#define qtn_mserv_head_add_rule "Add rule" - -//d:data query heading -//d:data amount query ( amount setting item ) -//l:popup_query_data_window -//r:1.0 -// -#define qtn_mserv_head_amount_count "Set count" - -//d:data query heading -//d:Data size query ( amount setting item ) -//l:popup_query_data_window -//r:1.0 -// -#define qtn_mserv_head_amount_mb "Set MB" - - -// LISTBOX ITEMS - -//d:Starts synchronization operation -//l:list_double_large_graphic_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_sync_now "Sync now" - -//d:Stops synchronization operation -//l:list_double_large_graphic_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_sync_stop "Stop sync" - -//d:Opens fill list view -//d:Settings for moving files from PC to phone -//l:list_double_large_graphic_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_from_home "From home" - -//d:Listbox item secondary text -//d:Memory card is not inserted to phone -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_memory_card_needed "No memory card" - -//d:Opens store list view -//d:Settings for moving files from phone to PC -//l:list_double_large_graphic_pane_t1_cp2 -//r:1.0 -// -#define qtn_mserv_to_home "To Home" - -//d:Listbox item secondary text -//d:All files are synchronized -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_in_sync "All in sync" - -//d:Listbox item secondary text -//d:No fill lists selected -//l:list_double_large_graphic_pane_t2_cp2 -//r:9.1 -// -#define qtn_mserv_nothing_selected "Nothing selected" - -//d:Listbox item secondary text -//d:N files are not synchronized -//d:Parameter max length: 5 characters -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_new_items "%N new items" - -//d:Listbox item secondary text -//d:One item is not synchronized -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_one_item "1 new item" - -//d:Listbox item secondary text -//d:Estimated duration of next synchronization -//d:Parameter max length: 4 characters -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_sync_time "Takes %N mins" - -//d:Listbox item secondary text -//d:Estimated duration of next synchronization is 1 min -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_sync_time_one "Takes 1 min" - -//d:Listbox item secondary text -//d:Synchronization is waiting for own turn -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_waiting_sync "Waiting" - - -//d:Default fill list -//l:list_single_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_def_latest_org "Latest images" - -//d:Default fill list -//l:list_single_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_def_latest_videos "Latest videos" - -//d:Default fill list -//l:list_single_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_def_recent_music "Latest music" - - -// SETTING ITEMS - - -// IMAGE LIST SETTINGS - -//d:Setting list item primary text -//d:Image shrinking -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_shrink_image "Shrink images" - -//d:Setting page heading text -//d:Image shrinking setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_shrink_image "Shrink images" - -//d:Setting page item text -//d:Images are shrinked to screen size -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_screen_size "To phone screen size" - -//d:Setting page item text -//d:Images are not shrinked -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_no_shrinking "No shrinking" - - - -//d:Setting item text -//d:Amount of files to be fetched -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_amount "Amount" - -//d:Setting item text -//d:Amount of data -//d:Parameter length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_amount_mb_list "%N MB" - -//d:Setting item text -//d:Amount of data -//d:Parameter length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_amount_item_list "%N items" - -//d:Setting item text -//d:Amount of data -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_amount_item_1_list "1 item" - -//d:Setting item text -//d:Amount of data -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_amount_item_0_list "0 items" - -//d:Setting page heading text -//d:Amount of files to be fetched -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_amount "Amount" - -//d:Setting page item text -//d:Amount of data -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_amount_unlimited "Unlimited" - -//d:Setting page item text -//d:Amount of data -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_amount_count "Set count" - -//d:Setting page item text -//d:Amount of data -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_amount_mb "Set MB" - - - -//d:Setting list item primary text -//d:Starts searching oldest, latest or random items -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_start_with "Starting with" - -//d:Setting page heading text -//d:Starts searching with oldest, latest or random items -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_start_with "Starting with" - -//d:Setting page item text -//d:Search latest items -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_start_latest "Latest" - -//d:Setting page item text -//d:Search oldest items -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_start_oldest "Oldest" - -//d:Setting page item text -//d:Search random items -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_random "Random" - -//d:Setting list item primary text -//d:Starts searching from specified date -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_from "From" - -//d:Setting page heading text -//d:Starts searching from specified date -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_from "From" - -//d:Setting list item primary text -//d:Search end date -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_until "Until" - -//d:Setting page text -//d:Search end date -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_until "Until" - -//d:Secondary text for video title -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_list_any_name "Any" - -//d:Secondary text for music genre -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_list_any_genre "Any" - -//d:Secondary text for music artist -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_list_any_artist "Any" - -//d:Secondary text for music album -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_list_any_album "Any" - -//d:Secondary text for music track -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_list_any_track "Any" - -//d:Secondary text for source devices -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_list_any_source_device "Any" - -//d:Multiselection list item text for video title -//d:Search criteria is "any" -//l:list_single_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_name "Any" - -//d:Multiselection list item text for file size -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_file_size "Any" - -//d:Multiselection list item text for music genre -setting -//d:Search criteria is "any" -//l:list_single_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_genre "Any" - -//d:Multiselection list item text for music artist -setting -//d:Search criteria is "any" -//l:list_single_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_artist "Any" - -//d:Multiselection list item text for music album -setting -//d:Search criteria is "any" -//l:list_single_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_album "Any" - -//d:Multiselection list item text for music track -setting -//d:Search criteria is "any" -//l:list_single_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_track "Any" - -//d:Multiselection list item text for source devices -setting -//d:Search criteria is "any" -//l:list_single_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_source_device "Any" - -//d:Item text for music track length -setting -//d:Search criteria is "any" -//l:list_set_graphic_pane_t1 -//r:2.0 -// -#define qtn_mserv_value_any_track_length "Any" - - -//d:Setting item text -//d:Servers where data will be searched -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_storage "Source devices" - -//d:Setting item text -//d:Selected server count -//d:Parameter maximum length: 3 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_n_servers "%N devices" - -//d:Setting page heading text -//d:fill source devices -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_storage "Storage server" - - - -//d:Setting item text -//d:Free text search criteria -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_free_text "Contains text" - -//d:Setting item secondary text -//d:If no text defined -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_none "None" - -//d:Setting page heading text -//d:Free text criteria -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_free_text "Contains text" - - - - -// VIDEO LIST SETTINGS - -//d:Setting item text -//d:Video title search criteria -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_name "Name" - -//d:Setting page heading text -//d:N titles selected -//d:Parameter maximum length: 3 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_n_names "%N names" - - - -//d:Setting item text -//d:Minimum file size -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_file_size_min "Min file size" - -//d:Setting item text -//d:Minimum file size setting -//d:Parameter maximum length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_min_list "%N MB" - -//d:Setting page heading text -//d:Min file size setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_file_size_min "Min file size" - -//d:Setting page text -//d:Minimum file size -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_min_mb "Set min MB" - -//d:Setting item text -//d:Maximum file size -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_file_size_max "Max file size" - -//d:Setting item text -//d:Maximum file size setting -//d:Parameter maximum length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_max_list "%N MB" - -//d:Setting page heading text -//d:Max file size setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_file_size_max "Max file size" - -//d:Setting page text -//d:Minimum file size -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_max_mb "Set max MB" - - -// MUSIC LIST SETTINGS - -//d:Setting item primary text -//d:Music genre setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_genre "Genre" - -//d:Setting item secondary text -//d:Number of selected genres -//d:Parameter maximum length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_n_genre "%N genres" - - - -//d:Setting item text -//d:Artist name setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_artist "Artist" - -//d:Setting item secondary text -//d:number of selected artists -//d:Parameter maximum length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_n_artists "%N artists" - - - -//d:Setting item text -//d:Title names -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_album "Album" - -//d:Setting item secondary text -//d:number of selected albums -//d:Parameter maximum length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_n_album "%N albums" - - - -//d:Setting item text -//d:Track names -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_track "Track" - -//d:Setting item secondary text -//d:number of selected tracks -//d:Parameter maximum length: 5 characters -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_n_tracks "%N tracks" - - - -//d:Setting item text -//d:Track length -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_track_length "Track length" - -//d:Setting page heading text -//d:Track length setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_track_length "Track length" - -//d:Setting item text -//d:Track length setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_less_1 "Less than 1 min." - -//d:Setting item text -//d:Track length setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_16_min "1-6 mins." - -//d:Setting item text -//d:Track length setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_68_min "6-8 mins." - -//d:Setting item text -//d:Track length setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_830_min "8-30 mins." - -//d:Setting item text -//d:Track length setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_more_4 "More than 30 mins." - -//d:Setting item text -//d:File size setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_file_size "File size" - -//d:Setting page heading text -//d:File size setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_file_size "File size" - -//d:Setting page text -//d:File size setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_less_1_mb "Less than 1 MB" - -//d:Setting page text -//d:File size setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_15_mb "1-5 MB" - -//d:Setting page text -//d:File size setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_510_mb "5-10 MB" - -//d:Setting page text -//d:File size setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_1050_mb "10-50 MB" - -//d:Setting page text -//d:File size setting -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_value_more_50 "More than 50 MB" - - - -// EDIT FILL LIST SETTINGS - -//d:Setting list item primary text -//d:Fill list name -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_list_name "List name" - -//d:Setting page heading text -//d:Fill list name -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_rule_list_name "List name" - -//d:Setting list item primary text -//d:User can add more rules -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_rule_add "Add more rules" - - -// FILL LIST BROWSE VIEW - -//d:List item secondary text -//d:File status is set "skipped" -//l:list_double_large_graphic_pane_t2_cp2 -//r:1.0 -// -#define qtn_mserv_status_skipped "Skipped" - - -// STORE LIST VIEW - -//d:List item text -//d:Captured images category -//l:list_single_graphic_pane_t1 -//r:2.1 -// -#define qtn_mserv_store_check_phone_images "Captured images" - -//d:List item text -//d:Other images category -//l:list_single_graphic_pane_t1 -//r:2.1 -// -#define qtn_mserv_store_check_other_images "Other images" - -//d:List item text -//d:Captured videos category -//l:list_single_graphic_pane_t1 -//r:2.1 -// -#define qtn_mserv_store_check_phone_videos "Captured videos" - -//d:List item text -//d:Other videos category -//l:list_single_graphic_pane_t1 -//r:2.1 -// -#define qtn_mserv_store_check_other_videos "Other videos" - -//d:List item text -//d:Music category -//l:list_single_graphic_pane_t1 -//r:2.1 -// -#define qtn_mserv_store_check_music "Music" - - -// STORE SETTINGS VIEW - -//d:Store setting item primary text -//d:Location where files will be copied -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_target_devices "Target devices" - -//d:Setting page heading text -//d:Sets target devices for file copying -//l:list_setting_pane_t1 -//r:1.0 -#define qtn_mserv_sett_target_devices "Target devices" - -//d:Setting list item primary text -//d:Local copy setting -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_local_copy "Keep on phone" - -//d:Setting list item secondary text -//d:File is not kept on the phone -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_no_local "No" - -//d:Setting list item secondary text -//d:File is kept on the phone -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_yes_local "Yes" - -//d:Setting list item secondary text -//d:File is kept on the phone ( just for images ) -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_original_size "Original size" - -//d:Setting list item secondary text -//d:Screen size version of the image file is kept on the phone -//l:list_set_graphic_pane_t1 -//r:1.0 -// -#define qtn_mserv_item_screen_size "Phone screen size" - -//d:Setting page heading text -//d:Source devices where data search is done -//l:list_setting_pane_t1 -//r:1.0 -// -#define qtn_mserv_sett_source_devices "Source device(s)" - -// NAVI PANE - -//d:status information -//d:Content refreshing completed -//l:navi_text_pane_t1 -//r:9.1 -// -#define qtn_mserv_navi_refresh_completed "Refresh completed" - -//d:Process progress info -//d:Parameter maximum length: 3 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_sync "Synchronizing %N%" - -//d:Last sync time in minutes -//d:Parameter maximum length: 2 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_last_sync_min "Synced %N mins ago" - -//d:Last sync time 1 minute ago -//d: navi pane -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_last_sync_min_one "Synced 1 min ago" - -//d:Last sync time in hours -//d:Parameter maximum length: 2 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_last_sync_hour "Synced %N hours ago" - -//d:Last sync time 1 hour ago -//d:navi pane -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_last_sync_hour_one "Synced 1 hour ago" - -//d:Last sync time in days -//d:Parameter maximum length: 3 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_last_sync_day "Synced %N days ago" - -//d:Last sync time 1 day ago -//d:navi pane -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_last_sync_day_one "Synced 1 day ago" - -//d:Process progress info -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_refreshing "Refreshing %N%" - -//d:list size info -//d:Parameters maximum length: 4 characters, 4 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_list_size "%0N MB (%1N free)" - -//d:file size & count -//d:Parameters maximum length: 4 characters, 5 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_items_fill_list "%0N MB, %1N items" - -//d:file size & count -//d:Parameters maximum length: 4 characters, 5 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_rules_amount "%0N MB, %1N items" - -//d:file size & count -//d:Parameters maximum length: 6 characters -//l:navi_text_pane_t1 -//r:2.0 -// -#define qtn_mserv_navi_rules_amount1 "%N MB, 1 item" - -//d:file size & count -//d:Parameters maximum length: 6 characters -//l:navi_text_pane_t1 -//r:2.0 -// -#define qtn_mserv_navi_rules_amount0 "%N MB, 0 items" - -//d:Store browser view navi pane text -//d:Amount of items -//d:Parameter maximum length: 5 characters -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_navi_items_store_browse "%N items" - -//d:Store browser view navi pane text -//d:Amount of items -//l:navi_text_pane_t1 -//r:2.0 -// -#define qtn_mserv_navi_items_store_browse1 "1 item" - -//d:Fill list view navi pane text -//d:Amount of items -//l:navi_text_pane_t1 -//r:2.0 -// -#define qtn_mserv_navi_items_fill_list1 "%N MB, 1 item" - -//d:Fill list view navi pane text -//d:Amount of items -//l:navi_text_pane_t1 -//r:2.1 -// -#define qtn_mserv_navi_items_fill_list_no_items "No items" - -//d:Fill rule list -view's navi pane text -//d:Amount of items -//l:navi_text_pane_t1 -//r:2.1 -// -#define qtn_mserv_navi_one_new_item "1 new item" - -//d:Fill rule list -view's navi pane text -//d:Amount of items -//l:navi_text_pane_t1 -//r:2.1 -// -#define qtn_mserv_navi_rules_amount_no_items "No items" - -//d:Store list view's navi pane text -//d:Amount of new items -//l:navi_text_pane_t1 -//r:2.1 -// -#define qtn_mserv_navi_no_new_items "No new items" - -//d:Store list view's navi pane text -//d:Amount of new items -//d:Parameter maximum length: 5 characters -//l:navi_text_pane_t1 -//r:2.1 -// -#define qtn_mserv_navi_new_items "%N new items" - -//d:Store browse view's navi pane text -//d:Amount of items -//l:navi_text_pane_t1 -//r:2.1 -// -#define qtn_mserv_navi_items_store_browse_none "No items" - -//d:Navi pane text -//d:Preprocesses files so that updated information can be seen on screen -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_wait_preprocessing "Updating lists" - -//d:Navi pane text -//d:Updating list -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_wait_updating_list "Updating list" - -//d:Navi pane text -//d:Creates new list of files with random method -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_wait_randomize "Randomizing" - -//d:Navi pane text -//d:Reads data e.g artist names, video titles, genres,... -//l:navi_text_pane_t1 -//r:1.0 -// -#define qtn_mserv_wait_getting_data "Reading data" - -// SOFTKEY TEXTS - -//d:Left softkey text -//d:Used with list reordering -//l:control_pane_t1/opt7 -//r:1.0 -// -#define qtn_mserv_skey_drop "Drop" - -//d:Left softkey text -//d:Used with list reordering -//l:control_pane_t1/opt7 -//r:1.0 -// -#define qtn_mserv_skey_grab "Grab" - -//d:Right softkey text -//d:Used to end reordering -//l:control_pane_t1/opt7 -//r:1.0 -// -#define qtn_mserv_skey_done "Done" - -//d:Middle softkey -//d:Deselects current fill list -//l:control_pane_t3/opt7 -//r:2.0 -// -#define qtn_mserv_msk_unselect "Unselect" - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/plugin/data/200075DD.rss --- a/homesync/contentmanager/mediaservant/plugin/data/200075DD.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2000 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 resource definition -* -*/ - - -#include -#include "pluginuids.h" - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = MSPluginUid; - - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x200075DD; - implementations = - { - // Info for - IMPLEMENTATION_INFO - { - implementation_uid = MSPluginImplementationUid; - version_no = 1; - display_name = "mediaservantplugin"; - default_data = "mediaservantplugin"; - opaque_data = ""; - } - }; - } - }; - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/plugin/group/bld.inf --- a/homesync/contentmanager/mediaservant/plugin/group/bld.inf Mon Nov 01 13:44:24 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 information file for project MediaServant -* -*/ - - - -PRJ_MMPFILES -mediaservantplugin.mmp - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/plugin/group/mediaservantplugin.mmp --- a/homesync/contentmanager/mediaservant/plugin/group/mediaservantplugin.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +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 -* -*/ - -#include - -TARGET mediaservantplugin.dll - -CAPABILITY CAP_ECOM_PLUGIN - -TARGETTYPE PLUGIN - -UID 0x10009D8D 0x1028290E -VENDORID VID_DEFAULT - -SECUREID 0x1028290E - - - -SOURCEPATH ../../src -SOURCE mspropertywatcher.cpp -SOURCEPATH ../src -SOURCE mediaservantplugin.cpp -SOURCE proxy.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../inc // for propertywathcer.h - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../../../inc - -START RESOURCE ../data/200075DD.rss -TARGET mediaservantplugin.rsc -TARGETPATH resource/plugins -END - - - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY fbscli.lib -LIBRARY AKNSKINS.lib -LIBRARY aknskinsrv.lib -LIBRARY egul.lib -LIBRARY msengine.lib -LIBRARY CommonEngine.lib // stringloader -LIBRARY eikcore.lib // CoeEnv -LIBRARY bafl.lib -LIBRARY apgrfx.lib // apasession -LIBRARY apparc.lib // appinfo -LIBRARY cone.lib -LIBRARY avkon.lib -LIBRARY PlatformEnv.lib // pathinfo - - -DEBUGLIBRARY flogger.lib - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/plugin/inc/mediaservantplugin.h --- a/homesync/contentmanager/mediaservant/plugin/inc/mediaservantplugin.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +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: CMediaservantPlugin class definition -* -*/ - - -#ifndef C_MEDIASERVANTPLUGIN_H -#define C_MEDIASERVANTPLUGIN_H - -// INCLUDES -#include -#include -#include "mspropertywatcher.h" - -// FORWARD DECLARATIONS -class CEikonEnv; -class CMSEngine; - -/** - * MediaServant UPnP plugin class - * - * @Since S60 5.1 - */ -class CMediaservantPlugin : public CUPnPPluginInterface, - public MMSPropertyObserver - { - public: - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aPluginObserver observer for plugins - * @return pointer to CMediaservantPlugin - */ - static CMediaservantPlugin* NewL( - MUPnPPluginObserver* aPluginObserver); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aPluginObserver observer for plugins - * @return pointer to CMediaservantPlugin - */ - static CMediaservantPlugin* NewLC( - MUPnPPluginObserver* aPluginObserver); - - /** - * Informs to ECom that it has been destroyed. - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual ~CMediaservantPlugin(); - - protected: - -// From base class CUPnPPluginInterface - - /** - * From CUPnPPluginInterface - * See base class definition - */ - const CGulIcon& GetIcon(); - - /** - * From CUPnPPluginInterface - * See base class definition - */ - const TDesC& GetTitle(); - - /** - * From CUPnPPluginInterface - * See base class definition - */ - const TDesC& GetSecondaryText(); - - /** - * From CUPnPPluginInterface - * See base class definition - */ - void ExecuteL(); - - /** - * From CUPnPPluginInterface - * See base class definition - */ - TBool RequiresUpnpConfiguration(); - -// From base class MMSPropertyObserver - - /** - * From MMSPropertyObserver - * See base class definition - */ - void PropertyChangedL( TCmService aService, - TInt aTotalItems, - TInt aProcessedItems, - TInt aItemsToBeProcessed ); - - private: - - /** - * Performs the second phase construction. - * - * @since S60 5.1 - * @param aPluginObserver observer for plugins - * @return None - */ - void ConstructL( MUPnPPluginObserver* aPluginObserver ); - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aEcomArguments, Ecom arguments - * @return None - */ - CMediaservantPlugin( TAny* aEcomArguments ); - - /** - * Load secondary text to plugin - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadPluginTextL(); - - private: - /** - * Required in all plugins which implement CUPnPPluginInterface - */ - MUPnPPluginObserver* iPluginObserver; - - /** - * Plugin primary text - */ - HBufC* iTitle; // owned - /** - * Plugin secondary text - */ - HBufC* iSecondaryText; // owned - /** - * Flag for indication that IAP setup is needed - */ - TBool iRequiresUpnpConf; - /** - * Plugin icon - */ - CGulIcon* iIcon; // owned - /** - * Resource file offset - */ - TInt iResFileOffset; - /** - * Control environment for res file handling - */ - CEikonEnv* iCoeEnv; - /** - * Progress watcher - */ - CMSPropertyWatcher* iMSPropertyWatcher; // owned - /** - * Application engine for text loading - */ - CMSEngine* iMSEngine; // owned - }; - - -#endif // C_MEDIASERVANTPLUGIN_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/plugin/inc/pluginuids.h --- a/homesync/contentmanager/mediaservant/plugin/inc/pluginuids.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +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: Plugin Uid definitions -* -*/ - - -#define MSPluginUid 0x1028290E -#define MSPluginImplementationUid 0x1028290E diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/plugin/src/mediaservantplugin.cpp --- a/homesync/contentmanager/mediaservant/plugin/src/mediaservantplugin.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,359 +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: CMediaservantPlugin class implementation -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "msengine.h" -#include "mediaservantplugin.h" -#include "msconstants.h" -#include "mediaservantuid.h" - -#include "msdebug.h" - -// CONSTANTS -_LIT( KMediaservantRscFile, "\\resource\\apps\\mediaservant.rsc" ); - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::NewL -// Create instance of concrete ECOM interface implementation -// --------------------------------------------------------------------------- -CMediaservantPlugin* CMediaservantPlugin::NewL( - MUPnPPluginObserver* aPluginObserver) - { - CMediaservantPlugin* self = CMediaservantPlugin::NewLC (aPluginObserver); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::NewLC -// Create instance of concrete ECOM interface implementation -// --------------------------------------------------------------------------- -CMediaservantPlugin* CMediaservantPlugin::NewLC( - MUPnPPluginObserver* aPluginObserver) - { - CMediaservantPlugin* self = new(ELeave) - CMediaservantPlugin(aPluginObserver); - CleanupStack::PushL( self ); - self->ConstructL( aPluginObserver ); - - return self; - } - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::ConstructL -// Second phase constructor. Creates icon and sets title and secondary text -// --------------------------------------------------------------------------- -// -void CMediaservantPlugin::ConstructL(MUPnPPluginObserver* - aPluginObserver) - { - LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL start")); - - // Set observer - iPluginObserver = aPluginObserver; - - // set icon - LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL create icon")); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC(skin, KAknsIIDDefault, - bitmap, mask, KMSMifFileName, - EMbmMediaservantQgn_mserv_app_menu_icon, - EMbmMediaservantQgn_mserv_app_menu_icon_mask); - - iIcon = CGulIcon::NewL(bitmap,mask); - iIcon->SetBitmapsOwnedExternally(EFalse); - - CleanupStack::Pop( mask ); - CleanupStack::Pop( bitmap ); - bitmap = NULL; - mask = NULL; - - - - // Load resource file - LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL load resource")); - TFileName rscFileName( KMediaservantRscFile ); - - iCoeEnv = CEikonEnv::Static(); - RFs& fileSession = iCoeEnv->FsSession(); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - - // this works for c and z drives - TInt err(KErrNone); - TRAP( err, iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName )) - if ( err != KErrNone ) - { - // not found? let's try mmc drive - rscFileName.Copy( PathInfo::MemoryCardRootPath() ); - rscFileName.Delete(2, 2); // remove // - rscFileName.Append( KMediaservantRscFile ); - iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ); - } - - LOG(_L("[MediaServant]\t CMediaServantPlugin::ConstructL \ - after resourceloader")); - - // Set item text - iTitle = StringLoader::LoadL( R_MS_PLUGIN_LISTBOX_PRIMARY_TEXT ); - - iMSEngine = CMSEngine::NewL(); - - // load secondary text - LoadPluginTextL(); - - // Create property watcher for progress info - iMSPropertyWatcher = CMSPropertyWatcher::NewL(); - // view will observe changes in property - iMSPropertyWatcher->SetObserver(this); - // start listening property - iMSPropertyWatcher->StartL(); - - LOG(_L("[MediaServant]\t CMediaservantPlugin::ConstructL end")); - } - -// --------------------------------------------------------------------------- -// Default constructor. -// --------------------------------------------------------------------------- -CMediaservantPlugin::CMediaservantPlugin(TAny* aEcomArguments) - : CUPnPPluginInterface( aEcomArguments ) - { - iRequiresUpnpConf = ETrue; - iTitle = NULL; - iSecondaryText = NULL; - } - - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::~CMediaservantPlugin -// --------------------------------------------------------------------------- -CMediaservantPlugin::~CMediaservantPlugin() - { - LOG(_L("[MediaServant]\t CMediaservantPlugin::~CMediaservantPlugin")); - - delete iMSEngine; - - // Un-Load resource file - if ( iResFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResFileOffset ); - iResFileOffset = 0; - } - - if ( iMSPropertyWatcher ) - { - iMSPropertyWatcher->Stop(); - delete iMSPropertyWatcher; - } - delete iIcon; - delete iTitle; - delete iSecondaryText; - } - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::GetIcon -// Returns reference to the icon of the plugin -// --------------------------------------------------------------------------- -const CGulIcon& CMediaservantPlugin::GetIcon() - { - return *iIcon; - } - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::GetTitle -// Returns const reference to the icon of the plugin -// --------------------------------------------------------------------------- -const TDesC& CMediaservantPlugin::GetTitle() - { - return *iTitle; - } - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::GetSecondaryText -// Returns const reference to the scondary text of the plugin -// --------------------------------------------------------------------------- -const TDesC& CMediaservantPlugin::GetSecondaryText() - { - return *iSecondaryText; - } - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::ExecuteL -// Executes the plugin -// --------------------------------------------------------------------------- -void CMediaservantPlugin::ExecuteL() - { - LOG(_L("[MediaServant]\t CMediaservantPlugin::ExecuteL")); - - RApaLsSession apaLsSession; - User::LeaveIfError(apaLsSession.Connect()); - CleanupClosePushL(apaLsSession); - - TApaAppInfo applicationInfo; - TInt error = apaLsSession.GetAppInfo( - applicationInfo, - TUid::Uid( KMediaServantUID3 ) ); - - if(error == KErrNone) - { - CApaCommandLine* commandLine = CApaCommandLine::NewLC(); - commandLine->SetExecutableNameL( applicationInfo.iFullName ); - commandLine->SetCommandL( EApaCommandRun ); - apaLsSession.StartApp( *commandLine ); - - CleanupStack::PopAndDestroy( commandLine ); - } - else - { - LOG(_L("[MediaServant]\t CMediaservantPlugin::ExecuteL \ - application launch failed")); - } - - CleanupStack::PopAndDestroy( &apaLsSession ); - } - -// --------------------------------------------------------------------------- -// CMediaservantPlugin::RequiresUpnpConfiguration -// Checks if the plugin needs upnp configuration (set IAP) -// --------------------------------------------------------------------------- -TBool CMediaservantPlugin::RequiresUpnpConfiguration() - { - return iRequiresUpnpConf; - } - - - -// -------------------------------------------------------------------------- -// CMediaservantPlugin::PropertyChangedL -// -------------------------------------------------------------------------- -// -void CMediaservantPlugin::PropertyChangedL( TCmService aService, - TInt aTotalItems, - TInt aProcessedItems, - TInt /*aItemsToBeProcessed*/ ) - { - - LOG(_L("[MediaServant]\t CMediaservantPlugin::PropertyChangedL")); - - switch ( aService ) - { - case ECmServiceHarvest: - { - delete iSecondaryText; - iSecondaryText = NULL; - iSecondaryText = StringLoader::LoadL( R_MS_PLUGIN_HARVESTING ); - iPluginObserver->ExtensionEvent( - EExtensionSecondaryTextChanged ); - break; - } - case ECmServiceStore: - // fall through - case ECmServiceFill: - { - { - TInt value( 0 ); - // calculate procentual value - if ( aTotalItems > 0 && aProcessedItems >= 0 ) - { - value = (TReal(aProcessedItems)/TReal(aTotalItems))*100; - } - delete iSecondaryText; - iSecondaryText = NULL; - iSecondaryText = StringLoader::LoadL( - R_MS_PLUGIN_SYNCHRONIZING, value ); - iPluginObserver->ExtensionEvent( - EExtensionSecondaryTextChanged ); - } - break; - } - case ECmServiceNone: - { - LoadPluginTextL(); - iPluginObserver->ExtensionEvent(EExtensionSecondaryTextChanged); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMediaservantPlugin::PropertyChangedL \ - service not found")); - } - - } - } - -// -------------------------------------------------------------------------- -// CMediaservantPlugin::LoadPluginTextL -// -------------------------------------------------------------------------- -// -void CMediaservantPlugin::LoadPluginTextL() - { - // Need to check content manager service state - //to determine secondary text - LOG(_L("[MediaServant]\t CMediaservantPlugin:LoadPluginTextL \ - open msengine")); - - TCmServiceState state = iMSEngine->ServiceState( - ECmServiceContentManager ); - if ( iSecondaryText ) - { - delete iSecondaryText; - iSecondaryText = NULL; - } - - switch ( state ) - { - case ECmServiceStateAutomatic: - { - iSecondaryText = StringLoader::LoadL( - R_MS_PLUGIN_TEXT_AUTO_SYNC ); - break; - } - case ECmServiceStateDisabled: - { - iSecondaryText = StringLoader::LoadL( - R_MS_PLUGIN_TEXT_MANUAL_SYNC ); - break; - } - default: - { - // don't show sync state - LOG(_L("[MediaServant]\t CMediaservantPlugin:LoadPluginTextL \ - sync state not shown")); - break; - } - } - } -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/plugin/src/proxy.cpp --- a/homesync/contentmanager/mediaservant/plugin/src/proxy.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +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 proxy table -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include "mediaservantplugin.h" - -// Provides a key value pair table, this is used to identify -// the correct construction function for the requested interface. -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x1028290E, CMediaservantPlugin::NewL), - }; - - - -// Function used to return an instance of the proxy table. -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msapp.cpp --- a/homesync/contentmanager/mediaservant/src/msapp.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2007 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: CMediaServantApp class implementation -* -*/ - - -#include -#include "msdebug.h" -#include "msapp.h" -#include "msdocument.h" -#include "msconstants.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------- -// CMediaServantApp::CreateDocumentL() -// --------------------------------------------------------- -// -CApaDocument* CMediaServantApp::CreateDocumentL() - { - LOG(_L("[MediaServant]\t CMediaServantApp::CreateDocumentL")); - - return CMSDocument::NewL( *this ); - } - -// --------------------------------------------------------- -// CMediaServantApp::AppDllUid() -// --------------------------------------------------------- -// -TUid CMediaServantApp::AppDllUid() const - { - LOG(_L("[MediaServant]\t CMediaServantApp::AppDllUid")); - - return KUidMediaServant; - } - - -// ================= OTHER EXPORTED FUNCTIONS ============== - -// --------------------------------------------------------- -// NewApplication() -// --------------------------------------------------------- -// -LOCAL_C CApaApplication* NewApplication() - { - LOG(_L("[MediaServant]\t CApaApplication* NewApplication")); - - return new CMediaServantApp; - } - -// --------------------------------------------------------------------------- -// Starts application -// --------------------------------------------------------------------------- -// -GLDEF_C TInt E32Main() - { - LOG(_L("[MediaServant]\t E32Main")); - - return EikStart::RunApplication( NewApplication ); - } - - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msappui.cpp --- a/homesync/contentmanager/mediaservant/src/msappui.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,543 +0,0 @@ -/* -* Copyright (c) 2007 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: CMediaServantAppUi class implementation -* -*/ - - -#include -#include -#include -#include - -#include "cmsettingsfactory.h" -#include "cmsettings.h" -#include "cmdriveinfo.h" -#include "msappui.h" -#include "msstorelistcontroller.h" -#include "msmainview.h" -#include "msfillview.h" -#include "msfillruleeditview.h" -#include "msstorelistview.h" -#include "msstoresettingsview.h" -#include "msbrowseview.h" -#include "msfillbrowseview.h" -#include "msconstants.h" -#include "msengine.h" -#include "msparameteragent.h" -#include "cmsappwizard.h" -#include "msgsinterface.h" -#include "msgspluginuids.h" - -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSAppUi::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSAppUi::ConstructL() - { - LOG(_L("[MediaServant]\t CMSAppUi::ConstructL")); - -#ifndef __SERIES60_31__ - BaseConstructL( EAknEnableSkin | EAknEnableMSK ); -#else - BaseConstructL( EAknEnableSkin ); -#endif - - // Create engine - iMSEngine = CMSEngine::NewL(); - - // Create parameter agent for message passing between views - iParameterAgent = new ( ELeave ) CMSParameterAgent(); - - // Create fill list controller - iFillRuleController = CMSFillRuleController::NewL( *iMSEngine ); - - // Create store list controller - iStoreListController = CMSStoreListController::NewL( *iMSEngine ); - - LoadSettingsPluginL(); // loads gs plugin - - // main view is created - CMSMainView* mainView = new ( ELeave )CMSMainView( *this ); - CleanupStack::PushL( mainView ); - mainView->ConstructL(); - AddViewL( mainView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( mainView); - - CMSFillView* fillView = new ( ELeave ) CMSFillView( *this ); - CleanupStack::PushL( fillView ); - fillView->ConstructL(); - AddViewL( fillView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( fillView ); - - CMSFillRuleEditView* ruleEditView = new ( ELeave ) - CMSFillRuleEditView( *this ); - CleanupStack::PushL( ruleEditView ); - ruleEditView->ConstructL(); - AddViewL( ruleEditView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( ruleEditView ); - - CMSStoreListView* storelistView = new ( ELeave ) - CMSStoreListView( *this ); - CleanupStack::PushL( storelistView ); - storelistView->ConstructL(); - AddViewL( storelistView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( storelistView); - - CMSStoreSettingsView* storesettingView = new ( ELeave ) - CMSStoreSettingsView( *this ); - CleanupStack::PushL( storesettingView ); - storesettingView->ConstructL(); - AddViewL( storesettingView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( storesettingView ); - - CMSBrowseView* browseView = new ( ELeave ) - CMSBrowseView( *this ); - CleanupStack::PushL( browseView ); - browseView->ConstructL(); - AddViewL( browseView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( browseView ); - - CMSFillBrowseView* fillBrowseView = - new ( ELeave ) CMSFillBrowseView( *this ); - CleanupStack::PushL( fillBrowseView ); - fillBrowseView->ConstructL(); - AddViewL( fillBrowseView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( fillBrowseView ); - - - // default view is now main view - SetDefaultViewL( *mainView ); - } - -// -------------------------------------------------------------------------- -// CMSAppUi::~CMSAppUi() -// -------------------------------------------------------------------------- -// -CMSAppUi::~CMSAppUi() - { - LOG(_L("[MediaServant]\t CMSAppUi::~CMSAppUi")); - - if( iPlugin ) - { - // Destroy Ecom plugin - iPlugin->DestroyPlugin(); - } - - delete iMSEngine; - delete iParameterAgent; - delete iFillRuleController; - delete iStoreListController; - } - -// -------------------------------------------------------------------------- -// CMSAppUi::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSAppUi::HandleCommandL(TInt aCommand) - { - LOG(_L("[MediaServant]\t CMSAppUi::HandleCommandL")); - - switch ( aCommand ) - { - case EAknSoftkeyBack: - // fall trough - case EEikCmdExit: - { - // program is exited - Exit(); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSAppUi::HandleCommandL \ - invalid command")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSAppUi::ChangeViewL() -// -// Changes active view according to input parameter. -// -------------------------------------------------------------------------- -// -void CMSAppUi::ChangeViewL(const TUid& aOldView, const TUid& aNewView) - { - LOG(_L("[MediaServant]\t CMSAppUi::ChangeViewL")); - - iParameterAgent->SetPreviousViewId( aOldView ); - - if ( aOldView.iUid == KMSMainViewId.iUid ) - { - // store focus index of main view - iParameterAgent->SetMainViewFocusIndex( - static_cast (iView)->FocusIndex()); - - } - else if ( aOldView.iUid == KMSFillViewId.iUid ) - { - // store focus index of main view - iParameterAgent->SetFillViewFocusIndex( - static_cast (iView)->FocusIndex()); - - } - else if ( aOldView.iUid == KMSStoreListViewId.iUid ) - { - // store focus index of fill view - iParameterAgent->SetStoreViewFocusIndex( - static_cast (iView)->FocusIndex()); - } - else - { - // no need to change view - } - - // new view is activated - ActivateViewL(TVwsViewId(KUidMediaServant, aNewView)); - } - -// -------------------------------------------------------------------------- -// CMSAppUi::StoreListController() -// Returns fill rule container -// -------------------------------------------------------------------------- -// -CMSStoreListController* CMSAppUi::StoreListController() - { - LOG(_L("[MediaServant]\t CMSAppUi::StoreListController")); - - return iStoreListController; - } - -// -------------------------------------------------------------------------- -// CMSAppUi::MSEngine() -// Returns msengine pointer -// -------------------------------------------------------------------------- -// -CMSEngine* CMSAppUi::MSEngine() - { - return iMSEngine; - } - -// -------------------------------------------------------------------------- -// CMSAppUi::RefreshListsL() -// Refresh store and fill lists -// -------------------------------------------------------------------------- -// -void CMSAppUi::RefreshListsL() - { - LOG(_L("[MediaServant]\t CMSAppUi::RefreshListsL")); - - iStoreListController->UpdateListsL(); - iFillRuleController->UpdateArrayL(); - } - -// -------------------------------------------------------------------------- -// CMSFillView::ReadMMCInfoL -// Reads mmc capasity -// -------------------------------------------------------------------------- -// -TInt CMSAppUi::ReadMMCInfoL( TInt64& aCapasity, TInt64& aFreeSpace ) - { - LOG(_L("[MediaServant]\t CMSAppUi::ReadMMCInfoL")); - RFs& sysFs = FsSession(); - RPointerArray storedDrives; - RPointerArray driveArray; - TInt error = KErrNone; - aCapasity = 0; - aFreeSpace = 0; - MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC(); - - // read stored info of stored drives - MSEngine()->GetDrivesL( storedDrives ); - // get system drive info - settings->DriveListL( sysFs, driveArray ); - - TInt count = storedDrives.Count(); - - for ( TInt i = 0; i < count; i++ ) - { - TIdentityRelation relation( CMSAppUi::CompareIds ); - TInt index = driveArray.Find( storedDrives[i], relation ); - if ( index != KErrNotFound ) - { - TVolumeInfo volInfo; - error = sysFs.Volume( volInfo, storedDrives[i]->DriveNumber() ); - if ( error == KErrNone ) - { - TRACE(Print(_L("[MediaServant]\t CMSAppUi::ReadMMCInfoL %ld\n"), - volInfo.iSize )); - aCapasity += volInfo.iSize; - aFreeSpace += volInfo.iFree; - } - } - } - - storedDrives.ResetAndDestroy(); - storedDrives.Close(); - - driveArray.ResetAndDestroy(); - driveArray.Close(); - - settings->Close(); - CleanupStack::Pop(); // settings - return error; - } - -// -------------------------------------------------------------------------- -// CMSAppUi::GetFilledFilesSize -// Get filled files size -// -------------------------------------------------------------------------- -// -void CMSAppUi::GetFilledFilesSize( TInt64& aSize, const TInt aID ) - { - iMSEngine->GetFilledFilesSize( aSize, aID ); - } - - -// CMSAppUi::ParameterAgent -// returns pointer to parameter agent -// -------------------------------------------------------------------------- -// -CMSParameterAgent* CMSAppUi::ParameterAgent() - { - return iParameterAgent; - } - -// -------------------------------------------------------------------------- -// CMSAppUi::FillRuleController -// returns pointer to rule controller -// -------------------------------------------------------------------------- -// -CMSFillRuleController* CMSAppUi::FillRuleController() - { - return iFillRuleController; - } - -// -------------------------------------------------------------------------- -// CMSAppUi::FsSession -// returns file server session -// -------------------------------------------------------------------------- -// -RFs& CMSAppUi::FsSession() - { - return iEikonEnv->FsSession(); - } - -// -------------------------------------------------------------------------- -// CMSAppUi::DriveSelectedL -// returns drive selection status -// -------------------------------------------------------------------------- -// -TBool CMSAppUi::DriveSelectedL() - { - TBool status( EFalse ); - - if ( iMSEngine->DriveSelectionStatus() && MemoryAttachedL() ) - { - status = ETrue; - } - return status; - } - - -// -------------------------------------------------------------------------- -// CMSAppUi::MemoryAttachedL -// Returns ETrue if selected memory is on the device -// -------------------------------------------------------------------------- -// -TBool CMSAppUi::MemoryAttachedL() - { - LOG(_L("[MediaServant]\t CMSAppUi::MemoryAttachedL")); - - TBool status( EFalse ); - RFs& fileServer = FsSession(); - RPointerArray storedDrives; - RPointerArray driveArray; - MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC(); - - // read stored info of stored drives - MSEngine()->GetDrivesL( storedDrives ); - // get system drive info - settings->DriveListL( fileServer, driveArray ); - - TInt count = storedDrives.Count(); - - for ( TInt i = 0; i < count; i++ ) - { - TIdentityRelation relation(CMSAppUi::CompareIds ); - TInt index = driveArray.Find( storedDrives[i], relation ); - if ( index != KErrNotFound ) - { - status = ETrue; - i = count; // break loop - } - } - - storedDrives.ResetAndDestroy(); - storedDrives.Close(); - - driveArray.ResetAndDestroy(); - driveArray.Close(); - - settings->Close(); - CleanupStack::Pop(); // settings - - return status; - } - -// -------------------------------------------------------------------------- -// CMSAppUi::CompareIds -// Compares drive ids -// -------------------------------------------------------------------------- -// -TBool CMSAppUi::CompareIds( const CCmDriveInfo& aStoredDrive, - const CCmDriveInfo& aDrive ) - { - TBool retval = EFalse; - if ( aStoredDrive.DriveId() == aDrive.DriveId() ) - { - retval = ETrue; - } - - return retval; - } - -// --------------------------------------------------------------------------- -// CMSAppUi::LoadSettingsPluginL -// --------------------------------------------------------------------------- -// -void CMSAppUi::LoadSettingsPluginL() - { - LOG(_L("[MediaServant]\t CMSAppUi::LoadSettingsPluginL start")); - - TRAPD( error, iPlugin = CMSGSInterface::NewL( KMSGSImplementationUid ) ); - if ( !error ) - { - AddViewL( iPlugin ); // transfer ownership to CAknViewAppUi - } - - LOG(_L("[MediaServant]\t CMSAppUi::LoadSettingsPluginL end")); - } - -// --------------------------------------------------------------------------- -// CMSAppUi::SettingsPlugin -// --------------------------------------------------------------------------- -// -CMSGSInterface* CMSAppUi::SettingsPlugin() - { - return iPlugin; - } - -// --------------------------------------------------------------------------- -// CMSAppUi::CheckDrivesSelectedL -// --------------------------------------------------------------------------- -// -void CMSAppUi::CheckDrivesSelectedL() - { - LOG(_L("[MediaServant]\t CMSAppUi::CheckDrivesSelectedL")); - - TBool status( EFalse ); - RFs& fileServer = FsSession(); - MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC(); - RPointerArray storedDrives; - RPointerArray driveArray; - CleanupClosePushL( storedDrives ); - CleanupClosePushL( driveArray ); - - // read stored info of stored drives - MSEngine()->GetDrivesL( storedDrives ); - // get system drive info - settings->DriveListL( fileServer, driveArray ); - - TInt count = storedDrives.Count(); - - for ( TInt i = 0; i < count; i++ ) - { - TIdentityRelation relation(CMSAppUi::CompareIds ); - TInt index = driveArray.Find( storedDrives[i], relation ); - if ( index != KErrNotFound ) - { - status = ETrue; - i = count; // break loop - } - } - - // none of drives have been selected - if( !status ) - { - for ( TInt j = 0; j < driveArray.Count(); j++ ) - { - // mass memory - if ( driveArray[j]->DriveType() != DriveInfo::EDriveRemovable ) - { - RPointerArray massDrives; - CleanupClosePushL( massDrives ); - TInt64 quota = - ( driveArray[j]->DriveSize() * KHDDefaultQuota ) / 100; - driveArray[j]->SetDriveQuota( quota ); - driveArray[j]->SetStatus( ETrue ); - - massDrives.AppendL( driveArray[j] ); - MSEngine()->SetDrivesL( massDrives ); - CleanupStack::PopAndDestroy( );// &massDrives - //break, for only one mass memory exist - j = driveArray.Count(); - } - } - } - storedDrives.ResetAndDestroy(); - driveArray.ResetAndDestroy(); - - CleanupStack::PopAndDestroy( 2 ); // &storedDrives, &driveArray - settings->Close(); - CleanupStack::Pop(); // settings - } - -// --------------------------------------------------------------------------- -// CMSAppUi::RunWizard -// --------------------------------------------------------------------------- -// -TInt CMSAppUi::RunWizardL() - { - LOG(_L("[MediaServant]\t CMSAppUi::RunWizardL Launch Wizard")); - - TInt wizRetVal(KErrNone); - - // Check drives selection status - CheckDrivesSelectedL(); - - CMSAppWizard* appWizard = CMSAppWizard::NewL( *iMSEngine ); - CleanupStack::PushL( appWizard ); - wizRetVal = appWizard->StartL(); - CleanupStack::PopAndDestroy( appWizard ); - - if( wizRetVal != KErrNone) - { - LOG(_L("[MediaServant]\t CMSAppUi::RunWizardL Wizard Run OK")); - } - else - { - TRACE(Print(_L("[MediaServant]\t RunWizardL::\ - wizard return value: %d"), wizRetVal)); - RefreshListsL(); - } - iMSEngine->SetAppWizardState(); - - return wizRetVal; - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msbasecontainer.cpp --- a/homesync/contentmanager/mediaservant/src/msbasecontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,323 +0,0 @@ -/* -* Copyright (c) 2007 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: CMSBaseContainer class implementation -* -*/ - - - -// INCLUDE FILES -#include - -#include -#include -#include -#include -#include -#include - -#include "msbasecontainer.h" -#include "msconstants.h" -#include "msdebug.h" - -// ================= MEMBER FUNCTIONS ======================================= - -// -------------------------------------------------------------------------- -// CMSBaseContainer::CMSBaseContainer() -// Default constructor. -// -------------------------------------------------------------------------- -// -CMSBaseContainer::CMSBaseContainer() - { - LOG(_L("[MediaServant]\t CMSBaseContainer::CMSBaseContainer")); - - iCoeEnv = CEikonEnv::Static(); - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::~CMSBaseContainer() -// Destructor. -// -------------------------------------------------------------------------- -// -CMSBaseContainer::~CMSBaseContainer() - { - LOG(_L("[MediaServant]\t CMSBaseContainer::~CMSBaseContainer")); - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::SetListBoxFromResourceL() -// Sets listbox from resource using ConstructFromResourceL() of -// CEikColumnListBox class. -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::SetListBoxFromResourceL( - CEikColumnListBox* aListBox, const TInt aResourceId ) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::SetListBoxFromResourceL \ - column listbox")); - - if ( aListBox && aResourceId ) - { - aListBox->SetContainerWindowL( *this ); - - TResourceReader reader; - iCoeEnv->CreateResourceReaderLC( reader, aResourceId ); - aListBox->ConstructFromResourceL( reader ); - CleanupStack::PopAndDestroy(); // resource stuffs. - - // Creates scrollbar. - CreateScrollbarL( aListBox ); - } - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::SetListBoxFromResourceL() -// Sets listbox from resource using ConstructFromResourceL() of -// CEikFormattedCellListBox class. -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::SetListBoxFromResourceL( - CEikFormattedCellListBox* aListBox, - const TInt aResourceId ) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::SetListBoxFromResourceL \ - formatted cell listbox")); - - if ( aListBox && aResourceId ) - { - aListBox->SetContainerWindowL( *this ); - - TResourceReader reader; - iCoeEnv->CreateResourceReaderLC( reader, aResourceId ); - aListBox->ConstructFromResourceL( reader ); - CleanupStack::PopAndDestroy(); // resource stuffs. - - // Creates scrollbar. - CreateScrollbarL( aListBox ); - } - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::AppendItemToListBoxArrayL() -// Appends item to the list -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::AppendItemToListBoxArrayL( CEikListBox* aListBox, - CTextListBoxModel* aModel, - TInt aIconIndex, - TDesC& aPrimaryText, - TDesC& aSecondaryText ) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::AppendItemToListBoxArrayL")); - - - if ( aListBox && aModel ) - { - MDesCArray *itemList = aModel->ItemTextArray(); - CDesCArray *itemArray = static_cast( itemList ); - - TBuf<2> iconIndex; // magic: maximum icon count is 99 - iconIndex.AppendNum( aIconIndex ); - - TInt newLen = iconIndex.Length() + - KSlashT().Length() + - (&aPrimaryText ? aPrimaryText.Length() : 0) + - KSlashT().Length() + - (&aSecondaryText ? aSecondaryText.Length() : 0); - - HBufC* newText = HBufC::NewMaxLC( newLen ); - - // Create new item string - TPtr newTPtr = newText->Des(); - - newTPtr.Copy( iconIndex ); - newTPtr.Append( KSlashT ); - - if ( &aPrimaryText ) - { - newTPtr.Append( aPrimaryText ); - } - newTPtr.Append( KSlashT ); - - if ( &aSecondaryText ) - { - newTPtr.Append( aSecondaryText ); - } - - itemArray->AppendL(newTPtr); - CleanupStack::PopAndDestroy( newText ); - - aListBox->HandleItemAdditionL(); - } - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::AppendItemToListBoxArrayL() -// Appends item to the list -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::AppendItemToListBoxArrayL( CEikListBox* aListBox, - CTextListBoxModel* aModel, - TInt aIconIndex, - TDesC& aItemText ) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::AppendItemToListBoxArrayL")); - - - if ( aListBox && aModel ) - { - MDesCArray *itemList = aModel->ItemTextArray(); - CDesCArray *itemArray = static_cast( itemList ); - - TBuf<2> iconIndex; // maximum icon count is 99 - iconIndex.AppendNum( aIconIndex ); - - TInt newLen = iconIndex.Length() + - KSlashT().Length() + - (&aItemText ? aItemText.Length() : 0) + - KSlashT().Length() + - iconIndex.Length(); - - HBufC* newText = HBufC::NewMaxLC( newLen ); - - // Create new item string - TPtr newTPtr = newText->Des(); - - newTPtr.Copy( iconIndex ); - newTPtr.Append( KSlashT ); - - if ( &aItemText ) - { - newTPtr.Append( aItemText ); - } - newTPtr.Append( KSlashT ); - - itemArray->AppendL(newTPtr); - CleanupStack::PopAndDestroy( newText ); - - aListBox->HandleItemAdditionL(); - } - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::AppendIconToArrayL() -// Adds icon to iconarray -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::AppendIconToArrayL")); - - __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC(aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId); - - CGulIcon* icon = CGulIcon::NewL(bitmap, mask); - icon->SetBitmapsOwnedExternally(EFalse); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop(mask); - CleanupStack::Pop(bitmap); - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL(icon); - - aArray->AppendL(icon); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(icon); - - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::CreateScrollbarL() -// Creates scrollbar. -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::CreateScrollbarL( CEikListBox* aListBox ) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::CreateScrollbarL")); - - if ( aListBox ) - { - // Creates scrollbar. - aListBox->CreateScrollBarFrameL( ETrue ); - aListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - } - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::UpdateScrollBar() -// Update scroll bar. -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::ShowNoteL ( TInt aResource, TInt aError ) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::ShowNoteL")); - - // Show error note - CAknInformationNote* dlg = new(ELeave)CAknInformationNote(); - TBuf errorText; - iCoeEnv->ReadResourceL(errorText, aResource ); - errorText.AppendNum( aError ); - dlg->ExecuteLD(errorText); - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::SetContextPaneIconL() -// Sets context pane icon. -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::SetContextPaneIconL( const CFbsBitmap* aIconBitmap, - const CFbsBitmap* aIconMask ) - { - LOG(_L("[MediaServant]\t CMSBaseContainer::SetContextPaneIconL")); - - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - CleanupStack::PushL( statusPane ); - CAknContextPane* contextPane = ( CAknContextPane * )statusPane-> - ControlL( TUid::Uid( EEikStatusPaneUidContext ) ); - CleanupStack::Pop( statusPane ); - contextPane->SetPicture( aIconBitmap, aIconMask ); - } - -// -------------------------------------------------------------------------- -// CMSBaseContainer::SetDefaultContextPaneIconL() -// Sets default context pane icon. -// -------------------------------------------------------------------------- -// -void CMSBaseContainer::SetDefaultContextPaneIconL() - { - LOG(_L("[MediaServant]\t CMSBaseContainer::SetDefaultContextPaneIconL")); - - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - CleanupStack::PushL( statusPane ); - CAknContextPane* contextPane = ( CAknContextPane * )statusPane-> - ControlL( TUid::Uid( EEikStatusPaneUidContext ) ); - CleanupStack::Pop( statusPane ); - contextPane->SetPictureToDefaultL(); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msbaseview.cpp --- a/homesync/contentmanager/mediaservant/src/msbaseview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +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: CMSBaseView class implementation -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include - -#include "msbaseview.h" -#include "msconstants.h" -#include "msappui.h" -#include "msengine.h" - -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSBaseView::CMSBaseView() -// Default constructor. -// -------------------------------------------------------------------------- -// -CMSBaseView::CMSBaseView() - { - LOG(_L("[MediaServant]\t CMSBaseView::CMSBaseView")); - } - -// -------------------------------------------------------------------------- -// CMSBaseView::~CMSBaseView() -// Destructor. -// -------------------------------------------------------------------------- -// -CMSBaseView::~CMSBaseView() - { - LOG(_L("[MediaServant]\t CMSBaseView::~CMSBaseView")); - ClearCurrentNaviPaneText(); - } - -// -------------------------------------------------------------------------- -// CMSBaseView::SetTitlePaneTextL() -// Sets text to title pane. -// -------------------------------------------------------------------------- -void CMSBaseView::SetTitlePaneTextL( TInt aResourceId ) - { - LOG(_L("[MediaServant]\t CMSBaseView::SetTitlePaneTextL")); - - // Fetches pointer to the default title pane control. - CAknTitlePane* titlePane = static_cast( - StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - - // Makes and sets text which is used title pane. - if ( aResourceId == KMSDefaultTitleId ) - { - titlePane->SetTextToDefaultL(); - } - else - { - TBuf titleText( 0 ); - iCoeEnv->ReadResourceL( titleText, aResourceId ); - titlePane->SetTextL( titleText ); - } - } - -// -------------------------------------------------------------------------- -// CMSBaseView::SetTitlePaneTextL() -// Sets text to title pane. -// -------------------------------------------------------------------------- -void CMSBaseView::SetTitlePaneTextL( const TDesC& aText ) - { - LOG(_L("[MediaServant]\t CMSBaseView::SetTitlePaneTextL")); - - // Fetches pointer to the default title pane control. - CAknTitlePane* titlePane = static_cast( - StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - - titlePane->SetTextL( aText ); - } - - -// -------------------------------------------------------------------------- -// CMSBaseView::SetNavigationPaneTextL() -// Sets navigation pane text. -// -------------------------------------------------------------------------- -// -void CMSBaseView::SetNavigationPaneTextL(const TDesC& aText ) - { - // old decorator is popped and deleted - ClearCurrentNaviPaneText(); - - if ( !iNaviPane ) - { - iNaviPane = static_cast - ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); - // ownership of decorator is transfered to application - } - - iNaviDecorator = iNaviPane->CreateNavigationLabelL( aText ); - iNaviPane->PushL( *iNaviDecorator ); - } - -// -------------------------------------------------------------------------- -// CMSBaseView::ClearCurrentNaviPaneText() -// Clears navi pane text. -// -------------------------------------------------------------------------- -// -void CMSBaseView::ClearCurrentNaviPaneText() - { - if ( iNaviDecorator ) - { - iNaviPane->Pop( iNaviDecorator ); - delete iNaviDecorator; - iNaviDecorator = NULL; - } - } - -// -------------------------------------------------------------------------- -// CMSFillView::CancelAsyncOperation() -// Cancels current operation -// -------------------------------------------------------------------------- -// -void CMSBaseView::CancelAsyncOperation( CMSAppUi* aAppUi ) - { - // getting data not yet finished so we must cancel the operation - TCmServerState state; - aAppUi->MSEngine()->ServerState( state ); - if ( state != ECmServerStateIdle ) - { - LOG( _L( "[MediaServant]\t CMSBaseView::\ - CancelAsyncOperation cancel operation" ) ); - aAppUi->MSEngine()->StopOperation(); - ClearCurrentNaviPaneText(); - } - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msbrowsecontainer.cpp --- a/homesync/contentmanager/mediaservant/src/msbrowsecontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +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: CMSBrowseContainer class implementation -* -*/ - - -#include -#include -#include "upnpstring.h" - -#include "mserv.hlp.hrh" -#include "cmstorerulecontainer.h" -#include "cmstorerule.h" -#include "msappui.h" -#include "msstorelistcontroller.h" -#include "msbrowseview.h" -#include "msbrowsecontainer.h" -#include "msengine.h" -#include "mediaservantuid.h" - -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSBrowseContainer::CMSBrowseContainer() -// -------------------------------------------------------------------------- -// -CMSBrowseContainer::CMSBrowseContainer( CMSAppUi& aAppUi, - CMSBrowseView& aView ) - { - LOG(_L("[MediaServant]\t CMSBrowseContainer::CMSBrowseContainer")); - - iAppUi = &aAppUi; - iView = &aView; - } - -// -------------------------------------------------------------------------- -// CMSBrowseContainer::~CMSBrowseContainer() -// -------------------------------------------------------------------------- -// -CMSBrowseContainer::~CMSBrowseContainer() - { - LOG(_L("[MediaServant]\t CMSBrowseContainer::~CMSBrowseContainer")); - - delete iListBox; // Deletes listbox object. - } - -// -------------------------------------------------------------------------- -// CMSBrowseContainer::GetBrowseDataL() -// Gets file information from engine -// -------------------------------------------------------------------------- -// -void CMSBrowseContainer::GetBrowseDataL() - { - LOG(_L("[MediaServant]\t CMSBrowseContainer::GetBrowseDataL")); - - CMSParameterAgent* parameterAgent = iAppUi->ParameterAgent(); - - TInt selected = iAppUi->ParameterAgent()->StoreViewFocusIndex(); - - // get list container - CCmStoreRuleContainer* storeRuleContainer = - iAppUi->StoreListController()->StoreListContainer(); - - // get rule - CCmStoreRule* storeRule = storeRuleContainer->StoreRule( selected ); - - // read media type - storeRule->StoreRule(0, &iMediaType); - - iView->SetTitlePaneTextL( iMediaType ); - - // get items covered by rule - iItemArray = iAppUi->MSEngine()->GetStoreListItemsL( storeRule->Name() ); - - HBufC* naviText = NULL; - - switch ( iItemArray->Count() ) - { - case 0: // 0 items - { - naviText = StringLoader::LoadLC( - R_MS_STORE_BROWSE_NAVI_0_ITEMS ); - break; - } - case 1: // 1 item - { - naviText = StringLoader::LoadLC( - R_MS_STORE_BROWSE_NAVI_1_ITEM ); - break; - } - default: // many items - { - naviText = StringLoader::LoadLC( - R_MS_STORE_BROWSE_NAVI_ITEMS, - iItemArray->Count() ); - // do number conversion - TPtr ptr = naviText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - break; - } - } - - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - -// -------------------------------------------------------------------------- -// CMSBrowseContainer::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSBrowseContainer::HandleResourceChange( TInt aType ) - { - LOG(_L("[MediaServant]\t CMSBrowseContainer::HandleResourceChange")); - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect( iView->ClientRect() ); - } - - CCoeControl::HandleResourceChange( aType ); - } - -// --------------------------------------------------------------------------- -// CMSBrowseContainer::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSBrowseContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSBrowseContainer::GetHelpContext")); - - aContext.iMajor = TUid::Uid(KMediaServantUID3); - aContext.iContext = KMSERV_HLP_FILE_BROWSE; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msbrowseview.cpp --- a/homesync/contentmanager/mediaservant/src/msbrowseview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +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: CMSBrowseView class implementation -* -*/ - - - -#include -#include -#include - -#include "msbrowsecontainer.h" -#include "msconstants.h" -#include "msbrowseview.h" -#include "msappui.h" -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSBrowseView::CMSBrowseView() -// -------------------------------------------------------------------------- -// -CMSBrowseView::CMSBrowseView( CMSAppUi& aAppUi ) - { - LOG(_L("[MediaServant]\t CMSBrowseView::CMSBrowseView")); - - iAppUi = &aAppUi; - } - -// -------------------------------------------------------------------------- -// CMSBrowseView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSBrowseView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSBrowseView::ConstructL")); - - BaseConstructL( R_MS_BROWSE_VIEW ); - } - -// -------------------------------------------------------------------------- -// CMSBrowseView::~CMSBrowseView() -// -------------------------------------------------------------------------- -// -CMSBrowseView::~CMSBrowseView() - { - LOG(_L("[MediaServant]\t CMSBrowseView::~CMSBrowseView")); - - DoDeactivate(); - } -// -------------------------------------------------------------------------- -// TUid CMSBrowseView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSBrowseView::Id() const - { - LOG(_L("[MediaServant]\t CMSBrowseView::Id")); - - return KMSBrowseViewId; - } - -// -------------------------------------------------------------------------- -// CMSBrowseView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSBrowseView::HandleCommandL( TInt aCommand ) - { - LOG(_L("[MediaServant]\t CMSBrowseView::HandleCommandL")); - - switch ( aCommand ) - { - case EAknSoftkeyBack: - { - // back to store view - iAppUi->ChangeViewL( KMSBrowseViewId, KMSStoreListViewId ); - break; - } - - case EAknCmdHelp : - { - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - - - -// -------------------------------------------------------------------------- -// CMSBrowseView::DoActivateL() -// -------------------------------------------------------------------------- -// -void CMSBrowseView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - LOG(_L("[MediaServant]\t CMSBrowseView::DoActivateL")); - - // Set title pane text to default - CMSBaseView::SetTitlePaneTextL( KMSDefaultTitleId ); - - if ( !iContainer ) - { - iContainer = new (ELeave) CMSBrowseContainer( *iAppUi, *this ); - iContainer->ConstructL( ClientRect() ); - iContainer->SetMopParent( this ); - AppUi()->AddToViewStackL( *this, iContainer ); - iContainer->ActivateL(); - } - } - -// -------------------------------------------------------------------------- -// CMSBrowseView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSBrowseView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSBrowseView::DoDeactivate")); - - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; // Deletes the container class object. - iContainer = NULL; - - ClearCurrentNaviPaneText(); - } - -// -------------------------------------------------------------------------- -// CMSBrowseView::SetTitlePaneTextL() -// -------------------------------------------------------------------------- -// -void CMSBrowseView::SetTitlePaneTextL( TCmMediaType aMediaType ) - { - LOG(_L("[MediaServant]\t CMSBrowseView::SetTitlePaneTextL")); - - TInt resourceId(0); - - switch ( aMediaType ) - { - case ECmImage: - { - resourceId = R_MS_STORE_TITLE_PHONE_IMAGES; - break; - } - case ECmOtherImage: - { - resourceId = R_MS_STORE_TITLE_IMAGES; - break; - } - case ECmVideo: - { - resourceId = R_MS_STORE_TITLE_PHONE_VIDEOS; - break; - } - case ECmOtherVideo: - { - resourceId = R_MS_STORE_TITLE_VIDEOS; - break; - } - case ECmAudio: - { - resourceId = R_MS_STORE_TITLE_MUSIC; - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSBrowseView::SetTitlePaneTextL \ - mediatype not found")); - break; - } - } - - if ( resourceId ) - { - HBufC* titleText = StringLoader::LoadLC( resourceId ); - CMSBaseView::SetTitlePaneTextL( *titleText ); - CleanupStack::PopAndDestroy( titleText ); - } - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msdocument.cpp --- a/homesync/contentmanager/mediaservant/src/msdocument.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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: CMSDocument class implementation -* -*/ - - - -#include "msdebug.h" -#include "msdocument.h" -#include "msappui.h" - -// -------------------------------------------------------------------------- -// CMSDocument::CMSDocument( CEikApplication& aApp ) -// -------------------------------------------------------------------------- -// -CMSDocument::CMSDocument( CEikApplication& aApp ) -: CAknDocument( aApp ) - { LOG(_L("[MediaServant]\t CMSDocument::CMSDocument")); - } - -// -------------------------------------------------------------------------- -// void CMSDocument::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSDocument::ConstructL() - { - LOG(_L("[MediaServant]\t CMSDocument::ConstructL")); - } - -// -------------------------------------------------------------------------- -// CMSDocument* CMSDocument::NewL( CEikApplication& aApp ) -// -------------------------------------------------------------------------- -// -CMSDocument* CMSDocument::NewL(CEikApplication& aApp ) - { - LOG(_L("[MediaServant]\t CMSDocument::NewL")); - - CMSDocument* self = CMSDocument::NewLC( aApp ); - CleanupStack::Pop( self ); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSDocument* CMSDocument::NewLC( CEikApplication& aApp ) -// -------------------------------------------------------------------------- -// -CMSDocument* CMSDocument::NewLC(CEikApplication& aApp ) - { - LOG(_L("[MediaServant]\t CMSDocument::NewL")); - - CMSDocument* self = new ( ELeave ) CMSDocument( aApp ); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSDocument::CreateAppUiL() -// -------------------------------------------------------------------------- -// -CEikAppUi* CMSDocument::CreateAppUiL() - { - LOG(_L("[MediaServant]\t CMSDocument::CreateAppUiL")); - - return new ( ELeave ) CMSAppUi; - } - -// -------------------------------------------------------------------------- -// CMSDocument::~CMSDocument() -// -------------------------------------------------------------------------- -// -CMSDocument::~CMSDocument() - { - LOG(_L("[MediaServant]\t CMSDocument::~CMSDocument")); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msfillbrowsecontainer.cpp --- a/homesync/contentmanager/mediaservant/src/msfillbrowsecontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,314 +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: CMSFillBrowseContainer class implementation -* -*/ - - -#include -#include -#include -#include - -#include "mserv.hlp.hrh" -#include "cmfillrule.h" -#include "msfillbrowsecontainer.h" -#include "msfillbrowseview.h" -#include "msappui.h" -#include "msengine.h" -#include "mediaservantuid.h" - -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::CMSFillBrowseContainer() -// -------------------------------------------------------------------------- -// -CMSFillBrowseContainer::CMSFillBrowseContainer( - CMSAppUi& aAppUi, - CMSFillBrowseView& aView ) - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\ - CMSFillBrowseContainer")); - - iAppUi = &aAppUi; - iView = &aView; - iIconCount = 0; //default icon - - iAppUi->MSEngine()->SetObserver( this ); - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::~CMSFillBrowseContainer() -// -------------------------------------------------------------------------- -// -CMSFillBrowseContainer::~CMSFillBrowseContainer() - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\ - ~CMSFillBrowseContainer")); - - iStatusArray.Close(); - - delete iListBox; // Deletes listbox object. - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::RandomizeListL() -// -------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::RandomizeListL() - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::RandomizeListL")); - - iAppUi->MSEngine()->PreProcessFillListL( iRule->Name() ); - HBufC* naviText = StringLoader::LoadLC( R_MS_WAIT_RANDOMIZE ); - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::HasListRandomRule -// -------------------------------------------------------------------------- -// -TBool CMSFillBrowseContainer::HasListRandomRule() - { - TBool retval = EFalse; - if ( iRule->Method() == ECMRandom ) - { - retval = ETrue; - } - return retval; - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::ReadyL() -// engine observer callback -// -------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::ReadyL( TCmService aService, TInt /*aError*/ ) - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::ReadyL")); - - if ( aService == ECmServicePreProcessingFilllist ) - { - iView->ClearCurrentNaviPaneText(); - // read rules again - iAppUi->FillRuleController()->UpdateArrayL(); - - GetBrowseDataL(); - // Add data to listbox - UpdateListBoxDataL(); - } - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::CheckIfStatusChanged() -// Checks if status values are changed -// -------------------------------------------------------------------------- -// -TBool CMSFillBrowseContainer::CheckIfStatusChanged() - { - TBool status( EFalse ); - - TInt itemCount = iItemArray->Count(); - - for ( TInt i = 0; i < itemCount; i++ ) - { - TCmListItemStatus status1 = (*iItemArray)[i]->Status(); - TCmListItemStatus status2 = iStatusArray[i]; - if ( (*iItemArray)[i]->Status() != iStatusArray[i] ) - { - status = ETrue; - i = itemCount; // break loop - } - } - - return status; - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::SetFileStatusesL() -// Sets file statuses -// -------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::SetFileStatusesL() - { - if ( CheckIfStatusChanged() ) - { - iAppUi->MSEngine()->SetFillFileStatusesL( iItemArray ); - } - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::GetBrowseDataL() -// Gets file information from engine -// -------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::GetBrowseDataL() - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::GetBrowseDataL")); - - CMSParameterAgent* parameterAgent = iAppUi->ParameterAgent(); - - TInt selected = iAppUi->ParameterAgent()->FillViewFocusIndex(); - - RPointerArray* fillListArray = - iAppUi->FillRuleController()->FillListArray(); - - CMSFillList* fillList = (*fillListArray)[selected]; - iRule = fillList->List(); - // get media type - iMediaType = iRule->MediaType(); - // get items covered by rule - if( iItemArray ) - { - iItemArray->ResetAndDestroy(); - iItemArray->Close(); - delete iItemArray; - iItemArray = NULL; - } - iItemArray = iAppUi->MSEngine()->GetFillListItemsL( iRule->Name() ); - // keep original statuses safe - for ( TInt i = 0; i < iItemArray->Count(); i++ ) - { - iStatusArray.AppendL( (*iItemArray)[i]->Status() ); - } - - // Set title pane text - HBufC* ruleName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - iRule->Name() ); - CleanupStack::PushL( ruleName ); - iView->SetTitlePaneTextL( *ruleName ); - CleanupStack::PopAndDestroy( ruleName ); - - // set navi pane text - CreateAndSetNaviPaneTextL( fillList->ItemCount(), fillList->ListSize() ); - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::CreateAndSetNaviPaneTextL() -// -------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::CreateAndSetNaviPaneTextL( TUint32 aCount, - TUint32 aSize ) - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\ - CreateAndSetNaviPaneTextL")); - - // Set navi pane text - CArrayFix* infoArray = - new ( ELeave ) CArrayFixFlat(2); // only 2 numbers needed - CleanupStack::PushL( infoArray ); - - HBufC* naviText = NULL; - - TReal size( 0 ); - Math::Round( size, TReal( aSize ) / KMega, 0 ); - - - switch ( aCount ) - { - case 0: // 0 items - { - naviText = StringLoader::LoadLC( - R_MS_FILL_LIST_BROWSE_NAVI_0_ITEMS ); - break; - } - case 1: // 1 item - { - naviText = StringLoader::LoadLC( - R_MS_FILL_LIST_BROWSE_NAVI_1_ITEM, size ); - break; - } - default: // many items - { - infoArray->AppendL( size ); - infoArray->AppendL( aCount ); - naviText = StringLoader::LoadLC( - R_MS_FILL_LIST_BROWSE_NAVI_ITEMS, *infoArray ); - // do number conversion - TPtr ptr = naviText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - break; - } - } - - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - CleanupStack::PopAndDestroy( infoArray ); - } - - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::SetStatusOfFiles() -// -------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::SetStatusOfFiles( TCmListItemStatus aStatus ) - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::SetStatusOfFiles")); - - const CListBoxView::CSelectionIndexArray* selections = - ListBox()->SelectionIndexes(); - TInt count = selections->Count(); - - // mark used - if ( count ) - { - for ( TInt index = 0; index < count; index++) - { - SetFileStatus( (*selections)[ index ], aStatus ); - - } - } - // set only highlighted item status - else - { - SetFileStatus( ListBox()->CurrentItemIndex(), aStatus ); - } - - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseContainer::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::HandleResourceChange( TInt aType ) - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::\ - HandleResourceChange")); - - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect( iView->ClientRect() ); - } - - CCoeControl::HandleResourceChange( aType ); - } - -// --------------------------------------------------------------------------- -// CMSFillBrowseContainer::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSFillBrowseContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSFillBrowseContainer::GetHelpContext")); - - aContext.iMajor = TUid::Uid(KMediaServantUID3); - aContext.iContext = KMSERV_HLP_FILL_BROWSE; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msfillbrowseview.cpp --- a/homesync/contentmanager/mediaservant/src/msfillbrowseview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +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: CMSFillBrowseView class implementation -* -*/ - - - -#include -#include -#include - -#include "msfillbrowsecontainer.h" -#include "msconstants.h" -#include "msfillbrowseview.h" -#include "msappui.h" -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSFillBrowseView::CMSFillBrowseView() -// -------------------------------------------------------------------------- -// -CMSFillBrowseView::CMSFillBrowseView(CMSAppUi& aAppUi ) - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::CMSFillBrowseView")); - - iAppUi = &aAppUi; - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSFillBrowseView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::ConstructL")); - - BaseConstructL( R_MS_FILL_BROWSE_VIEW ); - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseView::~CMSFillBrowseView() -// -------------------------------------------------------------------------- -// -CMSFillBrowseView::~CMSFillBrowseView() - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::~CMSFillBrowseView")); - - DoDeactivate(); - } -// -------------------------------------------------------------------------- -// TUid CMSFillBrowseView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSFillBrowseView::Id() const - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::Id")); - - return KMSFillBrowseViewId; - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSFillBrowseView::HandleCommandL( TInt aCommand ) - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::HandleCommandL")); - - switch ( aCommand ) - { - case EAknSoftkeyBack: - { - // update status before exit - iContainer->SetFileStatusesL(); - // back to fill list view - iAppUi->ChangeViewL( KMSBrowseViewId, KMSFillViewId ); - break; - } - - case EMSCmdLock: - { - iContainer->SetStatusOfFiles( ECmLocalCopy ); - break; - } - - case EMSCmdUnLock: - { - iContainer->SetStatusOfFiles( ECmFilled ); - break; - } - - case EMSCmdRandomize: - { - iContainer->RandomizeListL(); - break; - } - - case EAknCmdMark: // fall through - case EAknCmdUnmark: // fall through - case EAknMarkAll: // fall through - case EAknUnmarkAll: - { - // Gets pointer of current listbox. - CEikListBox* listbox = iContainer->ListBox(); - - if ( listbox ) - { - AknSelectionService::HandleMarkableListProcessCommandL( - aCommand, listbox ); - } - break; - } - case EAknCmdHelp : - { - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - - default: - { - // update status before exit - iContainer->SetFileStatusesL(); - - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - - - -// -------------------------------------------------------------------------- -// CMSFillBrowseView::DoActivateL(...) -// -------------------------------------------------------------------------- -// -void CMSFillBrowseView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::DoActivateL")); - - // Set title pane text to default - SetTitlePaneTextL( KMSDefaultTitleId ); - - if ( !iContainer ) - { - iContainer = new (ELeave) CMSFillBrowseContainer( - *iAppUi, - *this ); - iContainer->ConstructL( ClientRect() ); - iContainer->SetMopParent( this ); - AppUi()->AddToViewStackL( *this, iContainer ); - iContainer->ActivateL(); - - // marked item indexes - iSelections = iContainer->ListBox()->SelectionIndexes(); - - } - } - -// -------------------------------------------------------------------------- -// CMSFillBrowseView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSFillBrowseView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::DoDeactivate")); - - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; // Deletes the container class object. - iContainer = NULL; - - ClearCurrentNaviPaneText(); - } - - -// -------------------------------------------------------------------------- -// CMSFillBrowseView::DynInitMenuPaneL -// -------------------------------------------------------------------------- -// -void CMSFillBrowseView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane) - { - LOG(_L("[MediaServant]\t CMSFillBrowseView::DynInitMenuPaneL")); - - TInt numberOfItems = iContainer->ListBox()->Model()->NumberOfItems(); - - if ( aResourceId == R_MS_FILL_BROWSE_MENU ) - { - // check if random lists exist or there is no items - if ( iContainer->HasListRandomRule() == EFalse ) - { - aMenuPane->SetItemDimmed( EMSCmdRandomize, ETrue ); - } - - if ( numberOfItems ) - { - TCmListItemStatus fileStatus = iContainer->FileStatus( - iContainer->ListBox()->CurrentItemIndex() ); - - if ( fileStatus == ECmToBeFilled || - fileStatus == ECmToBeShrinked ) - { - aMenuPane->SetItemDimmed( EMSCmdUnLock, ETrue ); - aMenuPane->SetItemDimmed( EMSCmdLock, ETrue ); - aMenuPane->SetItemDimmed( EMSCmdMark, ETrue ); - } - else - { - if ( fileStatus == ECmFilled ) - { - aMenuPane->SetItemDimmed( EMSCmdUnLock, ETrue ); - } - else // ECmLocalCopy - { - aMenuPane->SetItemDimmed( EMSCmdLock, ETrue ); - } - } - } - else - { - aMenuPane->SetItemDimmed( EMSCmdLock, ETrue ); - aMenuPane->SetItemDimmed( EMSCmdUnLock, ETrue ); - aMenuPane->SetItemDimmed( EMSCmdMark, ETrue ); - } - } - - // mark submenu - if ( aResourceId == R_MS_MARK_MENUPANE && numberOfItems ) - { - - if ( iSelections->Count() == 0 ) - { - aMenuPane->SetItemDimmed( EAknCmdUnmark, ETrue ); - aMenuPane->SetItemDimmed( EAknUnmarkAll, ETrue ); - } - else - { - // index of selected item - TInt itemIdx = 0; - // highlighted item index - TInt currentItem = iContainer->ListBox()->CurrentItemIndex(); - // Sort criteria, offset = 0 - TKeyArrayFix sortKey( 0, ECmpTUint ); - TInt found = iSelections->Find( currentItem, sortKey, itemIdx ); - if ( found == 0 ) - { - aMenuPane->SetItemDimmed( EAknCmdMark, ETrue ); - } - } - } - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msfillcontainer.cpp --- a/homesync/contentmanager/mediaservant/src/msfillcontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1125 +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: CMSFillContainer class implementation -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "upnpstring.h" -#include - -#include "cmdriveinfo.h" -#include "mserv.hlp.hrh" -#include "cmfillrule.h" -#include "msfillview.h" -#include "msappui.h" -#include "mediaservantuid.h" -#include "msengine.h" -#include "msfillcontainer.h" -#include "msconstants.h" -#include "msdebug.h" - -// CONSTANTS - -// Listbox granularity -const TInt KListGranularity = 5; - -// -------------------------------------------------------------------------- -// CMSFillContainer::CMSFillContainer() -// -------------------------------------------------------------------------- -// -CMSFillContainer::CMSFillContainer( CMSAppUi& aAppUi, CMSFillView& aView ) : - iMSAppUi( aAppUi ), - iView( aView ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::CMSFillContainer")); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::~CMSFillContainer() -// -------------------------------------------------------------------------- -// -CMSFillContainer::~CMSFillContainer() - { - LOG(_L("[MediaServant]\t CMSFillContainer::~CMSFillContainer")); - - iSelectedLists.Close(); - - iView.ClearCurrentNaviPaneText(); - - delete iListBox; // Deletes listbox object. - - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSFillContainer::ConstructL( TRect aRect ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::ConstructL")); - - // fill quota size - CalculateFillQuotaL(); - - CreateWindowL(); - - iListBox = new (ELeave) CAknSingleGraphicStyleListBox; - - // This is multiselection listbox but resource defines it as SELECTION - // LIST because we don't want to let framework handle icon changes. - // Framework toggles between two icons whereas we have to show multiple - // icons. - // Special icons are changed every time item selection or priority - // changes. Calculations for icons are made in SetIcon() - SetListBoxFromResourceL(iListBox, R_FILL_VIEW_LISTBOX); - - // Create icons - CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount ); - CleanupStack::PushL( icons ); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - // selected and fits icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_white_check, - EMbmMediaservantQgn_mserv_white_check_mask ); - - // unselected and fits icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_white_uncheck, - EMbmMediaservantQgn_mserv_white_uncheck_mask ); - - // selected and partially fits icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_yellow_check, - EMbmMediaservantQgn_mserv_yellow_check_mask ); - - // unselected and partially fits icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_yellow_uncheck, - EMbmMediaservantQgn_mserv_yellow_uncheck_mask ); - - // selected and doesn't fit icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_red_check, - EMbmMediaservantQgn_mserv_red_check_mask ); - - // unselected and doesn't fit icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_red_uncheck, - EMbmMediaservantQgn_mserv_red_uncheck_mask ); - // video type -icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_video_list_small, - EMbmMediaservantQgn_mserv_video_list_small_mask ); - - // image type -icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_image_list_small, - EMbmMediaservantQgn_mserv_image_list_small_mask ); - - // music type -icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_music_list_small, - EMbmMediaservantQgn_mserv_music_list_small_mask ); - - // mark icon for reordering mode -icon - AppendIconToArrayL( icons, skin, - KAvkonMifFileName, - KAknsIIDDefault, - EMbmAvkonQgn_indi_marked_add, - EMbmAvkonQgn_indi_marked_add_mask ); - - iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); - CleanupStack::Pop(icons); - - - // Create icon for context pane - AknsUtils::CreateIconL( skin, - KAknsIIDDefault, - iIcon, - iIconMask, - KMSMifFileName, - EMbmMediaservantQgn_mserv_from_home, - EMbmMediaservantQgn_mserv_from_home_mask); - // change context icon - SetContextPaneIconL( iIcon, iIconMask ); - - SetRect(aRect); - - // Get rule controller - iFillRuleController = iMSAppUi.FillRuleController(); - // Update array - iFillRuleController->UpdateArrayL(); - // get fill lists - iFillListArray = iFillRuleController->FillListArray(); - // keep selections safe - iSelectedIndexes = iListBox->SelectionIndexes(); - - TInt64 capasity; - TInt64 free; - iMSAppUi.ReadMMCInfoL( capasity, free ); - iFreeMemory = Min( free, iQuota ); - - if ( iFillListArray->Count() > 0 ) - { - // Add data to listbox - UpdateListBoxDataL(); - - // Enable text scrolling - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - - // get item array - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - - iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); - } - - // keep selections safe - const CListBoxView::CSelectionIndexArray* selected = - iListBox->SelectionIndexes(); - - for ( TInt index = 0; index < selected->Count(); index++ ) - { - iSelectedLists.AppendL( (*selected)[index] ); - } - - // Set highlighted item - TInt currentItem = iMSAppUi.ParameterAgent()->FillViewFocusIndex(); - if ( currentItem >= 0 ) - { - //Set current item - iListBox->SetCurrentItemIndex( currentItem ); - } - else - { - // first item - // This is set when new list is created without existing lists - iListBox->SetCurrentItemIndex( 0 ); - } - - UpdateNaviTextL(); - - iPreviousItemIndex = 0; - iDragItemIndex = 0; - - // Change middle softkey according to selection - TBool listSelected = IsCurrentListItemActive(); - iView.SetCbaL( listSelected ); - - ActivateL(); // Activates window. ( Ready to draw ) - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::CountComponentControls() -// Returns number of components. -// -------------------------------------------------------------------------- -// -TInt CMSFillContainer::CountComponentControls() const - { - LOG(_L("[MediaServant]\t CMSFillContainer::CountComponentControls")); - - return 1; // return number of controls inside this container - } - - -// -------------------------------------------------------------------------- -// CMSFillContainer::ComponentControl() -// Returns pointer to particular component. -// -------------------------------------------------------------------------- -// -CCoeControl* CMSFillContainer::ComponentControl(TInt /*aIndex*/) const - - { - return iListBox; // return a pointer to the listbox - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::OfferKeyEventL() -// Handles the key events. -// -------------------------------------------------------------------------- -// -TKeyResponse CMSFillContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::OfferKeyEventL")); - - TKeyResponse response = EKeyWasNotConsumed; - - if ( aType != EEventKey ) - { - response = EKeyWasNotConsumed; - } - - else if ( iListBox && iListBox->CurrentItemIndex() >= 0 ) - { - // check if reordering mode is activated - if ( iReorderState == EMSFillReorderActive || - aKeyEvent.iCode == EKeyLeftArrow || - aKeyEvent.iCode == EKeyRightArrow ) - { - response = HandleReorderKeyEventL( aKeyEvent, aType ); - } - - // delete list - else if ( aKeyEvent.iCode == EKeyBackspace ) - { - DeleteRuleL(); - response = EKeyWasConsumed; - } - - // activate/deactivate list - else if ( aKeyEvent.iCode == EKeyOK ) - { - CCmFillRule* rule = - (*iFillListArray)[iListBox->CurrentItemIndex()]->List(); - if ( rule->Selected() == ECmSelected ) - { - rule->SetSelected( ECmUnSelected ); - } - else - { - rule->SetSelected( ECmSelected ); - } - iView.SetListUnselected(); - UpdateListBoxDataL(); - response = EKeyWasConsumed; - } - - // default - else - { - response = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - - - TCmServerState state; - iMSAppUi.MSEngine()->ServerState( state ); - if ( ( aKeyEvent.iCode == EKeyUpArrow || - ( aKeyEvent.iCode == EKeyDownArrow ))) - { - // change navi pane text to match highlighted list size - UpdateNaviTextL(); - } - } - -#ifndef __SERIES60_31__ - if ( iReorderState == EMSFillNormal ) - { - // Change middle softkey according to selection - TBool listSelected = IsCurrentListItemActive(); - iView.SetCbaL( listSelected ); - } -#endif - - return response; - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::HandleDragAndDropEventsL() -// Handles drag and drop events on touch screen -// -------------------------------------------------------------------------- -// -void CMSFillContainer::HandleDragAndDropEventsL( const TPointerEvent& aPointerEvent ) - { - if ( aPointerEvent.iType == TPointerEvent::EButton1Down && - iReorderState != EMSFillNormal ) - { - iReorderState = EMSFillReorderActive; - iDragItemIndex = iListBox->CurrentItemIndex(); - } - else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && - iReorderState == EMSFillReorderActive ) - { - iView.HandleCommandL( EMSCmdDrop ); - TInt listBoxItem = iListBox->CurrentItemIndex(); - iListBox->SetCurrentItemIndex( iDragItemIndex ); - - TKeyEvent keyEvent; - // Move dragged item downwards - if ( listBoxItem >= iDragItemIndex ) - { - keyEvent.iCode = EKeyDownArrow; - for( TInt c = 0; listBoxItem > iDragItemIndex + c; c++ ) - { - HandleReorderKeyEventL( keyEvent, EEventKey ); - } - } - // Move dragged item upwards - else - { - keyEvent.iCode = EKeyUpArrow; - for( TInt c = 0; listBoxItem < iDragItemIndex - c; c++ ) - { - HandleReorderKeyEventL( keyEvent, EEventKey ); - } - } - - iListBox->SetCurrentItemIndex( listBoxItem ); - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::UpdateListBoxDataL() -// Creates listbox items -// -------------------------------------------------------------------------- -// -void CMSFillContainer::UpdateListBoxDataL() - { - LOG(_L("[MediaServant]\t CMSFillContainer::UpdateListBoxDataL")); - TInt64 freeSpace = iFreeMemory; - - TCmServerState state; - iMSAppUi.MSEngine()->ServerState( state ); - - // Keep item index safe for reordering mode because we reset the list - TInt currentItemIndex = iListBox->CurrentItemIndex(); - - // reset list size - iSizeOfSelectedLists = 0; - - TBuf item; - HBufC* primary_text = HBufC::NewL( KMaxFileName ); - CleanupStack::PushL( primary_text ); - - // Listbox items - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - itemArray->Reset(); - - // Marked listbox item indexes - CArrayFix* selectionArray = new (ELeave ) - CArrayFixFlat(KListGranularity); - - CleanupStack::PushL( selectionArray ); - - TInt ruleCount = iFillListArray->Count(); - - for ( TInt index = 0; index < ruleCount; index++ ) - { - // Get fill rule name and put it to the listbox - CCmFillRule* rule = (*iFillListArray)[index]->List(); - HBufC* listName = UpnpString::ToUnicodeL( rule->Name() ); - CleanupStack::PushL( listName ); - primary_text->Des().Copy( *listName ); - CleanupStack::PopAndDestroy( listName ); - - - // Check if rule is active and mark it in the list - TCmFillRuleStatus status = rule->Selected(); - - TInt64 listSize = (*iFillListArray)[index]->ListSize(); - - if ( status == ECmSelected ) - { - selectionArray->AppendL( index ); - - TInt id = rule->ListId(); - TInt64 size = 0; - iMSAppUi.GetFilledFilesSize( size, id ); - - // list selected - add used memory size - iSizeOfSelectedLists += ( listSize - size ); - } - // calculate icon index - TInt iconIndex = ListItemIconIndex( index, - listSize, - freeSpace ); - - - switch ( rule->MediaType() ) - { - case ECmVideo: - { - item.Format( KSingleGraphicStyleFormatString, - iconIndex, primary_text, EVideoType ); - break; - } - case ECmImage: - { - item.Format( KSingleGraphicStyleFormatString, - iconIndex, primary_text, EImageType ); - break; - } - case ECmAudio: - { - item.Format( KSingleGraphicStyleFormatString, - iconIndex, primary_text, EAudioType ); - break; - } - default: - { - item.Format( KSingleGraphicStyleFormatStringNoTrailIcons, - iconIndex, primary_text); - break; - } - } - - // Check if reorder mode is active and mark current item - if ( iReorderState == EMSFillReorderActive && - index == currentItemIndex ) - { - TBuf<2> markIconStr; // Magic: 2 characters reserverd for icon - markIconStr.AppendNum( EMark ); - item.Append(markIconStr); - } - itemArray->AppendL( item ); - } - - iListBox->SetSelectionIndexesL( selectionArray ); - - CleanupStack::PopAndDestroy( selectionArray ); - CleanupStack::PopAndDestroy( primary_text ); - - UpdateNaviTextL(); - if( currentItemIndex > KErrNotFound && currentItemIndex < ruleCount ) - { - iListBox->SetCurrentItemIndex( currentItemIndex ); - } - iListBox->HandleItemAdditionL(); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::SetFillRules() -// Sends fill rules to server -// -------------------------------------------------------------------------- -// -void CMSFillContainer::SetFillRules() - { - LOG(_L("[MediaServant]\t CMSFillContainer::SetFillRules")); - - // Get marked items indexes - const CListBoxView::CSelectionIndexArray* selected = - iListBox->SelectionIndexes(); - - // Listbox item count - TInt itemCount = iFillListArray->Count(); - - // Selected item index - TInt itemIdx = 0; - - // Sort criteria, offset = 0 - TKeyArrayFix sortKey( 0, ECmpTUint ); - - // count selected items - TInt count = selected->Count(); - - for ( TInt index = 0; index < itemCount; index++ ) - { - // check if listbox item is found from selected item list - TInt found = selected->Find( index, sortKey, itemIdx ); - - CCmFillRule* rule = (*iFillListArray)[index]->List(); - - // FOUND - if ( found == 0 ) - { - // set rule selected - rule->SetSelected( ECmSelected ); - } - // NOT FOUND - else - { - // set rule unselected - rule->SetSelected( ECmUnSelected ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::SelectedItemIndex() -// Highlighted item index -// -------------------------------------------------------------------------- -// -TInt CMSFillContainer::SelectedItemIndex() - { - LOG(_L("[MediaServant]\t CMSFillContainer::SelectedItemIndex")); - - return iListBox->CurrentItemIndex(); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::ListItemCount() -// coun of list items -// -------------------------------------------------------------------------- -// -TInt CMSFillContainer::ListItemCount() - { - LOG(_L("[MediaServant]\t CMSFillContainer::ListItemCount")); - - return iListBox->Model()->NumberOfItems(); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::SetReorderStateL() -// Sets reorder state -// -------------------------------------------------------------------------- -// -void CMSFillContainer::SetReorderStateL( TMSReorderState aState ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::SetReorderStateL")); - - switch ( aState ) - { - case EMSFillNormal: - { - iReorderState = EMSFillNormal; - break; - } - case EMSFillReorderActive: - { - iReorderState = EMSFillReorderActive; - UpdateListBoxDataL(); - break; - } - case EMSFillGrabActive: - { - iReorderState = EMSFillGrabActive; - UpdateListBoxDataL(); - break; - } - default: - { - iReorderState = EMSFillNormal; - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::MoveItem() -// moves item up/down on the list -// -------------------------------------------------------------------------- -// -void CMSFillContainer::MoveItem( TInt aDirection ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::MoveItem")); - - TInt currentIdx = iListBox->CurrentItemIndex(); - TInt totalItem = iListBox->Model()->NumberOfItems(); - - // store selection status of all rules - StoreSelectionStatus(); - - // up - if (aDirection == -1 && currentIdx) - { - iFillRuleController->ChangePriority( totalItem, - currentIdx, - aDirection ); - } - // down - else if ( aDirection == 1 && currentIdx < totalItem - 1 ) - { - iFillRuleController->ChangePriority( totalItem, - currentIdx, - aDirection ); - } - else - { - // Do nothing - } - } - - -// -------------------------------------------------------------------------- -// CMSFillContainer::HandleReorderKeyEventL -// Handle key events in reordering mode. -// (other items were commented in a header). -// -------------------------------------------------------------------------- -// -TKeyResponse CMSFillContainer::HandleReorderKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::HandleReorderKeyEventL")); - - TKeyResponse keyResponse = EKeyWasConsumed; - - TInt currentIdx = iListBox->CurrentItemIndex(); - TInt totalItems = iListBox->Model()->NumberOfItems(); - - TBool reqToRedraw = EFalse; - if ( aType == EEventKey ) - { - switch ( aKeyEvent.iCode ) - { - case EKeyUpArrow: - // fall through - case EKeyLeftArrow: - { - if ( currentIdx > 0 ) - { - MoveItem(-1); - iListBox->SetCurrentItemIndex( currentIdx - 1 ); - reqToRedraw = ETrue; - } - break; - } - case EKeyDownArrow: - // fall through - case EKeyRightArrow: - { - if ( currentIdx < totalItems-1 ) // because index is 0 based - { - MoveItem(1); - iListBox->SetCurrentItemIndex( currentIdx + 1 ); - reqToRedraw = ETrue; - } - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillContainer::\ - HandleReorderKeyEventL invalid keycode")); - break; - } - } - } - - if( reqToRedraw ) - { - // update selected item indexes - const CListBoxView::CSelectionIndexArray* selected = - iListBox->SelectionIndexes(); - UpdateListBoxDataL(); - iSelectedLists.Reset(); - for ( TInt index = 0; index < selected->Count(); index++ ) - { - TInt a = (*selected)[index]; - iSelectedLists.AppendL( (*selected)[index] ); - } - } - - return keyResponse; - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::StoreSelectionStatus() -// stores fill rule selection status to rule container -// -------------------------------------------------------------------------- -// -void CMSFillContainer::StoreSelectionStatus() - { - LOG(_L("[MediaServant]\t CMSFillContainer::StoreSelectionStatusL")); - - // index of selected item - TInt itemIdx = 0; - // Sort criteria, offset = 0 - TKeyArrayFix sortKey( 0, ECmpTUint ); - - // Listbox array - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - - // Listbox item count - TInt itemCount = itemArray->Count(); - - const CListBoxView::CSelectionIndexArray* selected = - iListBox->SelectionIndexes(); - - // count selected items - TInt count = selected->Count(); - - for ( TInt index = 0; index < itemCount; index++ ) - { - // check if listbox item is found from selected item list - TInt found = selected->Find( index, sortKey, itemIdx ); - - if ( found == 0 ) - { - // found - get correcponding index for rule table with At() - CCmFillRule* rule = - (*iFillListArray)[selected->At( itemIdx )]->List(); - // set rule selected - rule->SetSelected( ECmSelected ); - } - else - { - // not found - CCmFillRule* rule = (*iFillListArray)[index]->List(); - // set rule unselected - rule->SetSelected( ECmUnSelected ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::DeleteRuleL() -// Deletes highlighted rule -// -------------------------------------------------------------------------- -// -void CMSFillContainer::DeleteRuleL() - { - LOG(_L("[MediaServant]\t CMSFillContainer::DeleteRuleL")); - - // Show delete files query - CAknQueryDialog* query= CAknQueryDialog::NewL( - CAknQueryDialog::ENoTone ); - - if ( query->ExecuteLD( R_MSERV_DELETE_LIST_QUERY ) ) - { - TInt currentItemIndex = iListBox->CurrentItemIndex(); - // delete rule - iFillRuleController->DeleteRuleL( currentItemIndex ); - - // Listbox items - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - - // delete list item - itemArray->Delete( currentItemIndex ); - iListBox->HandleItemRemovalL(); - iListDeleted = ETrue; - - if ( currentItemIndex > 0 ) - { - // highligth previous - iListBox->SetCurrentItemIndexAndDraw( currentItemIndex - 1 ); - } - iMSAppUi.MSEngine()->DeleteFilledFilesL(); - iView.ShowNaviTextL(); - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::IsListDeleted() -// Returns list delete status -// -------------------------------------------------------------------------- -// -TBool CMSFillContainer::IsListDeleted() - { - return iListDeleted; - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::HandlePointerEventL() -// Handles touchscreen event -// -------------------------------------------------------------------------- -// -void CMSFillContainer::HandlePointerEventL ( const TPointerEvent& aPointerEvent ) - { - CCoeControl::HandlePointerEventL( aPointerEvent ); - - if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) - { - // Do not change listbox item state, when highlighting an item or, - // when reordering state is active - if ( iListBox->CurrentItemIndex() == iPreviousItemIndex && - iReorderState == EMSFillNormal ) - { - TKeyEvent keyEvent; - keyEvent.iCode = EKeyOK; - OfferKeyEventL( keyEvent, EEventKey ); - } - else - { - UpdateListBoxDataL(); - } - iPreviousItemIndex = iListBox->CurrentItemIndex(); - } - - // Handle Drag and drop events, when reorder state is active - if ( iReorderState != EMSFillNormal ) - { - HandleDragAndDropEventsL( aPointerEvent ); - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::CheckIfDublicateName() -// Checks how many dublicate items is on the fill list -// -------------------------------------------------------------------------- -// -TInt CMSFillContainer::CheckIfDublicateNames( const TDesC& aName ) - { - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - TInt count(0); - - for ( TInt index = 0; index < itemArray->MdcaCount(); index++ ) - { - if ( KErrNotFound != itemArray->MdcaPoint( index ).Match( aName ) ) - { - count++; - } - } - return count; - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::UpdateNaviTextL() -// updates list size on navi pane -// -------------------------------------------------------------------------- -// -void CMSFillContainer::UpdateNaviTextL() - { - LOG(_L("[MediaServant]\t CMSFillContainer::UpdateNaviTextL")); - - TInt currentItemIndex = iListBox->CurrentItemIndex(); - - if ( currentItemIndex != KErrNotFound ) - { - CArrayFix* infoArray = new ( ELeave ) CArrayFixFlat(2); - CleanupStack::PushL( infoArray ); - - CMSFillList* fillList = (*iFillListArray)[currentItemIndex]; - CCmFillRule* rule = fillList->List(); - - HBufC* naviText = NULL; - - TInt64 freeMemory = iFreeMemory - iSizeOfSelectedLists; - - // round values - TReal size(0); - Math::Round( size, TReal(fillList->ListSize()) / KMega, 0 ); - - TReal freeSize(0); - Math::Round( freeSize, TReal(freeMemory) / KMega, 0 ); - - infoArray->AppendL( size ); - infoArray->AppendL( freeSize ); - - naviText = StringLoader::LoadLC( R_MS_NAVI_LIST_SIZE, - *infoArray ); - // do number conversion - TPtr ptr = naviText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iView.SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - CleanupStack::PopAndDestroy( infoArray ); - } - else - { - iView.ClearCurrentNaviPaneText(); - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::ChangeListActivityL() -// Toggles list item -// -------------------------------------------------------------------------- -// -void CMSFillContainer::ChangeListActivityL() - { - CCmFillRule* rule = - (*iFillListArray)[iListBox->CurrentItemIndex()]->List(); - if ( rule->Selected() == ECmSelected ) - { - rule->SetSelected( ECmUnSelected ); - } - else - { - rule->SetSelected( ECmSelected ); - } - UpdateListBoxDataL(); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::IsCurrentListItemActive() -// Checks if item is selected -// -------------------------------------------------------------------------- -// -TBool CMSFillContainer::IsCurrentListItemActive() - { - return iListBox->View()->ItemIsSelected( iListBox->CurrentItemIndex() ); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::HasListSelectionsChanged -// Checks if item is selected -// -------------------------------------------------------------------------- -// -TBool CMSFillContainer::HasListSelectionsChanged() - { - LOG(_L("[MediaServant]\t CMSFillContainer::HasListSelectionsChanged")); - - TBool status = EFalse; - - TInt originalCount = iSelectedLists.Count(); - - const CListBoxView::CSelectionIndexArray* selected = - iListBox->SelectionIndexes(); - - TKeyArrayFix sortKey( 0, ECmpTUint ); - // dummy index - not interested of this - TInt dummy = 0; - - for ( TInt index = 0; index < originalCount; index++ ) - { - // check if listbox item is found from selected item list - TInt found = selected->Find( - iSelectedLists[index], sortKey, dummy ); - if ( found != 0 ) - { - // something has changed on the list - status = ETrue; - index = originalCount; // break loop - } - } - - return status; - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::ListItemIconIndex -// Returns icon index based on list size and free space -// -------------------------------------------------------------------------- -// -TInt CMSFillContainer::ListItemIconIndex( TInt aIndex, - TInt64 aListSize, - TInt64& aFreeSpace ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::ListItemIconIndex")); - - TInt iconIndex( 0 ); - // check if item is selected - CCmFillRule* rule = (*iFillListArray)[aIndex]->List(); - if( ECmSelected == rule->Selected() ) - { - // doesn't fit - if ( aFreeSpace <= 0 ) - { - iconIndex = EMSSelectedDoesntFit; - aFreeSpace = 0; - } - // fits - else if ( aFreeSpace - aListSize > 0 ) - { - iconIndex = EMSSelectedFits; - aFreeSpace -= aListSize; - } - // fits partially - else - { - iconIndex = EMSSelectedPartiallyFits; - aFreeSpace = 0; - } - } - else - { - // doesn't fit - if ( aFreeSpace <= 0) - { - iconIndex = EMSUnSelectedDoesntFit; - aFreeSpace = 0; - } - // fits - else if ( aFreeSpace - aListSize > 0 ) - { - iconIndex = EMSUnselectedFits; - aFreeSpace -= aListSize; - } - // fits partially - else - { - iconIndex = EMSUnselectedPartiallyFits; - aFreeSpace = 0; - } - } - return iconIndex; - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::CalculateFillQuotaL() -// Gets selected drives and calculates quota size -// -------------------------------------------------------------------------- -// -void CMSFillContainer::CalculateFillQuotaL() - { - RPointerArray drives; - - iMSAppUi.MSEngine()->GetDrivesL( drives ); - for ( TInt i = 0; i < drives.Count(); i++ ) - { - iQuota += drives[i]->DriveQuota(); - iQuota -= drives[i]->UsedDriveQuota(); - } - drives.ResetAndDestroy(); - drives.Close(); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CMSFillContainer::SizeChanged() - { - // container control resize code. - if ( iListBox ) - { - iListBox->SetRect( Rect() ); // Set rectangle of listbox. - } - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSFillContainer::HandleResourceChange( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect( iView.ClientRect() ); - } - - CCoeControl::HandleResourceChange( aType ); - } - -// --------------------------------------------------------------------------- -// CMSFillContainer::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSFillContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSFillContainer::GetHelpContext")); - - aContext.iMajor = TUid::Uid(KMediaServantUID3); - aContext.iContext = KMSERV_HLP_FILL_LIST; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msfillrulecontroller.cpp --- a/homesync/contentmanager/mediaservant/src/msfillrulecontroller.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,664 +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: CMSFillRuleController class implementation -* -*/ - - -#include -#include -#include - -#include "cmfillrulecontainer.h" -#include "cmfillrule.h" -#include "msfillrulecontroller.h" -#include "msconstants.h" -#include "mediaservant.hrh" -#include "msengine.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSFillRuleController::NewL -// -------------------------------------------------------------------------- -// -CMSFillRuleController* CMSFillRuleController::NewL( CMSEngine& aMSEngine ) - { - LOG(_L("[MediaServant]\t CMSFillRuleController::NewL")); - - CMSFillRuleController* self = CMSFillRuleController::NewLC( aMSEngine ); - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::NewLC -// -------------------------------------------------------------------------- -// -CMSFillRuleController* CMSFillRuleController::NewLC( CMSEngine& aMSEngine ) - { - LOG(_L("[MediaServant]\t CMSFillRuleController::NewLC")); - - CMSFillRuleController* self = new (ELeave) CMSFillRuleController( - aMSEngine ); - - CleanupStack::PushL(self); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::ConstructL -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::ConstructL() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::ConstructL")); - - if (iMSEngine) - { - InitializeRuleContainersL(); - } - } -// -------------------------------------------------------------------------- -// CMSFillRuleController::CMSFillRuleController() -// -------------------------------------------------------------------------- -// -CMSFillRuleController::CMSFillRuleController( CMSEngine& aMSEngine ) - { - LOG(_L("[MediaServant]\t CMSFillRuleController::CMSFillRuleController")); - - iMSEngine = &aMSEngine; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::~CMSFillRuleController() -// -------------------------------------------------------------------------- -// -CMSFillRuleController::~CMSFillRuleController() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::~CMSFillRuleController")); - - iFillListArray.ResetAndDestroy(); - iFillListArray.Close(); - - delete iRuleContainer; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::FillListArray() -// Returns pointer to fill list array -// -------------------------------------------------------------------------- -// -RPointerArray* CMSFillRuleController::FillListArray() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::FillListArray")); - - return &iFillListArray; - } - -// --------------------------------------------------------------------------- -// CMSFillRuleController::InitializeRuleContainersL -// initializes rule containers -// --------------------------------------------------------------------------- -// -void CMSFillRuleController::InitializeRuleContainersL() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::\ - InitializeRuleContainersL")); - - TInt error( KErrNone ); - // Check if wizard has been executed - TBool runWizard = iMSEngine->GetAppWizardState( error ); - - if ( !runWizard ) - { - CreateFillRulesL(); - delete iRuleContainer; - iRuleContainer = NULL; - iRuleContainer = iMSEngine->FillRulesL(); - } - else - { - // FILL RULES - iRuleContainer = iMSEngine->FillRulesL(); - } - - // Creates pointer array to rules so we can change rule order at UI - // Operations done trough pointer array affects original rules - // in RuleContainer - if ( iRuleContainer ) - { - // Arrange rules by priority to pointer table - TInt rulecount = iRuleContainer->FillRuleCount(); - - for (TUint8 order = 0; order < rulecount; order++) - { - // search rule with desired priority - for (TInt index = 0; index < rulecount; index++) - { - - CCmFillRule* rule = iRuleContainer->FillRule(index); - TUint8 priority = rule->Priority(); - - if ( order == priority ) - { - CMSFillList* list = - CMSFillList::NewL( *iMSEngine, *rule ); - // add list to array - iFillListArray.AppendL( list ); - - // stop for loop - index = rulecount; - } - } - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::CreateFillRulesL() -// FOR TEST -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::CreateFillRulesL() - { - CCmFillRuleContainer* fillRuleContainer = CCmFillRuleContainer::NewLC(); - - // default list 1 - CCmFillRule* defaultList1 = CCmFillRule::NewLC(); - - HBufC* temp = StringLoader::LoadLC( R_MS_DEFAULT_FILL_LIST_1 ); - HBufC8* listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList1->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - defaultList1->SetMediaType( ECmImage ); - defaultList1->SetMethod( ECmLatest ); - defaultList1->SetSelected( ECmUnSelected ); - defaultList1->SetPriority( 0 ); - defaultList1->SetTemplateId( EMSDefaultImageList ); - defaultList1->SetStatus( ECmToBeFilled ); - defaultList1->SetLimitType( EMbits ); - defaultList1->SetAmount( KDefaultListSize50 ); - - fillRuleContainer->AddFillRuleL( defaultList1 ); - - // default list 2 - CCmFillRule* defaultList2 = CCmFillRule::NewLC(); - - temp = StringLoader::LoadLC( R_MS_DEFAULT_FILL_LIST_2 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList2->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - defaultList2->SetMediaType( ECmVideo ); - defaultList2->SetMethod( ECmLatest ); - defaultList2->SetSelected( ECmUnSelected ); - defaultList2->SetPriority( 1 ); - defaultList2->SetTemplateId( EMSDefaultVideoList ); - defaultList2->SetStatus( ECmToBeFilled ); - defaultList2->SetLimitType( EMbits ); - defaultList2->SetAmount( KDefaultListSize50 ); - - fillRuleContainer->AddFillRuleL( defaultList2 ); - - // default list 3 - CCmFillRule* defaultList3 = CCmFillRule::NewLC(); - - temp = StringLoader::LoadLC( R_MS_DEFAULT_FILL_LIST_3 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList3->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - defaultList3->SetMediaType( ECmAudio ); - defaultList3->SetMethod( ECmLatest ); - defaultList3->SetSelected( ECmUnSelected ); - defaultList3->SetPriority( 2 ); - defaultList3->SetTemplateId( EMSDefaultMusicList ); - defaultList3->SetStatus( ECmToBeFilled ); - defaultList3->SetLimitType( EMbits ); - defaultList3->SetAmount( KDefaultListSize200 ); - - fillRuleContainer->AddFillRuleL( defaultList3 ); - - iMSEngine->SetFillRulesL( fillRuleContainer ); - - CleanupStack::Pop( defaultList3 ); - CleanupStack::Pop( defaultList2 ); - CleanupStack::Pop( defaultList1 ); - CleanupStack::PopAndDestroy( fillRuleContainer ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::DeleteRuleL() -// Deletes current rule -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::DeleteRuleL( TInt aCurrentIndex ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::DeleteRuleL")); - - // get priority of selected rule - TInt currentPriority = - iFillListArray[ aCurrentIndex ]->List()->Priority(); - - // Rulecontainer must be scanned to find the index index of - // rule container. - // Priority can be used to compare because there can't be two rules - // with same priority. - for (TInt index = 0; index < iRuleContainer->FillRuleCount(); index++) - { - if (currentPriority == iRuleContainer->FillRule( index )->Priority()) - { - iFillListArray[ aCurrentIndex ]-> - List()->SetSelected( ECmDeleted ); - } - } - - // recalculate priorities - SetPriorities(); - - // store rules to server - iMSEngine->SetFillRulesL( iRuleContainer ); - - // update pointer array - UpdateArrayL(); - - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::AddRuleL() -// Adds new rule -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::AddRuleL( CCmFillRule* aRule ) - { - LOG(_L("[MediaServant]\t CMSFillContainer::DeleteRuleL")); - - if ( aRule ) - { - TInt priority = iFillListArray.Count(); - aRule->SetPriority( priority ); - iRuleContainer->AddFillRuleL( aRule ); - - // store rules to server - iMSEngine->SetFillRulesL( iRuleContainer ); - - // update pointer array - UpdateArrayL(); - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::SetPriorities() -// Sets priorities of rule array -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::SetPriorities() - { - TInt priority = 0; - - for ( TInt index = 0; index < iFillListArray.Count(); index++ ) - { - if ( iFillListArray[index]->List()->Selected() != ECmDeleted ) - { - iFillListArray[index]->List()->SetPriority( priority ); - priority++; // next list priority - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::compare() -// For sort. Sort is based on rule priority -// -------------------------------------------------------------------------- -// -TInt CMSFillRuleController::compare ( const CMSFillList& rule1, - const CMSFillList& rule2) - - { - LOG(_L("[MediaServant]\t CMSFillRuleController::compare")); - - TInt result = 0; - - if ( rule1.Priority() < rule2.Priority() ) - { - result = -1; - } - else if ( rule1.Priority() > rule2.Priority() ) - { - result = 1; - } - - return result; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::ChangePriority() -// Change priorities of rules -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::ChangePriority( TUint aTotalItem, - TUint aCurrentItem, - TInt aDirection ) - { - LOG(_L("[MediaServant]\t CMSFillRuleController::ChangePriority")); - - TLinearOrder key(CMSFillRuleController::compare); - - // up - if (aDirection == -1 && aCurrentItem) - { - // swap priotities of rules - iFillListArray[aCurrentItem]->List()->SetPriority(aCurrentItem-1); - iFillListArray[aCurrentItem-1]->List()->SetPriority(aCurrentItem); - - iFillListArray.Sort(key); - } - // down - else if ( aDirection == 1 && aCurrentItem < aTotalItem - 1 ) - { - // swap priotities of rules - iFillListArray[aCurrentItem]->List()->SetPriority(aCurrentItem+1); - iFillListArray[aCurrentItem+1]->List()->SetPriority(aCurrentItem); - - iFillListArray.Sort(key); - } - else - { - // Do nothing - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::UpdateArrayL() -// Resets old fill rule array and reads new rules from server -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::UpdateArrayL() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::UpdateArrayL")); - - // FILL RULES - delete iRuleContainer; - iRuleContainer = NULL; - iRuleContainer = iMSEngine->FillRulesL(); - - // Creates pointer array to rules so we can change rule order at UI - // Operations done trough pointer array affects original rules - // in RuleContainer - if ( iRuleContainer ) - { - iFillListArray.ResetAndDestroy(); - // Arrange rules by priority to pointer table - TInt rulecount = iRuleContainer->FillRuleCount(); - - for (TUint8 order = 0; order < rulecount; order++) - { - // search rule with desired priority - for (TInt index = 0; index < rulecount; index++) - { - - CCmFillRule* rule = iRuleContainer->FillRule(index); - TUint8 priority = rule->Priority(); - - if ( order == priority ) - { - // stop for loop - index = rulecount; - CMSFillList* list = - CMSFillList::NewLC( *iMSEngine, *rule ); - // add rule to array - iFillListArray.AppendL( list ); - CleanupStack::Pop( list ); - } - } - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::SaveRulesL() -// Sends fill rules to server -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::SaveRulesL() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::SaveRulesL")); - - iMSEngine->SetFillRulesL( iRuleContainer ); - } - - -// -------------------------------------------------------------------------- -// CMSFillRuleController::HasPriorityChangedL() -// Checks if list priorities has been changed -// -------------------------------------------------------------------------- -// -TBool CMSFillRuleController::HasPriorityChangedL() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::\ - HasPriorityChangedL")); - - TBool status( EFalse ); - - CCmFillRuleContainer* fillLists = iMSEngine->FillRulesL(); - CleanupStack::PushL( fillLists ); - TInt listCount = fillLists->FillRuleCount(); - TInt arrayCount = iFillListArray.Count(); - - if ( listCount == arrayCount ) - { - for ( TInt index = 0; index < listCount; index++ ) - { - CCmFillRule* origList = fillLists->FillRule(index); - TInt origPriority = origList->Priority(); - - // lists are in priority order in iFillListArray - CCmFillRule* modList = iFillListArray[ origPriority ]->List(); - - // if list names are same we have the same lists - if ( origList->Name().Compare( modList->Name() ) ) - { - status = ETrue; - index = listCount; // break loop - } - } - } - else - { - status = ETrue; - } - - CleanupStack::PopAndDestroy( fillLists ); - return status; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::HasSelectionsChanged() -// Checks if list activity has been changed -// -------------------------------------------------------------------------- -// -TBool CMSFillRuleController::HasSelectionsChanged( TCmFillRuleStatus aStatus ) - { - LOG(_L("[MediaServant]\t CMSFillRuleController::\ - HasSelectionsChanged")); - - TBool status( EFalse ); - - TInt listCount = iFillListArray.Count(); - - for ( TInt index = 0; index < listCount; index++ ) - { - if ( iFillListArray[ index ]->OriginalSelectionStatus() != - iFillListArray[ index ]->List()->Selected() && - iFillListArray[ index ]->OriginalSelectionStatus() != aStatus ) - { - // activity changed - status = ETrue; - index = listCount; - } - - } - return status; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleController::RestoreOriginalSelections() -// -------------------------------------------------------------------------- -// -void CMSFillRuleController::RestoreOriginalSelections() - { - LOG(_L("[MediaServant]\t CMSFillRuleController::\ - RestoreOriginalSelections")); - TInt listCount = iFillListArray.Count(); - - for ( TInt index = 0; index < listCount; index++ ) - { - iFillListArray[index]->List()->SetSelected( - iFillListArray[index]->OriginalSelectionStatus() ); - } - } - - - - - -/***************** CMSFillList class implementation **********************/ - - -// -------------------------------------------------------------------------- -// CMSFillList::NewL -// -------------------------------------------------------------------------- -// -CMSFillList* CMSFillList::NewL( CMSEngine& aMSEngine, CCmFillRule& aFillList ) - { - LOG(_L("[MediaServant]\t CMSFillList::NewL")); - - CMSFillList* self = CMSFillList::NewLC( aMSEngine, aFillList ); - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSFillList::NewLC -// -------------------------------------------------------------------------- -// -CMSFillList* CMSFillList::NewLC( CMSEngine& aMSEngine, - CCmFillRule& aFillList ) - { - LOG(_L("[MediaServant]\t CMSFillList::NewLC")); - - CMSFillList* self = new (ELeave) CMSFillList( aMSEngine, aFillList ); - - CleanupStack::PushL(self); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSFillList::ConstructL -// -------------------------------------------------------------------------- -// -void CMSFillList::ConstructL() - { - LOG(_L("[MediaServant]\t CMSFillList::ConstructL")); - - iListSize = iFillList->ListRealSizeInBytes(); - iItemCount = iFillList->ListRealCount(); - } -// -------------------------------------------------------------------------- -// CMSFillList::CMSFillList() -// -------------------------------------------------------------------------- -// -CMSFillList::CMSFillList( CMSEngine& aMSEngine, CCmFillRule& aFillList ) - { - LOG(_L("[MediaServant]\t CMSFillRuleController::CMSFillRuleController")); - iFillList = &aFillList; - iMSEngine = &aMSEngine; - - iSelected = iFillList->Selected(); - } - -// -------------------------------------------------------------------------- -// CMSFillList::~CMSFillList() -// -------------------------------------------------------------------------- -// -CMSFillList::~CMSFillList() - { - LOG(_L("[MediaServant]\t CMSFillList::~CMSFillList")); - } - -// -------------------------------------------------------------------------- -// CMSFillList::List() -// -------------------------------------------------------------------------- -// -CCmFillRule* CMSFillList::List() - { - LOG(_L("[MediaServant]\t CMSFillList::List")); - - return iFillList; - } - -// -------------------------------------------------------------------------- -// CMSFillList::List() -// -------------------------------------------------------------------------- -// -TUint32 CMSFillList::ListSize() - { - LOG(_L("[MediaServant]\t CMSFillList::ListSize")); - - return iListSize; - } - -// -------------------------------------------------------------------------- -// CMSFillList::List() -// -------------------------------------------------------------------------- -// -TUint32 CMSFillList::ItemCount() - { - LOG(_L("[MediaServant]\t CMSFillList::ItemCount")); - - return iItemCount; - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::Priority -// Return list priority -// -------------------------------------------------------------------------- -// -TInt CMSFillList::Priority() const - { - return iFillList->Priority(); - } - -// -------------------------------------------------------------------------- -// CMSFillContainer::Priority -// Return list priority -// -------------------------------------------------------------------------- -// -TCmFillRuleStatus CMSFillList::OriginalSelectionStatus() - { - return iSelected; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msfillruleeditlist.cpp --- a/homesync/contentmanager/mediaservant/src/msfillruleeditlist.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2460 +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: CMSFillRuleEditList class implementation -* -*/ - - -#include -#include -#include -#include -#include -#include -#include - -#include "cmsqlpropertycontainer.h" -#include "mserv.hlp.hrh" -#include "cmfillrule.h" -#include "cmfillrulecontainer.h" -#include "cmmediaserverfull.h" -#include "msappui.h" -#include "mediaservantuid.h" -#include "msengine.h" -#include "msconstants.h" -#include "msfillruleeditlist.h" -#include "msfillruleeditview.h" -#include "msruleamountsetting.h" // Amount -#include "msruleserverssetting.h" // Servers -#include "msrulemultiselectionsetting.h"// Artist, genre, album, track -#include "msrulefilesizesetting.h" // File size (min/max) -#include "mediaservant.hrh" -#include "msmetadatacollector.h" -#include "msdebug.h" -#include "msfillcontainer.h" -#include "msfillview.h" - -// CONSTANTS -_LIT( KSpace, " "); -const TInt KDateBufferLength = 20; - - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::NewL() -// Two phase constructor. -// -------------------------------------------------------------------------- -// -CMSFillRuleEditList* CMSFillRuleEditList::NewL( - CMSAppUi& aAppUi, CMSFillRuleEditView& aView ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::NewL")); - - CMSFillRuleEditList* self = CMSFillRuleEditList::NewLC( aAppUi, aView ); - CleanupStack::Pop( self ); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::NewLC() -// Two phase constructor. -// -------------------------------------------------------------------------- -// -CMSFillRuleEditList* CMSFillRuleEditList::NewLC( - CMSAppUi& aAppUi, CMSFillRuleEditView& aView ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::NewLC")); - - CMSFillRuleEditList* self = new ( ELeave ) CMSFillRuleEditList(); - CleanupStack::PushL( self ); - self->ConstructL( aAppUi, aView ); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::CMSFillRuleEditList() -// -------------------------------------------------------------------------- -// -CMSFillRuleEditList::CMSFillRuleEditList() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::CMSFillRuleEditList")); - - iDummyText.Copy(_L("")); - iMinFileSize = 0; - iMaxFileSize = 0; - iMinFileSizeSet = EMSAny; - iMaxFileSizeSet = EMSAny; - iFileSize = 0; - iFileSizeEnum = 0; - iTrackLengthEnum = 0; - iNewList = EFalse; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::~CMSFillRuleEditList() -// -------------------------------------------------------------------------- -// -CMSFillRuleEditList::~CMSFillRuleEditList() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::~CMSFillRuleEditList")); - - delete iMetadataCollector; - - if ( iServers ) - { - iServers->ResetAndDestroy(); - iServers->Close(); - delete iServers; - } - - if ( iServerArray ) - { - iServerArray->ResetAndDestroy(); - delete iServerArray; - } - - iVisibleRules.Close(); - - iArtistArray.Close(); - iAlbumArray.Close(); - iGenreArray.Close(); - iTrackArray.Close(); - iVideoTitleArray.Close(); - - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::ConstructL() -// Second phase constructor. -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::ConstructL( CMSAppUi& aAppUi, - CMSFillRuleEditView& aView ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::ConstructL")); - - iAppUi = &aAppUi; - iView = &aView; - - // Set engine observer - iAppUi->MSEngine()->SetObserver( this ); - - // read template - iRuleTemplate = iAppUi->ParameterAgent()->GetRuleTemplate(); - - // Edit existing list - if ( iRuleTemplate.templateType == EMSCmdEditRule ) - { - // get selected item index from previous screen - iSelectedList = iAppUi->ParameterAgent()->FillViewFocusIndex(); - - // get selected list - iRule =(*iAppUi-> - FillRuleController()->FillListArray())[iSelectedList]->List(); - // List media type - iMediaType = iRule->MediaType(); - - // set used template - iRuleTemplate.selectedTemplate = iRule->TemplateId(); - - ReadTemplateRulesL( iRuleTemplate.selectedTemplate ); - // Get values for rules - GetRuleValuesL(); - } - - else - { - iNewList = ETrue; - - // New fill list will be last one - set focus index to it - iSelectedList = - iAppUi->FillRuleController()->FillListArray()->Count(); - iAppUi->ParameterAgent()->SetFillViewFocusIndex( iSelectedList ); - - // Create new list - iRule = CCmFillRule::NewL(); - - // Read template rules and set default values - ReadTemplateRulesL( iRuleTemplate.selectedTemplate ); - - // Use template name as list name - iListName.Copy( iRuleTemplate.templateName ); - HBufC8* temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L( - iListName ); - CleanupStack::PushL( temp ); - iRule->SetNameL( *temp ); - CleanupStack::PopAndDestroy( temp ); - // List type is determined by given menu command - // MediaType is also set here - SetListType( iRuleTemplate.templateType ); - iRule->SetTemplateId( iRuleTemplate.selectedTemplate ); - - //Set rule selected by default - iRule->SetSelected( ECmSelected ); - - // Initialize fill rule status to ECmToBeFilled - // If rule is image rule, status is re-set - // according to used template - iRule->SetStatus( ECmToBeFilled ); - - InitializeValues(); - - // save new list - iAppUi->FillRuleController()->AddRuleL( iRule ); - - // Get list - iRule = (*iAppUi->FillRuleController()-> - FillListArray())[iSelectedList]->List(); - } - - // should filter the vedio array when construct first time, only selected item can be construct - if( iRule->MediaType() == ECmVideo ) - { - // reset track array - iTrackArray.Reset(); - // append the select video title in track array - TInt count = iVideoTitleArray.Count(); - if( count > 0 ) - { - for( TInt i=0; iFillRuleController()->SaveRulesL(); - PreprocessListL(); - } - else - { - CreateAndSetNaviPaneTextL(); - } - break; - } - case ECmAudio: - { - // construct item list - CAknSettingItemList::ConstructFromResourceL( - R_MS_AUDIO_FILL_RULES ); - break; - } - default: - { - break; - } - } - - if ( iMediaType == ECmVideo || iMediaType == ECmAudio ) - { - // Show 'reading data' text on navi pane - HBufC* naviText = StringLoader::LoadLC( - R_MS_WAIT_GETTING_DATA_TEXT ); - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SaveListValuesL -// Saves list values from visible setting items -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SaveListValuesL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveListValuesL")); - - CAknSettingItemArray* itemArray = SettingItemArray(); - for ( TInt index = 0; index < itemArray->Count(); index++ ) - { - CAknSettingItem* item = itemArray->At( index ); - if ( !item->IsHidden() ) - { - SaveValueL( item ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::PreprocessListL -// starts list preprocess and shows info on navi pane -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::PreprocessListL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::PreprocessListL")); - - iAppUi->MSEngine()->PreProcessFillListL( iRule->Name() ); - HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT ); - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SaveValueL -// Save values to rule container -// Only values from visible rules are stored -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SaveValueL( CAknSettingItem* aItem ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveValueL")); - - if ( !aItem->IsHidden() ) - { - switch ( aItem->Identifier() ) - { - case EMSListName: - { - // Name is always visible - set rule name - HBufC8* listName = - CnvUtfConverter::ConvertFromUnicodeToUtf8L( - SettingItemArray()->At(EMSListName)->SettingTextL() ); - CleanupStack::PushL( listName ); - iRule->SetNameL( *listName ); - CleanupStack::PopAndDestroy( listName ); - break; - } - case EMSShrinkImages: - { - // Set shrinking status for images - SetShrinkingStatus(); - break; - } - case EMSAmount: - { - // set amount of files - iRule->SetAmount( iAmount ); - // set limit type - iRule->SetLimitType( iLimitType ); - break; - } - case EMSStartingWith: - { - iRule->SetMethod( - static_cast (iStartWith) ); - break; - } - case EMSDateFrom: - { - DeleteRule( ECmDate, ECmGreater ); - - TInt ruleIndex = iRule->AddRuleL( ECmDate, - ECmGreater ); - HBufC8* str = HBufC8::NewL( KDateBufferLength ); - CleanupStack::PushL( str ); - str->Des().AppendNum(iDateFrom.Int64()); - iRule->AddRuleParamL( ruleIndex, *str ); - CleanupStack::PopAndDestroy( str ); - break; - } - case EMSDateUntil: - { - DeleteRule( ECmDate, ECmSmaller ); - - TInt ruleIndex = iRule->AddRuleL( ECmDate, - ECmSmaller ); - HBufC8* str = HBufC8::NewL( KDateBufferLength ); - CleanupStack::PushL( str ); - str->Des().AppendNum(iDateUntil.Int64()); - iRule->AddRuleParamL( ruleIndex, *str ); - CleanupStack::PopAndDestroy( str ); - - break; - } - case EMSServers: - { - HandleServerSelectionL(); - break; - } - case EMSFreeText: - { - DeleteRule( ECmFreeText ); - if ( iFreeText.Size() ) - { - TInt ruleIndex = iRule->AddRuleL( ECmFreeText, - ECmConsistOf ); - HBufC8* str = CnvUtfConverter::ConvertFromUnicodeToUtf8L( - iFreeText ); - CleanupStack::PushL( str ); - iRule->AddRuleParamL( ruleIndex, *str ); - CleanupStack::PopAndDestroy( str ); - } - break; - } - case EMSTitleName: - { - DeleteRule( ECmTitle ); - - if ( iVideoTitleArray.Count() > 0 ) - { - AddAdditionalRuleL( iVideoTitleArray, - ECmTitle, - ECmEquals ); - } - break; - } - case EMSMinFileSize: - { - DeleteRule( ECmFileSize, ECmGreater ); - if ( iMinFileSizeSet == EMSSetSize ) - { - AddAdditionalRuleL( ECmFileSize, - ECmGreater, - iMinFileSize*KMega ); - } - break; - } - case EMSMaxFileSize: - { - DeleteRule( ECmFileSize, ECmSmaller ); - if ( iMaxFileSizeSet == EMSSetSize ) - { - AddAdditionalRuleL( ECmFileSize, - ECmSmaller, - iMaxFileSize*KMega ); - } - break; - } - case EMSGenre: - { - DeleteRule( ECmGenre ); - - if ( iGenreArray.Count() > 0 ) - { - AddAdditionalRuleL( iGenreArray, - ECmGenre, - ECmEquals ); - } - break; - } - case EMSArtist: - { - DeleteRule( ECmArtist ); - - if ( iArtistArray.Count() > 0 ) - { - AddAdditionalRuleL( iArtistArray, - ECmArtist, - ECmEquals ); - } - break; - } - case EMSAlbum: - { - DeleteRule( ECmAlbum ); - - if ( iAlbumArray.Count() > 0 ) - { - AddAdditionalRuleL( iAlbumArray, - ECmAlbum, - ECmEquals ); - } - break; - } - case EMSTrack: - { - DeleteRule( ECmTitle ); - - if ( iTrackArray.Count() > 0 ) - { - AddAdditionalRuleL( iTrackArray, - ECmTitle, - ECmEquals ); - } - break; - } - case EMSTrackLength: - { - DeleteRule( ECmDuration ); - if ( iTrackLengthEnum ) - { - SaveTrackDurationL(); - } - break; - } - case EMSFileSize: - { - DeleteRule( ECmFileSize ); - if ( iFileSizeEnum ) - { - SaveTrackFileSizeL(); - } - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveValueL \ - no such rule")); - break; - } - } - } - } - -// -------------------------------------------------------------------------- -// CAknSettingItem* CMSFillRuleEditList::CreateSettingItemL(TInt aIdentifier) -// Takes care of creating actual setting items. -// -------------------------------------------------------------------------- -// -CAknSettingItem* CMSFillRuleEditList::CreateSettingItemL( TInt aIdentifier ) - { - CAknSettingItem* settingItem = NULL; - - // setting item is created according to aIdentifier - switch ( aIdentifier ) - { - case EMSListName: - { - settingItem = new (ELeave ) CMSTextSettingItem( - aIdentifier, - iListName ); - break; - } - case EMSShrinkImages: - { - settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem( - aIdentifier, - reinterpret_cast (iShrinkImages) ); - break; - } - - case EMSAmount: - { - settingItem = new (ELeave ) CMSRuleAmountSetting( - aIdentifier, - reinterpret_cast (iLimitType), - iAmount ); - break; - } - - case EMSStartingWith: - { - settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem( - aIdentifier, - iStartWith ); - break; - } - - case EMSDateFrom: - { - settingItem = new (ELeave ) CMSTimeOrDateSettingItem( - R_MS_FILL_RULE_DATE_FROM_SETTING_PAGE, - aIdentifier, - CAknTimeOrDateSettingItem::EDate, - iDateFrom ); - break; - } - - case EMSDateUntil: - { - settingItem = new (ELeave ) CMSTimeOrDateSettingItem( - R_MS_FILL_RULE_DATE_UNTIL_SETTING_PAGE, - aIdentifier, - CAknTimeOrDateSettingItem::EDate, - iDateUntil ); - break; - } - - case EMSServers: - { - settingItem = CMSRuleServersSetting::NewL( - aIdentifier, - *iServerArray, - iSettingText, - R_MS_VALUE_LIST_ANY_SOURCE_DEVICE); - break; - } - - case EMSFreeText: - { - settingItem = new (ELeave ) CMSTextSettingItem( - aIdentifier, - iFreeText ); - break; - } - case EMSTitleName: - { - settingItem = CMSRuleMultiselectionSetting::NewL( - aIdentifier, - R_MS_RULE_NAME_SETTING, - R_MS_VALUE_ANY_NAME, - R_MS_VALUE_LIST_ANY_NAME, - iMetadataCollector->Tracks(), - &iVideoTitleArray, - R_MS_RULE_TITLE_ITEM_TEXT, - iSettingText ); - break; - } - - case EMSMinFileSize: - { - settingItem = new (ELeave ) CMSRuleFileSizeSetting( - aIdentifier, - EMSMinFileSize, - iMinFileSizeSet, - iMinFileSize ); - break; - } - - case EMSMaxFileSize: - { - settingItem = new (ELeave ) CMSRuleFileSizeSetting( - aIdentifier, - EMSMaxFileSize, - iMaxFileSizeSet, - iMaxFileSize ); - break; - } - - case EMSGenre: - { - - - settingItem = CMSRuleMultiselectionSetting::NewL( - aIdentifier, - R_MS_RULE_GENRE_SETTING, - R_MS_VALUE_ANY_GENRE, - R_MS_VALUE_LIST_ANY_GENRE, - iMetadataCollector->Genres(), - &iGenreArray, - R_MS_RULE_GENRE_ITEM_TEXT, - iSettingText ); - break; - } - - case EMSArtist: - { - settingItem = CMSRuleMultiselectionSetting::NewL( - aIdentifier, - R_MS_RULE_ARTIST_SETTING, - R_MS_VALUE_ANY_ARTIST, - R_MS_VALUE_LIST_ANY_ARTIST, - iMetadataCollector->Artists(), - &iArtistArray, - R_MS_RULE_ARTIST_ITEM_TEXT, - iSettingText ); - break; - } - - case EMSAlbum: - { - settingItem = CMSRuleMultiselectionSetting::NewL( - aIdentifier, - R_MS_RULE_ALBUM_SETTING, - R_MS_VALUE_ANY_ALBUM, - R_MS_VALUE_LIST_ANY_ALBUM, - iMetadataCollector->Albums(), - &iAlbumArray, - R_MS_RULE_ALBUM_ITEM_TEXT, - iSettingText ); - break; - } - - case EMSTrack: - { - settingItem = CMSRuleMultiselectionSetting::NewL( - aIdentifier, - R_MS_RULE_TRACK_SETTING, - R_MS_VALUE_ANY_TRACK, - R_MS_VALUE_LIST_ANY_TRACK, - iMetadataCollector->Tracks(), - &iTrackArray, - R_MS_RULE_TRACK_ITEM_TEXT, - iSettingText ); - break; - } - - case EMSTrackLength: - { - settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem( - aIdentifier, - iTrackLengthEnum ); - break; - } - - case EMSFileSize: - { - settingItem = new (ELeave ) CMSEnumeratedTextPopupSettingItem( - aIdentifier, - iFileSizeEnum ); - break; - } - - case EMSAddMoreRules: - { - settingItem = new (ELeave ) CMSTextSettingItem( - aIdentifier, - iDummyText ); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::CreateSettingItemL\ - item not found")); - break; - } - } - return settingItem; - } - - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::OpenSelectedListboxItemL -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::OpenSelectedListboxItemL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - OpenSelectedListboxItemL")); - - HandleListBoxEventL( ListBox(), EEventEnterKeyPressed ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::HandleListBoxEventL() -// Handles listbox events -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::HandleListBoxEventL ( CEikListBox *aListBox, - TListBoxEvent aEventType) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::HandleListBoxEventL")); - - CAknSettingItemArray* itemArray = SettingItemArray(); - TInt currentItem = ListBox()->CurrentItemIndex(); - TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem); - CAknSettingItem* item= (*itemArray)[realIndex]; - - // Event type for non-touch UI - if ( aEventType == EEventEnterKeyPressed ) - { - if ( item->Identifier() == EMSAddMoreRules ) - { - AddFillRuleL(); - } - else - { - CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType ); - } - } - // Event type for touch UI - else if ( aEventType == EEventItemClicked ) - { - // show add fill rule query if last item "Add more rules" selected - if ( item->Identifier() == EMSAddMoreRules && - iPreviousRuleIdentifier == EMSAddMoreRules ) - { - AddFillRuleL(); - } - else - { - CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType ); - } - iPreviousRuleIdentifier = item->Identifier(); - // values need to be stored - StoreSettingsL(); - } - else if ( item->Identifier() != EMSAddMoreRules ) - { - CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType ); - } - - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::EditItemL() -// Called by framework when item is opened -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::EditItemL (TInt aIndex, TBool aCalledFromMenu) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::EditItemL")); - - // cancel ongoing operation - iView->CancelAsyncOperation( iAppUi ); - iState = EMSIdle; - - CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); - - // get the item information after update - CAknSettingItemArray* itemArray = SettingItemArray(); - TInt currentItem = ListBox()->CurrentItemIndex(); - TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem); - CAknSettingItem* item= (*itemArray)[realIndex]; - - // check if list name is modified - if ( item->Identifier() == EMSListName ) - { - HandleListNameL( item ); - } - - if ( CheckSettingPageAcceptance( item ) ) - { - // store new value - StoreSettingsL(); - // Save value to rule - SaveValueL( item ); - // save rule and process it - SaveAndPreprocesslistL( item ); - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::HandleListNameL -// Handles edit list name -case -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::HandleListNameL( CAknSettingItem* aItem ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::HandleListNameL")); - - CMSTextSettingItem* settingItem = - static_cast( aItem ); - - TPtr searchStr = settingItem->Text(); - - // Deletes leading and trailing whitespace characters - searchStr.Trim(); - - HBufC* originalSearchStr = - CnvUtfConverter::ConvertToUnicodeFromUtf8L( iRule->Name() ); - CleanupStack::PushL( originalSearchStr ); - - // whether they are same or not - if ( *originalSearchStr != searchStr ) - { - // if there are same names in other fill rules - TBool isSame = CheckSameNameL( searchStr ); - - if ( isSame ) - { - TInt postfix = 0; - TPtr itemText = searchStr; - - // decide which number is added to the end of the name - for ( ; ; ++postfix ) - { - HBufC* sameStr = HBufC::NewL( KMaxFileName ); - CleanupStack::PushL( sameStr ); - sameStr->Des().Append( itemText ); - - // if the name does not add number to the end is unique so keep the original name - if ( 0 != postfix) - { - sameStr->Des().Append( KSpace ); - sameStr->Des().AppendNum( postfix ); - // do number conversion - TPtr ptr = sameStr->Des(); - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( ptr ); - } - // must modify name with append a number - if ( !CheckSameNameL( *sameStr ) || ( *sameStr == *originalSearchStr ) ) - { - CleanupStack::PopAndDestroy( sameStr ); - break; - } - CleanupStack::PopAndDestroy( sameStr ); - } - - // do not need append a number - if ( 0 != postfix) - { - itemText.Append( KSpace ); - itemText.AppendNum( postfix ); - - // do number conversion - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( itemText ); - - iListName.Copy( itemText ); - settingItem->LoadL(); - - aItem->UpdateListBoxTextL(); - } - } - } - else - { - settingItem->LoadL(); - } - CleanupStack::PopAndDestroy( originalSearchStr ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::CheckSameNameL -// check the name is same or not -// -------------------------------------------------------------------------- -// -TBool CMSFillRuleEditList::CheckSameNameL( const TDesC& aName ) const - { - RPointerArray* iFillListArray = - iAppUi->FillRuleController()->FillListArray(); - - // fill rule name array is not empty - if ( iFillListArray->Count() > 0 ) - { - for ( TInt index = 0; index < iFillListArray->Count(); ++index ) - { - // Get fill rule name and put it to the listbox - CCmFillRule* rule = (*iFillListArray)[index]->List(); - HBufC* listName = - CnvUtfConverter::ConvertToUnicodeFromUtf8L( rule->Name() ); - CleanupStack::PushL( listName ); - // whether there is a same name fill rule - if ( aName == *listName ) - { - CleanupStack::PopAndDestroy( listName ); - return ETrue; - } - CleanupStack::PopAndDestroy( listName ); - } - } - return EFalse; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SaveAndPreprocesslistL -// Saves modified list and preprocesses it -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SaveAndPreprocesslistL( CAknSettingItem* aItem ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - SaveAndPreprocesslistL")); - - // save rules - iAppUi->FillRuleController()->SaveRulesL(); - // we'll lost iRule after update... - iAppUi->FillRuleController()->UpdateArrayL(); - // ...so get it again - iRule = (*iAppUi->FillRuleController()-> - FillListArray())[iSelectedList]->List(); - - // if multiselectionitem is edited start data reading after preprocess - if ( aItem->Identifier() == EMSGenre || - aItem->Identifier() == EMSArtist || - aItem->Identifier() == EMSAlbum || - aItem->Identifier() == EMSTrack|| - aItem->Identifier() == EMSTitleName) - { - iState = EMSFetchMetadata; - } - - // if other item than name is changed preprocessing is needed - if ( aItem->Identifier() != EMSListName ) - { - PreprocessListL(); - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::ActivateL -// Asks setting page selection status from setting item -// -------------------------------------------------------------------------- -// -TBool CMSFillRuleEditList::CheckSettingPageAcceptance( - CAknSettingItem* aItem ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - CheckSettingPageAcceptance")); - - TBool status( EFalse ); - - switch ( aItem->Identifier() ) - { - case EMSShrinkImages: - // fall through - case EMSAmount: - // fall through - case EMSStartingWith: - // fall through - case EMSMinFileSize: - // fall through - case EMSMaxFileSize: - // fall through - case EMSTrackLength: - // fall through - case EMSFileSize: - { - CMSEnumeratedTextPopupSettingItem* item = - static_cast(aItem); - status = item->SettingAccepted(); - break; - } - case EMSListName: - // fall through - case EMSServers: - // fall through - case EMSFreeText: - // fall through - case EMSTitleName: - // fall through - case EMSGenre: - // fall through - case EMSArtist: - // fall through - case EMSAlbum: - // fall through - case EMSTrack: - - { - CMSTextSettingItem* item = - static_cast(aItem); - status = item->SettingAccepted(); - break; - } - - case EMSDateFrom: - // fall through - case EMSDateUntil: - { - CMSTimeOrDateSettingItem* item = - static_cast(aItem); - status = item->SettingAccepted(); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - CheckSettingPageAcceptance no such item")); - break; - } - } - - return status; - } -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::ActivateL -// Activates setting list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::ActivateL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::ActivateL")); - - // hide all items by default - // index starts from '1' because list name is always visible - // index stops to count-1 because "add more rules" is always visible - for (TInt index = 1 ;index < SettingItemArray()->Count()-1; index++) - { - SettingItemArray()->At( index )->SetHidden(ETrue); - } - - CAknSettingItemArray* itemArray = SettingItemArray(); - // set template rules visible - for (TInt idx = 0; idx < iVisibleRules.Count(); idx++) - { - CAknSettingItem* item = SearchItemById( iVisibleRules[idx] ); - if ( item ) - { - item->SetHidden( EFalse); - } - } - // Show also additional rules if user has changed the default value - DisplayModifiedAdditionalRules(); - // visibility of some items may have changed - HandleChangeInItemArrayOrVisibilityL(); - - CAknSettingItemList::ActivateL(); - } - -// -------------------------------------------------------------------------- -// void CMSFillRuleEditList::ReadTemplateRulesL -// reads fill rule name -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::ReadTemplateRulesL( TInt aTemplate ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadTemplateRulesL")); - - TResourceReader rsReader; - - switch ( aTemplate ) - { - case EMSDefaultImageList: - { - iCoeEnv->CreateResourceReaderLC(rsReader, - R_MS_DEFAULT_IMAGE_LIST_RULES); - break; - } - case EMSDefaultVideoList: - { - iCoeEnv->CreateResourceReaderLC(rsReader, - R_MS_DEFAULT_VIDEO_LIST_RULES); - break; - } - case EMSDefaultMusicList: - { - iCoeEnv->CreateResourceReaderLC(rsReader, - R_MS_DEFAULT_MUSIC_LIST_RULES); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadTemplateRulesL\ - rule not found")); - break; - } - } - - // get rule count of the template - TInt ruleCount( rsReader.ReadInt16() ); - - // List name is always visible -> index starts from EMSListName+1 - for ( TInt index = EMSListName+1; index <= ruleCount; index++ ) - { - // get rule ID - TMSFillEditItems ruleId = - static_cast(rsReader.ReadInt16()); - // get value - TInt value = rsReader.ReadInt16(); - // get addional value - TInt addValue = rsReader.ReadInt16(); - if ( ruleId == EMSAmount ) - { - iLimitType = static_cast (addValue); - } - // Remember IDs of template rules - rules will be set - // visible later - iVisibleRules.AppendL( ruleId ); - - // set value of rule - SetDefaultValue( ruleId, value ); - } - - CleanupStack::PopAndDestroy();//reader - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SetDefaultValues -// Sets default value defined by template -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SetDefaultValue( TInt aId, TInt aValue ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetDefaultValue")); - - switch ( aId ) - { - case EMSShrinkImages: - { - iShrinkImages = static_cast (aValue); - break; - } - case EMSAmount: - { - iAmount = aValue; - break; - } - case EMSStartingWith: - { - iStartWith = aValue; - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - SetDefaultValues item not found")); - } - } - } -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::AddFillRuleL -// Sets rule visibility -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::AddFillRuleL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::AddFillRuleL")); - - TResourceReader reader; - - switch ( iMediaType ) - { - case ECmImage: - { - // read image templates - iCoeEnv->CreateResourceReaderLC( reader, R_MS_IMAGE_RULE_LIST ); - break; - } - case ECmVideo: - { - // read video templates - iCoeEnv->CreateResourceReaderLC( reader, R_MS_VIDEO_RULE_LIST ); - break; - } - case ECmAudio: - { - // read music templates - iCoeEnv->CreateResourceReaderLC( reader, R_MS_MUSIC_RULE_LIST ); - break; - } - default: - { - // command not found - return; - } - } - - // read rule count - TInt ruleCount( reader.ReadInt16() ); - - CDesCArray* ruleNames = new ( ELeave ) CDesCArrayFlat( ruleCount ); - CleanupStack::PushL( ruleNames ); - - // array for template ID's - RArray indexArray; - - // fill name array - for ( TInt index = 0; index < ruleCount; index++ ) - { - // read rule ID - TMSFillEditItems value = - static_cast( reader.ReadInt16() ); - // read rule name - TPtrC text = reader.ReadTPtrC(); - - // add only hidden items to the list - if ( SearchItemById( value )->IsHidden() ) - { - indexArray.AppendL( value ); - ruleNames->AppendL( text ); - } - } - - TInt selectedRule( 0 ); - - if ( iView->ShowTemplateQueryL( R_MSERV_TEMPLATE_QUERY, - R_MS_ADD_RULE_QUERY_HEADING, - ruleNames, - selectedRule ) ) - { - // search item - for ( TInt idx = 0; idx < SettingItemArray()->Count(); idx++ ) - { - CAknSettingItem* item = SettingItemArray()->At( idx ); - if ( item->Identifier() == indexArray[selectedRule] ) - { - // Show confirmation query for "From" and for "Until" - if ( item->Identifier() == EMSDateFrom || - item->Identifier() == EMSDateUntil ) - { - if ( iView->ShowQueryL( R_MSERV_VIDEO_RULE_QUERY ) ) - { - // set item visible - item->SetHidden( EFalse ); - } - } - else - { - item->SetHidden( EFalse ); - } - } - } - HandleChangeInItemArrayOrVisibilityL(); - } - indexArray.Close(); - CleanupStack::PopAndDestroy( ruleNames ); - CleanupStack::PopAndDestroy(); // resource stuff - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SetListType -// Sets list type based on given command -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SetListType( TInt aType ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetListType")); - - switch ( aType ) - { - case EMSCmdNewImageList: - { - iRule->SetMediaType( ECmImage ); - iMediaType = ECmImage; - break; - } - case EMSCmdNewVideoList: - { - iRule->SetMediaType( ECmVideo ); - iMediaType = ECmVideo; - break; - } - case EMSCmdNewMusicList: - { - iRule->SetMediaType( ECmAudio ); - iMediaType = ECmAudio; - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetListType \ - type not set")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::GetRuleValuesL -// Loads rule values for the list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::GetRuleValuesL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::GetRuleValuesL")); - - HBufC* listName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - iRule->Name() ); - CleanupStack::PushL( listName ); - iListName.Copy( *listName ); - CleanupStack::PopAndDestroy( listName ); - - // get limit type - iLimitType = iRule->LimitType(); - - // get amount - iAmount = iRule->Amount(); - - if ( iRule->Status() == ECmToBeShrinked ) - { - iShrinkImages = EMSShrinkScreenSize; - - } - else - { - iShrinkImages = EMSShrinkingOff; - } - - // get start with - iStartWith = iRule->Method(); - - InitializeValues(); - - // Read additional rules - TInt ruleCount = iRule->RuleCount(); - // Cycle trough all rules - for ( TInt ruleIndex = 0; ruleIndex < ruleCount; ruleIndex++ ) - { - TCmMetadataField metaData; - TCmOperatorType operatorType; - TInt paramCount(0); - - iRule->RuleL( ruleIndex, &metaData, &operatorType, ¶mCount ); - - - // Cycle trough all params - for ( TInt paramIndex = 0; paramIndex < paramCount; paramIndex++ ) - { - TPtrC8 strParam; - iRule->RuleParamL( ruleIndex, paramIndex, &strParam ); - - // read index value - TInt ruleParam( 0 ); - iRule->RuleParamL( ruleIndex, paramIndex, ruleParam ); - - switch ( metaData ) - { - case ECmArtist: - { - iArtistArray.AppendL( ruleParam ); - break; - } - case ECmAlbum: - { - iAlbumArray.AppendL( ruleParam ); - break; - } - case ECmGenre: - { - iGenreArray.AppendL( ruleParam ); - break; - } - case ECmTitle: - { - if ( iMediaType == ECmAudio ) - { - iTrackArray.AppendL( ruleParam ); - } - else // video - { - iVideoTitleArray.AppendL( ruleParam ); - } - - break; - } - case ECmDuration: - { - TLex8 lex( strParam ); - if ( operatorType == ECmGreater ) - { - lex.Val( iMinTrackLength ); - } - else if ( operatorType == ECmSmaller ) - { - lex.Val( iMaxTrackLength ); - } - break; - } - case ECmDate: - { - TInt64 value; - TLex8 lex(strParam); - lex.Val(value); - - if ( operatorType == ECmGreater ) - { - iDateFrom = TTime( value ); - } - if ( operatorType == ECmSmaller ) - { - iDateUntil = TTime( value ); - } - break; - } - case ECmFileSize: - { - TLex8 lex( strParam ); - if ( operatorType == ECmGreater ) - { - lex.Val( iMinFileSize ); - iMinFileSize /= KMega; - // not needed in audio case - iMinFileSizeSet = EMSSetSize; - } - else if ( operatorType == ECmSmaller ) - { - lex.Val( iMaxFileSize ); - iMaxFileSize /= KMega; - // not needed in audio case - iMaxFileSizeSet = EMSSetSize; - } - break; - } - case ECmBitrate: - { - break; - } - case ECmResolution: - { - break; - } - case ECmFreeText: - { - HBufC* listName = - CnvUtfConverter::ConvertToUnicodeFromUtf8L( - strParam ); - CleanupStack::PushL( listName ); - iFreeText.Copy( *listName ); - CleanupStack::PopAndDestroy( listName ); - } - default: - { - break; - } - } - } - } - - if ( iMediaType == ECmAudio ) - { - SetAudioFileSizeSelection(); - SetAudioFileDurationSelection(); - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::InitializeValues -// Initializes values of rules -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::InitializeValues() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::InitializeValues")); - - // set date - iDateFrom.Set(KDefaultFromDate); - // set date - iDateUntil.HomeTime(); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::DeleteRule -// Deletes rule from the list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::DeleteRule( TCmMetadataField aField ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::DeleteRule")); - - iRule->DeleteRule( aField ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::DeleteRule -// Deletes rule from the list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::DeleteRule( TCmMetadataField aField, - TCmOperatorType aType ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::DeleteRule")); - - iRule->DeleteRule( aField, aType ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::AddAdditionalRuleL -// Adds additional rules to the list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::AddAdditionalRuleL( RArray& aArray, - TCmMetadataField aField, - TCmOperatorType aOperator ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::AddAdditionalRuleL")); - - TInt ruleIndex = iRule->AddRuleL( aField, aOperator ); - for ( TInt idx = 0; idx < aArray.Count(); idx++) - { - iRule->AddRuleParamL( ruleIndex, aArray[ idx ] ); - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::AppendItemToListL -// Appends item to the list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::AppendItemToListL( RArray* aArray, - TInt aParam ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::AppendItemToListL")); - - aArray->AppendL( aParam ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::AddAdditionalRuleL -// sets numeric type rule -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::AddAdditionalRuleL( TCmMetadataField aMetadataField, - TCmOperatorType aOperator, - TInt aValue ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::AddAdditionalRuleL")); - - TInt ruleIndex = iRule->AddRuleL( aMetadataField, aOperator ); - HBufC8* str = HBufC8::NewLC( 10 ); - str->Des().Format(_L8("%d"), aValue ); - iRule->AddRuleParamL( ruleIndex, *str ); - CleanupStack::PopAndDestroy( str ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SaveTrackFileSizeL -// Saves track file size -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SaveTrackFileSizeL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveTrackFileSizeL")); - - switch ( iFileSizeEnum ) - { - case EMSFileSizeLess_1_mb: - { - AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_1_MB ); - break; - } - case EMSFileSize_15_mb: - { - AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_1_MB ); - AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_5_MB ); - break; - } - case EMSFileSize_510_mb: - { - AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_5_MB ); - AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_10_MB ); - break; - } - case EMSFileSize_1050_mb: - { - AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_10_MB ); - AddAdditionalRuleL( ECmFileSize, ECmSmaller, KMSSize_50_MB ); - break; - } - case EMSFileSizeMore_10: - { - AddAdditionalRuleL( ECmFileSize, ECmGreater, KMSSize_50_MB ); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - SetAudioFileSizeSelection enum not found")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SetAudioFileSizeSelection -// set selection for audio file size -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SetAudioFileSizeSelection() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - SetAudioFileSizeSelection")); - - if ( ( KMega * iMinFileSize ) == KMSSize_0_MB && - ( KMega * iMaxFileSize ) == KMSSize_1_MB ) - { - iFileSizeEnum = EMSFileSizeLess_1_mb; - } - else if ( ( KMega * iMinFileSize ) == KMSSize_1_MB && - ( KMega * iMaxFileSize ) == KMSSize_5_MB ) - { - iFileSizeEnum = EMSFileSize_15_mb; - } - else if ( ( KMega * iMinFileSize ) == KMSSize_5_MB && - ( KMega * iMaxFileSize ) == KMSSize_10_MB ) - { - iFileSizeEnum = EMSFileSize_510_mb; - } - else if ( ( KMega * iMinFileSize ) == KMSSize_10_MB && - ( KMega * iMaxFileSize ) == KMSSize_50_MB ) - { - iFileSizeEnum = EMSFileSize_1050_mb; - } - else if ( ( KMega * iMinFileSize ) == KMSSize_50_MB && - ( KMega * iMaxFileSize ) == KMSSize_0_MB ) - { - iFileSizeEnum = EMSFileSizeMore_10; - } - else - { - iFileSizeEnum = EMSFileSizeAny; - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SaveTrackDurationL -// Saves track duration -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SaveTrackDurationL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveTrackDurationL")); - - switch ( iTrackLengthEnum) - { - case EMSTrackLenLess_1: - { - AddAdditionalRuleL( ECmDuration, ECmSmaller, - KMSTrackLength_1_min ); - break; - } - case EMSTrackLen_16: - { - AddAdditionalRuleL( ECmDuration, ECmGreater, - KMSTrackLength_1_min ); - AddAdditionalRuleL( ECmDuration, ECmSmaller, - KMSTrackLength_6_min ); - break; - } - case EMSTrackLen_68: - { - AddAdditionalRuleL( ECmDuration, ECmGreater, - KMSTrackLength_6_min ); - AddAdditionalRuleL( ECmDuration, ECmSmaller, - KMSTrackLength_8_min ); - break; - } - case EMSTrackLen_830: - { - AddAdditionalRuleL( ECmDuration, ECmGreater, - KMSTrackLength_8_min ); - AddAdditionalRuleL( ECmDuration, ECmSmaller, - KMSTrackLength_30_min ); - break; - } - case EMSTrackLenMore_4: - { - AddAdditionalRuleL( ECmDuration, ECmGreater, - KMSTrackLength_30_min ); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SaveTrackDurationL\ - enum not found")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SetAudioFileDurationSelection -// set selection for audio file duration -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SetAudioFileDurationSelection() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - SetAudioFileDurationSelection")); - - if ( iMinTrackLength == KMSTrackLength_0_min && - iMaxTrackLength == KMSTrackLength_1_min ) - { - iTrackLengthEnum = EMSTrackLenLess_1; - } - else if ( iMinTrackLength == KMSTrackLength_1_min && - iMaxTrackLength == KMSTrackLength_6_min ) - { - iTrackLengthEnum = EMSTrackLen_16; - } - else if ( iMinTrackLength == KMSTrackLength_6_min && - iMaxTrackLength == KMSTrackLength_8_min ) - { - iTrackLengthEnum = EMSTrackLen_68; - } - else if ( iMinTrackLength == KMSTrackLength_8_min && - iMaxTrackLength == KMSTrackLength_30_min ) - { - iTrackLengthEnum = EMSTrackLen_830; - } - else if ( iMinTrackLength == KMSTrackLength_30_min && - iMaxTrackLength == KMSTrackLength_0_min ) - { - iTrackLengthEnum = EMSTrackLenMore_4; - } - else - { - iTrackLengthEnum = EMSTrackLenAny; - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::DisplayModifiedAdditionalRules -// Displays additional rule if user has set value on it. -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::DisplayModifiedAdditionalRules() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - DisplayModifiedAdditionalRules")); - - CAknSettingItemArray* itemArray = SettingItemArray(); - - // loop trough rules - for ( TInt index = 0; index < itemArray->Count(); index++ ) - { - CAknSettingItem* item= itemArray->At( index ); - if ( item->IsHidden() ) - { - switch ( item->Identifier() ) - { - case EMSFreeText: - { - item->SetSettingPageFlags( - CAknTextSettingPage::EZeroLengthAllowed ); - if ( iFreeText.Size() ) - { - item->SetHidden( EFalse ); - } - break; - } - case EMSServers: - { - if ( iRule->MediaServerCount() ) - { - item->SetHidden( EFalse ); - } - break; - } - case EMSDateFrom: - { - if ( iDateFrom != TTime( KDefaultFromDate ) ) - { - item->SetHidden( EFalse ); - } - break; - } - case EMSDateUntil: - { - TTime currentDate; - currentDate.HomeTime(); - - if ( iDateUntil.DateTime().Day() != currentDate.DateTime().Day() || - iDateUntil.DateTime().Month() != currentDate.DateTime().Month() || - iDateUntil.DateTime().Year() != currentDate.DateTime().Year() ) - { - item->SetHidden( EFalse ); - } - break; - } - case EMSTrackLength: - { - if ( iTrackLengthEnum ) - { - item->SetHidden( EFalse ); - } - break; - } - case EMSFileSize: - { - if ( iFileSizeEnum ) - { - item->SetHidden( EFalse ); - } - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - SetAudioFileSizeSelection item not found")); - break; - } - } - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SearchItemById -// Searches item from the itemarray by given ID -// -------------------------------------------------------------------------- -// -CAknSettingItem* CMSFillRuleEditList::SearchItemById( TMSFillEditItems aId ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SearchItemById")); - - CAknSettingItem* item = NULL; - CAknSettingItemArray* itemArray = SettingItemArray(); - - for ( TInt index = 0; index < itemArray->Count(); index++ ) - { - if ( itemArray->At( index )->Identifier() == aId ) - { - item = itemArray->At( index ); - index = itemArray->Count(); // break out from the loop - } - } - return item; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SetShrinkingStatus -// Sets shrinking status to fill list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SetShrinkingStatus() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::SetShrinkingStatus")); - - switch ( iShrinkImages ) - { - case EMSShrinkScreenSize: - { - iRule->SetStatus( ECmToBeShrinked ); - break; - } - case EMSShrinkingOff: - { - iRule->SetStatus( ECmToBeFilled ); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - SetShrinkingStatus shrink status not found")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::ReadyL() -// engine observer callback -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::ReadyL( TCmService aService, TInt /*aError*/ ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadyL")); - - switch ( aService ) - { - case ECmServicePreProcessingFilllist: - { - // we'll lost iRule after update... - iAppUi->FillRuleController()->UpdateArrayL(); - // ...so get it again - iRule = (*iAppUi->FillRuleController()-> - FillListArray())[iSelectedList]->List(); - // show file info - CreateAndSetNaviPaneTextL(); - - if ( iState == EMSFetchMetadata ) - { - if( iRule->MediaType() == ECmVideo ) - { - // reset track array - iTrackArray.Reset(); - // append the select video title in track array - TInt count = iVideoTitleArray.Count(); - if( count > 0 ) - { - for( TInt i=0; iGetFilteredMetadataL(); - - // Show 'reading data' text on navi pane - HBufC* naviText = StringLoader::LoadLC( - R_MS_WAIT_GETTING_DATA_TEXT ); - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - - } - iState = EMSIdle; - break; - } - case ECmServiceFill: - { - UpdateSettingItemsL(); - if ( iNewList ) - { - SaveListValuesL(); - iAppUi->FillRuleController()->SaveRulesL(); - PreprocessListL(); - } - else - { - // show item counts - CreateAndSetNaviPaneTextL(); - } - - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::ReadyL \ - service not found")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::UpdateSettingItemsL() -// updates items in multiselection settings -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::UpdateSettingItemsL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::UpdateSettingItemsL")); - - // update setting item text - CAknSettingItem* item = NULL; - if ( iMediaType == ECmVideo ) - { - item = SearchItemById( EMSTitleName ); - } - else - { - item = SearchItemById( EMSTrack ); - } - - CMSRuleMultiselectionSetting* settingItem = - static_cast (item); - if ( item ) - { - settingItem->CreateItemListL(); - //DrawDeferred(); - } - - if ( iMediaType == ECmAudio ) - { - // update setting item text - item = SearchItemById( EMSArtist ); - settingItem = - static_cast (item); - if ( item ) - { - settingItem->CreateItemListL(); - //DrawDeferred(); - } - - // update setting item text - item = SearchItemById( EMSGenre ); - settingItem = static_cast (item); - if ( item ) - { - settingItem->CreateItemListL(); - //DrawDeferred(); - } - // update setting item text - item = SearchItemById( EMSAlbum ); - settingItem = static_cast (item); - if ( item ) - { - settingItem->CreateItemListL(); - } - } - DrawDeferred(); - } - -// Sets navi pane text -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::CreateAndSetNaviPaneTextL() -// Sets navi pane text -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::CreateAndSetNaviPaneTextL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - CreateAndSetNaviPaneTextL")); - - RPointerArray* fillListArray = - iAppUi->FillRuleController()->FillListArray(); - - // Set navi pane text - // magic: only two numbers - CArrayFix* infoArray = new ( ELeave ) CArrayFixFlat(2); - CleanupStack::PushL( infoArray ); - - TReal size( 0 ); - Math::Round( size, - TReal((*fillListArray)[iSelectedList]->ListSize()) / KMega, - 0 ); - TUint32 count = (*fillListArray)[iSelectedList]->ItemCount(); - - HBufC* naviText = NULL; - - switch ( count ) - { - case 0: - { - naviText = StringLoader::LoadLC( - R_MS_RULE_NAVI_0_ITEMS, size ); - break; - } - case 1: - { - naviText = StringLoader::LoadLC( - R_MS_RULE_NAVI_1_ITEM, size ); - break; - } - default: - { - infoArray->AppendL( size ); - infoArray->AppendL( count ); - naviText = StringLoader::LoadLC( - R_MS_RULE_NAVI_MANY_ITEMS, *infoArray ); - break; - } - } - - // do number conversion - TPtr ptr = naviText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - CleanupStack::PopAndDestroy( infoArray ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::RemoveCurrentRule -// Hides current rule -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::RemoveCurrentRuleL() - { - LOG( _L( "[MediaServant]\t CMSFillRuleEditList::RemoveCurrentRuleL" ) ); - - CAknSettingItemArray* itemArray = SettingItemArray(); - - TInt currentItem = ListBox()->CurrentItemIndex(); - TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem); - - CAknSettingItem* item= (*itemArray)[realIndex]; - - // free text must be deleted here because user can't enter empty text - switch ( item->Identifier() ) - { - case EMSFreeText: - { - DeleteRule( ECmFreeText ); - iFreeText.Zero(); - item->LoadL(); - break; - } - case EMSServers: - { - DeleteAllServersFromRuleL(); - break; - } - case EMSDateFrom: - { - DeleteRule( ECmDate ); - iDateFrom.Set( KDefaultFromDate ); - break; - } - case EMSDateUntil: - { - DeleteRule( ECmDate ); - iDateUntil.HomeTime(); - break; - } - case EMSTrackLength: - { - DeleteRule( ECmDuration ); - break; - } - case EMSFileSize: - { - DeleteRule( ECmFileSize ); - break; - } - default: - { - LOG( _L( "[MediaServant]\t CMSFillRuleEditList::\ - RemoveCurrentRuleL no such item" ) ); - break; - } - } - - // Menu command is shown only hidden items - item->SetHidden( ETrue ); - // visibility changed - HandleChangeInItemArrayOrVisibilityL(); - // cancel ongoing operation - iView->CancelAsyncOperation( iAppUi ); - // set idle state - iState = EMSIdle; - // update list info - SaveAndPreprocesslistL( item ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::IsCurrentRuleAdditional -// Tests if current rule is additional -// -------------------------------------------------------------------------- -// -TBool CMSFillRuleEditList::IsCurrentRuleAdditional() - { - LOG( _L( "[MediaServant]\t CMSFillRuleEditList::\ - IsCurrentRuleAdditional" ) ); - - TBool isAdditional = EFalse; - - TInt currentItem = ListBox()->CurrentItemIndex(); - - CAknSettingItemArray* itemArray = SettingItemArray(); - TInt realIndex = itemArray->ItemIndexFromVisibleIndex(currentItem); - CAknSettingItem* item= (*itemArray)[realIndex]; - - TInt id = item->Identifier(); - - if ( id == EMSServers || - id == EMSFreeText || - id == EMSTrackLength || - id == EMSFileSize ) - { - isAdditional = ETrue; - } - // From and Until are additional rules in Video list - else if ( iMediaType == ECmVideo && - ( id == EMSDateFrom || id == EMSDateUntil ) ) - { - isAdditional = ETrue; - } - - return isAdditional; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::ListMediaType -// Returns media type of the list -// -------------------------------------------------------------------------- -// -TCmMediaType CMSFillRuleEditList::ListMediaType() - { - return iMediaType; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::SizeChanged() - { - ListBox()->SetRect( Rect() ); // Set rectangle of listbox. - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::HandleResourceChange( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect( iView->ClientRect() ); - } - - CCoeControl::HandleResourceChange( aType ); - } - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::CreateServerSettingListL -// Creates selection item list -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::CreateServerSettingListL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - CreateServerSettingListL")); - - if ( iServerArray ) - { - iServerArray->ResetAndDestroy(); - delete iServerArray; - iServerArray = NULL; - } - - iServerArray = - new ( ELeave ) CSelectionItemList( 8 ); - - TBuf8 itemText; - TInt selectedItemCount( 0 ); - - TInt serverCount(0); - if ( iServers ) - { - serverCount = iServers->Count(); - } - - // Cycle trough all servers - for ( TInt idx = 0; idx < serverCount; idx++ ) - { - // get server - CCmMediaServerFull* server = (*iServers)[idx]; - - // Add all servers to the list - HBufC* devName = - CnvUtfConverter::ConvertToUnicodeFromUtf8L( - server->MediaServerName() ); - CleanupStack::PushL( devName ); - CSelectableItem* item = new ( ELeave ) CSelectableItem( - *devName, EFalse); - - CleanupStack::PushL( item ); - // item must be constructed - item->ConstructL(); - - // count of servers set to rule - TInt ruleServerCount = iRule->MediaServerCount(); - - // Cycle trough all servers - for (TInt index = 0; index < ruleServerCount; index++ ) - { - TInt serverId( 0 ); - iRule->MediaServerL( index, serverId ); - - if ( serverId == server->DbId() ) // compare IDs - { - // found - break this loop - index = ruleServerCount; - // found - mark selected - item->SetSelectionStatus( ETrue ); - selectedItemCount++; - } - } - // append item to list - iServerArray->AppendL(item); - CleanupStack::Pop( item ); - CleanupStack::PopAndDestroy( devName ); - } - - // Create and append default item and put it first - HBufC* itemName = StringLoader::LoadLC( R_MS_VALUE_ANY_SOURCE_DEVICE ); - CSelectableItem* item = NULL; - if ( selectedItemCount ) - { - item = new ( ELeave ) CSelectableItem( *itemName, EFalse ); - } - else - { - item = new ( ELeave ) CSelectableItem( *itemName, ETrue ); - } - - CleanupStack::PushL( item ); - item->ConstructL(); - iServerArray->InsertL(0, item); - CleanupStack::Pop( item ); - CleanupStack::PopAndDestroy( itemName ); - - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::HandleServerSelectionL -// Adds selected servers from the list to the rule -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::HandleServerSelectionL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - HandleServerSelectionL")); - - DeleteAllServersFromRuleL(); - - // Check if first item ("Any") selected - if ( (*iServerArray)[0]->SelectionStatus() == EFalse ) - { - for ( TInt index = 1; index < iServerArray->Count(); index++ ) - { - CSelectableItem* item = (*iServerArray)[index]; - TBool selected = item->SelectionStatus(); - - CCmMediaServerFull* server = (*iServers)[index-1]; - - // add server - if ( item->SelectionStatus() ) - { - iRule->AddMediaServerL( server->DbId() ); - } - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::DeleteAllServersFromRuleL -// Deletes all servers from rule -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::DeleteAllServersFromRuleL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::\ - DeleteAllServersFromRuleL")); - - // count of servers set to rule - TInt ruleServerCount = iRule->MediaServerCount(); - - for ( TInt index = ruleServerCount-1; index >= 0; index-- ) - { - TInt serverId( 0 ); - iRule->MediaServerL( index , serverId ); - iRule->DeleteMediaServer( serverId ); - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditList::GetServersAndCheckActivityL -// Gets mediaservers and removes not active servers -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditList::GetServersAndCheckActivityL() - { - iServers = iAppUi->MSEngine()->GetMediaServersL(); - - for ( TInt i = 0; i < iServers->Count() ; i++ ) - { - CCmMediaServerFull* server = (*iServers)[i]; - // remove server if it is not tagged as fill server - if ( !server->FillUsage() ) - { - delete server; - iServers->Remove(i); - i--; - } - } - iServers->Compress(); - } - -// --------------------------------------------------------------------------- -// CMSFillRuleEditList::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSFillRuleEditList::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSFillRuleEditList::GetHelpContext")); - - aContext.iMajor = TUid::Uid(KMediaServantUID3); - aContext.iContext = KMSERV_HLP_EDIT_RULES; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msfillruleeditview.cpp --- a/homesync/contentmanager/mediaservant/src/msfillruleeditview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,276 +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: CMSFillRuleEditView class implementation -* -*/ - - -#include -#include -#include -#include - -#include "msfillview.h" -#include "msengine.h" -#include "msfillruleeditlist.h" -#include "msfillruleeditview.h" -#include "msappui.h" -#include "msconstants.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView::CMSFillRuleEditView() -// -------------------------------------------------------------------------- -// -CMSFillRuleEditView::CMSFillRuleEditView( CMSAppUi& aAppUi ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::CMSFillRuleEditView")); - - iAppUi = &aAppUi; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::ConstructL")); - - BaseConstructL( R_MS_FILL_EDIT_VIEW ); - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView::~CMSFillRuleEditView() -// -------------------------------------------------------------------------- -// -CMSFillRuleEditView::~CMSFillRuleEditView() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::~CMSFillRuleEditView")); - - DoDeactivate(); - } - -// -------------------------------------------------------------------------- -// TUid CMSFillRuleEditView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSFillRuleEditView::Id() const - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::Id")); - - return KMSFillEditViewId; - } - - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditView::HandleCommandL( TInt aCommand ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::HandleCommandL")); - - switch (aCommand) - { - case EAknCmdOpen: - { - iContainer->OpenSelectedListboxItemL(); - break; - } - case EAknSoftkeyDone: - { - iAppUi->MSEngine()->StopOperation(); - iAppUi->FillRuleController()->UpdateArrayL(); - iAppUi->ChangeViewL( KMSFillEditViewId, KMSFillViewId ); - break; - } - case EMSCmdRemoveRule: - { - iContainer->RemoveCurrentRuleL(); - break; - } - case EAknCmdHelp : - { - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - default: - { - AppUi()->HandleCommandL(aCommand); - } - break; - - } - } - - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView::DoActivateL() -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::DoActivateL")); - - if ( !iContainer ) - { - // create settings screen - iContainer = CMSFillRuleEditList::NewL(*iAppUi, - *this ); - iContainer->SetMopParent( this ); - - // now control receives keyboard events - iAppUi->AddToStackL( *this, iContainer ); - iContainer->ActivateL(); - } - - // Set title text - HBufC* titleText = NULL; - - switch ( iContainer->ListMediaType() ) - { - case ECmImage: - { - titleText = StringLoader::LoadLC( - R_MS_EDIT_IMAGE_RULE_VIEW_TITLE ); - break; - } - case ECmVideo: - { - titleText = StringLoader::LoadLC( - R_MS_EDIT_VIDEO_RULE_VIEW_TITLE ); - break; - } - case ECmAudio: - { - titleText = StringLoader::LoadLC( - R_MS_EDIT_MUSIC_RULE_VIEW_TITLE ); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::DoActivateL \ - list has no media type")); - break; - } - } - - if ( titleText ) - { - SetTitlePaneTextL( *titleText ); - CleanupStack::PopAndDestroy ( titleText ); - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::DoDeactivate")); - - ClearCurrentNaviPaneText(); - - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; // Deletes the container class object. - iContainer = NULL; - } - - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView:DynInitMenuPaneL -// -------------------------------------------------------------------------- -// -void CMSFillRuleEditView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::DynInitMenuPaneL")); - - if ( aResourceId == R_MS_FILL_EDIT_MENU && iContainer ) - { - // check if the list is empty - if ( iContainer->IsCurrentRuleAdditional() == EFalse ) - { - // Hide command - aMenuPane->SetItemDimmed(EMSCmdRemoveRule, ETrue); - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView:ShowTemplateQueryL -// -------------------------------------------------------------------------- -// -TBool CMSFillRuleEditView::ShowTemplateQueryL( TInt aResourceId, - TInt aQueryHeading, - CDesCArray* aRuleNames, - TInt &aSelected ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::ShowTemplateQueryL")); - - TBool ret( EFalse ); - - // construct and show template query - CAknListQueryDialog* query = - new ( ELeave ) CAknListQueryDialog( &aSelected ); - query->PrepareLC( aResourceId ); - - // read header text - HBufC* header = StringLoader::LoadLC( aQueryHeading ); - query->SetHeaderTextL( header->Des() ); - - // set item array - query->SetItemTextArray( aRuleNames ); - query->SetOwnershipType( ELbmDoesNotOwnItemArray ); - CleanupStack::PopAndDestroy( header ); - - if ( query->RunLD() ) - { - ret = ETrue; - } - - return ret; - } - -// -------------------------------------------------------------------------- -// CMSFillRuleEditView:ShowQueryL -// -------------------------------------------------------------------------- -// -TBool CMSFillRuleEditView::ShowQueryL( TInt aResourceId ) - { - LOG(_L("[MediaServant]\t CMSFillRuleEditView::ShowQueryL")); - - TBool ret( EFalse ); - CAknQueryDialog* query= CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ); - CleanupStack::PushL( query ); - if ( query->ExecuteLD( aResourceId ) ) - { - ret = ETrue; - } - CleanupStack::Pop( query ); - return ret; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msfillview.cpp --- a/homesync/contentmanager/mediaservant/src/msfillview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,603 +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: CMSFillView class implementation -* -*/ - - -#include -#include -#include -#include -#include - -#include "cmfillrule.h" -#include "msfillview.h" -#include "msengine.h" -#include "msfillcontainer.h" -#include "msappui.h" -#include "msconstants.h" -#include "mediaservant.hrh" -#include "msparameteragent.h" -#include "msdebug.h" - - -// CONSTANTS -_LIT( KWildCard, "*" ); -_LIT( KSpace, " "); - -const TInt KImageListTemplate = 1; -const TInt KVideoListTemplate = 2; -const TInt KMusicListTemplate = 3; - - -// -------------------------------------------------------------------------- -// CMSFillView::CMSFillView() -// -------------------------------------------------------------------------- -// -CMSFillView::CMSFillView( CMSAppUi& aAppUi ) - { - LOG(_L("[MediaServant]\t CMSFillView::CMSFillView")); - - iAppUi = &aAppUi; - } - -// -------------------------------------------------------------------------- -// CMSFillView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSFillView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSFillView::ConstructL")); - - BaseConstructL( R_MS_FILL_VIEW ); - } - -// -------------------------------------------------------------------------- -// CMSFillView::~CMSFillView() -// -------------------------------------------------------------------------- -// -CMSFillView::~CMSFillView() - { - LOG(_L("[MediaServant]\t CMSFillView::~CMSFillView")); - DoDeactivate(); - } - -// -------------------------------------------------------------------------- -// TUid CMSFillView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSFillView::Id() const - { - LOG(_L("[MediaServant]\t CMSFillView::Id")); - - return KMSFillViewId; - } - - -// -------------------------------------------------------------------------- -// CMSFillView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSFillView::HandleCommandL(TInt aCommand) - { - LOG(_L("[MediaServant]\t CMSFillView::HandleCommandL")); - - CEikButtonGroupContainer* cba = Cba(); - - switch (aCommand) - { - case EAknSoftkeyBack: - { - CancelAsyncOperation( iAppUi ); - iNextView = KMSMainViewId; - - CheckAndHandleChangesL(); - - break; - } - - case EAknSoftkeyDone: - { - CancelAsyncOperation( iAppUi ); - iContainer->SetReorderStateL( EMSFillNormal ); - cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - cba->DrawNow(); - - // Set title pane text - SetTitlePaneTextL( R_MS_FILL_VIEW_TITLE ); - break; - } - - case EMSCmdActivate: // fall through - case EMSCmdDeActivate: - { - iContainer->ChangeListActivityL(); - SetListUnselected(); - break; - } - // Edit fill rule - case EMSCmdEditRule: - { - CancelAsyncOperation( iAppUi ); - TMSTemplate ruleTemplate; - ruleTemplate.templateType = aCommand; - ruleTemplate.selectedTemplate = EMSNoTemplate; - iAppUi->ParameterAgent()->SetRuleTemplate( ruleTemplate ); - - iNextView = KMSFillEditViewId; - CheckAndHandleChangesL(); - - break; - } - - case EMSCmdBrowse: - { - CancelAsyncOperation( iAppUi ); - iNextView = KMSFillBrowseViewId; - CheckAndHandleChangesL(); - - break; - } - - case EMSCmdNewImageList: // fall through - case EMSCmdNewVideoList: // fall through - case EMSCmdNewMusicList: - { - CancelAsyncOperation( iAppUi ); - ShowTemplateQueryL( aCommand ); - iNextView = KMSFillEditViewId; - CheckAndHandleChangesL(); - break; - } - - // Reorder fill rule - case EMSCmdReorder: - { - iContainer->SetReorderStateL( EMSFillReorderActive ); - cba->SetCommandSetL( R_SOFTKEYS_DROP_EMPTY ); - cba->DrawNow(); - // Set title pane text - SetTitlePaneTextL( R_MS_FILL_VIEW_TITLE_REORDER_MODE ); - break; - } - - // Drop rule to new location - case EMSCmdDrop: - { - iContainer->SetReorderStateL( EMSFillGrabActive ); - cba->SetCommandSetL( R_SOFTKEYS_GRAB_DONE ); - cba->DrawNow(); - break; - } - // Reorder mode active - grab item - case EMSCmdGrab: - { - iContainer->SetReorderStateL( EMSFillReorderActive ); - cba->SetCommandSetL( R_SOFTKEYS_DROP_EMPTY ); - cba->DrawNow(); - break; - } - // Delete fill rule - case EMSCmdDelete: - { - iContainer->DeleteRuleL(); - break; - } - case EAknCmdHelp : - { - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - default: - { - CancelAsyncOperation( iAppUi ); - AppUi()->HandleCommandL(aCommand); - break; - } - } - } - - -// -------------------------------------------------------------------------- -// CMSFillView::DoActivateL() -// -------------------------------------------------------------------------- -// -void CMSFillView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - LOG(_L("[MediaServant]\t CMSFillView::DoActivateL")); - - // Set engine observer - iAppUi->MSEngine()->SetObserver( this ); - - // Set title pane text - SetTitlePaneTextL( R_MS_FILL_VIEW_TITLE ); - - if ( !iContainer ) - { - iContainer = new (ELeave) CMSFillContainer( *iAppUi, *this ); - iContainer->ConstructL( ClientRect() ); - iContainer->SetMopParent( this ); - AppUi()->AddToViewStackL( *this, iContainer ); - } - SetListUnselected(); - } - -// -------------------------------------------------------------------------- -// CMSFillView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSFillView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSFillView::DoDeactivate")); - - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; // Deletes the container class object. - iContainer = NULL; - SetListUnselected(); - } - -// -------------------------------------------------------------------------- -// CMSFillView::FocusIndex() -// -------------------------------------------------------------------------- -// -TInt CMSFillView::FocusIndex() const - { - return iContainer->SelectedItemIndex(); - } - -// -------------------------------------------------------------------------- -// CMSFillView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) -// -------------------------------------------------------------------------- -// -void CMSFillView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - LOG(_L("[MediaServant]\t CMSFillView::DynInitMenuPaneL")); - - if ( aResourceId == R_FILL_VIEW_MENU && iContainer ) - { - // check if the list is empty - if ( iContainer->ListItemCount() <= 0 ) - { - // Hide commands - aMenuPane->SetItemDimmed(EMSCmdEditRule, ETrue); - aMenuPane->SetItemDimmed(EMSCmdReorder, ETrue); - aMenuPane->SetItemDimmed(EMSCmdDelete, ETrue); - aMenuPane->SetItemDimmed(EMSCmdBrowse, ETrue); - aMenuPane->SetItemDimmed(EMSCmdActivate, ETrue); - aMenuPane->SetItemDimmed(EMSCmdDeActivate, ETrue); - } - - if ( iContainer->IsCurrentListItemActive() ) - { - aMenuPane->SetItemDimmed(EMSCmdActivate, ETrue); - } - else - { - aMenuPane->SetItemDimmed(EMSCmdDeActivate, ETrue); - } - } - } - -// -------------------------------------------------------------------------- -// CMSFillView::ShowTemplateQueryL -// shows template query -// -------------------------------------------------------------------------- -// -void CMSFillView::ShowTemplateQueryL( TInt aCommand ) - { - LOG(_L("[MediaServant]\t CMSFillView::ShowTemplateQueryL")); - - HBufC* defaultListName = NULL;; - - TMSTemplate ruleTemplate; - // set template info - ruleTemplate.templateType = aCommand; - - switch ( aCommand ) - { - case EMSCmdNewImageList: - { - defaultListName = StringLoader::LoadLC( - R_MS_CUSTOM_LIST_IMAGE_NAME ); - ruleTemplate.selectedTemplate = KImageListTemplate; - break; - } - case EMSCmdNewVideoList: - { - defaultListName = StringLoader::LoadLC( - R_MS_CUSTOM_LIST_VIDEO_NAME ); - ruleTemplate.selectedTemplate = KVideoListTemplate; - break; - } - case EMSCmdNewMusicList: - { - defaultListName = StringLoader::LoadLC( - R_MS_CUSTOM_LIST_MUSIC_NAME ); - ruleTemplate.selectedTemplate = KMusicListTemplate; - break; - } - default: - { - defaultListName = StringLoader::LoadLC( - R_MS_CUSTOM_LIST_IMAGE_NAME ); - ruleTemplate.selectedTemplate = KImageListTemplate; - // command not found - break; - } - } - - // Create search string with wildcards - HBufC* searchStr = HBufC::NewLC( KMaxFileName ); - searchStr->Des().Copy( KWildCard ); - searchStr->Des().Append( defaultListName->Des() ); - searchStr->Des().Append( KWildCard ); - - // Check if fill list have dublicate names - TInt count = iContainer->CheckIfDublicateNames( *searchStr ); - - CleanupStack::PopAndDestroy( searchStr ); - // keep template name safe - ruleTemplate.templateName.Copy( defaultListName->Des() ); - - // if existing items... - searchStr = HBufC::NewLC( KMaxFileName ); - searchStr->Des().Append( defaultListName->Des() ); - - TBool same = EFalse; - - RPointerArray* iFillListArray = - iAppUi->FillRuleController()->FillListArray(); - - // if there are same name items - for ( TInt index = 0; index < iFillListArray->Count(); ++index ) - { - CCmFillRule* rule = (*iFillListArray)[index]->List(); - HBufC* listName = - CnvUtfConverter::ConvertToUnicodeFromUtf8L( rule->Name() ); - CleanupStack::PushL( listName ); - if ( *searchStr == *listName ) - { - same = ETrue; - } - CleanupStack::PopAndDestroy( listName ); - } - - CleanupStack::PopAndDestroy( searchStr ); - // exist same name items - if ( count > 0 && same ) - { - TInt postfix; - // calculate a postfix number to add the end of the name - for ( postfix = 1; ; ++postfix ) - { - HBufC* sameStr = HBufC::NewL( KMaxFileName ); - CleanupStack::PushL( sameStr ); - sameStr->Des().Copy( KWildCard ); - sameStr->Des().Append( defaultListName->Des() ); - sameStr->Des().Append( KSpace ); - sameStr->Des().AppendNum( postfix ); - sameStr->Des().Append( KWildCard ); - - // do number conversion - TPtr ptr = sameStr->Des(); - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( ptr ); - - if ( 0 == iContainer->CheckIfDublicateNames( *sameStr ) ) - { - // after append the current number, there are not - //same name items, so jump out the code block - CleanupStack::PopAndDestroy( sameStr ); - break; - } - CleanupStack::PopAndDestroy( sameStr ); - } - - // append order number to name - ruleTemplate.templateName.Append( KSpace ); - ruleTemplate.templateName.AppendNum( postfix ); - - // do number conversion - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( - ruleTemplate.templateName ); - } - - // store template info to parameter agent - iAppUi->ParameterAgent()->SetRuleTemplate( ruleTemplate ); - - CleanupStack::PopAndDestroy( defaultListName ); - } - -// --------------------------------------------------------------------------- -// CMSFillView::ShowNaviTextL -// --------------------------------------------------------------------------- -// -void CMSFillView::ShowNaviTextL() - { - LOG(_L("[MediaServant]\t CMSFillView::ShowNaviTextL")); - - HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT ); - SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - -// --------------------------------------------------------------------------- -// CMSFillView::SetListUnselected -// --------------------------------------------------------------------------- -// -void CMSFillView::SetListUnselected( ) - { - LOG(_L("[MediaServant]\t CMSFillView::SetListUnselected")); - - iListUnSelected = iAppUi->FillRuleController()-> - HasSelectionsChanged( ECmUnSelected ); - } - -// --------------------------------------------------------------------------- -// CMSFillView::CheckAndHandleChangesL -// --------------------------------------------------------------------------- -// -void CMSFillView::CheckAndHandleChangesL() - { - LOG(_L("[MediaServant]\t CMSFillView::CheckAndHandleChangesL")); - - TBool priorityChanged( EFalse ); - - // Check if priorities has been changed - priorityChanged = iAppUi->FillRuleController()-> - HasPriorityChangedL(); - - iNewListSelected = iAppUi->FillRuleController()-> - HasSelectionsChanged( ECmSelected ); - // check if there is deleted lists - TBool listDeleted = iContainer->IsListDeleted(); - - // set activity for all rules - iContainer->SetFillRules(); - - if ( iListUnSelected ) - { - // unselected list(s) - show query - DoDeleteQueryL(); - } - - // send rules to server - iAppUi->FillRuleController()->SaveRulesL(); - - // update lists if list(s) have been deleted, created or their selection - // statuses or priorities have been changed - if ( listDeleted || - priorityChanged || - iListUnSelected || - iNewListSelected ) - { - // disable right softkey - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_EMPTY ); - cba->DrawDeferred(); - - ShowNaviTextL(); - iAppUi->MSEngine()->UpdateFillListsL(); - } - else // no list update needed - { - // retrieve new information - iAppUi->FillRuleController()->UpdateArrayL(); - iAppUi->ChangeViewL( KMSFillViewId, iNextView ); - } - } - -// --------------------------------------------------------------------------- -// CMSFillView::DoDeleteQueryL -// --------------------------------------------------------------------------- -// -void CMSFillView::DoDeleteQueryL() - { - LOG(_L("[MediaServant]\t CMSFillView::DoDeleteQueryL")); - - // Show delete files query - CAknQueryDialog* query= CAknQueryDialog::NewL( - CAknQueryDialog::ENoTone ); - - if ( query->ExecuteLD( R_MSERV_DELETE_FILES_QUERY ) ) - { - // do nothing - } - else // canceled - { - iAppUi->FillRuleController()->RestoreOriginalSelections(); - } - } - -// -------------------------------------------------------------------------- -// CMSFillView::ReadyL() -// engine observer callback -// -------------------------------------------------------------------------- -// -void CMSFillView::ReadyL( TCmService aService, TInt /*aError*/ ) - { - LOG(_L("[MediaServant]\t CMSFillView::ReadyL")); - - switch ( aService ) - { - case ECmServiceUpdateFillLists: - { - // set original softkeys back - CEikButtonGroupContainer* cba = - CEikButtonGroupContainer::Current(); - cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - cba->DrawDeferred(); - - // retrieve new information - iAppUi->FillRuleController()->UpdateArrayL(); - - ClearCurrentNaviPaneText(); - iAppUi->ChangeViewL( KMSFillViewId, iNextView ); - break; - } - case ECmServiceDeleteFilledFiles: - { - LOG(_L("[MediaServant]\t CMSFillView::ReadyL delete complete")); - ClearCurrentNaviPaneText(); - // Set context pane icon - iContainer->SetDefaultContextPaneIconL(); - - iContainer->UpdateListBoxDataL(); - break; - } - - default: - { - LOG(_L("[MediaServant]\t CMSFillView::ReadyL \ - service not found")); - } - - } - } - -// -------------------------------------------------------------------------- -// CMSFillView::SetCbaL() -// Changes softkeys -// -------------------------------------------------------------------------- -// -void CMSFillView::SetCbaL( TBool aSelected ) - { - LOG(_L("[MediaServant]\t CMSFillView::SetCbaL")); - - CEikButtonGroupContainer* cba = Cba(); - - if ( aSelected ) - { - cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_BACK__DEACTIVATE ); - } - else - { - cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_BACK__ACTIVATE ); - } - cba->DrawDeferred(); - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msitembrowser.cpp --- a/homesync/contentmanager/mediaservant/src/msitembrowser.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,316 +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: CMSItemBrowser class implementation -* -*/ - - - -#include -#include -#include -#include -#include -#include -#include - -#include "cmbaselistitem.h" -#include "msappui.h" -#include "msitembrowser.h" -#include "msengine.h" -#include "msconstants.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSItemBrowser::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSItemBrowser::ConstructL( TRect aRect ) - { - LOG(_L("[MediaServant]\t CMSItemBrowser::ConstructL")); - - GetBrowseDataL(); - - CreateWindowL(); - - iListBox = new (ELeave) CAknDoubleGraphicStyleListBox; - - SetListBoxFromResourceL(iListBox, R_BROWSE_VIEW_LISTBOX); - - // Create icons - CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount ); - CleanupStack::PushL( icons ); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - // mark icon - AppendIconToArrayL( icons, skin, - KAvkonMifFileName, - KAknsIIDDefault, - EMbmAvkonQgn_indi_marked_add, - EMbmAvkonQgn_indi_marked_add_mask ); - - // image icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_prop_file_image, - EMbmMediaservantQgn_prop_file_image_mask ); - // audio icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_prop_file_audio, - EMbmMediaservantQgn_prop_file_audio_mask ); - // video icon - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_prop_file_video, - EMbmMediaservantQgn_prop_file_video_mask ); - - - iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(icons); - CleanupStack::Pop(icons); - - // Container is listbox observer - iListBox->SetListBoxObserver( this ); - - SetRect(aRect); - - // Add data to listbox - UpdateListBoxDataL(); - - ActivateL(); // Activates window. ( Ready to draw ) - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::~CMSItemBrowser -// -------------------------------------------------------------------------- -CMSItemBrowser::~CMSItemBrowser() - { - if ( iItemArray ) - { - iItemArray->ResetAndDestroy(); - iItemArray->Close(); - delete iItemArray; - } - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::CountComponentControls() -// Returns number of components. -// -------------------------------------------------------------------------- -// -TInt CMSItemBrowser::CountComponentControls() const - { - return 1; // return number of controls inside this container - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::ComponentControl() -// Returns pointer to particular component. -// -------------------------------------------------------------------------- -// -CCoeControl* CMSItemBrowser::ComponentControl( TInt /*aIndex*/) const - - { - return iListBox; // return a pointer to the listbox - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::OfferKeyEventL() -// Handles the key events. -// -------------------------------------------------------------------------- -// -TKeyResponse CMSItemBrowser::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - LOG(_L("[MediaServant]\t CMSItemBrowser::OfferKeyEventL")); - - TKeyResponse response = EKeyWasNotConsumed; - - if ( aType != EEventKey ) - { - response = EKeyWasNotConsumed; - } - - if ( iListBox ) - { - response = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - - return response; - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::HandleListBoxEventL() -// Handles listbox event. -// -------------------------------------------------------------------------- -void CMSItemBrowser::HandleListBoxEventL( - CEikListBox* /*aListBox*/, - TListBoxEvent /*aEventType*/ ) - { - LOG(_L("[MediaServant]\t CMSItemBrowser::HandleListBoxEventL")); - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::ReadDataFromEngineL() -// Reads data items from engine -// -------------------------------------------------------------------------- -// -void CMSItemBrowser::UpdateListBoxDataL() - { - LOG(_L("[MediaServant]\t CMSItemBrowser::UpdateListBoxDataL")); - - // Listbox items - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - // Clear list - itemArray->Reset(); - - TInt count = iItemArray->Count(); - - for (TInt index = 0; index < count; index++) - { - TInt iconType; - CCmBaseListItem* item = (*iItemArray)[index]; - TUint32 fileSize = item->Size(); - HBufC* fileSizeStr = NULL; - HBufC* primaryText = HBufC::NewLC( KMaxDataTypeLength ); - HBufC* secondaryText = HBufC::NewLC( KMaxDataTypeLength ); - - switch ( iMediaType ) - { - case ECmVideo: - // fall through - case ECmOtherVideo: - { - iconType = EIconVideo; - break; - } - case ECmImage: - // fall through - case ECmOtherImage: - { - iconType = EIconImage; - break; - } - case ECmAudio: - { - iconType = EIconAudio; - - secondaryText->Des().Copy( item->SecondaryText() ); - break; - } - default: - { - iconType = EIconVideo; - break; - } - } - - // Set item secondary text - if ( fileSize < KMega ) - { - if ( secondaryText->Length() ) - { - secondaryText->Des().Append( KDelimiter); - } - - fileSizeStr = StringLoader::LoadLC( - R_MS_FILE_SIZE_KB, fileSize / KKilo ); - } - else - { - if ( secondaryText->Length() ) - { - secondaryText->Des().Append( KDelimiter ); - } - - TReal size( 0 ); - Math::Round( size, TReal( fileSize ) / KMega, 0 ); - fileSizeStr = StringLoader::LoadLC( - R_MS_FILE_SIZE_MB, size ); - } - - secondaryText->Des().Append( *fileSizeStr ); - if ( fileSizeStr ) - { - CleanupStack::PopAndDestroy( fileSizeStr ); - } - - // do number conversion - TPtr ptr = secondaryText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - // add item - AppendItemToListBoxArrayL( - iListBox, - iListBox->Model(), - iconType, // default icon - (*iItemArray)[index]->PrimaryText(), - *secondaryText ); - CleanupStack::PopAndDestroy( secondaryText ); - CleanupStack::PopAndDestroy( primaryText ); - } - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::SetCurrentFileStatus -// -------------------------------------------------------------------------- -// -void CMSItemBrowser::SetFileStatus( TInt aIndex, - TCmListItemStatus aStatus ) - { - LOG(_L("[MediaServant]\t CMSItemBrowser::SetFileStatus")); - - (*iItemArray)[aIndex]->SetStatus( aStatus ); - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::GetCurrentFileStatus -// -------------------------------------------------------------------------- -// -TCmListItemStatus CMSItemBrowser::FileStatus( TInt aIndex ) - { - LOG(_L("[MediaServant]\t CMSItemBrowser::FileStatus")); - - return (*iItemArray)[ aIndex ]->Status(); - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::ListBox() -// Returns listbox -// -------------------------------------------------------------------------- -// -CEikListBox* CMSItemBrowser::ListBox() - { - return iListBox; - } - -// -------------------------------------------------------------------------- -// CMSItemBrowser::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CMSItemBrowser::SizeChanged() - { - // container control resize code. - if ( iListBox ) - { - iListBox->SetRect( Rect() ); // Set rectangle of listbox. - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msmaincontainer.cpp --- a/homesync/contentmanager/mediaservant/src/msmaincontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1453 +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: CMSMainContainer class implementation -* -*/ - - - -#include -#include -#include -#include -#include - -#include "mserv.hlp.hrh" -#include "cmfillrule.h" -#include "msappui.h" -#include "msmainview.h" -#include "mediaservantuid.h" -#include "msmaincontainer.h" -#include "msengine.h" -#include "msconstants.h" -#include "msdebug.h" - -// Constants -const TInt KTimerInterval = 60000000; // 1 min -const TInt KNaviTimerInterval = 2000000; // 2 sec - - -// -------------------------------------------------------------------------- -// CMSMainContainer::CMSMainContainer() -// -------------------------------------------------------------------------- -// -CMSMainContainer::CMSMainContainer( CMSAppUi& aAppUi, - CMSMainView& aView ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::CMSMainContainer")); - - iAppUi = &aAppUi; - iView = &aView; - iAppWizardRun = EFalse; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::~CMSMainContainer() -// -------------------------------------------------------------------------- -// -CMSMainContainer::~CMSMainContainer() - { - LOG(_L("[MediaServant]\t CMSMainContainer::~CMSMainContainer")); - - if( iPeriodic ) - { - iPeriodic->Cancel(); - } - delete iPeriodic; - - if( iNaviTimer ) - { - iNaviTimer->Cancel(); - } - delete iNaviTimer; - - if( iUpdateList ) - { - iUpdateList->Cancel(); - } - delete iUpdateList; - - if( iMSPropertyWatcher ) - { - iMSPropertyWatcher->Stop(); - } - delete iMSPropertyWatcher; - - if( iMemoryCardMonitor ) - { - iMemoryCardMonitor->Cancel(); - } - delete iMemoryCardMonitor; - - delete iListBox; // Deletes listbox object. - } - - -// -------------------------------------------------------------------------- -// CMSMainContainer::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSMainContainer::ConstructL( TRect aRect ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::ConstructL")); - - // Create property watcher for progress info - iMSPropertyWatcher = CMSPropertyWatcher::NewL(); - // view will observe changes in property - iMSPropertyWatcher->SetObserver(this); - - //create a mmc monitor to capture mmc event - RFs& systemFs = CEikonEnv::Static()->FsSession(); - iMemoryCardMonitor = CMSMemoryCardMonitor::NewL( this, systemFs ); - iMemoryCardMonitor->StartMonitor(); - - CreateWindowL(); - - iListBox = new (ELeave) CAknDoubleLargeStyleListBox; - - SetListBoxFromResourceL(iListBox, R_MAIN_VIEW_LISTBOX); - - // Create icons - CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount ); - CleanupStack::PushL( icons ); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName() ); - - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_sync, - EMbmMediaservantQgn_mserv_sync_mask ); - - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_sync_stop, - EMbmMediaservantQgn_mserv_sync_stop_mask ); - - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_to_home, - EMbmMediaservantQgn_mserv_to_home_mask ); - - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_to_home_inactive, - EMbmMediaservantQgn_mserv_to_home_inactive_mask ); - - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_from_home, - EMbmMediaservantQgn_mserv_from_home_mask ); - - AppendIconToArrayL( icons, skin, - KMSMifFileName, - KAknsIIDDefault, - EMbmMediaservantQgn_mserv_from_home_inactive, - EMbmMediaservantQgn_mserv_from_home_inactive_mask ); - - iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(icons); - - CleanupStack::Pop(icons); - - // Container is listbox observer - iListBox->SetListBoxObserver( this ); - // Set engine observer - iAppUi->MSEngine()->SetObserver( this ); - - SetRect(aRect); - - // Check if automatic sync/harvest is ongoing - TCmServerState state; - iAppUi->MSEngine()->ServerState( state ); - if ( state == ECmServerStateStoring || - state == ECmServerStateFilling || - state == ECmServerStateSearchingForServers ) - { - iSyncRunning = ESyncRunning; - } - - if ( state == ECmServerStateHarvesting ) - { - iRefreshRunning = ETrue; - } - - // From home secondary item text depends list selections - iFillListSelected = CheckIfFillListSelected(); - - // Add data to listbox - UpdateListBoxDataL(); - - if ( iSyncRunning != ESyncRunning && - iRefreshRunning == EFalse && - state != ECmServerStateDeleting ) - { - // Set last sync time to navi pane - SetNaviTextLastSyncL(); - } - - // Delete may be in progress so we have to inform user - if ( state == ECmServerStateDeleting ) - { - HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT ); - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - - // start listening property - iMSPropertyWatcher->StartL(); - - //Set current item - iListBox->SetCurrentItemIndex( - iAppUi->ParameterAgent()->MainViewFocusIndex() ); - - // Start timer for last sync time reading - iPeriodic = CPeriodic::NewL(CActive::EPriorityIdle); - iPeriodic->Start( 0, KTimerInterval, TCallBack(TimerCallbackL,this) ); - - // create navi text timer - don't start - iNaviTimer = CPeriodic::NewL( CActive::EPriorityIdle ); - - iUpdateList = CIdle::NewL( CActive::EPriorityIdle ); - - ActivateL(); // Activates window. ( Ready to draw ) - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::CountComponentControls() -// Returns number of components. -// -------------------------------------------------------------------------- -// -TInt CMSMainContainer::CountComponentControls() const - { - return 1; // return number of controls inside this container - } - - -// -------------------------------------------------------------------------- -// CMSMainContainer::ComponentControl() -// Returns pointer to particular component. -// -------------------------------------------------------------------------- -// -CCoeControl* CMSMainContainer::ComponentControl( TInt aIndex ) const - - { - CCoeControl* retval = NULL; - switch ( aIndex ) - { - case 0: - { - retval = iListBox; // return a pointer to the listbox - break; - } - default: - { - retval = NULL; - break; - } - } - return retval; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::OfferKeyEventL() -// Handles the key events. -// -------------------------------------------------------------------------- -// -TKeyResponse CMSMainContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::OfferKeyEventL")); - - TKeyResponse response = EKeyWasNotConsumed; - - if ( aType != EEventKey ) - { - response = EKeyWasNotConsumed; - } - - if ( iListBox ) - { - response = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - - iView->SetCbaL( iListBox->CurrentItemIndex() ); - - return response; - } - - -// -------------------------------------------------------------------------- -// CMSMainContainer::OpenSelectedListboxItemL -// -------------------------------------------------------------------------- -// -void CMSMainContainer::OpenSelectedListboxItemL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::OpenSelectedListboxItemL")); - - HandleListBoxEventL( NULL, EEventEnterKeyPressed ); - } - - -// -------------------------------------------------------------------------- -// CMSMainContainer::HandleListBoxEventL() -// Handles listbox event. -// -------------------------------------------------------------------------- -void CMSMainContainer::HandleListBoxEventL( - CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::HandleListBoxEventL")); - - if ( ( aEventType == MEikListBoxObserver::EEventEnterKeyPressed ) || - ( aEventType == MEikListBoxObserver::EEventItemClicked ) ) - { - TInt selected = iListBox->CurrentItemIndex(); - - switch ( selected ) - { - case EStoreAndFill: - { - // refresh is not active - if ( !iRefreshRunning ) - { - if ( iSyncRunning == ESyncNotRunning ) - { - StartSyncL(); - } - else - { - // Cancel current asyncronous operation - iAppUi->MSEngine()->StopOperation(); - iSyncRunning = ESyncNotRunning; - iView->ClearCurrentNaviPaneText(); - UpdateListBoxDataL(); - } - } - // refresh is ongoing - else - { - if ( iSyncRunning == ESyncWaiting ) - { - iSyncRunning = ESyncNotRunning; - } - else - { - iSyncRunning = ESyncWaiting; - } - UpdateListBoxDataL(); - } - - break; - } - case EStoreToNetwork: - { - if ( !iRefreshRunning && - !iSyncRunning && - !iPreprocessRunning ) - { - iAppUi->ChangeViewL( KMSMainViewId, - KMSStoreListViewId ); - } - else - { - TInt noteId = ( iRefreshRunning || iPreprocessRunning ? - R_MS_ACCESS_ERROR_NOTE : - R_MS_ACCESS_ERROR_NOTE_SYNC ); - ShowErrorNoteL( noteId ); - } - break; - } - case EFillToPhone: - { - if ( iAppUi->DriveSelectedL() ) - { - if ( !iRefreshRunning && - !iSyncRunning && - !iPreprocessRunning ) - { - iAppUi->ChangeViewL( KMSMainViewId, KMSFillViewId ); - } - else - { - TInt noteId = ( iRefreshRunning || - iPreprocessRunning ? - R_MS_ACCESS_ERROR_NOTE : - R_MS_ACCESS_ERROR_NOTE_SYNC ); - ShowErrorNoteL( noteId ); - } - } - else - { - ShowErrorNoteL( R_MS_INSERT_MEMORY_CARD_TEXT ); - } - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSMainContainer::\ - HandleListBoxEventL no item selected")); - } - } - } - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::UpdateListBoxDataL() -// Updates listbox texts -// -------------------------------------------------------------------------- -// -void CMSMainContainer::UpdateListBoxDataL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::UpdateListBoxDataL")); - - TCmServerState state; - iAppUi->MSEngine()->ServerState( state ); - - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - - if ( itemArray->Count() ) - { - // delete all listbox items - itemArray->Reset(); - } - - - // Get file counts and sync time - TInt itemsToBeStored( 0 ); - TInt itemsToBeFilled( 0 ); - TInt syncTime( 0 ); - TInt syncTimeStore( 0 ); - TInt syncTimeFill( 0 ); - - iAppUi->MSEngine()->GetTransferInfo( ECmServiceStore, - itemsToBeStored, - syncTimeStore ); - - iAppUi->MSEngine()->GetTransferInfo( ECmServiceFill, - itemsToBeFilled, - syncTimeFill ); - - syncTime = syncTimeStore + syncTimeFill; - - // Create item strings - HBufC* primaryText = NULL; - HBufC* secondaryText = NULL; - TInt icon = EIconSync; - - switch ( iSyncRunning ) - { - default: - // fall trough - case ESyncNotRunning: - { - primaryText = StringLoader::LoadLC( R_MAIN_SYNC_NOW_TEXT ); - - if ( itemsToBeStored > 0 || itemsToBeFilled > 0) - { - if ( syncTime/60 > 1 ) // 1 minute - { - secondaryText = StringLoader::LoadLC( - R_MS_SYNC_TIME_TEXT, - syncTime/60 ); - // do number conversion - TPtr ptr = secondaryText->Des(); - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( ptr ); - } - else - { - secondaryText = StringLoader::LoadLC( - R_MS_SYNC_TIME_ONE_MIN_TEXT ); - } - - } - break; - } - case ESyncRunning: - { - primaryText = StringLoader::LoadLC( R_MAIN_STOP_SYNC_TEXT ); - icon = EIconSyncStop; - break; - } - case ESyncWaiting: - { - primaryText = StringLoader::LoadLC( R_MAIN_STOP_SYNC_TEXT ); - secondaryText = StringLoader::LoadLC( R_MS_SYNC_WAITING_TEXT ); - icon = EIconSyncStop; - break; - } - } - - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - icon, - *primaryText, - *secondaryText ); - - if ( secondaryText ) - { - CleanupStack::PopAndDestroy( secondaryText ); - secondaryText = NULL; - } - - if ( primaryText ) - { - CleanupStack::PopAndDestroy( primaryText ); - primaryText = NULL; - } - - - // From Home -item - primaryText = StringLoader::LoadLC( R_MAIN_FROM_HOME_TEXT ); - - TBool driveSelected = iAppUi->DriveSelectedL(); - - if ( driveSelected == EFalse ) - { - secondaryText = StringLoader::LoadLC( R_MS_MEMORY_CARD_NEEDED_TEXT ); - } - else if ( !iFillListSelected ) - { - secondaryText = StringLoader::LoadLC( R_MS_LIST_NOTHING_SELECTED ); - } - else if ( itemsToBeFilled <= 0 ) - { - secondaryText = StringLoader::LoadLC( R_MS_ALL_IN_SYNC_TEXT ); - } - - if ( iRefreshRunning || - iPreprocessRunning || - iSyncRunning == ESyncRunning || - driveSelected == EFalse ) - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconFromHomeInactive, - *primaryText, - *secondaryText ); - } - else - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconFromHome, - *primaryText, - *secondaryText ); - } - - if ( secondaryText ) - { - CleanupStack::PopAndDestroy( secondaryText ); - secondaryText = NULL; - } - - CleanupStack::PopAndDestroy( primaryText ); - primaryText = NULL; - - // To Home -item - primaryText = StringLoader::LoadLC( R_MAIN_TO_HOME_TEXT ); - - if ( itemsToBeStored < 1 ) - { - secondaryText = StringLoader::LoadLC( R_MS_ALL_IN_SYNC_TEXT ); - } - else if ( itemsToBeStored == 1 ) - { - secondaryText = StringLoader::LoadLC( R_MS_SYNC_ONE_NEW_ITEM_TEXT ); - } - else // > 1 - { - secondaryText = StringLoader::LoadLC( R_MS_SYNC_NEW_ITEMS_TEXT, - itemsToBeStored ); - // do number conversion - TPtr ptr = secondaryText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - } - - if ( iRefreshRunning || - iPreprocessRunning || - iSyncRunning == ESyncRunning ) - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconToHomeInactive, - *primaryText, - *secondaryText ); - } - else - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconToHome, - *primaryText, - *secondaryText ); - } - - if ( secondaryText ) - { - CleanupStack::PopAndDestroy( secondaryText ); - secondaryText = NULL; - } - - CleanupStack::PopAndDestroy( primaryText ); - primaryText = NULL; - - - iListBox->DrawNow(); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::ReadyL() -// engine observer callback -// -------------------------------------------------------------------------- -// -void CMSMainContainer::ReadyL( TCmService aService, TInt aError ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL")); - - // Clears navi pane - iView->ClearCurrentNaviPaneText(); - - if( aError == KErrNotFound ) - { - ShowErrorNoteL( R_MS_ERROR_DEVICES_NOT_FOUND ); - } - else if( aError == KErrGeneral ) - { - ShowErrorNoteL( R_MS_ERROR_SYNC_INTERRUPTED ); - } - else if( aError == KErrDiskFull ) - { - ShowErrorNoteL( R_MS_ERROR_MEMORY_FULL ); - } - else if ( aError && aError != KErrCancel ) - { -#ifdef __DEBUG - ShowNoteL( R_ACTIVE_ERROR_NOTE_TEXT, aError ); -#endif - iRefreshRunning = EFalse; - iSyncRunning = ESyncNotRunning; - } - - switch ( aService ) - { - case ECmServiceDeleteMetadata: - { - iAppUi->MSEngine()->DeleteDeletedMediaserversL(); - // start harvest - iAppUi->MSEngine()->ScanMediaServersL(); - break; - } - case ECmServiceHarvest: - { - if( iAppWizardRun ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::\ - ReadyL, HARVEST (Wizard)")); - - // refreshes also fill rules - iAppUi->RefreshListsL(); - - // "From home" secondary item text depends list selections - // must be read here again because list selections change - // after wizard run - iFillListSelected = CheckIfFillListSelected(); - - if ( iRefreshRunning && iSyncRunning == ESyncWaiting ) - { - StartSyncL(); - iRefreshRunning = EFalse; - } - - iRefreshRunning = EFalse; - iAppWizardRun = EFalse; - LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL, \ - START PRE PRO")); - - // show navi pane text for 2 seconds - ShowRefreshCompleteTextL(); - iNaviTimer->Start( KNaviTimerInterval, - KNaviTimerInterval, - TCallBack( NaviTimerCallbackL, this ) ); - break; - } - else - { - if ( iRefreshRunning && iSyncRunning == ESyncWaiting ) - { - StartSyncL(); - iRefreshRunning = EFalse; - } - else - { - iRefreshRunning = EFalse; - // refreshes also fill rules and store item - iAppUi->RefreshListsL(); - - // show navi pane text for 2 seconds - ShowRefreshCompleteTextL(); - iNaviTimer->Start( KNaviTimerInterval, - KNaviTimerInterval, - TCallBack( NaviTimerCallbackL, this ) ); - } - } - break; - } - - case ECmServiceFill: - // fall trough - case ECmServiceStore: - { - iSyncRunning = ESyncNotRunning; - SetNaviTextLastSyncL(); - iAppUi->RefreshListsL(); - break; - } - - case ECmServicePreProcessingStore: - { - LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL, \ - PRE PRO STORE")); - - if ( iSyncRunning == ESyncWaiting ) - { - StartSyncL(); - } - - iPreprocessRunning = EFalse; - iAppUi->RefreshListsL(); - break; - } - case ECmServicePreProcessingFill: - { - LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL, \ - PRE PRO FILL")); - - // Set last sync time to navi pane - SetNaviTextLastSyncL(); - - iPreprocessRunning = EFalse; - break; - } - - case ECmServiceDeleteFilledFiles: - { - // Set last sync time to navi pane - SetNaviTextLastSyncL(); - break; - } - - default: - { - LOG(_L("[MediaServant]\t CMSMainContainer::ReadyL \ - service not found")); - break; - } - } - - UpdateListBoxDataL(); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::PropertyChangedL -// -------------------------------------------------------------------------- -// -void CMSMainContainer::PropertyChangedL( TCmService aService, - TInt aTotalItems, - TInt aProcessedItems, - TInt /*aItemsToBeProcessed*/ ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::PropertyChangedL")); - - switch ( aService ) - { - case ECmServiceHarvest: - { - // Launching propertywatcher causes unwanted call of observer - // (server previous state is returned - // We want to show progress only when refresh is truly running - if ( iRefreshRunning ) - { - TInt value( 0 ); - if ( aTotalItems > 0 ) - { - value = (TReal(aProcessedItems)/TReal(aTotalItems))*100; - } - - HBufC* progress = StringLoader::LoadLC( - R_MS_NAVI_REFRESHING_TEXT, value ); - - // do number conversion - TPtr ptr = progress->Des(); - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( ptr ); - - // update navi pane - iView->SetNavigationPaneTextL( *progress ); - CleanupStack::PopAndDestroy( progress ); - } - break; - } - case ECmServiceStore: - // fall through - case ECmServiceFill: - { - if ( aTotalItems > 0 && aProcessedItems > 0 ) - { - // calculate procentual value - TInt value = (TReal(aProcessedItems)/TReal(aTotalItems))*100; - HBufC* progress = StringLoader::LoadLC( - R_MS_NAVI_SYNC_TEXT, value ); - - // do number conversion - TPtr ptr = progress->Des(); - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( ptr ); - - // update navi pane - iView->SetNavigationPaneTextL( *progress ); - CleanupStack::PopAndDestroy( progress ); - } - break; - } - case ECmServiceNone: - { - iSyncRunning = ESyncNotRunning; - iRefreshRunning = EFalse; - if ( iNaviTimer && !iNaviTimer->IsActive() ) - { - SetNaviTextLastSyncL(); - } - - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSMainContainer::PropertyChangedL \ - service not found")); - } - } - - if ( iUpdateList && !iUpdateList->IsActive() ) - { - iCurStep = EFirstStep; - iRequestCt = 1; - iUpdateList->Start( TCallBack( BackgroundUpdateListL, this ) ); - } - else - { - iRequestCt++; - LOG(_L("[MediaServant]\t S.L add to queue")); - } - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::SetManualWizardInfo -// -------------------------------------------------------------------------- -// -void CMSMainContainer::SetManualWizardInfo( TBool aAppWizardRun ) - { - iAppWizardRun = aAppWizardRun; - } - - -// -------------------------------------------------------------------------- -// CMSMainContainer::ShowRefreshIndicationL -// -------------------------------------------------------------------------- -// -void CMSMainContainer::ShowRefreshIndicationL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::ShowRefreshIndicationL")); - - iRefreshRunning = ETrue; - // Start 0 % - HBufC* naviText = StringLoader::LoadLC( - R_MS_NAVI_REFRESHING_TEXT, 0 ); - - // do number conversion - TPtr ptr = naviText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - - UpdateListBoxDataL(); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::StopRefreshL -// -------------------------------------------------------------------------- -// -void CMSMainContainer::StopRefreshL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::StopRefreshL")); - - iRefreshRunning = EFalse; - iSyncRunning = ESyncNotRunning; - iAppUi->FillRuleController()->UpdateArrayL(); - UpdateListBoxDataL(); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::StartSyncL -// -------------------------------------------------------------------------- -// -void CMSMainContainer::StartSyncL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::StartSync")); - - iSyncRunning = ESyncRunning; - TInt error = iAppUi->MSEngine()->ExecuteSyncL(); - - if ( !error ) - { - UpdateListBoxDataL(); - - // set progress to 0% - HBufC* progress = StringLoader::LoadLC( - R_MS_NAVI_SYNC_TEXT, 0 ); - - // do number conversion - TPtr ptr = progress->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iView->SetNavigationPaneTextL( *progress ); - CleanupStack::PopAndDestroy( progress ); - } - else - { - iSyncRunning = ESyncNotRunning; - } - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::StartMetadataDeleteL -// -------------------------------------------------------------------------- -// -void CMSMainContainer::StartMetadataDeleteL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::StartMetadataDeleteL")); - - iAppUi->MSEngine()->DeleteMetadataL(); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::SelectedItemIndex -// returns current item index -// -------------------------------------------------------------------------- -// -TInt CMSMainContainer::SelectedItemIndex() - { - return iListBox->CurrentItemIndex(); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::ShowErrorNoteL -// Shows error note -// -------------------------------------------------------------------------- -// -void CMSMainContainer::ShowErrorNoteL( TInt aTextResource ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::ShowErrorNoteL")); - - HBufC* errorText = StringLoader::LoadLC( aTextResource ); - CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote(); - dlg->ExecuteLD( *errorText ); - CleanupStack::PopAndDestroy( errorText ); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::SetNaviTextLastSyncL -// Sets last synchronization time to navi pane -// -------------------------------------------------------------------------- -// -void CMSMainContainer::SetNaviTextLastSyncL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::SetNaviTextLastSyncL")); - - TTimeIntervalMinutes syncMinutes; - TTimeIntervalHours syncHours; - TTimeIntervalDays syncDays; - - TTime lastSync = iAppUi->MSEngine()->LastSyncTime(); - - if ( lastSync.Int64() > 0 ) - { - // Get current time - TTime time; - time.HomeTime(); - - time.MinutesFrom( lastSync, syncMinutes ); - time.HoursFrom( lastSync, syncHours ); - syncDays = time.DaysFrom( lastSync ); - - - HBufC* naviText = NULL; - - TInt days = syncDays.Int(); - TInt hours = syncHours.Int(); - TInt mins = syncMinutes.Int(); - if ( days > 0 ) - { - naviText = ( days == 1 ? StringLoader::LoadLC( - R_MS_LAST_SYNC_DAY ) : - StringLoader::LoadLC( - R_MS_LAST_SYNC_DAYS, days )); - } - else if ( hours > 0 ) - { - naviText = ( hours == 1 ? StringLoader::LoadLC( - R_MS_LAST_SYNC_HOUR ) : - StringLoader::LoadLC( - R_MS_LAST_SYNC_HOURS, hours )); - } - else if ( mins > 0 ) - { - naviText = ( mins == 1 ? StringLoader::LoadLC( - R_MS_LAST_SYNC_MIN ) : - StringLoader::LoadLC( - R_MS_LAST_SYNC_MINS, mins )); - } - else - { - // do nothing - leave navi pane empty - } - - if ( naviText ) - { - // do number conversion - TPtr ptr = naviText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CMSMainContainer::SizeChanged() - { - // container control resize code. - if ( iListBox ) - { - iListBox->SetRect( Rect() ); // Set rectangle of listbox. - } - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSMainContainer::HandleResourceChange( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect( iView->ClientRect() ); - } - - CCoeControl::HandleResourceChange( aType ); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::TimerCallbackL() -// Periodic timer callback -// -------------------------------------------------------------------------- -// -TInt CMSMainContainer::TimerCallbackL(TAny* aObject) - { - CMSMainContainer* mainContainer = - static_cast(aObject); - TCmServerState state; - mainContainer->iAppUi->MSEngine()->ServerState( state ); - if ( state == ECmServerStateIdle ) - { - mainContainer->SetNaviTextLastSyncL(); - } - return 0; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::NaviTimerCallbackL() -// -------------------------------------------------------------------------- -// -TInt CMSMainContainer::NaviTimerCallbackL(TAny* aObject) - { - CMSMainContainer* mainContainer = - static_cast(aObject); - TCmServerState state; - mainContainer->iAppUi->MSEngine()->ServerState( state ); - - // Clear old text - mainContainer->iView->ClearCurrentNaviPaneText(); - - if ( state == ECmServerStateIdle ) - { - mainContainer->SetNaviTextLastSyncL(); - } - - mainContainer->iNaviTimer->Cancel(); - - return 0; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::BackgroundUpdateListL -// Static callback method for update list box data -// -------------------------------------------------------------------------- -// -TInt CMSMainContainer::BackgroundUpdateListL( TAny* aObject ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::BackgroundUpdateListL")); - TInt reslt = ( ( CMSMainContainer* )aObject )->UpdateListByStepL(); - return reslt; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::UpdateListByStepL -// Update list box data steps -// -------------------------------------------------------------------------- -// -TInt CMSMainContainer::UpdateListByStepL() - { - TRACE(Print(_L("[MediaServant]\t CMSMainContainer:UpdateListByStepL \ - step: %d %d"), iCurStep, iUpdateList->IsActive())); - - // Get file counts and sync time - static TInt staItemsToBeStored( 0 ); - static TInt staItemsToBeFilled( 0 ); - static TInt staSyncTime( 0 ); - static TInt staSyncTimeStore( 0 ); - static TInt staSyncTimeFill( 0 ); - static TBool staDriveSelected( ETrue ); - - switch ( iCurStep ) - { - case EFirstStep: - { - iAppUi->MSEngine()->GetTransferInfo( ECmServiceStore, - staItemsToBeStored, - staSyncTimeStore ); - break; - } - case ESecondStep: - { - iAppUi->MSEngine()->GetTransferInfo( ECmServiceFill, - staItemsToBeFilled, - staSyncTimeFill ); - break; - } - case EThirdStep: - { - staDriveSelected = iAppUi->DriveSelectedL(); - break; - } - case EForthStep: - //fall through - default: - { - TInt icon = EIconSync; - // Create item strings - HBufC* primaryText = NULL; - HBufC* secondaryText = NULL; - - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - if ( itemArray->Count() ) - { - // delete all listbox items - itemArray->Reset(); - } - staSyncTime = staSyncTimeStore + staSyncTimeFill; - //home-sync item - switch ( iSyncRunning ) - { - default: - // fall trough - case ESyncNotRunning: - { - primaryText = StringLoader::LoadLC( - R_MAIN_SYNC_NOW_TEXT ); - if ( staItemsToBeStored > 0 || staItemsToBeFilled > 0 ) - { - if ( staSyncTime/60 > 1 ) // 1 minute - { - secondaryText = StringLoader::LoadLC( - R_MS_SYNC_TIME_TEXT, - staSyncTime/60 ); - // do number conversion - TPtr ptr = secondaryText->Des(); - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( ptr ); - } - else - { - secondaryText = StringLoader::LoadLC( - R_MS_SYNC_TIME_ONE_MIN_TEXT ); - } - } - break; - } - case ESyncRunning: - { - primaryText = StringLoader::LoadLC( - R_MAIN_STOP_SYNC_TEXT ); - icon = EIconSyncStop; - break; - } - case ESyncWaiting: - { - primaryText = StringLoader::LoadLC( - R_MAIN_STOP_SYNC_TEXT ); - secondaryText = StringLoader::LoadLC( - R_MS_SYNC_WAITING_TEXT ); - icon = EIconSyncStop; - break; - } - } - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - icon, - *primaryText, - *secondaryText ); - - if ( secondaryText ) - { - CleanupStack::PopAndDestroy( secondaryText ); - secondaryText = NULL; - } - - if ( primaryText ) - { - CleanupStack::PopAndDestroy( primaryText ); - primaryText = NULL; - } - - // From Home -item - primaryText = StringLoader::LoadLC( R_MAIN_FROM_HOME_TEXT ); - - if ( staDriveSelected == EFalse ) - { - secondaryText = StringLoader::LoadLC( - R_MS_MEMORY_CARD_NEEDED_TEXT ); - } - else if ( !iFillListSelected ) - { - secondaryText = StringLoader::LoadLC( - R_MS_LIST_NOTHING_SELECTED ); - } - else if ( staItemsToBeFilled <= 0 ) - { - secondaryText = StringLoader::LoadLC( - R_MS_ALL_IN_SYNC_TEXT ); - } - - if ( iRefreshRunning || - iPreprocessRunning || - iSyncRunning == ESyncRunning || - staDriveSelected == EFalse ) - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconFromHomeInactive, - *primaryText, - *secondaryText ); - } - else - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconFromHome, - *primaryText, - *secondaryText ); - } - - if ( secondaryText ) - { - CleanupStack::PopAndDestroy( secondaryText ); - secondaryText = NULL; - } - - CleanupStack::PopAndDestroy( primaryText ); - primaryText = NULL; - - // To Home -item - primaryText = StringLoader::LoadLC( R_MAIN_TO_HOME_TEXT ); - - - if ( staItemsToBeStored < 1 ) - { - secondaryText = StringLoader::LoadLC( - R_MS_ALL_IN_SYNC_TEXT ); - } - else if ( staItemsToBeStored == 1 ) - { - secondaryText = StringLoader::LoadLC( - R_MS_SYNC_ONE_NEW_ITEM_TEXT ); - } - else // > 1 - { - secondaryText = StringLoader::LoadLC( - R_MS_SYNC_NEW_ITEMS_TEXT, - staItemsToBeStored ); - // do number conversion - TPtr ptr = secondaryText->Des(); - AknTextUtils:: - DisplayTextLanguageSpecificNumberConversion( ptr ); - } - - if ( iRefreshRunning || - iPreprocessRunning || - iSyncRunning == ESyncRunning ) - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconToHomeInactive, - *primaryText, - *secondaryText ); - } - else - { - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconToHome, - *primaryText, - *secondaryText ); - } - - if ( secondaryText ) - { - CleanupStack::PopAndDestroy( secondaryText ); - secondaryText = NULL; - } - CleanupStack::PopAndDestroy( primaryText ); - primaryText = NULL; - iListBox->DrawNow(); - break; - } - } - TInt theValue = ( TInt )iCurStep; - theValue++; - iCurStep = ( TMSUpdateStep )theValue; - - //complete one refresh request - TInt reslt( 0 ); - if( iCurStep == EEndStep ) - { - iRequestCt--; - if( iRequestCt ) - { - iCurStep = EFirstStep; - } - //if still have request,continue - reslt = iRequestCt; - } - //not the last step, contiue - else - { - reslt = ETrue; - } - return reslt; - } - -// --------------------------------------------------------------------------- -// CMSMainContainer::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSMainContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSMainContainer::GetHelpContext")); - - aContext.iMajor = TUid::Uid(KMediaServantUID3); - aContext.iContext = KMSERV_HLP_MAIN_VIEW; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::MemoryCardChangedL -// Callback to handle mmc insert -// -------------------------------------------------------------------------- -// -void CMSMainContainer::MemoryCardChangedL( TMemoryCardEvent aEvent ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::MemoryCardChangedL start")); - switch ( aEvent ) - { - case EMemoryCardInsert: - { - if( !iAppUi->DriveSelectedL() ) - { - iView->CheckMemoryCardL(); - } - UpdateListBoxDataL(); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSMainContainer::MemoryCardChangedL \ - event not found")); - break; - } - } - LOG(_L("[MediaServant]\t CMSMainContainer::MemoryCardChangedL end")); - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::CheckIfFillListSelected -// -------------------------------------------------------------------------- -// -TBool CMSMainContainer::CheckIfFillListSelected() - { - LOG(_L("[MediaServant]\t CMSMainContainer::CheckIfFillListSelected")); - - TBool listSelected( EFalse ); - RPointerArray* listArray = - iAppUi->FillRuleController()->FillListArray(); - - for ( TInt i = 0; i < listArray->Count(); i++ ) - { - CCmFillRule* list = (*listArray)[i]->List(); - if ( list->Selected() == ECmSelected ) - { - listSelected = ETrue; - i = listArray->Count(); // break loop - } - } - return listSelected; - } - -// -------------------------------------------------------------------------- -// CMSMainContainer::ShowRefreshCompleteTextL -// -------------------------------------------------------------------------- -// -void CMSMainContainer::ShowRefreshCompleteTextL() - { - LOG(_L("[MediaServant]\t CMSMainContainer::ShowRefreshCompleteTextL")); - - HBufC* naviText = StringLoader::LoadLC( R_MS_NAVI_CONTENT_REFRESHED ); - iView->SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - } -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msmainview.cpp --- a/homesync/contentmanager/mediaservant/src/msmainview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,529 +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: CMSMainView class implementation -* -*/ - - - -#include -#include -#include -#include - -#include "msgspluginuids.h" -#include "msstorelistcontroller.h" -#include "cmsettingsfactory.h" -#include "cmsettings.h" -#include "cmdriveinfo.h" -#include "msmaincontainer.h" -#include "mediaservant.hrh" -#include "msgsinterface.h" -#include "msengine.h" -#include "msconstants.h" -#include "msmainview.h" -#include "msappui.h" -#include "msdebug.h" -#include "cmsappwizard.h" - - -// -------------------------------------------------------------------------- -// CMSMainView::CMSMainView() -// -------------------------------------------------------------------------- -// -CMSMainView::CMSMainView(CMSAppUi& aAppUi ) - { - LOG(_L("[MediaServant]\t CMSMainView::CMSMainView")); - - iAppUi = &aAppUi; - iCheckMMC = ETrue; - - } - -// -------------------------------------------------------------------------- -// CMSMainView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSMainView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSMainView::ConstructL")); - - BaseConstructL( R_MS_MAIN_VIEW ); - - TInt error( KErrNone ); - TBool runWizard( EFalse ); - - // Check if wizard has been executed: - runWizard = iAppUi->MSEngine()->GetAppWizardState( error ); - - TRACE( Print(_L("[MediaServant]\t CMSMainView::ConstructL \ - wizard state error = %d"), error )); - - if ( error == KErrNone && !runWizard ) - { - // prevent user events handling - iWizardInitialization = ETrue; - iIdle = CIdle::NewL( CActive::EPriorityIdle ); - TCallBack cb( InitializeWizardL, this ); - iIdle->Start( cb ); - } - else - { - iIdle = CIdle::NewL( CActive::EPriorityIdle ); - TCallBack cb( InitializeMemoryCardL, this ); - iIdle->Start( cb ); - } - } - -// -------------------------------------------------------------------------- -// CMSMainView::~CMSMainView() -// -------------------------------------------------------------------------- -// -CMSMainView::~CMSMainView() - { - LOG(_L("[MediaServant]\t CMSMainView::~CMSMainView")); - - delete iIdle; - - DoDeactivate(); - } -// -------------------------------------------------------------------------- -// TUid CMSMainView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSMainView::Id() const - { - LOG(_L("[MediaServant]\t CMSMainView::Id")); - - return KMSMainViewId; - } - -// -------------------------------------------------------------------------- -// CMSFillView::FocusIndex() -// -------------------------------------------------------------------------- -// -TInt CMSMainView::FocusIndex() const - { - return iContainer->SelectedItemIndex(); - } - -// -------------------------------------------------------------------------- -// CMSMainView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSMainView::HandleCommandL( TInt aCommand ) - { - LOG(_L("[MediaServant]\t CMSMainView::HandleCommandL")); - - if ( !iWizardInitialization ) - { - switch ( aCommand ) - { - case EMSCmdSelect: - // fall through - case EAknCmdOpen: - // fall through: - case EAknSoftkeyOpen: - // fall through: - case EAknSoftkeySelect: - { - iContainer->OpenSelectedListboxItemL(); - break; - } - - case EMSCmdStartHarvest: - { - iAppUi->MSEngine()->ScanMediaServersL(); - iContainer->ShowRefreshIndicationL(); - break; - } - - case EMSCmdStopHarvest: - { - // clear navi pane - ClearCurrentNaviPaneText(); - - iAppUi->MSEngine()->StopOperation(); - iContainer->StopRefreshL(); - break; - } - - case EMSCmdSettings: - { - if ( iAppUi->SettingsPlugin() ) - { - // activate plugin - iAppUi->ActivateLocalViewL( - iAppUi->SettingsPlugin()->Id() ); - } - break; - } - case EMSCmdRunWizard: - { - LOG(_L("[MediaServant]\t CMSMainView::\ - HandleCommandL WIZARD")); - TBool wizRetVal(KErrNone); - CMSAppWizard* wiz = - CMSAppWizard::NewL( *iAppUi->MSEngine() ); - CleanupStack::PushL( wiz ); - wizRetVal = wiz->StartL(); - - iAppUi->RefreshListsL(); - CleanupStack::PopAndDestroy( wiz ); - - if( wizRetVal != KErrNone ) - { - // Start harvest: - LOG(_L("[MediaServant]\t CMSMainView::\ - HandleCommandL WIZARD, Start Harvest")); - iContainer->SetManualWizardInfo( ETrue ); - iContainer->StartMetadataDeleteL(); - iContainer->ShowRefreshIndicationL(); - } - - break; - } - - case EAknCmdHelp : - { - - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - } - - - -// -------------------------------------------------------------------------- -// CMSMainView::DoActivateL(...) -// -------------------------------------------------------------------------- -// -void CMSMainView::DoActivateL( - const TVwsViewId& aPrevViewId, TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - LOG(_L("[MediaServant]\t CMSMainView::DoActivateL")); - if( KMSGSImplementationUid == aPrevViewId.iViewUid ) - { - // Refresh store and fill rules array from server. - iAppUi->RefreshListsL(); - - CCmStoreRuleContainer* container = - ( iAppUi->StoreListController() )->StoreListContainer(); - // update the Table transferInfo - iAppUi->MSEngine()->SetStoreRulesL( container ); - } - - // Set title pane text to default - SetTitlePaneTextL( KMSDefaultTitleId ); - - if ( !iContainer ) - { - iContainer = new (ELeave) CMSMainContainer( *iAppUi, - *this ); - iContainer->ConstructL( ClientRect() ); - iContainer->SetMopParent( this ); - AppUi()->AddToViewStackL( *this, iContainer ); - } - } - -// -------------------------------------------------------------------------- -// CMSMainView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSMainView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSMainView::DoDeactivate")); - - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; // Deletes the container class object. - iContainer = NULL; - - ClearCurrentNaviPaneText(); - } - -// -------------------------------------------------------------------------- -// CMSMainView::DynInitMenuPaneL -// -------------------------------------------------------------------------- -// -void CMSMainView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane) - { - LOG(_L("[MediaServant]\t CMSMainView::DynInitMenuPaneL")); - - TCmServerState state; - - if (aResourceId == R_MAIN_VIEW_MENU ) - { - iAppUi->MSEngine()->ServerState( state ); - - switch ( state ) - { - case ECmServerStateHarvesting: - { - aMenuPane->SetItemDimmed(EMSCmdStartHarvest, ETrue); - aMenuPane->SetItemDimmed(EMSCmdSettings, ETrue); - aMenuPane->SetItemDimmed(EMSCmdRunWizard, ETrue); - break; - } - case ECmServerStateDeleting: - // fall through - case ECmServerStateFilling: - // fall through - case ECmServerStateStoring: - // fall through - case ECmServicePreProcessingStore: - // fall through - case ECmServicePreProcessingFill: - { - aMenuPane->SetItemDimmed(EMSCmdStartHarvest, ETrue); - aMenuPane->SetItemDimmed(EMSCmdStopHarvest, ETrue); - aMenuPane->SetItemDimmed(EMSCmdSettings, ETrue); - aMenuPane->SetItemDimmed(EMSCmdRunWizard, ETrue); - break; - } - default: - { - aMenuPane->SetItemDimmed(EMSCmdStopHarvest, ETrue); - } - } - - // sync item highlighted - if ( iContainer->SelectedItemIndex() == 0 ) - { - aMenuPane->SetItemDimmed( EAknCmdOpen, ETrue ); - } - else - { - aMenuPane->SetItemDimmed( EMSCmdSelect, ETrue ); - } - - } - } - -// -------------------------------------------------------------------------- -// CMSMainView::SetCbaL() -// Changes softkeys -// -------------------------------------------------------------------------- -// -void CMSMainView::SetCbaL( TBool aHighlightedIndex ) - { - CEikButtonGroupContainer* cba = Cba(); - - if ( aHighlightedIndex == EStoreAndFill ) - { - cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT ); - } - else - { - cba->SetCommandSetL( R_MS_SOFTKEYS_OPTIONS_BACK__OPEN ); - } - cba->DrawDeferred(); - } - -// -------------------------------------------------------------------------- -// CMSMainView::CheckMemoryCardL -// Checks if memory card has been changed -// -------------------------------------------------------------------------- -// -void CMSMainView::CheckMemoryCardL() - { - LOG(_L("[MediaServant]\t CMSMainView::CheckMemoryCardL")); - - RFs& fileServer = iAppUi->FsSession(); - RPointerArray storedDrives; - CleanupClosePushL( storedDrives ); - RPointerArray driveArray; - CleanupClosePushL( driveArray ); - - MCmSettings* settings = CCmSettingsFactory::NewCmSettingsEngineLC(); - - // read stored info of stored drives - iAppUi->MSEngine()->GetDrivesL( storedDrives ); - - // get system drive info - settings->DriveListL( fileServer, driveArray ); - - TInt count = driveArray.Count(); - - for ( TInt i = 0; i < count; i++ ) - { - TRACE( - Print(_L("[MediaServant]\t CMSMainView::drivearray type = %d"), \ - driveArray[i]->DriveType())); - - // check if mmc card is found - if ( driveArray[i]->DriveType() == DriveInfo::EDriveRemovable ) - { - // check if memory card is used before - TIdentityRelation relation(CMSAppUi::CompareIds ); - TInt index = storedDrives.Find( driveArray[i], relation ); - if ( index == KErrNotFound ) - { - ShowAndHandleMMCQueryL( *&storedDrives, - *&driveArray, - i ); - - iAppUi->MSEngine()->ExecuteStorePreProcessingL(); - - i = count; // break loop - } - } - } - - settings->Close(); - CleanupStack::Pop(); // settings - driveArray.ResetAndDestroy(); - storedDrives.ResetAndDestroy(); - CleanupStack::PopAndDestroy( 2, &storedDrives ); - } - -// -------------------------------------------------------------------------- -// CMSMainView::ShowAndHandleMMCQueryL -// Shows mmc query and handles selection -// -------------------------------------------------------------------------- -// -void CMSMainView::ShowAndHandleMMCQueryL( - RPointerArray& aStoredArray, - RPointerArray& aDriveArray, - TInt index ) - { - LOG(_L("[MediaServant]\t CMSMainView::ShowAndHandleMMCQueryL")); - - // Show delete files query - CAknQueryDialog* query= CAknQueryDialog::NewL( - CAknQueryDialog::ENoTone ); - - if ( query->ExecuteLD( R_MSERV_MMC_QUERY ) ) - { - TInt driveCount = aStoredArray.Count(); - // search and delete existing mmc card info - for ( TInt i = driveCount - 1 ; i >= 0 ; i-- ) - { - TRACE( Print( _L("[MediaServant]\t CMSAppUi::storedarray \ - type = %d"), aStoredArray[i]->DriveType() ) ); - if ( aStoredArray[i]->DriveType() == DriveInfo::EDriveRemovable ) - { - delete aStoredArray[i]; - aStoredArray[i] = NULL; - aStoredArray.Remove(i); - LOG(_L("[MediaServant]\t CMSMainView::CheckMemoryCardL \ - old mmc info removed")); - } - } - TInt64 quota = - ( aDriveArray[index]->DriveSize() * KMMCDefaultQuota ) / 100; - aDriveArray[index]->SetDriveQuota( quota ); - aDriveArray[index]->SetStatus( ETrue ); - // then append new one - aStoredArray.Append( aDriveArray[index] ); - // ownership transferred->remove pointer from drivearray - aDriveArray.Remove(index); - - // store drives - iAppUi->MSEngine()->SetDrivesL( aStoredArray ); - } - } - -// -------------------------------------------------------------------------- -// CMSMainView::InitializeWizardL -// Starts the wizard when run first time -// -------------------------------------------------------------------------- -// -TBool CMSMainView::InitializeWizardL( TAny* aPtr ) - { - CMSMainView* main = static_cast< CMSMainView* >( aPtr ); - - return main->DoInitializeWizardL(); - } - -// -------------------------------------------------------------------------- -// CMSMainView::InitializeMemoryCardL -// Starts the new memroy card when new memory card inserted -// -------------------------------------------------------------------------- -// -TInt CMSMainView::InitializeMemoryCardL( TAny* aPtr ) - { - CMSMainView* main = static_cast< CMSMainView* >( aPtr ); - - main->DoInitializeMemoryCardL(); - - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CMSMainView::DoInitializeWizardL -// Do starts the wizard when run first time -// -------------------------------------------------------------------------- -// -TBool CMSMainView::DoInitializeWizardL() - { - LOG(_L("[MediaServant]\t CMSAppUi::DoInitializeWizardL")); - TInt wizRetVal(KErrNone); - - TRAPD( error, wizRetVal = iAppUi->RunWizardL() ); - - if ( error ) - { - TRACE(Print(_L("[MediaServant]\t DoInitializeWizardL::\ - wizard error value: %d"), error)); - } - - if( wizRetVal != KErrNone) - { - iContainer->SetManualWizardInfo( ETrue ); - iAppUi->RefreshListsL(); - iContainer->StartMetadataDeleteL(); - iContainer->ShowRefreshIndicationL(); - } - else - { - TRACE(Print(_L("[MediaServant]\t DoInitializeWizardL::\ - wizard return value: %d"), wizRetVal)); - // wizard cancelled. Check memory card - iContainer->MemoryCardChangedL(EMemoryCardInsert); - } - - // let view to respond user events again - iWizardInitialization = EFalse; - - // must return EFalse because this is not called anymore - return EFalse; - } - -// -------------------------------------------------------------------------- -// CMSMainView::DoInitializeMemoryCardL -// Do Starts the new memroy card when new memory card dialog inserted -// -------------------------------------------------------------------------- -// -void CMSMainView::DoInitializeMemoryCardL() - { - CheckMemoryCardL(); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msmemorycardmonitor.cpp --- a/homesync/contentmanager/mediaservant/src/msmemorycardmonitor.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +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: CMSMemoryCardMonitor implementation -* -*/ - -#include - -#include "msmemorycardmonitor.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::NewL -// --------------------------------------------------------------------------- -// -CMSMemoryCardMonitor* CMSMemoryCardMonitor::NewL( - MMSMemoryCardObserver* aObserver, RFs& aRfs ) - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::NewL")); - - CMSMemoryCardMonitor* self = CMSMemoryCardMonitor::NewLC( aObserver, - aRfs ); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::NewLC -// --------------------------------------------------------------------------- -// -CMSMemoryCardMonitor* CMSMemoryCardMonitor::NewLC( - MMSMemoryCardObserver* aObserver, RFs& aRfs ) - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::NewLC")); - - CMSMemoryCardMonitor* self = - new(ELeave) CMSMemoryCardMonitor( aObserver, aRfs ); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::ConstructL -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CMSMemoryCardMonitor::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::CMSMemoryCardMonitor -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -CMSMemoryCardMonitor::CMSMemoryCardMonitor( MMSMemoryCardObserver* aObserver, - RFs& aRfs ) - : CActive( EPriorityIdle ), - iObserver( aObserver ), - iFsSession( aRfs ), - iMemoryCardExist( EFalse ) - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::CMSMemoryCardMonitor")); - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::~CMSMemoryCardMonitor -// Destructor -// --------------------------------------------------------------------------- -// -CMSMemoryCardMonitor::~CMSMemoryCardMonitor() - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::~CMSMemoryCardMonitor")); - - Cancel(); - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::DoCancel -// cancel monitor -// --------------------------------------------------------------------------- -// -void CMSMemoryCardMonitor::DoCancel() - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::DoCancel() start")); - iFsSession.NotifyChangeCancel(); - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::DoCancel() end")); - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::RunL -// RunL -// --------------------------------------------------------------------------- -// -void CMSMemoryCardMonitor::RunL() - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::RunL() start")); - TMemoryCardEvent mmcevent( EMemoryCardOthers ); - TBool mmc = MemoryCardExist(); - - TRACE(Print(_L("[MediaServant]\t CMSMemoryCardMonitor::Runl %d-->%d\n"), - iMemoryCardExist, mmc )); - - if( iMemoryCardExist && !mmc ) - { - mmcevent = EMemoryCardRemove; - } - else if( !iMemoryCardExist && mmc ) - { - mmcevent = EMemoryCardInsert; - } - - if( mmcevent != EMemoryCardOthers && iObserver ) - { - iObserver->MemoryCardChangedL( mmcevent ); - } - - StartMonitor(); - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::RunError -// RunError -// --------------------------------------------------------------------------- -// -TInt CMSMemoryCardMonitor::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::StartMonitor -// start -// --------------------------------------------------------------------------- -// -void CMSMemoryCardMonitor::StartMonitor() - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::StartMonitor")); - if ( IsActive() ) - { - Cancel(); - } - iMemoryCardExist = MemoryCardExist(); - iFsSession.NotifyChange( ENotifyDisk, iStatus ); - SetActive(); - } - -// --------------------------------------------------------------------------- -// CMSMemoryCardMonitor::MemoryCardExist -// Get the mmc status -// --------------------------------------------------------------------------- -// -TBool CMSMemoryCardMonitor::MemoryCardExist() const - { - LOG(_L("[MediaServant]\t CMSMemoryCardMonitor::MemoryCardExist")); - - TBool mmcstatus( EFalse ); - TDriveList list; - iFsSession.DriveList( list ); - - for( TInt driveNumber = 0 ; driveNumber <= EDriveZ ; driveNumber++ ) - { - if( list[driveNumber] ) // Is memorycard available - { - TDriveInfo driveInfo; - iFsSession.Drive( driveInfo, driveNumber ); - TUint drvStatus( 0 ); - User::LeaveIfError( DriveInfo::GetDriveStatus( iFsSession, - driveNumber, - drvStatus ) ); - TInt removableStatus = drvStatus & DriveInfo::EDriveRemovable; - - // Check if drive is memory card - if( removableStatus && ( driveInfo.iType != EMediaNotPresent ) ) - { - mmcstatus = ETrue; - driveNumber = EDriveZ + 1; - } - } - } - return mmcstatus; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msmetadatacollector.cpp --- a/homesync/contentmanager/mediaservant/src/msmetadatacollector.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,295 +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: Collects metadata based on user selections -* -*/ - - -// INCLUDES -#include -#include "cmsqlpropertycontainer.h" -#include "cmsqlpropertyitem.h" -#include "cmsqlpropertycollector.h" -#include "msmetadatacollector.h" -#include "msappui.h" -#include "msengine.h" -#include "msdebug.h" - - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CMSMetadataCollector* CMSMetadataCollector::NewL( - CMSAppUi& aMSAppUi, - TCmMediaType aMediaType, - RArray& aGenreArray, - RArray& aArtistArray, - RArray& aAlbumArray, - RArray& aTrackArray ) - { - LOG(_L("[MediaServant]\t CMSMetadataCollector::NewL")); - - CMSMetadataCollector* self = CMSMetadataCollector::NewLC( - aMSAppUi, - aMediaType, - aGenreArray, - aArtistArray, - aAlbumArray, - aTrackArray ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CMSMetadataCollector* CMSMetadataCollector::NewLC( - CMSAppUi& aAppUi, - TCmMediaType aMediaType, - RArray& aGenreArray, - RArray& aArtistArray, - RArray& aAlbumArray, - RArray& aTrackArray ) - { - LOG(_L("[MediaServant]\t CMSMetadataCollector::NewLC")); - - CMSMetadataCollector* self = new ( ELeave ) CMSMetadataCollector( - aAppUi, - aMediaType, - aGenreArray, - aArtistArray, - aAlbumArray, - aTrackArray ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CMSMetadataCollector::~CMSMetadataCollector() - { - LOG(_L("[MediaServant]\t CMSMetadataCollector::~CMSMetadataCollector")); - - delete iMetadataCollector; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CMSMetadataCollector::CMSMetadataCollector( CMSAppUi& aMSAppUi, - TCmMediaType aMediaType, - RArray& aGenreArray, - RArray& aArtistArray, - RArray& aAlbumArray, - RArray& aTrackArray ) : - iMSAppUi( &aMSAppUi ), - iMediaType( aMediaType ), - iGenreArray( &aGenreArray ), - iArtistArray( &aArtistArray ), - iAlbumArray( &aAlbumArray ), - iTrackArray( &aTrackArray ) - { - } - -// --------------------------------------------------------------------------- -// CMSMetadataCollector::ConstructL -// --------------------------------------------------------------------------- -// -void CMSMetadataCollector::ConstructL() - { - LOG(_L("[MediaServant]\t CMSMetadataCollector::ConstructL")); - - iMetadataCollector = CCmSqlPropertyCollector::NewL(); - AddContainersL(); - - GetFilteredMetadataL(); - } - - -// --------------------------------------------------------------------------- -//CMSMetadataCollector::GetFilteredMetadataL -// --------------------------------------------------------------------------- -// -void CMSMetadataCollector::GetFilteredMetadataL() - { - LOG(_L("[MediaServant]\t CMSMetadataCollector::GetFilteredMetadataL")); - - DeleteAllItems(); - - // TRACKS - this is both video titles and music tracks - for ( TInt index = 0; index < iTrackArray->Count(); index++ ) - { - CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC(); - - item->SetId( (*iTrackArray)[index] ); - - - CCmSqlPropertyContainer* container = - iMetadataCollector->PropertyContainer( ETracks ); - container->AddPropertyItemL( item ); - CleanupStack::Pop( item ); - } - - if ( iMediaType == ECmAudio ) - { - // ARTISTS - for ( TInt index = 0; index < iArtistArray->Count(); index++ ) - { - CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC(); - item->SetId( (*iArtistArray)[index] ); - - CCmSqlPropertyContainer* container = - iMetadataCollector->PropertyContainer( EArtists ); - container->AddPropertyItemL( item ); - CleanupStack::Pop( item ); - } - - // GENRES - for ( TInt index = 0; index < iGenreArray->Count(); index++ ) - { - CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC(); - item->SetId( (*iGenreArray)[index] ); - - CCmSqlPropertyContainer* container = - iMetadataCollector->PropertyContainer( EGenres ); - container->AddPropertyItemL( item ); - - CleanupStack::Pop( item ); - } - - // ALBUMS - for ( TInt index = 0; index < iAlbumArray->Count(); index++ ) - { - CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC(); - item->SetId( (*iAlbumArray)[index] ); - - CCmSqlPropertyContainer* container = - iMetadataCollector->PropertyContainer( EAlbums ); - container->AddPropertyItemL( item ); - - CleanupStack::Pop( item ); - } - } - - // Start asynchronous metadata query. - // Engine observer's ReadyL will be called when ready - iMSAppUi->MSEngine()->GetFilteredMetadataL( iMetadataCollector ); - } - -// -------------------------------------------------------------------------- -//CMSMetadataCollector::DeleteAllItems -// -------------------------------------------------------------------------- -// -void CMSMetadataCollector::DeleteAllItems() - { - LOG(_L("[MediaServant]\t CMSMetadataCollector::DeleteAllItems")); - - for ( TInt index = 0; - index < iMetadataCollector->PropertyContainerCount(); - index++ ) - { - CCmSqlPropertyContainer* container = - iMetadataCollector->PropertyContainer( index ); - for ( TInt idx = 0; idx < container->PropertyItemCount(); idx++ ) - { - container->DeletePropertyItem( idx-- ); - } - } - } - -// -------------------------------------------------------------------------- -//CMSMetadataCollector::AddContainersL -// -------------------------------------------------------------------------- -// -void CMSMetadataCollector::AddContainersL() - { - LOG(_L("[MediaServant]\t CMSMetadataCollector::AddContainersL")); - - // tracks - // this container is used both videos and music - CCmSqlPropertyContainer* trackContainer = - CCmSqlPropertyContainer::NewLC(); - trackContainer->SetType( ECmTitle ); - iMetadataCollector->AddPropertyContainerL( trackContainer ); - CleanupStack::Pop( trackContainer ); - - if ( iMediaType == ECmAudio ) - { - // artists - CCmSqlPropertyContainer* artistContainer = - CCmSqlPropertyContainer::NewLC(); - artistContainer->SetType( ECmArtist ); - iMetadataCollector->AddPropertyContainerL( artistContainer ); - CleanupStack::Pop( artistContainer ); - - // genres - CCmSqlPropertyContainer* genreContainer = - CCmSqlPropertyContainer::NewLC(); - genreContainer->SetType( ECmGenre ); - iMetadataCollector->AddPropertyContainerL( genreContainer ); - CleanupStack::Pop( genreContainer ); - - // albums - CCmSqlPropertyContainer* albumContainer = - CCmSqlPropertyContainer::NewLC(); - albumContainer->SetType( ECmAlbum ); - iMetadataCollector->AddPropertyContainerL( albumContainer ); - CleanupStack::Pop( albumContainer ); - } - } - -// --------------------------------------------------------------------------- -//CMSMetadataCollector::Genres -// --------------------------------------------------------------------------- -// -CCmSqlPropertyContainer* CMSMetadataCollector::Genres() - { - return iMetadataCollector->PropertyContainer( EGenres ); - } - -// --------------------------------------------------------------------------- -//CMSMetadataCollector::Artists -// --------------------------------------------------------------------------- -// -CCmSqlPropertyContainer* CMSMetadataCollector::Artists() - { - return iMetadataCollector->PropertyContainer( EArtists ); - } - -// --------------------------------------------------------------------------- -//CMSMetadataCollector::Albums -// --------------------------------------------------------------------------- -// -CCmSqlPropertyContainer* CMSMetadataCollector::Albums() - { - return iMetadataCollector->PropertyContainer( EAlbums ); - } - -// --------------------------------------------------------------------------- -//CMSMetadataCollector::Tracks -// --------------------------------------------------------------------------- -// -CCmSqlPropertyContainer* CMSMetadataCollector::Tracks() - { - return iMetadataCollector->PropertyContainer( ETracks ); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msmultiselectiondialog.cpp --- a/homesync/contentmanager/mediaservant/src/msmultiselectiondialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,489 +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: CMSMultiselectionDialog class implementation -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include - -#include "msmultiselectiondialog.h" -#include "mediaservant.hrh" -#include "msconstants.h" -#include "msdebug.h" - - -//CONSTANTS - -// Reserved list items at a time -const TInt KListGranularity = 10; -// Used for item icon definition -_LIT(KOneSlashT, "1\t"); - - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::NewL -// -------------------------------------------------------------------------- -// -CMSMultiselectionDialog* CMSMultiselectionDialog::NewL( - CSelectionItemList* aItemArray, - const TDesC& aTitle ) - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::NewL")); - - CMSMultiselectionDialog* self = - CMSMultiselectionDialog::NewLC( aItemArray, aTitle ); - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::NewLC -// -------------------------------------------------------------------------- -// -CMSMultiselectionDialog* CMSMultiselectionDialog::NewLC( - CSelectionItemList* aItemArray, - const TDesC& aTitle ) - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::NewLC")); - - CMSMultiselectionDialog* self = - new(ELeave) CMSMultiselectionDialog( aItemArray ); - - CleanupStack::PushL(self); - self->ConstructL( aTitle ); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::ConstructL( const TDesC& aTitle ) - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\ - ConstructL")); - - // base class call - // menubar id has no effect because options menu is not used - CAknSelectionListDialog::ConstructL( R_MS_MENUBAR_MAIN_VIEW ); - - // keep safe previous view title - iPreviousTitle = HBufC::NewL( KMaxFileName ); - - // set dialog title - CEikStatusPane* statusPane = - (( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); - iTitlePane = (CAknTitlePane*)statusPane->ControlL( - TUid::Uid(EEikStatusPaneUidTitle)); - // keep previous title safe - iPreviousTitle->Des().Copy( *iTitlePane->Text() ); - // set new title - iTitlePane->SetTextL(aTitle); - } - - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::CMSMultiselectionDialog -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CMSMultiselectionDialog::CMSMultiselectionDialog( - CSelectionItemList* aItemArray) -: CAknSelectionListDialog(iSelectedItem, NULL, NULL), - iItemArray (aItemArray) - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog:: \ - CMSMultiselectionDialog")); - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::CMSMultiselectionDialog -// C++ default destructor. -// -------------------------------------------------------------------------- -// -CMSMultiselectionDialog::~CMSMultiselectionDialog() - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog:: \ - ~CMSMultiselectionDialog")); - - // set previous title back - if( iTitlePane ) - { - TInt error = KErrNone; - TRAP( error, iTitlePane->SetTextL( *iPreviousTitle ) ); - if( error ) - { - TRACE( Print(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog\ - SetTextL error %d\n"),error ) ); - } - } - - delete iPreviousTitle; - - delete iInternalItemArray; - - delete iNaviDecorator; - } - - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::OkToExitL(TInt aButtonId) -// called by framework when the softkey is pressed -// -------------------------------------------------------------------------- -// -TBool CMSMultiselectionDialog::OkToExitL(TInt aButtonId) - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\ - OkToExitL")); - - TBool retval = ETrue; - - // When using middle softkey list update must be called from - // this way because dialog doesn't receive middle softkey key - // event. - if ( aButtonId == EAknSoftkeyChange ) - { - HandleSelectionKeyPressL(); - // don't exit dialog - retval = EFalse; - } - - if ( retval ) - { - // Update item selections to the list - UpdateAllSelectionsL(); - - // Clear navi pane text - iNaviPane->Pop( iNaviDecorator ); - - if ( aButtonId == EAknSoftkeyBack ) - { - iAvkonAppUi->ProcessCommandL( EEikCmdExit ); - } - } - - return retval; - } - - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::PreLayoutDynInitL() -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::PreLayoutDynInitL() - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog:: \ - PreLayoutDynInitL")); - - iListBox = static_cast - (Control(EMultiSelectionListBoxId)); - - // display find box - SetupFind(CAknSelectionListDialog::EFixedFind); - - CAknIconArray* icons = new (ELeave) CAknIconArray(2); //magic: icon count - CleanupStack::PushL( icons ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName() ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOn, - EMbmAvkonQgn_indi_checkbox_on, - EMbmAvkonQgn_indi_checkbox_on_mask ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOff, - EMbmAvkonQgn_indi_checkbox_off, - EMbmAvkonQgn_indi_checkbox_off_mask ); - - - iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons); - CleanupStack::Pop(icons); - - GenerateInternalArrayL(); - - CEikStatusPane* statusPane=iEikonEnv->AppUiFactory()->StatusPane(); - - // Set empty navi pane text - iNaviPane = static_cast - ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); - // ownership of decorator is transfered to application - iNaviDecorator = iNaviPane->CreateNavigationLabelL( _L("") ); - iNaviPane->PushL( *iNaviDecorator ); - - iListBox->ActivateL(); - CAknSelectionListDialog::PreLayoutDynInitL(); - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::HandleSelectionKeyPressL() -// handles middle softkey press -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::HandleSelectionKeyPressL() - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\ - HandleSelectionKeyPressL")); - // Make special selection handling - HandleSelectionsL(); - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionSettingPage::HandlePointerEventL -// called by framework when the pointer device is pressed -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::HandlePointerEventL( - const TPointerEvent& aPointerEvent ) - { - CCoeControl::HandlePointerEventL( aPointerEvent ); - - if ( TPointerEvent::EButton1Up == aPointerEvent.iType ) - { - HandleSelectionKeyPressL(); - } - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::AppendIconToArray -// Load a possibly skinned icon (with mask) and append it to an -// icon array. -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId) const - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\ - AppendIconToArrayL")); - - __ASSERT_DEBUG( aArray, User::Leave(KErrArgument) ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC(aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId); - - CGulIcon* icon = CGulIcon::NewL(bitmap, mask); - icon->SetBitmapsOwnedExternally(EFalse); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop(2); // mask, bitmap - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL(icon); - - aArray->AppendL(icon); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(icon); - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::GenerateInternalArrayL -// Creates an internal array shown by listbox -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::GenerateInternalArrayL() - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\ - GenerateInternalArrayL")); - - - // delete existing array - delete iInternalItemArray; - iInternalItemArray = 0; - - // Make a new owned text array from the input one: - iInternalItemArray = new(ELeave)CDesCArrayFlat( KListGranularity ); - TInt count = iItemArray->Count(); - - for (TInt index = 0; index < count; index++) - { - // Fill up the control-owned space for the modified buffers: - TInt newLen = - ((*iItemArray)[index]->ItemText()).Length() + - KOneSlashT().Length(); - - HBufC* newText = HBufC::NewMaxLC( newLen ); - - TPtr newTPtr = newText->Des(); - newTPtr.Copy( ((*iItemArray)[index])->ItemText() ); - - // replace '\t' with space - TInt offset = newTPtr.Find( KSlashT ); - if ( offset >= 0 ) - { - TInt replaceCount = KSlashT().Length(); - newTPtr.Replace( offset, replaceCount, KSPaceT ); - } - - newTPtr.Insert( 0, KOneSlashT ); // magic: insert to the beginning - - // A copy of the new buffer goes to the internal itemarray: - iInternalItemArray->AppendL(newTPtr); - CleanupStack::PopAndDestroy( newText ); - } - - CTextListBoxModel* model=iListBox->Model(); - model->SetItemTextArray(iInternalItemArray); - model->SetOwnershipType(ELbmDoesNotOwnItemArray); - - // Transfer the selected status from - // the input array into the listbox view - SetAllSelectionsL(); - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::SetAllSelectionsL -// Sets selection status of items -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::SetAllSelectionsL() - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\ - SetAllSelectionsL")); - - TInt count = iItemArray->Count(); - - CListBoxView* view = iListBox->View(); - - for (TInt index = 0; index < count; index++) - { - if ( (*iItemArray)[ index ]->SelectionStatus() ) - { - view->SelectItemL( index ); - } - else - { - view->DeselectItem( index ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionSettingPage::HandleSelectionsL -// Removes selection marks from other items if first one is selected -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::HandleSelectionsL() - { - LOG(_L("[MediaServant]\t CMSMultiselectionDialog::\ - HandleSelectionsL")); - CAknListBoxFilterItems* filter = - static_cast < CAknFilteredTextListBoxModel* > - ( iListBox->Model() )->Filter(); - const CArrayFix* indexes = iListBox->View()->SelectionIndexes(); - if ( indexes->Count() ) - { - TKeyArrayFix sortKey(0,ECmpTUint); - TInt dummy; - if ( FindBox()->TextLength() == 0 || - filter->VisibleItemIndex( 0 ) != KErrNotFound ) - { - // Check if first item is selected - if ( indexes->Find(0, sortKey, dummy) == 0 ) - { - // clear all - iListBox->View()->ClearSelection(); - - // select current item - iListBox->View()->SelectItemL( iListBox->CurrentItemIndex() ); - } - else // first item not selected - { - // check if first item is highlighted - if ( iListBox->CurrentItemIndex() == 0 ) - { - // remove all selections... - iListBox->View()->ClearSelection(); - } - //...and toggle highlighted item - iListBox->View()->ToggleItemL( iListBox->CurrentItemIndex() ); - - // check if we don't have selected items - if ( indexes->Count() == 0 ) - { - // check the first one - iListBox->View()->SelectItemL(0); - } - } - } - else - { - //...and toggle highlighted item - iListBox->View()->ToggleItemL( iListBox->CurrentItemIndex() ); - - // check if we don't have selected items - if ( indexes->Count() == 0 ) - { - // check the first one - iListBox->View()->SelectItemL(0); - } - } - } - else // no items selected - { - iListBox->View()->SelectItemL(0); - } - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionDialog::UpdateAllSelectionsL -// Updates selection status of the items in the item array -// -------------------------------------------------------------------------- -// -void CMSMultiselectionDialog::UpdateAllSelectionsL() - { - LOG(_L("[UPNP_HOMECONNECT]\t CMSMultiselectionDialog::\ - UpdateAllSelectionsL")); - - TInt count = iItemArray->Count(); - - CAknListBoxFilterItems* filter - = static_cast < CAknFilteredTextListBoxModel* > - ( iListBox->Model() )->Filter(); - // reset filtering so that real selected indexes can be get - filter->ResetFilteringL(); - - CListBoxView* view = iListBox->View(); - - for (TInt index = 0; index < count; index++) - { - (*iItemArray)[ index ]->SetSelectionStatus( - view->ItemIsSelected( index ) ); - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msmultiselectionsettingpage.cpp --- a/homesync/contentmanager/mediaservant/src/msmultiselectionsettingpage.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +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: CMSMultiselectionSettingPage class implementation -* -*/ - - -#include -#include "msmultiselectionsettingpage.h" -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSMultiSelectionSettingPage::NewL -// -------------------------------------------------------------------------- -// -CMSMultiselectionSettingPage* CMSMultiselectionSettingPage::NewL( - TInt aIdentifier, - CSelectionItemList& aItemArray, - TBool aFirstItemSwitch ) - { - LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::NewL")); - - CMSMultiselectionSettingPage* self = - CMSMultiselectionSettingPage::NewLC( aIdentifier, - aItemArray, - aFirstItemSwitch ); - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSMultiSelectionSettingPage::NewLC -// -------------------------------------------------------------------------- -// -CMSMultiselectionSettingPage* CMSMultiselectionSettingPage::NewLC( - TInt aIdentifier, - CSelectionItemList& aItemArray, - TBool aFirstItemSwitch ) - { - LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::NewLC")); - - CMSMultiselectionSettingPage* self = new (ELeave) - CMSMultiselectionSettingPage( aIdentifier, - aItemArray, - aFirstItemSwitch ); - - CleanupStack::PushL(self); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSMultiSelectionSettingPage::ConstructL -// -------------------------------------------------------------------------- -// -void CMSMultiselectionSettingPage::ConstructL() - { - LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::ConstructL")); - - CAknCheckBoxSettingPage::ConstructL(); - } - -// -------------------------------------------------------------------------- -// CMSMultiSelectionSettingPage::CMSMultiSelectionSettingPage -// -------------------------------------------------------------------------- -// -CMSMultiselectionSettingPage::CMSMultiselectionSettingPage( - TInt aIdentifier, - CSelectionItemList& aItemArray, - TBool aFirstItemSwitch - ) : - CAknCheckBoxSettingPage( aIdentifier, &aItemArray ), - iItemArray ( &aItemArray ), - iFirstItemSwitch ( aFirstItemSwitch ) - { - } - -// -------------------------------------------------------------------------- -// CMSMultiSelectionSettingPage::~CMSMultiSelectionSettingPage() -// -------------------------------------------------------------------------- -// -CMSMultiselectionSettingPage::~CMSMultiselectionSettingPage() - { - LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::\ - ~CMSMultiSelectionSettingPage")); - - } - -// -------------------------------------------------------------------------- -// CMSMultiSelectionSettingPage::SelectCurrentItemL() -// -------------------------------------------------------------------------- -// -void CMSMultiselectionSettingPage::SelectCurrentItemL() - { - if ( iFirstItemSwitch ) - { - HandleSelectionsL(); - } - else - { - CAknCheckBoxSettingPage::SelectCurrentItemL(); - } - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionSettingPage::HandleSelectionsL -// Removes selection marks from other items if first one is selected -// -------------------------------------------------------------------------- -// -void CMSMultiselectionSettingPage::HandleSelectionsL() - { - LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::\ - HandleSelectionsL")); - - CEikListBox* listBox = ListBoxControl(); - - const CArrayFix* indexes = listBox->View()->SelectionIndexes(); - - if ( indexes->Count() ) - { - TKeyArrayFix sortKey(0,ECmpTUint); - TInt dummy; - - // check if firs item selected - if ( indexes->Find(0, sortKey, dummy) == 0 ) - { - // clear all - listBox->View()->ClearSelection(); - // select current item - listBox->View()->SelectItemL( listBox->CurrentItemIndex()); - } - else // first item not selected - { - // check if first item is highlighted - if ( listBox->CurrentItemIndex() == 0 ) - { - // remove all selections... - listBox->View()->ClearSelection(); - } - //...and toggle highlighted item - listBox->View()->ToggleItemL( listBox->CurrentItemIndex()); - - // check if we don't have selected items - if ( indexes->Count() == 0 ) - { - // check the first one - listBox->View()->SelectItemL(0); - } - } - } - else // no items selected - { - listBox->View()->SelectItemL(0); - } - } -// -------------------------------------------------------------------------- -// CMSMultiselectionSettingPage::UpdateAllSelections -// Updates selection status of the items in the item array -// -------------------------------------------------------------------------- -// -void CMSMultiselectionSettingPage::UpdateAllSelections() - { - LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::\ - UpdateAllSelections")); - - TInt count = iItemArray->Count(); - - CListBoxView* view = ListBoxControl()->View(); - - for (TInt index = 0; index < count; index++) - { - (*iItemArray)[ index ]->SetSelectionStatus( - view->ItemIsSelected( index ) ); - } - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionSettingPage::HandlePointerEventL -// called by framework when the pointer device is pressed -// -------------------------------------------------------------------------- -// -void CMSMultiselectionSettingPage::HandlePointerEventL(const TPointerEvent &aPointerEvent) - { - CCoeControl::HandlePointerEventL(aPointerEvent); - if ( TPointerEvent::EButton1Up == aPointerEvent.iType ) - { - SelectCurrentItemL(); - } - } - -// -------------------------------------------------------------------------- -// CMSMultiselectionSettingPage::OkToExitL(TInt aButtonId) -// called by framework when the softkey is pressed -// -------------------------------------------------------------------------- -// -TBool CMSMultiselectionSettingPage::OkToExitL( TInt aButtonId ) - { - LOG(_L("[MediaServant]\t CMSMultiSelectionSettingPage::OkToExitL")); - - if ( aButtonId != EEikCmdCanceled ) - { - // Update item selections to the list - UpdateAllSelections(); - } - - return ETrue; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msparameteragent.cpp --- a/homesync/contentmanager/mediaservant/src/msparameteragent.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,186 +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: CMSParameterAgent class implementation -* -*/ - - -#include "msparameteragent.h" -#include "mediaservant.hrh" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSParameterAgent::CMSParameterAgent() -// -------------------------------------------------------------------------- -// -CMSParameterAgent::CMSParameterAgent() - { - LOG(_L("[MediaServant]\t CMSParameterAgent::CMSParameterAgent")); - - iPreviousFocusIndex = 0; - iTemplate.templateType = KErrNotFound; - iTemplate.selectedTemplate = EMSNoTemplate; - - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::~CMSParameterAgent() -// -------------------------------------------------------------------------- -// -CMSParameterAgent::~CMSParameterAgent() - { - LOG(_L("[MediaServant]\t CMSParameterAgent::~CMSParameterAgent")); - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::SetRuleTemplate() -// -------------------------------------------------------------------------- -// -void CMSParameterAgent::SetRuleTemplate( TMSTemplate aTemplate ) - { - LOG(_L("[MediaServant]\t CMSParameterAgent::SetRuleTemplate")); - - iTemplate = aTemplate; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::SetRuleTemplate() -// -------------------------------------------------------------------------- -// -TMSTemplate CMSParameterAgent::GetRuleTemplate() const - { - LOG(_L("[MediaServant]\t CMSParameterAgent::GetRuleTemplate")); - - return iTemplate; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::SetMainViewFocusIndex() -// -------------------------------------------------------------------------- -// -void CMSParameterAgent::SetMainViewFocusIndex( TInt aIndex ) - { - TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\ - SetMainViewFocusIndex %d"), aIndex) ); - - iMainViewFocusIndex = aIndex; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::MainViewFocusIndex() -// -------------------------------------------------------------------------- -// -TInt CMSParameterAgent::MainViewFocusIndex() const - { - TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\ - MainViewFocusIndex %d"), iMainViewFocusIndex) ); - - return iMainViewFocusIndex; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::SetFillViewFocusIndex() -// -------------------------------------------------------------------------- -// -void CMSParameterAgent::SetFillViewFocusIndex( TInt aIndex ) - { - TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\ - SetFillViewFocusIndex %d"), aIndex ) ); - - iFillViewFocusIndex = aIndex; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::FillViewFocusIndex() -// -------------------------------------------------------------------------- -// -TInt CMSParameterAgent::FillViewFocusIndex() const - { - TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\ - FillViewFocusIndex %d"), iFillViewFocusIndex )); - - return iFillViewFocusIndex; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::SetStoreViewFocusIndex() -// -------------------------------------------------------------------------- -// -void CMSParameterAgent::SetStoreViewFocusIndex( TInt aIndex ) - { - TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\ - SetStoreViewFocusIndex %d"), aIndex ) ); - - iStoreViewFocusIndex = aIndex; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::StoreViewFocusIndex() -// -------------------------------------------------------------------------- -// -TInt CMSParameterAgent::StoreViewFocusIndex() const - { - TRACE( Print(_L("[MediaServant]\t CMSParameterAgent::\ - StoreViewFocusIndex %d"), iStoreViewFocusIndex) ); - - return iStoreViewFocusIndex; - } -// -------------------------------------------------------------------------- -// CMSParameterAgent::SetPreviousViewId() -// -------------------------------------------------------------------------- -// -void CMSParameterAgent::SetPreviousViewId( TUid aViewId ) - { - LOG(_L("[MediaServant]\t CMSParameterAgent::SetPreviousViewId")); - - iPreviousViewId = aViewId; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::PreviousViewId() -// -------------------------------------------------------------------------- -// -TUid CMSParameterAgent::PreviousViewId() const - { - LOG(_L("[MediaServant]\t CMSParameterAgent::PreviousViewId")); - - return iPreviousViewId; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::SetBrowseTarget() -// -------------------------------------------------------------------------- -// -void CMSParameterAgent::SetBrowseTarget( - TMSBrowseTarget aBrowseTarget ) - { - LOG(_L("[MediaServant]\t CMSParameterAgent::SetBrowseTarget")); - - iBrowseTarget = aBrowseTarget; - } - -// -------------------------------------------------------------------------- -// CMSParameterAgent::GetBrowseTarget() -// -------------------------------------------------------------------------- -// -TMSBrowseTarget CMSParameterAgent::GetBrowseTarget() const - { - LOG(_L("[MediaServant]\t CMSParameterAgent::GetBrowseTarget")); - - return iBrowseTarget; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/mspropertywatcher.cpp --- a/homesync/contentmanager/mediaservant/src/mspropertywatcher.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +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: CMSPropertyWatcher class implementation -* -*/ - - - -// Include Files -#include - -#include "mspropertywatcher.h" -#include "msdebug.h" - - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::CMSPropertyWatcher -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -CMSPropertyWatcher::CMSPropertyWatcher() - : CActive(CActive::EPriorityStandard) - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::CMSPropertyWatcher")); - } - - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::NewL -// Two-phased constructor. -// --------------------------------------------------------------------------- -// -CMSPropertyWatcher* CMSPropertyWatcher::NewL() - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::NewL")); - - CMSPropertyWatcher* self = CMSPropertyWatcher::NewLC(); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::NewLC -// Two-phased constructor. -// --------------------------------------------------------------------------- -// -CMSPropertyWatcher* CMSPropertyWatcher::NewLC() - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::NewLC")); - - CMSPropertyWatcher* self = new ( ELeave ) CMSPropertyWatcher(); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::ConstructL -// Symbian 2nd phase constructor can leave. -// --------------------------------------------------------------------------- -// -void CMSPropertyWatcher::ConstructL() - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::ConstructL")); - - // Define new property - TInt err = RProperty::Define( KCmPropertyCat, - KCmProperty, - RProperty::EByteArray, - sizeof(TCmProgressInfo)); - if (err != KErrAlreadyExists) - { - User::LeaveIfError(err); - } - - User::LeaveIfError(iProgressInfo .Attach(KCmPropertyCat,KCmProperty)); - CActiveScheduler::Add(this); - } - - -// Destructor -CMSPropertyWatcher::~CMSPropertyWatcher() - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::~CMSPropertyWatcher")); - - Cancel(); - iProgressInfo.Close(); - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::StartL -// Starts active object -// --------------------------------------------------------------------------- -// -void CMSPropertyWatcher::StartL() - { - RunL(); - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::Stop -// Stops active object -// --------------------------------------------------------------------------- -// -void CMSPropertyWatcher::Stop() - { - Cancel(); - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::RunL -// Called when asyncronous request is ready -// --------------------------------------------------------------------------- -// -void CMSPropertyWatcher::RunL() - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::RunL")); - - // resubscribe before processing new value to prevent missing updates - iProgressInfo.Subscribe( iStatus ); - SetActive(); - - TCmProgressInfo info; - - // initialise values on info to remove compilation warning - info.iService = ECmServiceNone; // Service identifier - info.iTotalItems = KErrNone; // Total count of items - info.iProcessedItems = KErrNone; // Processed items - info.iItemsToTransferPerService = KErrNone; // Remaining items per service - - TPckgBuf< TCmProgressInfo > paramspkg( info ); - - // get value - if ( iProgressInfo.Get( - KCmPropertyCat,KCmProperty,paramspkg ) == KErrNotFound ) - { - } - else - { - // inform observer - iObserver->PropertyChangedL( - paramspkg().iService, - paramspkg().iTotalItems, - paramspkg().iProcessedItems, - paramspkg().iItemsToTransferPerService ); - } - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::DoCancel -// Cancels active object -// --------------------------------------------------------------------------- -// -void CMSPropertyWatcher::DoCancel() - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::DoCancel")); - - iProgressInfo.Cancel(); - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::RunError -// --------------------------------------------------------------------------- -// -TInt CMSPropertyWatcher::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CMSPropertyWatcher::SetObserver -// Set observer -// --------------------------------------------------------------------------- -// -void CMSPropertyWatcher::SetObserver( MMSPropertyObserver* aObserver ) - { - LOG(_L("[MediaServant]\t CMSPropertyWatcher::SetObserver")); - - iObserver = aObserver; - } -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msruleamountsetting.cpp --- a/homesync/contentmanager/mediaservant/src/msruleamountsetting.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,251 +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: CMSRuleAmountSetting class implementation -* -*/ - - -#include -#include -#include - -#include "cmcommontypes.h" -#include "msruleamountsetting.h" -#include "mediaservant.hrh" -#include "msdebug.h" - - -// CONSTANTS -const TInt KArrayGranularity = 3; - - -// -------------------------------------------------------------------------- -// CMSRuleAmountSetting::~CMSRuleAmountSetting() -// -------------------------------------------------------------------------- -// -CMSRuleAmountSetting::~CMSRuleAmountSetting() - { - } - -// -------------------------------------------------------------------------- -// CMSRuleAmountSetting::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CMSRuleAmountSetting::EditItemL( TBool aCalledFromMenu ) - { - LOG(_L("[MediaServant]\t CMSRuleAmountSetting::EditItemL")); - - // Launches setting page - CMSEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu); - StoreL(); - - // selected item index - TInt selected = QueryValue()->CurrentValueIndex(); - - if ( SettingAccepted() && - selected != EUnlimited ) - { - // Construct Integer query - CAknNumberQueryDialog* query = CAknNumberQueryDialog::NewL( iValue ); - - // set query heading - if ( selected == EPieces) - { - HBufC* heading = - StringLoader::LoadLC( R_MS_AMOUNT_QUERY_HEADING ); - query->SetPromptL( *heading ); - CleanupStack::PopAndDestroy( heading ); - } - else // EMbits - { - HBufC* heading = - StringLoader::LoadLC( R_MS_SIZE_QUERY_HEADING ); - query->SetPromptL( *heading ); - CleanupStack::PopAndDestroy( heading ); - } - - // run query - if ( query->ExecuteLD( R_MSERV_DATA_QUERY ) ) - { - HBufC* itemText = NULL; - - CArrayPtr< CAknEnumeratedText >* enumeratedTextArray = - EnumeratedTextArray (); - // delete object - delete (*enumeratedTextArray)[selected]; - // delete pointer - enumeratedTextArray->Delete( selected ); - - if ( selected == EPieces ) - { - - switch ( iValue ) - { - case 0: // 0 items - { - itemText = - StringLoader::LoadLC( R_MS_VALUE_AMOUNT_0_ITEMS ); - break; - } - case 1: // 1 item - { - itemText = - StringLoader::LoadLC( R_MS_VALUE_AMOUNT_ONE_ITEM ); - break; - } - default: // many items - { - itemText = StringLoader::LoadLC( - R_MS_VALUE_AMOUNT_COUNT_NUMBER, - iValue ); - break; - } - } - } - else // EMbits - { - itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_MB_NUMBER, - iValue ); - } - - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - CAknEnumeratedText* enumeratedText = - new (ELeave) CAknEnumeratedText( selected, itemText); - CleanupStack::PushL( enumeratedText ); - // insert new text to array - enumeratedTextArray->InsertL( selected, enumeratedText ); - CleanupStack::Pop( enumeratedText ); - if ( itemText ) - { - CleanupStack::Pop( itemText ); - } - - UpdateListBoxTextL(); - } - else - { - EditItemL( aCalledFromMenu ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSRuleAmountSetting::CMSRuleAmountSetting -// -------------------------------------------------------------------------- -// -CMSRuleAmountSetting::CMSRuleAmountSetting( - TInt aIdentifier, - TInt &aLimitType, - TInt &aValue - ) : - CMSEnumeratedTextPopupSettingItem( aIdentifier, aLimitType ), - iLimitType( aLimitType ), - iValue( aValue ) - { - } - -// -------------------------------------------------------------------------- -// CMSRuleAmountSetting::CompleteConstructionL -// -------------------------------------------------------------------------- -// -void CMSRuleAmountSetting::CompleteConstructionL() - { - LOG(_L("[MediaServant]\t CMSRuleAmountSetting::CompleteConstructionL")); - - CArrayPtr< CAknEnumeratedText > * enumeratedTextArray = - new (ELeave) CArrayPtrFlat(KArrayGranularity); - CleanupStack::PushL( enumeratedTextArray ); - - CArrayPtr< HBufC > * poppedUpTextArray = - new (ELeave) CArrayPtrFlat (KArrayGranularity); - CleanupStack::PushL( poppedUpTextArray ); - - - // "UNLIMITED" setting item text - HBufC* itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_UNLIMITED ); - CAknEnumeratedText* enumeratedText = - new (ELeave) CAknEnumeratedText( EUnlimited, itemText ); - CleanupStack::PushL( enumeratedText ); - enumeratedTextArray->AppendL( enumeratedText ); - CleanupStack::Pop( 2, itemText ); - - // "XX items" setting item text - switch( iValue ) - { - case 0: // 0 items - { - itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_0_ITEMS ); - break; - } - case 1: // 1 item - { - itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_ONE_ITEM ); - break; - } - default: // many items - { - itemText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_COUNT_NUMBER, - iValue); - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - break; - } - } - - enumeratedText = new (ELeave) CAknEnumeratedText(EPieces, itemText); - CleanupStack::PushL( enumeratedText ); - enumeratedTextArray->AppendL( enumeratedText ); - CleanupStack::Pop( 2, itemText ); - - // "XX MB" setting item text - itemText = StringLoader::LoadLC( - R_MS_VALUE_AMOUNT_MB_NUMBER, iValue ); - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - enumeratedText = new (ELeave) CAknEnumeratedText(EMbits, itemText); - CleanupStack::PushL( enumeratedText ); - enumeratedTextArray->AppendL( enumeratedText ); - CleanupStack::Pop( 2, itemText ); - - // "UNLIMITED" popup text - HBufC* popupText = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_UNLIMITED ); - poppedUpTextArray->AppendL(popupText); - CleanupStack::Pop( popupText ); - - // "SET MB" popup text - HBufC* popupText2 = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_COUNT_PAGE ); - poppedUpTextArray->AppendL(popupText2); - CleanupStack::Pop( popupText2 ); - - // "SET COUNT" popup text - HBufC* popupText3 = StringLoader::LoadLC( R_MS_VALUE_AMOUNT_MB_PAGE ); - poppedUpTextArray->AppendL(popupText3); - CleanupStack::Pop( popupText3 ); - - // set arrays - SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray); - CleanupStack::Pop( 2, enumeratedTextArray ); - - HandleTextArrayUpdateL(); - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msrulefilesizesetting.cpp --- a/homesync/contentmanager/mediaservant/src/msrulefilesizesetting.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +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: CMSRuleFileSizeSetting class implementation -* -*/ - - -#include -#include -#include -#include -#include "cmcommontypes.h" -#include "msrulefilesizesetting.h" -#include "mediaservant.hrh" -#include "msdebug.h" - - -// CONSTANTS -const TInt KArrayGranularity = 2; - - -// -------------------------------------------------------------------------- -// CMSRuleFileSizeSetting::~CMSRuleFileSizeSetting() -// -------------------------------------------------------------------------- -// -CMSRuleFileSizeSetting::~CMSRuleFileSizeSetting() - { - } - -// -------------------------------------------------------------------------- -// CMSRuleFileSizeSetting::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CMSRuleFileSizeSetting::EditItemL( TBool aCalledFromMenu ) - { - LOG(_L("[MediaServant]\t CMSRuleFileSizeSetting::EditItemL")); - - // Launches setting page - // Button pressed on setting page will be stored to iSettingPageEvent - CMSEnumeratedTextPopupSettingItem::EditItemL(aCalledFromMenu); - StoreL(); - - // selected item index - TInt selected = QueryValue()->CurrentValueIndex(); - - if ( SettingAccepted() && - selected != EMSAny ) - { - // Construct Integer query - CAknNumberQueryDialog* query = CAknNumberQueryDialog::NewL( iValue ); - - // set query heading - if ( iType == EMSMinFileSize) - { - HBufC* heading = StringLoader::LoadLC( - R_MS_MIN_FILE_SIZE_PAGE_ITEM_TEXT ); - query->SetPromptL( *heading ); - CleanupStack::PopAndDestroy( heading ); - } - else // EMSMaxFileSize - { - HBufC* heading = StringLoader::LoadLC( - R_MS_MAX_FILE_SIZE_PAGE_ITEM_TEXT ); - query->SetPromptL( *heading ); - CleanupStack::PopAndDestroy( heading ); - } - - // run query - if ( query->ExecuteLD( R_MSERV_DATA_QUERY ) ) - { - CArrayPtr< CAknEnumeratedText >* enumeratedTextArray = - EnumeratedTextArray (); - // delete object - delete enumeratedTextArray->At(selected); - // delete pointer - enumeratedTextArray->Delete( selected ); - - HBufC* itemText = StringLoader::LoadLC( R_MS_FILE_SIZE_ITEM_TEXT, - iValue ); - - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - CAknEnumeratedText* enumeratedText = - new (ELeave) CAknEnumeratedText( selected, itemText); - CleanupStack::PushL( enumeratedText ); - - // insert new text to array - enumeratedTextArray->InsertL( selected, enumeratedText ); - CleanupStack::Pop( 2, itemText ); - - - UpdateListBoxTextL(); - } - } - } - -// -------------------------------------------------------------------------- -// CMSRuleFileSizeSetting::CMSRuleFileSizeSetting -// -------------------------------------------------------------------------- -// -CMSRuleFileSizeSetting::CMSRuleFileSizeSetting( - TInt aIdentifier, - TInt aType, - TInt &aSelection, - TInt &aValue - ) : - CMSEnumeratedTextPopupSettingItem( aIdentifier, aSelection ), - iType( aType ), - iValue( aValue ) - { - } - -// -------------------------------------------------------------------------- -// CMSRuleFileSizeSetting::CompleteConstructionL -// -------------------------------------------------------------------------- -// -void CMSRuleFileSizeSetting::CompleteConstructionL() - { - LOG(_L("[MediaServant]\t CMSRuleFileSizeSetting::\ - CompleteConstructionL")); - - CArrayPtr< CAknEnumeratedText > * enumeratedTextArray = - new (ELeave) CArrayPtrFlat(KArrayGranularity); - CleanupStack::PushL( enumeratedTextArray ); - - CArrayPtr< HBufC > * poppedUpTextArray = - new (ELeave) CArrayPtrFlat (KArrayGranularity); - CleanupStack::PushL( poppedUpTextArray ); - - // "Any" setting item text - HBufC* itemText = StringLoader::LoadLC( R_MS_VALUE_ANY_FILE_SIZE ); - CAknEnumeratedText* enumeratedText = - new (ELeave) CAknEnumeratedText( EMSAny, itemText ); - CleanupStack::PushL( enumeratedText ); - enumeratedTextArray->AppendL( enumeratedText ); - CleanupStack::Pop( 2, itemText ); - - // "XX MB" setting item text - itemText = StringLoader::LoadLC( R_MS_FILE_SIZE_ITEM_TEXT, iValue ); - - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - enumeratedText = new (ELeave) CAknEnumeratedText(EMSSetSize, itemText); - CleanupStack::PushL( enumeratedText ); - enumeratedTextArray->AppendL( enumeratedText ); - CleanupStack::Pop( 2, itemText ); - - // "Any" popup text - HBufC* popupText = StringLoader::LoadLC( R_MS_VALUE_ANY_FILE_SIZE ); - poppedUpTextArray->AppendL(popupText); - CleanupStack::Pop( popupText ); - - if ( iType == EMSMinFileSize ) - { - // "Set min MB" setting page text - HBufC* popupText2 = - StringLoader::LoadLC( R_MS_MIN_FILE_SIZE_PAGE_ITEM_TEXT ); - poppedUpTextArray->AppendL(popupText2); - CleanupStack::Pop( popupText2 ); - } - else // EMSMaxFileSize - { - // "Set max MB" setting page text - HBufC* popupText2 = StringLoader::LoadLC( - R_MS_MAX_FILE_SIZE_PAGE_ITEM_TEXT ); - poppedUpTextArray->AppendL(popupText2); - CleanupStack::Pop( popupText2 ); - } - - // set arrays - SetEnumeratedTextArrays(enumeratedTextArray, poppedUpTextArray); - CleanupStack::Pop( 2, enumeratedTextArray ); - - HandleTextArrayUpdateL(); - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msrulemultiselectionsetting.cpp --- a/homesync/contentmanager/mediaservant/src/msrulemultiselectionsetting.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,349 +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: CMSRuleMultiselectionSetting class implementation -* -*/ - - -#include -#include -#include -#include - -#include "cmsqlpropertycontainer.h" -#include "cmsqlpropertyitem.h" -#include "msrulemultiselectionsetting.h" -#include "msconstants.h" -#include "msmultiselectiondialog.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KItemArrayGranularity = 3; - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::NewL -// -------------------------------------------------------------------------- -// -CMSRuleMultiselectionSetting* CMSRuleMultiselectionSetting::NewL( - TInt aIdentifier, - TInt aTitleResource, - TInt aFirstPopupItemResource, - TInt aAnyItemTextResource, - CCmSqlPropertyContainer* aMetadataArray, - RArray* aArray, - TInt aItemTextResource, - TDes& aText) - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::NewL")); - - CMSRuleMultiselectionSetting* self = - CMSRuleMultiselectionSetting::NewLC( - aIdentifier, - aTitleResource, - aFirstPopupItemResource, - aAnyItemTextResource, - aMetadataArray, - aArray, - aItemTextResource, - aText ); - - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::NewLC -// -------------------------------------------------------------------------- -// -CMSRuleMultiselectionSetting* CMSRuleMultiselectionSetting::NewLC( - TInt aIdentifier, - TInt aTitleResource, - TInt aFirstPopupItemResource, - TInt aAnyItemTextResource, - CCmSqlPropertyContainer* aMetadataArray, - RArray* aArray, - TInt aItemTextResource, - TDes& aText) - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::NewLC")); - - CMSRuleMultiselectionSetting* self = - new (ELeave) CMSRuleMultiselectionSetting( - aIdentifier, - aTitleResource, - aFirstPopupItemResource, - aAnyItemTextResource, - aMetadataArray, - aArray, - aItemTextResource, - aText ); - - CleanupStack::PushL(self); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::ConstructL -// -------------------------------------------------------------------------- -// -void CMSRuleMultiselectionSetting::ConstructL() - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::ConstructL")); - - iItemArray = - new ( ELeave ) CSelectionItemList( KItemArrayGranularity ); - - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::SetSettingItemTextL -// -------------------------------------------------------------------------- -// -void CMSRuleMultiselectionSetting::SetSettingItemTextL() - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\ - SetSettingItemTextL")); - - HBufC* itemText = NULL; - - if ( iSelectedItemCount == 1 ) - { - // only one item selected so we can use item index to find text - CSelectableItem* apu = (*iItemArray)[ iSelectedItemIndex ]; - itemText = apu->ItemText().AllocLC(); - } - else if ( iSelectedItemCount > 1 ) - { - itemText = StringLoader::LoadLC( iItemTextResource, - iSelectedItemCount ); - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - } - else - { - itemText = StringLoader::LoadLC( iAnyItemTextResource ); - } - - // Set new text - SetExternalText( *itemText ); - // Load text - LoadL(); - - CleanupStack::PopAndDestroy( itemText ); - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::CMSRuleMultiselectionSetting -// -------------------------------------------------------------------------- -// -CMSRuleMultiselectionSetting::CMSRuleMultiselectionSetting( - TInt aIdentifier, - TInt aTitleResource, - TInt aFirstPopupItemResource, - TInt aAnyItemTextResource, - CCmSqlPropertyContainer* aMetadataArray, - RArray* aArray, - TInt aItemTextResource, - TDes& aText - ) : - CMSTextSettingItem( aIdentifier, aText ), - iItemTextResource ( aItemTextResource ), - iText( aText ), - iList (aArray), - iMetadataArray( aMetadataArray ), - iTitleResource( aTitleResource ), - iFirstPopupItemResource( aFirstPopupItemResource ), - iAnyItemTextResource( aAnyItemTextResource ) - { - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::~CMSRuleMultiselectionSetting() -// -------------------------------------------------------------------------- -// -CMSRuleMultiselectionSetting::~CMSRuleMultiselectionSetting() - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\ - ~CMSRuleMultiselectionSetting")); - - if ( iItemArray ) - { - iItemArray->ResetAndDestroy(); - delete iItemArray; - } - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CMSRuleMultiselectionSetting::EditItemL( TBool /*aCalledFromMenu*/ ) - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::EditItemL")); - - HBufC* title = StringLoader::LoadLC( iTitleResource ); - CMSMultiselectionDialog* dlg = - CMSMultiselectionDialog::NewL(iItemArray, *title); - - // reset dialog acceptance indicator - SetAcceptState( EFalse ); - - // launch dialog - if ( dlg->ExecuteLD( R_MS_MULTISELECTION_DIALOG ) ) - { - // dialog accepted - SetAcceptState( ETrue ); - - // reset selected item count - iSelectedItemCount = 0; - - // remove previous items - iList->Reset(); - - // Check if first item ("Any") is selected - if ( (*iItemArray)[ 0 ]->SelectionStatus() == EFalse ) - { - AppendSelectedItemsToListL(); - } - - // set item text - SetSettingItemTextL(); - // load and update text - LoadL(); - UpdateListBoxTextL(); - } - CleanupStack::PopAndDestroy( title ); - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::CreateSelectionItemListL -// Creates selection item list -// -------------------------------------------------------------------------- -// -void CMSRuleMultiselectionSetting::CreateSelectionItemListL() - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\ - CreateSelectionItemListL")); - - // delete old items - iItemArray->ResetAndDestroy(); - iSelectedItemCount = 0; - - // Cycle trough all metadata items - iMetadataArray->SortPropertyItem(); - for ( TInt idx = 0; idx < iMetadataArray->PropertyItemCount(); idx++ ) - { - CCmSqlPropertyItem* propertyItem = - iMetadataArray->PropertyItem( idx ); - - HBufC* itemStr = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - propertyItem->Name() ); - CleanupStack::PushL( itemStr ); - - // Check if item was selected last time - TInt found = iList->Find( propertyItem->Id() ); - - CSelectableItem* item; - - if ( found != KErrNotFound ) - { - // create item - selected - item = new ( ELeave ) CSelectableItem( *itemStr, ETrue ); - iSelectedItemCount++; - iSelectedItemIndex = idx + 1; //first item is "any" - } - else - { - // create item - not selected - item = new ( ELeave ) CSelectableItem( *itemStr, EFalse ); - } - - CleanupStack::PushL( item ); - - // item must be constructed - item->ConstructL(); - - // append item to list - iItemArray->AppendL(item); - - CleanupStack::Pop( item ); - CleanupStack::PopAndDestroy( itemStr ); - } - - // Create and append default item (Any/None) - HBufC* itemName = StringLoader::LoadLC( iFirstPopupItemResource ); - CSelectableItem* item = NULL; - if ( iSelectedItemCount ) - { - item = new ( ELeave ) CSelectableItem( *itemName, EFalse ); - } - else - { - item = new ( ELeave ) CSelectableItem( *itemName, ETrue ); - } - - CleanupStack::PushL( item ); - item->ConstructL(); - iItemArray->InsertL(0, item); - CleanupStack::Pop( item ); - CleanupStack::PopAndDestroy( itemName ); - - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::AppendSelectedItemsToListL -// Appends selected items to the list -// -------------------------------------------------------------------------- -// -void CMSRuleMultiselectionSetting::AppendSelectedItemsToListL() - { - LOG(_L("[MediaServant]\t CMSRuleMultiselectionSetting::\ - AppendSelectedItemsToListL")); - - // first index '0' is "Any" - for ( TInt index = 1; index < iItemArray->Count(); index++ ) - { - if ( (*iItemArray)[index]->SelectionStatus() ) - { - CCmSqlPropertyItem* propertyItem = - iMetadataArray->PropertyItem( index - 1 ); - iList->AppendL( propertyItem->Id() ); - iSelectedItemCount++; - iSelectedItemIndex = index; - } - } - } - -// -------------------------------------------------------------------------- -// CMSRuleMultiselectionSetting::CreateItemListL -// Creates item list and updates listbox -// -------------------------------------------------------------------------- -// -void CMSRuleMultiselectionSetting::CreateItemListL() - { - // Create item list - CreateSelectionItemListL(); - // set item text - SetSettingItemTextL(); - // update listbox - UpdateListBoxTextL(); - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msruleserverssetting.cpp --- a/homesync/contentmanager/mediaservant/src/msruleserverssetting.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +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: CMSRuleServersSetting class implementation -* -*/ - - -#include -#include - - -#include "msruleserverssetting.h" -#include "msmultiselectionsettingpage.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::NewL -// -------------------------------------------------------------------------- -// -CMSRuleServersSetting* CMSRuleServersSetting::NewL( - TInt aIdentifier, - CSelectionItemList& aServerList, - TDes& aText, - TInt aSecondaryTextResource ) - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::NewL")); - - CMSRuleServersSetting* self = CMSRuleServersSetting::NewLC( - aIdentifier, - aServerList, - aText, - aSecondaryTextResource ); - - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::NewLC -// -------------------------------------------------------------------------- -// -CMSRuleServersSetting* CMSRuleServersSetting::NewLC( - TInt aIdentifier, - CSelectionItemList& aServerList, - TDes& aText, - TInt aSecondaryTextResource ) - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::NewLC")); - - CMSRuleServersSetting* self = new (ELeave) CMSRuleServersSetting( - aIdentifier, - aServerList, - aText, - aSecondaryTextResource ); - - CleanupStack::PushL(self); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::ConstructL -// -------------------------------------------------------------------------- -// -void CMSRuleServersSetting::ConstructL() - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::ConstructL")); - - iSettingText = HBufC16::NewL( KMaxFileName ); - - SetSettingItemTextL(); - } - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::CMSRuleServersSetting -// -------------------------------------------------------------------------- -// -CMSRuleServersSetting::CMSRuleServersSetting( - TInt aIdentifier, - CSelectionItemList& aServerList, - TDes& aText, - TInt aSecondaryTextResource - ) : - CMSTextSettingItem( aIdentifier, aText ), - iText( aText ), - iItemArray( aServerList ), - iSecondaryTextResource( aSecondaryTextResource ) - { - } -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::~CMSRuleServersSetting() -// -------------------------------------------------------------------------- -// -CMSRuleServersSetting::~CMSRuleServersSetting() - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::\ - ~CMSRuleServersSetting")); - - delete iSettingText; - } - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CMSRuleServersSetting::EditItemL( TBool /*aCalledFromMenu*/ ) - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::EditItemL")); - - // reset dialog acceptance indicator - SetAcceptState( EFalse ); - - // Create setting page - CAknSettingPage* dlg = CMSMultiselectionSettingPage::NewL( - R_MS_FILL_RULE_SERVERS_SETTING_PAGE, - iItemArray, ETrue ); - // launch setting page - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - // dialog accepted - SetAcceptState( ETrue ); - - SetSettingItemTextL(); - LoadL(); - // show value on screen - UpdateListBoxTextL(); - } - } - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::CountSelectedItems -// Counts selected items -// -------------------------------------------------------------------------- -// -TInt CMSRuleServersSetting::CountSelectedItems() - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::\ - CountSelectedItems")); - - TInt count(0); - - // don't calculate first item - for ( TInt index = 1; index < iItemArray.Count(); index++ ) - { - if ( iItemArray[ index ]->SelectionStatus() ) - { - count++; - } - } - - return count; - } - -// -------------------------------------------------------------------------- -// CMSRuleServersSetting::SetSettingItemTextL -// Sets setting item secondary text according to selected items -// -------------------------------------------------------------------------- -// -void CMSRuleServersSetting::SetSettingItemTextL() - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::\ - SetSettingItemTextL")); - - TInt count = CountSelectedItems(); - - HBufC* itemText = NULL; - // Check if there is no selected items - if ( count == 0 ) - { - itemText = StringLoader::LoadLC( iSecondaryTextResource ); - iSettingText->Des().Copy( *itemText ); - } - // Check if only one item is selected - else if ( count == 1 ) - { - TInt itemCount = iItemArray.Count(); - for ( TInt index = 1; index < itemCount; index++ ) - { - CSelectableItem* item = iItemArray[ index ]; - if ( item->SelectionStatus() ) - { - iSettingText->Des().Copy( item->ItemText() ); - index = itemCount; // break loop - } - } - } - // more than one item selected - else - { - itemText = StringLoader::LoadLC( R_MS_ITEM_DEVICES, count ); - - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iSettingText->Des().Copy( *itemText ); - } - - if ( itemText ) - { - CleanupStack::PopAndDestroy( itemText ); - } - - // Set new value - SetExternalText( *iSettingText ); - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/mssettingitems.cpp --- a/homesync/contentmanager/mediaservant/src/mssettingitems.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -/* -* Copyright (c) 2007 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: Setting item class implementations -* -*/ - - -#include -#include -#include -#include -#include "mssettingitems.h" -#include "mediaservant.hrh" - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::CMSTextSettingItem -// -------------------------------------------------------------------------- -// -CMSTextSettingItem::CMSTextSettingItem( TInt aIdentifier, TDes& aText ) : - CAknTextSettingItem( aIdentifier, aText ) - { - } - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::HandleSettingPageEventL -// -------------------------------------------------------------------------- -// -void CMSTextSettingItem::HandleSettingPageEventL( - CAknSettingPage* aSettingPage, - TAknSettingPageEvent aEventType ) - { - if ( aEventType == EEventSettingOked ) - { - iOKPressed = ETrue; - } - else - { - iOKPressed = EFalse; - } - - CAknTextSettingItem::HandleSettingPageEventL( - aSettingPage, - aEventType ); - } - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::SettingAccepted -// -------------------------------------------------------------------------- -// -TBool CMSTextSettingItem::SettingAccepted() - { - return iOKPressed; - } - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::SetAcceptState -// -------------------------------------------------------------------------- -// -void CMSTextSettingItem::SetAcceptState( TBool aState ) - { - iOKPressed = aState; - } - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::Text -// -------------------------------------------------------------------------- -// -TPtr& CMSTextSettingItem::Text() - { - return CAknTextSettingItem::InternalTextPtr(); - } - -// -------------------------------------------------------------------------- -// CMSTextSettingItem::SetText -// -------------------------------------------------------------------------- -// -void CMSTextSettingItem::SetText( TDesC& text ) - { - CAknTextSettingItem::SetExternalText(text); - } - -// -------------------------------------------------------------------------- -// CMSEnumeratedTextPopupSettingItem::CMSEnumeratedTextPopupSettingItem -// -------------------------------------------------------------------------- -// -CMSEnumeratedTextPopupSettingItem::CMSEnumeratedTextPopupSettingItem( - TInt aResourceId, - TInt& aValue ): - CAknEnumeratedTextPopupSettingItem( aResourceId, aValue ) - { - } - -// -------------------------------------------------------------------------- -// CMSEnumeratedTextPopupSettingItem::HandleSettingPageEventL -// -------------------------------------------------------------------------- -// -void CMSEnumeratedTextPopupSettingItem::HandleSettingPageEventL( - CAknSettingPage* aSettingPage, - TAknSettingPageEvent aEventType ) - { - if ( aEventType == EEventSettingOked ) - { - iOKPressed = ETrue; - } - else - { - iOKPressed = EFalse; - } - - CAknEnumeratedTextPopupSettingItem::HandleSettingPageEventL( - aSettingPage, - aEventType ); - } - -// -------------------------------------------------------------------------- -// CMSEnumeratedTextPopupSettingItem::SettingAccepted -// -------------------------------------------------------------------------- -// -TBool CMSEnumeratedTextPopupSettingItem::SettingAccepted() - { - return iOKPressed; - } - -// -------------------------------------------------------------------------- -// CMSEnumeratedTextPopupSettingItem::SetAcceptState -// -------------------------------------------------------------------------- -// -void CMSEnumeratedTextPopupSettingItem::SetAcceptState( TBool aState ) - { - iOKPressed = aState; - } - -// -------------------------------------------------------------------------- -// CMSTimeOrDateSettingItem::CMSTimeOrDateSettingItem -// -------------------------------------------------------------------------- -// -CMSTimeOrDateSettingItem::CMSTimeOrDateSettingItem( TInt aCMSIdentifier, - TInt aIdentifier, - TAknTimeOrDateSettingItemMode aMode, - TTime& aTime ): - CAknTimeOrDateSettingItem( aIdentifier, aMode, aTime ),iCMSInternalTime( aTime ) - { - iCMSIdentifier = aCMSIdentifier; - } - -// -------------------------------------------------------------------------- -// CMSTimeOrDateSettingItem::HandleSettingPageEventL -// -------------------------------------------------------------------------- -// -void CMSTimeOrDateSettingItem::HandleSettingPageEventL( - CAknSettingPage* aSettingPage, - TAknSettingPageEvent aEventType ) - { - if ( aEventType == EEventSettingOked ) - { - iOKPressed = ETrue; - // When press OK ,the external time value should transferred to the internal time value immediately - LoadL(); - } - else - { - iOKPressed = EFalse; - // When press cancel,externalizes the current setting - StoreL(); - } - - CAknTimeOrDateSettingItem::HandleSettingPageEventL( - aSettingPage, - aEventType ); - } - -// -------------------------------------------------------------------------- -// CMSTimeOrDateSettingItem::SettingAccepted -// -------------------------------------------------------------------------- -// -TBool CMSTimeOrDateSettingItem::SettingAccepted() - { - return iOKPressed; - } - -// -------------------------------------------------------------------------- -// CMSTimeOrDateSettingItem::SetAcceptState -// -------------------------------------------------------------------------- -// -void CMSTimeOrDateSettingItem::SetAcceptState( TBool aState ) - { - iOKPressed = aState; - } - -// -------------------------------------------------------------------------- -// CMSTimeOrDateSettingItem::EditItemL -// -------------------------------------------------------------------------- -// -void CMSTimeOrDateSettingItem::EditItemL( TBool /*aCalledFromMenu*/ ) - { - // Access to the setting Name - TPtrC text = SettingName(); - CAknSettingPage* dlg = KErrNone; - - // Launches the setting page resource file - dlg = new ( ELeave )CAknDateSettingPage( iCMSIdentifier, iCMSInternalTime ); - - // Set the edit page to observer - SetSettingPage( dlg ); - SettingPage()->SetSettingPageObserver( this ); - - if( ProtectionState() == CAknSettingItem::ESettingItemViewOnly ) - SettingPage()->SetEditState( EFalse ); - - // Change to EUpdateWhenAccepted flag to avoid the checking every time there is an input to the field - SettingPage()->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ); - SetSettingPage( 0 ); - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msstorekeeponphonesetting.cpp --- a/homesync/contentmanager/mediaservant/src/msstorekeeponphonesetting.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +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: CMSStoreKeepOnPhoneSetting class implementation -* -*/ - - -#include -#include - -#include "msstorekeeponphonesetting.h" -#include "mediaservant.hrh" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSStoreKeepOnPhoneSetting::~CMSStoreKeepOnPhoneSetting() -// -------------------------------------------------------------------------- -// -CMSStoreKeepOnPhoneSetting::~CMSStoreKeepOnPhoneSetting() - { - } - -// -------------------------------------------------------------------------- -// CMSStoreKeepOnPhoneSetting::CMSStoreKeepOnPhoneSetting -// -------------------------------------------------------------------------- -// -CMSStoreKeepOnPhoneSetting::CMSStoreKeepOnPhoneSetting( - TInt aIdentifier, - TCmMediaType aMediaType, - TInt& aSelection - ) : - CAknEnumeratedTextPopupSettingItem( aIdentifier, aSelection), - iMediaType ( aMediaType ) - { - } - -// -------------------------------------------------------------------------- -// CMSRuleAmountSetting::CompleteConstructionL -// -------------------------------------------------------------------------- -// -void CMSStoreKeepOnPhoneSetting::CompleteConstructionL() - { - LOG(_L("[MediaServant]\t CMSStoreKeepOnPhoneSetting::\ - CompleteConstructionL")); - - // base class call - CAknEnumeratedTextPopupSettingItem::CompleteConstructionL(); - - // Get text arrays - defined in resource - CArrayPtr< CAknEnumeratedText >* resEnumeratedTextArray = - EnumeratedTextArray (); - CArrayPtr< HBufC > * resPoppedUpTextArray = PoppedUpTextArray (); - - if ( iMediaType == ECmImage || iMediaType == ECmOtherImage ) - { - // remove "yes" item - delete resEnumeratedTextArray->At( EMSKeep ); - resEnumeratedTextArray->Delete( EMSKeep ); - delete resPoppedUpTextArray->At( EMSKeep ); - resPoppedUpTextArray->Delete( EMSKeep ); - } - - else // other type than image - { - // remove "keep original size" and "keep screen size" items - delete resEnumeratedTextArray->At( EMSKeepScreenSize ); - delete resPoppedUpTextArray->At( EMSKeepScreenSize ); - delete resEnumeratedTextArray->At( EMSKeepOriginalSize ); - delete resPoppedUpTextArray->At( EMSKeepOriginalSize ); - // delete 2 items - resEnumeratedTextArray->Delete( EMSKeepOriginalSize, 2 ); - // delete 2 items - resPoppedUpTextArray->Delete( EMSKeepOriginalSize, 2 ); - - } - - HandleTextArrayUpdateL(); - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msstorelistcontainer.cpp --- a/homesync/contentmanager/mediaservant/src/msstorelistcontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,485 +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: CMSStoreListContainer class implementation -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mserv.hlp.hrh" -#include "cmstorerulecontainer.h" -#include "cmstorerule.h" -#include "msappui.h" -#include "msstorelistcontainer.h" -#include "msstorelistcontroller.h" -#include "msstorelistview.h" -#include "msengine.h" -#include "msconstants.h" -#include "mediaservantuid.h" -#include "msdebug.h" - - -// CONSTANTS - -// list granularity -const TInt KListGranularity = 5; - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::CMSStoreListContainer() -// -------------------------------------------------------------------------- -// -CMSStoreListContainer::CMSStoreListContainer( CMSAppUi& aAppUi, - CMSStoreListView& aView ): - iMSAppUi( aAppUi ), - iView( aView ) - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::CMSStoreListContainer")); - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::~CMSStoreListContainer() -// -------------------------------------------------------------------------- -// -CMSStoreListContainer::~CMSStoreListContainer() - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::\ - ~CMSStoreListContainer")); - delete iSelectionArray; - - if ( iListBox ) - { - delete iListBox; // Deletes listbox object. - } - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::ConstructL( TRect aRect ) - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::ConstructL")); - - CreateWindowL(); - - iListBox = new (ELeave) CAknSingleGraphicStyleListBox; - - SetListBoxFromResourceL(iListBox, R_STORE_LIST_VIEW_LISTBOX); - - // Container is listbox observer - iListBox->SetListBoxObserver( this ); - - // Get list container - iStoreRuleContainer = - iMSAppUi.StoreListController()->StoreListContainer(); - - // creata array for selection indexes - iSelectionArray = new (ELeave ) CArrayFixFlat(KListGranularity); - - // Create icons - CAknIconArray* icons = new (ELeave) CAknIconArray( EIconCount ); - CleanupStack::PushL( icons ); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName() ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOn, - EMbmAvkonQgn_indi_checkbox_on, - EMbmAvkonQgn_indi_checkbox_on_mask ); - - AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOff, - EMbmAvkonQgn_indi_checkbox_off, - EMbmAvkonQgn_indi_checkbox_off_mask ); - - iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons); - CleanupStack::Pop(icons); - - // Create icon for context pane - AknsUtils::CreateIconL( skin, - KAknsIIDDefault, - iIcon, - iIconMask, - KMSMifFileName, - EMbmMediaservantQgn_mserv_to_home, - EMbmMediaservantQgn_mserv_to_home_mask); - // change context icon - SetContextPaneIconL( iIcon, iIconMask ); - - - SetRect(aRect); - - // Add data to listbox - UpdateListBoxDataL(); - - //Set current item - iListBox->SetCurrentItemIndex( - iMSAppUi.ParameterAgent()->StoreViewFocusIndex() ); - ActivateL(); // Activates window. ( Ready to draw ) - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::CountComponentControls() -// Returns number of components. -// -------------------------------------------------------------------------- -// -TInt CMSStoreListContainer::CountComponentControls() const - { - return 1; // return number of controls inside this container - } - - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::ComponentControl() -// Returns pointer to particular component. -// -------------------------------------------------------------------------- -// -CCoeControl* CMSStoreListContainer::ComponentControl(TInt aIndex) const - - { - CCoeControl* retval = NULL; - switch ( aIndex ) - { - case 0: - { - retval = iListBox; // return a pointer to the listbox - break; - } - default: - { - retval = NULL; - break; - } - } - return retval; - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::OfferKeyEventL() -// Handles the key events. -// -------------------------------------------------------------------------- -// -TKeyResponse CMSStoreListContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::OfferKeyEventL")); - - TKeyResponse response = EKeyWasNotConsumed; - - if ( aType != EEventKey ) - { - response = EKeyWasNotConsumed; - } - - if ( iListBox ) - { - response = iListBox->OfferKeyEventL( aKeyEvent, aType ); - if ( aKeyEvent.iCode == EKeyOK && - iListBox->View()->ItemIsSelected( SelectedItemIndex() )) - { - // check that server is set - CheckServersAndShowNoteL(); - } - - if ( !iView.PreProcessing() ) - { - iView.CreateAndSetNaviTextL(); - } - } - - return response; - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::HandlePointerEventL -// called by framework when the pointer device is pressed -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) - { - CCoeControl::HandlePointerEventL( aPointerEvent ); - - if ( TPointerEvent::EButton1Up == aPointerEvent.iType && - !iView.PreProcessing() ) - { - iView.CreateAndSetNaviTextL(); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::ToggleCurrentItemL() -// Toggles item selection -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::ToggleCurrentItemL() - { - TInt itemIndex = SelectedItemIndex(); - - iListBox->View()->ToggleItemL( itemIndex ); - - if ( iListBox->View()->ItemIsSelected( itemIndex ) ) - { - // check that server is set - CheckServersAndShowNoteL(); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::CheckServersAndShowNoteL() -// Checks if server is not set and shows info note -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::CheckServersAndShowNoteL() - { - CCmStoreRule* rule = - iStoreRuleContainer->StoreRule( SelectedItemIndex() ); - if ( !rule->MediaServerCount() ) - { - CAknInformationNote* dlg = new(ELeave)CAknInformationNote(); - CleanupStack::PushL( dlg ); - HBufC* noteText = - StringLoader::LoadLC( R_MS_TEXT_TARGET_DEVICE_NEEDED ); - dlg->ExecuteLD( *noteText ); - CleanupStack::PopAndDestroy( noteText ); - CleanupStack::Pop( dlg ); - } - - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::HandleListBoxEventL() -// Handles listbox event. -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::HandleListBoxEventL( - CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ) - { - LOG(_L("[MediaServant]\t CMSMainContainer::HandleListBoxEventL")); - - if ( ( aEventType == MEikListBoxObserver::EEventEnterKeyPressed ) || - ( aEventType == MEikListBoxObserver::EEventItemClicked ) ) - { - ToggleCurrentItemL(); - } - } - - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::UpdateListBoxDataL() -// Updates listbox content -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::UpdateListBoxDataL() - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::UpdateListBoxDataL")); - - TCmServerState state; - iMSAppUi.MSEngine()->ServerState( state ); - - CDesCArray* itemArray = static_cast - (iListBox->Model()->ItemTextArray()); - - - TInt ruleCount = iStoreRuleContainer->StoreRuleCount(); - - for ( TInt index = 0; index < ruleCount; index++ ) - { - - - CCmStoreRule* rule = iStoreRuleContainer->StoreRule( index ); - TPtrC8 ruleName = rule->Name(); - - HBufC* itemText = - CnvUtfConverter::ConvertToUnicodeFromUtf8L( rule->Name() ); - CleanupStack::PushL( itemText ); - - if ( rule->Selected() ) - { - iSelectionArray->AppendL( index ); - } - - AppendItemToListBoxArrayL( iListBox, - iListBox->Model(), - EIconCheckboxOff, - *itemText ); - - CleanupStack::PopAndDestroy( itemText ); - } - - iListBox->HandleItemAdditionL(); - - - iListBox->SetSelectionIndexesL( iSelectionArray ); - - if ( state != ECmServerStatePreProcessingStore ) - { - iView.CreateAndSetNaviTextL(); - } - } - - - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::SelectedItemIndex() -// Highlighted item index -// -------------------------------------------------------------------------- -// -TInt CMSStoreListContainer::SelectedItemIndex() - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::SelectedItemIndex")); - - return iListBox->CurrentItemIndex(); - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::UpdateRulesToServerL() -// Send rules to server -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::UpdateRulesToServerL() - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::UpdateRulesToServerL")); - - // Send rules to server - if ( iStoreRuleContainer ) - { - iMSAppUi.MSEngine()->SetStoreRulesL( iStoreRuleContainer ); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::SetServerSelectionsL() -// Sets selection statuses to servers -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::SetServerSelectionsL() - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::SetServerSelectionsL")); - - // remove all selections - for ( TInt i = 0; i < iStoreRuleContainer->StoreRuleCount(); i++ ) - { - CCmStoreRule* rule = - iStoreRuleContainer->StoreRule( i ); - rule->SetSelected( ECmUnSelected ); - } - - // Get marked items indexes - const CListBoxView::CSelectionIndexArray* selections = - iListBox->SelectionIndexes(); - // add user selections - for ( TInt j = 0; j < selections->Count(); j++ ) - { - TInt selectionIndex = (*selections)[j]; - CCmStoreRule* rule = - iStoreRuleContainer->StoreRule( selectionIndex ); - - rule->SetSelected( ECmSelected ); - - } - - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::ListItemCountL() -// Gets list item count & size -// -------------------------------------------------------------------------- -// -TInt CMSStoreListContainer::ListItemCountL() - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::ListItemCountL")); - - TInt fileCount( 0 ); - TInt64 size( 0 ); - - CCmStoreRule* rule = iStoreRuleContainer->StoreRule( - SelectedItemIndex() ); - TPtrC8 ruleName = rule->Name(); - - if ( ruleName.Size() ) - { - iMSAppUi.MSEngine()->GetItemCountsL( ECmServiceStore, - ruleName, - fileCount, - size ); - } - - return fileCount; - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::CurrentListItemSelectionStatus() -// Return list item selection status -// -------------------------------------------------------------------------- -// -TBool CMSStoreListContainer::CurrentListItemSelectionStatus() - { - return iListBox->View()->ItemIsSelected( SelectedItemIndex() ); - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::SizeChanged() - { - // container control resize code. - if (iListBox) - { - iListBox->SetRect(Rect()); // Set rectangle of listbox. - } - } - -// -------------------------------------------------------------------------- -// CMSStoreListContainer::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSStoreListContainer::HandleResourceChange(TInt aType) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect(iView.ClientRect()); - } - - CCoeControl::HandleResourceChange(aType); - } - -// --------------------------------------------------------------------------- -// CMSStoreListContainer::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSStoreListContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSStoreListContainer::GetHelpContext")); - - aContext.iMajor = TUid::Uid(KMediaServantUID3); - aContext.iContext = KMSERV_HLP_STORE_LIST; - } -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msstorelistcontroller.cpp --- a/homesync/contentmanager/mediaservant/src/msstorelistcontroller.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +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: CMSStoreListController class implementation -* -*/ - -#include -#include -#include - -#include "cmstorerulecontainer.h" -#include "cmstorerule.h" -#include "msstorelistcontroller.h" -#include "mediaservant.hrh" -#include "msengine.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSStoreListController::NewL -// -------------------------------------------------------------------------- -// -CMSStoreListController* CMSStoreListController::NewL( CMSEngine& aMSEngine ) - { - LOG(_L("[MediaServant]\t CMSStoreListController::NewL")); - - CMSStoreListController* self = CMSStoreListController::NewLC( - aMSEngine ); - - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::NewLC -// -------------------------------------------------------------------------- -// -CMSStoreListController* CMSStoreListController::NewLC( CMSEngine& aMSEngine ) - { - LOG(_L("[MediaServant]\t CMSStoreListController::NewLC")); - - CMSStoreListController* self = new (ELeave) CMSStoreListController( - aMSEngine ); - - CleanupStack::PushL(self); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::ConstructL -// -------------------------------------------------------------------------- -// -void CMSStoreListController::ConstructL() - { - LOG(_L("[MediaServant]\t CMSStoreListController::ConstructL")); - - iStoreListContainer = iMSEngine->StoreRulesL(); - if ( iStoreListContainer && - iStoreListContainer->StoreRuleCount() <= 0) - { - CreateStoreRulesL(); - } - else - { - ChangeStoreRuleNamesL(); - } - - delete iStoreListContainer; - iStoreListContainer = NULL; - iStoreListContainer = iMSEngine->StoreRulesL(); - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::CMSStoreListController() -// -------------------------------------------------------------------------- -// -CMSStoreListController::CMSStoreListController( CMSEngine& aMSEngine ) - { - LOG(_L("[MediaServant]\t \ - CMSStoreListController::CMSStoreListController")); - - iMSEngine = &aMSEngine; - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::~CMSStoreListController() -// -------------------------------------------------------------------------- -// -CMSStoreListController::~CMSStoreListController() - { - LOG(_L("[MediaServant]\t \ - CMSStoreListController::~CMSStoreListController")); - - delete iStoreListContainer; - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::StoreListArray() -// Returns pointer to store list array -// -------------------------------------------------------------------------- -// -CCmStoreRuleContainer* CMSStoreListController::StoreListContainer() - { - LOG(_L("[MediaServant]\t CMSStoreListController::StoreListContainer")); - - return iStoreListContainer; - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::CreateStoreRulesL() -// -------------------------------------------------------------------------- -// -void CMSStoreListController::CreateStoreRulesL() - { - LOG(_L("[MediaServant]\t CMSStoreListController::CreateStoreRulesL")); - - CCmStoreRuleContainer* storeRuleContainer = - CCmStoreRuleContainer::NewLC(); - - CCmStoreRule* defaultList1 = CCmStoreRule::NewLC(); - HBufC* temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_1 ); - HBufC8* listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList1->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - defaultList1->AddStoreRuleL( ECmImage ); - defaultList1->SetSelected( ECmSelected ); - defaultList1->SetStatus( ECmKeepOnDevice ); - storeRuleContainer->AddStoreRuleL( defaultList1 ); - - CCmStoreRule* defaultList2 = CCmStoreRule::NewLC(); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_2 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList2->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - defaultList2->AddStoreRuleL( ECmOtherImage ); - defaultList2->SetSelected( ECmSelected ); - defaultList2->SetStatus( ECmToBeShrinked ); - storeRuleContainer->AddStoreRuleL( defaultList2 ); - - CCmStoreRule* defaultList3 = CCmStoreRule::NewLC(); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_3 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList3->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - defaultList3->AddStoreRuleL( ECmVideo ); - defaultList3->SetSelected( ECmSelected ); - defaultList3->SetStatus( ECmKeepOnDevice ); - storeRuleContainer->AddStoreRuleL( defaultList3 ); - - CCmStoreRule* defaultList4 = CCmStoreRule::NewLC(); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_4 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList4->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - defaultList4->AddStoreRuleL( ECmOtherVideo ); - defaultList4->SetSelected( ECmSelected ); - defaultList4->SetStatus( ECmKeepOnDevice ); - storeRuleContainer->AddStoreRuleL( defaultList4 ); - - CCmStoreRule* defaultList5 = CCmStoreRule::NewLC(); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_5 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList5->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - defaultList5->AddStoreRuleL( ECmAudio ); - defaultList5->SetSelected( ECmSelected ); - defaultList5->SetStatus( ECmKeepOnDevice ); - storeRuleContainer->AddStoreRuleL( defaultList5 ); - - iMSEngine->SetStoreRulesL( storeRuleContainer ); - - CleanupStack::Pop( defaultList5 ); - CleanupStack::Pop( defaultList4 ); - CleanupStack::Pop( defaultList3 ); - CleanupStack::Pop( defaultList2 ); - CleanupStack::Pop( defaultList1 ); - CleanupStack::PopAndDestroy( storeRuleContainer ); - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::ChangeStoreRuleNamesL() -// Changes names of store rules -// This must be done because user may change language and rule names -// are used in other views ( read from database ) -// -------------------------------------------------------------------------- -// -void CMSStoreListController::ChangeStoreRuleNamesL() - { - LOG(_L("[MediaServant]\t CMSStoreListController::\ - ChangeStoreRuleNamesL")); - - CCmStoreRule* defaultlist1 = iStoreListContainer->StoreRule( 0 ); - HBufC* temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_1 ); - HBufC8* listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultlist1->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - // other images - CCmStoreRule* defaultList2 = iStoreListContainer->StoreRule( 1 ); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_2 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList2->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - // phone videos - CCmStoreRule* defaultList3 = iStoreListContainer->StoreRule( 2 ); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_3 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList3->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - - CCmStoreRule* defaultList4 = iStoreListContainer->StoreRule( 3 ); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_4 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList4->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - // music - CCmStoreRule* defaultList5 = iStoreListContainer->StoreRule( 4 ); - temp = StringLoader::LoadLC( R_MS_DEFAULT_STORE_LIST_5 ); - listName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *temp ); - CleanupStack::PushL( listName ); - defaultList5->SetNameL( *listName ); - CleanupStack::PopAndDestroy( 2, temp ); - - iMSEngine->SetStoreRulesL( iStoreListContainer ); - } - -// -------------------------------------------------------------------------- -// CMSStoreListController::UpdateListsL() -// Resets old store rule array and reads new rules from server -// -------------------------------------------------------------------------- -// -void CMSStoreListController::UpdateListsL() - { - LOG(_L("[MediaServant]\t CMSStoreListController::UpdateListsL")); - - delete iStoreListContainer; - iStoreListContainer = NULL; - - // load lists again - iStoreListContainer = iMSEngine->StoreRulesL(); - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msstorelistview.cpp --- a/homesync/contentmanager/mediaservant/src/msstorelistview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,318 +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: CMSStoreListView class implementation -* -*/ - - - -#include -#include -#include - -#include "msstorelistcontainer.h" -#include "mediaservant.hrh" -#include "msconstants.h" -#include "msstorelistview.h" -#include "msappui.h" -#include "msengine.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSStoreListView::CMSStoreListView() -// -------------------------------------------------------------------------- -// -CMSStoreListView::CMSStoreListView( CMSAppUi& aAppUi ) : - iAppUi( aAppUi ) - { - LOG(_L("[MediaServant]\t CMSStoreListView::CMSStoreListView")); - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSStoreListView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSStoreListView::ConstructL")); - - BaseConstructL( R_MS_STORE_LIST_VIEW ); - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::~CMSStoreListView() -// -------------------------------------------------------------------------- -// -CMSStoreListView::~CMSStoreListView() - { - LOG(_L("[MediaServant]\t CMSStoreListView::~CMSStoreListView")); - - DoDeactivate(); - } - -// -------------------------------------------------------------------------- -// TUid CMSStoreListView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSStoreListView::Id() const - { - LOG(_L("[MediaServant]\t CMSStoreListView::Id")); - - return KMSStoreListViewId; - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSStoreListView::HandleCommandL( TInt aCommand ) - { - LOG(_L("[MediaServant]\t CMSStoreListView::HandleCommandL")); - - switch (aCommand) - { - case EAknSoftkeyBack: - { - CancelAsyncOperation( &iAppUi ); - - // set default icon back - iContainer->SetDefaultContextPaneIconL(); - // update store rule for mainview redraw - iContainer->SetServerSelectionsL(); - iContainer->UpdateRulesToServerL(); - // back to main view - iAppUi.ChangeViewL( KMSStoreListViewId, KMSMainViewId ); - break; - } - - case EMSStoreCmdActivate: // fall through - case EMSStoreCmdDeActivate: - { - iContainer->ToggleCurrentItemL(); - break; - } - - case EMSStoreCmdEdit: - { - CancelAsyncOperation( &iAppUi ); - // update store rule for mainview redraw - iContainer->SetServerSelectionsL(); - iContainer->UpdateRulesToServerL(); - - iAppUi.ChangeViewL( KMSStoreListViewId, KMSStoreSettingsViewId ); - break; - } - - case EMSCmdBrowse: - { - CancelAsyncOperation( &iAppUi ); - - // update store rule for mainview redraw - iContainer->SetServerSelectionsL(); - iContainer->UpdateRulesToServerL(); - - // set browse target - iAppUi.ParameterAgent()->SetBrowseTarget( EMSStoredItems ); - iAppUi.ChangeViewL( KMSStoreListViewId, KMSBrowseViewId ); - break; - } - - case EAknCmdHelp : - { - TRAPD( error, HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - if ( error != KErrNone ) - { - LOG(_L("[MediaServant]\t CMSStoreListView:: \ - HandleCommandL help leaves in \ - LaunchHelpApplication")); - } - break; - } - - default: - { - CancelAsyncOperation( &iAppUi ); - AppUi()->HandleCommandL(aCommand); - break; - } - } - } - - - -// -------------------------------------------------------------------------- -// CMSStoreListView::DoActivateL(...) -// -------------------------------------------------------------------------- -// -void CMSStoreListView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - LOG(_L("[MediaServant]\t CMSStoreListView::DoActivateL")); - - // Set engine observer - iAppUi.MSEngine()->SetObserver( this ); - // start preprosessing if returned from edit view - if ( iAppUi.ParameterAgent()->PreviousViewId() == - KMSStoreSettingsViewId ) - { - iAppUi.MSEngine()->ExecuteStorePreProcessingL(); - HBufC* naviText = StringLoader::LoadLC( R_MS_PREPROCESSING_TEXT ); - SetNavigationPaneTextL( *naviText ); - CleanupStack::PopAndDestroy( naviText ); - iPreprocessingState = ETrue; - } - - - // Set title pane text to default - SetTitlePaneTextL( R_MS_STORE_LIST_VIEW_TITLE ); - - if ( !iContainer ) - { - iContainer = new (ELeave) CMSStoreListContainer( iAppUi, *this ); - iContainer->ConstructL( ClientRect() ); - iContainer->SetMopParent( this ); - AppUi()->AddToViewStackL( *this, iContainer ); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSStoreListView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSStoreListView::DoDeactivate")); - - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - ClearCurrentNaviPaneText(); - - delete iContainer; // Deletes the container class object. - iContainer = NULL; - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::FocusIndex() -// -------------------------------------------------------------------------- -// -TInt CMSStoreListView::FocusIndex() const - { - return iContainer->SelectedItemIndex(); - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::DynInitMenuPaneL -// -------------------------------------------------------------------------- -// -void CMSStoreListView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane) - { - LOG(_L("[MediaServant]\t CMSStoreListView::DynInitMenuPaneL")); - - if ( aResourceId == R_MS_STORE_LIST_MENU ) - { - // selection command - if ( iContainer->CurrentListItemSelectionStatus() ) - { - aMenuPane->SetItemDimmed( EMSStoreCmdActivate, ETrue ); - } - else - { - aMenuPane->SetItemDimmed( EMSStoreCmdDeActivate, ETrue ); - } - } - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::ReadyL() -// engine observer callback -// -------------------------------------------------------------------------- -// -void CMSStoreListView::ReadyL( TCmService aService, TInt /*aError*/ ) - { - LOG(_L("[MediaServant]\t CMSStoreListView::ReadyL")); - - if ( aService == ECmServicePreProcessingStore ) - { - CreateAndSetNaviTextL(); - iPreprocessingState = EFalse; - } - } - - -// -------------------------------------------------------------------------- -// CMSStoreListView::CreateAndSetNaviTextL() -// Creates and sets navi pane text -// -------------------------------------------------------------------------- -// -void CMSStoreListView::CreateAndSetNaviTextL() - { - LOG(_L("[MediaServant]\t CMSStoreListView::CreateAndSetNaviTextL")); - - HBufC* naviText = NULL; - - TInt count = iContainer->ListItemCountL(); - - switch ( count ) - { - case 0: // 0 items - { - naviText = StringLoader::LoadLC( - R_MS_NO_ITEMS_TO_BE_SYNCED ); - break; - } - case 1: // 1 item - { - naviText = StringLoader::LoadLC( - R_MS_1_ITEM_TO_BE_SYNCED ); - break; - } - default: // many items - { - naviText = StringLoader::LoadLC( - R_MS_N_ITEMS_TO_BE_SYNCED, - count ); - // do number conversion - TPtr ptr = naviText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - break; - } - - } - // update navi pane - SetNavigationPaneTextL( *naviText ); - - CleanupStack::PopAndDestroy( naviText ); - } - -// -------------------------------------------------------------------------- -// CMSStoreListView::PreProcessing() -// Returns preprocessing state -// -------------------------------------------------------------------------- -// -TBool CMSStoreListView::PreProcessing() - { - return iPreprocessingState; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msstoreserverssetting.cpp --- a/homesync/contentmanager/mediaservant/src/msstoreserverssetting.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,350 +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: CMSStoreServersSetting class implementation -* -*/ - - -#include -#include - -#include "cmmediaserverfull.h" -#include "cmstorerule.h" -#include "cmfillrule.h" -#include "msstoreserverssetting.h" -#include "msmultiselectionsettingpage.h" -#include "msconstants.h" -#include "msappui.h" -#include "msengine.h" -#include "msdebug.h" - -#include "upnpstring.h" - -// CONSTANTS -const TInt KItemArrayGranularity = 3; - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::NewL -// -------------------------------------------------------------------------- -// -CMSStoreServersSetting* CMSStoreServersSetting::NewL( - TInt aIdentifier, - CCmStoreRule* aRule, - CMSAppUi& aAppUi, - TDes& aText ) - { - LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewL")); - - CMSStoreServersSetting* self = CMSStoreServersSetting::NewLC( - aIdentifier, - aRule, - aAppUi, - aText ); - - CleanupStack::Pop(self); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::NewLC -// -------------------------------------------------------------------------- -// -CMSStoreServersSetting* CMSStoreServersSetting::NewLC( - TInt aIdentifier, - CCmStoreRule* aRule, - CMSAppUi& aAppUi, - TDes& aText ) - { - LOG(_L("[MediaServant]\t CMSStoreServersSetting::NewLC")); - - CMSStoreServersSetting* self = new (ELeave) CMSStoreServersSetting( - aIdentifier, - aRule, - aAppUi, - aText ); - - CleanupStack::PushL(self); - self->ConstructL(); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::ConstructL -// -------------------------------------------------------------------------- -// -void CMSStoreServersSetting::ConstructL() - { - LOG(_L("[MediaServant]\t CMSStoreServersSetting::ConstructL")); - - iSettingText = HBufC::NewL( KMaxFileName ); - - // Get media server list - iServers = iAppUi.MSEngine()->GetMediaServersL(); - - // create item array - CreateSelectionItemListL(); - - SetSettingItemTextL(); - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::CMSRuleServersSetting -// -------------------------------------------------------------------------- -// -CMSStoreServersSetting::CMSStoreServersSetting( - TInt aIdentifier, - CCmStoreRule* aRule, - CMSAppUi& aAppUi, - TDes& aText - ) : - CAknTextSettingItem( aIdentifier, aText ), - iRule( aRule ), - iAppUi( aAppUi ) - { - } -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::~CMSStoreServersSetting() -// -------------------------------------------------------------------------- -// -CMSStoreServersSetting::~CMSStoreServersSetting() - { - delete iSettingText; - - if ( iItemArray ) - { - iItemArray->ResetAndDestroy(); - delete iItemArray; - } - - if ( iServers ) - { - iServers->ResetAndDestroy(); - iServers->Close(); - delete iServers; - } - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CMSStoreServersSetting::EditItemL( TBool /*aCalledFromMenu*/ ) - { - LOG(_L("[MediaServant]\t CMSStoreServersSetting::EditItemL")); - - // Create setting page - CAknSettingPage* dlg = CMSMultiselectionSettingPage::NewL( - R_MS_STORE_SETTINGS_LOCATION_SETTING_PAGE, - *iItemArray, EFalse ); - // launch setting page - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - DeleteAllServersFromRuleL(); - - for ( TInt index = 0; index < iItemArray->Count(); index++ ) - { - CSelectableItem* item = iItemArray->At( index ); - TBool selected = item->SelectionStatus(); - - CCmMediaServerFull* server = (*iServers)[index]; - // get server UDN - TPtrC8 serverUDN = server->MediaServer(); - - // add server - if ( item->SelectionStatus() ) - { - // set server for rule - iRule->AddMediaServerL( serverUDN ); - } - } - - SetSettingItemTextL(); - LoadL(); - // show value on screen - UpdateListBoxTextL(); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::CreateSelectionItemListL -// Creates selection item list -// -------------------------------------------------------------------------- -// -void CMSStoreServersSetting::CreateSelectionItemListL() - { - if ( iItemArray ) - { - iItemArray->ResetAndDestroy(); - delete iItemArray; - iItemArray = NULL; - } - - iItemArray = - new ( ELeave ) CSelectionItemList( KItemArrayGranularity ); - - TBuf8 itemText; - - TInt serverCount(0); - if ( iServers ) - { - serverCount = iServers->Count(); - } - - // Cycle trough all servers - for ( TInt idx = 0; idx < serverCount; idx++ ) - { - // get server - CCmMediaServerFull* server = (*iServers)[idx]; - // show only copy capable devices - if ( server->StoreUsage() ) - { - HBufC* devName = - UpnpString::ToUnicodeL( server->MediaServerName() ); - CleanupStack::PushL( devName ); - CSelectableItem* item = new ( ELeave ) CSelectableItem( - *devName, EFalse); - - CleanupStack::PushL( item ); - // item must be constructed - item->ConstructL(); - - // count of servers set to rule - TInt ruleServerCount = iRule->MediaServerCount(); - - // Cycle trough all servers - for (TInt index = 0; index < ruleServerCount; index++ ) - { - const TDesC8& ruleServerUDN = iRule->MediaServerL( index ); - - if (ruleServerUDN == server->MediaServer()) // compare UDNs - { - // found - break this loop - index = ruleServerCount; - // found - mark selected - item->SetSelectionStatus( ETrue ); - iSelectedItemCount++; - } - } - // append item to list - iItemArray->AppendL(item); - CleanupStack::Pop( item ); - CleanupStack::PopAndDestroy( devName ); - } - else // we don't need this kind of servers anymore so remove it - { - delete server; - iServers->Remove( idx ); - idx--; // remove transfers next item to current index - serverCount--; // servers on the list were reduced - } - } - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::DeleteAllServersFromRuleL -// Deletes all servers from rule -// -------------------------------------------------------------------------- -// -void CMSStoreServersSetting::DeleteAllServersFromRuleL() - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::\ - CMSStoreServersSetting")); - - // count of servers set to rule - TInt ruleServerCount = iRule->MediaServerCount(); - - for ( TInt index = ruleServerCount-1; index >= 0; index-- ) - { - const TDesC8& ruleServerUDN = iRule->MediaServerL( index ); - iRule->DeleteMediaServer( ruleServerUDN ); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::CountSelectedItems -// Counts selected items -// -------------------------------------------------------------------------- -// -TInt CMSStoreServersSetting::CountSelectedItems() - { - LOG(_L("[MediaServant]\t CMSRuleServersSetting::\ - CMSStoreServersSetting")); - - TInt count(0); - - for ( TInt index = 0; index < iItemArray->Count(); index++ ) - { - if ( (*iItemArray)[index]->SelectionStatus() ) - { - count++; - } - } - - return count; - } - -// -------------------------------------------------------------------------- -// CMSStoreServersSetting::SetSettingItemTextL -// Sets setting item secondary text according to selected items -// -------------------------------------------------------------------------- -// -void CMSStoreServersSetting::SetSettingItemTextL() - { - TInt count = CountSelectedItems(); - - HBufC* itemText = NULL; - // no items selected - if ( count == 0 ) - { - itemText = StringLoader::LoadLC( R_MS_NO_SELECTED_ITEMS ); - iSettingText->Des().Copy( *itemText ); - } - // just one item selected - else if ( count == 1 ) - { - TInt itemCount = iItemArray->Count(); - for ( TInt index = 0; index < itemCount; index++ ) - { - CSelectableItem* item = (*iItemArray)[ index ]; - if ( item->SelectionStatus() ) - { - iSettingText->Des().Copy( item->ItemText() ); - index = itemCount; // break loop - } - } - } - // more than one item selected - else - { - itemText = StringLoader::LoadLC( R_MS_ITEM_DEVICES, count ); - - // do number conversion - TPtr ptr = itemText->Des(); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); - - iSettingText->Des().Copy( *itemText ); - } - - if ( itemText ) - { - CleanupStack::PopAndDestroy( itemText ); - } - - // Set new value - SetExternalText( *iSettingText ); - } -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msstoresettingslist.cpp --- a/homesync/contentmanager/mediaservant/src/msstoresettingslist.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,410 +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: CMSStoreSettingsList class implementation -* -*/ - - -#include -#include - -#include "cmsqlpropertycontainer.h" -#include "mserv.hlp.hrh" -#include "cmstorerule.h" -#include "cmstorerulecontainer.h" -#include "msengine.h" -#include "msstorelistcontroller.h" -#include "msappui.h" -#include "msstoresettingslist.h" -#include "msstoresettingsview.h" -#include "msconstants.h" -#include "msstoreserverssetting.h" // Servers -#include "msstorekeeponphonesetting.h" // Keep on phone -#include "mediaservant.hrh" -#include "mediaservantuid.h" -#include "msdebug.h" - - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::NewL() -// Two phase constructor. -// -------------------------------------------------------------------------- -// -CMSStoreSettingsList* CMSStoreSettingsList::NewL( TInt aResourceId, - CMSAppUi& aAppUi, CMSStoreSettingsView& aView ) - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::NewL")); - - CMSStoreSettingsList* self = - CMSStoreSettingsList::NewLC( aResourceId, - aAppUi, - aView ); - CleanupStack::Pop( self ); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::NewLC() -// Two phase constructor. -// -------------------------------------------------------------------------- -// -CMSStoreSettingsList* CMSStoreSettingsList::NewLC( TInt aResourceId, - CMSAppUi& aAppUi, CMSStoreSettingsView& aView ) - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::NewLC")); - - CMSStoreSettingsList* self = - new ( ELeave ) CMSStoreSettingsList( aAppUi, aView ); - CleanupStack::PushL( self ); - self->ConstructL( aResourceId ); - - return self; - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::CMSStoreSettingsList() -// -------------------------------------------------------------------------- -// -CMSStoreSettingsList::CMSStoreSettingsList( CMSAppUi& aAppUi, - CMSStoreSettingsView& aView ) - : iAppUi( aAppUi ), iView( aView ) - { - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::~CMSStoreSettingsList() -// -------------------------------------------------------------------------- -// -CMSStoreSettingsList::~CMSStoreSettingsList() - { - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::ConstructL() -// Second phase constructor. -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::ConstructL( TInt aResourceId ) - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::ConstructL")); - - iAppUi.MSEngine()->SetObserver( this ); - - // get selected item index from previous screen - TInt selected = iAppUi.ParameterAgent()->StoreViewFocusIndex(); - - // get list container - iStoreRuleContainer = - iAppUi.StoreListController()->StoreListContainer(); - - // get rule - iStoreRule = iStoreRuleContainer->StoreRule( selected ); - - // read media type - iStoreRule->StoreRule(0, &iMediaType); - - // Set title pane - SetTitlePaneTextL(); - - // Read rule status - ReadRuleStatus(); - - CAknSettingItemList::ConstructFromResourceL( aResourceId ); - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::SaveKeepOnPhoneSetting -// Save value to rule -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::SaveKeepOnPhoneSetting() - { - // KEEP ON PHONE - switch ( iKeepOnPhone ) - { - case EMSDontKeep: - { - iStoreRule->SetStatus( ECmToBeRemoved ); - break; - } - case EMSKeep: - { - iStoreRule->SetStatus( ECmKeepOnDevice ); - break; - } - case EMSKeepOriginalSize: - { - iStoreRule->SetStatus( ECmKeepOnDevice ); - break; - } - case EMSKeepScreenSize: - { - iStoreRule->SetStatus( ECmToBeShrinked ); - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::\ - SaveValues keep on phone setting not found")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::ReadRuleStatus -// Reads rule status -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::ReadRuleStatus() - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::ReadRuleStatus")); - - switch ( iStoreRule->Status() ) - { - case ECmToBeRemoved: - { - iKeepOnPhone = EMSDontKeep; - break; - } - case ECmKeepOnDevice: - { - if ( iMediaType == ECmImage || iMediaType == ECmOtherImage ) - { - iKeepOnPhone = EMSKeepOriginalSize; - } - else - { - iKeepOnPhone = EMSKeep; - } - break; - } - case ECmToBeShrinked: - { - iKeepOnPhone = EMSKeepScreenSize; - break; - } - default: - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::\ - SaveValues keep on phone setting not found")); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CAknSettingItem* CMSStoreSettingsList::CreateSettingItemL() -// Takes care of creating actual setting items. -// -------------------------------------------------------------------------- -// -CAknSettingItem* CMSStoreSettingsList::CreateSettingItemL( TInt aIdentifier ) - { - CAknSettingItem* settingItem = NULL; - - // setting item is created according to aIdentifier - switch ( aIdentifier ) - { - case EMSKeepOnPhone: - { - settingItem = new ( ELeave ) CMSStoreKeepOnPhoneSetting( - aIdentifier, - iMediaType, - iKeepOnPhone ); - break; - } - - case EMSSourceServers: - { - settingItem = CMSStoreServersSetting::NewL( - aIdentifier, - iStoreRule, - iAppUi, - iDummyText ); - break; - } - default: - { - LOG( _L( "[MediaServant]\t CMSStoreSettingsList::\ - CreateSettingItemL invalid setting item" ) ); - break; - } - } - return settingItem; - } - - -// --------------------------------------------------------- -// CMSStoreSettingsList::OpenSelectedListboxItemL -// --------------------------------------------------------- -// -void CMSStoreSettingsList::OpenSelectedListboxItemL() - { - HandleListBoxEventL( ListBox(), EEventEnterKeyPressed ); - } - - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::HandleListBoxEventL() -// Handles listbox events -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::HandleListBoxEventL ( CEikListBox *aListBox, - TListBoxEvent aEventType) - { - // Base class call - CAknSettingItemList::HandleListBoxEventL ( aListBox, aEventType ); - // values need to be stored - StoreSettingsL(); - - - CAknSettingItemArray* itemArray = SettingItemArray(); - - TInt currentItem = ListBox()->CurrentItemIndex(); - if ( currentItem < itemArray->Count() ) - { - CAknSettingItem* item= (*itemArray)[currentItem]; - - // show add fill rule query if last item "Add more rules" selected - if ( item->Identifier() == EMSKeepOnPhone ) - { - SaveKeepOnPhoneSetting(); - } - } - } - - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::ReadyL() -// engine observer callback -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::ReadyL( TCmService aService, TInt /*aError*/ ) - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::ReadyL")); - - switch ( aService ) - { - - case ECmServiceStore: - { - // stop showing 'reading date text - iView.ClearCurrentNaviPaneText(); - break; - } - - default: - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::ReadyL \ - service not found")); - break; - } - } - - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::SetTitlePaneTextL -// Sets title pane text -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::SetTitlePaneTextL() - { - LOG( _L( "[MediaServant]\t CMSStoreSettingsList::SetTitlePaneTextL" ) ); - - HBufC* title(0); - - switch ( iMediaType ) - { - case ECmVideo: - { - title = StringLoader::LoadLC( R_MS_STORE_TITLE_PHONE_VIDEOS ); - break; - } - case ECmOtherVideo: - { - title = StringLoader::LoadLC( R_MS_STORE_TITLE_VIDEOS ); - break; - } - case ECmOtherImage: - { - title = StringLoader::LoadLC( R_MS_STORE_TITLE_IMAGES ); - break; - } - case ECmAudio: - { - title = StringLoader::LoadLC( R_MS_STORE_TITLE_MUSIC ); - break; - } - case ECmImage: - { - title = StringLoader::LoadLC( R_MS_STORE_TITLE_PHONE_IMAGES ); - break; - } - default: - { - LOG( _L( "[MediaServant]\t CMSStoreSettingsList::\ - SetTitlePaneTextL invalid mediatype" ) ); - break; - } - } - - if ( title ) - { - // Set title pane text - iView.SetTitlePaneTextL( *title ); - CleanupStack::PopAndDestroy( title ); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::SizeChanged() -// Called by framework when the view size is changed. -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::SizeChanged() - { - ListBox()->SetRect( Rect() ); // Set rectangle of listbox. - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsList::HandleResourceChange -// Handles layout change -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsList::HandleResourceChange( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetRect( iView.ClientRect() ); - } - - CCoeControl::HandleResourceChange( aType ); - } - -// --------------------------------------------------------------------------- -// CMSStoreSettingsList::GetHelpContext -// --------------------------------------------------------------------------- -// -void CMSStoreSettingsList::GetHelpContext( TCoeHelpContext& aContext ) const - { - LOG(_L("[MediaServant]\t CMSStoreSettingsList::GetHelpContext")); - - aContext.iMajor = TUid::Uid(KMediaServantUID3); - aContext.iContext = KMSERV_HLP_STORE_SETTINGS; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/contentmanager/mediaservant/src/msstoresettingsview.cpp --- a/homesync/contentmanager/mediaservant/src/msstoresettingsview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +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: CMSStoreSettingsView class implementation -* -*/ - - -#include -#include - -#include "msstoresettingslist.h" -#include "msstorelistcontroller.h" -#include "msengine.h" -#include "msstoresettingsview.h" -#include "msappui.h" -#include "msconstants.h" -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CMSStoreSettingsView::CMSStoreSettingsView() -// -------------------------------------------------------------------------- -// -CMSStoreSettingsView::CMSStoreSettingsView( CMSAppUi& aAppUi ) : - iAppUi( aAppUi ) - { - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsView::ConstructL() -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsView::ConstructL() - { - LOG(_L("[MediaServant]\t CMSStoreSettingsView::ConstructL")); - - BaseConstructL( R_MS_STORE_SETTINGS_VIEW ); - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsView::~CMSStoreSettingsView() -// -------------------------------------------------------------------------- -// -CMSStoreSettingsView::~CMSStoreSettingsView() - { - LOG(_L("[MediaServant]\t CMSStoreSettingsView::~CMSFillRuleEditView")); - - DoDeactivate(); - } - -// -------------------------------------------------------------------------- -// TUid CMSStoreSettingsView::Id() -// -------------------------------------------------------------------------- -// -TUid CMSStoreSettingsView::Id() const - { - LOG(_L("[MediaServant]\t CMSStoreSettingsView::Id")); - - return KMSStoreSettingsViewId; - } - - -// -------------------------------------------------------------------------- -// CMSStoreSettingsView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsView::HandleCommandL(TInt aCommand) - { - LOG(_L("[MediaServant]\t CMSStoreSettingsView::HandleCommandL")); - - switch (aCommand) - { - case EAknCmdOpen: - { - iContainer->OpenSelectedListboxItemL(); - break; - } - case EAknSoftkeyDone: - { - // getting data not yet finished so we must cancel the operation - TCmServerState state; - iAppUi.MSEngine()->ServerState( state ); - if ( state == ECmServerStateGettingStoreFields ) - { - LOG( _L( "[MediaServant]\t CMSFillRuleEditList::\ - ~CMSFillRuleEditList cancel operation" ) ); - iAppUi.MSEngine()->StopOperation(); - ClearCurrentNaviPaneText(); - } - - // Get store list container - CCmStoreRuleContainer* storeRuleContainer = - iAppUi.StoreListController()->StoreListContainer(); - - // Set rules to server - iAppUi.MSEngine()->SetStoreRulesL( storeRuleContainer ); - - iAppUi.ChangeViewL( KMSStoreSettingsViewId, KMSStoreListViewId ); - break; - } - case EAknCmdHelp : - { - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - default: - { - AppUi()->HandleCommandL(aCommand); - break; - } - } - } - - -// -------------------------------------------------------------------------- -// CMSStoreSettingsView::DoActivateL() -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - LOG(_L("[MediaServant]\t CMSStoreSettingsView::DoActivateL")); - - if ( !iContainer ) - { - // create settings screen - iContainer = CMSStoreSettingsList::NewL( R_MS_STORE_SETTINGS_LIST, - iAppUi, - *this ); - iContainer->SetMopParent( this ); - - // now control receives keyboard events - iAppUi.AddToStackL( *this, iContainer ); - iContainer->ActivateL(); - } - } - -// -------------------------------------------------------------------------- -// CMSStoreSettingsView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CMSStoreSettingsView::DoDeactivate() - { - LOG(_L("[MediaServant]\t CMSStoreSettingsView::DoDeactivate")); - - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; // Deletes the container class object. - iContainer = NULL; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/group/bld.inf --- a/homesync/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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 information file for mediaservant -* -*/ - - -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -WINSCW ARMV5 - - -PRJ_EXPORTS -../group/msdebug.h |../../inc/msdebug.h -../install/mediaservant_stub.SIS /epoc32/data/z/system/install/mediaservant_stub.sis -../rom/mediaservant.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mediaservant.iby) -../rom/mediaservantresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(mediaservantresources.iby) -../conf/mediaservant.confml APP_LAYER_CONFML(component.confml) -../conf/mediaservant_10281fab.crml APP_LAYER_CRML(component_10281fab.crml) - - -PRJ_MMPFILES -#include "../contentmanager/cmserver/cmmemorymanager/group/bld.inf" -#include "../contentmanager/cmserver/cmfillmanager/group/bld.inf" -#include "../contentmanager/cmserver/cmstoremanager/group/bld.inf" -#include "../contentmanager/cmserver/cmscheduler/group/bld.inf" -#include "../contentmanager/cmserver/cmserver/group/bld.inf" -#include "../contentmanager/mediaservant/applicationengine/group/bld.inf" -#include "../contentmanager/homesyncwizard/group/bld.inf" -#include "../contentmanager/homesyncgsplugin/group/bld.inf" -#include "../contentmanager/mediaservant/group/bld.inf" - -// end of file \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/group/build_mediaservant.bat --- a/homesync/group/build_mediaservant.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Build mediaservant -rem - -echo on -echo Building !! - -call bldmake bldfiles -call abld build armv5 >"%DRIVE%"\mediaservant_2.1\group\mediaservant_armv5.txt 2>&1 -call abld build armv5 -c >"%DRIVE%"\mediaservant_2.1\group\mediaservant_armv5_check.txt 2>&1 -cd "%DRIVE%"\mediaservant_2.1\install -call mediaservant_sis.bat -call mediaservant_stub_sis.bat -cd "%DRIVE%"\ - -echo Done !!! -echo off diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/group/clean_mediaservant.bat --- a/homesync/group/clean_mediaservant.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Clean mediaservant -rem - -echo on -echo Cleaning !! - -del mediaservant_armv5.txt -del mediaservant_armv5_check.txt - -call abld reallyclean -call bldmake clean - -echo Done !!! -echo off - diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/group/mediaservantvariant.hrh --- a/homesync/group/mediaservantvariant.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2007 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: MediaServant variation flags -* -* The file is included by any code (cpp and resource) that needs to -* have static (compilation time, link time, image build time) or -* dynamic (run time) variation support for variant specific features. -* -* Each feature is declared as follows: -* - declare a supported or turned-on feature (static variation) -* - #define __FXX -* - declare an unsupported or turned-off feature (static variation) -* - #undef __FXX -* - declare ID for dynamic variation (see Feature Manager component) -* - #define KFeatureIdFxx KOtherFeatureFirst + nn -* -* -*/ - - -#ifndef MEDIASERVANTVARIANT_HRH -#define MEDIASERVANTVARIANT_HRH - -/** -* This flag indicates that MdS is used as a metadata storage -*/ -//#define __USE_MDS_FOR_METADATA - -/* Whether to use libxml2 or Symbian native parser in Cds Sync */ -//#define __USE_LIBXML2_PARSER - -//#define __USE_REDUCED_CAPABILITIES - -#endif diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/group/msdebug.h --- a/homesync/group/msdebug.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Common trace-information file. -* -*/ - - -#ifndef DEBUG_H -#define DEBUG_H - -/** - * NOTE: Link to flogger.lib in MMP file. Use DEBUGLIBRARY -keyword to avoid - * warnings in release builds. - * Example: DEBUGLIBRARY flogger.lib - */ - -/** - * Usage: LOG(_L("[MODULE_NAME]\t Trace text here")); - * TRACE(Print(_L("[MODULE_NAME]\t Trace text here with parameter %d"), - * iCount)); - * - * Trace target can be changed below (file logging needs directory - * c:\logs\upnp) - * #define __FLOGGING -row uncommented (default) = File logging - * #define __CLOGGING -row uncommented = Console logging - */ - -// undefine for sure -#undef __FLOGGING__ -#undef __CLOGGING__ - -#ifdef _DEBUG -// Define one of these flags: -// FLOGGING = File logging -// CLOGGING = Console logging -#define __FLOGGING__ -//#define __CLOGGING__ -#endif - - - -// Then actual definitions depending on the -// flag values. - -#ifdef _DEBUG - - #include - - - // Actual log file name - _LIT(KLogFile,"ComponentLog.txt"); - - // Subdirectory under c:\logs -directory - _LIT(KLogDir, "component"); - - #include - #include - - - // Define the top level macros - #define LOG(a) {Print(a);} - #define TRACE(a) {a;} - - - #ifdef __FLOGGING__ - - inline void Print(const TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list,aFmt); - TBuf<32> logFile(KLogFile); - RFileLogger::WriteFormat( KLogDir, - logFile, - EFileLoggingModeAppend, - aFmt, - list ); - } - - #else - // Console Logging on - #define Print RDebug::Print - - #endif // __FLOGGING__ - -#else - - // DEBUG build is not on --> no logging at all - #define LOG(a) - #define TRACE(a) - -#endif // _DEBUG - -#endif // DEBUG_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/install/empty.sq diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/install/make_mediaservant_sis.bat --- a/homesync/install/make_mediaservant_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Mediaservant sisx -rem - -makesis cenrep.pkg -signsis cenrep.sis cenrep.sisx rd.cer rd-key.pem - -makesis mediaservant.pkg -signsis mediaservant.sis mediaservant.sisx rd.cer rd-key.pem -del ..\sis\mediaservant.sis /F -del ..\sis\mediaservant.sisx /F -move .\mediaservant.sis ..\sis -move .\mediaservant.sisx ..\sis diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/install/make_mediaservant_stub_sis.bat --- a/homesync/install/make_mediaservant_stub_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Mediaservant stub sis -rem - -del mediaservant_stub.sis /F -makesis -s mediaservant_stub.pkg diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/install/mediaservant.pkg --- a/homesync/install/mediaservant.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +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: Mediaservatn package -; -; mediaservant.pkg -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"Home Sync"},(0x20022D5B),1,1,0, TYPE=SA, RU - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - - -; Files to copy -"\epoc32\release\armv5\urel\mediaservant.exe"-"!:\sys\bin\mediaservant.exe" -"\epoc32\data\z\private\10003a3f\apps\mediaservant_reg.rsc"-"!:\private\10003a3f\import\apps\mediaservant_reg.rsc" -"\epoc32\data\z\resource\apps\mediaservant_aif.mif"-"!:\resource\apps\mediaservant_aif.mif" -"\epoc32\data\z\resource\apps\mediaservant.mif"-"!:\resource\apps\mediaservant.mif" -"\epoc32\release\armv5\urel\msengine.dll"-"!:\sys\bin\msengine.dll" -"\epoc32\release\armv5\urel\msappwizard.dll"-"!:\sys\bin\msappwizard.dll" -"\epoc32\data\z\resource\apps\msappwizard.mif"-"!:\resource\apps\msappwizard.mif" - -; Mediaservant plugin -"\epoc32\data\z\resource\plugins\mediaservantplugin.rsc"-"!:\resource\plugins\mediaservantplugin.rsc" -"\epoc32\release\armv5\urel\mediaservantplugin.dll"-"!:\sys\bin\mediaservantplugin.dll" - -; GS plugin -"\epoc32\data\z\resource\plugins\msgsplugin.rsc"-"!:\resource\plugins\msgsplugin.rsc" -"\epoc32\release\armv5\urel\msgsplugin.dll"-"!:\sys\bin\msgsplugin.dll" - -"\epoc32\release\armv5\urel\cmfillmanager.dll"-"!:\sys\bin\cmfillmanager.dll" -"\epoc32\release\armv5\urel\cmstoremanager.dll"-"!:\sys\bin\cmstoremanager.dll" -"\epoc32\release\armv5\urel\cmscheduler.dll"-"!:\sys\bin\cmscheduler.dll" -"\epoc32\release\armv5\urel\cmmemorymanager.dll"-"!:\sys\bin\cmmemorymanager.dll" -"\epoc32\release\armv5\urel\cmclient.dll"-"!:\sys\bin\cmclient.dll" -"\epoc32\release\armv5\urel\cmserver.exe"-"!:\sys\bin\cmserver.exe" - -"\epoc32\data\z\resource\apps\mediaservant.rsc"-"!:\resource\apps\mediaservant.rsc" -"\epoc32\data\z\resource\apps\cmsappwizard.rsc"-"!:\resource\apps\cmsappwizard.rsc" -"\epoc32\data\z\resource\apps\memorymanager.rsc"-"!:\resource\apps\memorymanager.rsc" -"\epoc32\data\z\resource\msgspluginsrc.rsc"-"!:\resource\msgspluginsrc.rsc" - -; End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/install/mediaservant_stub.SIS Binary file homesync/install/mediaservant_stub.SIS has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/install/mediaservant_stub.pkg --- a/homesync/install/mediaservant_stub.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +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: Mediaservant stub package -; -; mediaservant_stub.pkg -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"MediaServant"},(0x20022D5B),1,1,0, TYPE=SA - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -;[0x101F7961], 0, 0, 0, {"S60ProductID"} - -""-"z:\sys\bin\mediaservant.exe" -""-"z:\sys\bin\msengine.dll" -""-"z:\sys\bin\msappwizard.dll" -""-"z:\sys\bin\mediaservantplugin.dll" -""-"z:\sys\bin\msgsplugin.dll" -""-"z:\sys\bin\cmfillmanager.dll" -""-"z:\sys\bin\cmstoremanager.dll" -""-"z:\sys\bin\cmscheduler.dll" -""-"z:\sys\bin\cmmemorymanager.dll" -""-"z:\sys\bin\cmclient.dll" -""-"z:\sys\bin\cmserver.exe" - -""-"z:\resource\apps\mediaservant.r*" -""-"z:\resource\apps\mediaservant.mif" -""-"z:\resource\apps\mediaservant_aif.mif" -""-"z:\resource\apps\msappwizard.mif" -""-"z:\resource\apps\cmsappwizard.r*" -""-"z:\resource\apps\memorymanager.r*" -""-"z:\resource\msgspluginsrc.r*" -""-"z:\resource\plugins\msgsplugin.r*" -""-"z:\resource\plugins\mediaservantplugin.r*" - -""-"z:\private\10003a3f\import\apps\mediaservant_reg.r*" - -; End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/rom/mediaservant.iby --- a/homesync/rom/mediaservant.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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: Mediaservant iby -* -*/ -#ifndef __MEDIASERVANT_IBY__ -#define __MEDIASERVANT_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - -#include - -// Application and setup wizard -file=ABI_DIR\BUILD_DIR\mediaservant.exe \sys\bin\mediaservant.exe -data=\epoc32\data\z\private\10003a3f\apps\mediaservant_reg.rsc \private\10003a3f\import\apps\mediaservant_reg.rsc -data=\epoc32\data\z\resource\apps\mediaservant_aif.mif \resource\apps\mediaservant_aif.mif -data=\epoc32\data\z\resource\apps\mediaservant.mif \resource\apps\mediaservant.mif -file=ABI_DIR\BUILD_DIR\msengine.dll \sys\bin\msengine.dll -file=ABI_DIR\BUILD_DIR\msappwizard.dll \sys\bin\msappwizard.dll -data=\epoc32\data\z\resource\apps\msappwizard.mif \resource\apps\msappwizard.mif -data=\epoc32\data\z\resource\apps\msgsplugin.mif \resource\apps\msgsplugin.mif - -// Plugins -ECOM_PLUGIN( mediaservantplugin.dll, mediaservantplugin.rsc ) -ECOM_PLUGIN( msgsplugin.dll, msgsplugin.rsc ) - -// Engine -file=ABI_DIR\BUILD_DIR\cmfillmanager.dll \sys\bin\cmfillmanager.dll -file=ABI_DIR\BUILD_DIR\cmstoremanager.dll \sys\bin\cmstoremanager.dll -file=ABI_DIR\BUILD_DIR\cmscheduler.dll \sys\bin\cmscheduler.dll -file=ABI_DIR\BUILD_DIR\cmmemorymanager.dll \sys\bin\cmmemorymanager.dll -file=ABI_DIR\BUILD_DIR\cmclient.dll \sys\bin\cmclient.dll -file=ABI_DIR\BUILD_DIR\cmserver.exe \sys\bin\cmserver.exe - -// export mediaservant_stub.sis file -data=ZSYSTEM\install\mediaservant_stub.sis system\install\mediaservant_stub.sis - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __MEDIASERVANT_IBY__ \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff homesync/rom/mediaservantresources.iby --- a/homesync/rom/mediaservantresources.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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: Mediaservant resources iby -* -*/ -#ifndef __MEDIASERVANTRESOURCES_IBY__ -#define __MEDIASERVANTRESOURCES_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - -#include - -// Application and setup wizard -data=\epoc32\data\z\resource\apps\mediaservant.rsc \resource\apps\mediaservant.rsc -data=\epoc32\data\z\resource\apps\cmsappwizard.rsc \resource\apps\cmsappwizard.rsc - -// Engine -data=\epoc32\data\z\resource\apps\memorymanager.rsc \resource\apps\memorymanager.rsc - -// msgsplugin -data=DATAZ_\RESOURCE_FILES_DIR\msgspluginsrc.rsc RESOURCE_FILES_DIR\msgspluginsrc.rsc - -// cmserver startup disabled -//data=\epoc32\data\z\resource\apps\cmserver_reg.rsc \private\10003a3f\import\apps\cmserver_reg.rsc -//data=\epoc32\data\z\resource\apps\cmserver.rsc \private\101f875a\import\[100FFFFF].rsc - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __MEDIASERVANTRESOURCES_IBY__ \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff install/make_sis.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/make_sis.cmd Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,89 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem + +@echo off +cls +echo. +echo ======================================================================== +echo CREATING THE UPGRADE SIS FILE FOR DLNA SERVICES +echo ======================================================================== +echo. +echo Verifying that the required PKG files can be found... + +IF NOT EXIST .\pkg\dlnasrv_cenrep_keys.pkg goto sis_pkg_error +IF NOT EXIST .\pkg\dlnasrv.pkg goto sis_pkg_error + +echo [OK] + +echo. +echo Deleting the old SIS, SISX and PKG files (if any) from this directory... + +IF EXIST .\dlnasrv_cenrep_keys.pkg del .\dlnasrv_cenrep_keys.pkg /F /Q +IF EXIST .\dlnasrv.pkg del .\dlnasrv.pkg /F /Q + +echo [OK] + +echo. +echo Copying PKG files... + +xcopy .\pkg\dlnasrv_cenrep_keys.pkg . +xcopy .\pkg\dlnasrv.pkg . + +echo [OK] + +echo. +echo Generating cenrep SIS file... + +makesis dlnasrv_cenrep_keys.pkg + +echo. +echo [OK] + +echo. +echo Generating dlnasrv SIS file... + +makesis dlnasrv.pkg + +echo. +echo [OK] + +echo. +echo DONE. + +goto end + + +REM ========================================================================== +REM Error notes +REM ========================================================================== + +:sis_pkg_error +echo. +echo ERROR: One or more required PKG files missing! +goto echo_failed + +:echo_failed +echo. +echo FAILED. +echo. + +:end + +REM Delete temporary files +IF EXIST .\dlnasrv_cenrep_keys.pkg del .\dlnasrv_cenrep_keys.pkg /F /Q +IF EXIST .\dlnasrv.pkg del .\dlnasrv.pkg /F /Q + +@echo on diff -r 6369bfd1b60d -r 08b5eae9f9ff install/make_udeb_sis.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/make_udeb_sis.cmd Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,89 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem + +@echo off +cls +echo. +echo ======================================================================== +echo CREATING THE UPGRADE SIS FILE FOR DLNA SERVICES +echo ======================================================================== +echo. +echo Verifying that the required PKG files can be found... + +IF NOT EXIST .\pkg\dlnasrv_cenrep_keys.pkg goto sis_pkg_error +IF NOT EXIST .\pkg\dlnasrv.pkg goto sis_pkg_error + +echo [OK] + +echo. +echo Deleting the old SIS, SISX and PKG files (if any) from this directory... + +IF EXIST .\dlnasrv_cenrep_keys.pkg del .\dlnasrv_cenrep_keys.pkg /F /Q +IF EXIST .\dlnasrv.pkg del .\dlnasrv.pkg /F /Q + +echo [OK] + +echo. +echo Copying PKG files... + +xcopy .\pkg\dlnasrv_cenrep_keys.pkg . +xcopy .\pkg\dlnasrv_udeb.pkg . + +echo [OK] + +echo. +echo Generating cenrep SIS file... + +makesis dlnasrv_cenrep_keys.pkg + +echo. +echo [OK] + +echo. +echo Generating dlnasrv SIS file... + +makesis dlnasrv_udeb.pkg + +echo. +echo [OK] + +echo. +echo DONE. + +goto end + + +REM ========================================================================== +REM Error notes +REM ========================================================================== + +:sis_pkg_error +echo. +echo ERROR: One or more required PKG files missing! +goto echo_failed + +:echo_failed +echo. +echo FAILED. +echo. + +:end + +REM Delete temporary files +IF EXIST .\dlnasrv_cenrep_keys.pkg del .\dlnasrv_cenrep_keys.pkg /F /Q +IF EXIST .\dlnasrv_udeb.pkg del .\dlnasrv_udeb.pkg /F /Q + +@echo on diff -r 6369bfd1b60d -r 08b5eae9f9ff install/pkg/dlnasrv.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/pkg/dlnasrv.pkg Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,86 @@ +; +; 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: Package file for DLNA services +; + +; Languages +&EN + +; Standard SIS file header +#{"DLNA Services"},(0x2000F8DB),1,1,0, TYPE=SA, RU + +; Localized Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; --------------------------------------------------------------------------- +; upnpavcontroller +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\urel\upnpavcontrollerclient.dll" - "!:\sys\bin\upnpavcontrollerclient.dll" +"\epoc32\release\armv5\urel\upnpavcontrollerserver.exe" - "!:\sys\bin\upnpavcontrollerserver.exe" +"\epoc32\release\armv5\urel\upnpavcontrollerhelper.dll" - "!:\sys\bin\upnpavcontrollerhelper.dll" +"\epoc32\release\armv5\urel\upnprenderingstatemachine.dll" - "!:\sys\bin\upnprenderingstatemachine.dll" +"\epoc32\release\armv5\urel\upnpxmlparser.dll" - "!:\sys\bin\upnpxmlparser.dll" + +; --------------------------------------------------------------------------- +; upnpframework +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\urel\upnputilities.dll" - "!:\sys\bin\upnputilities.dll" +"\epoc32\release\armv5\urel\upnpcommand.dll" - "!:\sys\bin\upnpcommand.dll" +"\epoc32\release\armv5\urel\upnpconnmon.dll" - "!:\sys\bin\upnpconnmon.dll" +"\epoc32\release\armv5\urel\upnpthumbnailcreator.dll" - "!:\sys\bin\upnpthumbnailcreator.dll" +"\epoc32\release\armv5\urel\upnpfiletransferengine.dll" - "!:\sys\bin\upnpfiletransferengine.dll" +"\epoc32\release\armv5\urel\upnpmusicadapter.dll" - "!:\sys\bin\upnpmusicadapter.dll" + +; --------------------------------------------------------------------------- +; upnpmediaserver +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\urel\avconnectionmanager.dll" - "!:\sys\bin\avconnectionmanager.dll" +"\epoc32\release\armv5\urel\avcontentdirectory.dll" - "!:\sys\bin\avcontentdirectory.dll" +"\epoc32\release\armv5\urel\avmediaserverclient.dll" - "!:\sys\bin\avmediaserverclient.dll" +"\epoc32\release\armv5\urel\upnpavobjects.dll" - "!:\sys\bin\upnpavobjects.dll" +"\epoc32\release\armv5\urel\avmediaserver.exe" - "!:\sys\bin\avmediaserver.exe" +"\epoc32\data\z\private\101f977c\objects.xml" - "!:\private\101f977c\objects.xml" +"\epoc32\data\z\private\101f977c\public\MediaServer1\ConnectionManager1.xml" - "!:\private\101f977c\public\MediaServer1\ConnectionManager1.xml" +"\epoc32\data\z\private\101f977c\public\MediaServer1\ContentDirectory1.xml" - "!:\private\101f977c\public\MediaServer1\ContentDirectory1.xml" +"\epoc32\data\z\private\101f977c\public\MediaServer1\MediaServer1.xml" - "!:\private\101f977c\public\MediaServer1\MediaServer1.xml" +"\epoc32\data\z\private\101f977c\backup_registration.xml" - "!:\private\101f977c\backup_registration.xml" +"\epoc32\data\z\private\101f977d\backup_registration.xml" - "!:\private\101f977d\backup_registration.xml" + +; --------------------------------------------------------------------------- +; upnpsettings +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\urel\upnpsettingsengine.dll" - "!:\sys\bin\upnpsettingsengine.dll" + +; --------------------------------------------------------------------------- +; upnpsharing +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\urel\upnpsecuritymanagerclient.dll" - "!:\sys\bin\upnpsecuritymanagerclient.dll" +"\epoc32\release\armv5\urel\upnpsecuritymanagerserver.exe" - "!:\sys\bin\upnpsecuritymanagerserver.exe" +"\epoc32\data\Z\resource\UPnPNotifier.RSC" - "!:\resource\UPnPNotifier.RSC" +"\epoc32\release\armv5\urel\upnpsecurity.dll" - "!:\sys\bin\upnpsecurity.dll" +"\epoc32\release\armv5\urel\upnpsecuritymanagerplugin.dll" - "!:\sys\bin\upnpsecuritymanagerplugin.dll" +"\epoc32\data\Z\resource\plugins\upnpsecuritymanagerplugin.rsc" - "!:\resource\plugins\upnpsecuritymanagerplugin.rsc" +"\epoc32\release\armv5\urel\dlnaprofiler.dll" - "!:\sys\bin\dlnaprofiler.dll" +"\epoc32\release\armv5\urel\upnpsharingalgorithm.dll" - "!:\sys\bin\upnpsharingalgorithm.dll" +"\epoc32\data\Z\resource\upnpsharingalgorithm.rsc" - "!:\resource\upnpsharingalgorithm.rsc" +"\epoc32\release\armv5\urel\upnpcontentserverclient.dll" - "!:\sys\bin\upnpcontentserverclient.dll" +"\epoc32\release\armv5\urel\upnpcontentserver.exe" - "!:\sys\bin\upnpcontentserver.exe" + +; End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff install/pkg/dlnasrv_cenrep_keys.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/pkg/dlnasrv_cenrep_keys.pkg Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,42 @@ +; +; 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: Package file for DLNA services central repository keys +; + +; Languages +&EN + +; Standard SIS file header +#{"DLNA Services cenrep keys"}, (0x10202BE9), 1, 1, 0, TYPE=SP + +; Supports Series 60 v3.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Localised vendor name +%{"Nokia-EN"} + +; Unique vendor name +:"Nokia" + +; --------------------------------------------------------------------------- +; upnpsettings +; --------------------------------------------------------------------------- +"\epoc32\data\z\private\10202be9\20009cae.txt" - "!:\private\10202be9\persists\20009cae.txt" + +; --------------------------------------------------------------------------- +; upnpsharing +; --------------------------------------------------------------------------- +"..\upnpsharing\upnpcontentserver\cenrep\20007564.cre" - "!:\private\10202be9\persists\20007564.cre" + +; End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff install/pkg/dlnasrv_udeb.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/pkg/dlnasrv_udeb.pkg Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,87 @@ +; +; 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: Package file for DLNA services +; + +; Languages +&EN + +; Standard SIS file header +;#{"DLNA Services"},(0x2000F8DB),1,1,0, TYPE=SA, RU +#{"DLNA Services"},(0xEFFFFFFF),1,1,0, TYPE=SA, RU + +; Localized Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Supports Series 60 v 3.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; --------------------------------------------------------------------------- +; upnpavcontroller +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\udeb\upnpavcontrollerclient.dll" - "!:\sys\bin\upnpavcontrollerclient.dll" +"\epoc32\release\armv5\udeb\upnpavcontrollerserver.exe" - "!:\sys\bin\upnpavcontrollerserver.exe" +"\epoc32\release\armv5\udeb\upnpavcontrollerhelper.dll" - "!:\sys\bin\upnpavcontrollerhelper.dll" +"\epoc32\release\armv5\udeb\upnprenderingstatemachine.dll" - "!:\sys\bin\upnprenderingstatemachine.dll" +"\epoc32\release\armv5\udeb\upnpxmlparser.dll" - "!:\sys\bin\upnpxmlparser.dll" + +; --------------------------------------------------------------------------- +; upnpframework +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\udeb\upnputilities.dll" - "!:\sys\bin\upnputilities.dll" +"\epoc32\release\armv5\udeb\upnpcommand.dll" - "!:\sys\bin\upnpcommand.dll" +"\epoc32\release\armv5\udeb\upnpconnmon.dll" - "!:\sys\bin\upnpconnmon.dll" +"\epoc32\release\armv5\udeb\upnpthumbnailcreator.dll" - "!:\sys\bin\upnpthumbnailcreator.dll" +"\epoc32\release\armv5\udeb\upnpfiletransferengine.dll" - "!:\sys\bin\upnpfiletransferengine.dll" +"\epoc32\release\armv5\udeb\upnpmusicadapter.dll" - "!:\sys\bin\upnpmusicadapter.dll" + +; --------------------------------------------------------------------------- +; upnpmediaserver +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\udeb\avconnectionmanager.dll" - "!:\sys\bin\avconnectionmanager.dll" +"\epoc32\release\armv5\udeb\avcontentdirectory.dll" - "!:\sys\bin\avcontentdirectory.dll" +"\epoc32\release\armv5\udeb\avmediaserverclient.dll" - "!:\sys\bin\avmediaserverclient.dll" +"\epoc32\release\armv5\udeb\upnpavobjects.dll" - "!:\sys\bin\upnpavobjects.dll" +"\epoc32\release\armv5\udeb\avmediaserver.exe" - "!:\sys\bin\avmediaserver.exe" +"\epoc32\data\z\private\101f977c\objects.xml" - "!:\private\101f977c\objects.xml" +"\epoc32\data\z\private\101f977c\public\MediaServer1\ConnectionManager1.xml" - "!:\private\101f977c\public\MediaServer1\ConnectionManager1.xml" +"\epoc32\data\z\private\101f977c\public\MediaServer1\ContentDirectory1.xml" - "!:\private\101f977c\public\MediaServer1\ContentDirectory1.xml" +"\epoc32\data\z\private\101f977c\public\MediaServer1\MediaServer1.xml" - "!:\private\101f977c\public\MediaServer1\MediaServer1.xml" +"\epoc32\data\z\private\101f977c\backup_registration.xml" - "!:\private\101f977c\backup_registration.xml" +"\epoc32\data\z\private\101f977d\backup_registration.xml" - "!:\private\101f977d\backup_registration.xml" + +; --------------------------------------------------------------------------- +; upnpsettings +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\udeb\upnpsettingsengine.dll" - "!:\sys\bin\upnpsettingsengine.dll" + +; --------------------------------------------------------------------------- +; upnpsharing +; --------------------------------------------------------------------------- +"\epoc32\release\armv5\udeb\upnpsecuritymanagerclient.dll" - "!:\sys\bin\upnpsecuritymanagerclient.dll" +"\epoc32\release\armv5\udeb\upnpsecuritymanagerserver.exe" - "!:\sys\bin\upnpsecuritymanagerserver.exe" +"\epoc32\data\Z\resource\UPnPNotifier.RSC" - "!:\resource\UPnPNotifier.RSC" +"\epoc32\release\armv5\udeb\upnpsecurity.dll" - "!:\sys\bin\upnpsecurity.dll" +"\epoc32\release\armv5\udeb\upnpsecuritymanagerplugin.dll" - "!:\sys\bin\upnpsecuritymanagerplugin.dll" +"\epoc32\data\Z\resource\plugins\upnpsecuritymanagerplugin.rsc" - "!:\resource\plugins\upnpsecuritymanagerplugin.rsc" +"\epoc32\release\armv5\udeb\dlnaprofiler.dll" - "!:\sys\bin\dlnaprofiler.dll" +"\epoc32\release\armv5\udeb\upnpsharingalgorithm.dll" - "!:\sys\bin\upnpsharingalgorithm.dll" +"\epoc32\data\Z\resource\upnpsharingalgorithm.rsc" - "!:\resource\upnpsharingalgorithm.rsc" +"\epoc32\release\armv5\udeb\upnpcontentserverclient.dll" - "!:\sys\bin\upnpcontentserverclient.dll" +"\epoc32\release\armv5\udeb\upnpcontentserver.exe" - "!:\sys\bin\upnpcontentserver.exe" + +; End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff install/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/readme.txt Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,8 @@ +How to create dlnasrv sis package: +-------------------------------------------------------------------------------- +1. Run dlnasrv\install\make_sis.cmd +2. Sign dlnasrv.sis +3. Sign dlnasrv_cenrep_keys.sis + +NOTE: Both dlnasrv.sis and dlnasrv_cenrep_keys.sis are required to be able to use +dlna services! \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/rom/bld.inf --- a/upnpavcontroller/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 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" -* 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 information file for upnpavcontroller ROM -* -*/ - - -#include "../../group/upnpplatformvar.hrh" - - -PRJ_PLATFORMS - -PRJ_EXPORTS -// ROM build -../rom/upnpavcontroller.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpavcontroller.iby) - -PRJ_MMPFILES -// none diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/rom/upnpavcontroller.iby --- a/upnpavcontroller/rom/upnpavcontroller.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +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: upnpavcontroller subsystem ROM include file -* -*/ - - - - - -#ifndef __UPNPAVCONTROLLER_IBY__ -#define __UPNPAVCONTROLLER_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // AV Controller - file=ABI_DIR\BUILD_DIR\upnpavcontrollerclient.dll \sys\bin\upnpavcontrollerclient.dll - file=ABI_DIR\BUILD_DIR\upnpavcontrollerserver.exe \sys\bin\upnpavcontrollerserver.exe - file=ABI_DIR\BUILD_DIR\upnpavcontrollerhelper.dll \sys\bin\upnpavcontrollerhelper.dll - - // Upnp XML Parser - file=ABI_DIR\BUILD_DIR\upnpxmlparser.dll \sys\bin\upnpxmlparser.dll - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPAVCONTROLLER_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerhelper/inc/upnppushserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnppushserver.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,236 @@ +/* +* 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: Push transport server +* +*/ + +#ifndef UPNPPUSHSERVER_H +#define UPNPPUSHSERVER_H + +// INCLUDES +#include +#include + +#include +#include +#include "upnpcontentdirectorydatafinder.h" + + +// FORWARD DECLARATIONS +class CUpnpItem; +class CUpnpHttpServerSession; +class CUpnpElement; +class CUpnpDlnaFilter; +class CUpnpDlnaProtocolInfo; + +// CONSTANTS +const TInt KPushServerPort = 58186; + +// CLASS DECLARATION + +/** +* Push controller server. A singleton class that instantiates itself whenever +* something is shared using the static "ShareL" methods. And as the last item +* is unshared, the singleton is destroyed. +* +* @lib pushtransportserver +*/ +NONSHARABLE_CLASS( CUpnpPushServer) + : public CBase + , public MUpnpHttpServerTransactionCreator + , public MUpnpHttpServerObserver + , public MUpnpContentDirectoryDataFinder + { + +public: // the api + + /** + * Share an item to the push transport server. + * All the resources within the item become shared. + * The given hash should be unique within the process. + * It can be used to unshare. + * + * @param aHash, TUint (usualy instance of the class using this functionality) + * @param aItem, upnpitem + */ + IMPORT_C static void ShareL( + TUint aHash, + CUpnpItem& aItem ); + + /** + * Unshare an item identified by the hash. + * + * @param aHash, TUint (usualy instance of the class using this functionality) + */ + IMPORT_C static void UnshareL( + TUint aHash ); + + /** + * Unshare all items + */ + IMPORT_C static void UnshareAllL(); + + /** + * Returns true if server is running + */ + IMPORT_C static TBool IsRunning(); + +private: // internal construction/destruction + + /** + * default constructor + */ + CUpnpPushServer(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * destructor + */ + ~CUpnpPushServer(); + +private: // MUpnpHttpServerTransactionCreator + + /** + * see MUpnpHttpServerTransactionCreator + */ + void NewTransactionL( const TDesC8& aMethod, + const TDesC8& aUri, const TInetAddr& aSender, + CUpnpHttpServerTransaction*& aTrans ); + +private: // MUpnpHttpServerObserver + + /** + * see MUpnpHttpServerObserver + */ + void HttpEventLD( CUpnpHttpMessage* aMessage ); + +private: // MUpnpContentDirectoryDataFinder + + /** + * see MUpnpContentDirectoryDataFinder + */ + TInt CheckImportUriL( const TDesC8& aImportUri ); + + /** + * see MUpnpContentDirectoryDataFinder + */ + void GetTitleForUriL( TInt aObjectId, TPtr& aValue ); + + /** + * see MUpnpContentDirectoryDataFinder + */ + TInt GetProtocolInfoL( const TDesC8& aContentUri, + CUpnpDlnaProtocolInfo*& aProtocolInfo ); + + /** + * see MUpnpContentDirectoryDataFinder + */ + TInt FindSharedFolderL( const TDesC& aUrlPath, + const TDesC& aFileName, HBufC*& aFolderPath ); + + /** + * see MUpnpContentDirectoryDataFinder + */ + CUpnpDlnaProtocolInfo* GetProtocolInfoByImportUriL( + const TDesC8& aImportUri); + +private: // internal methods + + /** + * shares a resource by hash. + * + * @param aHash, TUint + * @param aResource, upnpelement + */ + void ShareResourceL( + TUint aHash, + CUpnpElement& aResource ); + + /** + * unshared an entry by hash. + * + * @param aHash, TUint + */ + void UnshareResource( + TUint aHash ); + + /** + * count of shared entries. + * + */ + TInt EntryCount(); + + /** + * constructs an URI by hashcode. + * + * @param aHash, TUint + * @param aFileExt, file extension of the element + * @param aUriBuf, uri output buffer. + */ + void HashToUri( TUint aHash, const TDesC& aFileExt, TDes8& aUriBuf ); + + /** + * extracts hashcode from given uri. + * + * @param aUri, uri + */ + TUint HashFromUri( const TDesC8& aUri ); + + /** + * extracts hashcode from given uri + * + * @param aUri, uri + */ + TUint HashFromUri( const TDesC16& aUri ); + +private: + /** + * An array entry that represents one resource that is being shared + * within this push server. + */ + class TUpnpPushEntry + { + public: + TUpnpPushEntry( TUint aHash, const TDesC& aPath, + const TDesC8& aProtocolInfo ): iHash(aHash), + iPath(aPath), iProtocolInfo(aProtocolInfo) {} + TUint Hash() const {return iHash;} + const TDesC& Path() const {return iPath;} + const TDesC8& ProtocolInfo() const {return iProtocolInfo;} + private: + TUint iHash; + const TDesC& iPath; + const TDesC8& iProtocolInfo; + }; + +private: // members + + // the http server + CUpnpHttpServerSession* iHttpServer; + + // shared content + RHashMap iEntries; + + CUpnpDlnaFilter* iFilter; //owned + + }; + + +#endif // UPNPPUSHSERVER_H + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerhelper/inc/upnptranscodehelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerhelper/inc/upnptranscodehelper.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,136 @@ +/* +* 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: UPnP transcode helper +* +*/ + +#ifndef C_UPNPTRANSCODEHELPER_H +#define C_UPNPTRANSCODEHELPER_H + +// INCLUDES +#include + +#include "upnpgstwrapperobserver.h" + +class CUpnpItem; +class CUpnpAVDevice; +class CUpnpGstWrapper; + + +NONSHARABLE_CLASS(CUpnpTranscodeHelper) : public CBase + , public MUpnpGstWrapperObserver + { + + enum TContainerType + { + EUnknownContainer, + EMp4Container, + ETsContainer + }; + +public: // construction / destruction + + /** + * Static NewL + * + * @param none + * @return instance to CUpnpTranscodeHelper + */ + static CUpnpTranscodeHelper* CUpnpTranscodeHelper::NewL(); + + /** + * Destructor + */ + virtual ~CUpnpTranscodeHelper(); + +private: // construction, private part + + /** + * Constructor + */ + CUpnpTranscodeHelper(); + + /** + * 2nd phrase Constructor + */ + void ConstructL(); + +public: + + /** + * Fetch pre-defined transcoding pipeline and protocol info for renderer + * + * @param aRenderer Reference to renderer + * @param aUpnpItem Reference to original upnp item + * @param aPipeline Reference pointer to descriptor where parsed + * transcoding pipeline will be allocated + * @param aProtocolInfo Reference pointer to descriptor where parsed + * protocol info will be allocated + */ + void PreDefinedCfgL( const CUpnpAVDevice& aRenderer, + CUpnpItem& aUpnpItem, HBufC8*& aPipeline, + HBufC8*& aProtocolInfo ); + + /** + * Create transcoding pipeline + * + * @param aUpnpItem Reference to original upnp item + * @param aRendererProtocolInfos Reference to descriptor array containing + * protocol list from the renderer + * @return Pointer to descriptor containing transcoding pipeline; + * NULL if match not found + */ + HBufC8* PipelineL( CUpnpItem& aUpnpItem, + const CDesC8Array& aRendererProtocolInfos ); + + /** + * Add a valid protocol info according to transcoding pipeline + * + * @param aUpnpItem Reference to original upnp item + * @param aPipeline Reference to pipeline descriptor + * @param aProtocolMatches Reference to descriptor array containing + * protocol list from the renderer + */ + void AddValidResElementL( CUpnpItem& aUpnpItem, + const TDesC8& aPipeline, const CDesC8Array& aProtocolMatches ); + + + void ReplaceResourceL( CUpnpItem& aUpnpItem, const TDesC8& aProtocolInfo ); + + /* + * Start transcoding + * + * @param aPipeline Reference to pipeline descriptor + */ + void TranscodeL( const TDesC8& aPipeline ); + +private: + + HBufC8* GeneratePipelineL( const TDesC8& aOriginalFilePath, + TContainerType aDestContainerType ); + + HBufC8* PathToLinuxSyntaxL( const TDesC& aOriginalPath ); + +private: + + void HandleGstEvent( Gst::TEvent aEvent ); + +private: + + RFs iFs; + CUpnpGstWrapper* iGstWrapper; + + }; + +#endif // C_UPNPTRANSCODEHELPER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerhelper/src/upnppushserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnppushserver.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,427 @@ +/* +* 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: Push transport server +* +*/ + + + + + + +// INCLUDE FILES +// System +#include +#include + +// upnp stack api's +#include +#include +#include +#include +#include +#include + +// dlnasrv / mediaserver api +#include +#include "upnpdlnafilter.h" + +// dlnasrv / internal api's +#include "upnpconstantdefs.h" // for upnp-specific stuff +#include "upnpitemutility.h" // for GetResElements + + +_LIT( KComponentLogfile, "upnppushserver.txt"); +#include "upnplog.h" +#include "upnppushserver.h" + +// CONSTANTS +const TUint KMaxItemResourcesCount = 8; +const TUint KMaxBufferSize = 64; +const TUint KMaxUriLength = 256; +const TInt KSlash = 47; // '/' +const TInt KDot = 46; // '.' + +_LIT8( KHttp, "http://" ); +_LIT8( KSeparatorcolon, ":" ); +_LIT8( KSeparatorSlash, "/" ); +// GLOBALS + + +// -------------------------------------------------------------------------- +// CUpnpPushServer::ShareL +// +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpPushServer::ShareL( + TUint aHash, + CUpnpItem& aItem ) + { + __LOG( "PushServer::ShareL()" ); + RUPnPElementsArray resources; + CleanupClosePushL( resources ); + UPnPItemUtility::GetResElements( aItem, resources ); + if ( resources.Count() == 0 ) + { + __LOG( "PushServer::ShareL() - no resources" ); + User::Leave(KErrNotFound); + } + + CUpnpPushServer* singleton = static_cast( Dll::Tls() ); + if ( !singleton ) + { + // singleton must be created first + __LOG( "PushServer::ShareL: creating singleton" ); + singleton = new (ELeave) CUpnpPushServer(); + CleanupStack::PushL( singleton ); + singleton->ConstructL(); + User::LeaveIfError( Dll::SetTls( singleton ) ); + CleanupStack::Pop( singleton ); + } + + CUpnpElement* elem = + (CUpnpElement*)(UPnPItemUtility::FindElementByName( + aItem, KElementAlbumArtUri() )); + if( elem ) + { + singleton->ShareResourceL( aHash, *elem ); + aHash += 1; + } + + for( TUint i(0); iShareResourceL( aHash+i, *resources[i] ); + } + + CleanupStack::PopAndDestroy( &resources ); + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::Unshare +// +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpPushServer::UnshareL( + TUint aHash ) + { + CUpnpPushServer* singleton = static_cast( Dll::Tls() ); + if ( singleton == 0 ) return; // singleton is empty, nothing to share. + + // assume item would have max. 8 resources, call unshare for those + for( TUint i=0; iUnshareResource( aHash+i ); + } + + if ( singleton->EntryCount() == 0 ) + { + __LOG( "PushServer::Unshare: destroying singleton" ); + Dll::FreeTls(); + delete singleton; + } + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::UnshareAll +// +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpPushServer::UnshareAllL() + { + CUpnpPushServer* singleton = static_cast( Dll::Tls() ); + if ( singleton != 0 ) + { + __LOG( "PushServer::UnshareAll: destroying singleton" ); + Dll::FreeTls(); + delete singleton; + } + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::IsRunning +// +//--------------------------------------------------------------------------- +EXPORT_C TBool CUpnpPushServer::IsRunning() + { + CUpnpPushServer* singleton = static_cast( Dll::Tls() ); + return (singleton ? ETrue : EFalse); + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::ShareResourceL +// +//--------------------------------------------------------------------------- +void CUpnpPushServer::ShareResourceL( + TUint aHash, + CUpnpElement& aResource ) + { + // catch protocol info if one exists + const CUpnpAttribute* piAttr = UPnPItemUtility::FindAttributeByName( + aResource, KAttributeProtocolInfo() ); + + // create URI + TBuf8 uri; + TParse parse; + TInt result = parse.Set( aResource.FilePath(), NULL, NULL ); + User::LeaveIfError(result); + HashToUri( aHash, parse.Ext(), uri ); + aResource.SetValueL( uri ); + + // add to share + __LOG2( "PushServer::ShareResourceL %d = %S", + aHash, &aResource.FilePath() ); + __LOG8( uri ); + TUpnpPushEntry entry(aHash, aResource.FilePath(), + ( piAttr ? piAttr->Value() : KNullDesC8 ) ); + iEntries.InsertL( aHash, entry ); + } + + +// -------------------------------------------------------------------------- +// CUpnpPushServer::UnshareResource +// +//--------------------------------------------------------------------------- +void CUpnpPushServer::UnshareResource( TUint aHash ) + { + iEntries.Remove( aHash ); + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::EntryCount +// +//--------------------------------------------------------------------------- +TInt CUpnpPushServer::EntryCount() + { + return iEntries.Count(); + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::HashToUri +// +//--------------------------------------------------------------------------- +void CUpnpPushServer::HashToUri( TUint aHash, const TDesC& aFileExt, + TDes8& aUriBuf ) + { + TInetAddr addr; + iHttpServer->GetAddress( addr ); + TBuf ip; + addr.Output( ip ); + + aUriBuf.Append( KHttp() ); // http:// + aUriBuf.Append( ip ); // http://n.n.n.n + aUriBuf.Append( KSeparatorcolon() ); // http://n.n.n.n: + aUriBuf.AppendNum( addr.Port() ); // http://n.n.n.n:pppp + aUriBuf.Append( KSeparatorSlash() ); // http://n.n.n.n:pppp/ + aUriBuf.AppendNum( aHash ); // http://n.n.n.n:pppp/hash + aUriBuf.Append( aFileExt ); // http://n.n.n.n:pppp/hash.ext + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::HashFromUri +// +//--------------------------------------------------------------------------- +TUint CUpnpPushServer::HashFromUri( const TDesC8& aUri ) + { + TBuf16 uri16; + uri16.Copy( aUri ); + return HashFromUri( uri16 ); + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::HashFromUri +// +//--------------------------------------------------------------------------- +TUint CUpnpPushServer::HashFromUri( const TDesC16& aUri ) + { + TUint hash = 0; + TChar slash( KSlash ); + TChar dot( KDot ); + // extract the hash part + TInt begin = aUri.LocateReverse( slash ); + if ( begin<0 ) + { + begin = -1; + } + TInt end = aUri.LocateReverse( dot ); + if ( end<0 ) + { + end = aUri.Length(); + } + TPtrC16 hashPart = aUri.Mid( + begin+1, end-begin-1 ); + // convert to a number + TLex16 hashLex( hashPart ); + if ( hashLex.Val( hash, EDecimal ) != KErrNone ) + { + // hashcode was not found + hash = 0; + } + __LOG2( "PushServer: HashFromUri: %S -> %d", &aUri, hash ); + return hash; + } + + +// -------------------------------------------------------------------------- +// CUpnpPushServer::CUpnpPushServer +// +//--------------------------------------------------------------------------- +CUpnpPushServer::CUpnpPushServer() + :iEntries() + { + __LOG( "PushServer::CUpnpPushServer()" ); + + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::ConstructL +// +//--------------------------------------------------------------------------- +void CUpnpPushServer::ConstructL() + { + __LOG( "PushServer::ConstructL()" ); + + iHttpServer = CUpnpHttpServerSession::NewL( 0, *this ); + + TRAPD( err, iHttpServer->StartL( KPushServerPort ) ); + if( err ) + { + //fixed port already in use -> start with random port + iHttpServer->StartL(); + } + + iHttpServer->DefaultRuntime().SetCreator( *this ); + iFilter = CUpnpDlnaFilter::NewL( this, NULL ); + + __LOG( "PushServer::ConstructL() - end" ); + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::CUpnpPushServer +// +//--------------------------------------------------------------------------- +CUpnpPushServer::~CUpnpPushServer() + { + __LOG( "PushServer::~CUpnpPushServer()" ); + iEntries.Close(); + if(NULL != iHttpServer) + { + iHttpServer->Stop(); + } + delete iHttpServer; + delete iFilter; + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::NewTransactionL +// +//--------------------------------------------------------------------------- +void CUpnpPushServer::NewTransactionL( + const TDesC8& aMethod, + const TDesC8& aUri, + const TInetAddr& aSender, + CUpnpHttpServerTransaction*& aTrans ) + { + TBuf ip; + aSender.Output(ip); + if ( aMethod == KHttpGet() || aMethod == KHttpHead() ) + { + __LOG2( "PushServer: HTTP %S from=%S, launching transaction", &aMethod, + &ip ); + iFilter->NewTransactionL( aMethod, aUri, aSender, aTrans ); + } + else + { + // this method not supported + __LOG2( "PushServer: unsupported request: %S from=%S", &aMethod, &ip ); + User::Leave( KErrNotSupported ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::HttpEventLD +// +//--------------------------------------------------------------------------- +void CUpnpPushServer::HttpEventLD( CUpnpHttpMessage* aMessage ) + { + __LOG1( "QuickShare:HttpEventLD() type=%d", aMessage->Type() ); + + delete aMessage; + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::CheckImportUriL +// +//--------------------------------------------------------------------------- +TInt CUpnpPushServer::CheckImportUriL( const TDesC8& /*aImportUri*/ ) + { + // should never be here + __PANIC( __FILE__, __LINE__ ); + return 0; + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::GetTitleForUriL +// +//--------------------------------------------------------------------------- +void CUpnpPushServer::GetTitleForUriL( TInt /*aObjectId*/, TPtr& /*aValue*/ ) + { + // should never be here + __PANIC( __FILE__, __LINE__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::GetProtocolInfoL +// +//--------------------------------------------------------------------------- +TInt CUpnpPushServer::GetProtocolInfoL( const TDesC8& aContentUri, + CUpnpDlnaProtocolInfo*& aProtocolInfo ) + { + aProtocolInfo = 0; + TInt result = KErrNotFound; + TUpnpPushEntry* entry = iEntries.Find( HashFromUri( aContentUri ) ); + if ( entry ) + { + aProtocolInfo = CUpnpDlnaProtocolInfo::NewL( entry->ProtocolInfo() ); + result = KErrNone; + } + return result; + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::FindSharedFolderL +// +//--------------------------------------------------------------------------- +TInt CUpnpPushServer::FindSharedFolderL( const TDesC& /*aUrlPath*/, + const TDesC& aFileName, HBufC*& aFolderPath ) + { + aFolderPath = 0; + TInt result = KErrNotFound; + TUpnpPushEntry* entry = iEntries.Find( HashFromUri( aFileName ) ); + if ( entry ) + { + aFolderPath = entry->Path().AllocL(); + result = KErrNone; + } + return result; + } + +// -------------------------------------------------------------------------- +// CUpnpPushServer::GetProtocolInfoByImportUriL +// +//--------------------------------------------------------------------------- +CUpnpDlnaProtocolInfo* CUpnpPushServer::GetProtocolInfoByImportUriL( + const TDesC8& /*aImportUri */) + { + // should never be here + __PANIC( __FILE__, __LINE__ ); + return 0; + } + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerhelper/src/upnptranscodehelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerhelper/src/upnptranscodehelper.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,426 @@ +/* +* 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: Implementation of UPnP transcode helper +* +*/ +#include //hack + +#include +#include +#include + +#include +#include +#include + +#include "upnpitemutility.h" +#include "upnpavdevice.h" + +#include "upnptranscodehelper.h" + +_LIT( KComponentLogfile, "upnptranscodehelper.txt"); +#include "upnplog.h" + +#define __FUNC_LOG __LOG8_1( "%s", __PRETTY_FUNCTION__ ); + +_LIT( KRendererCfgFile, "C:\\data\\UpnpCfgs.xml" ); + +_LIT( KTranscodedFlag, "?transcoded=true" ); + +_LIT8( KSymbianDirDelimiter, "\\" ); +_LIT8( KLinuxDirDelimiter, "/" ); +_LIT8( KProtocolInfo, "protocolInfo" ); +_LIT8( KRes, "res" ); + +// These are for Transport Stream muxer checking (from pipeline) +_LIT8( KMpegTsMux, "mpegtsmux" ); +_LIT8( KFFMuxMpegTs, "ffmux_mpegts" ); + +// These are for Transport Stream support checking +_LIT8( KTsProtocolInfoIdentifier, "_TS_" ); +_LIT8( KAllMpegMimeTypes, "video/mpeg:*" ); + +// This is for MP4 support checking +_LIT8( KMp4MimeType, "video/mp4" ); + +// The pipeline is currently hardcoded (except input file) +_LIT8( KDefaultPipelineFmt, +"mpegtsmux output-buf-size=0x7FCCC name=mux ! appsink max-buffers=10 name=sinkbuffer filesrc \ +location=%S ! qtdemux name=demux ! queue max-size-bytes=0xAAAA ! mux. demux. ! \ +queue max-size-bytes=0xAAAA ! mux."); + +const TInt KLocationFmtTagLen = 2; + +CUpnpTranscodeHelper* CUpnpTranscodeHelper::NewL() + { + __FUNC_LOG; + + CUpnpTranscodeHelper* self = new ( ELeave ) CUpnpTranscodeHelper(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +CUpnpTranscodeHelper::~CUpnpTranscodeHelper() + { + __FUNC_LOG; + + iGstWrapper->RemoveObserver( *this ); + iGstWrapper->Close(); + iFs.Close(); + } + +void CUpnpTranscodeHelper::PreDefinedCfgL( const CUpnpAVDevice& aRenderer, + CUpnpItem& aUpnpItem, HBufC8*& aPipeline, + HBufC8*& aProtocolInfo ) + { + __FUNC_LOG; + + //fetch mimetype and filename from original resource + RUPnPElementsArray resources; + CleanupClosePushL( resources ); + UPnPItemUtility::GetResElements( aUpnpItem, resources ); + TInt resourcesCount = resources.Count(); + if ( resourcesCount == 0 ) + { + User::Leave( KErrNotFound ); + } + + const CUpnpAttribute& originalProtocolInfoDesc = + UPnPItemUtility::FindAttributeByNameL( + *resources[0], KProtocolInfo ); + + CUpnpDlnaProtocolInfo* originalProtocolInfo = + CUpnpDlnaProtocolInfo::NewL( originalProtocolInfoDesc.Value() ); + CleanupStack::PushL( originalProtocolInfo ); + + //create config for renderer + CUpnpRendererCfg* config = CUpnpRendererCfg::NewLC( KRendererCfgFile, + aRenderer.ModelName(), originalProtocolInfo->ThirdField() ); + + CUpnpRendererCfgParser* parser = CUpnpRendererCfgParser::NewLC(); + + parser->ParseRendererCfgL( *config ); + + HBufC8* srcFileName8 = PathToLinuxSyntaxL( resources[0]->FilePath() ); + CleanupStack::PushL( srcFileName8 ); + + HBufC8* pipeline = HBufC8::NewLC( config->Pipeline().Length() + + srcFileName8->Length() - KLocationFmtTagLen ); + pipeline->Des().AppendFormat( config->Pipeline(), srcFileName8 ); + + HBufC8* protocolInfo = config->ProtocolInfo().AllocL(); + + RFile file; + User::LeaveIfError( file.Open(iFs,resources[0]->FilePath(),EFileRead) ); + CleanupClosePushL(file); + TInt size(KErrNotFound); + User::LeaveIfError( file.Size(size) ); + iGstWrapper->SetTranscodedFileSize( config->SizeMultiplier()*size ); + CleanupStack::PopAndDestroy(&file); + + CleanupStack::Pop( pipeline ); + CleanupStack::PopAndDestroy( srcFileName8 ); + CleanupStack::PopAndDestroy( parser ); + CleanupStack::PopAndDestroy( config ); + CleanupStack::PopAndDestroy( originalProtocolInfo ); + CleanupStack::PopAndDestroy( &resources ); + + aPipeline = pipeline; + aProtocolInfo = protocolInfo; + } + +HBufC8* CUpnpTranscodeHelper::PipelineL( CUpnpItem& aUpnpItem, + const CDesC8Array& aRendererProtocolInfos ) + { + __FUNC_LOG; + + HBufC8* pipeline = NULL; + TBool protocolMatch = EFalse; + TContainerType srcContainerType = EUnknownContainer; + TContainerType destContainerType = EUnknownContainer; + + //Get resources from the current upnp item + RUPnPElementsArray resources; + CleanupClosePushL( resources ); + UPnPItemUtility::GetResElements( aUpnpItem, resources ); + TInt resourcesCount = resources.Count(); + if ( resourcesCount == 0 ) + { + User::Leave( KErrNotFound ); + } + + //Check if suitable source container is found from 1st resource + const CUpnpAttribute& originalProtocolInfo = + UPnPItemUtility::FindAttributeByNameL( + *resources[0], KProtocolInfo ); + + if( originalProtocolInfo.Value().Find( KMp4MimeType ) ) + { + srcContainerType = EMp4Container; + } + else + { + User::Leave( KErrNotSupported ); + } + + //Loop through all protocol infos from renderer and try to find suitable + TInt rendererProtocolInfoCount = aRendererProtocolInfos.Count(); + for( TInt i = 0; i < rendererProtocolInfoCount && !protocolMatch; i++ ) + { + for( TInt j = 0; j < resourcesCount && !protocolMatch; j++ ) + { + const TDesC8& protocolInfo = + UPnPItemUtility::FindAttributeByNameL( + *resources[j], KProtocolInfo ).Value(); + + const TDesC8& rendererProtocolInfo = + aRendererProtocolInfos.MdcaPoint(i); + + if( rendererProtocolInfo.Find( protocolInfo ) != KErrNotFound ) + { + protocolMatch = ETrue; + //breaks both 'for' loops here + } + + //Check if protocol info is supported + if( destContainerType == EUnknownContainer && + ( rendererProtocolInfo.Find( + KTsProtocolInfoIdentifier ) != KErrNotFound || + rendererProtocolInfo.Find( + KAllMpegMimeTypes ) != KErrNotFound ) ) + { + destContainerType = ETsContainer; + } + //TODO: add here other supported containers (muxers) as well + + } + } + + if( !protocolMatch ) + { + HBufC8* filePath = PathToLinuxSyntaxL( resources[0]->FilePath() ); + CleanupStack::PushL( filePath ); + pipeline = GeneratePipelineL( *filePath, destContainerType ); + CleanupStack::PopAndDestroy( filePath ); + } + + CleanupStack::PopAndDestroy( &resources ); + + return pipeline; + } + +void CUpnpTranscodeHelper::ReplaceResourceL( CUpnpItem& aUpnpItem, + const TDesC8& aProtocolInfo ) + { + RUPnPElementsArray& elements = const_cast( + aUpnpItem.GetElements()); + + for( TInt resIndex(0); resIndex < elements.Count(); ++resIndex ) + { + if( elements[resIndex]->Name() == KRes ) + { + HBufC* tmp = HBufC::NewLC( + elements[resIndex]->FilePath().Length() + + KTranscodedFlag().Length() ); + tmp->Des().Append( elements[resIndex]->FilePath() ); + tmp->Des().Append( KTranscodedFlag() ); + elements.Remove( resIndex ); + aUpnpItem.AddResourceL( *tmp, aProtocolInfo ); + CleanupStack::PopAndDestroy( tmp ); + break; + } + } + } + +void CUpnpTranscodeHelper::TranscodeL( const TDesC8& aPipeline ) + { + __FUNC_LOG; + + //iGstWrapper->StartL( aPipeline ); + iGstWrapper->SetPipelineL( aPipeline ); + + //should we wait here until we get pipeline playing state notification + //or error ;) + } + + +void CUpnpTranscodeHelper::AddValidResElementL( + CUpnpItem& aUpnpItem, const TDesC8& aPipeline, + const CDesC8Array& aRendererProtocolInfos ) + { + __FUNC_LOG; + + TBool suitableFound = EFalse; + const TDesC8* protocolInfoIdentifier = NULL; + + //TODO: Add also other supported containers (muxers) + if( aPipeline.Find( KMpegTsMux ) != KErrNotFound || + aPipeline.Find( KFFMuxMpegTs ) != KErrNotFound ) + { + protocolInfoIdentifier = &KTsProtocolInfoIdentifier(); + } + else + { + User::Leave( KErrNotSupported ); + } + + TInt rendererProtocolInfoCount = aRendererProtocolInfos.Count(); + + if( rendererProtocolInfoCount == 0 ) + { + User::Leave(KErrNotFound); + } + + //Get resources from the current upnp item + RUPnPElementsArray resources; + CleanupClosePushL( resources ); + UPnPItemUtility::GetResElements( aUpnpItem, resources ); + TInt resourcesCount = resources.Count(); + if ( resourcesCount == 0 ) + { + User::Leave( KErrNotFound ); + } + + for( TInt i = 0; i < rendererProtocolInfoCount && !suitableFound; i++ ) + { + TPtrC8 rendererProtocolInfo = aRendererProtocolInfos.MdcaPoint(i); + if( rendererProtocolInfo.Find( *protocolInfoIdentifier ) ) + { + //TODO: Add only suitable ones -- now adds all protocol infos + // from renderer, which contains _TS_ sub-string + const TDesC& originalFilePath = resources[0]->FilePath(); + HBufC* transcodedFilePath = HBufC::NewL( + originalFilePath.Length() + KTranscodedFlag().Length() ); + CleanupStack::PushL( transcodedFilePath ); + + + transcodedFilePath->Des().Append( originalFilePath ); + transcodedFilePath->Des().Append( KTranscodedFlag ); + + aUpnpItem.AddResourceL( *transcodedFilePath, + rendererProtocolInfo ); + + CleanupStack::PopAndDestroy( transcodedFilePath ); + + suitableFound = ETrue; + } + } + + CleanupStack::PopAndDestroy( &resources ); + + if( !suitableFound ) + { + User::Leave( KErrNotFound ); + } + else + { + // delete orig. + RUPnPElementsArray& elements = const_cast( + aUpnpItem.GetElements()); + + for( TInt resIndex(0); resIndex < elements.Count(); ++resIndex ) + { + if( elements[resIndex]->Name() == KRes ) + { + elements.Remove(resIndex); + break; + } + } + } + } + +CUpnpTranscodeHelper::CUpnpTranscodeHelper() + { + __FUNC_LOG; + } + +void CUpnpTranscodeHelper::ConstructL() + { + __FUNC_LOG; + + iGstWrapper = CUpnpGstWrapper::GetInstanceL(); + iGstWrapper->SetObserverL( *this ); + User::LeaveIfError( iFs.Connect() ); + } + +HBufC8* CUpnpTranscodeHelper::GeneratePipelineL( + const TDesC8& aOriginalFilePath, + TContainerType aDestContainerType ) + { + __FUNC_LOG; + + if( aDestContainerType == EUnknownContainer ) + { + User::Leave( KErrNotSupported ); + } + + HBufC8* pipeline = NULL; + + switch( aDestContainerType ) + { + case ETsContainer: + { + //TODO ?? + pipeline = HBufC8::NewL( KDefaultPipelineFmt().Length() - + KLocationFmtTagLen + aOriginalFilePath.Length() ); + pipeline->Des().AppendFormat( KDefaultPipelineFmt, + &aOriginalFilePath ); + break; + } + default: + { + __ASSERT_ALWAYS( 0, User::Invariant() ); + } + } + + return pipeline; + } + +HBufC8* CUpnpTranscodeHelper::PathToLinuxSyntaxL( + const TDesC& aOriginalPath ) + { + __FUNC_LOG; + + HBufC8* newFilePath = UpnpString::FromUnicodeL( aOriginalPath ); + + TInt index = 0; + while( index >= 0 ) + { + index = newFilePath->Find( KSymbianDirDelimiter ); + if( index >= 0 ) + { + newFilePath->Des().Replace( index, + KSymbianDirDelimiter().Length(), KLinuxDirDelimiter ); + } + } + + return newFilePath; + } + +void CUpnpTranscodeHelper::HandleGstEvent( Gst::TEvent aEvent ) + { + __FUNC_LOG; + + if( aEvent == Gst::EError ) + { + __LOG1( "CUpnpTranscodeHelper::HandleGstEvent ErrorMsg: %S", + iGstWrapper->ErrorMsg() ); + __ASSERT( EFalse, __FILE__, __LINE__ ); + } + } + + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrolpoint.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrolpoint.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,146 @@ +/** @file +* Copyright (c) 2005-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: Control point with some basic AV services +* +*/ + + + +#ifndef C_CUPNPAVCONTROLPOINT_H +#define C_CUPNPAVCONTROLPOINT_H + + +// INCLUDES +#include "upnpcontrolpoint.h" + +// FORWARD DECLARATIONS +class MUpnpAVControlPointObserver; + +// CLASS DECLARATION + +/** +* Control point services. +* This class inherits control point base class and provides just a little +* added value on top of that. Some default construction has been taken +* care of, and some low level messaging is taken care of. Everything else +* is up to the client. +* +* @lib - +* @since S60 5.2 +*/ +NONSHARABLE_CLASS ( CUpnpAVControlPoint ): public CUpnpControlPoint + { +public: // Constructors and destructor + + /** static constructor. */ + static CUpnpAVControlPoint* NewL( + MUpnpAVControlPointObserver& aAVControlPointObserver + ); + + /** Destructor. */ + virtual ~CUpnpAVControlPoint(); + +private: // private construction part + + /** constructor */ + CUpnpAVControlPoint(MUpnpAVControlPointObserver& aAVControlPointObserver); + + /** 2nd phase constructor */ + void ConstructL(); + +public: // services + + /** + * Returns the internally cached service for given device and + * service type. + * + * @since S60 5.2 + * @param aDevice the device for which service is requested for. + * @param aServiceType the upnp service required, for instance CDS. + * @return Cached service. + */ + CUpnpService* Service( + const CUpnpDevice* aDevice, + const TDesC8& aServiceType ); + + /** + * Helper method to create new action with given action name. + * + * New action is created by internally cached service. The service is + * identified with given device and service type. + * + * @since S60 5.2 + * @param aDevice the device for which service is requested for + * @param aServiceType the upnp service required, for instance CDS + * @param aActionName Name of the action. + * @return New action object + * @leave KErrUnknown if internally cached service could not be found. + * KErrGeneral if service doesn't support action. + * Systemwide error code otherwise. + */ + CUpnpAction* CreateActionLC( + const CUpnpDevice* aDevice, + const TDesC8& aServiceType, + const TDesC8& aActionName ); + + /** + * Starts up the av control point by creating SSDP search. + * + * @param None. + * @return None. + */ + void StartUpL(); + +private: // Virtual method overrides from base classes + + /** + * From CUpnpControlPoint Device discovery handler. + */ + void DeviceDiscoveredL( CUpnpDevice* aDevice ); + + /** + * From CUpnpControlPoint Device dissappear handler. + */ + void DeviceDisappearedL( CUpnpDevice* aDevice ); + + /** + * From CUpnpControlPoint Action response handler function. + */ + void ActionResponseReceivedL( CUpnpAction* aAction ); + + /** + * From CUpnpControlPoint State update handler. + */ + void StateUpdatedL( CUpnpService* aService ); + + /** + * From CUpnpControlPoint HTTP message handler function. + */ + void HttpResponseReceivedL( CUpnpHttpMessage* aMessage ); + + /** + * This function will be invoke if some network event will occure + * for example IP Address of UPnP changes + */ + void NetworkEvent( CUpnpNetworkEventBase* aEvent ); + +private: // Data + + //AV control point observer (engine) + MUpnpAVControlPointObserver& iAVControlPointObserver; + }; + +#endif // C_CUPNPAVCONTROLPOINT_H + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrolpointobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavcontrolpointobserver.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,75 @@ +/** @file +* Copyright (c) 2005-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: MUpnpAVControlPointObserver +* +*/ + + + +#ifndef MUPNPAVCONTROLPOINTOBSERVER_H +#define MUPNPAVCONTROLPOINTOBSERVER_H + +// INCLUDES +#include "upnpdevice.h" + +// FORWARD DECLARATIONS +class CUpnpAction; +class CUpnpHttpMessage; +class CUpnpDevice; + +// CLASS DECLARATION + +/** +* Interface class. +* This class defines a observer interface for AV controlpoint +*/ +class MUpnpAVControlPointObserver + { + public: // New functions + + /** + * Handles an action event that occurred in remote device + * @param aAction object that describes the action + */ + virtual void ActionResponseL(CUpnpAction* aAction ) = 0; + + /** + * A service update has been received from network + * @param aService the service with its new state + */ + virtual void StateUpdatedL(CUpnpService* aService) = 0; + + /** + * Handles HTTP messages. + * @param aMessage Incoming HTTP message. + */ + virtual void HttpResponseL(CUpnpHttpMessage* aMessage) = 0; + + /** + * Handles UPnP device discoveries. + * @param aDevice Device that is discovered. + */ + virtual void DeviceDiscoveredL(CUpnpDevice* aDevice) = 0; + + /** + * Handles UPnP device disappears. + * @param aDevice Device that disappeared. + */ + virtual void DeviceDisappearedL(CUpnpDevice* aDevice) = 0; + + }; + +#endif // MUPNPAVCONTROLPOINTOBSERVER_H + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/inc/upnpavcpstrings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpavcpstrings.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,154 @@ +/** @file +* Copyright (c) 2005-2006 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: File contains all global literals used in this module +* +*/ + + + +#ifndef UPNPAVCPSTRING_H_ +#define UPNPAVCPSTRING_H_ + +namespace UpnpAVCPStrings + { + _LIT8( KContentDirectory, "ContentDirectory:*"); + _LIT8( KConnectionManager, "ConnectionManager:*"); + _LIT8( KAVTransport, "AVTransport:*"); + _LIT8( KRenderingControl, "RenderingControl:*"); + _LIT8( KSetVolume, "SetVolume"); + _LIT8( KInstanceID, "InstanceID"); + _LIT8( KChannel, "Channel"); + _LIT8( KDesiredVolume, "DesiredVolume"); + _LIT8( KCurrentVolume, "CurrentVolume"); + _LIT8( KDesiredMute, "DesiredMute"); + _LIT8( KCurrentMute, "CurrentMute"); + _LIT8( KGetVolume, "GetVolume"); + _LIT8( KGetMute, "GetMute"); + _LIT8( KSetMute, "SetMute"); + _LIT8( KSetAVTransportURI, "SetAVTransportURI"); + _LIT8( KSetNextAVTransportURI, "SetNextAVTransportURI"); + _LIT8( KGetMediaInfo, "GetMediaInfo"); + _LIT8( KGetTransportInfo, "GetTransportInfo"); + _LIT8( KGetPositionInfo, "GetPositionInfo"); + _LIT8( KGetDeviceCapabilities, "GetDeviceCapabilities"); + _LIT8( KGetTransportSettings, "GetTransportSettings"); + _LIT8( KStop, "Stop"); + _LIT8( KPlay, "Play"); + _LIT8( KPause, "Pause"); + _LIT8( KRecord, "Record"); + _LIT8( KSeek, "Seek"); + _LIT8( KNext, "Next"); + _LIT8( KPrevious, "Previous"); + _LIT8( KSetPlayMode, "SetPlayMode"); + _LIT8( KSetRecordQualityMode, "SetRecordQualityMode"); + _LIT8( KGetCurrentTransportActions, "GetCurrentTransportActions"); + _LIT8( KCurrentURI, "CurrentURI"); + _LIT8( KCurrentURIMetaData, "CurrentURIMetaData"); + _LIT8( KNextURI, "NextURI"); + _LIT8( KNextURIMetaData, "NextURIMetaData"); + _LIT8( KSpeed, "Speed"); + _LIT8( KUnit, "Unit"); + _LIT8( KTarget, "Target"); + _LIT8( KNewPlayMode, "NewPlayMode"); + _LIT8( KNewRecordQualityMode, "NewRecordQualityMode"); + _LIT8( KMediaDuration, "MediaDuration"); + _LIT8( KNrTracks, "NrTracks"); + _LIT8( KPlayMedium, "PlayMedium"); + _LIT8( KPlayMedia, "PlayMedia"); + _LIT8( KRecordMedium, "RecordMedium"); + _LIT8( KWriteStatus, "WriteStatus"); + _LIT8( KCurrentTransportStatus, "CurrentTransportStatus"); + _LIT8( KCurrentTransportState, "CurrentTransportState"); + _LIT8( KCurrentSpeed, "CurrentSpeed"); + _LIT8( KTrack, "Track"); + _LIT8( KTrackDuration, "TrackDuration"); + _LIT8( KTrackMetaData, "TrackMetaData"); + _LIT8( KTrackURI, "TrackURI"); + _LIT8( KRelTime, "RelTime"); + _LIT8( KAbsTime, "AbsTime"); + _LIT8( KAbsCount, "AbsCount"); + _LIT8( KRecMedia, "RecMedia"); + _LIT8( KRelCount, "RelCount"); + _LIT8( KPlayMode, "PlayMode"); + _LIT8( KActions, "Actions"); + _LIT8( KRecQualityMode, "RecQualityMode"); + _LIT8( KSearchCaps, "SearchCaps"); + _LIT8( KSortCaps, "SortCaps"); + _LIT8( KId, "Id"); + _LIT8( KGetSearchCapabilities, "GetSearchCapabilities"); + _LIT8( KGetSortCapabilities, "GetSortCapabilities"); + _LIT8( KGetSystemUpdateID, "GetSystemUpdateID"); + _LIT8( KCreateObject, "CreateObject"); + _LIT8( KImportResource, "ImportResource"); + _LIT8( KExportResource, "ExportResource"); + _LIT8( KCreateReference, "CreateReference"); + _LIT8( KBrowse, "Browse"); + _LIT8( KDestinationURI, "DestinationURI"); + _LIT8( KSourceURI, "SourceURI"); + _LIT8( KTransferID, "TransferID"); + _LIT8( KResourceURI, "ResourceURI"); + _LIT8( KNumberReturned, "NumberReturned"); + _LIT8( KTotalMatches, "TotalMatches"); + _LIT8( KUpdateID, "UpdateID"); + _LIT8( KBrowseFlag, "BrowseFlag"); + _LIT8( KFilter, "Filter"); + _LIT8( KStartingIndex, "StartingIndex"); + _LIT8( KRequestedCount, "RequestedCount"); + _LIT8( KSortCriteria, "SortCriteria"); + _LIT8( KContainerID, "ContainerID"); + _LIT8( KObjectID, "ObjectID"); + _LIT8( KResult, "Result"); + _LIT8( KTransferStatus, "TransferStatus"); + _LIT8( KTransferLength, "TransferLength"); + _LIT8( KTransferTotal, "TransferTotal"); + _LIT8( KNewID, "NewID"); + _LIT8( KSearch, "Search"); + _LIT8( KDestroyObject, "DestroyObject"); + _LIT8( KDeleteResource, "DeleteResource"); + _LIT8( KStopTransferResource, "StopTransferResource"); + _LIT8( KGetTransferProgress, "GetTransferProgress"); + _LIT8( KUpdateObject, "UpdateObject"); + _LIT8( KSearchCriteria, "SearchCriteria"); + _LIT8( KCurrentTagValue, "CurrentTagValue"); + _LIT8( KNewTagValue, "NewTagValue"); + _LIT8( KPrepareForConnection, "PrepareForConnection"); + _LIT8( KRemoteProtocolInfo, "RemoteProtocolInfo"); + _LIT8( KPeerConnectionManager, "PeerConnectionManager"); + _LIT8( KPeerConnectionId, "PeerConnectionID"); + _LIT8( KDirection, "Direction"); + _LIT8( KConnectionId, "ConnectionID"); + _LIT8( KGetCurrentConnectionIDs, "GetCurrentConnectionIDs"); + _LIT8( KConnectionComplete, "ConnectionComplete"); + _LIT8( KGetCurrentConnectionInfo, "GetCurrentConnectionInfo"); + _LIT8( KAVTransportId, "AVTransportID"); + _LIT8( KConnectionIds, "ConnectionIDs"); + _LIT8( KProtocolInfo, "ProtocolInfo"); + _LIT8( KStatus, "Status"); + _LIT8( KGetProtocolInfo, "GetProtocolInfo"); + _LIT8( KSource, "Source"); + _LIT8( KSink, "Sink"); + _LIT8( KRcsID, "RcsID"); + _LIT8( KElements, "Elements"); + _LIT8( KPeerConnectionID, "PeerConnectionID"); + _LIT8( KConnectionID, "ConnectionID"); + _LIT8( KSystemUpdateID, "SystemUpdateID"); + _LIT8( KContainerUpdateIDs, "ContainerUpdateIDs"); + _LIT8( KSourceProtocolInfo, "SourceProtocolInfo"); + _LIT8( KSinkProtocolInfo, "SinkProtocolInfo"); + _LIT8( KCurrentConnectionIds, "CurrentConnectionIDs"); + _LIT8( KLastChange, "LastChange"); + _LIT8( KTransferIds, "TransferIDs"); + } + +#endif //UPNPAVCPSTRING_H_ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/inc/upnpdeviceicondownloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerserver/inc/upnpdeviceicondownloader.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,144 @@ +/* +* 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: +* +*/ + +#ifndef C_UPNPDEVICEICONDOWNLOADER_H +#define C_UPNPDEVICEICONDOWNLOADER_H + +// Include files +#include +#include +#include + +// FORWARD DECLARATIONS +class CHttpDownloader; + +/** + * Class for observing device icon download + */ +class MUpnpDeviceIconDownloadObserver + { +public: + /** + * Notifies device icon download completed + * + * @param aDeviceUuid the device uuid indicates the device the icon belongs + * @param aError system wide error code indicates the download status + */ + virtual void DeviceIconDownloadedL( const TDesC8& aDeviceUuid, TInt aError ) = 0; + }; + +/** + * Class for device icon downloading + */ +class CUpnpDeviceIconDownloader: public CBase, + public MHttpTransferObserver + { + +public: + + /** + * Static 1st phase constructor + * + * @param aObserver download observer + * @param aIap used access point + * @return new instance + */ + static CUpnpDeviceIconDownloader* NewL( + MUpnpDeviceIconDownloadObserver& aObserver, + TUint aIap ); + + /** + * Destructor + */ + virtual ~CUpnpDeviceIconDownloader(); + +private: // From MHttpTransferObserver + void TransferProgress( TAny* aKey, TInt aBytes, TInt aTotalBytes ); + void ReadyForTransferL( TAny* aKey ); + void TransferCompleted( TAny* aKey, TInt aStatus ); + +public: // New functions + /** + * Starts download + * + * @param aDeviceUuid uuid of device + * @param aDeviceIconUrl url of device icon + */ + void StartDownloadL( const TDesC8& aDeviceUuid, const TDesC8& aDeviceIconUrl ); + + /** + * Cancels download + * + * @param aDeviceUuid uuid of device + */ + void CancelDownload( const TDesC8& aDeviceUuid ); + + /** + * Transfers icon file to the client + * + * @param aMessage message from client + * @param aSlot message slot to be used + * @param aDeviceUuid the device that's icon is transferred + */ + void TransferFileToClientL( const RMessage2& aMessage, TInt aSlot, + const TDesC8& aDeviceUuid ); + +private: + /** + * Private class for download queue handling + */ + class CEntry : public CBase + { + public: + static CEntry* NewLC( const TDesC8& aDeviceUuid, const TDesC8& aDeviceIconUrl ); + virtual ~CEntry(); + inline TPtrC8 DeviceUuid() const { return iDeviceUuid->Des(); } + inline TPtrC8 DeviceIconUrl() const { return iDeviceIconUrl->Des(); } + static TInt Compare( const TDesC8* aDeviceUuid, const CEntry& aEntry ); + private: + inline CEntry() {} + void ConstructL( const TDesC8& aDeviceUuid, const TDesC8& aDeviceIconUrl ); + + private: + HBufC8* iDeviceUuid; + HBufC8* iDeviceIconUrl; + }; + +private: + CUpnpDeviceIconDownloader( MUpnpDeviceIconDownloadObserver& aObserver, + TUint aIap ); + void ConstructL(); + void DownloadNext(); + void DownloadNextL( CEntry& aNext ); + void CleanupFilesL(); + TBool FileExistsL( const TDesC8& aDeviceUuid ); + void CleanupFilesIfNeededL(); + void CheckDiskSpaceL(); + TBool InProgress( const TDesC8& aDeviceUuid ); + +private: + MUpnpDeviceIconDownloadObserver& iObserver; + TInt iIap; + RFs iFs; + RPointerArray< CEntry > iQueue; + CEntry* iCurrent; // Own, can be NULL + CHttpDownloader* iDownloader; // Own + TBool iCleanupOnShutdown; + }; + + +#endif // C_UPNPDEVICEICONDOWNLOADER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/inc/upnpfilesharingactive.h --- a/upnpavcontroller/upnpavcontrollerserver/inc/upnpfilesharingactive.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2006 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: AO for file sharing operations -* -*/ - - - - - - -#ifndef C_UPNPFILESHARINGACTIVE_H -#define C_UPNPFILESHARINGACTIVE_H - -// INCLUDE FILES -#include -#include - -// FORWARD DECLARATIONS -class CUPnPAVRenderingSessionImpl; -class CUpnpFileSharing; -class CUpnpItem; - -/** - * Used to make an asynchronous file sharing operation to synchronous - * operation. Handles UPnP Security for a file. - * - * @since S60 v3.1 - */ -class CUPnPFileSharingActive : public CActive - { - -public: - - /** - * Static 1st phase construct - */ - static CUPnPFileSharingActive* NewL(); - - /** - * Destructor - */ - virtual ~CUPnPFileSharingActive(); - -private: - - /** - * Constructor - */ - CUPnPFileSharingActive(); - - void ConstructL(); - -private: // Private methods for accessing UPnP security - - /** - * Allows/denied access to the files to which the given item's res- - * elements are pointing. - * - * @since Series 60 3.2 - * @param aItem the item - * @param aAccessAllowed ETrue to allow and EFalse to deny the access - */ - void SetAccesstoItemResourcesL( CUpnpItem& aItem, TBool aAccessAllowed ); - -protected: // From CActive - - /** - * See e32base.h - */ - void RunL(); - - /** - * See e32base.h - */ - void DoCancel(); - - /** - * See e32base.h - */ - TInt RunError( TInt aError ); - -public: // New functions - - /** - * Shares an item - * - * @param item to share - */ - void ShareItemL( CUpnpItem& aItem ); - - /** - * Unshares an item - * - * @param aId item to unshare (id) - */ - void UnShareItemL( const TDesC8& aId ); - -private: - - CUpnpFileSharing* iFileSharing; // Own - - }; - -#endif // C_UPNPAVEVENTACTIVE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrolpoint.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpavcontrolpoint.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,230 @@ +/** @file +* Copyright (c) 2005-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: CUpnpAVControlPoint +* +*/ + + +// INCLUDE FILES +#include "upnpavcontrolpoint.h" +#include "upnpavcontrolpointobserver.h" + +#include + +_LIT( KComponentLogfile, "upnpavcontrollerserver.txt" ); +#include "upnplog.h" + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CUpnpAVControlPoint* CUpnpAVControlPoint::NewL( + MUpnpAVControlPointObserver& aAVControlPointObserver ) + { + CUpnpAVControlPoint* self = + new (ELeave) CUpnpAVControlPoint( aAVControlPointObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::CUpnpAVControlPoint +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CUpnpAVControlPoint::CUpnpAVControlPoint( + MUpnpAVControlPointObserver& aAVControlPointObserver) + : CUpnpControlPoint(), + iAVControlPointObserver(aAVControlPointObserver) + { + } + +// ----------------------------------------------------------------------------- +// CUpnpStateUpdateHandler::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::ConstructL( ) + { + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::~CUpnpAVControlPoint +// Destructor +// ----------------------------------------------------------------------------- +// +CUpnpAVControlPoint::~CUpnpAVControlPoint() + { + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::Service +// This function returns a pointer to appropriate service instance. +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +CUpnpService* CUpnpAVControlPoint::Service( + const CUpnpDevice* aDevice, + const TDesC8& aServiceType ) + { + __ASSERT( aDevice, __FILE__, __LINE__ ); + + // CUpnpDevice::ServiceList() is non-const method (for some reason). + CUpnpDevice* dev = const_cast(aDevice); + RPointerArray& services = dev->ServiceList(); + + for( TInt i(0); i < services.Count(); i++ ) + { + if( services[i]->ServiceType().Match( aServiceType )!= KErrNotFound ) + { + return services[i]; + } + } + return NULL; + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::CreateActionLC +// Creates new action object. +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +CUpnpAction* CUpnpAVControlPoint::CreateActionLC( + const CUpnpDevice* aDevice, + const TDesC8& aServiceType, + const TDesC8& aActionName ) + { + // Tries to find CUpnpService from given device with given + // service type. + CUpnpService* service = Service( aDevice, aServiceType ); + if ( !service ) + { + // Service not found. + User::Leave( KErrUnknown ); + } + + // Creates the action with given action name. + // Note! If service doesn't include action, it return NULL. + // CUpnpService::CreateActionLC leaves only if creation of + // found action leaves. + CUpnpAction* action = service->CreateActionLC( aActionName ); + if ( !action ) + { + // Action not found. + User::Leave( KErrGeneral ); + } + + return action; + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::StartUpL +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::StartUpL() + { + //_LIT8( KMediaServer, "urn:schemas-upnp-org:device:MediaServer" ); + _LIT8( KMediaRenderer, "urn:schemas-upnp-org:device:MediaRenderer" ); + + CDesC8ArrayFlat* targetDeviceTypes = new(ELeave) CDesC8ArrayFlat(1); + CleanupStack::PushL( targetDeviceTypes ); + // We only have push use case, no need to ask stack to find media servers: + //targetDeviceTypes->AppendL( KMediaServer() ); + targetDeviceTypes->AppendL( KMediaRenderer() ); + CUpnpControlPoint::ConstructL( *targetDeviceTypes ); + CleanupStack::Pop( targetDeviceTypes ); + targetDeviceTypes->Reset(); + delete targetDeviceTypes; + targetDeviceTypes = NULL; + + TPtrC8 devicePtr; + devicePtr.Set( UpnpSSDP::KUPnPRootDevice ); + SearchL( devicePtr ); + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::DeviceDiscoveredL +// This function implements an inteface and notifies an observer. +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::DeviceDiscoveredL( CUpnpDevice* aDevice ) + { + iAVControlPointObserver.DeviceDiscoveredL( aDevice ); + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::DeviceDisappearedL +// This function implements an inteface and notifies an observer. +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::DeviceDisappearedL( CUpnpDevice* aDevice ) + { + iAVControlPointObserver.DeviceDisappearedL(aDevice); + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::ActionResponseReceivedL +// This function ralizes an interface. Functionality is located in separate +// handler class. +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::ActionResponseReceivedL( CUpnpAction* aAction ) + { + iAVControlPointObserver.ActionResponseL( aAction ); + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::StateUpdatedL +// This function implements an inteface and forwards request +// to stateupdate handler. +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::StateUpdatedL( CUpnpService* aService ) + { + iAVControlPointObserver.StateUpdatedL( aService ); + } + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::HttpResponseReceivedL +// This function implements an inteface and notifies an observer. +// (other items were commented in a header) +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::HttpResponseReceivedL( + CUpnpHttpMessage* aMessage ) + { + iAVControlPointObserver.HttpResponseL( aMessage ); + } + + +// ----------------------------------------------------------------------------- +// CUpnpAVControlPoint::NetworkEvent +// ----------------------------------------------------------------------------- +// +void CUpnpAVControlPoint::NetworkEvent( CUpnpNetworkEventBase* aEvent ) + { + CUpnpControlPoint::NetworkEvent( aEvent ); + TRAP_IGNORE( SearchL( UpnpSSDP::KUPnPRootDevice ) ); + } + +//end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/src/upnpdeviceicondownloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpavcontrollerserver/src/upnpdeviceicondownloader.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,420 @@ +/* +* 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: +* +*/ + +// INCLUDES +#include +#include +#include +#include "upnpdeviceicondownloader.h" +#include "upnpconstantdefs.h" +#include "upnpaverrorhandler.h" + +_LIT( KComponentLogfile, "upnpavcontrollerserver.txt"); +#include "upnplog.h" + +const TUint KBufferSize = 0x4000; // 16K +const TInt KParallerTransfers = 1; +_LIT( KIconFolder, "icons\\" ); +_LIT( KIconTemp, "temp" ); +_LIT( KIconExt, ".dat" ); +const TInt KCleanupNeededKey = KMaxTInt; +const TInt KDefaultDiskSpaceNeeded = 0x8000; // 32K + +// -------------------------------------------------------------------------- +// FolderNameLC +// -------------------------------------------------------------------------- +static HBufC* FolderNameLC( RFs& aFs ) + { + HBufC* ret = HBufC::NewLC( KMaxPath ); + TPtr ptr( ret->Des() ); + aFs.PrivatePath( ptr ); + ptr.Insert( 0, TDriveUnit( RFs::GetSystemDrive() ).Name() ); + ptr.Append( KIconFolder ); + return ret; + } + +// -------------------------------------------------------------------------- +// FileNameLC +// -------------------------------------------------------------------------- +static HBufC* FileNameLC( RFs& aFs, const TDesC8& aDeviceUuid ) + { + HBufC* ret = FolderNameLC( aFs ); + HBufC* uuid = HBufC::NewLC( aDeviceUuid.Length() ); + uuid->Des().Copy( aDeviceUuid ); + TPtr ptr( ret->Des() ); + ptr.Append( *uuid ); + ptr.Append( KIconExt ); + CleanupStack::PopAndDestroy( uuid ); + return ret; + } + +// -------------------------------------------------------------------------- +// TempFileNameLC +// -------------------------------------------------------------------------- +static HBufC* TempFileNameLC( RFs& aFs ) + { + HBufC* ret = FolderNameLC( aFs ); + TPtr ptr( ret->Des() ); + ptr.Append( KIconTemp ); + ptr.Append( KIconExt ); + return ret; + } + +// -------------------------------------------------------------------------- +// CompleteFileL +// -------------------------------------------------------------------------- +static void CompleteFileL( RFs& aFs, const TDesC8& aDeviceUuid ) + { + HBufC* src = TempFileNameLC( aFs ); + HBufC* tgt = FileNameLC( aFs, aDeviceUuid ); + User::LeaveIfError( aFs.Replace( *src, *tgt ) ); + CleanupStack::PopAndDestroy( tgt ); + CleanupStack::PopAndDestroy( src ); + } + +// -------------------------------------------------------------------------- +// PropertyCategory +// -------------------------------------------------------------------------- +static TUid PropertyCategory() + { + RProcess process; + TUid ret( TUid::Uid( process.SecureId().iId ) ); + process.Close(); + return ret; + } + +// -------------------------------------------------------------------------- +// GetIntPropertyL +// -------------------------------------------------------------------------- +static void GetIntPropertyL( const TUid& aCategory, TInt aKey, TInt& aValue ) + { + TInt initValue( aValue ); + TInt err( RProperty::Get( aCategory, aKey, aValue ) ); + if ( err == KErrNotFound ) + { + err = RProperty::Define( aCategory, aKey, RProperty::EInt ); + aValue = initValue; + } + __LOG3( "CUpnpDeviceIconDownloader - GetIntPropertyL - err: %d key: %d value: %d", + err, aKey, aValue ); + User::LeaveIfError( err ); + } + +// ============================ MEMBER FUNCTIONS ============================ + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::NewL +// -------------------------------------------------------------------------- +CUpnpDeviceIconDownloader* CUpnpDeviceIconDownloader::NewL( + MUpnpDeviceIconDownloadObserver& aObserver, TUint aIap ) + { + CUpnpDeviceIconDownloader* self = new ( ELeave ) CUpnpDeviceIconDownloader( + aObserver, aIap ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::~CUpnpDeviceIconDownloader +// -------------------------------------------------------------------------- +CUpnpDeviceIconDownloader::~CUpnpDeviceIconDownloader() + { + iQueue.ResetAndDestroy(); + delete iDownloader; + delete iCurrent; + if ( iCleanupOnShutdown ) + { + TRAP_IGNORE( CleanupFilesL() ); + } + iFs.Close(); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::TransferProgress +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::TransferProgress( TAny* /*aKey*/, TInt /*aBytes*/, + TInt /*aTotalBytes*/ ) + { + __LOG( "CUpnpDeviceIconDownloader::TransferProgress" ); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::ReadyForTransferL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::ReadyForTransferL( TAny* /*aKey*/ ) + { + __LOG( "CUpnpDeviceIconDownloader::ReadyForTransferL" ); + if ( iCurrent ) + { + iDownloader->StartTransferL( iCurrent ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::TransferCompleted +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::TransferCompleted( TAny* /*aKey*/, TInt aStatus ) + { + __LOG( "CUpnpDeviceIconDownloader::TransferCompleted" ); + if ( iCurrent ) + { + TInt err( UPnPAVErrorHandler::ConvertToSymbianErrorCode( aStatus, EUPnPHTTPError ) ); + __LOG2( "CUpnpDeviceIconDownloader::TransferCompleted - Http: %d Err: %d", + aStatus, err ); + TPtrC8 uuid( iCurrent->DeviceUuid() ); + if ( err == KErrNone ) + { + TRAP_IGNORE( CompleteFileL( iFs, uuid ) ); + } + TRAP_IGNORE( iObserver.DeviceIconDownloadedL( uuid, err ) ); + delete iCurrent; + iCurrent = NULL; + } + DownloadNext(); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::StartDownloadL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::StartDownloadL( + const TDesC8& aDeviceUuid, const TDesC8& aDeviceIconUrl ) + { + __LOG( "CUpnpDeviceIconDownloader::StartDownloadL" ); + CleanupFilesIfNeededL(); + if( !FileExistsL( aDeviceUuid ) && !InProgress( aDeviceUuid ) ) + { + if ( !iDownloader ) + { + iDownloader = CHttpDownloader::NewL( *this, iIap, KBufferSize, + KParallerTransfers ); + } + CEntry* entry = CEntry::NewLC( aDeviceUuid, aDeviceIconUrl ); + iQueue.AppendL( entry ); + CleanupStack::Pop( entry ); + DownloadNext(); + } + else + { + __LOG( "CUpnpDeviceIconDownloader::StartDownloadL - Skipped" ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CancelDownload +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::CancelDownload( const TDesC8& aDeviceUuid ) + { + __LOG( "CUpnpDeviceIconDownloader::CancelDownload" ); + if ( iCurrent && !iCurrent->DeviceUuid().Compare( aDeviceUuid ) ) + { + iDownloader->CancelTransfer( iCurrent ); + delete iCurrent; + iCurrent = NULL; + } + else + { + TInt pos( iQueue.Find( aDeviceUuid, CEntry::Compare ) ); + if ( pos >= 0 && pos < iQueue.Count() ) + { + delete iQueue[ pos ]; + iQueue.Remove( pos ); + } + } + DownloadNext(); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::TransferFileToClientL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::TransferFileToClientL( const RMessage2& aMessage, + TInt aSlot, const TDesC8& aDeviceUuid ) + { + if ( InProgress( aDeviceUuid ) ) + { + User::Leave( KErrNotReady ); + } + HBufC* filename = FileNameLC( iFs, aDeviceUuid ); + __LOG1( "CUpnpDeviceIconDownloader::TransferFileToClientL - %S", filename ); + RFile file; + CleanupClosePushL( file ); + User::LeaveIfError( file.Open( iFs, *filename, EFileShareReadersOnly | EFileRead ) ); + User::LeaveIfError( file.TransferToClient( aMessage, aSlot ) ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( filename ); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CEntry::NewLC +// -------------------------------------------------------------------------- +CUpnpDeviceIconDownloader::CEntry* CUpnpDeviceIconDownloader::CEntry::NewLC( + const TDesC8& aDeviceUuid, const TDesC8& aDeviceIconUrl ) + { + CEntry* self = new ( ELeave ) CEntry(); + CleanupStack::PushL( self ); + self->ConstructL( aDeviceUuid, aDeviceIconUrl ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CEntry::~CEntry +// -------------------------------------------------------------------------- +CUpnpDeviceIconDownloader::CEntry::~CEntry() + { + delete iDeviceUuid; + delete iDeviceIconUrl; + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CEntry::Compare +// -------------------------------------------------------------------------- +TInt CUpnpDeviceIconDownloader::CEntry::Compare( const TDesC8* aDeviceUuid, + const CUpnpDeviceIconDownloader::CEntry& aEntry ) + { + return !aEntry.iDeviceUuid->Compare( *aDeviceUuid ); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CEntry::ConstructL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::CEntry::ConstructL( const TDesC8& aDeviceUuid, + const TDesC8& aDeviceIconUrl ) + { + iDeviceUuid = aDeviceUuid.AllocL(); + iDeviceIconUrl = aDeviceIconUrl.AllocL(); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CUpnpDeviceIconDownloader +// -------------------------------------------------------------------------- +CUpnpDeviceIconDownloader::CUpnpDeviceIconDownloader( + MUpnpDeviceIconDownloadObserver& aObserver, TUint aIap ) : + iObserver( aObserver ), iIap( aIap ) + { + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::ConstructL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::ConstructL() + { + __LOG1( "CUpnpDeviceIconDownloader::ConstructL - IAP %d", iIap ); + User::LeaveIfError( iFs.Connect() ); + User::LeaveIfError( iFs.ShareProtected() ); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::DownloadNext +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::DownloadNext() + { + while( !iCurrent && iQueue.Count() > 0 ) + { + iCurrent = iQueue[ 0 ]; + iQueue.Remove( 0 ); + TRAPD( err, DownloadNextL( *iCurrent ) ); + if ( err != KErrNone ) + { + __LOG1( "CUpnpDeviceIconDownloader::DownloadNext - Error: %d", err ); + TRAP_IGNORE( iObserver.DeviceIconDownloadedL( iCurrent->DeviceUuid(), err ) ); + delete iCurrent; + iCurrent = NULL; + } + } + __LOG1( "CUpnpDeviceIconDownloader::DownloadNext - Waiting: %d", iQueue.Count() ); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::DownloadNextL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::DownloadNextL( CEntry& aNext ) + { + CheckDiskSpaceL(); + HBufC* fileName = TempFileNameLC( iFs ); + iFs.Delete( *fileName ); // Delete previous, ignore error + iFs.MkDirAll( *fileName ); // Ensure folder exists, ignore error + iDownloader->DownloadFileL( aNext.DeviceIconUrl(), *fileName, &aNext ); + CleanupStack::PopAndDestroy( fileName ); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CleanupFilesL +// -------------------------------------------------------------------------- + +void CUpnpDeviceIconDownloader::CleanupFilesL() + { + HBufC* folderName = FolderNameLC( iFs ); + __LOG1( "CUpnpDeviceIconDownloader::CleanupFilesL - %S", folderName ); + CFileMan* fileMan = CFileMan::NewL( iFs ); + CleanupStack::PushL( fileMan ); + fileMan->RmDir( *folderName ); // Ignore error + CleanupStack::PopAndDestroy( fileMan ); + CleanupStack::PopAndDestroy( folderName ); + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::FileExistsL +// -------------------------------------------------------------------------- +TBool CUpnpDeviceIconDownloader::FileExistsL( const TDesC8& aDeviceUuid ) + { + HBufC* filename = FileNameLC( iFs, aDeviceUuid ); + TEntry entry; + TBool ret( iFs.Entry( *filename, entry ) == KErrNone ); + __LOG2( "CUpnpDeviceIconDownloader::FileExistsL - %S %d", filename, ret ); + CleanupStack::PopAndDestroy( filename ); + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CleanupFilesIfNeededL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::CleanupFilesIfNeededL() + { + TInt cleanupNeeded( ETrue ); + TUid category( PropertyCategory() ); + GetIntPropertyL( category, KCleanupNeededKey, cleanupNeeded ); + if ( cleanupNeeded ) + { + CleanupFilesL(); + User::LeaveIfError( RProperty::Set( category, KCleanupNeededKey, EFalse ) ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::CheckDiskSpaceL +// -------------------------------------------------------------------------- +void CUpnpDeviceIconDownloader::CheckDiskSpaceL() + { + if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, KDefaultDiskSpaceNeeded, + RFs::GetSystemDrive() ) ) + { + iCleanupOnShutdown = ETrue; + User::Leave( KErrDiskFull ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpDeviceIconDownloader::InProgress +// -------------------------------------------------------------------------- +TBool CUpnpDeviceIconDownloader::InProgress( const TDesC8& aDeviceUuid ) + { + return ( ( iCurrent && !iCurrent->DeviceUuid().Compare( aDeviceUuid ) ) || + iQueue.Find( aDeviceUuid, CEntry::Compare ) != KErrNotFound ); + } + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpavcontrollerserver/src/upnpfilesharingactive.cpp --- a/upnpavcontroller/upnpavcontrollerserver/src/upnpfilesharingactive.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* -* Copyright (c) 2006 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: AO for file sharing operations -* -*/ - - - - - - -// INCLUDE FILES -// upnp stack api -#include -#include - -// upnpframework / avcontroller helper api -#include "upnpconstantdefs.h" // for upnp-specific stuff -#include "upnpitemutility.h" // for GetResElements - -// upnpframework / internal api's -#include "upnpsecaccesscontroller.h" - -// avcontroller internal -#include "upnpfilesharingactive.h" - -_LIT( KComponentLogfile, "upnpavcontrollerserver.txt"); -#include "upnplog.h" - - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::NewL -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -CUPnPFileSharingActive* CUPnPFileSharingActive::NewL() - { - CUPnPFileSharingActive* self = new (ELeave) CUPnPFileSharingActive(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::CUPnPFileSharingActive -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -CUPnPFileSharingActive::CUPnPFileSharingActive(): - CActive( EPriorityStandard )//, - { - CActiveScheduler::Add( this ); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::~CUPnPFileSharingActive -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -CUPnPFileSharingActive::~CUPnPFileSharingActive() - { - Cancel(); - delete iFileSharing; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::ConstructL -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -void CUPnPFileSharingActive::ConstructL() - { - __LOG( "CUPnPFileSharingActive::ConstructL" ); - - iFileSharing = CUpnpFileSharing::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::RunL -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -void CUPnPFileSharingActive::RunL() - { - CActiveScheduler::Stop(); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::DoCancel -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -void CUPnPFileSharingActive::DoCancel() - { - __LOG( "CUPnPFileSharingActive::DoCancel" ); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::RunError -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -TInt CUPnPFileSharingActive::RunError( TInt /*aError*/ ) - { - - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::ShareItemL -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -void CUPnPFileSharingActive::ShareItemL( CUpnpItem& aItem ) - { - __LOG( "CUPnPFileSharingActive::ShareItemL" ); - - TInt status = KErrNone; - - // Allow access to the files listed in res-elements - SetAccesstoItemResourcesL( aItem, ETrue ); - - // Share the item - TRAP( status, - iFileSharing->ShareItemL( KContainerIdRoot, aItem, iStatus ) ); - if( status == KErrNone ) - { - SetActive(); - CActiveScheduler::Start(); - status = iStatus.Int(); - } - - // If the sharing failed - if( status != KErrNone ) - { - // Deny access to the files listed in res-elements - SetAccesstoItemResourcesL( aItem, EFalse ); - } - - // Leave if the was an error - if( status != KErrNone ) - { - User::Leave( status ); - } - - __LOG( "CUPnPFileSharingActive::ShareItemL - end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::UnShareItemL -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -void CUPnPFileSharingActive::UnShareItemL( const TDesC8& aId ) - { - __LOG( "CUPnPFileSharingActive::ConstructL" ); - - TLex8 lex( aId ); - TInt id; - User::LeaveIfError( lex.Val( id ) ); - TInt status = KErrNone; - - // Get the shared items data via Metadata API - CUpnpItem* item = CUpnpItem::NewL(); - CleanupStack::PushL( item ); - iFileSharing->GetSharedItemL( id, *item, iStatus ); - SetActive(); - CActiveScheduler::Start(); - status = iStatus.Int(); - - // If the item's metadata was resolved succesfully - if( status == KErrNone ) - { - // Unshare the item - TRAP( status, iFileSharing->UnshareItemL( id, iStatus ) ); - if( status == KErrNone ) - { - SetActive(); - CActiveScheduler::Start(); - status = iStatus.Int(); - } - } - - // If the unsharing succeeded - if( status == KErrNone ) - { - // Deny access to the files listed in res-elements - SetAccesstoItemResourcesL( *item, EFalse ); - } - - // Clean up - CleanupStack::PopAndDestroy( item ); - item = NULL; - - // Leave if error - if( status != KErrNone ) - { - User::LeaveIfError( status ); - } - - __LOG( "CUPnPFileSharingActive::UnShareItemL - end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingActive::SetAccesstoItemResourcesL -// See upnpfilesharingactive.h -// -------------------------------------------------------------------------- -void CUPnPFileSharingActive::SetAccesstoItemResourcesL( - CUpnpItem& aItem, - TBool aAccessAllowed ) - { - __LOG( "CUPnPFileSharingActive::SetAccesstoItemResourcesL" ); - - // Create security access controller - CUpnpSecAccessController* accessController = - CUpnpSecAccessController::NewL(); - CleanupStack::PushL( accessController ); - - // Get all filenames and set the access for those. - RUPnPElementsArray resElements; - UPnPItemUtility::GetResElements( aItem, resElements ); - for( TInt i=0; iAddAllowedFile( resElements[i]->FilePath() ); - } - else - { - accessController->RemoveAllowedFile( - resElements[i]->FilePath() ); - } - } - - // Clean up - resElements.Close(); - CleanupStack::PopAndDestroy( accessController ); - accessController = NULL; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/bwins/upnprenderingstatemachineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/bwins/upnprenderingstatemachineu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,41 @@ +EXPORTS + ?SetOptions@CUpnpRenderingStateMachine@@QAEXH@Z @ 1 NONAME ; void CUpnpRenderingStateMachine::SetOptions(int) + ?SetURIResult@CUpnpRenderingStateMachine@@QAEXH@Z @ 2 NONAME ; void CUpnpRenderingStateMachine::SetURIResult(int) + ?PositionInfoResult@CUpnpRenderingStateMachine@@QAEXHABVTDesC8@@0@Z @ 3 NONAME ; void CUpnpRenderingStateMachine::PositionInfoResult(int, class TDesC8 const &, class TDesC8 const &) + ?CommandL@CUpnpRenderingStateMachine@@QAEXW4TCommand@Upnp@@HPBVCUpnpItem@@@Z @ 4 NONAME ; void CUpnpRenderingStateMachine::CommandL(enum Upnp::TCommand, int, class CUpnpItem const *) + ?SyncL@CUpnpRenderingStateMachine@@QAEXXZ @ 5 NONAME ; void CUpnpRenderingStateMachine::SyncL(void) + ?Position@CUpnpRenderingStateMachine@@QBEHXZ @ 6 NONAME ; int CUpnpRenderingStateMachine::Position(void) const + ?SetResourceSelector@CUpnpRenderingStateMachine@@QAEXAAVMUPnPResourceSelector@@@Z @ 7 NONAME ; void CUpnpRenderingStateMachine::SetResourceSelector(class MUPnPResourceSelector &) + ?State@CUpnpRenderingStateMachine@@QBE?AW4TState@Upnp@@XZ @ 8 NONAME ; enum Upnp::TState CUpnpRenderingStateMachine::State(void) const + ?SetOffSync@CUpnpRenderingStateMachine@@QAEXXZ @ 9 NONAME ; void CUpnpRenderingStateMachine::SetOffSync(void) + ?NewL@CUpnpRenderingStateMachine@@SAPAV1@AAVMUPnPAVRenderingSession@@@Z @ 10 NONAME ; class CUpnpRenderingStateMachine * CUpnpRenderingStateMachine::NewL(class MUPnPAVRenderingSession &) + ?Duration@CUpnpRenderingStateMachine@@QBEHXZ @ 11 NONAME ; int CUpnpRenderingStateMachine::Duration(void) const + ?IsInSync@CUpnpRenderingStateMachine@@QBEHXZ @ 12 NONAME ; int CUpnpRenderingStateMachine::IsInSync(void) const + ?Options@CUpnpRenderingStateMachine@@QBEHXZ @ 13 NONAME ; int CUpnpRenderingStateMachine::Options(void) const + ?InteractOperationComplete@CUpnpRenderingStateMachine@@QAEXHW4TUPnPAVInteractOperation@@@Z @ 14 NONAME ; void CUpnpRenderingStateMachine::InteractOperationComplete(int, enum TUPnPAVInteractOperation) + ?SetNextURIResult@CUpnpRenderingStateMachine@@QAEXH@Z @ 15 NONAME ; void CUpnpRenderingStateMachine::SetNextURIResult(int) + ?IsBusy@CUpnpRenderingStateMachine@@QBEHXZ @ 16 NONAME ; int CUpnpRenderingStateMachine::IsBusy(void) const + ?SetObserver@CUpnpRenderingStateMachine@@QAEXAAVMUpnpRenderingStateMachineObserver@@@Z @ 17 NONAME ; void CUpnpRenderingStateMachine::SetObserver(class MUpnpRenderingStateMachineObserver &) + ?HasPauseCapability@CUpnpRenderingStateMachine@@QBEHXZ @ 18 NONAME ; int CUpnpRenderingStateMachine::HasPauseCapability(void) const + ??1CUpnpRenderingStateMachine@@UAE@XZ @ 19 NONAME ; CUpnpRenderingStateMachine::~CUpnpRenderingStateMachine(void) + ?RemoveObserver@CUpnpRenderingStateMachine@@QAEXXZ @ 20 NONAME ; void CUpnpRenderingStateMachine::RemoveObserver(void) + ?Cancel@CUpnpVolumeStateMachine@@QAEXXZ @ 21 NONAME ; void CUpnpVolumeStateMachine::Cancel(void) + ?VolumeResult@CUpnpVolumeStateMachine@@QAEXHHH@Z @ 22 NONAME ; void CUpnpVolumeStateMachine::VolumeResult(int, int, int) + ??1CUpnpVolumeStateMachine@@UAE@XZ @ 23 NONAME ; CUpnpVolumeStateMachine::~CUpnpVolumeStateMachine(void) + ?Options@CUpnpVolumeStateMachine@@QBEHXZ @ 24 NONAME ; int CUpnpVolumeStateMachine::Options(void) const + ?NewL@CUpnpVolumeStateMachine@@SAPAV1@AAVMUPnPAVRenderingSession@@@Z @ 25 NONAME ; class CUpnpVolumeStateMachine * CUpnpVolumeStateMachine::NewL(class MUPnPAVRenderingSession &) + ?IsBusy@CUpnpVolumeStateMachine@@QBEHXZ @ 26 NONAME ; int CUpnpVolumeStateMachine::IsBusy(void) const + ?SetVolumeL@CUpnpVolumeStateMachine@@QAEXH@Z @ 27 NONAME ; void CUpnpVolumeStateMachine::SetVolumeL(int) + ?Mute@CUpnpVolumeStateMachine@@QBEHXZ @ 28 NONAME ; int CUpnpVolumeStateMachine::Mute(void) const + ?RemoveObserver@CUpnpVolumeStateMachine@@QAEXXZ @ 29 NONAME ; void CUpnpVolumeStateMachine::RemoveObserver(void) + ?SetObserver@CUpnpVolumeStateMachine@@QAEXAAVMUpnpVolumeStateMachineObserver@@@Z @ 30 NONAME ; void CUpnpVolumeStateMachine::SetObserver(class MUpnpVolumeStateMachineObserver &) + ?Volume@CUpnpVolumeStateMachine@@QBEHXZ @ 31 NONAME ; int CUpnpVolumeStateMachine::Volume(void) const + ?MuteResult@CUpnpVolumeStateMachine@@QAEXHHH@Z @ 32 NONAME ; void CUpnpVolumeStateMachine::MuteResult(int, int, int) + ?SetOffSync@CUpnpVolumeStateMachine@@QAEXXZ @ 33 NONAME ; void CUpnpVolumeStateMachine::SetOffSync(void) + ?IsInSync@CUpnpVolumeStateMachine@@QBEHXZ @ 34 NONAME ; int CUpnpVolumeStateMachine::IsInSync(void) const + ?SyncL@CUpnpVolumeStateMachine@@QAEXXZ @ 35 NONAME ; void CUpnpVolumeStateMachine::SyncL(void) + ?SetMuteL@CUpnpVolumeStateMachine@@QAEXH@Z @ 36 NONAME ; void CUpnpVolumeStateMachine::SetMuteL(int) + ?HasVolumeCapability@CUpnpVolumeStateMachine@@QBEHXZ @ 37 NONAME ; int CUpnpVolumeStateMachine::HasVolumeCapability(void) const + ?SetOptions@CUpnpVolumeStateMachine@@QAEXH@Z @ 38 NONAME ; void CUpnpVolumeStateMachine::SetOptions(int) + ?CopyValues@CUpnpVolumeStateMachine@@QAEXABV1@@Z @ 39 NONAME ; void CUpnpVolumeStateMachine::CopyValues(class CUpnpVolumeStateMachine const &) + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/eabi/upnprenderingstatemachineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/eabi/upnprenderingstatemachineu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,49 @@ +EXPORTS + _ZN26CUpnpRenderingStateMachine10SetOffSyncEv @ 1 NONAME + _ZN26CUpnpRenderingStateMachine10SetOptionsEi @ 2 NONAME + _ZN26CUpnpRenderingStateMachine11SetObserverER34MUpnpRenderingStateMachineObserver @ 3 NONAME + _ZN26CUpnpRenderingStateMachine12SetURIResultEi @ 4 NONAME + _ZN26CUpnpRenderingStateMachine14RemoveObserverEv @ 5 NONAME + _ZN26CUpnpRenderingStateMachine16SetNextURIResultEi @ 6 NONAME + _ZN26CUpnpRenderingStateMachine18PositionInfoResultEiRK6TDesC8S2_ @ 7 NONAME + _ZN26CUpnpRenderingStateMachine19SetResourceSelectorER21MUPnPResourceSelector @ 8 NONAME + _ZN26CUpnpRenderingStateMachine25InteractOperationCompleteEi24TUPnPAVInteractOperation @ 9 NONAME + _ZN26CUpnpRenderingStateMachine4NewLER23MUPnPAVRenderingSession @ 10 NONAME + _ZN26CUpnpRenderingStateMachine5SyncLEv @ 11 NONAME + _ZN26CUpnpRenderingStateMachine8CommandLEN4Upnp8TCommandEiPK9CUpnpItem @ 12 NONAME + _ZN26CUpnpRenderingStateMachineD0Ev @ 13 NONAME + _ZN26CUpnpRenderingStateMachineD1Ev @ 14 NONAME + _ZN26CUpnpRenderingStateMachineD2Ev @ 15 NONAME + _ZNK26CUpnpRenderingStateMachine18HasPauseCapabilityEv @ 16 NONAME + _ZNK26CUpnpRenderingStateMachine5StateEv @ 17 NONAME + _ZNK26CUpnpRenderingStateMachine6IsBusyEv @ 18 NONAME + _ZNK26CUpnpRenderingStateMachine7OptionsEv @ 19 NONAME + _ZNK26CUpnpRenderingStateMachine8DurationEv @ 20 NONAME + _ZNK26CUpnpRenderingStateMachine8IsInSyncEv @ 21 NONAME + _ZNK26CUpnpRenderingStateMachine8PositionEv @ 22 NONAME + _ZTI26CUpnpRenderingStateMachine @ 23 NONAME ; ## + _ZTV26CUpnpRenderingStateMachine @ 24 NONAME ; ## + _ZN23CUpnpVolumeStateMachine10MuteResultEiii @ 25 NONAME + _ZN23CUpnpVolumeStateMachine10SetOffSyncEv @ 26 NONAME + _ZN23CUpnpVolumeStateMachine10SetOptionsEi @ 27 NONAME + _ZN23CUpnpVolumeStateMachine10SetVolumeLEi @ 28 NONAME + _ZN23CUpnpVolumeStateMachine11SetObserverER31MUpnpVolumeStateMachineObserver @ 29 NONAME + _ZN23CUpnpVolumeStateMachine12VolumeResultEiii @ 30 NONAME + _ZN23CUpnpVolumeStateMachine14RemoveObserverEv @ 31 NONAME + _ZN23CUpnpVolumeStateMachine4NewLER23MUPnPAVRenderingSession @ 32 NONAME + _ZN23CUpnpVolumeStateMachine5SyncLEv @ 33 NONAME + _ZN23CUpnpVolumeStateMachine6CancelEv @ 34 NONAME + _ZN23CUpnpVolumeStateMachine8SetMuteLEi @ 35 NONAME + _ZN23CUpnpVolumeStateMachineD0Ev @ 36 NONAME + _ZN23CUpnpVolumeStateMachineD1Ev @ 37 NONAME + _ZN23CUpnpVolumeStateMachineD2Ev @ 38 NONAME + _ZNK23CUpnpVolumeStateMachine19HasVolumeCapabilityEv @ 39 NONAME + _ZNK23CUpnpVolumeStateMachine4MuteEv @ 40 NONAME + _ZNK23CUpnpVolumeStateMachine6IsBusyEv @ 41 NONAME + _ZNK23CUpnpVolumeStateMachine6VolumeEv @ 42 NONAME + _ZNK23CUpnpVolumeStateMachine7OptionsEv @ 43 NONAME + _ZNK23CUpnpVolumeStateMachine8IsInSyncEv @ 44 NONAME + _ZTI23CUpnpVolumeStateMachine @ 45 NONAME ; ## + _ZTV23CUpnpVolumeStateMachine @ 46 NONAME ; ## + _ZN23CUpnpVolumeStateMachine10CopyValuesERKS_ @ 47 NONAME + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/group/bld.inf Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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 information file for upnprenderingstatemachine +* +*/ + + +PRJ_PLATFORMS + + +PRJ_EXPORTS +../inc/upnprenderingstatemachineconstants.h |../../../inc/upnprenderingstatemachineconstants.h +../inc/upnprenderingstatemachineobserver.h |../../../inc/upnprenderingstatemachineobserver.h +../inc/upnprenderingoperationexecutor.h |../../../inc/upnprenderingoperationexecutor.h +../inc/upnprenderingstatemachine.h |../../../inc/upnprenderingstatemachine.h +../inc/upnpvolumestatemachine.h |../../../inc/upnpvolumestatemachine.h +../inc/upnpvolumestatemachineobserver.h |../../../inc/upnpvolumestatemachineobserver.h + +PRJ_MMPFILES +upnprenderingstatemachine.mmp + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/group/upnprenderingstatemachine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/group/upnprenderingstatemachine.mmp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007 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 specification file for upnprenderingstatemachine component +* +*/ + +// For compatibility with IAD branch +#include "../../../group/upnpplatformvar.hrh" +#include + +TARGET upnprenderingstatemachine.dll +TARGETTYPE dll +UID 0x1000008D 0x20009C9D + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +// SIS installation + IAD support +VERSION 10.1 +paged + +// User include paths, own headers +USERINCLUDE ../inc +// User include paths, other headers of dlnasrv +USERINCLUDE ../../inc + +// System include paths +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../inc + +// Source files +SOURCEPATH ../src +SOURCE upnprenderingstatemachine.cpp +SOURCE upnprenderingplaytimecalculator.cpp +SOURCE upnpvolumestatemachine.cpp +SOURCE upnpretraces.cpp + +// Platform and UI libraries +LIBRARY euser.lib + +// dlnasrv +LIBRARY upnpavobjects.lib +LIBRARY upnpavcontrollerclient.lib +LIBRARY upnpavcontrollerhelper.lib + +// debug +DEBUGLIBRARY flogger.lib + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingoperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingoperation.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2007,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: A rendering operation modeled as a class +* +*/ + +#ifndef C_UPNPRENDERINGOPERATION_H +#define C_UPNPRENDERINGOPERATION_H + +// INCLUDES +#include +#include "upnprenderingstatemachineconstants.h" + +// FORWARD DECLARATIONS + +// CONSTANTS + +/** + * Abstract class that represents an internal operation on the + * rendering state machine + */ +NONSHARABLE_CLASS( TUpnpRenderingOperation ) + { + public: // construction/destruction + + // constructor with command, int param and an untyped pointed + inline TUpnpRenderingOperation( Upnp::TCommand aCmd, + TInt aParam = 0, const TAny* aData = NULL ); + + // constructor + inline TUpnpRenderingOperation( Upnp::TCommand aCmd, + const TAny* aData ); + + public: // assignment + + /** + * operator set + */ + inline TUpnpRenderingOperation operator=( + Upnp::TCommand aCmd ); + /** + * operator set + */ + inline TUpnpRenderingOperation operator=( + const TUpnpRenderingOperation& aOther ); + + public: // comparison + + /** + * operator equals + * + * @return boolean + */ + inline TBool operator==( Upnp::TCommand aCmd ) const; + + /** + * operator not equal + * + * @return boolean + */ + inline TBool operator!=( Upnp::TCommand aCmd ) const; + + /** + * operator equals + * + * @return boolean + */ + inline TBool operator==( + const TUpnpRenderingOperation& aOther ) const; + + /** + * operator not equal + * + * @return boolean + */ + inline TBool operator!=( + const TUpnpRenderingOperation& aOther ) const; + + public: // convenience methods + + /** + * IsValid + * + * @return boolean + */ + inline TBool IsValid() const; + + /** + * IsUserOriented + * + * @return boolean + */ + inline TBool IsUserOriented() const; + + public: // member access + + // the command id (const) + inline const Upnp::TCommand& Command() const; + + // any command-related parameter (const) + inline TInt& Param(); + + // any command-related parameter + inline const TInt& Param() const; + + // any command-related pointer data (const) + inline const TAny* Data() const; + + // command user-oriented or not + inline void SetUserOriented( TBool aUserOriented ); + + private: // members + + // the command ID + Upnp::TCommand iCmd; + + // any parameter + TInt iParam; + + // any data + const TAny* iData; + + // whether this was by user's request + TBool iUserOriented; + }; + +#include "upnprenderingoperation.inl" + +#endif // C_UPNPRENDERINGOPERATION_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingoperation.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingoperation.inl Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2007,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: A rendering operation modeled as a class +* +*/ + + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::TUpnpRenderingOperation +// -------------------------------------------------------------------------- +// +inline TUpnpRenderingOperation::TUpnpRenderingOperation( + Upnp::TCommand aCmd, TInt aParam, const TAny* aData ) + { + iCmd=aCmd; + iParam=aParam; + iData=aData; + iUserOriented=ETrue; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::TUpnpRenderingOperation +// -------------------------------------------------------------------------- +// +inline TUpnpRenderingOperation::TUpnpRenderingOperation( + Upnp::TCommand aCmd, const TAny* aData ) + { + iCmd=aCmd; + iParam=0; + iData=aData; + iUserOriented=ETrue; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::operator= +// -------------------------------------------------------------------------- +// +inline TUpnpRenderingOperation TUpnpRenderingOperation::operator=( + Upnp::TCommand aCmd ) + { + iCmd=aCmd; + iParam=0; + iData=0; + iUserOriented=ETrue; + return *this; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::operator= +// -------------------------------------------------------------------------- +// +inline TUpnpRenderingOperation TUpnpRenderingOperation::operator=( + const TUpnpRenderingOperation& aOther ) + { + iCmd=aOther.iCmd; + iParam=aOther.iParam; + iData=aOther.iData; + iUserOriented=aOther.iUserOriented; + return *this; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::operator== +// -------------------------------------------------------------------------- +// +inline TBool TUpnpRenderingOperation::operator==( + Upnp::TCommand aCmd ) const + { + return iCmd==aCmd; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::operator!= +// -------------------------------------------------------------------------- +// +inline TBool TUpnpRenderingOperation::operator!=( + Upnp::TCommand aCmd ) const + { + return !operator==(aCmd); + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::operator== +// -------------------------------------------------------------------------- +// +inline TBool TUpnpRenderingOperation::operator==( + const TUpnpRenderingOperation& aOther ) const + { + return iCmd==aOther.iCmd && iParam==aOther.iParam && + iData==aOther.iData && iUserOriented==aOther.iUserOriented; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::operator!= +// -------------------------------------------------------------------------- +// +inline TBool TUpnpRenderingOperation::operator!=( + const TUpnpRenderingOperation& aOther ) const + { + return !operator==(aOther); + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::IsValid +// -------------------------------------------------------------------------- +// +inline TBool TUpnpRenderingOperation::IsValid() const + { + return iCmd != Upnp::ENone; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::IsUserOriented +// -------------------------------------------------------------------------- +// +inline TBool TUpnpRenderingOperation::IsUserOriented() const + { + return iUserOriented; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::Command +// -------------------------------------------------------------------------- +// +inline const Upnp::TCommand& + TUpnpRenderingOperation::Command() const + { + return iCmd; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::Param +// -------------------------------------------------------------------------- +// +inline TInt& TUpnpRenderingOperation::Param() + { + return iParam; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::Param +// -------------------------------------------------------------------------- +// +inline const TInt& TUpnpRenderingOperation::Param() const + { + return iParam; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::Data +// -------------------------------------------------------------------------- +// +inline const TAny* TUpnpRenderingOperation::Data() const + { + return iData; + } + +// -------------------------------------------------------------------------- +// TUpnpRenderingOperation::SetUserOriented +// -------------------------------------------------------------------------- +// +inline void TUpnpRenderingOperation::SetUserOriented( TBool aUserOriented ) + { + iUserOriented = aUserOriented; + } + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingoperationexecutor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingoperationexecutor.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007,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: An interface that executes rendering operations +* +*/ + +#ifndef C_UPNPRENDERINGOPERATIONEXECUTOR_H +#define C_UPNPRENDERINGOPERATIONEXECUTOR_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class TUpnpRenderingOperation; + +/** + * An interface that is able to receive rendering operation items + * and execute them. The interface is being used by the rendering + * operation queue class. + */ +NONSHARABLE_CLASS( MUpnpRenderingOperationExecutor ) + { + public: + + /** + * Result of executing or processing an item + */ + enum TResult + { + EQueue = 0, // Wait until other operations finished first + EContinue = 1, // operation started and it will continue + ECompleted = 2 // operation finished + }; + + /** + * Executes a new operation + * @param aOperation new operation to execute + * @param aCurrent operation currently ongoing, + or ENone if we are idle + * @return EQueue if can't execute in parallel, + * ECompleted if finished, or + * EContinue if this operation will continue running + */ + virtual TResult ExecuteOperationL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ) = 0; + + /** + * Processes an operation with some abstract input + */ + virtual TResult ProcessOperationL( + const TUpnpRenderingOperation& aOperation, TInt aEvent, + TInt aError, const TAny* aParam1, const TAny* aParam2 ) = 0; + + /** + * Executor should handle an error that occurred in ExecuteOperationL + * @param aOperation currently ongoing operation, the one that failed + * @param aError the error code + */ + virtual void HandleAsyncError( + const TUpnpRenderingOperation& aOperation, TInt aLeave ) = 0; + + }; + +#endif // C_UPNPRENDERINGOPERATIONEXECUTOR_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingplaytimecalculator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingplaytimecalculator.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2007,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: Calculates playback time for rendering state machine +* +*/ + +#ifndef UPNPRENDERINGPLAYTIMECALCULATOR_H +#define UPNPRENDERINGPLAYTIMECALCULATOR_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + + +/** +* A class that keeps track of playback time by setting a timestamp at given +* play, pause, resume and stop events and maybe also comparing that to given +* fixed progress positions along the way. By doing that we will be able to +* tell how long the track has been playing when a stop signal arrives. This +* is important so that we can tell if it is a natural "track complete" stop +* or an "user interrupt" type of stop. +*/ +NONSHARABLE_CLASS( CUpnpRenderingPlaytimeCalculator ) + { +public: // the interface + + /** + * Default constructor + */ + CUpnpRenderingPlaytimeCalculator(); + + /** + * Marks START timestamp. + * Calling Start() will reset the calculator. + */ + void Start(); + + /** + * Marks PAUSE timestamp. + * Can be called multiple times, ceach Pause will replace previous mark. + */ + void Pause(); + + /** + * Marks RESUME timestamp. + * Can NOT be called multiple times. + */ + void Resume(); + + /** + * Marks STOP timestamp. + * Can be called multiple times. + */ + void Stop(); + + /** + * Sets the track duration as it is represented in the media server. + * This method should be used to set the initial duration so that + * the calculator works even if renderer NEVER sends position info. + * @param aDuration track duration in milliseconds + */ + void SetDuration( TInt aDuration ); + + /** + * Returns the track duration if it is known, otherwise KErrNotFound. + */ + TInt Duration() const; + + /** + * Acknowledges track duration and position info that was received from + * the renderer. Following things are done here: + * 1. The renderer's understanding of duration might be different from + * media server's understanding. If it is, we MAY modify it. + * 2. The position is compared to the calculated position and if it is + * different, an offset is calculated and used in future Position calls. + */ + void AcknowledgePositionInfo( TInt aDuration, TInt aPosition ); + + /** + * Estimates position now, or returns total playtime of previous track. + */ + TInt Position() const; + + /** + * returns true if last track track playtime would indicate that it was + * played back entirely. + */ + TBool IsTrackComplete() const; + + /** + * Returns true if calculator is in playing state. + */ + TBool IsPlaying() const; + + /** + * Adjust the start mark according to the new postion; use case is seek + */ + void RestartAt( TInt aNewPosition ); + +private: + + /** + * calculates playtime estimate starting from PLAY mark until given time, + * tacking in account all time spent in PAUSE and also cinsidering offset. + */ + TInt PositionAt( TTime& aTime ) const; + + /** + * calculates time spent in pause + */ + TInt PausetimeAt( TTime& aTime ) const; + + /** + * calculates the offset from current time and the position + */ + TInt OffsetFromNow( TInt aPosition ) const; + +private: + + // duration of the track + TInt iDuration; + + // the start timestamp + TTime iStartMark; + + // the stop timestamp + TTime iStopMark; + + // the pause mark + TTime iPauseMark; + + // total time spent in pause + TInt iPauseTime; + + // the offset to real position + TInt iOffset; + + // is a track playing + TBool iPlaying; + + // is track paused + TBool iPaused; + + }; + + + +#endif // UPNPRENDERINGPLAYTIMECALCULATOR_H + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingstatemachine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingstatemachine.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,473 @@ +/* +* Copyright (c) 2007,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: Generic upnp remote rendering state machine +* +*/ + +#ifndef C_UPNPRENDERINGSTATEMACHINE_H +#define C_UPNPRENDERINGSTATEMACHINE_H + +// INCLUDES +#include +#include "upnpavrenderingsessionobserver.h" // TUPnPAVInteractOperation +#include "upnpresourceselector.h" // TUPnPSelectDefaultResource +#include "upnprenderingstatemachineconstants.h" // types +#include "upnprenderingoperationexecutor.h" + +// FORWARD DECLARATIONS +class MUPnPAVRenderingSession; +class MUpnpRenderingStateMachineObserver; +class TUpnpRenderingOperation; +class CUpnpRenderingPlaytimeCalculator; +class CUpnpRenderingStateMachineStates; +class CUpnpRenderingOperationQueue; +class MUPnPResourceSelector; +class CUpnpItem; +class CPeriodic; + +// CONSTANTS +const TInt KUriBuffer = 256; + +/** + * Class for handling renderer states + * + * @lib upnprenderingstatemachine.lib + */ +class CUpnpRenderingStateMachine + : public CBase + , public MUpnpRenderingOperationExecutor + { + +public: // construction / destruction + + /** + * static constructor + * + * @param aSession session where to send volume events + */ + IMPORT_C static CUpnpRenderingStateMachine* NewL( + MUPnPAVRenderingSession& aSession ); + + /** + * Destructor + */ + IMPORT_C virtual ~CUpnpRenderingStateMachine(); + +private: // construction, private part + + /** + * static constructor + */ + CUpnpRenderingStateMachine( + MUPnPAVRenderingSession& aSession ); + + /** + * 2nd phase constructor + */ + void ConstructL(); + +public: // the interface + + /** + * sets the state machine options (future extension) + * @param aOptions options bit mask + */ + IMPORT_C void SetOptions( TInt aOptions ); + + /** + * returns current options + * @return the options bitmask + */ + IMPORT_C TInt Options() const; + + /** + * sets the state machine observer + * @param aObserver the observer to set + */ + IMPORT_C void SetObserver( MUpnpRenderingStateMachineObserver& aObserver ); + + /** + * removes the current observer + */ + IMPORT_C void RemoveObserver(); + + /** + * sets the resource selector for media to play + * if not called, TUPnPSelectDefaultResource will be used. + */ + IMPORT_C void SetResourceSelector( MUPnPResourceSelector& aSelector ); + + /** + * Synchronises the state machine with the remote renderer + * (updates the state) + * this is an aynchronous operation and calls back RendererSyncReady() + */ + IMPORT_C void SyncL(); + + /** + * Forces the state machine off sync + * (sets the cached state to OffSync) + */ + IMPORT_C void SetOffSync(); + + /** + * Checks if the state machine is synchronised + * with the remote renderer ie. in operation + * @return ETrue if state machine is operational + */ + IMPORT_C TBool IsInSync() const; + + /** + * Executes a command on the renderer. + * If a command is currently running, the command is queued. + * see Upnp::TCommand on upnprenderingstatemachineconstants.h + * @param aCommand the command to execute + * @param aCommandParameter command-specific parameter + * @param aMedia the media to be played (specific to PLAY command) + */ + IMPORT_C void CommandL( + Upnp::TCommand aCommand, + TInt aCommandParameter = 0, + const CUpnpItem* aMedia = NULL + ); + + /** + * Checks if the state machine is busy executing a command + * @return ETrue if the state machine is busy + */ + IMPORT_C TBool IsBusy() const; + + /** + * Cancels currently ongoing operation and cleans up the + * queue of operations + */ + IMPORT_C void Cancel(); + + /** + * returns the current renderer state + * Note: this is not a network operation - returns a cached value + * @return the renderer state + */ + IMPORT_C Upnp::TState State() const; + + /** + * returns current track duration. + * Note: this is NOT a network operation - returns a cached value. + * NOTE ALSO: The method only works in case ERenderingOptionAutoSyncPos + * option is in use or ERenderingCommandSyncPos has been called to + * synchronise the position/duration. + * @return the current track duration, or -1 if it is not available + */ + IMPORT_C TInt Duration() const; + + /** + * returns current position within the track. + * Note: this is NOT a network operation - returns the position within an + * internal position timer. The timer can be calibrated with the renderer + * position using ECalibrate command, after which the Position values are + * again more accurate. + * @return the current estimated position, or -1 if it is not available + */ + IMPORT_C TInt Position() const; + + /** + * Tests if this renderer has pause capability. + * Requesting PAUSE for a renderer that does not have this capability + * wil result into an error. + * @return ETrue if device has volume control capability. + */ + IMPORT_C TBool HasPauseCapability() const; + +public: // methods like in MUPnPRenderingSessionObserver + + /** + * @see MUPnPRenderiongSessionObserver + * client of this state machine should forward the corresponding method + * from the rendering session directly to this method + */ + IMPORT_C void InteractOperationComplete( + TInt aError, TUPnPAVInteractOperation aOperation ); + + /** + * @see MUPnPRenderiongSessionObserver + * client of this state machine should forward the corresponding method + * from the rendering session directly to this method + */ + IMPORT_C void PositionInfoResult( + TInt aError, const TDesC8& aPosition, const TDesC8& aLength ); + + /** + * @see MUPnPRenderiongSessionObserver + * client of this state machine should forward the corresponding method + * from the rendering session directly to this method + */ + IMPORT_C void SetURIResult( TInt aError ); + + /** + * @see MUPnPRenderiongSessionObserver + * client of this state machine should forward the corresponding method + * from the rendering session directly to this method + */ + IMPORT_C void SetNextURIResult( TInt aError ); + +public: // internal methods for the state algorithms + + /** + * Reports SynReady to observer + */ + void ReportSyncReady( TInt aError, + Upnp::TState aNewState ); + + /** + * Reports StateChanged to observers + */ + void ReportStateChanged( TInt aError, + Upnp::TState aNewState, + TBool aActionResponse = ETrue, + TInt aStateParam = 0 ); + + /** + * Reports PositionSync to observers + */ + void ReportPositionSync( TInt aError, + Upnp::TPositionMode aMode, + TInt aDuration, TInt aPosition ); + +private: // data + + // Rendering session + MUPnPAVRenderingSession& iSession; + + // the observer (no ownership!) + MUpnpRenderingStateMachineObserver* iObserver; + + // the current state + Upnp::TState iState; + + // rendering state machine option flags + TInt iOptions; + + // playtime calculator + CUpnpRenderingPlaytimeCalculator* iPlaytimeCalculator; + + // state when buffering started with 'set uri' request + Upnp::TState iStateBeforeSetUri; + + +/************************** + ** State machine states ** + **************************/ + +public: // Operation execution methods + + /** + * from MUpnpRenderingOperationExecutor + */ + TResult ExecuteOperationL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + + /** + * from MUpnpRenderingOperationExecutor + */ + TResult ProcessOperationL( + const TUpnpRenderingOperation& aOperation, TInt aEvent, + TInt aError, const TAny* aParam1, const TAny* aParam2 ); + + /** + * from MUpnpRenderingOperationExecutor + */ + void HandleAsyncError( + const TUpnpRenderingOperation& aOperation, TInt aError ); + + /** + * processing events + * used in context of the operation queue + */ + enum TOperationEvents + { + EInteractOperationComplete, + EPositionInfo, + ESetUriResult, + ETimeout + }; + +private: // internal state machinery + + // these are all called from the operation queue. + // in all below methods, aOperation is the currently ongoing operation. + + // executes an operation + TResult ExecuteOperationSyncL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationPlayL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationStopL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationPauseL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationResumeL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationRestartL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationSeekL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationCalibrateL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + TResult ExecuteOperationSetUriL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ); + + // handles network events + TResult ProcessPositionInfo( + const TUpnpRenderingOperation& aOperation, + TInt aError, const TDesC8& aPosition, const TDesC8& aLength ); + TResult ProcessSetURIResultL( + const TUpnpRenderingOperation& aOperation, TInt aError ); + TResult ProcessAVEvents( + const TUpnpRenderingOperation& aOperation, + const TUPnPAVInteractOperation aIntOp, + TInt aError ); + +protected: // internal + + // retrieves a resource from given media using the media selector + const CUpnpElement& ResourceFromL( const CUpnpItem& aMedia ); + + + // user-defined resource selector (NOT OWNED!) + MUPnPResourceSelector* iSelector; + + // the default resource selector (used if not explicitly set by user) + TUPnPSelectDefaultResource iDefaultSelector; + + // currently playing HTTP URI + TBuf8 iCurrentUri; + + +/*********** + ** Queue ** + ***********/ +public: // methods + + /** + * Count of operations in the queue + * @return count of operations in the queue + */ + TInt Size() const; + + /** + * Checks if the queue is free for new operations + * @return ETrue if new operation can be run immediately + */ + TBool IsFree() const; + + /** + * push operation to queue. + * Don't even try to execute it at this stage. + * @param aOperation the operation to be added + */ + void PushL( + const TUpnpRenderingOperation& aOperation ); + + /** + * push operation to queue and execute + * @param aOperation the operation to be added + */ + void PushAndExecuteL( + const TUpnpRenderingOperation& aOperation ); + + /** + * executes the first operation in the queue + * note: non-leaving version. + * if the operation completes, continues recursively to next + * until queue is empty + */ + void Execute(); + + /** + * Processes an item in the queue with given data + * if the operation completes, continues recursively to next + * until queue is empty + */ + void Process( TInt aEvent, + TInt aError=0, const TAny* aParam1=NULL, const TAny* aParam2=NULL ); + + /** + * Finds and removes deprecated commands from queue. + * E.g. If the last command is stop, then all other except the current + * (ongoing) and the stop command are removed. + */ + void CompressQueueL(); + + /** + * removes all dup. commands but not the latest one and ongoing + * + * @param aCommand commands to be removed from queue + */ + void RemoveAllDublicateCommands( Upnp::TCommand aCommand ); + +public: // own methods + + /** + * Returns currently ongoing operation. ENone, if queue empty + * @return operation at first position + */ + TUpnpRenderingOperation Current() const; + + + /** + * executes the current operation recursively + * if the operation completes, continues recursively to next + * until queue is empty + */ + void ExecuteRecursivelyL(); + + /** + * executes an operation parallel to an ongoing operation + */ + void ExecuteParallelL( + const TUpnpRenderingOperation& aOperation ); + +private: + + void SetUriL( const TUpnpRenderingOperation& aOperation ); + +private: + + // the array that implements the queue + RArray iQueue; + + // Seek position to be used for playbacktimecalculator + // when seek is completed + TInt iSeekPostion; + + // Start timestamp for getting position; it is used to add + // half of the delay when get position request is made and + // when the response is received to avoid lag with the renderer + TTime iGetPositionStartMark; + + }; + + +#endif // C_UPNPRENDERINGSTATEMACHINE_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingstatemachineconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingstatemachineconstants.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2007,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: Constants used in upnprenderingstatemachine +* +*/ + +#ifndef C_UPNPRENDERINGSTATEMACHINECONSTANTS_H +#define C_UPNPRENDERINGSTATEMACHINECONSTANTS_H + +/** + * Constants enumerations for the Upnp API + * especially those needed in the rendering engine part. + */ +namespace Upnp + { + + /** + * Commands + */ + enum TCommand + { + ENone = 0x0000, // no command + ESync = 0x0001, // get in sync with the renderer + EPlay = 0x0002, // requests to start playing + // (in RenderingStateMachine aMedia indicates the media to play) + EStop = 0x0004, // requests to stop playback (fast to play again) + EClose = 0x0008, // requests to close playback (a permanent stop) + EPause = 0x0010, // request to pause + EResume = 0x0020, // request to resume from pause + ERestart = 0x0040, // start track from beginning + ECalibrate= 0x0080, // request to calibrate the position counter from + // renderer + ESeek = 0x0100, // seek (aParameter = position in ms) + ENext = 0x0200, // skip to next track + EPrev = 0x0400, // skip to previous track + EBack = 0x0800, // skip to previous track, or track start if + // current position is less than 3 seconds + EJump = 0x1000, // Start playing given track + // (aParameter = track index) + ESetUri = 0x2000 // set uri + }; + + /** + * Properties + */ + enum TProperty + { + EVolume = 0x01, // the volume property + EMute = 0x02, // the mute property + EMediaDuration = 0x04, // current track duration (ms) - read only + EPosition = 0x08, // current track position (ms) - see ESeek command + EOptions = 0x10, // rendering options (see TRenderingOptions) + ECurrentIndex = 0x20, // Index of item currently playing. + // Note: can only be set when NOT playing. + // Note2: changes in the value are reported via + // CurrentIndexChanged() + ECurrentState = 0x40 // the state of the engine (TState) - read only + }; + + /** + * Generic rendering state + */ + enum TState + { + EOffSync = 0x0001, // not synchronised with renderer yet + EBusy = 0x0010, // renderer is busy doing something else + EDead = 0x0020, // unrecoverable error state + EStopped = 0x0100, // renderer is idle + EBuffering = 0x1000, // media playback is being started in the + // renderer + EPlaying = 0x2000, // renderer is playing media + EPaused = 0x4000, // renderer is in pause state + // -------- masks --------- + EStateMaskInSync = 0xFFF0, // any state where synchronised to + // renderer + EStateMaskActive = 0xFF00, // any state where can be used + EStateMaskRendering = 0XF000, // any state where some kind of output + // is going on + }; + + /** + * extra information in RenderingStateMachine provided with state indicates + * reason for state transition + */ + enum TStateInfo + { + ENoMedia = 0, + // no media initialised (typically the initial state) + EStopRequested = 1, + // stop was requested (by this engine or by external party) + ETrackCompleted = 2, + // track was fully completed + EPositionChanged = 3 + }; + + /** + * Mode in which the position is changing. + * This includes information of trick modes. + * this type is internal to rendering engine + */ + enum TPositionMode + { + EPlayingNormally = 0, + // playback is going on normally + ESeekingForward = 1, + // fast seeking forward. New position will be ackowledged soon. + ESeekingBackward = 2, + // fast seeking backward New position will be ackowledged soon. + EBufferingData = 3, + // renderer is buffering data. Will return to PlayingNormally + // soon. + }; + + /** + * Rendering options. Use this to optimise the engine to your + * specific needs. + * this type is internal to rendering engine. + * + * NOTE: instructions for flag use on the rendering engine API: + * to turn on a flag: + * engine->SetPropertyL( Upnp::EOptions, + * engine->Property( Upnp::EOptions ) | EFlag ); + * to turn off a flag: + * engine->SetPropertyL( Upnp::EOptions, + * engine->Property( Upnp::EOptions ) & ~EFlag ); + */ + enum TRenderingOptions + { + EPlaylistMode = 0x0001, + // play content in playlist mode, progress automatically. + // for images this means a timed slideshow. + // if flag disabled, only manual skip is supported. + // (this flag is on by default) + EAutoCalibratePosition = 0x0002, + // calibrate and update track position automatically. + // If position changed, sends PropertyChanged callback. + // (this flag is on by default) + EVolumeSupport = 0x0004, + // request support for volume in the renderer + // Clear this flag to disable all volume usage and avoid one + // unnecessary network operation. Clearing the flag would be + // only useful if you only have pure image source. + // (this flag is on by default) + ESafetyTimer = 0x0008, + // attaches a safety timer for all skip commands + // (next,prev,back,jump) so that client can safely call them + // directly from UI as often as required. Commands are only + // executed after the safety period. having a burst of 10 + // "Next" commands will be converted internally to a + // single "Jump(current+10)" operation. + EConvertVolumeZeroToMute = 0x0100, + // convert client VOLUME 0 request to MUTE and back + // (this flag is on by default) + }; + } + +#endif // C_UPNPRENDERINGSTATEMACHINECONSTANTS_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingstatemachineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnprenderingstatemachineobserver.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007,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: Observer for the generic upnp rendering state machine +* +*/ + +#ifndef C_UPNPRENDERINGSTATEMACHINEOBSERVER_H +#define C_UPNPRENDERINGSTATEMACHINEOBSERVER_H + +// INCLUDES +#include +#include "upnprenderingstatemachineconstants.h" // for types + +// FORWARD DECLARATIONS + +// CONSTANTS + + +/** + * Class for receiving callbacks from + * rendering state machine + * + * @lib upnprenderingstatemachine.lib + */ +class MUpnpRenderingStateMachineObserver + { +public: + + /** + * Indicates state machine has been synchronised with the renderer + * @param aError error that occurred during sync + */ + virtual void RendererSyncReady( TInt aError, + Upnp::TState aState ) = 0; + + /** + * Indicates renderer state has changed + * either by request or spontanelously. + * @param aError the error code + * @param aState the new state + * @param aUserOriented ETrue if this responds to a request + * @param aStateParam extra info depending on the state change + */ + virtual void RenderingStateChanged( + TInt aError, + Upnp::TState aState, + TBool aUserOriented, + TInt aStateParam ) = 0; + + /** + * Synchronises UI with media duration and current position + * this callback can be either automatic or explicitly requested + * @param aError error that occurred during position sync + * @param aMode mode in which the track is progressing + * @param aDuration media duration in milliseconds + * @param aPosition current position in milliseconds + */ + virtual void PositionSync( TInt aError, + Upnp::TPositionMode aMode, + TInt aDuration, TInt aPosition ) = 0; + + }; + + +#endif // C_UPNPRENDERINGSTATEMACHINEOBSERVER_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnpretraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnpretraces.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007,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: upnprenderingstatemachine trace helper functions +* +*/ + +#ifndef C_UPNPRETRACES_H +#define C_UPNPRETRACES_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// FUNCTIONS + + + /** + * Name of a state, for logging purposes + * @param aState: see Upnp::TState + * @return 16-bit zero-terminated string. Use %s in descriptor format. + */ + const TUint16* StateName( TInt aState ); + + /** + * Name of a command, for logging purposes + * @param aCommand: see Upnp::TCommand + * @return 16-bit zero-terminated string. Use %s in descriptor format. + */ + const TUint16* CommandName( TInt aCommand ); + + /** + * Name of a property, for logging purposes + * @param aProperty: see Upnp::TProperty + * @return 16-bit zero-terminated string. Use %s in descriptor format. + */ + const TUint16* PropertyName( TInt aProperty ); + + /** + * Name of a interact operation, for logging purposes + * @param aInteractOperation: see TUPnPAVInteractOperation + * @return 16-bit zero-terminated string. Use %s in descriptor format. + */ + const TUint16* InteractOperationName( TInt aInteractOperation ); + +#endif // C_UPNPRETRACES_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnpvolumestatemachine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnpvolumestatemachine.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,307 @@ +/* +* Copyright (c) 2007,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: Generic upnp volume state machine +* +*/ + + +#ifndef C_UPNPVOLUMESTATEMACHINE_H +#define C_UPNPVOLUMESTATEMACHINE_H + +// INCLUDES +#include + +#include "upnprenderingstatemachineconstants.h" + +// FORWARD DECLARATIONS +class MUPnPAVRenderingSession; +class MUpnpVolumeStateMachineObserver; + +// CONSTANTS +const TInt KVolumeMin = 0; +const TInt KVolumeMax = 100; +const TInt KMuteOff = 0; +const TInt KMuteOn = 1; + + +class TUpnpVSMQueueItem + { + +public: + + enum TPropertyType + { + EVolume, + EMute + }; + +public: + + TUpnpVSMQueueItem( const TUpnpVSMQueueItem::TPropertyType aProperty, + const TInt aValue ); + +public: + + TUpnpVSMQueueItem::TPropertyType Property() const; + + TInt Value() const; + +private: + + const TUpnpVSMQueueItem::TPropertyType iProperty; + + const TInt iValue; + + }; + + +/** + * Class for handling renderer volume + * + * @lib upnpavcontrollerhelper.lib + * @since S60 v3.2 + */ +class CUpnpVolumeStateMachine + : public CBase + { + +public: // construction / destruction + + /** + * static constructor + * + * @since Series 60 3.2 + * @param aSession session where to send volume events + */ + IMPORT_C static CUpnpVolumeStateMachine* NewL( + MUPnPAVRenderingSession& aSession ); + + /** + * Destructor + * + * @since Series 60 3.1 + */ + IMPORT_C virtual ~CUpnpVolumeStateMachine(); + +private: // construction, private part + + /** + * static constructor + */ + CUpnpVolumeStateMachine( + MUPnPAVRenderingSession& aSession ); + + void HandleVolumeResultInSyncState( + TInt aError, TInt aVolumeLevel, TBool aActionResponse ); + + void HandleUnsolicitedMuteEvent( + TInt aError, TBool aMute, TBool aActionResponse ); + + void HandleUnsolicitedMuteEventInIdle( + TInt aError, TBool aMute, TBool aActionResponse ); + + void NotifyObserver(TBool aMute); + + +public: // the interface + + /** + * sets the state machine options (future extension) + * @param aOptions options bit mask + */ + IMPORT_C void SetOptions( TInt aOptions ); + + /** + * returns current options + * @return the options bitmask + */ + IMPORT_C TInt Options() const; + + /** + * sets the state machine observer + * @param aObserver the observer to set + */ + IMPORT_C void SetObserver( MUpnpVolumeStateMachineObserver& aObserver ); + + /** + * removes the current observer + */ + IMPORT_C void RemoveObserver(); + + /** + * Synchronises the state machine with the remote renderer + * (updates cached volume and mute levels) + * this is an aynchronous operation and calls back VolumeSyncReady() + */ + IMPORT_C void SyncL(); + + /** + * Forces the state machine off sync + * (clears cached volume and mute levels) + */ + IMPORT_C void SetOffSync(); + + /** + * Checks if the state machine is synchronised + * with the remote renderer + */ + IMPORT_C TBool IsInSync() const; + + /** + * Sets volume on the renderer. + * This method is thread-safe, and checks limits automatically. + * If trying to adjust volume when session is busy, + * method will leave with KErrInUse. + * If trying to adjust volume to an existing value, + * method will call back immediately with KErrNone. + * Example for increasing volume: + * v->SetVolumeL( v->Volume() + KDefaultVolumeResolution ); + * @param aVolume volume to set + */ + IMPORT_C void SetVolumeL( TInt aVolume ); + + /** + * returns the current renderer volume level. + * Note: this is not a network operation - returns a cached value + * @return volume level + */ + IMPORT_C TInt Volume() const; + + /** + * Sets or unsets renderer mute state. + * If trying to adjust volume when session is busy, + * method will leave with KErrInUse. + * If trying to adjust mute to a state to an existing state, + * method will call back immediately with KErrNone. + * example of toggling mute state: + * v->SetMuteL( !v->Mute() ); + * @param aMuteState either ETrue of EFalse to set mute on or off + */ + IMPORT_C void SetMuteL( TBool aMuteState ); + + /** + * returns the current renderer muted state. + * Note: this is not a network operation - returns a cached value + * @return mute state + */ + IMPORT_C TBool Mute() const; + + /** + * Checks if the state machine is busy doing something. + * If not, new requests can be put in. + */ + IMPORT_C TBool IsBusy() const; + + /** + * Tests if this renderer has volume and mute capability. + * Calling volume handling methods for a renderer that does not have + * this capability wil result into an error. + * @return ETrue if device has volume control capability. + */ + IMPORT_C TBool HasVolumeCapability() const; + + /** + * Cancels any ongoing operation + */ + IMPORT_C void Cancel(); + + /** + * Copies cached values from another instance + */ + IMPORT_C void CopyValues( const CUpnpVolumeStateMachine& aOther ); + +public: // methods like in MUPnPRenderiongSessionObserver + + /** + * @see MUPnPRenderiongSessionObserver + * client of this state machine should forward the corresponding method + * from the rendering session directly to this method + */ + IMPORT_C void VolumeResult( + TInt aError, TInt aVolumeLevel, TBool aActionResponse ); + + /** + * @see MUPnPRenderiongSessionObserver + * client of this state machine should forward the corresponding method + * from the rendering session directly to this method + */ + IMPORT_C void MuteResult( + TInt aError, TBool aMute, TBool aActionResponse ); + +private: + + void PushIntoQueueL( const TUpnpVSMQueueItem::TPropertyType aPropery, + const TInt aValue); + + void CompressQueue(); + + void ProcessNextQueuedProperty(); + +private: // data + + // Rendering session + MUPnPAVRenderingSession& iSession; + + // the observer (no ownership!) + MUpnpVolumeStateMachineObserver* iObserver; + + // volume state machine option flags + TInt iOptions; + + // operation types + enum TState + { + EOffSync, // not synchronised + ESyncing, // synchronising the state machine + EIdle, // doing nothing + EAdjustingVolume, // adjusting volume + EAdjustingMute, // setting/unsetting mute + EAdjustingVolumeToZero, // setting to mute due to volume==0 + EAdjustingVolumeFromZero, // adjusting volume up from muted state + ECancelled // operation being cancelled + }; + + //currently ongoing operation + TState iState; + + // current renderer volume level + TInt iCurrentVolume; + + // volume requested by client during mute state + TInt iVolumeToSetAfterMute; + + // current renderer mute state + TInt iCurrentMute; + + // in case mute is on, this flag is set if mute was by client request + TBool iMuteRequestedByClient; + + // volume capability + TBool iVolumeCapability; + + // mute capability (only used internally) + TBool iMuteCapability; + + RArray iQueue; + + // last changed volume level + TInt iCachedVolume; + + // last changed mute + TInt iCachedMute; + }; + + +#endif // C_UPNPVOLUMESTATEMACHINE_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/inc/upnpvolumestatemachineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/inc/upnpvolumestatemachineobserver.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2007,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: Observer for generic upnp volume state machine +* +*/ + + +#ifndef C_UPNPVOLUMESTATEMACHINEOBSERVER_H +#define C_UPNPVOLUMESTATEMACHINEOBSERVER_H + +// INCLUDES +#include + + +/** + * Class for receiving callbacks from + * CUPnPVolumeStateMachine + * + * @lib upnpavcontrollerhelper.lib + */ +class MUpnpVolumeStateMachineObserver + { + +public: + + /** + * Indicates state machine has been synchronised with the renderer + * @param aError error that occurred during sync + */ + virtual void VolumeSyncReady( TInt aError ) = 0; + + /** + * Indicates volume state has been changed + * either by request or spontanelously. + * @param aError the error code + * @param aRenderingSession for playback commands + * @param aUserOriented ETrue if this responds to a request + */ + virtual void VolumeChanged( + TInt aError, TInt aVolume, TBool aUserOriented ) = 0; + + /** + * Indicates mute state has been changed + * either by request or spontanelously. + * @param aError the error code + * @param aMuteState current mute state + * @param aUserOriented ETrue if this responds to a request + */ + virtual void MuteChanged( + TInt aError, TBool aMuteState, TBool aUserOriented ) = 0; + + }; + + +#endif // C_UPNPVOLUMESTATEMACHINEOBSERVER_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/src/upnprenderingplaytimecalculator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/src/upnprenderingplaytimecalculator.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,300 @@ +/* +* Copyright (c) 2007,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: Implementation of playback time for rendering state machine +* +*/ + +// INCLUDES +#include "upnprenderingplaytimecalculator.h" + +_LIT( KComponentLogfile, "upnprenderingstatemachine.txt"); +#include "upnplog.h" + +// CONSTANTS +const TInt KMicrosecondsInMillisecond = 1000; +const TInt KMillisecondsInSecond = 1000; +const TInt KDurationErrorMargin = 3000; // 3 seconds + +// ======== MEMBER FUNCTIONS ======== + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::CUpnpRenderingPlaytimeCalculator +// -------------------------------------------------------------------------- +// +CUpnpRenderingPlaytimeCalculator::CUpnpRenderingPlaytimeCalculator() + { + iPlaying = EFalse; + iPaused = EFalse; + iStartMark = 0; + iStopMark = 0; + iPauseMark = 0; + iPauseTime = 0; + iOffset = 0; + iDuration = KErrNotFound; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::Start +// -------------------------------------------------------------------------- +// +void CUpnpRenderingPlaytimeCalculator::Start() + { + __LOG("PlaytimeCalculator: Start()" ); + iStartMark.UniversalTime(); + iPauseTime = 0; + iPlaying = ETrue; + iPaused = EFalse; + iOffset = 0; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::Pause +// -------------------------------------------------------------------------- +// +void CUpnpRenderingPlaytimeCalculator::Pause() + { + __LOG("PlaytimeCalculator: Pause()" ); + if( !iPaused ) + { + iPauseMark.UniversalTime(); + iPaused = ETrue; + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::Resume +// -------------------------------------------------------------------------- +// +void CUpnpRenderingPlaytimeCalculator::Resume() + { + __LOG("PlaytimeCalculator: Resume()" ); + TTime resumeMark; + resumeMark.UniversalTime(); + iPauseTime += PausetimeAt( resumeMark ); + iPaused = EFalse; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::Stop +// -------------------------------------------------------------------------- +// +void CUpnpRenderingPlaytimeCalculator::Stop() + { + __LOG("PlaytimeCalculator: Stop()" ); + iStopMark.UniversalTime(); + iPlaying = EFalse; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::SetDuration +// -------------------------------------------------------------------------- +// +void CUpnpRenderingPlaytimeCalculator::SetDuration( TInt aDuration ) + { + iDuration = aDuration; + __LOG1("PlaytimeCalculator:SetDuration iDuration %d", iDuration ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::Duration +// -------------------------------------------------------------------------- +// +TInt CUpnpRenderingPlaytimeCalculator::Duration() const + { + __LOG1("PlaytimeCalculator: iDuration %d", iDuration ); + return iDuration; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::AcknowledgePositionInfo +// -------------------------------------------------------------------------- +// +void CUpnpRenderingPlaytimeCalculator::AcknowledgePositionInfo( + TInt aDuration, TInt aPosition ) + { + __LOG3("PlaytimeCalculator::AcknowledgePositionInfo \ +aDuration %d aPosition %d, iPlaying %d ", + aDuration, aPosition, iPlaying ); + + // handle DURATION + if ( aDuration > 0 ) + { + if ( iDuration <= 0) + { + // we did not know duration before, set it + iDuration = aDuration; + } + else if ( aDuration > iDuration ) + { + // renderer thinks track is longer. trust longer value! + // too long is more safe than too short. + // TOO LONG -> playlist play may discontinue. (annoying) + // TOO SHORT -> pressing stop may cause track skip and + // user can't stop the music (critical) + iDuration = aDuration; + } + } + // handle POSITION + if ( iPlaying ) + { + // calculate playtime now, compare to given position + // and manipulate offset accordingly + iOffset = OffsetFromNow( aPosition ); + __LOG1("PlaytimeCalculator: New Offset %d", iOffset ); + } + else + { + // start timer and set position according to ongoing playback + Start(); + TTimeIntervalSeconds origPos = aPosition / KMillisecondsInSecond; + iStartMark -= origPos; + iOffset = OffsetFromNow( aPosition ); + } + + __LOG2("PlaytimeCalculator::AcknowledgePositionInfo \ +iDuration %d Current Position %d ", iDuration, Position() ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::Position +// -------------------------------------------------------------------------- +// +TInt CUpnpRenderingPlaytimeCalculator::Position() const + { + TTime tempTime; + if ( iPlaying ) + { + __LOG("PlaytimeCalculator: Position() - using current time" ); + // measure time until NOW. + tempTime.UniversalTime(); + } + else + { + // measure time until last track STOPPED. + tempTime = iStopMark; + } + return PositionAt( tempTime ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::IsTrackComplete +// -------------------------------------------------------------------------- +// +TBool CUpnpRenderingPlaytimeCalculator::IsTrackComplete() const + { + TBool isCompleted = ETrue; + TInt playtime = Position(); + if ( playtime >= 0 && + playtime < iDuration - KDurationErrorMargin ) + { + // [0 - duration-margin] + isCompleted= EFalse; + } + else if ( playtime >= iDuration - KDurationErrorMargin && + playtime <= iDuration + KDurationErrorMargin ) + { + // [duration-margin - duration+margin] + isCompleted= ETrue; + } + else + { + // position either negative or greater than duration ?? + __LOG2("PlaytimeCalculator: WARNING: playtime=%d duration=%d", + playtime, + iDuration ); + isCompleted= ETrue; + } + return isCompleted; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::IsPlaying +// -------------------------------------------------------------------------- +// +TBool CUpnpRenderingPlaytimeCalculator::IsPlaying() const + { + return iPlaying; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::RestartAt +// -------------------------------------------------------------------------- +// +void CUpnpRenderingPlaytimeCalculator::RestartAt( TInt aNewPosition ) + { + __LOG("PlaytimeCalculator: RestartAt()" ); + Stop(); + Start(); + // Consider new position to be equivalent to current position + TTimeIntervalSeconds newPos = + aNewPosition / KMillisecondsInSecond; + iStartMark -= newPos; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::PositionAt +// -------------------------------------------------------------------------- +// +TInt CUpnpRenderingPlaytimeCalculator::PositionAt( TTime& aMark ) const + { + TTimeIntervalMicroSeconds played = + aMark.MicroSecondsFrom( iStartMark ); + TInt playtime = ( played.Int64() / KMicrosecondsInMillisecond ); + __LOG1("PlaytimeCalculator: PositionAt played %d", playtime ); + + playtime -= iPauseTime; + playtime -= PausetimeAt( aMark ); + playtime += iOffset; + __LOG3("PlaytimeCalculator: playtime=%d pausetime=%d offset=%d", + playtime, + (iPauseTime + PausetimeAt( aMark )), + iOffset ); + return playtime; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::PausetimeAt +// -------------------------------------------------------------------------- +// +TInt CUpnpRenderingPlaytimeCalculator::PausetimeAt( TTime& aMark ) const + { + TInt pausetime = 0; + if ( iPaused ) + { + TTimeIntervalMicroSeconds latestPause = + aMark.MicroSecondsFrom( iPauseMark ); + pausetime = ( latestPause.Int64() / KMicrosecondsInMillisecond ); + __LOG1("PlaytimeCalculator: PausetimeAt pause time %d", pausetime ); + } + return pausetime; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingPlaytimeCalculator::OffsetFromNow +// -------------------------------------------------------------------------- +// +TInt CUpnpRenderingPlaytimeCalculator::OffsetFromNow( TInt aPosition ) const + { + TTime timeNow; + timeNow.UniversalTime(); + TInt tempPlaytime = PositionAt( timeNow ); + TInt o = aPosition - tempPlaytime; + __LOG2("PlaytimeCalculator: renderer position (%d), \ +tempPlaytime (%d)", aPosition, tempPlaytime ); + __LOG3("PlaytimeCalculator: old off(%d) current off(%d), \ +new offset(%d)", iOffset, o, iOffset+o); + return iOffset+o; + } + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/src/upnprenderingstatemachine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/src/upnprenderingstatemachine.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,1690 @@ +/* +* Copyright (c) 2007,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: Implementation of generic upnp remote rendering state machine +* +*/ + +// INCLUDES +// dlnasrv / mediaserver api +#include + +// dlnasrv / avcontroller api +#include "upnpavrenderingsession.h" +#include "upnpavdevice.h" +#include "upnpitemutility.h" +#include "upnpconstantdefs.h" +#include "upnprenderingstatemachineconstants.h" +#include "upnprenderingstatemachineobserver.h" + +// dlnasrv / component internal +#include "upnprenderingoperation.h" +#include "upnprenderingplaytimecalculator.h" +#include "upnpretraces.h" +#include "upnprenderingstatemachine.h" +#include "upnpavcontrollerglobals.h" + +_LIT( KComponentLogfile, "upnprenderingstatemachine.txt"); +#include "upnplog.h" + +// CONSTANTS +const TInt64 KMicrosecondsInMillisecond = 1000; +const TInt KSeekThresholdTime = 2000; //ms + +// ======== MEMBER FUNCTIONS ======== + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::NewL +// Static constructor. +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpRenderingStateMachine* CUpnpRenderingStateMachine::NewL( + MUPnPAVRenderingSession& aSession ) + { + CUpnpRenderingStateMachine* self = + new (ELeave) CUpnpRenderingStateMachine( aSession ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::CUpnpRenderingStateMachine +// default constructor +// -------------------------------------------------------------------------- +// +CUpnpRenderingStateMachine::CUpnpRenderingStateMachine( + MUPnPAVRenderingSession& aSession ) + : iSession( aSession ) + { + iState = Upnp::EOffSync; + iObserver = NULL; + iOptions = 0; + iSelector = 0; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ConstructL +// 2nd phase constructor +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::ConstructL() + { + __LOG( "RenderingStateMachine::ConstructL" ); + iPlaytimeCalculator = new(ELeave) CUpnpRenderingPlaytimeCalculator(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::~CUpnpRenderingStateMachine +// destructor +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpRenderingStateMachine::~CUpnpRenderingStateMachine() + { + __LOG( "RenderingStateMachine: ~CUpnpRenderingStateMachine" ); + delete iPlaytimeCalculator; + iQueue.Close(); + iObserver = NULL; + __LOG( "RenderingStateMachine: ~CUpnpRenderingStateMachine end" ); + } + + + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SetOptions +// sets the option flags for this state machine +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::SetOptions( TInt aOptions ) + { + iOptions = aOptions; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::Options +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpRenderingStateMachine::Options() const + { + return iOptions; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SetObserver +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::SetObserver( + MUpnpRenderingStateMachineObserver& aObserver ) + { + iObserver = &aObserver; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::RemoveObserver +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::RemoveObserver() + { + iObserver = NULL; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SetResourceSelector +// custom selection for resource inside item +// selects which resource is used in SetAvTransportUri +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::SetResourceSelector( + MUPnPResourceSelector& aSelector ) + { + __LOG( "RenderingStateMachine: SetResourceSelector" ); + iSelector = &aSelector; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SyncL +// synchronises the state machine with renderer +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::SyncL() + { + __LOG( "CUpnpRenderingStateMachine::SyncL" ); + __ASSERT( !IsInSync(), __FILE__, __LINE__ ); + __ASSERT( !IsBusy(), __FILE__, __LINE__ ); + if ( IsInSync() ) + { + User::Leave( KErrGeneral ); + } + if ( IsBusy() ) + { + User::Leave( KErrServerBusy ); + } + TUpnpRenderingOperation sync( + Upnp::ESync ); + PushAndExecuteL( sync ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SetOffSync +// sets this state machine off sync +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::SetOffSync() + { + __LOG( "CUpnpRenderingStateMachine::SetOffSync" ); + __ASSERT( !IsBusy(), __FILE__, __LINE__ ); + iState = Upnp::EOffSync; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::IsInSync +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpRenderingStateMachine::IsInSync() const + { + return (iState & Upnp::EStateMaskInSync) != 0; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::Command +// Issues a command to the renderer through the state machine +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::CommandL( + Upnp::TCommand aCommand, + TInt aCommandParameter, + const CUpnpItem* aMedia ) + { + __LOG1( "CUpnpRenderingStateMachine::CommandL cmd = %d",aCommand ); + TUpnpRenderingOperation cmd( + aCommand, aCommandParameter, aMedia ); + PushAndExecuteL( cmd ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::IsBusy +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpRenderingStateMachine::IsBusy() const + { + return !IsFree(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::State +// -------------------------------------------------------------------------- +// +EXPORT_C Upnp::TState CUpnpRenderingStateMachine::State() const + { + return iState; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::Duration +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpRenderingStateMachine::Duration() const + { + __LOG( "CUpnpRenderingStateMachine::Duration" ); + __ASSERT( iState & Upnp::EStateMaskActive, + __FILE__, __LINE__ ); + __ASSERT( iPlaytimeCalculator, __FILE__, __LINE__ ); + return iPlaytimeCalculator->Duration(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::Position +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpRenderingStateMachine::Position() const + { + __LOG( "CUpnpRenderingStateMachine::Position" ); + __ASSERT( iState & Upnp::EStateMaskActive, + __FILE__, __LINE__ ); + __ASSERT( iPlaytimeCalculator, __FILE__, __LINE__ ); + return iPlaytimeCalculator->Position(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::HasPauseCapability +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpRenderingStateMachine::HasPauseCapability() const + { + return iSession.Device().PauseCapability(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::InteractOperationComplete +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::InteractOperationComplete( + TInt aError, TUPnPAVInteractOperation aOperation ) + { + __LOG( "CUpnpRenderingStateMachine::InteractOperationComplete" ); + Process( + CUpnpRenderingStateMachine::EInteractOperationComplete, + aError, &aOperation ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::PositionInfoResult +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::PositionInfoResult( + TInt aError, const TDesC8& aPosition, const TDesC8& aLength ) + { + __LOG( "CUpnpRenderingStateMachine::PositionInfoResult" ); + Process( + CUpnpRenderingStateMachine::EPositionInfo, + aError, (TAny*)&aPosition, (TAny*)&aLength ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SetURIResult +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::SetURIResult( TInt aError ) + { + __LOG( "CUpnpRenderingStateMachine::SetURIResult" ); + Process( + CUpnpRenderingStateMachine::ESetUriResult, + aError ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SetNextURIResult +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRenderingStateMachine::SetNextURIResult( TInt /*aError*/ ) + { + __LOG( "CUpnpRenderingStateMachine::SetNextURIResult" ); + __PANIC( __FILE__, __LINE__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ReportSyncReady +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::ReportSyncReady( + TInt aError, Upnp::TState aNewState ) + { + __LOG3( "RenderingStateMachine: SyncReady err=%i %s->%s", + aError, StateName( iState ), StateName( aNewState ) ); + iState = aNewState; + if ( iObserver ) + { + iObserver->RendererSyncReady( aError, iState ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ReportStateChanged +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::ReportStateChanged( + TInt aError, Upnp::TState aNewState, + TBool aActionResponse, TInt aStateParam ) + { + __LOG3( "RenderingStateMachine: StateChanged err=%i %s->%s", + aError, StateName( iState ), StateName( aNewState ) ); + iState = aNewState; + if ( iObserver ) + { + iObserver->RenderingStateChanged( + aError, iState, aActionResponse, aStateParam ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ReportPositionSync +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::ReportPositionSync( TInt aError, + Upnp::TPositionMode aMode, + TInt aDuration, TInt aPosition ) + { + __LOG1( "RenderingStateMachine: PositionSync %i", aError ); + if ( iObserver ) + { + iObserver->PositionSync( aError, aMode, aDuration, aPosition ); + } + } + + + +/***************************************** + ** State machine states implementation ** + *****************************************/ + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG1( "RenderingStateMachine: ExecuteOperationL (operation=%d)", + aOperation.Command() ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + switch( aOperation.Command() ) + { + case Upnp::ESync: + { + ret = ExecuteOperationSyncL( aOperation, aCurrent ); + break; + } + case Upnp::EPlay: + { + ret = ExecuteOperationPlayL( aOperation, aCurrent ); + break; + } + case Upnp::EStop: + { + ret = ExecuteOperationStopL( aOperation, aCurrent ); + break; + } + case Upnp::EPause: + { + ret = ExecuteOperationPauseL( aOperation, aCurrent ); + break; + } + case Upnp::EResume: + { + ret = ExecuteOperationResumeL( aOperation, aCurrent ); + break; + } + case Upnp::ERestart: + { + ret = ExecuteOperationRestartL( aOperation, aCurrent ); + break; + } + case Upnp::ESeek: + { + ret = ExecuteOperationSeekL( aOperation, aCurrent ); + break; + } + case Upnp::ECalibrate: + { + ret = ExecuteOperationCalibrateL( aOperation, aCurrent ); + break; + } + case Upnp::ESetUri: + { + ret = ExecuteOperationSetUriL( aOperation, aCurrent ); + break; + } + default: + __PANIC( __FILE__, __LINE__ ); + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ProcessOperationL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ProcessOperationL( + const TUpnpRenderingOperation& aOperation, TInt aEvent, + TInt aError, const TAny* aParam1, const TAny* aParam2 ) + { + __LOG2( "RenderingStateMachine: ProcessOperationL (event=%d) (aError=%d)", + aEvent, aError ); + + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + switch( aEvent ) + { + case EInteractOperationComplete: + { + TUPnPAVInteractOperation op = + *(TUPnPAVInteractOperation*)aParam1; + if ( op == EUPnPAVPlay + || op == EUPnPAVPlayUser + || op == EUPnPAVStop + || op == EUPnPAVStopUser + || op == EUPnPAVPause + || op == EUPnPAVPauseUser + || op == EUPnPAVSeek ) + { + ret = ProcessAVEvents( aOperation, op, aError ); + } + else if ( op == EUPnPAVTransition ) + { + ret = EContinue; + __LOG1( "RenderingStateMachine: Transition %d", aError ); + } + else + { + __PANIC( __FILE__, __LINE__ ); + } + break; + } + case EPositionInfo: + { + const TDesC8& pos = *(const TDesC8*)aParam1; + const TDesC8& len = *(const TDesC8*)aParam2; + ret = ProcessPositionInfo( aOperation, aError, pos, len ); + break; + } + case ESetUriResult: + { + ret = ProcessSetURIResultL( aOperation, aError ); + break; + } + default: + { + __PANIC( __FILE__, __LINE__ ); + } + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::HandleAsyncError +// cancels the ongoing operation +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::HandleAsyncError( + const TUpnpRenderingOperation& aOperation, TInt aError ) + { + __LOG( "RenderingStateMachine: HandleAsyncError" ); + switch ( aOperation.Command() ) + { + case Upnp::ESync: + { + ReportSyncReady( aError, State() ); + break; + } + case Upnp::EPlay: + { + if ( aOperation.IsUserOriented() ) + { + ReportStateChanged( aError, + Upnp::EStopped, ETrue ); + } + break; + } + case Upnp::EStop: + { + if ( aOperation.IsUserOriented() ) + { + ReportStateChanged( aError, State(), ETrue ); + } + break; + } + case Upnp::EPause: + { + if ( aOperation.IsUserOriented() ) + { + ReportStateChanged( aError, State(), ETrue ); + } + break; + } + case Upnp::ECalibrate: + { + // do nothing + break; + } + case Upnp::ESeek: + { + TInt seekCode = Upnp::EPositionChanged; + ReportStateChanged( aError, + State(), ETrue, seekCode ); + break; + } + default: + // __PANICD( __FILE__, __LINE__ ); + break; + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationSyncL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationSyncL( + const TUpnpRenderingOperation& /*aOperation*/, + const TUpnpRenderingOperation& /*aCurrent*/ ) + { + __LOG( "RenderingStateMachine: ExecuteOperationSyncL" ); + // GetRendererState() method to be implemented in AVController + // 1. if renderer has already sent its first state event, it will be + // returned immediately. + // 2. if not (SUBSCRIBE just sent) there will be a small wait loop to + // wait for the initial event + // 3. if the initial even does not arrive + // 3.1 Request the state from the renderer (optional) + // 3.2 Assume it is in stopped state. (maybe enough) + + TUPnPAVInteractOperation op = iSession.GetRendererStateL(); + __LOG1( "RenderingStateMachine: ExecuteOperationSyncL \ +current op = %d" ,op ); + Upnp::TState state = Upnp::EPlaying; + if( op == EUPnPAVStopUser ) + { + state = Upnp::EStopped; + } + ReportSyncReady( KErrNone , state ); + return ECompleted; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationPlayL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationPlayL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG( "RenderingStateMachine: ExecuteOperationPlayL" ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if ( aCurrent == Upnp::EPlay ) + { + __LOG( "RenderingStateMachine: ExecuteOperationPlayL \ +aCurrent == Upnp::EPlay " ); + // Play request repeats. Compare content. + const CUpnpItem* item = static_cast( + aOperation.Data() ); + if ( ResourceFromL( *item ).Value() != iCurrentUri ) + { + ret = EQueue; + } + } + else if ( aCurrent != Upnp::ENone ) + { + __LOG( "RenderingStateMachine: ExecuteOperationPlayL \ +aCurrent == Upnp::ENone " ); + ret = EQueue; + } + else + { + switch( State() ) + { + case Upnp::EPaused: + { + __LOG( "RenderingStateMachine: ExecuteOperationPlayL \ +aCurrent == Upnp::EPaused " ); + + const CUpnpItem* item = + static_cast( aOperation.Data() ); + if ( item && ResourceFromL( *item ).Value() != iCurrentUri ) + { + // track changed during pause -> stop paused and start + // playing the new + TUpnpRenderingOperation stop( Upnp::EStop ); + stop.SetUserOriented( EFalse ); + PushL( stop ); + TUpnpRenderingOperation play( aOperation ); + PushL( play ); + } + else + { + iSession.PlayL(); + ret = EContinue; + } + break; + } + case Upnp::EPlaying: + case Upnp::EStopped: + { + __LOG( "RenderingStateMachine: ExecuteOperationPlayL aCurrent == Upnp::EStopped " ); + + // start play sequence + const CUpnpItem* item = static_cast( + aOperation.Data() ); + + __LOG1( "RenderingStateMachine: ExecuteOperationPlayL item 0x%x ", item ); + + if ( item ) + { + // improvements !!! + // check if user requests playing the same track that was + // previously playing. In that case we just call Play(). + // Much faster. + const TDesC8& httpuri = ResourceFromL( *item ).Value(); + + __LOG( "RenderingStateMachine: ExecuteOperationPlayL current:" ); + __LOG8( iCurrentUri ); + __LOG( "RenderingStateMachine: ExecuteOperationPlayL new:" ); + __LOG8( httpuri ); + if( iCurrentUri == httpuri ) + { + iSession.PlayL(); + } + else + { + SetUriL( aOperation ); + } + } + else + { + // uri not available + User::Leave( KErrArgument ); + } + ret = EContinue; + break; + } + case Upnp::EOffSync: + case Upnp::EBusy: + case Upnp::EDead: + case Upnp::EBuffering: + case Upnp::EStateMaskInSync: + case Upnp::EStateMaskActive: + case Upnp::EStateMaskRendering: + default: + { + User::Leave( KErrNotReady ); + } + } + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationSetUriL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationSetUriL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& /*aCurrent*/ ) + { + __LOG( "RenderingStateMachine: ExecuteOperationSetUriL" ); + + iStateBeforeSetUri = State(); + SetUriL( aOperation ); + + return EContinue; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::SetUriL +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::SetUriL( + const TUpnpRenderingOperation& aOperation ) + { + __LOG( "RenderingStateMachine: ExecuteOperationSetUriL" ); + + const CUpnpItem* item = static_cast( + aOperation.Data() ); + + __LOG1( "RenderingStateMachine: SetUriL item 0x%x ", item ); + + if ( item ) + { + const TDesC8& httpuri = ResourceFromL( *item ).Value(); + + __LOG( "RenderingStateMachine: SetUriL current:" ); + __LOG8( iCurrentUri ); + __LOG( "RenderingStateMachine: SetUriL new:" ); + __LOG8( httpuri ); + + __LOG( "RenderingStateMachine: SetUriL iSession.SetURIL" ); + + iSession.SetURIL( httpuri, *item ); + iCurrentUri.Copy( httpuri ); + ReportStateChanged( KErrNone, Upnp::EBuffering ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationStopL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationStopL( + const TUpnpRenderingOperation& /*aOperation*/, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG( "RenderingStateMachine: ExecuteOperationStopL" ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if ( aCurrent == Upnp::EStop ) + { + // already stopping, no need to stop twice + } + else if ( aCurrent != Upnp::ENone ) + { + ret = EQueue; + } + else + { + switch( State() ) + { + case Upnp::EPlaying: + case Upnp::EPaused: + { + iSession.StopL(); + ret = EContinue; + break; + } + case Upnp::EStopped: + { + ReportStateChanged( KErrNone, State() ); + break; + } + case Upnp::EOffSync: + case Upnp::EBusy: + case Upnp::EDead: + case Upnp::EBuffering: + case Upnp::EStateMaskInSync: + case Upnp::EStateMaskActive: + case Upnp::EStateMaskRendering: + default: + { + User::Leave( KErrNotReady ); + } + } + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationPauseL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationPauseL( + const TUpnpRenderingOperation& /*aOperation*/, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG( "RenderingStateMachine: ExecuteOperationPauseL" ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if ( aCurrent == Upnp::EPause ) + { + // pause during pause request + } + else if ( aCurrent != Upnp::ENone ) + { + ret = EQueue; + } + else + { + switch( State() ) + { + case Upnp::EPlaying: + { + iSession.PauseL(); + ret = EContinue; + break; + } + case Upnp::EPaused: + { + ReportStateChanged( KErrNone, State() ); + ret = ECompleted; + break; + } + case Upnp::EOffSync: + case Upnp::EBusy: + case Upnp::EDead: + case Upnp::EStopped: + case Upnp::EBuffering: + case Upnp::EStateMaskInSync: + case Upnp::EStateMaskActive: + case Upnp::EStateMaskRendering: + default: + { + User::Leave( KErrNotReady ); + } + } + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationResumeL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationResumeL( + const TUpnpRenderingOperation& /*aOperation*/, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG( "RenderingStateMachine: ExecuteOperationResumeL" ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if ( aCurrent == Upnp::EPlay ) + { + // resume during play + } + else if ( aCurrent != Upnp::ENone ) + { + ret = EQueue; + } + else + { + switch( State() ) + { + case Upnp::EPlaying: + { + ReportStateChanged( KErrNone, State() ); + break; + } + case Upnp::EPaused: + { + iSession.PlayL(); + ret = EContinue; + break; + } + case Upnp::EOffSync: + case Upnp::EBusy: + case Upnp::EDead: + case Upnp::EStopped: + case Upnp::EBuffering: + case Upnp::EStateMaskInSync: + case Upnp::EStateMaskActive: + case Upnp::EStateMaskRendering: + default: + { + User::Leave( KErrNotReady ); + } + } + + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationRestartL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationRestartL( + const TUpnpRenderingOperation& /*aOperation*/, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG( "RenderingStateMachine: ExecuteOperationRestartL" ); + // handle parallel + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if ( aCurrent != Upnp::ENone ) + { + ret = EQueue; + } + else + { + switch( State() ) + { + case Upnp::EPlaying: + { + TUpnpRenderingOperation stop( + Upnp::EStop ); + stop.SetUserOriented( EFalse ); + PushL( stop ); + TUpnpRenderingOperation play( + Upnp::EPlay ); + PushL( play ); + break; + } + case Upnp::EPaused: + { + TUpnpRenderingOperation stop( + Upnp::EStop ); + PushL( stop ); + break; + } + case Upnp::EOffSync: + case Upnp::EBusy: + case Upnp::EDead: + case Upnp::EStopped: + case Upnp::EBuffering: + case Upnp::EStateMaskInSync: + case Upnp::EStateMaskActive: + case Upnp::EStateMaskRendering: + default: + { + User::Leave( KErrNotReady ); + } + } + + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationSeekL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationSeekL( + const TUpnpRenderingOperation& aOperation, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG( "RenderingStateMachine: ExecuteOperationSeekL" ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + + TInt currentPosition = iPlaytimeCalculator->Position(); + TInt seekPosition = aOperation.Param(); + __LOG3( "RenderingStateMachine: state 0x%x, currentPosition %d, seekPosition %d", + State(), currentPosition, seekPosition ); + if( seekPosition < currentPosition + KSeekThresholdTime && + seekPosition > currentPosition - KSeekThresholdTime ) + { + // ignore seek + } + else if ( aCurrent != Upnp::ENone ) + { + ret = EQueue; + } + else if ( State() == Upnp::EStopped || + State() == Upnp::EPlaying ) + { + iSeekPostion = seekPosition; + TTime seekTime = (TInt64)iSeekPostion * KMicrosecondsInMillisecond; + iSession.SeekRelTimeL( seekTime ); + ret = EContinue; + } + else if( State() == Upnp::EPaused ) + { + TInt lastIndex( iQueue.Count() - 1 ); + TBool found(EFalse); + for( TInt i(lastIndex); i > 0; i-- ) + { + if( iQueue[i].Command() == Upnp::EPause ) + { + break; + } + else if( iQueue[i].Command() == Upnp::EPlay || + iQueue[i].Command() == Upnp::EResume ) + { + __LOG( "RenderingStateMachine: ExecuteOperationSeekL \ + play or resume found adding seek to queue" ); + TUpnpRenderingOperation seek( aOperation ); + PushL( seek ); + found = ETrue; + break; + } + } + /** + * if play or resume was not found it is + * illigal to execute seek in renderer + */ + if ( !found ) + { + User::Leave( KErrNotReady ); + } + } + else + { + User::Leave( KErrNotReady ); + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteOperationCalibrateL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ExecuteOperationCalibrateL( + const TUpnpRenderingOperation& /*aOperation*/, + const TUpnpRenderingOperation& aCurrent ) + { + __LOG( "RenderingStateMachine: ExecuteOperationCalibrateL" ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if ( aCurrent != Upnp::ENone ) + { + ret = EQueue; + } + else if ( State() == Upnp::EPlaying || + State() == Upnp::EPaused ) + { + iGetPositionStartMark.UniversalTime(); + iSession.GetPositionInfoL(); + ret = EContinue; + } + else + { + User::Leave( KErrNotReady ); + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ProcessEvents +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ProcessAVEvents( + const TUpnpRenderingOperation& aOperation, + const TUPnPAVInteractOperation aIntOp, + TInt aError ) + { + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if( !aError ) + { + switch( aIntOp ) + { + case EUPnPAVPlay: + { + if ( State() == Upnp::EPaused ) + { + iPlaytimeCalculator->Resume(); + } + else if ( !iPlaytimeCalculator->IsPlaying() ) + { + iPlaytimeCalculator->Start(); + } + ReportStateChanged( aError, + Upnp::EPlaying ); + break; + } + case EUPnPAVPlayUser: + { + // spontaneous state change to playing + if ( State() == Upnp::EStopped ) + { + iPlaytimeCalculator->Start(); + } + else if ( State() == Upnp::EPaused ) + { + iPlaytimeCalculator->Resume(); + } + ReportStateChanged( aError, + Upnp::EPlaying, EFalse ); + ret = EContinue; + break; + } + case EUPnPAVStop: + { + iPlaytimeCalculator->Stop(); + ReportStateChanged( aError, + Upnp::EStopped , ETrue ); + break; + } + case EUPnPAVStopUser: + { + // spontaneous state change to stopped + iPlaytimeCalculator->Stop(); + TInt stopcode = Upnp::ENoMedia; + if( iPlaytimeCalculator->Duration() != KErrNotFound ) + { + stopcode = ( iPlaytimeCalculator->IsTrackComplete() ? + Upnp::ETrackCompleted : + Upnp::EStopRequested ); + } + ReportStateChanged( aError, + Upnp::EStopped, EFalse, stopcode ); + ret = EContinue; + break; + } + case EUPnPAVPause: + { + iPlaytimeCalculator->Pause(); + ReportStateChanged( aError, + Upnp::EPaused ); + break; + } + case EUPnPAVPauseUser: + { + // spontaneous state change to paused + iPlaytimeCalculator->Pause(); + ReportStateChanged( aError, + Upnp::EPaused, EFalse ); + ret = EContinue; + break; + } + case EUPnPAVSeek: + { + iPlaytimeCalculator->RestartAt( iSeekPostion ); + TInt seekCode = Upnp::EPositionChanged; + ReportStateChanged( aError, + State(), ETrue, seekCode ); + break; + } + default: + { + __LOG2( "RenderingStateMachine: aIntOp = %d event during %s", + aIntOp , CommandName(aOperation.Command()) ); + break; + } + } + } + else + { + ReportStateChanged( aError, + State() ); + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ProcessPositionInfo +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ProcessPositionInfo( + const TUpnpRenderingOperation& aOperation, + TInt aError, const TDesC8& aPosition, const TDesC8& aLength ) + { + __LOG( "RenderingStateMachine: ProcessPositionInfo" ); + __ASSERT( aOperation == Upnp::ECalibrate, + __FILE__, __LINE__ ); + + TInt duration = 0; + TInt position = 0; + if ( aError == KErrNone ) + { + aError = UPnPItemUtility::UPnPDurationAsMilliseconds( + aLength, duration ); + } + if ( aError == KErrNone ) + { + aError = UPnPItemUtility::UPnPDurationAsMilliseconds( + aPosition, position ); + } + if ( aError == KErrNone ) + { + //Incorporate the delay in receiving the response. + TTime posStopMark; posStopMark.UniversalTime(); + TTimeIntervalMicroSeconds delay = + posStopMark.MicroSecondsFrom( iGetPositionStartMark ); + TInt delayInMSec = ( delay.Int64() / KMicrosecondsInMillisecond ); + position += (delayInMSec/2); + if ( position > duration ) + { + position = duration; + } + __LOG2( "RenderingStateMachine: ProcessPositionInfo added delay(%d) \ +position(%d)", delayInMSec/2, position); + iPlaytimeCalculator->AcknowledgePositionInfo( + duration, position ); + } + // response + // trick states + ReportPositionSync( aError, + Upnp::EPlayingNormally, + iPlaytimeCalculator->Duration(), + iPlaytimeCalculator->Position() ); + return ECompleted; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ProcessSetURIResultL +// -------------------------------------------------------------------------- +// +MUpnpRenderingOperationExecutor::TResult +CUpnpRenderingStateMachine::ProcessSetURIResultL( + const TUpnpRenderingOperation& aOperation, + TInt aError ) + { + __LOG( "RenderingStateMachine: ProcessSetURIResultL" ); + TBool validOp( aOperation == Upnp::EPlay || aOperation == Upnp::ESetUri ); + __ASSERT( validOp, __FILE__, __LINE__ ); + MUpnpRenderingOperationExecutor::TResult ret(ECompleted); + if ( aError == KErrNone ) + { + // get duration from item and write to playtime calculator + const CUpnpItem* item = static_cast( + aOperation.Data() ); + const CUpnpAttribute* attr = + UPnPItemUtility::FindAttributeByName( + ResourceFromL( *item ), KAttributeDuration ); + if ( attr ) + { + TInt ms = 0; + if ( UPnPItemUtility::UPnPDurationAsMilliseconds( + attr->Value(), ms ) == KErrNone ) + { + iPlaytimeCalculator->SetDuration( ms ); + } + } + if( aOperation.Command() == Upnp::EPlay ) + { + iSession.PlayL(); + ret = EContinue; + } + else + { + ReportStateChanged( KErrNone, Upnp::EBuffering, EFalse, ETrue ); + iState = iStateBeforeSetUri; + ret = ECompleted; + } + } + //if seturi failed send first stop in that case! + else if( aError == KErrAccessDenied || aError == KErrLocked ) + { + iCurrentUri.Zero(); + iQueue.Remove( 0 ); // removes play from queue + TUpnpRenderingOperation stop( Upnp::EStop ); + stop.SetUserOriented( EFalse ); + PushL( stop ); // add stop + iSession.StopL(); + ret = EContinue; // continue = waits for operation to complete + TUpnpRenderingOperation play( aOperation ); + PushL( play ); + } + else + { + HandleAsyncError( aOperation, aError ); + } + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ResourceFrom +// -------------------------------------------------------------------------- +// +const CUpnpElement& CUpnpRenderingStateMachine::ResourceFromL( + const CUpnpItem& aItem ) + { + const CUpnpElement* element( NULL ); + if ( iSelector ) + { + element = &iSelector->SelectResourceL( aItem ); + } + else + { + element = &iDefaultSelector.SelectResourceL( aItem ); + } + return *element; + } + + +/************************** + ** Queue implementation ** + **************************/ + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::Size +// -------------------------------------------------------------------------- +// +TInt CUpnpRenderingStateMachine::Size() const + { + __LOG1( "CUpnpRenderingStateMachine::Size(%d)", iQueue.Count() ); + return iQueue.Count(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::IsFree +// Checks if the queue is free for new operations +// -------------------------------------------------------------------------- +// +TBool CUpnpRenderingStateMachine::IsFree() const + { + return Size() == 0; + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::PushL +// push operation to queue. Don't try to execute it yet. +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::PushL( + const TUpnpRenderingOperation& aOperation ) + { + __LOG( "CUpnpRenderingStateMachine::PushL" ); + iQueue.AppendL( aOperation ); + CompressQueueL(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::PushAndExecuteL +// push operation to queue and execute it immediately +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::PushAndExecuteL( + const TUpnpRenderingOperation& aOperation ) + { + __LOG( "CUpnpRenderingStateMachine::PushAndExecuteL" ); + if ( IsFree() ) + { + PushL( aOperation ); + ExecuteRecursivelyL(); + } + else + { + ExecuteParallelL( aOperation ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingAlgorithms::Execute +// Runs an operation in queue +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::Execute() + { + __LOG( "CUpnpRenderingStateMachine::Execute" ); + TUpnpRenderingOperation op = Current(); + if ( op.IsValid() ) + { + __LOG1( "OperationQueue: Executing %s", + CommandName(op.Command()) ); + MUpnpRenderingOperationExecutor::TResult result = ECompleted; + TRAPD( leave, result = ExecuteOperationL( op, + Upnp::ENone ) ); + __LOG1( "OperationQueue: leave code(%d) ", leave ); + + if ( leave != KErrNone ) + { + __LOG1( "OperationQueue: %s failed while executing", + CommandName(op.Command()) ); + iQueue.Reset(); + HandleAsyncError( op, leave ); + } + else if ( result == ECompleted ) + { + __LOG1( "OperationQueue: %s completed while executing", + CommandName(op.Command()) ); + if( iQueue.Count() > 0 ) + { + iQueue.Remove( 0 ); + Execute(); // recur + } + } + else if ( result == EContinue ) + { + // operation continues + } + else + { + // illegal answer + __PANIC( __FILE__, __LINE__ ); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::Process +// Abstract process of an operation +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::Process( + TInt aEvent, + TInt aError, const TAny* aParam1, const TAny* aParam2 ) + { + __LOG( "CUpnpRenderingStateMachine::Process" ); + TUpnpRenderingOperation op = Current(); + MUpnpRenderingOperationExecutor::TResult result = ECompleted; + __LOG2( "OperationQueue: Processing %s with event %d", + CommandName(op.Command()), aEvent ); + __LOG( "CUpnpRenderingStateMachine::Process - call ProcessOperationL" ); + TRAPD( leave, + result = ProcessOperationL( op, aEvent, + aError, aParam1, aParam2 ) ); + if ( leave != KErrNone ) + { + __LOG1( "OperationQueue: %s failed while processing", + CommandName(op.Command()) ); + iQueue.Reset(); + HandleAsyncError( op, leave ); + } + else if ( result == ECompleted ) + { + __LOG2( + "OperationQueue: %s completed while processing iQueue count = %d" + ,CommandName(op.Command()) , iQueue.Count() ); + if( iQueue.Count() > 0 ) + { + iQueue.Remove( 0 ); + Execute(); // pop new + } + } + else if ( result == EContinue ) + { + // operation continues + } + else + { + // illegal answer + __PANIC( __FILE__, __LINE__ ); + } + } + +void CUpnpRenderingStateMachine::CompressQueueL() + { + TInt queueCount( iQueue.Count() ); + + if( queueCount > 1 ) + { + TInt lastIndex( queueCount - 1 ); + + switch( iQueue[lastIndex].Command() ) + { + case Upnp::EStop: + { + /* + + TODO : check how to do later!! + + TInt removeStartIndex( 0 ); + + if( iQueue[0] == Upnp::EStop ) + { + // remove all except current ongoing stop command + removeStartIndex = lastIndex ; + } + else + { + // remove all except current ongoing command and last stop + // command + removeStartIndex = lastIndex - 1; + } + + for( TInt i = removeStartIndex; i > 0; i-- ) + { + __LOG2( "OperationQueue: Removing %s from queue index %d", + CommandName( iQueue[i].Command() ), i ); + iQueue.Remove( i ); + } */ + + break; + } + case Upnp::EPlay: + { + /* + + TODO : check how to do later!! + + TInt removeStartIndex( 0 ); + + const CUpnpItem* item = static_cast( + iQueue[lastIndex].Data() ); + + if( iQueue[0] == Upnp::EPlay && + item && + ResourceFromL( *item ).Value() == iCurrentUri ) + { + // remove all except current ongoing play command + removeStartIndex = lastIndex; + } + else + { + // remove all except current ongoing command and + // (last stop and) play command + if( queueCount > 2 && + iQueue[lastIndex - 1] == Upnp::EStop ) + { + // stop found before last play command + removeStartIndex = lastIndex - 2; + } + else + { + removeStartIndex = lastIndex - 1; + } + } + + for( TInt i = removeStartIndex; i > 0; i-- ) + { + __LOG2( "OperationQueue: Removing %s from queue index %d", + CommandName( iQueue[i].Command() ), i ); + iQueue.Remove( i ); + } + */ + break; + } + case Upnp::ECalibrate: + { + RemoveAllDublicateCommands( iQueue[lastIndex].Command() ); + break; + } + case Upnp::ERestart: + case Upnp::EPause: + case Upnp::ESeek: + case Upnp::EResume: + case Upnp::ENone: + case Upnp::ESync: + case Upnp::EClose: + case Upnp::ENext: + case Upnp::EPrev: + case Upnp::EBack: + case Upnp::EJump: + default: + { + //not implemented -> do nothing + break; + } + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::RemoveAllDublicateCommands +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::RemoveAllDublicateCommands( +Upnp::TCommand aCommand ) + { + __LOG1( "CUpnpRenderingStateMachine::RemoveAllDublicateCommands \ + command = %d" , aCommand ); + TInt lastIndex( iQueue.Count() - 1 ); + + for( TInt i(lastIndex-1); i > 0; i-- ) + { + if( iQueue[i].Command() == aCommand ) + { + __LOG1( "CUpnpRenderingStateMachine::RemoveAllDublicateCommands \ + found dublicate command index = %d",i); + // remove dublicate command + iQueue.Remove( i ); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::Current +// -------------------------------------------------------------------------- +// +TUpnpRenderingOperation CUpnpRenderingStateMachine::Current() const + { + __LOG( "CUpnpRenderingStateMachine::Current" ); + return ( iQueue.Count() > 0 ) ? iQueue[0] : Upnp::ENone; + } + +// -------------------------------------------------------------------------- +// ResetArray +// -------------------------------------------------------------------------- +// +void ResetArray( TAny* iParam ) + { + __LOG( "CUpnpRenderingStateMachine::ResetArray" ); + RArray* array = + static_cast< RArray* >( iParam ); + array->Reset(); + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteRecursivelyL +// Runs an operation first in the queue. If during the operation there +// were more operations added to queue, continues running recursively. +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::ExecuteRecursivelyL() + { + __LOG( "CUpnpRenderingStateMachine::ExecuteRecursivelyL" ); + TUpnpRenderingOperation op = Current(); + if ( op.IsValid() ) + { + __LOG1( "OperationQueue: Executing %s", + CommandName(op.Command()) ); + // if the operation fails, OperationArrayClose method will + // clean up the entire operations queue ! + CleanupStack::PushL( TCleanupItem( + ResetArray, &iQueue ) ); + MUpnpRenderingOperationExecutor::TResult result = + ExecuteOperationL( op, + Upnp::ENone ); + CleanupStack::Pop(); + switch( result ) + { + case ECompleted: + { + __LOG1( "OperationQueue: %s completed while executing", + CommandName(op.Command()) ); + if( iQueue.Count() > 0 ) + { + iQueue.Remove( 0 ); + ExecuteRecursivelyL(); // recur + } + break; + } + case EContinue: + { + // operation continues + break; + } + case EQueue: + default: + { + // illegal answer + __PANIC( __FILE__, __LINE__ ); + } + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpRenderingStateMachine::ExecuteParallelL +// Runs an operation that was requested to put to queue. Checks if it +// completes right away or if it should wait for its turn to run. +// -------------------------------------------------------------------------- +// +void CUpnpRenderingStateMachine::ExecuteParallelL( + const TUpnpRenderingOperation& aOperation ) + { + __LOG( "CUpnpRenderingStateMachine::ExecuteParallelL" ); + TUpnpRenderingOperation current = Current(); + __LOG1( "OperationQueue: Executing %s", + CommandName(aOperation.Command()) ); + MUpnpRenderingOperationExecutor::TResult result = + ExecuteOperationL( aOperation, current ); + switch( result ) + { + case ECompleted: + { + __LOG1( "OperationQueue: %s completed while executing", + CommandName(aOperation.Command()) ); + break; + } + case EQueue: + { + PushL( aOperation ); + __LOG1( "OperationQueue: %s added to queue", + CommandName(aOperation.Command()) ); + break; + } + case EContinue: + default: + { + // illegal answer + __PANIC( __FILE__, __LINE__ ); + } + } + } + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/src/upnpretraces.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/src/upnpretraces.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007,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: Implementation of upnprenderingstatemachine trace helper functions +* +*/ + +// INCLUDES +#include +#include "upnpavrenderingsessionobserver.h" // TUPnPAVInteractOperation +#include "upnprenderingstatemachineconstants.h" +#include "upnpretraces.h" + +// CONSTANTS + + +// ======== MEMBER FUNCTIONS ======== + +const TUint16* StateName( TInt aState ) + { + switch ( aState ) + { + case Upnp::EOffSync: return (TUint16*)L"OffSync"; + case Upnp::EBusy: return (TUint16*)L"Busy"; + case Upnp::EStopped: return (TUint16*)L"Stopped"; + case Upnp::EPlaying: return (TUint16*)L"Playing"; + case Upnp::EPaused: return (TUint16*)L"Paused"; + case Upnp::EDead: return (TUint16*)L"Dead"; + case Upnp::EBuffering: return (TUint16*)L"Buffering"; + default: return (TUint16*)L"State?"; + } + } + +const TUint16* CommandName( TInt aCommand ) + { + switch ( aCommand ) + { + case Upnp::ENone: return (TUint16*)L"None"; + case Upnp::ESync: return (TUint16*)L"Sync"; + case Upnp::EPlay: return (TUint16*)L"Play"; + case Upnp::EStop: return (TUint16*)L"Stop"; + case Upnp::EClose: return (TUint16*)L"Close"; + case Upnp::EPause: return (TUint16*)L"Pause"; + case Upnp::EResume: return (TUint16*)L"Resume"; + case Upnp::ERestart: return (TUint16*)L"Restart"; + case Upnp::ECalibrate: return (TUint16*)L"Calibrate"; + case Upnp::ESeek: return (TUint16*)L"Seek"; + case Upnp::ENext: return (TUint16*)L"Next"; + case Upnp::EPrev: return (TUint16*)L"Prev"; + case Upnp::EBack: return (TUint16*)L"Back"; + case Upnp::EJump: return (TUint16*)L"Jump"; + case Upnp::ESetUri: return (TUint16*)L"SetUri"; + default: return (TUint16*)L"Cmd?"; + } + } + +const TUint16* PropertyName( TInt aProperty ) + { + switch ( aProperty ) + { + case Upnp::EVolume: return (TUint16*)L"Volume"; + case Upnp::EMute: return (TUint16*)L"Mute"; + case Upnp::EMediaDuration:return (TUint16*)L"MediaDuration"; + case Upnp::EPosition: return (TUint16*)L"Position"; + case Upnp::EOptions: return (TUint16*)L"Options"; + case Upnp::ECurrentIndex: return (TUint16*)L"CurrentIndex"; + case Upnp::ECurrentState: return (TUint16*)L"CurrentState"; + default: return (TUint16*)L"Property?"; + } + } + +const TUint16* InteractOperationName( TInt aInteractOperation ) + { + switch ( aInteractOperation ) + { + case EUPnPAVPlay: return (TUint16*)L"UPnPAVPlay"; + case EUPnPAVPause: return (TUint16*)L"UPnPAVPause"; + case EUPnPAVStop: return (TUint16*)L"UPnPAVStop"; + case EUPnPAVPlayUser: return (TUint16*)L"UPnPAVPlayUser"; + case EUPnPAVPauseUser: return (TUint16*)L"UPnPAVPauseUser"; + case EUPnPAVStopUser: return (TUint16*)L"UPnPAVStopUser"; + default: return (TUint16*)L"InteractOperation?"; + } + } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnprenderingstatemachine/src/upnpvolumestatemachine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnprenderingstatemachine/src/upnpvolumestatemachine.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,835 @@ +/* +* Copyright (c) 2007,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: Implementation of generic upnp volume state machine +* +*/ + + +// INCLUDES +// avcontroller api +#include +#include // for device.VolumeCapability() +// volume state machine +#include "upnprenderingstatemachineconstants.h" // option flags +#include "upnpvolumestatemachineobserver.h" +#include "upnpvolumestatemachine.h" + +_LIT( KComponentLogfile, "upnprenderingengine.txt"); +#include "upnplog.h" + +// CONSTANTS +const TInt KCancelTimeMaximum = 3000000; +const TInt KCancelTimeResolution = 500000; + +// ======== MEMBER FUNCTIONS ======== + + +TUpnpVSMQueueItem::TUpnpVSMQueueItem( + const TUpnpVSMQueueItem::TPropertyType aProperty, const TInt aValue ) + : iProperty( aProperty ) + , iValue( aValue ) + { + } + +TUpnpVSMQueueItem::TPropertyType TUpnpVSMQueueItem::Property() const + { + return iProperty; + } + +TInt TUpnpVSMQueueItem::Value() const + { + return iValue; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::NewL +// Static constructor. +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpVolumeStateMachine* CUpnpVolumeStateMachine::NewL( + MUPnPAVRenderingSession& aSession ) + { + CUpnpVolumeStateMachine* self = + new (ELeave) CUpnpVolumeStateMachine( aSession ); + // no 2nd phase construction needed + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::CUpnpVolumeStateMachine +// Default constructor. +// -------------------------------------------------------------------------- +// +CUpnpVolumeStateMachine::CUpnpVolumeStateMachine( + MUPnPAVRenderingSession& aSession ) + : iSession( aSession ) + { + __LOG( "VolumeStateMachine: constructor" ); + iVolumeCapability = iSession.Device().VolumeCapability(); + iMuteCapability = iSession.Device().MuteCapability(); + iState = EOffSync; + iCurrentVolume = KErrNotFound; + iVolumeToSetAfterMute = KErrNotFound; + iCurrentMute = KErrNotFound; + iMuteRequestedByClient = EFalse; + iCachedVolume = KErrNotFound; + iCachedMute = KErrNotFound; + } + + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::~CUpnpVolumeStateMachine +// Destructor. +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpVolumeStateMachine::~CUpnpVolumeStateMachine() + { + __LOG( "VolumeStateMachine: destructor" ); + } + + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::SetOptions +// sets the option flags for this state machine +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::SetOptions( TInt aOptions ) + { + iOptions = aOptions; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::Options +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpVolumeStateMachine::Options() const + { + return iOptions; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::SetObserver +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::SetObserver( + MUpnpVolumeStateMachineObserver& aObserver ) + { + iObserver = &aObserver; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::RemoveObserver +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::RemoveObserver() + { + iObserver = NULL; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::SyncL +// Synchronises this state machine with the renderer +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::SyncL() + { + __LOG( "VolumeStateMachine: SyncL" ); + + if ( iState != EOffSync && iState != EIdle ) + { + __LOG( "VolumeStateMachine: not synchronizing" ); + return; + } + + if ( !iVolumeCapability ) + { + User::Leave( KErrNotSupported ); + } + + iSession.GetVolumeL(); + iState = ESyncing; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::SetOffSync +// Forces the state machine off sync +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::SetOffSync() + { + __ASSERTD( !IsBusy(), __FILE__, __LINE__ ); + iState = EOffSync; + iCurrentVolume = KErrNotFound; + iVolumeToSetAfterMute = KErrNotFound; + iCurrentMute = KErrNotFound; + iMuteRequestedByClient = EFalse; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::IsInSync +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpVolumeStateMachine::IsInSync() const + { + return iState != EOffSync; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::SetVolumeL +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::SetVolumeL( TInt aVolume ) + { + __LOG1( "VolumeStateMachine: SetVolumeL %d", aVolume ); + __ASSERTD( IsInSync(), __FILE__, __LINE__ ); + if ( !iVolumeCapability ) + { + User::Leave( KErrNotSupported ); + } + + if ( IsBusy() ) + { + PushIntoQueueL( TUpnpVSMQueueItem::EVolume, aVolume ); + return; + } + + // check volume is between given limits + aVolume = Max( aVolume, KVolumeMin ); + aVolume = Min( aVolume, KVolumeMax ); + + if ( aVolume == KVolumeMin && iCurrentVolume > 0 && + iMuteCapability && iCurrentMute == KMuteOff && + iOptions & Upnp::EConvertVolumeZeroToMute ) + { + // adjust volume to zero (using mute) + iSession.SetMuteL( ETrue ); + iState = EAdjustingVolumeToZero; + } + else if ( aVolume == KVolumeMin && iCurrentMute == KMuteOn ) + { + // no need to change volume. Call back directly. + if ( iObserver ) + { + iObserver->VolumeChanged( + KErrNone, iCurrentVolume, ETrue ); + } + } + else if ( aVolume > KVolumeMin && iCurrentMute == KMuteOn && + !iMuteRequestedByClient ) + { + // volume is at zero, and renderer is muted. + // unmute and after that change volume if needed + iVolumeToSetAfterMute = aVolume; + iSession.SetMuteL( EFalse ); + iState = EAdjustingVolumeFromZero; + } + else if ( aVolume != iCurrentVolume ) + { + // adjust volume normally + iSession.SetVolumeL( aVolume ); + iState = EAdjustingVolume; + } + else + { + // no need to change volume. Call back directly. + if ( iObserver ) + { + iObserver->VolumeChanged( + KErrNone, iCurrentVolume, ETrue ); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::Volume +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpVolumeStateMachine::Volume() const + { + __ASSERTD( IsInSync(), __FILE__, __LINE__ ); + TInt vol = iCurrentVolume; + if ( iCurrentMute && (iOptions & Upnp::EConvertVolumeZeroToMute) ) + { + vol = KVolumeMin; + } + return vol; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::SetMuteL +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::SetMuteL( TBool aMuteState ) + { + __LOG1( "VolumeStateMachine: SetMuteL", aMuteState ); + __ASSERTD( IsInSync(), __FILE__, __LINE__ ); + if ( !iMuteCapability ) + { + // Could implement here FAKE MUTE SUPPORT by converting mute + // to Volume(0). However there is no need to that since no clients + // use the mute feature. + User::Leave( KErrNotSupported ); + } + if ( IsBusy() ) + { + PushIntoQueueL( TUpnpVSMQueueItem::EMute, aMuteState ); + return; + } + + // check mute state is between given limits + aMuteState = Max( aMuteState, KMuteOff ); + aMuteState = Min( aMuteState, KMuteOn ); + + if ( aMuteState && !iCurrentMute ) + { + // mute + iSession.SetMuteL( ETrue ); + iState = EAdjustingMute; + } + else if ( !aMuteState && iCurrentMute ) + { + // unmute + iSession.SetMuteL( EFalse ); + iState = EAdjustingMute; + } + else + { + // no change in mute state. Call back directly. + if ( iObserver ) + { + iObserver->MuteChanged( + KErrNone, iCurrentMute, ETrue ); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::Mute +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpVolumeStateMachine::Mute() const + { + __ASSERTD( IsInSync(), __FILE__, __LINE__ ); + return ( (iCurrentMute == KMuteOn) ? KMuteOn : KMuteOff ); + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::IsBusy +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpVolumeStateMachine::IsBusy() const + { + return iState != EIdle; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::HasVolumeCapability +// tests if renderer has volume capability +// -------------------------------------------------------------------------- +// +EXPORT_C TBool CUpnpVolumeStateMachine::HasVolumeCapability() const + { + return iVolumeCapability; + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::Cancel +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::Cancel() + { + // actually we can not cancel anything, but providing the interface for + // future purposes + if ( iState != EIdle ) + { + __LOG1( "VolumeStateMachine: Canceling in state %d", iState ); + iState = ECancelled; + for ( TInt t = KCancelTimeMaximum; + t > 0 && iState != EIdle; + t -= KCancelTimeResolution ) + { + User::After( TTimeIntervalMicroSeconds32( + KCancelTimeResolution ) ); + } + __LOG1( "VolumeStateMachine: state after cancel: %d", iState ); + } + } + +void CUpnpVolumeStateMachine::HandleVolumeResultInSyncState( + TInt aError, TInt aVolumeLevel, TBool /*aActionResponse*/ ) + { + if ( aError == KErrNone ) + { + iCurrentVolume = aVolumeLevel; + if ( iMuteCapability ) + { + // continue to sync mute + TRAPD( muteError, iSession.GetMuteL() ); + if ( muteError != KErrNone ) + { + // error syncing mute - callback + iState = EIdle; + if ( iObserver ) + { + iObserver->VolumeSyncReady( muteError ); + } + } + } + else + { + // mute not needed - callback + iCurrentMute = KMuteOff; // assume always off + iState = EIdle; + // notify sync initially and volume if changed + if ( iObserver && iCachedVolume == KErrNotFound ) + { + iObserver->VolumeSyncReady( KErrNone ); + } + else if ( iObserver && iCachedVolume != iCurrentVolume ) + { + iObserver->VolumeChanged( + aError, iCurrentVolume, EFalse ); + } + } + } + else + { + // error callback + iState = EIdle; + if ( iObserver ) + { + iObserver->VolumeSyncReady( aError ); + } + } + + } + + + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::VolumeResult +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::VolumeResult( + TInt aError, TInt aVolumeLevel, TBool aActionResponse ) + { + __LOG3( "VolumeStateMachine: VolumeResult %d, %d state=%d", + aError, aVolumeLevel, iState ); + + // + // RESPONSE TO A REQUEST + // + if ( aActionResponse ) + { + // + // SYNC + // + if( iState == ESyncing ) + { + HandleVolumeResultInSyncState(aError, aVolumeLevel, aActionResponse); + } + // + // VOLUME ADJUST + // + else if ( iState == EAdjustingVolume || + iState == EAdjustingVolumeFromZero ) + { + if ( aError == KErrNone ) + { + iCurrentVolume = aVolumeLevel; + } + iState = EIdle; + // volume adjust done, call back + if ( iObserver ) + { + iObserver->VolumeChanged( + aError, iCurrentVolume, ETrue ); + } + } + // + // CANCEL + // + else if( iState == ECancelled ) + { + iState = EIdle; + } + } + + // + // UNSOLICTED VOLUME EVENT + // + else + { + if ( iState == EIdle ) + { + if ( aVolumeLevel != iCurrentVolume ) + { + if ( iCurrentMute == KMuteOn ) + { + __LOG("unsolicted volume event during muted"); + } + iCurrentVolume = aVolumeLevel; + if ( iObserver ) + { + iObserver->VolumeChanged( + KErrNone, iCurrentVolume, EFalse ); + } + } + } + else + { + __LOG("ignoring unsolicted volume event in this state"); + } + } + + iCachedVolume = iCurrentVolume; + ProcessNextQueuedProperty(); + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::MuteResult +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::MuteResult( + TInt aError, TBool aMute, TBool aActionResponse ) + { + __LOG3( "VolumeStateMachine: MuteResult %d, %d, %d", + aError, aMute, aActionResponse ); + __LOG1( "VolumeStateMachine: MuteResult in state=%d", iState ); + + // + // RESPONSE TO A REQUEST + // + if( aActionResponse ) + { + // + // SYNC + // + if ( iState == ESyncing ) + { + if ( aError == KErrNone ) + { + iCurrentMute = aMute; + iMuteRequestedByClient = EFalse; + } + iState = EIdle; + // notify sync initially and volume and mute if changed + if ( iObserver && iCachedMute == KErrNotFound ) + { + iObserver->VolumeSyncReady( aError ); + } + else if ( iObserver ) + { + if( iCachedVolume != iCurrentVolume ) + { + iObserver->VolumeChanged( + aError, iCurrentVolume, EFalse ); + } + if( iCachedMute != iCurrentMute ) + { + iObserver->MuteChanged( + aError, iCurrentMute, EFalse ); + } + } + } + // + // MUTE ADJUST + // + if ( iState == EAdjustingMute ) + { + if ( aError == KErrNone ) + { + iCurrentMute = aMute; + iMuteRequestedByClient = aMute; + } + iState = EIdle; + if ( iObserver ) + { + iObserver->MuteChanged( + aError, iCurrentMute, ETrue ); + } + } + // + // VOLUME ADJUST -> 0 + // + if ( iState == EAdjustingVolumeToZero ) + { + if ( aError == KErrNone ) + { + iCurrentMute = aMute; + iMuteRequestedByClient = EFalse; + } + iState = EIdle; + if ( iObserver ) + { + iObserver->VolumeChanged( + aError, KVolumeMin, ETrue ); + } + } + // + // VOLUME ADJUST 0 -> up + // + if ( iState == EAdjustingVolumeFromZero ) + { + if ( aError == KErrNone ) + { + iCurrentMute = aMute; + iMuteRequestedByClient = EFalse; + TRAP( aError, iSession.SetVolumeL( + iVolumeToSetAfterMute ) ); + } + if ( aError != KErrNone ) + { + // error callback + iVolumeToSetAfterMute = KErrNotFound; + iState = EIdle; + if ( iObserver ) + { + iObserver->VolumeChanged( + aError, iCurrentVolume, ETrue ); + } + } + } + // + // CANCEL + // + else if( iState == ECancelled ) + { + iState = EIdle; + } + } + + // + // UNSOLICITED MUTE EVENT + // + else + { + HandleUnsolicitedMuteEvent(aError, aMute, aActionResponse ); + } + + iCachedMute = iCurrentMute; + ProcessNextQueuedProperty(); + } + +void CUpnpVolumeStateMachine::HandleUnsolicitedMuteEvent( + TInt aError, TBool aMute, TBool aActionResponse ) + { + if ( iState == EIdle ) + { + HandleUnsolicitedMuteEventInIdle(aError, aMute, aActionResponse); + } + else + { + __LOG("ignoring unsolicted mute event in this state"); + } + + } + +void CUpnpVolumeStateMachine::HandleUnsolicitedMuteEventInIdle( + TInt /*aError*/, TBool aMute, TBool /*aActionResponse*/ ) + { + __LOG3( "VolumeStateMachine: HandleUnsolicitedMuteEventInIdle %d, %d, %d", + aMute, iCurrentMute, iMuteRequestedByClient ); + + if ( iCurrentMute && !aMute && iMuteRequestedByClient ) + { + // client has requested mute, renderer unmuted + iCurrentMute = aMute; + // check if client has changed volume during mute + if ( iVolumeToSetAfterMute > 0 && + iVolumeToSetAfterMute != iCurrentVolume ) + { + TRAP_IGNORE( + iSession.SetVolumeL( iVolumeToSetAfterMute ); + iVolumeToSetAfterMute = KErrNotFound; + iState = EAdjustingVolume; + ); + } + // notify observer about mute state change + if ( iObserver ) + { + iObserver->MuteChanged( + KErrNone, KMuteOff, EFalse ); + } + } + else if ( iCurrentMute && !aMute || + !iCurrentMute && aMute ) + { + // renderer unmuted - notify volume state back + iCurrentMute = aMute; + // check if client has changed volume during mute + if ( iVolumeToSetAfterMute > 0 && + iVolumeToSetAfterMute != iCurrentVolume && + !aMute && + ( ( (iOptions & Upnp::EConvertVolumeZeroToMute) == 0 ) || + iMuteRequestedByClient ) ) + { + __LOG2( "After unmute adjusting volume %d->%d", + iCurrentVolume, iVolumeToSetAfterMute ); + TRAP_IGNORE( + iSession.SetVolumeL( iVolumeToSetAfterMute ); + iVolumeToSetAfterMute = KErrNotFound; + iState = EAdjustingVolume; + ); + } + // notify observer + if ( iObserver ) + { + NotifyObserver(aMute); + } + } + else + { + // no need to report status change + } + } + +void CUpnpVolumeStateMachine::NotifyObserver(TBool aMute) + { + __LOG2( "VolumeStateMachine: NotifyObserver %d, %d", + aMute, iOptions ); + + if ( ( (iOptions & Upnp::EConvertVolumeZeroToMute) == 0 ) || + iMuteRequestedByClient ) + { + // client prefers to use mute, or client has + // explicitely requested this mute session. + iObserver->MuteChanged( + KErrNone, aMute, EFalse ); + } + else + { + // convert mute signal to volume callback + TInt givenvol = + ( aMute ? KVolumeMin : iCurrentVolume ); + iObserver->VolumeChanged( + KErrNone, givenvol, EFalse ); + } + } + + + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::CopyValues +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpVolumeStateMachine::CopyValues( + const CUpnpVolumeStateMachine& aOther ) + { + iCurrentVolume = aOther.Volume(); + iCurrentMute = aOther.Mute(); + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::PushIntoQueueL +// -------------------------------------------------------------------------- +// +void CUpnpVolumeStateMachine::PushIntoQueueL( + const TUpnpVSMQueueItem::TPropertyType aPropery, const TInt aValue ) + { + __LOG( "VolumeStateMachine: PushIntoQueueL" ); + TUpnpVSMQueueItem queued( aPropery, aValue ); + iQueue.AppendL( queued ); + + CompressQueue(); + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::CompressQueueL +// -------------------------------------------------------------------------- +// +void CUpnpVolumeStateMachine::CompressQueue() + { + TInt queueCount( iQueue.Count() ); + + if( queueCount > 1 ) + { + __LOG1( "VolumeStateMachine: CompressQueue (queue count: %d)", queueCount ); + + TInt lastIndex( queueCount - 1 ); + + if( iQueue[lastIndex].Property() == TUpnpVSMQueueItem::EVolume ) + { + // remove all other except the last 'set volume' request + for( TInt i( queueCount - 2 ); i >= 0; --i ) + { + __LOG2( "VolumeStateMachine Queue: Removing %d from queue index %d", + iQueue[i].Property(), i ); + + iQueue.Remove( i ); + } + } + else + { + // remove all other except (the last 'set volume' request and) + // the last 'set mute' request + TBool setVolumeFound( EFalse ); + TBool setMuteFound( EFalse ); + for( TInt i( queueCount - 1 ); i >= 0; --i ) + { + if( iQueue[i].Property() == TUpnpVSMQueueItem::EVolume && + !setVolumeFound ) + { + setVolumeFound = ETrue; + } + else if( iQueue[i].Property() == TUpnpVSMQueueItem::EMute && + !setMuteFound ) + { + setMuteFound = ETrue; + } + else + { + __LOG2( "VolumeStateMachine Queue: Removing %d from queue index %d", + iQueue[i].Property(), i ); + + iQueue.Remove( i ); + } + } + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpVolumeStateMachine::ProcessNextQueuedProperty +// -------------------------------------------------------------------------- +// +void CUpnpVolumeStateMachine::ProcessNextQueuedProperty() + { + if( iQueue.Count() > 0 ) + { + __LOG( "VolumeStateMachine: ProcessNextQueuedPropertyL" ); + + TUpnpVSMQueueItem queuedItem( iQueue[0] ); + iQueue.Remove( 0 ); + + if( queuedItem.Property() == TUpnpVSMQueueItem::EVolume ) + { + TRAPD( err, SetVolumeL( queuedItem.Value() ) ); + if( err ) + { + iObserver->VolumeChanged( err, iCurrentVolume, ETrue ); + } + } + else + { + TRAPD( err, SetMuteL( queuedItem.Value() ) ); + if( err ) + { + iObserver->MuteChanged( err, iCurrentMute, ETrue ); + } + } + } + } + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpxmlparser/inc/upnpavtevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpxmlparser/inc/upnpavtevent.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,192 @@ +/* +* 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: Container class for AV Transport events. +* +*/ + +#ifndef C_UPNPAVTEVENT_INL +#define C_UPNPAVTEVENT_INL + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CONSTS + +/** + * Details of AVTransport event + * + * @lib upnpxmlparser.lib + */ +class CUPnPAVTEvent : public CBase + { + +public: + + /** + * AV Transport state. + */ + enum TTransportState + { + EIdle = 0, + EStopped, + EPlaying, + ETransitioning, + EPausedPlayback, + EPausedRecording, + ERecording, + ENoMediaPresent + }; + +private: + + /** + * Default constructor. + */ + CUPnPAVTEvent(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + +public: + + /** + * 1st phase constructor. + */ + static CUPnPAVTEvent* NewL(); + + /** + * Default destructor. + */ + ~CUPnPAVTEvent(); + + /** + * Copy constructor. + * + * @param event object to be copied. + * @return a copy of event. + */ + static CUPnPAVTEvent* CloneL( const CUPnPAVTEvent& event ); + +public: // Exported getters + + /** + * Return instance id + * + * @return instance id + */ + IMPORT_C TInt InstanceID() const; + + /** + * Return mute state + * + * @return mute + */ + IMPORT_C TInt Mute() const; + + /** + * Return volume + * + * @return volume + */ + IMPORT_C TInt Volume() const; + + /** + * Return AV Transport state + * + * @return transport state + */ + IMPORT_C TTransportState TransportState() const; + + /** + * Return AV Transport Uri + * + * @return uri + */ + IMPORT_C const TDesC8& TransportURI() const; + +public: // Not exported setters + + /** + * Set instance id + * + * @param instance id + */ + void SetInstanceID( TInt aInstanceID ); + + /** + * Set mute + * + * @param mute + */ + void SetMute( TInt aMute ); + + /** + * Set volume + * + * @param volume + */ + void SetVolume( TInt aVolume ); + + /** + * Set AV Transport state + * + * @param transport state + */ + void SetTransportState( TTransportState aTransportState ); + + /** + * Set AV Transport state + * + * @param stanport state (as a descriptor) + */ + void SetTransportState( const TDesC8& aData ); + + /** + * Set AV Tranport Uri + * + * @param Uri + */ + void SetTransportURIL( const TDesC8& aTransportURI ); + +public: + + /** + * Reset the member variables. + */ + void Reset(); + +private: // data + + TInt iInstanceID; + + TInt iMute; + + TInt iVolume; + + TTransportState iTransportState; + + /** + * Heap buffer for AV Transport Uri. + * Own. + */ + HBufC8* iTransportURI; + }; + +#endif // C_UPNPAVTEVENT + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontroller/upnpxmlparser/src/upnpavtevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpavcontroller/upnpxmlparser/src/upnpavtevent.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,237 @@ +/* +* 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: +* +*/ + +// INCLUDES +#include "upnpavtevent.h" + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::CUPnPAVTEvent +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +CUPnPAVTEvent::CUPnPAVTEvent() + { + // No implementation required + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::ConstructL +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::ConstructL() + { + // No implementation required + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::NewL +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +CUPnPAVTEvent* CUPnPAVTEvent::NewL() + { + CUPnPAVTEvent* self = new (ELeave) CUPnPAVTEvent; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::~CUPnPAVTEvent +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +CUPnPAVTEvent::~CUPnPAVTEvent() + { + delete iTransportURI; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::CloneL +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +CUPnPAVTEvent* CUPnPAVTEvent::CloneL( const CUPnPAVTEvent& event ) + { + CUPnPAVTEvent* tmp = CUPnPAVTEvent::NewL(); + tmp->SetInstanceID( event.InstanceID() ); + tmp->SetMute( event.Mute() ); + tmp->SetTransportState( event.TransportState() ); + tmp->SetTransportURIL( event.TransportURI() ); + tmp->SetVolume( event.Volume() ); + return tmp; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::InstanceID +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +EXPORT_C TInt CUPnPAVTEvent::InstanceID() const + { + return iInstanceID; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::Mute +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +EXPORT_C TInt CUPnPAVTEvent::Mute() const + { + return iMute; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::Volume +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +EXPORT_C TInt CUPnPAVTEvent::Volume() const + { + return iVolume; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::TransportState +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +EXPORT_C CUPnPAVTEvent::TTransportState + CUPnPAVTEvent::TransportState() const + { + return iTransportState; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::TransportURI +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +EXPORT_C const TDesC8& CUPnPAVTEvent::TransportURI() const + { + if( iTransportURI ) + { + return *iTransportURI; + } + else + { + return KNullDesC8; + } + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::SetInstanceID +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::SetInstanceID( TInt aInstanceID ) + { + iInstanceID = aInstanceID; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::SetMute +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::SetMute( TInt aMute ) + { + iMute = aMute; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::SetVolume +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::SetVolume( TInt aVolume ) + { + iVolume = aVolume; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::SetTransportState +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::SetTransportState( TTransportState aTransportState ) + { + iTransportState = aTransportState; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::SetTransportState +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::SetTransportState( const TDesC8& aData ) + { + // Define AV Transport States + _LIT8( KStopped, "STOPPED" ); + _LIT8( KPlaying, "PLAYING" ); + _LIT8( KTransitioning, "TRANSITIONING" ); + _LIT8( KPausedPlayback, "PAUSED_PLAYBACK" ); + _LIT8( KPausedRecording, "PAUSED_RECORDING" ); + _LIT8( KRecording, "RECORDING" ); + _LIT8( KNoMediaPresent, "NO_MEDIA_PRESENT" ); + + if( !aData.CompareF( KStopped ) ) + { + iTransportState = EStopped; + } + else if( !aData.CompareF( KPlaying ) ) + { + iTransportState = EPlaying; + } + else if( !aData.CompareF( KTransitioning ) ) + { + iTransportState = ETransitioning; + } + else if( !aData.CompareF( KPausedPlayback ) ) + { + iTransportState = EPausedPlayback; + } + else if( !aData.CompareF( KPausedRecording ) ) + { + iTransportState = EPausedRecording; + } + else if( !aData.CompareF( KRecording ) ) + { + iTransportState = ERecording; + } + else if( !aData.CompareF( KNoMediaPresent ) ) + { + iTransportState = ENoMediaPresent; + } + else + { + iTransportState = EIdle; + } + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::SetTransportURIL +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::SetTransportURIL( const TDesC8& aTransportURI ) + { + HBufC8* tmp = aTransportURI.AllocL(); + iTransportURI = tmp; + } + +// -------------------------------------------------------------------------- +// CUPnPAVTEvent::Reset +// See upnpavevent.h for description +// -------------------------------------------------------------------------- +void CUPnPAVTEvent::Reset() + { + iInstanceID = KErrNotFound; + iMute = KErrNotFound; + iVolume = KErrNotFound; + iTransportState = EIdle; + delete iTransportURI; iTransportURI = NULL; + } + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/BWINS/AVControlFrameworkU.DEF --- a/upnpavcontrolpoint/avcontrolframework/BWINS/AVControlFrameworkU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -EXPORTS - ??0CUpnpAVControlPoint@@IAE@AAVMUpnpAVControlPointObserver@@@Z @ 1 NONAME ; CUpnpAVControlPoint::CUpnpAVControlPoint(class MUpnpAVControlPointObserver &) - ??1CUpnpAVControlPoint@@UAE@XZ @ 2 NONAME ; CUpnpAVControlPoint::~CUpnpAVControlPoint(void) - ?ActionResponseReceivedL@CUpnpAVControlPoint@@MAEXPAVCUpnpAction@@@Z @ 3 NONAME ; void CUpnpAVControlPoint::ActionResponseReceivedL(class CUpnpAction *) - ?AddressChangedL@CUpnpAVControlPoint@@UAEXXZ @ 4 NONAME ABSENT ; void CUpnpAVControlPoint::AddressChangedL(void) - ?AvtDeviceCapabilitiesActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 5 NONAME ; int CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL(class TDesC8 const &, int) - ?AvtMediaInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 6 NONAME ; int CUpnpAVControlPoint::AvtMediaInfoActionL(class TDesC8 const &, int) - ?AvtNextActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 7 NONAME ; int CUpnpAVControlPoint::AvtNextActionL(class TDesC8 const &, int) - ?AvtPauseActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 8 NONAME ; int CUpnpAVControlPoint::AvtPauseActionL(class TDesC8 const &, int) - ?AvtPlayActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 9 NONAME ; int CUpnpAVControlPoint::AvtPlayActionL(class TDesC8 const &, int, class TDesC8 const &) - ?AvtPositionInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 10 NONAME ; int CUpnpAVControlPoint::AvtPositionInfoActionL(class TDesC8 const &, int) - ?AvtPreviousActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 11 NONAME ; int CUpnpAVControlPoint::AvtPreviousActionL(class TDesC8 const &, int) - ?AvtRecordActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 12 NONAME ; int CUpnpAVControlPoint::AvtRecordActionL(class TDesC8 const &, int) - ?AvtSeekActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 13 NONAME ; int CUpnpAVControlPoint::AvtSeekActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &) - ?AvtSetNextTransportUriActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 14 NONAME ; int CUpnpAVControlPoint::AvtSetNextTransportUriActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &) - ?AvtSetPlayModeActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 15 NONAME ; int CUpnpAVControlPoint::AvtSetPlayModeActionL(class TDesC8 const &, int, class TDesC8 const &) - ?AvtSetRecordModeActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 16 NONAME ; int CUpnpAVControlPoint::AvtSetRecordModeActionL(class TDesC8 const &, int, class TDesC8 const &) - ?AvtSetTransportUriActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 17 NONAME ; int CUpnpAVControlPoint::AvtSetTransportUriActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &) - ?AvtStopActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 18 NONAME ; int CUpnpAVControlPoint::AvtStopActionL(class TDesC8 const &, int) - ?AvtTransportInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 19 NONAME ; int CUpnpAVControlPoint::AvtTransportInfoActionL(class TDesC8 const &, int) - ?AvtTransportSettingsActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 20 NONAME ; int CUpnpAVControlPoint::AvtTransportSettingsActionL(class TDesC8 const &, int) - ?AvtTransportsActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 21 NONAME ; int CUpnpAVControlPoint::AvtTransportsActionL(class TDesC8 const &, int) - ?CdsBrowseActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@000HH0@Z @ 22 NONAME ; int CUpnpAVControlPoint::CdsBrowseActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, int, int, class TDesC8 const &) - ?CdsCreateObjectActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 23 NONAME ; int CUpnpAVControlPoint::CdsCreateObjectActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) - ?CdsCreateReferenceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 24 NONAME ; int CUpnpAVControlPoint::CdsCreateReferenceActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) - ?CdsDeleteResourceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@0@Z @ 25 NONAME ; int CUpnpAVControlPoint::CdsDeleteResourceActionL(class TDesC8 const &, class TDesC8 const &) - ?CdsDestroyObjectActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@0@Z @ 26 NONAME ; int CUpnpAVControlPoint::CdsDestroyObjectActionL(class TDesC8 const &, class TDesC8 const &) - ?CdsExportResourceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 27 NONAME ; int CUpnpAVControlPoint::CdsExportResourceActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) - ?CdsImportResourceActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00@Z @ 28 NONAME ; int CUpnpAVControlPoint::CdsImportResourceActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) - ?CdsSearchActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@000HH0@Z @ 29 NONAME ; int CUpnpAVControlPoint::CdsSearchActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, int, int, class TDesC8 const &) - ?CdsSearchCapabilitiesActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 30 NONAME ; int CUpnpAVControlPoint::CdsSearchCapabilitiesActionL(class TDesC8 const &) - ?CdsSortCapabilitiesActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 31 NONAME ; int CUpnpAVControlPoint::CdsSortCapabilitiesActionL(class TDesC8 const &) - ?CdsStopTransferActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 32 NONAME ; int CUpnpAVControlPoint::CdsStopTransferActionL(class TDesC8 const &, int) - ?CdsSystemUpdateIdActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 33 NONAME ; int CUpnpAVControlPoint::CdsSystemUpdateIdActionL(class TDesC8 const &) - ?CdsTransferProgressActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 34 NONAME ; int CUpnpAVControlPoint::CdsTransferProgressActionL(class TDesC8 const &, int) - ?CdsUpdateObjectActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@000@Z @ 35 NONAME ; int CUpnpAVControlPoint::CdsUpdateObjectActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) - ?CmConnectionCompleteActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 36 NONAME ; int CUpnpAVControlPoint::CmConnectionCompleteActionL(class TDesC8 const &, int) - ?CmCurrentConnectionInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H@Z @ 37 NONAME ; int CUpnpAVControlPoint::CmCurrentConnectionInfoActionL(class TDesC8 const &, int) - ?CmCurrentConnectionsActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 38 NONAME ; int CUpnpAVControlPoint::CmCurrentConnectionsActionL(class TDesC8 const &) - ?CmPrepareConnectionActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@00H0@Z @ 39 NONAME ; int CUpnpAVControlPoint::CmPrepareConnectionActionL(class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, int, class TDesC8 const &) - ?CmProtocolInfoActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@@Z @ 40 NONAME ; int CUpnpAVControlPoint::CmProtocolInfoActionL(class TDesC8 const &) - ?ConstructL@CUpnpAVControlPoint@@IAEXXZ @ 41 NONAME ; void CUpnpAVControlPoint::ConstructL(void) - ?DeviceDisappearedL@CUpnpAVControlPoint@@MAEXPAVCUpnpDevice@@@Z @ 42 NONAME ; void CUpnpAVControlPoint::DeviceDisappearedL(class CUpnpDevice *) - ?DeviceDiscoveredL@CUpnpAVControlPoint@@MAEXPAVCUpnpDevice@@@Z @ 43 NONAME ; void CUpnpAVControlPoint::DeviceDiscoveredL(class CUpnpDevice *) - ?HttpResponseReceivedL@CUpnpAVControlPoint@@MAEXPAVCUpnpHttpMessage@@@Z @ 44 NONAME ; void CUpnpAVControlPoint::HttpResponseReceivedL(class CUpnpHttpMessage *) - ?InitializeCdsActionFactoryL@CUpnpAVControlPoint@@IAEXXZ @ 45 NONAME ; void CUpnpAVControlPoint::InitializeCdsActionFactoryL(void) - ?NewL@CUpnpAVControlPoint@@SAPAV1@AAVMUpnpAVControlPointObserver@@@Z @ 46 NONAME ; class CUpnpAVControlPoint * CUpnpAVControlPoint::NewL(class MUpnpAVControlPointObserver &) - ?RcGetMuteActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 47 NONAME ; int CUpnpAVControlPoint::RcGetMuteActionL(class TDesC8 const &, int, class TDesC8 const &) - ?RcGetVolumetActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0@Z @ 48 NONAME ; int CUpnpAVControlPoint::RcGetVolumetActionL(class TDesC8 const &, int, class TDesC8 const &) - ?RcSetMuteActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H00@Z @ 49 NONAME ; int CUpnpAVControlPoint::RcSetMuteActionL(class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &) - ?RcSetVolumetActionL@CUpnpAVControlPoint@@QAEHABVTDesC8@@H0H@Z @ 50 NONAME ; int CUpnpAVControlPoint::RcSetVolumetActionL(class TDesC8 const &, int, class TDesC8 const &, int) - ?Service@CUpnpAVControlPoint@@QAEPAVCUpnpService@@PAVCUpnpDevice@@ABVTDesC8@@@Z @ 51 NONAME ; class CUpnpService * CUpnpAVControlPoint::Service(class CUpnpDevice *, class TDesC8 const &) - ?StateUpdatedL@CUpnpAVControlPoint@@MAEXPAVCUpnpService@@@Z @ 52 NONAME ; void CUpnpAVControlPoint::StateUpdatedL(class CUpnpService *) - ?NetworkEvent@CUpnpAVControlPoint@@UAEXPAVCUpnpNetworkEventBase@@@Z @ 53 NONAME ; void CUpnpAVControlPoint::NetworkEvent(class CUpnpNetworkEventBase *) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/EABI/AVControlFrameworkU.DEF --- a/upnpavcontrolpoint/avcontrolframework/EABI/AVControlFrameworkU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -EXPORTS - _ZN19CUpnpAVControlPoint10ConstructLEv @ 1 NONAME - _ZN19CUpnpAVControlPoint13StateUpdatedLEP12CUpnpService @ 2 NONAME - _ZN19CUpnpAVControlPoint14AvtNextActionLERK6TDesC8i @ 3 NONAME - _ZN19CUpnpAVControlPoint14AvtPlayActionLERK6TDesC8iS2_ @ 4 NONAME - _ZN19CUpnpAVControlPoint14AvtSeekActionLERK6TDesC8iS2_S2_ @ 5 NONAME - _ZN19CUpnpAVControlPoint14AvtStopActionLERK6TDesC8i @ 6 NONAME - _ZN19CUpnpAVControlPoint15AddressChangedLEv @ 7 NONAME ABSENT - _ZN19CUpnpAVControlPoint15AvtPauseActionLERK6TDesC8i @ 8 NONAME - _ZN19CUpnpAVControlPoint16AvtRecordActionLERK6TDesC8i @ 9 NONAME - _ZN19CUpnpAVControlPoint16CdsBrowseActionLERK6TDesC8S2_S2_S2_iiS2_ @ 10 NONAME - _ZN19CUpnpAVControlPoint16CdsSearchActionLERK6TDesC8S2_S2_S2_iiS2_ @ 11 NONAME - _ZN19CUpnpAVControlPoint16RcGetMuteActionLERK6TDesC8iS2_ @ 12 NONAME - _ZN19CUpnpAVControlPoint16RcSetMuteActionLERK6TDesC8iS2_S2_ @ 13 NONAME - _ZN19CUpnpAVControlPoint17DeviceDiscoveredLEP11CUpnpDevice @ 14 NONAME - _ZN19CUpnpAVControlPoint18AvtPreviousActionLERK6TDesC8i @ 15 NONAME - _ZN19CUpnpAVControlPoint18DeviceDisappearedLEP11CUpnpDevice @ 16 NONAME - _ZN19CUpnpAVControlPoint19AvtMediaInfoActionLERK6TDesC8i @ 17 NONAME - _ZN19CUpnpAVControlPoint19RcGetVolumetActionLERK6TDesC8iS2_ @ 18 NONAME - _ZN19CUpnpAVControlPoint19RcSetVolumetActionLERK6TDesC8iS2_i @ 19 NONAME - _ZN19CUpnpAVControlPoint20AvtTransportsActionLERK6TDesC8i @ 20 NONAME - _ZN19CUpnpAVControlPoint21AvtSetPlayModeActionLERK6TDesC8iS2_ @ 21 NONAME - _ZN19CUpnpAVControlPoint21CmProtocolInfoActionLERK6TDesC8 @ 22 NONAME - _ZN19CUpnpAVControlPoint21HttpResponseReceivedLEP16CUpnpHttpMessage @ 23 NONAME - _ZN19CUpnpAVControlPoint22AvtPositionInfoActionLERK6TDesC8i @ 24 NONAME - _ZN19CUpnpAVControlPoint22CdsCreateObjectActionLERK6TDesC8S2_S2_ @ 25 NONAME - _ZN19CUpnpAVControlPoint22CdsStopTransferActionLERK6TDesC8i @ 26 NONAME - _ZN19CUpnpAVControlPoint22CdsUpdateObjectActionLERK6TDesC8S2_S2_S2_ @ 27 NONAME - _ZN19CUpnpAVControlPoint23ActionResponseReceivedLEP11CUpnpAction @ 28 NONAME - _ZN19CUpnpAVControlPoint23AvtSetRecordModeActionLERK6TDesC8iS2_ @ 29 NONAME - _ZN19CUpnpAVControlPoint23AvtTransportInfoActionLERK6TDesC8i @ 30 NONAME - _ZN19CUpnpAVControlPoint23CdsDestroyObjectActionLERK6TDesC8S2_ @ 31 NONAME - _ZN19CUpnpAVControlPoint24CdsDeleteResourceActionLERK6TDesC8S2_ @ 32 NONAME - _ZN19CUpnpAVControlPoint24CdsExportResourceActionLERK6TDesC8S2_S2_ @ 33 NONAME - _ZN19CUpnpAVControlPoint24CdsImportResourceActionLERK6TDesC8S2_S2_ @ 34 NONAME - _ZN19CUpnpAVControlPoint24CdsSystemUpdateIdActionLERK6TDesC8 @ 35 NONAME - _ZN19CUpnpAVControlPoint25AvtSetTransportUriActionLERK6TDesC8iS2_S2_ @ 36 NONAME - _ZN19CUpnpAVControlPoint25CdsCreateReferenceActionLERK6TDesC8S2_S2_ @ 37 NONAME - _ZN19CUpnpAVControlPoint26CdsSortCapabilitiesActionLERK6TDesC8 @ 38 NONAME - _ZN19CUpnpAVControlPoint26CdsTransferProgressActionLERK6TDesC8i @ 39 NONAME - _ZN19CUpnpAVControlPoint26CmPrepareConnectionActionLERK6TDesC8S2_S2_iS2_ @ 40 NONAME - _ZN19CUpnpAVControlPoint27AvtTransportSettingsActionLERK6TDesC8i @ 41 NONAME - _ZN19CUpnpAVControlPoint27CmConnectionCompleteActionLERK6TDesC8i @ 42 NONAME - _ZN19CUpnpAVControlPoint27CmCurrentConnectionsActionLERK6TDesC8 @ 43 NONAME - _ZN19CUpnpAVControlPoint27InitializeCdsActionFactoryLEv @ 44 NONAME - _ZN19CUpnpAVControlPoint28AvtDeviceCapabilitiesActionLERK6TDesC8i @ 45 NONAME - _ZN19CUpnpAVControlPoint28CdsSearchCapabilitiesActionLERK6TDesC8 @ 46 NONAME - _ZN19CUpnpAVControlPoint29AvtSetNextTransportUriActionLERK6TDesC8iS2_S2_ @ 47 NONAME - _ZN19CUpnpAVControlPoint30CmCurrentConnectionInfoActionLERK6TDesC8i @ 48 NONAME - _ZN19CUpnpAVControlPoint4NewLER27MUpnpAVControlPointObserver @ 49 NONAME - _ZN19CUpnpAVControlPoint7ServiceEP11CUpnpDeviceRK6TDesC8 @ 50 NONAME - _ZN19CUpnpAVControlPointC1ER27MUpnpAVControlPointObserver @ 51 NONAME - _ZN19CUpnpAVControlPointC2ER27MUpnpAVControlPointObserver @ 52 NONAME - _ZN19CUpnpAVControlPointD0Ev @ 53 NONAME - _ZN19CUpnpAVControlPointD1Ev @ 54 NONAME - _ZN19CUpnpAVControlPointD2Ev @ 55 NONAME - _ZTI19CUpnpAVControlPoint @ 56 NONAME ; ## - _ZTI20CUpnpCmActionFactory @ 57 NONAME ; ## - _ZTI20CUpnpRcActionFactory @ 58 NONAME ; ## - _ZTI21CUpnpAvtActionFactory @ 59 NONAME ; ## - _ZTI21CUpnpCdsActionFactory @ 60 NONAME ; ## - _ZTI23CUpnpStateUpdateHandler @ 61 NONAME ; ## - _ZTI26CUpnpActionResponseHandler @ 62 NONAME ; ## - _ZTV19CUpnpAVControlPoint @ 63 NONAME ; ## - _ZTV20CUpnpCmActionFactory @ 64 NONAME ; ## - _ZTV20CUpnpRcActionFactory @ 65 NONAME ; ## - _ZTV21CUpnpAvtActionFactory @ 66 NONAME ; ## - _ZTV21CUpnpCdsActionFactory @ 67 NONAME ; ## - _ZTV23CUpnpStateUpdateHandler @ 68 NONAME ; ## - _ZTV26CUpnpActionResponseHandler @ 69 NONAME ; ## - _ZThn4_N19CUpnpAVControlPoint15AddressChangedLEv @ 70 NONAME ABSENT ; ## - _ZN19CUpnpAVControlPoint12NetworkEventEP21CUpnpNetworkEventBase @ 71 NONAME - _ZThn8_N19CUpnpAVControlPoint12NetworkEventEP21CUpnpNetworkEventBase @ 72 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/group/avcontrolframework.mmp --- a/upnpavcontrolpoint/avcontrolframework/group/avcontrolframework.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: ?Description -* -*/ - -#include - -TARGETTYPE dll - -#if defined(__HN_31__) || defined(__HN_32__) -TARGET hnavcontrolframework.dll -UID 0x1000008d 0x2000F888 -#else -TARGET avcontrolframework.dll -UID 0x1000008d 0x10204164 -#endif - -LANG SC -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -VERSION 10.1 -paged - -SOURCEPATH ../src/ -SOURCE upnpavcontrolpoint.cpp -SOURCE upnpstateupdatehandler.cpp -SOURCE upnpactionresponsehandler.cpp -SOURCE upnpcdsactionfactory.cpp -SOURCE upnpavtactionfactory.cpp -SOURCE upnpcmactionfactory.cpp -SOURCE upnprcactionfactory.cpp - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../inc -USERINCLUDE ../../inc -USERINCLUDE ../inc - -LIBRARY euser.lib -LIBRARY bafl.lib - -#if defined(__HN_31__) || defined(__HN_32__) -LIBRARY hncontrolpointbase.lib -LIBRARY hnserviceframework.lib -LIBRARY hnipserversutils.lib -#else -LIBRARY upnpcontrolpointbase.lib -LIBRARY upnpserviceframework.lib -LIBRARY upnpipserversutils.lib -#endif - -LIBRARY flogger.lib -DEFFILE AVControlFramework - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/group/bld.inf --- a/upnpavcontrolpoint/avcontrolframework/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/** @file -* Copyright (c) 2005 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 info for the AVControlFramework component -* -*/ - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these - - -PRJ_EXPORTS - -PRJ_MMPFILES -avcontrolframework.mmp - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnpactionresponsehandler.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnpactionresponsehandler.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpActionResponseHandler handles service specific responses -* -*/ - - - -#ifndef C_CUPNPACTIONRESPONSEHANDLER_H -#define C_CUPNPACTIONRESPONSEHANDLER_H - - -// INCLUDES -#include -#include "upnpavcontrolpointobserver.h" - -// FORWARD DECLARATIONS -class CUpnpService; -class CUpnpAVControlPoint; -// CLASS DECLARATION - -/** -* Action response handler class. -* This class contains functionality to handle UPnP action responses. -* -* @since Series 60 2.6 -*/ -class CUpnpActionResponseHandler : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUpnpActionResponseHandler* NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * Destructor. - */ - virtual ~CUpnpActionResponseHandler(); - - public: // New functions - /** - * The entry point for action response handling. - * @since Series 60 2.6 - * @param aAction response UPnP action. - * @return errorcode. KErrNone if no errors. - */ - TInt ActionResponseReceived(CUpnpAction* aAction); - /** - * Rendering Control response handler. - * @since Series 60 2.6 - * @param aAction response UPnP action. - * @return errorcode. KErrNone if no errors. - */ - TInt RenderingControlResponse(CUpnpAction* aAction); - /** - * AV Transport response handler. - * @since Series 60 2.6 - * @param aAction response UPnP action. - * @return errorcode. KErrNone if no errors. - */ - TInt AVTransportResponse(CUpnpAction* aAction); - /** - * Connection Manager response handler. - * @since Series 60 2.6 - * @param aAction response UPnP action. - * @return errorcode. KErrNone if no errors. - */ - TInt ConnectionManagerResponse(CUpnpAction* aAction); - /** - * Content Directory response handler. - * @since Series 60 2.6 - * @param aAction response UPnP action. - * @return errorcode. KErrNone if no errors. - */ - TInt ContentDirectoryResponse(CUpnpAction* aAction); - - private: - - /** - * C++ default constructor. - */ - CUpnpActionResponseHandler( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - //observer that is intrested about AVCP actions. - MUpnpAVControlPointObserver& iAVControlPointObserver; - // AVCP main class. - CUpnpAVControlPoint& iAVCP; - }; - -#endif // C_CUPNPACTIONRESPONSEHANDLER_H - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnpavcpstring.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnpavcpstring.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: File contains all global literals used in this module -* -*/ - - - -#ifndef UPNPAVCPSTRING_H_ -#define UPNPAVCPSTRING_H_ - -namespace UpnpAVCPStrings - { - _LIT8( KContentDirectory, "ContentDirectory:*"); - _LIT8( KConnectionManager, "ConnectionManager:*"); - _LIT8( KAVTransport, "AVTransport:*"); - _LIT8( KRenderingControl, "RenderingControl:*"); - _LIT8( KSetVolume, "SetVolume"); - _LIT8( KInstanceID, "InstanceID"); - _LIT8( KChannel, "Channel"); - _LIT8( KDesiredVolume, "DesiredVolume"); - _LIT8( KCurrentVolume, "CurrentVolume"); - _LIT8( KDesiredMute, "DesiredMute"); - _LIT8( KCurrentMute, "CurrentMute"); - _LIT8( KGetVolume, "GetVolume"); - _LIT8( KGetMute, "GetMute"); - _LIT8( KSetMute, "SetMute"); - _LIT8( KSetAVTransportURI, "SetAVTransportURI"); - _LIT8( KSetNextAVTransportURI, "SetNextAVTransportURI"); - _LIT8( KGetMediaInfo, "GetMediaInfo"); - _LIT8( KGetTransportInfo, "GetTransportInfo"); - _LIT8( KGetPositionInfo, "GetPositionInfo"); - _LIT8( KGetDeviceCapabilities, "GetDeviceCapabilities"); - _LIT8( KGetTransportSettings, "GetTransportSettings"); - _LIT8( KStop, "Stop"); - _LIT8( KPlay, "Play"); - _LIT8( KPause, "Pause"); - _LIT8( KRecord, "Record"); - _LIT8( KSeek, "Seek"); - _LIT8( KNext, "Next"); - _LIT8( KPrevious, "Previous"); - _LIT8( KSetPlayMode, "SetPlayMode"); - _LIT8( KSetRecordQualityMode, "SetRecordQualityMode"); - _LIT8( KGetCurrentTransportActions, "GetCurrentTransportActions"); - _LIT8( KCurrentURI, "CurrentURI"); - _LIT8( KCurrentURIMetaData, "CurrentURIMetaData"); - _LIT8( KNextURI, "NextURI"); - _LIT8( KNextURIMetaData, "NextURIMetaData"); - _LIT8( KSpeed, "Speed"); - _LIT8( KUnit, "Unit"); - _LIT8( KTarget, "Target"); - _LIT8( KNewPlayMode, "NewPlayMode"); - _LIT8( KNewRecordQualityMode, "NewRecordQualityMode"); - _LIT8( KMediaDuration, "MediaDuration"); - _LIT8( KNrTracks, "NrTracks"); - _LIT8( KPlayMedium, "PlayMedium"); - _LIT8( KPlayMedia, "PlayMedia"); - _LIT8( KRecordMedium, "RecordMedium"); - _LIT8( KWriteStatus, "WriteStatus"); - _LIT8( KCurrentTransportStatus, "CurrentTransportStatus"); - _LIT8( KCurrentTransportState, "CurrentTransportState"); - _LIT8( KCurrentSpeed, "CurrentSpeed"); - _LIT8( KTrack, "Track"); - _LIT8( KTrackDuration, "TrackDuration"); - _LIT8( KTrackMetaData, "TrackMetaData"); - _LIT8( KTrackURI, "TrackURI"); - _LIT8( KRelTime, "RelTime"); - _LIT8( KAbsTime, "AbsTime"); - _LIT8( KAbsCount, "AbsCount"); - _LIT8( KRecMedia, "RecMedia"); - _LIT8( KRelCount, "RelCount"); - _LIT8( KPlayMode, "PlayMode"); - _LIT8( KActions, "Actions"); - _LIT8( KRecQualityMode, "RecQualityMode"); - _LIT8( KSearchCaps, "SearchCaps"); - _LIT8( KSortCaps, "SortCaps"); - _LIT8( KId, "Id"); - _LIT8( KGetSearchCapabilities, "GetSearchCapabilities"); - _LIT8( KGetSortCapabilities, "GetSortCapabilities"); - _LIT8( KGetSystemUpdateID, "GetSystemUpdateID"); - _LIT8( KCreateObject, "CreateObject"); - _LIT8( KImportResource, "ImportResource"); - _LIT8( KExportResource, "ExportResource"); - _LIT8( KCreateReference, "CreateReference"); - _LIT8( KBrowse, "Browse"); - _LIT8( KDestinationURI, "DestinationURI"); - _LIT8( KSourceURI, "SourceURI"); - _LIT8( KTransferID, "TransferID"); - _LIT8( KResourceURI, "ResourceURI"); - _LIT8( KNumberReturned, "NumberReturned"); - _LIT8( KTotalMatches, "TotalMatches"); - _LIT8( KUpdateID, "UpdateID"); - _LIT8( KBrowseFlag, "BrowseFlag"); - _LIT8( KFilter, "Filter"); - _LIT8( KStartingIndex, "StartingIndex"); - _LIT8( KRequestedCount, "RequestedCount"); - _LIT8( KSortCriteria, "SortCriteria"); - _LIT8( KContainerID, "ContainerID"); - _LIT8( KObjectID, "ObjectID"); - _LIT8( KResult, "Result"); - _LIT8( KTransferStatus, "TransferStatus"); - _LIT8( KTransferLength, "TransferLength"); - _LIT8( KTransferTotal, "TransferTotal"); - _LIT8( KNewID, "NewID"); - _LIT8( KSearch, "Search"); - _LIT8( KDestroyObject, "DestroyObject"); - _LIT8( KDeleteResource, "DeleteResource"); - _LIT8( KStopTransferResource, "StopTransferResource"); - _LIT8( KGetTransferProgress, "GetTransferProgress"); - _LIT8( KUpdateObject, "UpdateObject"); - _LIT8( KSearchCriteria, "SearchCriteria"); - _LIT8( KCurrentTagValue, "CurrentTagValue"); - _LIT8( KNewTagValue, "NewTagValue"); - _LIT8( KPrepareForConnection, "PrepareForConnection"); - _LIT8( KRemoteProtocolInfo, "RemoteProtocolInfo"); - _LIT8( KPeerConnectionManager, "PeerConnectionManager"); - _LIT8( KPeerConnectionId, "PeerConnectionID"); - _LIT8( KDirection, "Direction"); - _LIT8( KConnectionId, "ConnectionID"); - _LIT8( KGetCurrentConnectionIDs, "GetCurrentConnectionIDs"); - _LIT8( KConnectionComplete, "ConnectionComplete"); - _LIT8( KGetCurrentConnectionInfo, "GetCurrentConnectionInfo"); - _LIT8( KAVTransportId, "AVTransportID"); - _LIT8( KConnectionIds, "ConnectionIDs"); - _LIT8( KProtocolInfo, "ProtocolInfo"); - _LIT8( KStatus, "Status"); - _LIT8( KGetProtocolInfo, "GetProtocolInfo"); - _LIT8( KSource, "Source"); - _LIT8( KSink, "Sink"); - _LIT8( KRcsID, "RcsID"); - _LIT8( KElements, "Elements"); - _LIT8( KPeerConnectionID, "PeerConnectionID"); - _LIT8( KConnectionID, "ConnectionID"); - _LIT8( KSystemUpdateID, "SystemUpdateID"); - _LIT8( KContainerUpdateIDs, "ContainerUpdateIDs"); - _LIT8( KSourceProtocolInfo, "SourceProtocolInfo"); - _LIT8( KSinkProtocolInfo, "SinkProtocolInfo"); - _LIT8( KCurrentConnectionIds, "CurrentConnectionIDs"); - _LIT8( KLastChange, "LastChange"); - _LIT8( KTransferIds, "TransferIDs"); - } - -#endif //UPNPAVCPSTRING_H_ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnpavtactionfactory.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnpavtactionfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,299 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Produces avt actions -* -*/ - - - -#ifndef C_CUPNPAVTACTIONFACTORY_H -#define C_CUPNPAVTACTIONFACTORY_H - -// INCLUDES -#include -#include "upnpavcontrolpointobserver.h" - -// FORWARD DECLARATIONS -class CUpnpService; -class CUpnpAVControlPoint; - -// CLASS DECLARATION - -/** -* AV Transport factory class. -* This class creates AV Transport actions. -* -* @since Series 60 2.6 -*/ -class CUpnpAvtActionFactory : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUpnpAvtActionFactory* NewL( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - /** - * Destructor. - */ - ~CUpnpAvtActionFactory(); - - public: // New functions - /** - * Cretes and places in CU-stack a SetTransportURI action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @param aCurrentUri Resource URI. - * @param aCurrentMetaData Resource metadata. - * @return Error code. KErrNone if no errors. - */ - TInt AvtSetTransportUriActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aCurrentUri, - const TDesC8& aCurrentMetaData ); - /** - * Cretes and places in CU-stack a SetNextTransportURI action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @param aNextUri Resource URI. - * @param aNextMetaData Resource metadata. - * @return Error code. KErrNone if no errors. - */ - TInt AvtSetNextTransportUriActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aNextUri, - const TDesC8& aNextMetaData ); - /** - * Cretes and places in CU-stack a Seek action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @param aUnit - * @param aTarget - * @return Error code. KErrNone if no errors. - */ - TInt AvtSeekActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aUnit, - const TDesC8& aTarget); - /** - * Cretes and places in CU-stack a GetMediaInfo action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtMediaInfoActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a GetTransportInfo action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtTransportInfoActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a GetPositionInfo action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtPositionInfoActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a GetDeviceCapabilities action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtDeviceCapabilitiesActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a GetTransportSettings action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtTransportSettingsActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a Stop action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtStopActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a Play action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @param aSpeed Play speed. - * @return Error code. KErrNone if no errors. - */ - TInt AvtPlayActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aSpeed); - /** - * Cretes and places in CU-stack a Pause action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtPauseActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a Record action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtRecordActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a Next action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtNextActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a Previous action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtPreviousActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - /** - * Cretes and places in CU-stack a SetPlayMode action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @param aPlayMode Mode of play. - * @return Error code. KErrNone if no errors. - */ - TInt AvtSetPlayModeActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aPlayMode); - /** - * Cretes and places in CU-stack a SetRecordQualityMode action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @param aRecordMode Mode of recording. - * @return Error code. KErrNone if no errors. - */ - TInt AvtSetRecordModeActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aRecordMode); - /** - * Cretes and places in CU-stack a GetTransportIDs action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaRenderer Action's target device. - * @param aInstanceId Media Renderer instance number. - * @return Error code. KErrNone if no errors. - */ - TInt AvtTransportsActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId); - - private: - - /** - * C++ default constructor. - */ - CUpnpAvtActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - //observer that is intrested about AVCP actions - MUpnpAVControlPointObserver& iAVControlPointObserver; - // AVCP main class - CUpnpAVControlPoint& iAVCP; - }; - -#endif // C_CUPNPAVTACTIONFACTORY_H - - // End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnpcdsactionfactory.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnpcdsactionfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,278 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: ?Description -* -*/ - - - -#ifndef C_CUPNPCDSACTIONFACTORY_H -#define C_CUPNPCDSACTIONFACTORY_H - - -// INCLUDES -#include -#include "upnpavcontrolpointobserver.h" - -// FORWARD DECLARATIONS - -class CUpnpService; -class CUpnpAVControlPoint; -// CLASS DECLARATION - -/** -* ?one_line_short_description. -* ?other_description_lines -* -* @since Series 60 2.6 -*/ -class CUpnpCdsActionFactory : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUpnpCdsActionFactory* NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * Destructor. - */ - ~CUpnpCdsActionFactory(); - - public: // New functions - - /** - * This function creates an action for content directory browse function. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Destination of action. - * @param aObjectId object to be browsed - * @param aBrowseFlag item or children browse - * @param aFilter - * @param aStartingIndex - * @param aRequestedCount - * @param aSortCriteria - * @return errorcode KErrNone if no errors - */ - TInt CdsBrowseActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectId, - const TDesC8& aBrowseFlag, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria); - /** - * This function creates an action for content directory Search function. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Destination of action. - * @param aObjectId object to be browsed - * @param aSearchCriteria search parameters - * @param aFilter - * @param aStartingIndex - * @param aRequestedCount - * @param aSortCriteria - * @return errorcode KErrNone if no errors - */ - TInt CdsSearchActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectId, - const TDesC8& aSearchCriteria, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria); - - /** - * Creates and places in CU-stack a GetSystemUpdateID action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @return Error code. KErrNone if no errors. - */ - TInt CdsSystemUpdateIdActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer); - /** - * Creates and places in CU-stack a GetSearchCapabilities action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @return Error code. KErrNone if no errors. - */ - TInt CdsSearchCapabilitiesActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer); - /** - * Creates and places in CU-stack a GetSortCapabilities action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @return Error code. KErrNone if no errors. - */ - TInt CdsSortCapabilitiesActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer); - /** - * Creates and places in CU-stack a CreateObject action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aId A contatiner id . - * @param aElements new object as XML string. - * @return error code. KErrNone if no errors. - */ - TInt CdsCreateObjectActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aId, - const TDesC8& aElements); - /** - * Cretes and places in CU-stack a ImportResource action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aSourceUri source of import. - * @param aDestinationUri destination for import. - * @return error code. KErrNone if no errors. - */ - TInt CdsImportResourceActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri); - /** - * Creates and places in CU-stack a ExportResource action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aSourceUri source of export. - * @param aDestinationUri destination for export. - * @return error code. KErrNone if no errors - */ - TInt CdsExportResourceActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri); - /** - * Creates and places in CU-stack a CreateRefernce action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aDestinationContainerId ID of container - * in wher reference is created. - * @param aSourceObjectId object to be refered. - * @return error code. KErrNone if no errors - */ - TInt CdsCreateReferenceActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aDestinationContainerId, - const TDesC8& aSourceObjectId); - /** - * Creates and places in CU-stack a DeleteResource action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aResourceUri URI of target resource. - * @return error code. KErrNone if no errors. - */ - TInt CdsDeleteResourceActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aResourceUri); - /** - * Creates and places in CU-stack a DestroyObject action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aObjectId URI of target resource. - * @return error code. KErrNone if no errors. - */ - TInt CdsDestroyObjectActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectId); - /** - * Creates and places in CU-stack a StopTransfer action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aTransferId Id of target transfer. - * @return error code. KErrNone if no errors. - */ - TInt CdsStopTransferActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - TInt aTransferId); - /** - * Creates and places in CU-stack a GetTransferProgress action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aTransferId Id of target transfer. - * @return error code. KErrNone if no errors. - */ - TInt CdsTransferProgressActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - TInt aTransferId); - /** - * Creates and places in CU-stack a UpdateObject action. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aMediaServer Action's target device. - * @param aObjectID object to be updated. - * @param aCurrentTagValue current metadata. - * @param aNewTagValue new metadata. - * @return error code. KErrNone if no errors. - */ - TInt CdsUpdateObjectActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectID, - const TDesC8& aCurrentTagValue, - const TDesC8& aNewTagValue); - - private: - - /** - * C++ default constructor. - */ - CUpnpCdsActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - - //observer that is intrested about AVCP actions - MUpnpAVControlPointObserver& iAVControlPointObserver; - // AVCP main class - CUpnpAVControlPoint& iAVCP; - }; - -#endif // C_CUPNPCDSACTIONFACTORY_H - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnpcmactionfactory.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnpcmactionfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Produces cm actions -* -*/ - - - -#ifndef C_CUPNPCMACTIONFACTORY_H -#define C_CUPNPCMACTIONFACTORY_H - - -// INCLUDES -#include -#include "upnpavcontrolpointobserver.h" - -// FORWARD DECLARATIONS -class CUpnpService; -class CUpnpAVControlPoint; - -// CLASS DECLARATION - -/** -* Factory class. -* This class creates Connection Manager actions. -* -* @since Series 60 2.6 -*/ -class CUpnpCmActionFactory : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUpnpCmActionFactory* NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * Destructor. - */ - ~CUpnpCmActionFactory(); - - public: // New functions - /** - * This function creates an action for Connection Manager - * GetProtocolInfo function. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aDevice Destination of action. - * @return errorcode KErrNone if no errors. - */ - TInt CmProtocolInfoActionLC(CUpnpAction*& aAction, CUpnpDevice* aDevice); - /** - * This function creates an action for Connection Manager - * GetCurrentConnections function. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aDevice Destination of action. - * @return errorcode KErrNone if no errors. - */ - TInt CmCurrentConnectionsActionLC(CUpnpAction*& aAction, CUpnpDevice* aDevice); - - /** - * This function creates an action for Connection Manager - * PrepareForConnection function. - * @since Series 60 2.6 - * @param aAction CUpnpAction pointer for created action. - * @param aDevice Destination of action. - * @param aRemoteProtocolInfo. - * @param aPeerConnectionManager. - * @param aPeerConnectionID connection ID. - * @param aDirection connection direction. - * @return errorcode KErrNone if no errors. - */ - TInt CmPrepareConnectionActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - const TDesC8& aRemoteProtocolInfo, - const TDesC8& aPeerConnectionManager, - TInt aPeerConnectionID, - const TDesC8& aDirection); - /** - * This function creates an action for Connection Manager - * ConnectionComplete function. - * @since Series 60 2.6 - * @param aAction created action - * @param aDevice Action's target device. - * @param aConnectionId target connection. - * @return errorcode KErrNone if no errors. - */ - TInt CmConnectionCompleteActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aConnectionId); - /** - * This function creates an action for Connection Manager - * GetCurrentConnections function. - * @since Series 60 2.6 - * @param aAction created action - * @param aDevice Action's target device. - * @param aConnectionId target connection. - * @return errorcode KErrNone if no errors. - */ - TInt CmCurrentConnectionInfoActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aConnectionId); - - private: - - /** - * C++ default constructor. - */ - CUpnpCmActionFactory( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - // Observer that is intrested about AVCP actions. - MUpnpAVControlPointObserver& iAVControlPointObserver; - // AVCP main class. - CUpnpAVControlPoint& iAVCP; - }; - -#endif // C_CUPNPCMACTIONFACTORY_H - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnpcustomlog.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnpcustomlog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Declares Logger Functions -* -*/ - - - - - -#ifndef C_UPNPCUSTOMLOG_H -#define C_UPNPCUSTOMLOG_H - -#include -#include - -// UPNP_LOG : -//1 - logging, UDEB -//0 - no logging, UREL - -//UPNP_FLOGGING = file logging, default in UDEB -//UPNP_CLOGGING = console logging - - -#ifndef _DEBUG - // UREL - #define UPNP_LOG 0 // No logging in UREL builds - -#else - - // UDEB - #define UPNP_LOG 1 - #define UPNP_FLOGGING //File logger - //#define UPNP_CLOGGING //console logger - - _LIT(KEventLogFile, "EventActionLog.txt"); - // If log file is not defined in CPP file, use UPnPStackLog as default - #ifndef KLogFile - #define KLogFile _L("UPnPStack.txt") - #endif - -#endif - -_LIT(KLogFolder,"upnp"); -const TInt KMaxLogLen = 256; -//_LIT(KLogFile, LOG_FILE); - -// Writing some descriptor into log -// LOGT(own_desc); -// -// Writing data into log -// LOGS("My log string"); -// -// Writing data with one decimal parameter -// LOGS1("Log with decimal parameter %i", desimalValue); -// -// Writing data with one decimal and hexa parameter -// LOGS2("Log with decimal and hexa parameters %i %x", desimalValue, hexaValue); -// -// Writing data with one descriptor and decimal parameters -// LOGS2("String %S and decimal value %i", &stringData, decimalValue); -// -// Writing User::AllocSize -// LOGM; - -#if UPNP_LOG == 1 - -#ifdef UPNP_FLOGGING - -static void DoOutput(TDesC8& aData) - { - if(!aData.Length()) - { - return; - } - RFileLogger logger; - logger.Connect(); - - logger.CreateLog( KLogFolder(), KLogFile, EFileLoggingModeAppend); - logger.Write( aData.Mid(0,(aData.Length()(aFmt)); - - HBufC8* buf = HBufC8::NewLC(KMaxLogLen); - - buf->Des().FormatList(fmt, args); - DoOutput(*buf); - - VA_END(args); - CleanupStack::PopAndDestroy(buf); - } - -static void DebugStringWideL(const char* aFmt, ...) - { - VA_LIST args; - VA_START(args, aFmt); - - TPtrC8 fmt(reinterpret_cast(aFmt)); - - HBufC* fmt16 = HBufC::NewLC(fmt.Length()); - fmt16->Des().Copy(fmt); - - HBufC* buf = HBufC::NewLC(KMaxLogLen); - TPtrC pointer = fmt16->Des() ; - buf->Des().FormatList(pointer, args); - - HBufC8* buf8 = HBufC8::NewLC(buf->Length()); - buf8->Des().Copy(*buf); - - DoOutput(*buf8); - - VA_END(args); - - CleanupStack::PopAndDestroy(buf8); - CleanupStack::PopAndDestroy(buf); - CleanupStack::PopAndDestroy(fmt16); - } - - -static void DebugBufferL(const TDesC8& aBuf) - { - DebugStringNarrowL("\"%S\"", &aBuf); - } - -static void DebugBufferL(const TDesC& aBuf) - { - DebugStringWideL("\"%S\"", &aBuf); - } - -static void DebugTimeL() - { - TTime time; - time.UniversalTime(); - - TBuf<64> dateTimeString; - - _LIT(KTimeString, "%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"); - time.FormatL(dateTimeString, KTimeString); - DebugBufferL(dateTimeString); - - } - - -// ------------ Content Directory logging specific --------------- -_LIT(KInfoFormatString, "INFO#%S#%S#%d#%S"); -_LIT(KErrFormatString, "ERROR#%S#%S#%d#%S"); - -static void LOGCD(const char* aInFunction, const char* aCalledFunction, TInt aErrorCode, const char* aComment) -{ - // Transforming parameters from 'const char *' into 'HBufC' - TPtrC8 InFunction8(reinterpret_cast(aInFunction)); - HBufC* InFunction16 = HBufC::NewLC(128); - InFunction16->Des().Copy(InFunction8); - - TPtrC8 CalledFunction8(reinterpret_cast(aCalledFunction)); - HBufC* CalledFunction16 = HBufC::NewLC(128); - CalledFunction16->Des().Copy(CalledFunction8); - - TPtrC8 Comment8(reinterpret_cast(aComment)); - HBufC* Comment16 = HBufC::NewLC(128); - Comment16->Des().Copy(Comment8); - - // preparing main 16bit buffer - HBufC* buf = HBufC::NewLC(KMaxLogLen); - - // formating all together in 16bit descriptor - if(aErrorCode < 0) - { - buf->Des().Format(KErrFormatString, &*InFunction16, &*CalledFunction16, aErrorCode, &*Comment16); - } - else - { - buf->Des().Format(KInfoFormatString, &*InFunction16, &*CalledFunction16, aErrorCode, &*Comment16); - } - - // converting 16bit descriptor into 8bit one - HBufC8* buf8 = HBufC8::NewLC(buf->Length()); - buf8->Des().Copy(*buf); - - // main file logging - DoOutput(*buf8); - - // cleaning - CleanupStack::PopAndDestroy(buf8); - CleanupStack::PopAndDestroy(buf); - CleanupStack::PopAndDestroy(Comment16); - CleanupStack::PopAndDestroy(CalledFunction16); - CleanupStack::PopAndDestroy(InFunction16); -} - - - #define LOGTIME DebugTimeL() - #define LOG(x) DebugStringNarrowL x - #define LOG8(x) DebugStringNarrowL x - #define LOG16(x) DebugStringWideL x - - #define LOGT(A) - #define LOGS(A) LOG16((A)) - #define LOGS1(A,B) LOG16((A,B)) - #define LOGS2(A,B,C) LOG16((A,B,C)) - #define LOGM - - #define LOGTH(H,A) LOGT(A) - #define LOGSH(H,A) LOGS(A) - #define LOGS1H(H,A,B) LOGS1(A,B) - #define LOGS2H(H,A,B,C) LOGS2(A,B,C) - - #define ACTIONSEND(A) - #define ACTIONRECV(A,B) - -static void LOGSQL(const char* aInFunction, const char* aCalledFunction, TInt aErrorCode, const TDesC* aCommand) -{ - LOGCD(aInFunction, aCalledFunction, aErrorCode, "SQL Command:"); - - // log whole sql command separately - LOGS1("%S", aCommand); -} - - - -#else // UPNP_CLOGGING = console logging - #define LOGS(A) RDebug::Print(_L(A)); - #define LOGS1(A,B) RDebug::Print(_L(A),B); - #define LOGS2(A,B,C) RDebug::Print(_L(A),B,C); - - #define LOGT(A) - #define LOGM - #define ACTIONSEND(A) - #define ACTIONRECV(A,B) - - #define LOGTH(H,A) LOGT(A) - #define LOGSH(H,A) LOGS(A) - #define LOGS1H(H,A,B) LOGS1(A,B) - #define LOGS2H(H,A,B,C) LOGS2(A,B,C) - #define LOGCD(A,B,C,D) - #define LOGSQL(A,B,C,D) - - #define LOGTIME - #define LOG(x) - #define LOG8(x) - #define LOG16(x) - - -#endif //UPNP_LOG == 1 - -#else // UPNP_LOG == 0 or invalid - #define LOGT(A) - #define LOGS(A) - #define LOGS1(A,B) - #define LOGS2(A,B,C) - #define LOGM - #define ACTIONSEND(A) - #define ACTIONRECV(A,B) - - #define LOGTH(H,A) - #define LOGSH(H,A) - #define LOGS1H(H,A,B) - #define LOGS2H(H,A,B,C) - - #define LOGCD(A,B,C,D) - #define LOGSQL(A,B,C,D) - - #define LOGTIME - #define LOG(x) - #define LOG8(x) - #define LOG16(x) - -#endif // UPNP_LOG - -#define LOG_FUNC_NAME LOGS( __PRETTY_FUNCTION__ ) - -#endif // C_UPNPCUSTOMLOG_H - -// End Of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnprcactionfactory.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnprcactionfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Produces rc actions -* -*/ - - - -#ifndef C_CUPNPRCACTIONFACTORY_H -#define C_CUPNPRCACTIONFACTORY_H - - -// INCLUDES -#include -#include "upnpavcontrolpointobserver.h" - -// FORWARD DECLARATIONS -class CUpnpService; -class CUpnpAVControlPoint; - -// CLASS DECLARATION - -/** -* RC action factory class. -* This class provides a Rendering Control action creation services. -* -* @since Series 60 2.6 -*/ -class CUpnpRcActionFactory : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUpnpRcActionFactory* NewL( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * Destructor. - */ - ~CUpnpRcActionFactory(); - - public: // New functions - - /** - * Creates a GetVolume action. - * @since Series 60 2.6 - * @param aAction Pointer for returning created action. - * @param aDevice Target of the action. - * @param aInstanceID rendering instance. - * @param aChannel audio channel. - * @return error code. KErrNone if no errors - */ - TInt RcGetVolumeActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel); - /** - * Creates a SetVolume action. - * @since Series 60 2.6 - * @param aAction Pointer for returning created action. - * @param aDevice Target of the action. - * @param aInstanceID rendering instance. - * @param aChannel audio channel. - * @param aVolume volume. - * @return error code. KErrNone if no errors - */ - TInt RcSetVolumeActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel, - TInt aVolume); - /** - * Creates a GetMuteAction. - * @since Series 60 2.6 - * @param aAction Pointer for returning created action. - * @param aDevice Target of the action. - * @param aInstanceID rendering instance. - * @param aChannel audio channel. - * @return error code. KErrNone if no errors - */ - TInt RcGetMuteActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel); - /** - * ?Creates a SetMute action. - * @since Series 60 2.6 - * @param aAction Pointer for returning created action. - * @param aDevice Target of the action. - * @param aInstanceID rendering instance. - * @param aChannel audio channel. - * @param aMute - * @return error code. KErrNone if no errors - */ - TInt RcSetMuteActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel, - const TDesC8& aMute); - - - private: - - /** - * C++ default constructor. - */ - CUpnpRcActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - //observer that is intrested about AVCP actions. - MUpnpAVControlPointObserver& iAVControlPointObserver; - // AVCP main class. - CUpnpAVControlPoint& iAVCP; - - }; - -#endif // C_CUPNPRCACTIONFACTORY_H - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/inc/upnpstateupdatehandler.h --- a/upnpavcontrolpoint/avcontrolframework/inc/upnpstateupdatehandler.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Watches states of control point -* -*/ - - - -#ifndef C_CUPNPSTATEUPDATEHANDLER_H -#define C_CUPNPSTATEUPDATEHANDLER_H - - -// INCLUDES -#include -#include "upnpavcontrolpointobserver.h" - -// FORWARD DECLARATIONS -class CUpnpService; -class CUpnpAVControlPoint; - -// CLASS DECLARATION - -/** -* UPnP event handler. -* This class contain functions to handle UPnP events. -* -* @since Series 60 2.6 -*/ -class CUpnpStateUpdateHandler : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUpnpStateUpdateHandler* NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * Destructor. - */ - virtual ~CUpnpStateUpdateHandler(); - - public: // New functions - - /** - * MAin function for event handling - * @since Series 60 2.6 - * @param aService Service that has update events. - * @return KErrNone - */ - TInt StateUpdated( CUpnpService*& aService ); - /** - * Handler for Content Directory events. - * @since Series 60 2.6 - * @param aDevice Device that has update events - * @param aService Service that has update events - * @return KErrNone, KErrNotsupported, KErrGeneral - */ - TInt ContentDirectoryStateUpdated( - CUpnpDevice& aDevice, - CUpnpService*& aService ); - /** - * Handler for Connection Manager events. - * @since Series 60 2.6 - * @param aDevice Device that has update events - * @param aService Service that has update events - * @return KErrNone, KErrNotsupported, KErrGeneral - */ - TInt ConnectionManagerStateUpdated( - CUpnpDevice& aDevice, - CUpnpService*& aService); - /** - * Handler for Rendering Control events. - * @since Series 60 2.6 - * @param aDevice Device that has update events - * @param aService Service that has update events - * @return KErrNone, KErrNotsupported, KErrGeneral - */ - TInt RenderingControlStateUpdated( CUpnpDevice& aDevice, CUpnpService*& aService ); - /** - * Handler for AV Transport events. - * @since Series 60 2.6 - * @param aDevice Device that has update events - * @param aService Service that has update events - * @return KErrNone, KErrNotsupported, KErrGeneral - */ - TInt AVTransportStateUpdated( CUpnpDevice& aDevice, CUpnpService*& aService ); - - private: - - /** - * C++ default constructor. - */ - CUpnpStateUpdateHandler( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - - //observer that is intrested about AVCP actions - MUpnpAVControlPointObserver& iAVControlPointObserver; - //AVCP main class - CUpnpAVControlPoint& iAVCP; - }; - -#endif // C_CUPNPSTATEUPDATEHANDLER_H - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/src/upnpactionresponsehandler.cpp --- a/upnpavcontrolpoint/avcontrolframework/src/upnpactionresponsehandler.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,717 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpActionResponseHandler -* -*/ - - -// INCLUDE FILES -#include "upnpactionresponsehandler.h" -#include "upnpavcontrolpoint.h" -#include "upnpavcpstring.h" - -// CONSTANTS] -using namespace UpnpAVCPStrings; - - -// ----------------------------------------------------------------------------- -// CUpnpActionResponseHandler::CUpnpActionResponseHandler -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpActionResponseHandler::CUpnpActionResponseHandler( - MUpnpAVControlPointObserver& aAVCPObserver, CUpnpAVControlPoint& aAVCP ) - :iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpActionResponseHandler::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpActionResponseHandler::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CSuperDir::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpActionResponseHandler* CUpnpActionResponseHandler::NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) - { - CUpnpActionResponseHandler* self = new (ELeave) CUpnpActionResponseHandler( - aAVCPObserver, aAVCP ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// Destructor -CUpnpActionResponseHandler::~CUpnpActionResponseHandler() - { - } -// ----------------------------------------------------------------------------- -// CUpnpActionResponseHandler::ActionResponseReceived -// This is where action responses first came. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpActionResponseHandler::ActionResponseReceived(CUpnpAction* aAction) - { - CUpnpService& service = aAction->Service(); - if( service.ServiceType().Length() <= 0 ) - { - return KErrArgument; - } - TInt err( KErrNone ); - if ( service.ServiceType().Match(KRenderingControl) != KErrNotFound ) - { - err = RenderingControlResponse(aAction); - } - else if ( service.ServiceType().Match(KAVTransport) != KErrNotFound ) - { - err = AVTransportResponse(aAction); - } - else if ( service.ServiceType().Match(KConnectionManager) != KErrNotFound ) - { - err = ConnectionManagerResponse(aAction); - } - else if ( service.ServiceType().Match(KContentDirectory) != KErrNotFound ) - { - err = ContentDirectoryResponse(aAction); - } - else - { - err = KErrNotSupported; - } - return err; - } -// ----------------------------------------------------------------------------- -// CUpnpActionResponseHandler::RenderingControlResponse -// This is where action responses first came. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpActionResponseHandler::RenderingControlResponse(CUpnpAction* aAction) - { - CUpnpService& service = aAction->Service(); - if( service.ServiceType().Length() <= 0 ) - { - return KErrArgument; - } - const TDesC8& uuid = service.Device().Uuid(); - if (aAction->Name().Compare(KSetVolume) == 0) - { - iAVControlPointObserver.RcSetVolumeResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KChannel ), - aAction->ArgumentValue( KDesiredVolume ) - ); - } - else if (aAction->Name().Compare(KGetVolume) == 0) - { - iAVControlPointObserver.RcVolumeResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KChannel ), - aAction->ArgumentValue( KCurrentVolume ) - ); - } - else if (aAction->Name().Compare(KSetMute) == 0) - { - iAVControlPointObserver.RcSetMuteResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KChannel ), - aAction->ArgumentValue( KDesiredMute ) - ); - } - else if (aAction->Name().Compare(KGetMute) == 0) - { - iAVControlPointObserver.RcMuteResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KChannel ), - aAction->ArgumentValue( KCurrentMute ) - ); - } - else - { - return KErrNotSupported; - } - return KErrNone; - } -// ----------------------------------------------------------------------------- -// CUpnpActionResponseHandler::AVTransportResponse -// This is where action responses fot AV transport service are handled. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpActionResponseHandler::AVTransportResponse(CUpnpAction* aAction) - { - - CUpnpService& service = aAction->Service(); - if( service.ServiceType().Length() <= 0 ) - { - return KErrArgument; - } - const TDesC8& uuid = service.Device().Uuid(); - if (aAction->Name().Compare(KSetAVTransportURI) == 0) - { - iAVControlPointObserver.AvtSetTransportUriResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KCurrentURI ), - aAction->ArgumentValue( KCurrentURIMetaData ) - ); - } - else if (aAction->Name().Compare(KSetNextAVTransportURI) == 0) - { - iAVControlPointObserver.AvtSetNextTransportUriResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KNextURI ), - aAction->ArgumentValue( KNextURIMetaData ) - ); - } - else if (aAction->Name().Compare(KGetMediaInfo) == 0) - { - iAVControlPointObserver.AvtMediaInfoResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KNrTracks ), - aAction->ArgumentValue( KMediaDuration ), - aAction->ArgumentValue( KCurrentURI ), - aAction->ArgumentValue( KCurrentURIMetaData ), - aAction->ArgumentValue( KNextURI ), - aAction->ArgumentValue( KNextURIMetaData ), - aAction->ArgumentValue( KPlayMedium ), - aAction->ArgumentValue( KRecordMedium ), - aAction->ArgumentValue( KWriteStatus ) - ); - } - else if (aAction->Name().Compare(KGetTransportInfo) == 0) - { - iAVControlPointObserver.AvtGetTransportInfoResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KCurrentTransportState ), - aAction->ArgumentValue( KCurrentTransportStatus ), - aAction->ArgumentValue( KCurrentSpeed ) - ); - } - else if (aAction->Name().Compare(KGetPositionInfo) == 0) - { - iAVControlPointObserver.AvtPositionInfoResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KTrack ), - aAction->ArgumentValue( KTrackDuration), - aAction->ArgumentValue( KTrackMetaData ), - aAction->ArgumentValue( KTrackURI ), - aAction->ArgumentValue( KRelTime ), - aAction->ArgumentValue( KAbsTime ), - aAction->ArgumentValue( KRelCount ), - aAction->ArgumentValue( KAbsCount ) - ); - } - else if (aAction->Name().Compare(KGetDeviceCapabilities) == 0) - { - iAVControlPointObserver.AvtDeviceCapabilitiesResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KPlayMedia ), - aAction->ArgumentValue( KRecMedia ), - aAction->ArgumentValue( KRecQualityMode ) - ); - } - else if (aAction->Name().Compare(KGetTransportSettings) == 0) - { - iAVControlPointObserver.AvtTransportSettingsResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KPlayMode ), - aAction->ArgumentValue( KRecQualityMode ) - ); - } - else if (aAction->Name().Compare(KStop) == 0) - { - iAVControlPointObserver.AvtStopResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ) - ); - } - else if (aAction->Name().Compare(KPlay) == 0) - { - iAVControlPointObserver.AvtPlayResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KSpeed ) - ); - } - else if (aAction->Name().Compare(KPause) == 0) - { - iAVControlPointObserver.AvtPauseResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ) - ); - } - else if (aAction->Name().Compare(KRecord) == 0) - { - iAVControlPointObserver.AvtRecordResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ) - ); - } - else if (aAction->Name().Compare(KSeek) == 0) - { - iAVControlPointObserver.AvtSeekResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KUnit ), - aAction->ArgumentValue( KTarget ) - ); - } - else if (aAction->Name().Compare(KNext) == 0) - { - iAVControlPointObserver.AvtNextResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ) - ); - } - else if (aAction->Name().Compare(KPrevious) == 0) - { - iAVControlPointObserver.AvtPreviousResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ) - ); - } - else if (aAction->Name().Compare(KSetPlayMode) == 0) - { - iAVControlPointObserver.AvtSetPlayModeResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KNewPlayMode ) - ); - } - else if (aAction->Name().Compare(KSetRecordQualityMode) == 0) - { - iAVControlPointObserver.AvtSetRecordModeResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KNewRecordQualityMode ) - ); - } - else if (aAction->Name().Compare(KGetCurrentTransportActions) == 0) - { - iAVControlPointObserver.AvtSetPlayModeResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KInstanceID ), - aAction->ArgumentValue( KActions ) - ); - } - else{ - return KErrNotSupported; - } - return KErrNone; - } -// ----------------------------------------------------------------------------- -// CUpnpActionResponseHandler::ConnectionManagerResponse -// This is where action responses for Connection Manager service are handled. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpActionResponseHandler::ConnectionManagerResponse(CUpnpAction* aAction) - { - CUpnpService& service = aAction->Service(); - if( service.ServiceType().Length() <= 0 ) - { - return KErrArgument; - } - const TDesC8& uuid = service.Device().Uuid(); - if (aAction->Name().Compare( KGetProtocolInfo ) == 0) - { - iAVControlPointObserver.CmProtocolInfoResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KSource ), - aAction->ArgumentValue( KSink ) - ); - } - - else if (aAction->Name().Compare( KPrepareForConnection ) == 0) - { - TLex8 connectionLex1( aAction->ArgumentValue( KConnectionId ) ); - TInt connectionId; - connectionLex1.Val( connectionId ); - TLex8 transportLex1( aAction->ArgumentValue( KAVTransportId ) ); - TInt transportId; - transportLex1.Val( transportId ); - TLex8 rscLex3( aAction->ArgumentValue( KRcsID ) ); - TInt rscId; - rscLex3.Val( rscId ); - iAVControlPointObserver.CmPrepareResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KRemoteProtocolInfo ), - aAction->ArgumentValue( KPeerConnectionManager ), - aAction->ArgumentValue( KPeerConnectionId ), - aAction->ArgumentValue( KDirection ), - connectionId, - transportId, - rscId - ); - } - else if (aAction->Name().Compare(KConnectionComplete) == 0) - { - TLex8 connectionLex1( aAction->ArgumentValue( KConnectionId ) ); - TInt connectionId; - connectionLex1.Val( connectionId ); - - iAVControlPointObserver.CmComplete( - uuid, - aAction->SessionId(), - aAction->Error(), - connectionId - ); - } - else if (aAction->Name().Compare(KGetCurrentConnectionIDs) == 0) - { - iAVControlPointObserver.CmCurrentConnections( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KConnectionIds ) - ); - } - else if (aAction->Name().Compare( KGetCurrentConnectionInfo ) == 0) - { - - TLex8 rscLex3( aAction->ArgumentValue( KRcsID ) ); - TInt rscId; - rscLex3.Val( rscId ); - TLex8 transportLex1( aAction->ArgumentValue( KAVTransportId ) ); - TInt transportId; - transportLex1.Val( transportId ); - TLex8 peerLex( aAction->ArgumentValue( KPeerConnectionId ) ); - TInt peerId; - peerLex.Val( peerId ); - - iAVControlPointObserver.CmCurrentInfo( - uuid, - aAction->SessionId(), - aAction->Error(), - rscId, - transportId, - aAction->ArgumentValue( KProtocolInfo), - aAction->ArgumentValue( KPeerConnectionManager), - peerId, - aAction->ArgumentValue( KDirection ), - aAction->ArgumentValue( KStatus ) - ); - } - else - { - return KErrNotSupported; - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUpnpActionResponseHandler::ContentDirectoryResponse -// This is where action responses for Content Directory service are handled. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpActionResponseHandler::ContentDirectoryResponse(CUpnpAction* aAction) - { - CUpnpService& service = aAction->Service(); - if( service.ServiceType().Length() <= 0 ) - { - return KErrArgument; - } - const TDesC8& uuid = service.Device().Uuid(); - if (aAction->Name().Compare(KGetSearchCapabilities) == 0) - { - iAVControlPointObserver.CdsSearchCapabilitiesResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KSearchCaps ) - ); - } - else if (aAction->Name().Compare(KGetSortCapabilities) == 0) - { - iAVControlPointObserver.CdsSortCapabilitiesResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KSortCaps ) - ); - } - else if (aAction->Name().Compare(KGetSystemUpdateID) == 0) - { - const TDesC8& systemUpdateId = aAction->ArgumentValue( KId ); - TLex8 updateidLex( systemUpdateId ); - TInt systemUpdate; - updateidLex.Val( systemUpdate ); - - iAVControlPointObserver.CdsSystemUpdateIdResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - systemUpdate - ); - } - else if (aAction->Name().Compare(KBrowse) == 0) - { - const TDesC8& numberReturned = aAction->ArgumentValue( KNumberReturned ); - TLex8 returnedLex( numberReturned ); - TInt numberReturnedInt; - returnedLex.Val( numberReturnedInt ); - - const TDesC8& totalmatches = aAction->ArgumentValue( KTotalMatches ); - TLex8 matchesLex( totalmatches ); - TInt totalMatchesInt; - matchesLex.Val( totalMatchesInt ); - - const TDesC8& updateId = aAction->ArgumentValue( KUpdateID ); - TLex8 updateLex( updateId ); - TInt updateIdInt; - updateLex.Val( updateIdInt ); - - const TDesC8& startIndex = aAction->ArgumentValue( KStartingIndex ); - TLex8 indexLex( startIndex ); - TInt indexInt; - indexLex.Val( indexInt ); - - const TDesC8& requestCount = aAction->ArgumentValue( KRequestedCount ); - TLex8 requestLex( requestCount ); - TInt requestInt; - requestLex.Val( requestInt ); - - iAVControlPointObserver.CdsBrowseResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KObjectID ), - aAction->ArgumentValue( KBrowseFlag ), - aAction->ArgumentValue( KFilter ), - indexInt, - requestInt, - aAction->ArgumentValue( KSortCriteria ), - aAction->ArgumentValue( KResult ), - numberReturnedInt, - totalMatchesInt, - aAction->ArgumentValue( KUpdateID ) - ); - } - else if (aAction->Name().Compare(KSearch) == 0) - { - - const TDesC8& numberReturned = aAction->ArgumentValue( KNumberReturned ); - TLex8 returnedLex( numberReturned ); - TInt numberReturnedInt; - returnedLex.Val( numberReturnedInt ); - - const TDesC8& totalmatches = aAction->ArgumentValue( KTotalMatches ); - TLex8 matchesLex( totalmatches ); - TInt totalMatchesInt; - matchesLex.Val( totalMatchesInt ); - - const TDesC8& updateId = aAction->ArgumentValue( KUpdateID ); - TLex8 updateLex( updateId ); - TInt updateIdInt; - updateLex.Val( updateIdInt ); - - const TDesC8& startingIndex = aAction->ArgumentValue( KStartingIndex ); - TLex8 indexLex( startingIndex ); - TInt indexInt; - indexLex.Val( indexInt ); - - const TDesC8& reqCnt = aAction->ArgumentValue( KRequestedCount ); - TLex8 requestLex( reqCnt ); - TInt requestInt; - requestLex.Val( requestInt ); - - iAVControlPointObserver.CdsSearchResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KContainerID ), - aAction->ArgumentValue( KSearchCriteria ), - aAction->ArgumentValue( KFilter ), - indexInt, - requestInt, - aAction->ArgumentValue( KSortCriteria ), - aAction->ArgumentValue( KResult ), - numberReturnedInt, - totalMatchesInt, - aAction->ArgumentValue( KUpdateID ) - ); - } - else if (aAction->Name().Compare(KDestroyObject) == 0) - { - iAVControlPointObserver.CdsDestroyObjectResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KObjectID ) - ); - } - else if (aAction->Name().Compare(KUpdateObject) == 0) - { - iAVControlPointObserver.CdsUpdateObjectResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KObjectID ), - aAction->ArgumentValue( KCurrentTagValue ), - aAction->ArgumentValue( KNewTagValue ) - ); - } - else if (aAction->Name().Compare(KImportResource) == 0) - { - iAVControlPointObserver.CdsImportResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KSourceURI ), - aAction->ArgumentValue( KDestinationURI ), - aAction->ArgumentValue( KTransferID ) - ); - } - else if (aAction->Name().Compare(KExportResource) == 0) - { - iAVControlPointObserver.CdsExportResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KSourceURI ), - aAction->ArgumentValue( KDestinationURI ), - aAction->ArgumentValue( KTransferID ) - ); - } - else if (aAction->Name().Compare(KStopTransferResource) == 0) - { - iAVControlPointObserver.CdsStopTransferResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KTransferID ) - ); - } - else if (aAction->Name().Compare(KGetTransferProgress) == 0) - { - iAVControlPointObserver.CdsCTransferProgressResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue( KTransferID ), - aAction->ArgumentValue( KTransferStatus ), - aAction->ArgumentValue( KTransferLength ), - aAction->ArgumentValue( KTransferTotal ) - ); - } - else if (aAction->Name().Compare(KDeleteResource) == 0) - { - iAVControlPointObserver.CdsDeleteResourceResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue(KResourceURI) - ); - } - else if (aAction->Name().Compare(KCreateReference) == 0) - { - iAVControlPointObserver.CdsCreateReferenceResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue(KContainerID), - aAction->ArgumentValue(KObjectID), - aAction->ArgumentValue(KNewID) - ); - } - else if (aAction->Name().Compare(KCreateObject) == 0) - { - iAVControlPointObserver.CdsCreateObjectResponse( - uuid, - aAction->SessionId(), - aAction->Error(), - aAction->ArgumentValue(KContainerID), - aAction->ArgumentValue(KElements), - aAction->ArgumentValue(KObjectID), - aAction->ArgumentValue(KResult) - ); - } - else - { - return KErrArgument; - } - return KErrNone; - } - -//End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/src/upnpavcontrolpoint.cpp --- a/upnpavcontrolpoint/avcontrolframework/src/upnpavcontrolpoint.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1857 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpAVControlPoint -* -*/ - - -// INCLUDE FILES -#include "upnpavcontrolpoint.h" -#include "upnpargument.h" - -#include "upnpstateupdatehandler.h" -#include "upnpactionresponsehandler.h" -#include "upnpavtactionfactory.h" -#include "upnpcdsactionfactory.h" -#include "upnpcmactionfactory.h" -#include "upnprcactionfactory.h" -#define KLogFile _L("UPnPStack.txt") -#include "upnpcustomlog.h" -#include "upnpcons.h" - - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CUpnpAVControlPoint* CUpnpAVControlPoint::NewL( - MUpnpAVControlPointObserver& aAVControlPointObserver) - { - CUpnpAVControlPoint* self = - new (ELeave) CUpnpAVControlPoint(aAVControlPointObserver); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CUpnpAVControlPoint -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C CUpnpAVControlPoint::CUpnpAVControlPoint( - MUpnpAVControlPointObserver& aAVControlPointObserver) - : CUpnpControlPoint(), - iAVControlPointObserver(aAVControlPointObserver) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::ConstructL( ) - { - _LIT8( KMediaServer, "urn:schemas-upnp-org:device:MediaServer" ); - _LIT8( KMediaRenderer, "urn:schemas-upnp-org:device:MediaRenderer" ); - - CDesC8ArrayFlat* targetDeviceTypes = new(ELeave) CDesC8ArrayFlat(1); - CleanupStack::PushL( targetDeviceTypes ); - targetDeviceTypes->AppendL( KMediaServer() ); - targetDeviceTypes->AppendL( KMediaRenderer() ); - CUpnpControlPoint::ConstructL( *targetDeviceTypes ); - CleanupStack::Pop( targetDeviceTypes ); - targetDeviceTypes->Reset(); - delete targetDeviceTypes; - targetDeviceTypes = NULL; - - TPtrC8 devicePtr; - devicePtr.Set( UpnpSSDP::KUPnPRootDevice ); - SearchL( devicePtr ); - - iStateUpdateHandler = CUpnpStateUpdateHandler::NewL( - iAVControlPointObserver, - *this ); - iActionResponseHandler = CUpnpActionResponseHandler::NewL( - iAVControlPointObserver, - *this ); - - iAvtActionFactory = CUpnpAvtActionFactory::NewL( - iAVControlPointObserver, - *this ); - iCdsActionFactory = CUpnpCdsActionFactory::NewL( - iAVControlPointObserver, - *this ); - iCmActionFactory = CUpnpCmActionFactory::NewL( - iAVControlPointObserver, - *this ); - iRcActionFactory = CUpnpRcActionFactory::NewL( - iAVControlPointObserver, - *this ); - - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::~CUpnpAVControlPoint -// Destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CUpnpAVControlPoint::~CUpnpAVControlPoint() - { - delete iStateUpdateHandler; - delete iActionResponseHandler; - delete iAvtActionFactory; - delete iCdsActionFactory; - delete iCmActionFactory; - delete iRcActionFactory; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::InitializeCdsActionFactoryL -// Initialize CdsActionFactory if is NULL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::InitializeCdsActionFactoryL() - { - - if (!iCdsActionFactory) - { - iCdsActionFactory = CUpnpCdsActionFactory::NewL( - iAVControlPointObserver, - *this ); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::StateUpdatedL -// This function implements an inteface and forwards request -// to stateupdate handler. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::StateUpdatedL(CUpnpService* aService) - { - iStateUpdateHandler->StateUpdated( aService ); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::DeviceDiscoveredL -// This function implements an inteface and notifies an observer. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::DeviceDiscoveredL(CUpnpDevice* aDevice) - { - iAVControlPointObserver.DeviceDiscoveredL( aDevice ); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::DeviceDisappearedL -// This function implements an inteface and notifies an observer. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::DeviceDisappearedL(CUpnpDevice* aDevice) - { - iAVControlPointObserver.DeviceDisappearedL(aDevice); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::ActionResponseReceivedL -// This function ralizes an interface. Functionality is located in separate -// handler class. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::ActionResponseReceivedL(CUpnpAction* aAction) - { - TInt err = iActionResponseHandler->ActionResponseReceived( aAction ); -#ifdef _DEBUG - if (err != KErrNone) - { - LOGS("Error in action response received."); - } -#endif //_DEBUG - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::HttpResponseReceivedL -// This function implements an inteface and notifies an observer. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::HttpResponseReceivedL(CUpnpHttpMessage* aMessage) - { - iAVControlPointObserver.HttpResponseL( aMessage ); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::Service -// This function returns a pointer to appropriate service instance. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C CUpnpService* CUpnpAVControlPoint::Service( CUpnpDevice* aMediaServer, - const TDesC8& aServiceType ) - { - RPointerArray& services = aMediaServer->ServiceList(); - - for( TInt i(0); i < services.Count(); i++ ) - { - if( services[i]->ServiceType().Match( aServiceType ) != KErrNotFound ) - { - return services[i]; - } - } - return NULL; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtSetTransportUriActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtSetTransportUriActionL(const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aCurrentUri, - const TDesC8& aCurrentMetaData) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtSetTransportUriActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aCurrentUri, - aCurrentMetaData - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtSetNextTransportUriActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtSetNextTransportUriActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aNextUri, - const TDesC8& aNextMetaData) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtSetNextTransportUriActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aNextUri, - aNextMetaData - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtSeekActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtSeekActionL(const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aUnit, - const TDesC8& aTarget) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtSeekActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aUnit, - aTarget - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtMediaInfoActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtMediaInfoActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtMediaInfoActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtTransportInfoActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtTransportInfoActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtTransportInfoActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtPositionInfoActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtPositionInfoActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtPositionInfoActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtDeviceCapabilitiesActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtDeviceCapabilitiesActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtTransportSettingsActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtTransportSettingsActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtTransportSettingsActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtStopActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtStopActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtStopActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtPlayActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtPlayActionL(const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aSpeed) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtPlayActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aSpeed - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtPauseActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtPauseActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtPauseActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtRecordActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtRecordActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtRecordActionLC( - action, - (CUpnpDevice*)device, - aInstanceId ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtNextActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtNextActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtNextActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtPreviousActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtPreviousActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtPreviousActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtSetPlayModeActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtSetPlayModeActionL(const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aPlayMode) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtSetPlayModeActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aPlayMode - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtSetRecordModeActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtSetRecordModeActionL(const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aRecordMode) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtSetRecordModeActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aRecordMode - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::AvtTransportsActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::AvtTransportsActionL(const TDesC8& aUuid, - TInt aInstanceId) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iAvtActionFactory->AvtTransportsActionLC( - action, - (CUpnpDevice*)device, - aInstanceId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsBrowseActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsBrowseActionL(const TDesC8& aUuid, - const TDesC8& aObjectId, - const TDesC8& aBrowseFlag, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsBrowseActionLC( - action, - (CUpnpDevice*)device, - aObjectId, - aBrowseFlag, - aFilter, - aStartingIndex, - aRequestedCount, - aSortCriteria - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsSearchActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsSearchActionL(const TDesC8& aUuid, - const TDesC8& aObjectId, - const TDesC8& aSearchCriteria, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsSearchActionLC( - action, - (CUpnpDevice*)device, - aObjectId, - aSearchCriteria, - aFilter, - aStartingIndex, - aRequestedCount, - aSortCriteria - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsSystemUpdateIdActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsSystemUpdateIdActionL(const TDesC8& aUuid) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsSystemUpdateIdActionLC( - action, - (CUpnpDevice*)device - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsSearchCapabilitiesActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsSearchCapabilitiesActionL(const TDesC8& aUuid) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsSearchCapabilitiesActionLC( - action, - (CUpnpDevice*)device - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsSortCapabilitiesActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsSortCapabilitiesActionL(const TDesC8& aUuid) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsSortCapabilitiesActionLC( - action, - (CUpnpDevice*)device - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsCreateObjectActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsCreateObjectActionL(const TDesC8& aUuid, - const TDesC8& aId, - const TDesC8& aElements) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsCreateObjectActionLC( - action, - (CUpnpDevice*)device, - aId, - aElements - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsImportResourceActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsImportResourceActionL(const TDesC8& aUuid, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsImportResourceActionLC( - action, - (CUpnpDevice*)device, - aSourceUri, - aDestinationUri - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsExportResourceActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsExportResourceActionL(const TDesC8& aUuid, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsExportResourceActionLC( - action, - (CUpnpDevice*)device, - aSourceUri, - aDestinationUri - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsCreateReferenceActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsCreateReferenceActionL( - const TDesC8& aUuid, - const TDesC8& aDestinationContainerId, - const TDesC8& aSourceObjectId ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsCreateReferenceActionLC( - action, - (CUpnpDevice*)device, - aDestinationContainerId, - aSourceObjectId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsDeleteResourceActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsDeleteResourceActionL(const TDesC8& aUuid, - const TDesC8& aResourceUri ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsDeleteResourceActionLC( - action, - (CUpnpDevice*)device, - aResourceUri - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsDestroyObjectActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsDestroyObjectActionL(const TDesC8& aUuid, - const TDesC8& aObjectId ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsDestroyObjectActionLC( - action, - (CUpnpDevice*)device, - aObjectId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsStopTransferActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsStopTransferActionL(const TDesC8& aUuid, - TInt aTransferId ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsStopTransferActionLC( - action, - (CUpnpDevice*)device, - aTransferId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsTransferProgressActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsTransferProgressActionL(const TDesC8& aUuid, - TInt aTransferId ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsTransferProgressActionLC( - action, - (CUpnpDevice*)device, - aTransferId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CdsUpdateObjectActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CdsUpdateObjectActionL(const TDesC8& aUuid, - const TDesC8& aObjectID, - const TDesC8& aCurrentTagValue, - const TDesC8& aNewTagValue ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCdsActionFactory->CdsUpdateObjectActionLC( - action, - (CUpnpDevice*)device, - aObjectID, - aCurrentTagValue, - aNewTagValue - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CmProtocolInfoActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CmProtocolInfoActionL( - const TDesC8& aUuid) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCmActionFactory->CmProtocolInfoActionLC( - action, - (CUpnpDevice*)device - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CmCurrentConnectionsActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CmCurrentConnectionsActionL(const TDesC8& aUuid) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCmActionFactory->CmCurrentConnectionsActionLC( - action, - (CUpnpDevice*)device - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CmPrepareConnectionActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CmPrepareConnectionActionL( - const TDesC8& aUuid, - const TDesC8& aRemoteProtocolInfo, - const TDesC8& aPeerConnectionManager, - TInt aPeerConnectionID, - const TDesC8& aDirection - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCmActionFactory->CmPrepareConnectionActionLC( - action, - (CUpnpDevice*)device, - aRemoteProtocolInfo, - aPeerConnectionManager, - aPeerConnectionID, - aDirection - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CmConnectionCompleteActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CmConnectionCompleteActionL( - const TDesC8& aUuid, - TInt aConnectionId - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCmActionFactory->CmConnectionCompleteActionLC( - action, - (CUpnpDevice*)device, - aConnectionId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::CmCurrentConnectionInfoActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::CmCurrentConnectionInfoActionL( - const TDesC8& aUuid, - TInt aConnectionId - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iCmActionFactory->CmCurrentConnectionInfoActionLC( - action, - (CUpnpDevice*)device, - aConnectionId - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::RcGetVolumetActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::RcGetVolumetActionL( - const TDesC8& aUuid, - TInt aInstanceID, - const TDesC8& aChannel - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iRcActionFactory->RcGetVolumeActionLC( - action, - (CUpnpDevice*)device, - aInstanceID, - aChannel - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::RcSetVolumetActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::RcSetVolumetActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aChannel, - TInt aVolume - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iRcActionFactory->RcSetVolumeActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aChannel, - aVolume - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::RcGetMuteActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::RcGetMuteActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aChannel - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iRcActionFactory->RcGetMuteActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aChannel - ); - - if( err == KErrNone ) - { - - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::RcSetMuteActionL -// This function creates and sends a action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CUpnpAVControlPoint::RcSetMuteActionL( - const TDesC8& aUuid, - TInt aInstanceId, - const TDesC8& aChannel, - const TDesC8& aMute - ) - { - const CUpnpDevice* device = Device( aUuid ); - if( !device ) - { - return KErrBadHandle; - } - else - { - CUpnpAction* action = NULL; - TInt err( KErrNone ); - err = iRcActionFactory->RcSetMuteActionLC( - action, - (CUpnpDevice*)device, - aInstanceId, - aChannel, - aMute - ); - - if( err == KErrNone ) - { - SendL( action ); - CleanupStack::Pop( action ); - - return action->SessionId(); - } - else - { - return err; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVControlPoint::NetworkEvent -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpAVControlPoint::NetworkEvent( CUpnpNetworkEventBase* aEvent ) - { - CUpnpControlPoint::NetworkEvent( aEvent ); - TRAP_IGNORE( SearchL( UpnpSSDP::KUPnPRootDevice ) ); - } - -//end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/src/upnpavtactionfactory.cpp --- a/upnpavcontrolpoint/avcontrolframework/src/upnpavtactionfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,595 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Produces avt actions -* -*/ - - -// INCLUDE FILES -#include "upnpavtactionfactory.h" -#include "upnpavcontrolpoint.h" -#include "upnpavcpstring.h" - -// CONSTANTS -using namespace UpnpAVCPStrings; -const TInt KMaxIntLength = 10; - -// ============================= LOCAL FUNCTIONS =============================== - - - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::CUpnpAvtActionFactory -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpAvtActionFactory::CUpnpAvtActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) -:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpAvtActionFactory::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpAvtActionFactory* CUpnpAvtActionFactory::NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) - { - CUpnpAvtActionFactory* self = new (ELeave) CUpnpAvtActionFactory( - aAVCPObserver, - aAVCP ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::~CUpnpAvtActionFactory -// Destructor -// ----------------------------------------------------------------------------- -// -CUpnpAvtActionFactory::~CUpnpAvtActionFactory() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtSetTransportUriActionLC -// Creates an action for setting URI for transport. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtSetTransportUriActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aCurrentUri, - const TDesC8& aCurrentMetaData) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KSetAVTransportURI ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - aAction->SetArgumentL( KCurrentURI, aCurrentUri ); - aAction->SetArgumentL( KCurrentURIMetaData, aCurrentMetaData ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtSetNextTransportUriActionLC -// Creates an action for setting URI for next transport. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtSetNextTransportUriActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aNextUri, - const TDesC8& aNextMetaData) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KSetNextAVTransportURI ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - aAction->SetArgumentL( KNextURI, aNextUri ); - aAction->SetArgumentL( KNextURIMetaData, aNextMetaData ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtSeekActionLC -// Creates an action for seeking through the resource. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtSeekActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aUnit, - const TDesC8& aTarget) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KSeek ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - aAction->SetArgumentL( KUnit, aUnit ); - aAction->SetArgumentL( KTarget, aTarget ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtMediaInfoActionLC -// Creates an action for gettin media info. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtMediaInfoActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KGetMediaInfo ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtTransportInfoActionLC -// Creates an action for gettting transport info. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtTransportInfoActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KGetTransportInfo ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtPositionInfoActionLC -// Creates an action for getting position info. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtPositionInfoActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KGetPositionInfo ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtDeviceCapabilitiesActionLC -// Creates an action for getting device capabilities. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtDeviceCapabilitiesActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KGetDeviceCapabilities ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtTransportSettingsActionLC -// Creates an action for getting transport settings. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtTransportSettingsActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KGetTransportSettings ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtStopActionLC -// Creates an action for stopping transport. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtStopActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KStop ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtPlayActionLC -// Creates an action for playing. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtPlayActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aSpeed) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KPlay ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - aAction->SetArgumentL( KSpeed, aSpeed ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtPauseActionLC -// Creates an action for pause. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtPauseActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KPause ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtRecordActionLC -// Creates an action for recording. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtRecordActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KRecord ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtNextActionLC -// Creates an action for playing next item. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtNextActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KNext ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtPreviousActionLC -// Creates an action for palying previous item. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtPreviousActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KPrevious ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtSetPlayModeActionLC -// Creates an action for setting playmode. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtSetPlayModeActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aPlayMode) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KSetPlayMode ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - aAction->SetArgumentL( KNewPlayMode, aPlayMode ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtSetRecordModeActionLC -// Creates an action for setting record quality mode. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtSetRecordModeActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId, - const TDesC8& aRecordMode) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KSetRecordQualityMode ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - aAction->SetArgumentL( KNewRecordQualityMode, aRecordMode ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpAvtActionFactory::AvtTransportsActionLC -// Creates an action for getting current transports info. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpAvtActionFactory::AvtTransportsActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaRenderer, - TInt aInstanceId) - { - CUpnpService* service = iAVCP.Service(aMediaRenderer, KAVTransport); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceId ); - - aAction = service->CreateActionLC( KGetCurrentTransportActions ); - if( aAction ) - { - aAction->SetArgumentL( KInstanceID, instanceId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -//end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/src/upnpcdsactionfactory.cpp --- a/upnpavcontrolpoint/avcontrolframework/src/upnpcdsactionfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,507 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Produces cds actions -* -*/ - - -// INCLUDE FILES -#include "upnpcdsactionfactory.h" -#include "upnpavcontrolpoint.h" - -#include "upnpavcpstring.h" - -// CONSTANTS -using namespace UpnpAVCPStrings; -const TInt KMaxIntLength = 10; - -// ============================= LOCAL FUNCTIONS =============================== - - - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CUpnpCdsActionFactory -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpCdsActionFactory::CUpnpCdsActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) -:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpCdsActionFactory::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpCdsActionFactory* CUpnpCdsActionFactory::NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) - { - CUpnpCdsActionFactory* self = new (ELeave) CUpnpCdsActionFactory( - aAVCPObserver, - aAVCP ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::~CUpnpCdsActionFactory -// Destructor -// ----------------------------------------------------------------------------- -// -CUpnpCdsActionFactory::~CUpnpCdsActionFactory() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsBrowseActionLC -// Creates a browsing action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsBrowseActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectId, - const TDesC8& aBrowseFlag, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC(KBrowse); - - if( aAction ) - { - TBuf8 startingIndexDes; - startingIndexDes.Num(aStartingIndex); - TBuf8 requestedCount; - requestedCount.Num( aRequestedCount ); - - aAction->SetArgumentL( KObjectID(), aObjectId ); - aAction->SetArgumentL( KBrowseFlag(), aBrowseFlag ); - aAction->SetArgumentL( KFilter(), aFilter ); - aAction->SetArgumentL( KStartingIndex(), startingIndexDes ); - aAction->SetArgumentL( KRequestedCount(), requestedCount ); - aAction->SetArgumentL( KSortCriteria(), aSortCriteria ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsSearchActionLC -// Creates a search action. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsSearchActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectId, - const TDesC8& aSearchCriteria, - const TDesC8& aFilter, - TInt aStartingIndex, - TInt aRequestedCount, - const TDesC8& aSortCriteria) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC(KSearch); - - if( aAction ) - { - TBuf8 startingIndexDes; - startingIndexDes.Num(aStartingIndex); - TBuf8 requestedCount; - requestedCount.Num( aRequestedCount ); - - aAction->SetArgumentL( KContainerID(), aObjectId ); - aAction->SetArgumentL( KSearchCriteria(), aSearchCriteria ); - aAction->SetArgumentL( KFilter(), aFilter ); - aAction->SetArgumentL( KStartingIndex(), startingIndexDes ); - aAction->SetArgumentL( KRequestedCount(), requestedCount ); - aAction->SetArgumentL( KSortCriteria(), aSortCriteria ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsSystemUpdateIdActionLC -// Creates an action for content directory systemUpdateID query. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsSystemUpdateIdActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KGetSystemUpdateID ); - - if( aAction ) - { - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsSearchCapabilitiesActionLC -// Creates an action for content directory systemUpdateID query. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsSearchCapabilitiesActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KGetSearchCapabilities ); - - if( aAction ) - { - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsSortCapabilitiesActionLC -// Creates an action for content directory systemUpdateID query. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsSortCapabilitiesActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KGetSortCapabilities ); - - if( aAction ) - { - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsCreateObjectActionLC -// Creates an action for creating new content in content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsCreateObjectActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aId, - const TDesC8& aElements) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KCreateObject ); - - if( aAction ) - { - aAction->SetArgumentL( KContainerID, aId ); - aAction->SetArgumentL( KElements, aElements); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsImportResourceActionLC -// Creates an action for importing content in content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsImportResourceActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KImportResource ); - - if( aAction ) - { - aAction->SetArgumentL( KSourceURI, aSourceUri ); - aAction->SetArgumentL( KDestinationURI, aDestinationUri); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsExportResourceActionLC -// Creates an action for exporting content in content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsExportResourceActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aSourceUri, - const TDesC8& aDestinationUri) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KExportResource ); - - if( aAction ) - { - aAction->SetArgumentL( KSourceURI, aSourceUri ); - aAction->SetArgumentL( KDestinationURI, aDestinationUri); - - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsCreateReferenceActionLC -// Creates an action for exporting content in content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsCreateReferenceActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aDestinationContainerId, - const TDesC8& aSourceObjectId) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KCreateReference ); - - if( aAction ) - { - aAction->SetArgumentL( KContainerID, aDestinationContainerId ); - aAction->SetArgumentL( KObjectID, aSourceObjectId); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsDestroyObjectActionLC -// Creates an action for destroying object from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsDestroyObjectActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectId) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KDestroyObject ); - - if( aAction ) - { - aAction->SetArgumentL( KObjectID, aObjectId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsDeleteResourceActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsDeleteResourceActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aResourceUri) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KDeleteResource ); - - if( aAction ) - { - aAction->SetArgumentL( KResourceURI, aResourceUri ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsStopTransferActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsStopTransferActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - TInt aTransferId) - { - TBuf8 transferIdDes; - transferIdDes.Num(aTransferId); - - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KStopTransferResource ); - - if( aAction ) - { - aAction->SetArgumentL( KTransferID, transferIdDes ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsTransferProgressActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsTransferProgressActionLC(CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - TInt aTransferId) - { - TBuf8 transferIdDes; - transferIdDes.Num(aTransferId); - - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KGetTransferProgress ); - - if( aAction ) - { - aAction->SetArgumentL( KTransferID, transferIdDes ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::CdsUpdateObjectActionLC -// Creates an action for updating objects in content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCdsActionFactory::CdsUpdateObjectActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aMediaServer, - const TDesC8& aObjectID, - const TDesC8& aCurrentTagValue, - const TDesC8& aNewTagValue) - { - CUpnpService* service = iAVCP.Service(aMediaServer, KContentDirectory); - if( !service ) - { - return KErrUnknown; - } - - aAction = service->CreateActionLC( KUpdateObject ); - - if( aAction ) - { - aAction->SetArgumentL( KObjectID, aObjectID ); - aAction->SetArgumentL( KCurrentTagValue, aCurrentTagValue ); - aAction->SetArgumentL( KNewTagValue, aNewTagValue ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/src/upnpcmactionfactory.cpp --- a/upnpavcontrolpoint/avcontrolframework/src/upnpcmactionfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Produces cm actions -* -*/ - - -// INCLUDE FILES -#include "upnpcmactionfactory.h" -#include "upnpavcontrolpoint.h" -#include "upnpavcpstring.h" - -// CONSTANTS -using namespace UpnpAVCPStrings; -const TInt KMaxIntLength = 10; - -// ============================= LOCAL FUNCTIONS =============================== - - - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::CUpnpCmActionFactory -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpCmActionFactory::CUpnpCmActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) -:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpCmActionFactory::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpCmActionFactory* CUpnpCmActionFactory::NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) - { - CUpnpCmActionFactory* self = new (ELeave) CUpnpCmActionFactory( - aAVCPObserver, - aAVCP ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::~CUpnpCmActionFactory -// Destructor. -// ----------------------------------------------------------------------------- -// -CUpnpCmActionFactory::~CUpnpCmActionFactory() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::CmProtocolInfoActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCmActionFactory::CmProtocolInfoActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice) - { - CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KGetProtocolInfo ); - - if( aAction ) - { - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::CmCurrentConnectionsActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCmActionFactory::CmCurrentConnectionsActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice) - { - CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KGetCurrentConnectionIDs ); - - if( aAction ) - { - return KErrNone; - } - else - { - return KErrGeneral; - } - } - // ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::CmPrepareConnectionActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCmActionFactory::CmPrepareConnectionActionLC( - CUpnpAction*& aAction, - CUpnpDevice* aDevice, - const TDesC8& aRemoteProtocolInfo, - const TDesC8& aPeerConnectionManager, - TInt aPeerConnectionID, - const TDesC8& aDirection - ) - { - CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager); - if( !service ) - { - return KErrUnknown; - } - TBuf8 conId; - conId.Num( aPeerConnectionID ); - aAction = service->CreateActionLC( KPrepareForConnection ); - - if( aAction ) - { - aAction->SetArgumentL( KRemoteProtocolInfo(), aRemoteProtocolInfo ); - aAction->SetArgumentL( KPeerConnectionManager(), aPeerConnectionManager ); - aAction->SetArgumentL( KPeerConnectionID(), conId ); - aAction->SetArgumentL( KDirection(), aDirection ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::CmConnectionCompleteActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCmActionFactory::CmConnectionCompleteActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aConnectionId) - { - CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KConnectionComplete ); - - if( aAction ) - { - TBuf8 connectionId; - connectionId.Num(aConnectionId); - aAction->SetArgumentL( KConnectionID, connectionId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCmActionFactory::CmCurrentConnectionInfoActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpCmActionFactory::CmCurrentConnectionInfoActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aConnectionId) - { - CUpnpService* service = iAVCP.Service(aDevice, KConnectionManager); - if( !service ) - { - return KErrUnknown; - } - aAction = service->CreateActionLC( KGetCurrentConnectionInfo ); - - if( aAction ) - { - TBuf8 connectionId; - connectionId.Num(aConnectionId); - aAction->SetArgumentL( KConnectionID, connectionId ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/src/upnprcactionfactory.cpp --- a/upnpavcontrolpoint/avcontrolframework/src/upnprcactionfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Produces rc actions -* -*/ - - -// INCLUDE FILES -#include "upnprcactionfactory.h" -#include "upnpavcontrolpoint.h" -#include "upnpavcpstring.h" - -// CONSTANTS -using namespace UpnpAVCPStrings; -const TInt KMaxIntLength = 10; - -// ============================= LOCAL FUNCTIONS =============================== - - - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CUpnpRcActionFactory::CUpnpRcActionFactory -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpRcActionFactory::CUpnpRcActionFactory( MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) -:iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpRcActionFactory::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpRcActionFactory::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CSuperDir::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpRcActionFactory* CUpnpRcActionFactory::NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) - { - CUpnpRcActionFactory* self = new (ELeave) CUpnpRcActionFactory( - aAVCPObserver, - aAVCP ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpRcActionFactory::~CUpnpRcActionFactory -// Destructor -// ----------------------------------------------------------------------------- -// -CUpnpRcActionFactory::~CUpnpRcActionFactory() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpRcActionFactory::RcGetVolumeActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpRcActionFactory::RcGetVolumeActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel) - { - CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceID ); - - aAction = service->CreateActionLC( KGetVolume ); - - if ( aAction ) - { - aAction->SetArgumentL( KInstanceID(), instanceId ); - aAction->SetArgumentL( KChannel(), aChannel ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpRcActionFactory::RcSetVolumeActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpRcActionFactory::RcSetVolumeActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel, - TInt aVolume) - { - CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceID ); - TBuf8 volume; - volume.Num( aVolume ); - - aAction = service->CreateActionLC( KSetVolume ); - - if ( aAction ) - { - aAction->SetArgumentL( KInstanceID(), instanceId ); - aAction->SetArgumentL( KChannel(), aChannel ); - aAction->SetArgumentL( KDesiredVolume(), volume ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::RcGetMuteActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpRcActionFactory::RcGetMuteActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel) - { - CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceID ); - - aAction = service->CreateActionLC( KGetMute ); - - if ( aAction ) - { - aAction->SetArgumentL( KInstanceID(), instanceId ); - aAction->SetArgumentL( KChannel(), aChannel ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } -// ----------------------------------------------------------------------------- -// CUpnpCdsActionFactory::RcSetMuteActionLC -// Creates an action for deleting resource from content directory. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpRcActionFactory::RcSetMuteActionLC(CUpnpAction*& aAction, - CUpnpDevice* aDevice, - TInt aInstanceID, - const TDesC8& aChannel, - const TDesC8& aMute) - { - CUpnpService* service = iAVCP.Service(aDevice, KRenderingControl); - if( !service ) - { - return KErrUnknown; - } - TBuf8 instanceId; - instanceId.Num( aInstanceID ); - - aAction = service->CreateActionLC( KSetMute ); - - if ( aAction ) - { - aAction->SetArgumentL( KInstanceID(), instanceId ); - aAction->SetArgumentL( KChannel(), aChannel ); - aAction->SetArgumentL( KDesiredMute(), aMute ); - return KErrNone; - } - else - { - return KErrGeneral; - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcontrolframework/src/upnpstateupdatehandler.cpp --- a/upnpavcontrolpoint/avcontrolframework/src/upnpstateupdatehandler.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,248 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpStateUpdateHandler -* -*/ - - -// INCLUDE FILES -#include "upnpstateupdatehandler.h" -#include "upnpavcpstring.h" - -// CONSTANTS -using namespace UpnpAVCPStrings; -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::CUpnpStateUpdateHandler -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpStateUpdateHandler::CUpnpStateUpdateHandler( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) - :iAVControlPointObserver( aAVCPObserver ), iAVCP( aAVCP ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpStateUpdateHandler::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CSuperDir::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpStateUpdateHandler* CUpnpStateUpdateHandler::NewL( - MUpnpAVControlPointObserver& aAVCPObserver, - CUpnpAVControlPoint& aAVCP ) - { - CUpnpStateUpdateHandler* self = new (ELeave) CUpnpStateUpdateHandler( - aAVCPObserver, aAVCP ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::~CUpnpStateUpdateHandler -// Destructor -// ----------------------------------------------------------------------------- -// -CUpnpStateUpdateHandler::~CUpnpStateUpdateHandler() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::ContentDirectoryStateUpdated -// In this function are update events from content directory handled. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpStateUpdateHandler::ContentDirectoryStateUpdated( CUpnpDevice& aDevice, - CUpnpService*& aService) - { - CUpnpStateVariable* systemUpdateId = - aService->StateVariable( KSystemUpdateID ); - CUpnpStateVariable* containerUpdateIds = - aService->StateVariable( KContainerUpdateIDs ); - CUpnpStateVariable* transferIds = - aService->StateVariable( KTransferIds ); - - if( !(systemUpdateId || containerUpdateIds || transferIds) ) - { - return KErrArgument; - } - - // - if( systemUpdateId ) - { - TLex8 updateidLex( systemUpdateId->Value() ); - TInt systemUpdate; - updateidLex.Val( systemUpdate ); - iAVControlPointObserver.CdsUpdateEvent( - aDevice.Uuid(), - systemUpdate - ); - } - if( containerUpdateIds ) - { - iAVControlPointObserver.CdsContainerEvent( - aDevice.Uuid(), - containerUpdateIds->Value() - ); - } - if( transferIds ) - { - iAVControlPointObserver.CdsTransferEvent( - aDevice.Uuid(), - transferIds->Value() - ); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::StateUpdatedL -// This is the place to start handling state updates -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpStateUpdateHandler::StateUpdated(CUpnpService*& aService) - { - TInt err( KErrNone ); - CUpnpDevice& device = aService->Device(); - if (aService->ServiceType().Match( KRenderingControl ) != KErrNotFound ) - { - err = RenderingControlStateUpdated( device, aService ); - } - else if (aService->ServiceType().Match( KConnectionManager ) != KErrNotFound ) - { - err = ConnectionManagerStateUpdated( device, aService ); - } - else if (aService->ServiceType().Match( KAVTransport ) != KErrNotFound ) - { - err = AVTransportStateUpdated( device, aService ); - } - else if (aService->ServiceType().Match( KContentDirectory ) != KErrNotFound ) - { - err = ContentDirectoryStateUpdated( device, aService ); - } - else - { - err = KErrGeneral; - } - return err; - - } -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::RenderingControlStateUpdated -// In this function are rendering control events are handled. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpStateUpdateHandler::RenderingControlStateUpdated( CUpnpDevice& aDevice, - CUpnpService*& aService ) - { - CUpnpStateVariable* lastChange = aService->StateVariable( KLastChange ); - if( !lastChange ) - { - return KErrArgument; - } - else - { - iAVControlPointObserver.RcLastChangeEvent( - aDevice.Uuid(), - lastChange->Value() - ); - return KErrNone; - } - } -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::KAVTransportStateUpdatedL -// In this function are updates for mediarenderer handled. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpStateUpdateHandler::AVTransportStateUpdated( CUpnpDevice& aDevice, - CUpnpService*& aService ) - { - CUpnpStateVariable* lastChange = aService->StateVariable( KLastChange ); - if( !lastChange ) - { - return KErrArgument; - } - else - { - iAVControlPointObserver.AvtLastChangeEvent( - aDevice.Uuid(), - lastChange->Value() - ); - return KErrNone; - } - } -// ----------------------------------------------------------------------------- -// CUpnpStateUpdateHandler::ConnectionManagerStateUpdated -// In this function are update events from rendering control handled. -// (other items were commented in a header) -// ----------------------------------------------------------------------------- -// -TInt CUpnpStateUpdateHandler::ConnectionManagerStateUpdated(CUpnpDevice& aDevice, - CUpnpService*& aService) - { - CUpnpStateVariable* source = - aService->StateVariable( KSourceProtocolInfo ); - CUpnpStateVariable* sink = - aService->StateVariable( KSinkProtocolInfo ); - CUpnpStateVariable* connections = - aService->StateVariable( KCurrentConnectionIds ); - - if( !(source || sink || connections) ) - { - return KErrArgument; - } - - if( source ) - { - iAVControlPointObserver.CmSourceEvent( - aDevice.Uuid(), - source->Value() - ); - } - if( sink ) - { - iAVControlPointObserver.CmSinkEvent( - aDevice.Uuid(), - sink->Value() - ); - } - if( connections ) - { - iAVControlPointObserver.CmConnectionsEvent( - aDevice.Uuid(), - connections->Value() - ); - } - - return KErrNone; - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/group/avcpengine.mmp --- a/upnpavcontrolpoint/avcpengine/group/avcpengine.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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 specification for AVCPEngine -* -*/ - -#include "../../../group/upnpplatformvar.hrh" - -TARGET avcpengine.exe -TARGETTYPE exe -UID 0x1000008d 0x101F977A -CAPABILITY CAP_SERVER -VENDORID VID_DEFAULT - -VERSION 10.1 -paged - -SOURCEPATH ../src -SOURCE upnpavcpenginesession.cpp -SOURCE upnpavcpengine.cpp -SOURCE upnpavcpenginehelper.cpp -SOURCE upnpavcpmanager.cpp -SOURCE upnppathelement.cpp -SOURCE upnppathresolver.cpp -SOURCE upnpresolvehandler.cpp -SOURCE upnpcommand.cpp -SOURCE upnpbrowsecommand.cpp -SOURCE upnpdevicelistcommand.cpp -SOURCE upnpdownloadcommand.cpp -SOURCE upnpuploadcommand.cpp -SOURCE upnpdeletecommand.cpp -SOURCE upnpcreatecommand.cpp -SOURCE upnpmetadatacommand.cpp - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../inc -USERINCLUDE ../../inc -USERINCLUDE ../inc - -LIBRARY euser.lib -LIBRARY insock.lib -LIBRARY esock.lib -LIBRARY upnpipserversutils.lib -LIBRARY ssdpserver.lib -LIBRARY avcontrolframework.lib -LIBRARY upnpserviceframework.lib -LIBRARY upnpcontrolpointbase.lib - -//XML -LIBRARY xmlengineutils.lib -LIBRARY xmlenginedom.lib -LIBRARY estlib.lib - -// file server -LIBRARY efsrv.lib -LIBRARY estor.lib - -LIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/group/bld.inf --- a/upnpavcontrolpoint/avcpengine/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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 info for AVCPEngine -* -*/ - -#include "../../../group/upnpplatformvar.hrh" -PRJ_EXPORTS -../inc/upnpmdebug.h |../../inc/upnpmdebug.h -../inc/upnpavcpenginecommon.h MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpenginecommon.h) -../inc/upnpavcpenginecommon.inl MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpenginecommon.inl) - -PRJ_MMPFILES -avcpengine.mmp \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Implementation of CServer2 -* -*/ - - -#ifndef C_CUPNPAVCPENGINE_H -#define C_CUPNPAVCPENGINE_H - -// INCLUDES -#include -#include "upnpavcpengine.pan" - -// FORWARD DECLARATIONS -class CUpnpAVCPEngineSession; -class CUpnpAVCPManager; - -// CLASS DECLARATION -/** -* Simple imlementatation of server from -* Symbian Client/Server architecture. -* -* @since Series 60 3.1 -*/ -class CUpnpAVCPEngine: public CServer2 - { - public : - /** - * Two-phased constructor. - */ - static CUpnpAVCPEngine* NewLC(); - /** - * Destructor. - */ - ~CUpnpAVCPEngine(); - /** - * Register new server-side session - * it is used for manage life-time of server - */ - void IncrementSessions(CUpnpAVCPEngineSession* aObserver); - /** - * Unregister new server-side session - * it is used for manage life-time of server - */ - void DecrementSessions(CUpnpAVCPEngineSession* aObserver); - /** - * Function stars server, creates CleanupStack and - * executes ThreadFunctionL() in TRAP - */ - static TInt ThreadFunction( TAny* aStarted ); - /** - * Function creates CActiveScheduler, CUpnpAVCPEngine and starts server. - */ - static void ThreadFunctionL(); - - protected: // From CActive - /** - * From CActive notify about leaves in CService2::ServiceL - */ - TInt RunError( TInt aError ); - - private: // New methods - /** - * C++ default constructor. - */ - CUpnpAVCPEngine( TInt aPriority ); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL() ; - /** - * Panic client thread - * - * @param aMessage message to be panic - * @param aReason panic code - */ - static void PanicClient( const RMessage2& aMessage, TAVCPEnginePanic aReason ); - /** - * Panic server - * - * @param aPanic panic code - */ - static void PanicServer( TAVCPEnginePanic aPanic ); - - private: // From CServer - /** - * From CActive notify about leaves in ServiceL - */ - CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; - - private: // Data - // count of session - TInt iSessionCount; - // AVCP manager - CUpnpAVCPManager* iAVCPManger; - }; - - -#endif // C_CUPNPAVCPENGINE_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.pan --- a/upnpavcontrolpoint/avcpengine/inc/upnpavcpengine.pan Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: Definition of AVCPEngine panic codes -* -*/ - - -#ifndef AVCPENGINE_PAN -#define AVCPENGINE_PAN - -/** Panic Category */ -_LIT(KAVCPEngine, "AVCPEngine"); - -/** AVCPEngine panic codes */ -enum TAVCPEnginePanic - { - EAVCPEngineGenerealPanic = 0, - EAVCPEngineBadRequest = 1 - }; -#endif // AVCPENGINE_PAN diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Common data -* -*/ - - -#ifndef C_UPNPAVCPENGINECOMMON_H -#define C_UPNPAVCPENGINECOMMON_H - -//INCLUDES -#include - - -// CONSTANTS -// Server name -_LIT( KAVCPEngineName, "AVCPEngine" ); -// Filename -_LIT( KAVCPEngineFilename, "AVCPEngine" ); - -_LIT8( KAVCPEngineFriendlyName, "friendlyName" ); - - -// The server version. A version must be specified when -// creating a session with the server -const TUint KAVCPEngineMajorVersionNumber=0; -const TUint KAVCPEngineMinorVersionNumber=1; -const TUint KAVCPEngineBuildVersionNumber=1; - -// ENUMERATIONS - -// Operation codes used in message passing between client and server -enum TAVCPEngineRqst - { - EPrepareDeviceList, - EDownloadDeviceList, - EPrepareDirList, - EDownloadDirList, - EDirAttributes, - EFileAttributes, - EGetFile, - EDeleteDirectory, - EDeleteFile, - ECreateDirectory, - ECreateFile, - EPutFile, - EPrepareMetadata, - EDownloadMetadata, - ESetMetadata - }; - -// maximum length of UDN -const TInt KUUIDLength = 50; -// maximum length of friendly-name -const TInt KFriendlyNameLength = 50; -// maximum length of mime type -const TInt KMimeLength = 100; - -// structure describing MS device -class TAVDevice - { - public: - TBuf8 iFriendlyName; - TBuf8 iUDN; - }; -// structure describing position in file, used for partial read -class TFilePosition - { - public: - TInt iStart; - TInt iLength; - TBool iFlags; - }; - -// structure describing file/directory -class TFileInfo - { - public: - inline TFileInfo(); - // file/directory name - TBuf8 iName; - // MIME type - TBuf8 iMimeType; - // attribute bits - TUint iAtt; - // file size in bytes - TInt iSize; - // last modified - TTime iModified; - }; - -#include "upnpavcpenginecommon.inl" - -#endif // C_UPNPAVCPENGINECOMMON_H - -// End Of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.inl --- a/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginecommon.inl Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: ?Description -* -*/ - - -inline TFileInfo::TFileInfo() - { - iAtt = 0; - iSize = 0; - iModified.UniversalTime(); - } - - -// End Of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpavcpenginehelper.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginehelper.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: helper class -* -*/ - - -#ifndef C_UPNPAVCPENGINEHELPER_H -#define C_UPNPAVCPENGINEHELPER_H - -#include -#include "upnpmdebug.h" - -namespace UpnpAVCPEngine - { - - static const TInt KHttpGetStarted = 800; // HTTP get started ( port number ) - static const TInt KHttpPostStarted = 801; // HTTP post started ( port number ) - - static const TInt KRequestedCountLimit = 20; - - _LIT8( KContentDirectory, "ContentDirectory:1" ); - - _LIT8(KDefaultBrowseFilter, "res,res@protocolInfo,res@size,res@importUri,dc:date"); - - _LIT8(KRootId,"0"); - _LIT8(KRootName,"Root"); - _LIT8(KBrowseDirectChildren, "BrowseDirectChildren"); - _LIT8(KBrowseMetadata, "BrowseMetadata" ); - _LIT8(KResult, "Result"); - _LIT8(KNumberReturned, "NumberReturned" ); - _LIT8(KTotalMatches, "TotalMatches" ); - _LIT8(KStartingIndex, "StartingIndex"); - _LIT8(KRequestedCount, "RequestedCount"); - _LIT8(KSystemUpdateID, "SystemUpdateID"); - - _LIT8(KContainer,"container"); - _LIT8(KItem,"item"); - _LIT8(KRes,"res"); - _LIT8(KRestricted,"restricted"); - _LIT8(KDate,"date"); - _LIT8(KTitle,"title"); - _LIT8(KId,"id"); - _LIT8(KSize,"size"); - _LIT8(KParentId,"parentID"); - _LIT8(KImportUri,"importUri"); - _LIT8(KProtocolInfo,"protocolInfo"); - _LIT8(KProtocolInfoBegin,"http-get"); - - _LIT8(KOne, "1"); - _LIT8(KTrue, "true"); - - - /** - * Convert descriptor into integer, if some problem leaves - * - * @param aValue value to be converted - * @return integer value - */ - TInt StrToIntL(const TDesC8& aValue); - /** - * Get last path element from pathname. - * From aPath last path element will be removed - * - * @param aPath original pathname - * @return last path element - */ - HBufC8* GetLastPathElementL(TDes8& aPath); - /** - * Parse path into elements - */ - void ParsePathToElementsL(TPtr8 aPath, RPointerArray& aArray ); - /** - * Removes slashes from path - * - * @param aPath original pathname , path will be updated - */ - void RemoveSlashes(TDes8& aPath); - - } - -#endif // C_UPNPAVCPENGINEHELPER_H - -// End Of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpavcpenginesession.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpavcpenginesession.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Implementation of server-side session -* -*/ - - -#ifndef C_CUPNPAVCPENGINESESSION_H -#define C_CUPNPAVCPENGINESESSION_H - -// INCLUDES -#include -#include "upnpavcpengine.h" -#include "upnpavcpenginecommon.h" - -// FORWARD DECLARATIONS -class CUpnpAVCPManager; -class CUpnpCommand; - -// CLASS DECLARATION -/** -* Implementation of server-side session -* -* @since Series 60 3.1 -*/ -class CUpnpAVCPEngineSession : public CSession2 - { - public: // New methods - /** - * Two-phased constructor. - * - * @param aClient client thread - * @param aServer server - * @param aManager AVCP manager - */ - static CUpnpAVCPEngineSession* NewL( const RThread& aClient, - CUpnpAVCPEngine& aServer, CUpnpAVCPManager& aManager); - /** - * Destructor. - */ - virtual ~CUpnpAVCPEngineSession(); - - public: // From CSession - /** - * From CSession invoked when requests from client come. - */ - void ServiceL( const RMessage2& aMessage ); - - public: - /** - * Remove command from array of active command - */ - void RemoveCommand(CUpnpCommand* aCommand); - /** - * Get index of command in array based on command id - */ - TInt CommandById(TInt aId); - - private: // New methods - /** - * C++ default constructor. - */ - CUpnpAVCPEngineSession( const RThread& aClient, - CUpnpAVCPEngine& aServer, - CUpnpAVCPManager& aManager); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL() ; - /** - * Panic client thread - * - * @param aMessage message to be panic - * @param aReason panic code - */ - void PanicClient( const RMessage2& aMessage, TInt aPanic ) const; - - private: // Data - // server - CUpnpAVCPEngine& iAVCPEngine; - // manager - CUpnpAVCPManager& iAVCPManager; - // list of active command - RPointerArray iCommandList; - }; - -#endif //C_CUPNPAVCPENGINESESSION_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpavcpmanager.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpavcpmanager.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class comunicates with MSs -* -*/ - - -#ifndef C_CUPNPAVCPMANAGER_H -#define C_CUPNPAVCPMANAGER_H - -// INCLUDES -#include "upnpavcontrolpoint.h" - -// FORWARD DECLARATIONS -class MUpnpResponseHandler; -class MUpnpHttpResponseHandler; -class CUpnpPathResolver; -class CUpnpAVCPEngineSession; - -// CLASS DECLARATION -/** -* Class implements (derive CUpnpAVControlPoint). -* It provides way to send SOAP action, HTTP request, -* receive notification about responses also support eventing phase. -* Additionally class keeps path resolvers for each MS (if it is needed). -* -* @since Series 60 3.1 -*/ -class CUpnpAVCPManager : public CUpnpAVControlPoint - { - public: - /** - * Two-phased constructor. - */ - static CUpnpAVCPManager* NewL(); - /** - * Destructor. - */ - ~CUpnpAVCPManager(); - /** - * Get unique command id - * - * @return command id - */ - TInt NewCommandId(); - /** - * Register a observer for receive notification about SOAP responses - * - * @param aHandler class implemented observer - */ - void RegisterForAction(MUpnpResponseHandler& aHandler); - /** - * Register a observer for receive notification about HTTP responses - * - * @param aHandler class implemented observer - */ - void RegisterForHttp(MUpnpHttpResponseHandler& aHandler); - /** - * Unregister a observer for receive notification about HTTP responses - * - * @param aHandler class implemented observer - */ - void UnregisterForHttp(MUpnpHttpResponseHandler& aHandler); - /** - * Return path resolver. - * If path resolver was created, return instance, otherwise create a new one, - * subsribe for events. - * Parameter aSession is used for managing life time of resolver. - * if all session used resolver has been closed, resolver is doestoyed. - * - * @param aUUID UDN of MS - * aSession server-side session - */ - CUpnpPathResolver& PathResolverL(const TDesC8& aUUID, CUpnpAVCPEngineSession* aSession); - /** - * Perform cleanup after closing server-side session. - * it checks whether it was the last session used resolver and - * destroy resolver if it was true. - */ - void CleanupSessionL( CUpnpAVCPEngineSession* aSession); - - private: // Method from CUpnpAVControlPoint - /** - * From CUpnpAVControlPoint handles HTTP messages. - * @since Series 60 2.0 - * @param aMessage Incoming HTTP message. - */ - void HttpResponseReceivedL(CUpnpHttpMessage* aMessage); - /** - * From CUpnpAVControlPoint handles actions' responses. - * @since Series 60 2.0 - * @param aMessage Incoming HTTP message. - */ - void ActionResponseReceivedL(CUpnpAction* aAction); - /** - * From CUpnpAVControlPoint handles events (as a response for SUBSCRIBE). - * @since Series 60 2.0 - * @param aMessage Incoming HTTP message. - */ - void StateUpdatedL(CUpnpService* aService); - /** - * From CUpnpAVControlPoint handles UPnP device discoveries. - * @since Series 60 2.0 - * @param aDevice Device that is discovered. - */ - void DeviceDiscoveredL(CUpnpDevice* aDevice); - /** - * From CUpnpAVControlPoint handles UPnP device disappears. - * @since Series 60 2.0 - * @param aDevice Device that disappeared. - */ - void DeviceDisappearedL(CUpnpDevice* aDevice); - - private: - /** - * C++ default constructor. - */ - CUpnpAVCPManager(MUpnpAVControlPointObserver* aObserver); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - /** - * Return index of action handler for specific session id - * - * @return index if found, else KErrNotFound - */ - TInt HandlerBySessionId(TInt aSessionId); - /** - * Return index of HTTP handler for specific session id - * - * @return index if found, else KErrNotFound - */ - TInt HttpHandlerBySessionId(TInt aSessionId); - - private: // Data - // last command id - TInt iLastCommandId; - // array of observers registered for SOAP action - RPointerArray iPendingHandlers; - // array of observer registered for HTTP response - RPointerArray iHttpPendingHandlers; - // array of path resolvers - RPointerArray iPathResolvers; - }; - -#endif //C_CUPNPAVCPMANAGER_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpbrowsecommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpbrowsecommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class responsible for browsing in MS -* -*/ - - -#ifndef C_CUPNPBROWSECOMMAND_H -#define C_CUPNPBROWSECOMMAND_H - -// INCLUDES -#include "upnpcommand.h" -#include "upnpresponsehandler.h" -#include "upnpresolverobserver.h" - - -// FORWARD DECLARATIONS -class CUpnpPathResolver; - -// CLASS DECLARATION -/** -* Class responsible for browsing MS structure. -* It perfroms request related to directory listings, -* file/directory attributes -* -* @since Series 60 3.1 -*/ -class CUpnpBrowseCommand : public CUpnpCommand, public MUpnpResponseHandler, - public MUpnpResolverObserver, - public MUpnpHttpResponseHandler - { - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpBrowseCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpBrowseCommand(); - - public: // Method from CUpnpCommand - /** - * From CUpnpCommand returns session id. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - TInt SessionId(); - /** - * From CUpnpCommand implement logic for leaves that appear during InterpretL. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - void RunError(TInt aErrorCode); - /** - * From CUpnpCommand perfroms operation connected with command - * @since Series 60 3.1 - */ - void ExecuteL(); - /** - * From CUpnpCommand set result from previous performed command. - * It sets result from directory listing. - * @since Series 60 3.1 - */ - void SetResultL(const RMessage2& aMessage); - - public: // Method from observers - /** - * From MUpnpResponseHandler, it is notified when SOAP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aAction action with attached respone - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpAction* aAction); - /** - * From MUpnpHttpResponseHandler, it is notified when HTTP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aMessage response message - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage); - /** - * From MUpnpResolverObserver, it is notified after translation path into id. - * - * @param aErrorCode error code (KErrNone if Ok) - * @param aIdElement object describing searched element - * @since Series 60 3.1 - */ - void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement); - - private: - /** - * C++ default constructor. - */ - CUpnpBrowseCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - /** - * Helper function, iterate over list to find object with fiven name. - * If it find correct object set its attribute to internal member of class. - * - * @param aList list infomrmation about object - * @param aName name of object to find - * @return ETrue - found, else EFalse - */ - TBool SetAttForObject(RArray& aList, const TDesC8& aName); - /** - * Prepare message with HTTP-HEAD and send it to specific address. - * - * @param aUrl destination address - */ - void SendHeadRequestL(const TDesC8& aUrl); - - private: - // path resolver - CUpnpPathResolver* iPathResolver; - // object id taken from path specified by request - HBufC8* iObjectId; - // object name taken from path specified by request - HBufC8* iObjectName; - // start index, value used to not get whole browse response at once - TInt iStartIndex; - // structure used for keep information about file/directory attribute - TFileInfo iAttr; - // array of directory elements (files/directories) - RArray iResult; -}; - -#endif // C_CUPNPBROWSECOMMAND_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpcommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpcommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Base class for all commands -* -*/ - - -#ifndef C_CUPNPCOMMAND_H -#define C_CUPNPCOMMAND_H - -// INCLUDES -#include -#include "upnpavcpenginecommon.h" -#include "upnpmdebug.h" - -// FORWARD DECLARATIONS -class CUpnpAVCPManager; -class CUpnpAVCPEngineSession; -class RMessage2; - -// CLASS DECLARATION -/** -* Base abstract class defines common set of methods for all commands -* -* @since Series 60 3.1 -*/ -class CUpnpCommand : public CBase - { - public: // Constructors and destructor - /** - * Two-phased constructor. - * Based on type of request it creates instance of relevant derived class - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpCommand(); - - public: // New functions - /** - * Function defines operation to perform by derived command - */ - virtual void ExecuteL() = 0; - /** - * Function set result from previous performed command. - * Command was performed and sent information about size of result to client-side. - * Base on command id session find corresponding instance of command and set result. - */ - virtual void SetResultL(const RMessage2& aMessage) = 0; - /** - * Return command unique id - * - * @return command id; - */ - TInt Id(); - /** - * Return session id - * - * @return session id; - */ - TInt SessionId(); - /** - * Function defines define default behaviour when leave appear during asynchrounous operation - */ - virtual void RunError(TInt aErrorCode); - - protected: - /** - * C++ default constructor. - */ - CUpnpCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void BaseConstructL(); - /** - * Read descriptor from message connected with this command - * @since Series 60 3.1 - * @param aIndex index in message - * @return read value - */ - HBufC8* ReadDes8FromMessageLC(TInt aIndex); - /** - * Read descriptor from message connected with this command - * @since Series 60 3.1 - * @param aIndex index in message - * @return read value - */ - HBufC* ReadDes16FromMessageLC(TInt aIndex); - - protected: - // session id used for registration in CUpnpAVCPManager - TInt iSessionId; - // command id used for match with command requesting for results - TInt iId; - // type of request - TAVCPEngineRqst iType; - // AVCP manager used for sending request - CUpnpAVCPManager& iAVCPManager; - // server-side session - CUpnpAVCPEngineSession& iSession; - // processing message - RMessage2 iMessage; - }; - -#endif // C_CUPNPCOMMAND_H - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpcreatecommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpcreatecommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Create new file/directory in MS -* -*/ - - -#ifndef C_CUPNPCREATECOMMAND_H -#define C_CUPNPCREATECOMMAND_H - -// INCLUDES -#include "upnpcommand.h" -#include "upnpresponsehandler.h" -#include "upnpresolverobserver.h" - -// FORWARD DECLARATIONS -class CUpnpPathResolver; - - -// CLASS DECLARATION -/** -* Class responsible for creating new files/directories in MS . -* -* @since Series 60 3.1 -*/ -class CUpnpCreateCommand : public CUpnpCommand, public MUpnpResponseHandler, - public MUpnpResolverObserver - { - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpCreateCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpCreateCommand(); - - public: // Method from CUpnpCommand - /** - * From CUpnpCommand returns session id. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - TInt SessionId(); - /** - * From CUpnpCommand implement logic for leaves that appear during InterpretL. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - void RunError(TInt aErrorCode); - /** - * From CUpnpCommand perfroms operation connected with command - * @since Series 60 3.1 - */ - void ExecuteL(); - /** - * From CUpnpCommand it is empty implementation. - * @since Series 60 3.1 - */ - void SetResultL(const RMessage2& aMessage); - - public: // Method from observers - /** - * From MUpnpResponseHandler, it is notified when SOAP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aAction action with attached respone - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpAction* aAction); - /** - * From MUpnpResolverObserver, it is notified after translation path into id. - * - * @param aErrorCode error code (KErrNone if Ok) - * @param aIdElement object describing searched element - * @since Series 60 3.1 - */ - void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement); - - private: - /** - * C++ default constructor. - */ - CUpnpCreateCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - private: - // path resolver - CUpnpPathResolver* iPathResolver; - // object id taken from path specified by request - HBufC8* iObjectId; - // element in the path resolver - CUpnpPathElement* iElement; - // name of file/directory to be created - HBufC8* iTargetName; -}; - -#endif //C_CUPNPCREATECOMMAND_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpdeletecommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpdeletecommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Delete file/directory in MS -* -*/ - - -#ifndef C_CUPNPDELETECOMMAND_H -#define C_CUPNPDELETECOMMAND_H - -// INCLUDES -#include "upnpcommand.h" -#include "upnpresponsehandler.h" -#include "upnpresolverobserver.h" - -// FORWARD DECLARATIONS -class CUpnpPathResolver; - -// CLASS DECLARATION -/** -* Class responsible for deleting files/directories in MS . -* -* @since Series 60 3.1 -*/ -class CUpnpDeleteCommand : public CUpnpCommand, public MUpnpResponseHandler, - public MUpnpResolverObserver - { - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpDeleteCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpDeleteCommand(); - - - public: // Method from CUpnpCommand - /** - * From CUpnpCommand returns session id. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - TInt SessionId(); - /** - * From CUpnpCommand implement logic for leaves that appear during InterpretL. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - void RunError(TInt aErrorCode); - /** - * From CUpnpCommand perfroms operation connected with command - * @since Series 60 3.1 - */ - void ExecuteL(); - /** - * From CUpnpCommand it is empty implementation. - * @since Series 60 3.1 - */ - void SetResultL(const RMessage2& aMessage); - - public: // Method from observers - /** - * From MUpnpResponseHandler, it is notified when SOAP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aAction action with attached respone - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpAction* aAction); - /** - * From MUpnpResolverObserver, it is notified after translation path into id. - * - * @param aErrorCode error code (KErrNone if Ok) - * @param aIdElement object describing searched element - * @since Series 60 3.1 - */ - void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement); - - private: - /** - * C++ default constructor. - */ - CUpnpDeleteCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - private: - // path resolver - CUpnpPathResolver* iPathResolver; - -}; - -#endif // C_CUPNPDELETECOMMAND_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpdevicelistcommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpdevicelistcommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class responsbile for MS device list -* -*/ - - -#ifndef C_CUPNPDEVICELISTCOMMAND_H -#define C_CUPNPDEVICELISTCOMMAND_H - -// INCLUDES -#include "upnpcommand.h" - -// CLASS DECLARATION -/** -* Class responsible for getting list of active MSs. -* -* @since Series 60 3.1 -*/ -class CUpnpDeviceListCommand : public CUpnpCommand - { - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpDeviceListCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpDeviceListCommand(); - - public: // Method from CUpnpCommand - /** - * From CUpnpCommand perfroms operation connected with command - * @since Series 60 3.1 - */ - void ExecuteL(); - /** - * From CUpnpCommand set result from previous performed command. - * It sets result from directory listing. - * @since Series 60 3.1 - */ - void SetResultL(const RMessage2& aMessage); - - private: - /** - * C++ default constructor. - */ - CUpnpDeviceListCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - private: - // size of array with devices - TInt iDeviceCount; - // array of devices - TAVDevice* iDevices; - -}; - -#endif //C_CUPNPDEVICELISTCOMMAND_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpdownloadcommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpdownloadcommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class responsible for reading file from MS -* -*/ - - -#ifndef C_CUPNPDOWNLOADCOMMAND_H -#define C_CUPNPDOWNLOADCOMMAND_H - -// INCLUDES -#include "upnpcommand.h" -#include "upnpresponsehandler.h" -#include "upnpresolverobserver.h" - -// FORWARD DECLARATIONS -class CUpnpPathResolver; - -// CLASS DECLARATION -/** -* Class responsible for downloadind files from MS. -* -* @since Series 60 3.1 -*/ -class CUpnpDownloadCommand : public CUpnpCommand, - public MUpnpResponseHandler, - public MUpnpHttpResponseHandler, - public MUpnpResolverObserver - { - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpDownloadCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpDownloadCommand(); - - public: // Method from CUpnpCommand - /** - * From CUpnpCommand returns session id. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - TInt SessionId(); - /** - * From CUpnpCommand implement logic for leaves that appear during InterpretL. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - void RunError(TInt aErrorCode); - /** - * From CUpnpCommand perfroms operation connected with command - * @since Series 60 3.1 - */ - void ExecuteL(); - /** - * From CUpnpCommand it is empty implementation. - * @since Series 60 3.1 - */ - void SetResultL(const RMessage2& aMessage); - - public: // Method from observers - /** - * From MUpnpResponseHandler, it is notified when SOAP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aAction action with attached respone - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpAction* aAction); - /** - * From MUpnpHttpResponseHandler, it is notified when HTTP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aMessage response message - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage); - /** - * From MUpnpResolverObserver, it is notified after translation path into id. - * - * @param aErrorCode error code (KErrNone if Ok) - * @param aIdElement object describing searched element - * @since Series 60 3.1 - */ - void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement); - - private: - /** - * C++ default constructor. - */ - CUpnpDownloadCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - private: - // path resolver - CUpnpPathResolver* iPathResolver; - // object id taken from path specified by request - HBufC8* iObjectId; - // path to destinnation file (local file in cache directory) - HBufC8* iDestPath; - // flag indicates that RANGE was used - TBool iUseRange; - // structure keeps information about position of file to read - TFilePosition iPosition; - }; - -#endif //C_CUPNPDOWNLOADCOMMAND_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpmdebug.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpmdebug.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: Debug printing to a log file -* -*/ - - -#ifndef C_UPNPMDEBUG_H -#define C_UPNPMDEBUG_H - -// INCLUDES -#include - -#ifdef _DEBUG -#include -#include "upnpmydebug.h" - -// Take care that the correct upnpmydebug.h will be included -// In upnpmydebug.h in your module inc directory, -// define your application-specific configuration like this: -// ---------------------------------------------------------- -// Debug file - debug output is disabled if the parent dir does not exist -// _LIT(KDebugFileName, "C:\\logs\\remotefileengine\\remotefileengine.txt"); - -// Replace the current debug file - if not defined appends to the file -#ifndef APPEND_TO_DEBUG_FILE -#define REPLACE_DEBUG_FILE -#endif - -// Maximum formatted size resulting from a single DEBUG* call -#ifndef MAX_DEBUG_STRING_LENGTH -#define MAX_DEBUG_STRING_LENGTH 4096 -#endif -// ---------------------------------------------------------- - - -// FORWARD DECLARATIONS -static void DoOutput(TDesC8& aData); - -static void DebugStringNarrowL(const char* aFmt, ...) - { - VA_LIST args; - VA_START(args, aFmt); - - TPtrC8 fmt(reinterpret_cast(aFmt)); - HBufC8* buf = HBufC8::NewLC(MAX_DEBUG_STRING_LENGTH); - buf->Des().FormatList(fmt, args); - buf->Des().Append('\n'); - DoOutput(*buf); - CleanupStack::PopAndDestroy(buf); - - VA_END(args); - } - -static void DebugStringWideL(const char* aFmt, ...) - { - VA_LIST args; - VA_START(args, aFmt); - - TPtrC8 fmt(reinterpret_cast(aFmt)); - HBufC* fmt16 = HBufC::NewLC(fmt.Length()); - fmt16->Des().Copy(fmt); - HBufC* buf = HBufC::NewLC(MAX_DEBUG_STRING_LENGTH); - buf->Des().FormatList(*fmt16, args); - buf->Des().Append('\n'); - HBufC8* buf8 = HBufC8::NewLC(buf->Length()); - buf8->Des().Copy(*buf); - DoOutput(*buf8); - CleanupStack::PopAndDestroy(3); // fmt16, buf, buf8 - - VA_END(args); - } - -static void DebugBufferL(const TDesC8& aBuf) - { - DebugStringNarrowL("\"%S\"", &aBuf); - } - -static void DebugBufferL(const TDesC& aBuf) - { - DebugStringWideL("\"%S\"", &aBuf); - } - -static void DebugTimeL(const TTime& aTime) - { - TBuf<64> dateTimeString; - _LIT(KDateString, "%E%D%X%N%Y %1 %2 %3"); - aTime.FormatL(dateTimeString, KDateString); - DebugBufferL(dateTimeString); - _LIT(KTimeString, "%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"); - aTime.FormatL(dateTimeString, KTimeString); - DebugBufferL(dateTimeString); - } - -static void DoOutput(TDesC8& aData) - { - RFileLogger::Write(KDebugDirName, - KDebugFileName, - EFileLoggingModeAppend, - aData); - } -#endif - -// MACROS -// If you output one or more narrow descriptors by using '%S', -// use DEBUGSTRING8 -// else if you output one or more unicode descriptors by using '%S', -// use DEBUGSTRING16 -// else -// use DEBUGSTRING -// -// Narrow and unicode cannot be mixed in a single DEBUGSTRINGx call. - -#ifdef _DEBUG -#define DEBUGINIT() DebugInit() -#define DEBUGINITSUSPENDED() DebugInit(ETrue) -#define DEBUGENABLE() SetDebugEnabled(ETrue) -#define DEBUGDISABLE() SetDebugEnabled(EFalse) -#define DEBUGSUSPEND() SetDebugSuspended(ETrue) -#define DEBUGCONTINUE() SetDebugSuspended(EFalse) -#define DEBUGSTRING(x) DebugStringNarrowL x -#define DEBUGSTRING8(x) DebugStringNarrowL x -#define DEBUGSTRING16(x) DebugStringWideL x -#define DEBUGBUFFER(x) DebugBufferL x -#define DEBUGTIME(x) DebugTimeL x -#else -#define DEBUGINIT() -#define DEBUGINITSUSPENDED() -#define DEBUGENABLE() -#define DEBUGDISABLE() -#define DEBUGSUSPEND() -#define DEBUGCONTINUE() -#define DEBUGSTRING(x) -#define DEBUGSTRING8(x) -#define DEBUGSTRING16(x) -#define DEBUGBUFFER(x) -#define DEBUGTIME(x) -#endif - -#endif // C_MUPNPDEBUG_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpmetadatacommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpmetadatacommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Used for get/change metadata from/in MS -* -*/ - - -#ifndef C_CUPNPMETADATACOMMAND_H -#define C_CUPNPMETADATACOMMAND_H - -// INCLUDES -#include "upnpcommand.h" -#include "upnpresponsehandler.h" -#include "upnpresolverobserver.h" - -// FORWARD DECLARATIONS -class CUpnpPathResolver; - -// CLASS DECLARATION -/** -* Class responsible for operating on MS's metadata. -* It is used for get/change file/directory metadata -* -* @since Series 60 3.1 -*/ -class CUpnpMetadataCommand : public CUpnpCommand, public MUpnpResponseHandler, - public MUpnpResolverObserver -{ - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpMetadataCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpMetadataCommand(); - - public: // Method from CUpnpCommand - /** - * From CUpnpCommand returns session id. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - TInt SessionId(); - /** - * From CUpnpCommand implement logic for leaves that appear during InterpretL. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - void RunError(TInt aErrorCode); - /** - * From CUpnpCommand perfroms operation connected with command - * @since Series 60 3.1 - */ - void ExecuteL(); - /** - * From CUpnpCommand it is empty implementation. - * @since Series 60 3.1 - */ - void SetResultL(const RMessage2& aMessage); - - public: // Method from observers - /** - * From MUpnpResponseHandler, it is notified when SOAP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aAction action with attached respone - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpAction* aAction); - /** - * From MUpnpResolverObserver, it is notified after translation path into id. - * - * @param aErrorCode error code (KErrNone if Ok) - * @param aIdElement object describing searched element - * @since Series 60 3.1 - */ - void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement); - - private: - /** - * C++ default constructor. - */ - CUpnpMetadataCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - private: // Data - // path resolver - CUpnpPathResolver* iPathResolver; - // object id taken from path specified by request - HBufC8* iObjectId; - // result from browse, waiting for request about result - HBufC8* iResult; - // old metadata - HBufC8* iOldMetadata; - // new changed metadata - HBufC8* iNewMetadata; - -}; - -#endif //C_CUPNPMETADATACOMMAND_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpmydebug.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpmydebug.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: Debug definitions for UPnPAccess -* -*/ - - -#ifndef C_UPNPMYDEBUG_H -#define C_UPNPMYDEBUG_H - -// MACROS -#define APPEND_TO_DEBUG_FILE - -// CONSTANTS -_LIT(KDebugDirName, "avcp"); -_LIT(KDebugFileName, "avcpengine.txt"); - -#endif // C_UPNPMYDEBUG_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnppathelement.h --- a/upnpavcontrolpoint/avcpengine/inc/upnppathelement.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Describe a path element -* -*/ - - -#ifndef C_CUPNPPATHELEMENT_H -#define C_CUPNPPATHELEMENT_H - -// INCLUDES -#include - -// CLASS DECLARATION -/** -* Describe a path element -* -* @since Series 60 3.1 -*/ -class CUpnpPathElement: public CBase - { - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CUpnpPathElement* NewL(); - /** - * Destructor. - */ - virtual ~CUpnpPathElement(); - - public: // New functions - /** - * Get value of parent id - * @since Series 60 3.1 - * @return parent id - */ - const TDesC8& ParentId() const; - /** - * Set value of parent id - * @since Series 60 3.1 - * @param aParentId new value of parent id - */ - void SetParentIdL(const TDesC8& aParentId); - /** - * Get value of id - * @since Series 60 3.1 - * @return id value - */ - const TDesC8& Id() const; - /** - * Set value of id - * @since Series 60 3.1 - * @param aId new value of id - */ - void SetIdL(const TDesC8& aId); - /** - * Get value of name - * @since Series 60 3.1 - * @return name - */ - const TDesC8& Name() const; - /** - * Set value of name - * @since Series 60 3.1 - * @param aName new value of name - */ - void SetNameL(const TDesC8& aName); - - /** - * Get value of ImportURI - * @since Series 60 3.2 - * @return ImportURI - */ - const TDesC8& ImportURI() const; - /** - * Set value of ImportURI - * @since Series 60 3.2 - * @param aImportURI a new value of importURI - */ - void SetImportURIL(const TDesC8& aImportURI); - - /** - * Get value of original name - * @since Series 60 3.2 - * @return OriginalName - */ - const TDesC8& OriginalName() const; - - /** - * Set value of original name - * @since Series 60 3.2 - * @param aIOriginalName a new value of original name - */ - void SetOriginalNameL(const TDesC8& aOriginalName); - - /** - * Deletes value of original name - * @since Series 60 3.2 - */ - void DeleteOriginalName(); - - /** - Compares if two path elements have the same name and parent id. - @param aFirst First message to compare. - @param aSecond Second message to compare. - @result ETrue if same session id, EFalse otherwise. - **/ - static TBool MatchName(const CUpnpPathElement& aElement1, - const CUpnpPathElement& aElement2); - /** - Compares if two path elements have the same name, id and parent id. - @param aFirst First message to compare. - @param aSecond Second message to compare. - @result ETrue if same session id, EFalse otherwise. - **/ - static TBool MatchAll(const CUpnpPathElement& aElement1, - const CUpnpPathElement& aElement2); - - private: - /** - * C++ default constructor. - */ - CUpnpPathElement(); - - /** - * Symbian 2nd phase constructor - */ - void ConstructL(); - - private: - // id attrbute of UPnP object - HBufC8* iId; - // parent id attrbute of UPnP object - HBufC8* iParentId; - // name path element, name is taken from title element, - // but if duplication occurs, name is followed by index string - HBufC8* iName; - //hidden import URI - HBufC8* iImportURI; - //original name if change by creating resource - HBufC8* iOriginalName; - }; - -#endif // C_CUPNPPATHELEMENT_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnppathresolver.h --- a/upnpavcontrolpoint/avcpengine/inc/upnppathresolver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,240 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpPathResolver -* -*/ - - - -#ifndef C_CUPNPPATHRESOLVER_H -#define C_CUPNPPATHRESOLVER_H - -// INCLUDES -#include - -#include - -// FORWARD DECLARATIONS -class CUpnpPathElement; -class CUpnpResolveHandler; -class MUpnpResolverObserver; -class CUpnpAVCPManager; -class TFileInfo; -class CUpnpAVCPEngineSession; - -// CLASS DECLARATION -/** -* Class responsible for managing path element for one MS. -* It helps in translating pathname into id. -* -* @since Series 60 3.1 -*/ -class CUpnpPathResolver : public CBase - { - public: - /** - * Two-phased constructor. - */ - static CUpnpPathResolver* NewL(CUpnpAVCPManager& aManager,const TDesC8& aUUID); - - /** - * Destructor. - */ - virtual ~CUpnpPathResolver(); - - public: // New functions - /** - * Return UDN of MS that resolver is related - */ - const TDesC8& UUID() const; - - /** - * Add new path element into resolver. - * if resolver has element with the same name and ids ignore. - * if resolver has element with the same naem but different id, - * perform duplicatione mechanism by adding '(inx)' at the end of name, new name is returned. - * - * @param aParentId parent id - * @param aId id - * @param aName name of element - * @param aImportURI importURI of element - * @return approved name, it may be the same as aName if we don't have duplication, ale is followed by index - */ - const TDesC8& AddElementL(const TDesC8& aParentId, const TDesC8& aId, const TDesC8& aName, const TDesC8& aImportURI = KNullDesC8); - - /** - * Gets path element for object with given parent id and name. - * Ownership is not passed to caller. - * - * @param aParentId parent id - * @param aName name - * @return NULL if not found, else instance describing path element - */ - CUpnpPathElement* GetElementL(const TDesC8& aParentId, const TDesC8& aName) const; - /** - * Remove given element from cache array (if found in cache it destroys also given instance) - * - * @param aElement param to remove - */ - void RemoveElementD(CUpnpPathElement* aElement); - /** - * Request for resolving pathname and notify given observer after process will be finished. - */ - void ResolveIdL(const TDesC8& aPath, MUpnpResolverObserver& aObserver); - /** - * Remove instance of resolver's handler from array of active handlers - */ - void RemoveHandler(CUpnpResolveHandler* aHandler); - /** - Compares if two path resolvers have the UDN - @param aFirst First message to compare. - @param aSecond Second message to compare. - @result ETrue if same session id, EFalse otherwise. - **/ - static TBool Match(const CUpnpPathResolver& aElement1, const CUpnpPathResolver& aElement2) ; - /** - * Notify if event comes from CDS with system id, - * If system id is changed path elements will be removed - */ - void StateChangedL(const TDesC8& aSystemId); - /** - * Set modification time based on date element from CDS's object. - * - * @param aDateElement XML element with date - * @param aEntry structure to be updated - */ - void SetModifiedTimeL(TXmlEngElement& aDateElement, TFileInfo& aEntry); - /** - * Parse Browse response and updates information about path elements - * If aDirList is defined, update array by parsed path element - * (set also file/directory attributes) - * If aObjectId is not equal KNullDesC8, then also try to find resource URI for aObjectId. - * - * @param aResponse response - * @param aDirList array of directory entry elements - * @param aObjectId object id for resource URI - * @param aResUri found resource - */ - void ParseBrowseResponseL(const TDesC8& aResponse, RArray* aDirList = NULL, - const TDesC8& aObjectId = KNullDesC8, HBufC8** aResUri = NULL); - /** - * Parse Browse response and find resourse URI for object with given id. - * - * @param aResponse response - * @param aId id of object - * @param aResUri parameter to be set with found resoursce URI - * @return ETrue if found, else EFalse - */ - TBool GetResUriL(const TDesC8& aResponse, const TDesC8& aId, HBufC8*& aResUri); - /** - * Parse Browse response and find resourse for object with given id. - * - * @param aResponse response - * @param aId id of object - * @return ETrue if found, else EFalse - */ - TInt GetItemL(const TDesC8& aResponse, const TDesC8& aId); - - /** - * Parse Browse response of CreateObject - * - * @param aResponse response - * @return ETrue if found, else EFalse - */ - TBool BrowseCreateObjectL(const TDesC8& aResponse ) ; - - /** - * Register session that is interested of this resolver - * - * @param aSession session - */ - void RegisterSession(CUpnpAVCPEngineSession* aSession); - /** - * Unregister session that is not interested of this resolver - * - * @param aSession session - * @return number of session still being interested - */ - TInt UnregisterSession(CUpnpAVCPEngineSession* aSession); - /** - * Lock resolver to not accept resets as a result of state variable changes - * Reset will be postpone until unlock method is invoked - * - */ - void LockReset(); - /** - * Unlock reset. - * If between lock-unlock operation occurs state variable change, - * it'll reset all entries. - */ - void UnlockReset(); - private: - - /** - * C++ default constructor. - */ - CUpnpPathResolver(CUpnpAVCPManager& aManager); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(const TDesC8& aUUID); - /** - * Parse XML given as parameter and return DOM tree - * - * @param aXml buffer with XML - * @return DOM document - */ - RXmlEngDocument ParseXmlL(const TDesC8& aXml); - /** - * Get prefer resource element - * - * @param aElements array of elements - * @return chosen one - */ - TXmlEngElement GetPreferResourceL(const RArray& aElements); - /** - * Get first resource element with import URI - * - * @param aElements array of elements - * @param aImportURI if found - * @return chosen one - */ - TXmlEngElement GetResourceWithImportURIL(const RArray& aElements, TPtrC8& aImportURI); - - private: // Data - // last known system id (statevariable of CDS) - TInt iSystemId; - // UDN of MS - HBufC8* iUUID; - // manager - CUpnpAVCPManager& iManager; - // array of path elements - RPointerArray iPathElements; - // array of resolver's handlers - RPointerArray iResolveHandlers; - // array of session being interested of this resolver - RPointerArray iAVCPSessions; - // indicate whether path resolver is reseted to remove all entries - // when state variable changes - TBool iLocked; - // indicate whether entries are up-to-date - TBool iUptodate; - - RXmlEngDOMImplementation iDOMImpl; - }; - -#endif // C_CUPNPPATHRESOLVER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpresolvehandler.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpresolvehandler.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Resolve path(FS) into id (UPnP) -* -*/ - - -#ifndef C_CUPNPRESOLVEHANDLER_H -#define C_CUPNPRESOLVEHANDLER_H - -// INCLUDES -#include -#include "upnpresponsehandler.h" -#include "upnpresolverobserver.h" - -// FORWARD DECLARATIONS -class CUpnpPathResolver; -class CUpnpAVCPManager; - -// CLASS DECLARATION -/** -* Class responsible for translating path into id. -* -* @since Series 60 3.1 -*/ -class CUpnpResolveHandler: public CBase, public MUpnpResponseHandler - { - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aResolver path resolver - * @param aObserver observer to nofity - */ - static CUpnpResolveHandler* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver); - /** - * Destructor. - */ - virtual ~CUpnpResolveHandler(); - /** - * Request for tranlating given path in to id. - * Method parses path into element and tries to match. - * Inform use about result by observer, - * - * @param aPath path - */ - void ResolveL(const TDesC8& aPath); - - public: // Method from observers - /** - * From MUpnpResponseHandler returns session id. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - TInt SessionId(); - /** - * From MUpnpResponseHandler, it is notified when SOAP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aAction action with attached respone - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpAction* aAction); - /** - * From MUpnpResponseHandler, it is notified when leave appears - * during InterpretL - * @param aErrorCode error code - * @since Series 60 3.1 - */ - void RunError(TInt aErrorCode); - - private: - /** - * C++ default constructor. - */ - CUpnpResolveHandler(CUpnpAVCPManager& aAVCPManager, - CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver); - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - /** - * Check next element in path, if it is the last notify observer. - * If matching elemrnt wasn't found inform observer. - * - * @param aSendAction indicate whether use browse action - * if not found or inform used about error. - */ - void CheckNextElementL(TBool aSendAction = ETrue); - - private: - // manager - CUpnpAVCPManager& iAVCPManager; - // resolver instance - CUpnpPathResolver& iResolver; - // observer - MUpnpResolverObserver& iObserver; - // array of path elements - RPointerArray iPathElements; - // session id of last send SOAP action - TInt iSessionId; - // original pathname - HBufC8* iPath; - // last matched object id - HBufC8* iLastId; - // index of path elements, last checked - TInt iPathIndex; - // index used to no get whole browse result - TInt iStartIndex; - -}; - -#endif // C_CUPNPRESOLVEHANDLER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpresolverobserver.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpresolverobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: MUpnpResolverObserver -* -*/ - - -#ifndef C_CUPNPRESOLVEROBSERVER_H -#define C_CUPNPRESOLVEROBSERVER_H - -// FORWARD DECLARATIONS -class CUpnpPathElement; - -// CLASS DECLARATION -/** -* This observer class has to be implemented to receive notification about result of path resolving. -* -* @see CUpnpPathResolver -* @see ResolveHandler -* @since Series 60 3.1 -*/ -class MUpnpResolverObserver - { - public: // New functions - /** - * Method invoke when resolving process has finished and result are ready. - * @since Series 60 3.1 - * @param aErrCode status of resolving, if ok, value equal KErrNone - * @param aPathElement object describing searched element - */ - virtual void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aPathElement) = 0; - }; - -#endif // C_CUPNPRESOLVEROBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpresponsehandler.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpresponsehandler.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Observers which receive notifications about responses of SOAP actions and HTTP requests -* -*/ - - -#ifndef C_CUPNPRESPONSEHANDLER_H -#define C_CUPNPRESPONSEHANDLER_H - -// FORWARD DECLARATIONS -class CUpnpAction; -class CUpnpHttpMessage; - -// CLASS DECLARATION -/** -* This observer class has to be implemented to receive notification -* about response on SOAP action. -* The observer is used by CUpnpAVCPManager, it use session id -* (taken from SessionId method) for match incoming response with corresponding -* handler instance. After notify handler, handler is removed from -* registered handlers. -* -* @see CUpnpAVCPManager -* @since Series 60 3.1 -*/ -class MUpnpResponseHandler - { - public: // New functions - /** - * This callback function is notified when Soap respone - * with relevant session id (@see SessionId) comes. - * @param aErrorCode error code - * @param aMessage response message - * @since Series 60 3.1 - */ - virtual void InterpretL(TInt aErrorCode, CUpnpAction* aAction) = 0; - /** - * Function returns session id that identifies on which response handler is waiting - * - * @return session id - */ - virtual TInt SessionId() = 0; - /** - * This callback function is notified when leave appears during execution of InterpretL - * @param aErrorCode error code of leave - */ - virtual void RunError(TInt aErrorCode) = 0; - - - }; - -/** -* This observer class has to be implemented to receive notification -* about response on HTTP requests. -* The observer is used by CUpnpAVCPManager, it use session id -* (taken from SessionId method) for match incoming response with corresponding -* handler instance. After notify handler, handler is not removed from -* registered handlers. Handler instance has to use unregister itself. -* -* @see CUpnpAVCPManager -* @since Series 60 3.1 -*/ -class MUpnpHttpResponseHandler - { - public: // New functions - /** - * This callback function is notified when HTTP respone - * with relevant session id (@see SessionId) comes. - * @param aErrorCode error code - * @param aMessage response message - * @since Series 60 3.1 - */ - virtual void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aAction) = 0; - /** - * Function returns session id that identifies on which response handler is waiting - * - * @return session id - */ - virtual TInt SessionId() = 0; - /** - * This callback function is notified when leave appears during execution of InterpretL - * @param aErrorCode error code of leave - */ - virtual void RunError(TInt aErrorCode) = 0; - }; -#endif // C_CUPNPRESPONSEHANDLER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/inc/upnpuploadcommand.h --- a/upnpavcontrolpoint/avcpengine/inc/upnpuploadcommand.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class responsible for writing file from MS -* -*/ - - -#ifndef C_CUPNPUPLOADCOMMAND_H -#define C_CUPNPUPLOADCOMMAND_H - -// INCLUDES -#include "upnpcommand.h" -#include "upnpresponsehandler.h" -#include "upnpresolverobserver.h" - -// FORWARD DECLARATIONS -class CUpnpPathResolver; - -// CLASS DECLARATION -/** -* Class responsible for uploading files from MS. -* -* @since Series 60 3.1 -*/ -class CUpnpUploadCommand : public CUpnpCommand, - public MUpnpResponseHandler, - public MUpnpHttpResponseHandler, - public MUpnpResolverObserver - { - public: - /** - * Two-phased constructor. - * - * @param aAVCPManager manager - * @param aSession server-side session - * @param aMessage message - */ - static CUpnpUploadCommand* NewL(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Destructor. - */ - virtual ~CUpnpUploadCommand(); - - public: // Method from CUpnpCommand - /** - * From CUpnpCommand returns session id. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - TInt SessionId(); - /** - * From CUpnpCommand implement logic for leaves that appear during InterpretL. - * It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler - * @since Series 60 3.1 - */ - void RunError(TInt aErrorCode); - /** - * From CUpnpCommand perfroms operation connected with command - * @since Series 60 3.1 - */ - void ExecuteL(); - /** - * From CUpnpCommand set result from previous performed command. - * It sets result from directory listing. - * @since Series 60 3.1 - */ - void SetResultL(const RMessage2& aMessage); - - public: // Method from observers - /** - * From MUpnpResponseHandler, it is notified when SOAP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aAction action with attached respone - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpAction* aAction); - /** - * From MUpnpHttpResponseHandler, it is notified when HTTP respone - * with relevant session id comes. - * @param aErrorCode error code - * @param aMessage response message - * @since Series 60 3.1 - */ - void InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage); - /** - * From MUpnpResolverObserver, it is notified after translation path into id. - * - * @param aErrorCode error code (KErrNone if Ok) - * @param aIdElement object describing searched element - * @since Series 60 3.1 - */ - void ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement); - - private: - /** - * C++ default constructor. - */ - CUpnpUploadCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage); - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - - private: - // path resolver - CUpnpPathResolver* iPathResolver; - // object id taken from path specified by request - HBufC8* iObjectId; - // location to local file, it is file to be sent - HBufC8* iSrcPath; - // import URI - HBufC8* iImportURI; - - -}; - -#endif // C_CUPNPUPLOADCOMMAND_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpavcpengine.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpavcpengine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpAVCPEngine -* -*/ - - -// INCLUDE FILES -#include -#include "upnpavcpengine.h" -#include "upnpavcpenginesession.h" -#include "upnpavcpmanager.h" -#include "upnpavcpenginecommon.h" -#include "upnpmdebug.h" - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::CUpnpAVCPEngine -// constructor. -// ----------------------------------------------------------------------------- -// -CUpnpAVCPEngine::CUpnpAVCPEngine( TInt aPriority ) - : CServer2( aPriority ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::~CUpnpAVCPEngine -// destructor. -// ----------------------------------------------------------------------------- -// -CUpnpAVCPEngine::~CUpnpAVCPEngine() - { - delete iAVCPManger; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpAVCPEngine* CUpnpAVCPEngine::NewLC() - { - CUpnpAVCPEngine* engine = new (ELeave) CUpnpAVCPEngine( EPriorityNormal ); - CleanupStack::PushL( engine ); - engine->ConstructL() ; - return engine; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngine::ConstructL() - { - DEBUGSTRING(("CUpnpAVCPEngine::ConstructL ")); - iAVCPManger = CUpnpAVCPManager::NewL(); - StartL( KAVCPEngineName ); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::NewSessionL -// Create new session. -// ----------------------------------------------------------------------------- -// -CSession2* CUpnpAVCPEngine::NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const - { - // Check it's the right version - if ( !User::QueryVersionSupported( TVersion( - KAVCPEngineMajorVersionNumber, - KAVCPEngineMinorVersionNumber, - KAVCPEngineBuildVersionNumber ), - aVersion ) ) - { - User::Leave( KErrNotSupported ); - } - - RThread client; - aMessage.Client(client); - return CUpnpAVCPEngineSession::NewL( client, *const_cast ( this ), *const_cast (iAVCPManger) ); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::IncrementSessions -// Increment sessions. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngine::IncrementSessions(CUpnpAVCPEngineSession* /*aObserver*/) - { - iSessionCount++; - DEBUGSTRING(("IncrementSessions (%d)", iSessionCount)); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::DecrementSessions -// Decrement sessions. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngine::DecrementSessions( CUpnpAVCPEngineSession* aObserver) - { - TRAP_IGNORE( iAVCPManger->CleanupSessionL(aObserver) ); - iSessionCount--; - DEBUGSTRING(("DecrementSessions (%d)", iSessionCount)); - if ( iSessionCount <= 0 ) - { - CActiveScheduler::Stop(); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::RunError -// RunError is called when RunL leaves. -// ----------------------------------------------------------------------------- -// -TInt CUpnpAVCPEngine::RunError( TInt aError ) - { - DEBUGSTRING(("CUpnpAVCPEngine::RunError (%d)", aError)); - - if ( aError == KErrBadDescriptor ) - { - // A bad descriptor error implies a badly programmed client, so panic it; - // otherwise report the error to the client - PanicClient( Message(), /*EMessageHandlerBadDescriptor*/EAVCPEngineGenerealPanic ); - } - else - { - Message().Complete( aError ); - } - - // The leave will result in an early return from CServer::RunL(), skipping - // the call to request another message. So do that now in order to keep the - // server running. - ReStart(); - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::PanicClient -// Panic client. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngine::PanicClient( const RMessage2& aMessage, - TAVCPEnginePanic aPanic ) - { - aMessage.Panic( KAVCPEngine, aPanic ); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::PanicServer -// Panic server. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngine::PanicServer( TAVCPEnginePanic aPanic ) - { - User::Panic( KAVCPEngine, aPanic ); - } - - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::ThreadFunctionL -// Create and start the server. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngine::ThreadFunctionL() - { - // Construct active scheduler - CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler; - CleanupStack::PushL( activeScheduler ); - - // Install active scheduler - // We don't need to check whether an active scheduler is already installed - // as this is a new thread, so there won't be one - CActiveScheduler::Install( activeScheduler ); - - User::RenameThread( KAVCPEngineName ); - // Construct our server - CUpnpAVCPEngine* engine = CUpnpAVCPEngine::NewLC(); // Anonymous - - RProcess::Rendezvous(KErrNone); - - // Start handling requests - CActiveScheduler::Start(); - - CleanupStack::PopAndDestroy( engine ); - CleanupStack::PopAndDestroy( activeScheduler ); - - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngine::ThreadFunctionL -// Create and start the server. -// ----------------------------------------------------------------------------- -// -TInt CUpnpAVCPEngine::ThreadFunction( TAny* /*aNone*/ ) - { - __UHEAP_MARK; - - CTrapCleanup* cleanupStack = CTrapCleanup::New(); - if ( !(cleanupStack) ) - { - PanicServer( EAVCPEngineGenerealPanic ); - } - - TRAPD( err, ThreadFunctionL() ); - if ( err != KErrNone ) - { - PanicServer( EAVCPEngineGenerealPanic ); - } - - delete cleanupStack; - cleanupStack = NULL; - - __UHEAP_MARKEND; - - return KErrNone; - } - - -// ============================= LOCAL FUNCTIONS =============================== - -TInt E32Main() - { - return CUpnpAVCPEngine::ThreadFunction(NULL); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpavcpenginehelper.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpavcpenginehelper.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: helper class -* -*/ - - -#include "upnpavcpenginehelper.h" - -namespace UpnpAVCPEngine -{ - -// ----------------------------------------------------------------------------- -// UpnpAVCPEngine::StrToIntL -// ----------------------------------------------------------------------------- -// -TInt StrToIntL(const TDesC8& aValue) - { - TLex8 returnedLex( aValue ); - TInt value; - User::LeaveIfError( returnedLex.Val( value )); - return value; - } - -// ----------------------------------------------------------------------------- -// UpnpAVCPEngine::GetLastPathElementL -// ----------------------------------------------------------------------------- -// -HBufC8* GetLastPathElementL(TDes8& aPath) - { - RemoveSlashes(aPath); - TInt index = aPath.LocateReverse('/'); - if (index == KErrNotFound) - index = 0; - - HBufC8* result = aPath.Right(aPath.Length() - index).AllocL(); - TPtr8 ptr = result->Des(); - RemoveSlashes(ptr); - aPath.Delete( index, aPath.Length() - index); - return result; - } - -// ----------------------------------------------------------------------------- -// UpnpAVCPEngine::ParsePathToElementsL -// ----------------------------------------------------------------------------- -// -void ParsePathToElementsL(TPtr8 aPath, RPointerArray& aArray ) - { - TChar delimiter('/'); - RemoveSlashes(aPath); - - TPtrC8 ptr(aPath); - TInt i = 0; - - while(KErrNotFound != ptr.Locate(delimiter)) - { - aArray.Append( new (ELeave)TPtrC8() ); - aArray[i]->Set(ptr.Left((ptr.Locate(delimiter)))); - ptr.Set(ptr.Right(ptr.Length() - (ptr.Locate(delimiter) + 1)) ); - i++; - } - - aArray.Append( new (ELeave) TPtrC8() ); - aArray[i]->Set(ptr); - } - -// ----------------------------------------------------------------------------- -// UpnpAVCPEngine::RemoveSlashes -// ----------------------------------------------------------------------------- -// -void RemoveSlashes(TDes8& aPath) - { - if (aPath.Length() > 0 && aPath[0] == '/' ) - { - aPath.Delete(0,1); - } - - // remove ending '/' - TInt length = aPath.Length(); - if (length > 0 && aPath[length-1] == '/' ) - { - aPath.Delete(length-1,1); - } - } - -} - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpavcpenginesession.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpavcpenginesession.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpAVCPEngineSession -* -*/ - - -// INCLUDE FILES -#include "upnpavcpenginesession.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" -#include "upnpcommand.h" - - - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::CContentControlSession -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpAVCPEngineSession::CUpnpAVCPEngineSession( const RThread& /*aClient*/, - CUpnpAVCPEngine& aAVCPEngine, - CUpnpAVCPManager& aManager) - : CSession2(), - iAVCPEngine( aAVCPEngine ), - iAVCPManager( aManager ) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngineSession::ConstructL() - { - iAVCPEngine.IncrementSessions(this); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::~CUpnpAVCPEngineSession -// Destructor. -// ----------------------------------------------------------------------------- -// -CUpnpAVCPEngineSession::~CUpnpAVCPEngineSession() - { - iAVCPEngine.DecrementSessions(this); - iCommandList.ResetAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::ServiceL -// Handle client requests. -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngineSession::ServiceL( const RMessage2& aMessage ) - { - TInt index = KErrNotFound; - switch ( aMessage.Function() ) - { - // getting result from previous invoked command - case EDownloadDeviceList: - case EDownloadDirList: - case EDownloadMetadata: - DEBUGSTRING(("Command for results with id %d", aMessage.Int0())); - index = CommandById(aMessage.Int0()); - - if (index != KErrNotFound) - { - CUpnpCommand* resultCommand = iCommandList[index]; - CleanupStack::PushL(resultCommand); - resultCommand->SetResultL(aMessage); - CleanupStack::PopAndDestroy(resultCommand); - aMessage.Complete(KErrNone); - } - else - { - DEBUGSTRING(("Results not found %d", aMessage.Int0())); - aMessage.Complete(KErrNotFound); - } - break; - // all else commands - default: - CUpnpCommand* command = CUpnpCommand::NewL(iAVCPManager, *this, aMessage); - if (command) - { - iCommandList.AppendL(command); - CleanupStack::PushL(command); - command->ExecuteL(); - CleanupStack::Pop(command); // it will be destroyed after completion - } - else - { - PanicClient( aMessage, EAVCPEngineBadRequest ); - } - break; - } - - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::RemoveCommand -// remove command -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngineSession::RemoveCommand(CUpnpCommand* aCommand) - { - TInt index = iCommandList.Find(aCommand); - if (index != KErrNotFound) - { - DEBUGSTRING8(("CUpnpAVCPEngineSession::RemoveCommand with index %d", index)); - iCommandList.Remove(index); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::CommandById -// Index of command with given id -// ----------------------------------------------------------------------------- -// -TInt CUpnpAVCPEngineSession::CommandById(TInt aId) - { - TInt i = KErrNotFound; - - for ( i=0; i < iCommandList.Count() && iCommandList[i]->Id() != aId; i++ ) - {} - - if ( i != iCommandList.Count() ) - { - return i; - } - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::PanicClient -// Panic client -// ----------------------------------------------------------------------------- -// -void CUpnpAVCPEngineSession::PanicClient( const RMessage2 &aMessage, TInt aPanic ) const - { - aMessage.Panic( KAVCPEngine, aPanic ) ; // Note: this panics the client thread, not server - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPEngineSession::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpAVCPEngineSession* CUpnpAVCPEngineSession::NewL( - const RThread& aClient, - CUpnpAVCPEngine& aServer, - CUpnpAVCPManager& aManager ) - { - CUpnpAVCPEngineSession* self = new (ELeave) CUpnpAVCPEngineSession( - aClient, aServer, aManager); - CleanupStack::PushL( self ); - self->ConstructL() ; - CleanupStack::Pop( self ) ; - return self ; - } - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpavcpmanager.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpavcpmanager.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpAVCPManager -* -*/ - - -// INCLUDE FILES - -#include "upnpavcpmanager.h" -#include "upnpavcpenginehelper.h" -#include "upnppathresolver.h" -#include "upnpresponsehandler.h" -#include "upnpmdebug.h" -#include "upnpavcpenginecommon.h" - - - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::NewL -// Creates an instance of the implementation. -// ----------------------------------------------------------------------------- -CUpnpAVCPManager* CUpnpAVCPManager::NewL() - { - CUpnpAVCPManager* self = new (ELeave) CUpnpAVCPManager(NULL); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::CUpnpAVCPManager -// First phase construction. -// ----------------------------------------------------------------------------- -CUpnpAVCPManager::CUpnpAVCPManager(MUpnpAVControlPointObserver* aObserver):CUpnpAVControlPoint((MUpnpAVControlPointObserver&)aObserver) - { - - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::ConstructL -// Second phase construction. -// ----------------------------------------------------------------------------- -void CUpnpAVCPManager::ConstructL() - { - - _LIT8( KMediaServer, "MediaServer" ); - //CUpnpControlPoint::ConstructL( KMediaServer, value ); - CUpnpControlPoint::ConstructL( KMediaServer ); - InitializeCdsActionFactoryL(); - - // maybe we should look for something different?? - TPtrC8 devicePtr; - devicePtr.Set( UpnpSSDP::KSearchTargetAll ); - //SSDP search for mediaserver UPnP devices - DEBUGSTRING(("Search for devices")); - SearchL( devicePtr ); - } - -// ----------------------------------------------------------------------------- -// Destructor. -// ----------------------------------------------------------------------------- -CUpnpAVCPManager::~CUpnpAVCPManager() - { - iPendingHandlers.Reset(); - iHttpPendingHandlers.Reset(); - iPathResolvers.ResetAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::NewCommandId -// return new command id -// ----------------------------------------------------------------------------- -TInt CUpnpAVCPManager::NewCommandId() - { - return ++iLastCommandId; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::PathResolver -// return resolver or creates a new one -// ----------------------------------------------------------------------------- -CUpnpPathResolver& CUpnpAVCPManager::PathResolverL(const TDesC8& aUUID, CUpnpAVCPEngineSession* aSession) - { - - CUpnpPathResolver* resolver = CUpnpPathResolver::NewL(*this,aUUID); - CleanupStack::PushL(resolver); - - TIdentityRelation matcher( CUpnpPathResolver::Match ); - TInt idx = iPathResolvers.Find( resolver, matcher ); - - - if (idx != KErrNotFound) - { - CleanupStack::PopAndDestroy(resolver); - resolver = iPathResolvers[idx]; - } - else - { - //subscribe - CUpnpDevice* device = const_cast(Device(aUUID)); - if (device) - { - CUpnpService* service = Service(device, UpnpAVCPEngine::KContentDirectory); - DEBUGSTRING8(("Subscribe for events")); - SubscribeL( service ); - } - else - { - User::Leave(KErrNotFound); - } - CleanupStack::Pop(resolver); - iPathResolvers.AppendL(resolver); - } - - resolver->RegisterSession(aSession); - return *resolver; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::CleanupSession -// cleanup after closed client session -// ----------------------------------------------------------------------------- -void CUpnpAVCPManager::CleanupSessionL( CUpnpAVCPEngineSession* aSession) - { - DEBUGSTRING8(("CleanupSessionL")); - for (TInt i = 0; i < iPathResolvers.Count(); i++ ) - { - if (iPathResolvers[i]->UnregisterSession(aSession) == 0 ) - { - //unsubscribe - CUpnpDevice* device = const_cast(Device(iPathResolvers[i]->UUID())); - if (device) - { - CUpnpService* service = Service(device, UpnpAVCPEngine::KContentDirectory); - DEBUGSTRING8(("UnsubscribeL for events")); - UnsubscribeL( service ); - } - - //remove - delete iPathResolvers[i]; - iPathResolvers.Remove(i); - i--; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::RegisterForAction -// register for get action responses -// ----------------------------------------------------------------------------- -void CUpnpAVCPManager::RegisterForAction(MUpnpResponseHandler& aHandler) - { - iPendingHandlers.AppendL(&aHandler); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::HandlerBySessionId -// return index of handler for specific session -// ----------------------------------------------------------------------------- -TInt CUpnpAVCPManager::HandlerBySessionId(TInt aSessionId) - { - TInt i = KErrNotFound; - - for ( i=0; i < iPendingHandlers.Count() && iPendingHandlers[i]->SessionId() != aSessionId; i++ ) - {} - - if ( i != iPendingHandlers.Count() ) - { - return i; - } - return KErrNotFound; - } -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::HandlerBySessionId -// return index of handler for specific session -// ----------------------------------------------------------------------------- -void CUpnpAVCPManager::RegisterForHttp(MUpnpHttpResponseHandler& aHandler) - { - iHttpPendingHandlers.AppendL(&aHandler); - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::HandlerBySessionId -// return index of handler for specific session -// ----------------------------------------------------------------------------- -void CUpnpAVCPManager::UnregisterForHttp(MUpnpHttpResponseHandler& aHandler) - { - TInt index = iHttpPendingHandlers.Find(&aHandler); - if (index != KErrNotFound) - { - iHttpPendingHandlers.Remove(index); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::HandlerBySessionId -// return index of handler for specific session -// ----------------------------------------------------------------------------- -TInt CUpnpAVCPManager::HttpHandlerBySessionId(TInt aSessionId) - { - TInt i = KErrNotFound; - - for ( i=0; i < iHttpPendingHandlers.Count() && iHttpPendingHandlers[i]->SessionId() != aSessionId; i++ ) - {} - - if ( i != iHttpPendingHandlers.Count() ) - { - return i; - } - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::HandlerBySessionId -// return index of handler for specific session -// ----------------------------------------------------------------------------- -void CUpnpAVCPManager::ActionResponseReceivedL(CUpnpAction* aAction) - { - TInt sessionId = aAction->SessionId(); - TInt index = HandlerBySessionId(sessionId); - if (index != KErrNotFound) - { - MUpnpResponseHandler* handler = iPendingHandlers[index]; - iPendingHandlers.Remove(index); - handler->InterpretL(aAction->Error(), aAction); - } - - } - -// ----------------------------------------------------------------------------- -// CUpnpAVCPManager::StateUpdatedL -// Handles UPnP device events. -// ----------------------------------------------------------------------------- -void CUpnpAVCPManager::StateUpdatedL(CUpnpService* aService) - { - CUpnpPathResolver* resolver = CUpnpPathResolver::NewL(*this,aService->Device().Uuid()); - CleanupStack::PushL(resolver); - - TIdentityRelation matcher( CUpnpPathResolver::Match ); - TInt idx = iPathResolvers.Find( resolver, matcher ); - CleanupStack::PopAndDestroy(resolver); - - if (idx != KErrNotFound) - { - CUpnpStateVariable* systemUpdateId = aService->StateVariable( UpnpAVCPEngine::KSystemUpdateID ); - if (systemUpdateId) - { - (iPathResolvers[idx])->StateChangedL(systemUpdateId->Value()); - } - - } - } - -// -------------------------------------------------------------------------- -// CUpnpAVCPManager::HttpResponseReceivedL -// Handles HTTP messages. -// -------------------------------------------------------------------------- -void CUpnpAVCPManager::HttpResponseReceivedL(CUpnpHttpMessage* aMessage) - { - TInt sessionId = aMessage->SessionId(); - - TInt index = HttpHandlerBySessionId(sessionId); - if (index != KErrNotFound) - { - MUpnpHttpResponseHandler* handler = iHttpPendingHandlers[index]; - handler->InterpretL(aMessage->Error(), aMessage); - } - else - { - index = index; - } - } - -// -------------------------------------------------------------------------- -// CUpnpAVCPManager::DeviceDiscoveredL -// Handles UPnP device discoveries. -// -------------------------------------------------------------------------- -void CUpnpAVCPManager::DeviceDiscoveredL(CUpnpDevice* aDevice) - { - TPtrC8 uuid = aDevice->Uuid(); - TPtrC8 fn = aDevice->DescriptionProperty(KAVCPEngineFriendlyName); - DEBUGSTRING8(("DeviceDiscoveredL %S %S", &uuid, &fn)); - } - -// -------------------------------------------------------------------------- -// CUpnpAVCPManager::DeviceDisappearedL( -// Handles UPnP device disappears. -// -------------------------------------------------------------------------- -void CUpnpAVCPManager::DeviceDisappearedL(CUpnpDevice* aDevice) - { - TPtrC8 uuid = aDevice->Uuid(); - DEBUGSTRING8(("DeviceDiscoveredL %S", &uuid)); - - CUpnpPathResolver* resolver = CUpnpPathResolver::NewL(*this,aDevice->Uuid()); - CleanupStack::PushL(resolver); - - TIdentityRelation matcher( CUpnpPathResolver::Match ); - TInt idx = iPathResolvers.Find( resolver, matcher ); - CleanupStack::PopAndDestroy(resolver); - - if (idx != KErrNotFound) - { - delete iPathResolvers[idx]; - iPathResolvers.Remove(idx); - } - } - -// end of file - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpbrowsecommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpbrowsecommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,345 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpBrowseCommand -* -*/ - - -#include "upnpbrowsecommand.h" - -#include "upnppathresolver.h" -#include "upnppathelement.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" - -#include "upnphttpmessagefactory.h" -#include "upnpstring.h" -#include "upnpcons.h" - -#include "upnpavcpenginehelper.h" -using namespace UpnpAVCPEngine; - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpBrowseCommand* CUpnpBrowseCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpBrowseCommand* self = new( ELeave ) CUpnpBrowseCommand(aAVCPManager, aSession, aMessage); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::ConstructL() - { - CUpnpCommand::BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::CUpnpBrowseCommand -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -CUpnpBrowseCommand::CUpnpBrowseCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - CUpnpCommand( aAVCPManager, - aSession, - aMessage) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::~CUpnpBrowseCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpBrowseCommand::~CUpnpBrowseCommand() - { - delete iObjectId; - delete iObjectName; - iResult.Reset(); - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpBrowseCommand::SessionId() - { - return CUpnpCommand::SessionId(); - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::RunError(TInt aErrorCode) - { - return CUpnpCommand::RunError(aErrorCode); - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::ExecuteL -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::ExecuteL() - { - //ASSERT(iType == EPrepareDirList || iType == EDirAttributes || iType == EFileAttributes); - - HBufC8* uuid = NULL; - HBufC8* path = NULL; - if (iType == EPrepareDirList) - { - DEBUGSTRING(("Execute Browse command (dir listing)")); - // set command id - TPckg numPckg(iId); - iMessage.WriteL(0, numPckg); - - uuid = ReadDes8FromMessageLC(2); - DEBUGSTRING8((" uuid: %S",uuid)); - path = ReadDes8FromMessageLC(3); - DEBUGSTRING8((" path: %S",path)); - } - else - { - DEBUGSTRING(("Execute Browse command (attributes)")); - uuid = ReadDes8FromMessageLC(0); - DEBUGSTRING8((" uuid: %S",uuid)); - path = ReadDes8FromMessageLC(1); - DEBUGSTRING8((" path: %S",path)); - } - - iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession)); - DEBUGSTRING(("Resolve path %S", path)); - iPathResolver->ResolveIdL(*path, *this); - - CleanupStack::PopAndDestroy(path); - CleanupStack::PopAndDestroy(uuid); - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::SetResultL -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::SetResultL(const RMessage2& aMessage) - { - //ASSERT(aMessage.Function() == EDownloadDirList); - - TInt size = iResult.Count(); - TFileInfo* dirs = new TFileInfo[size]; - for (TInt i = 0; i < size; i++) - { - dirs[i] = iResult[i]; - } - TPtr8 result(reinterpret_cast(dirs), sizeof(TFileInfo)*size, sizeof(TFileInfo)*size); - aMessage.WriteL(1, result); - delete[] dirs; - } - - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::SetAttForObject -// ----------------------------------------------------------------------------- -// -TBool CUpnpBrowseCommand::SetAttForObject(RArray& aList, const TDesC8& aName) - { - TBool result(EFalse); - for (TInt i = 0; i < aList.Count(); i++) - { - if (aList[i].iName.Compare(aName) == 0) - { - iAttr = aList[i]; - result = ETrue; - break; - } - } - return result; - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::SendHeadRequestL -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::SendHeadRequestL(const TDesC8& aUrl) - { - DEBUGSTRING8(("Send HTTP HEAD request for %S", &aUrl)); - - HBufC8* resURIencoded = UpnpString::StringReplaceL(aUrl, _L8(" "), _L8("%20")); - - // we want wait for HEAD to get more info - CleanupStack::PushL(resURIencoded); - CUpnpHttpMessage* msg = RUpnpHttpMessageFactory::HttpHeadL( *resURIencoded ); - CleanupStack::PopAndDestroy(resURIencoded); - - CleanupStack::PushL( msg ); - - iAVCPManager.SendL(msg); - iSessionId = msg->SessionId(); - iAVCPManager.RegisterForHttp(*this); - - CleanupStack::PopAndDestroy( msg ); - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) - { - DEBUGSTRING(("Interpret action response %d", aErrorCode)); - if (aErrorCode == EHttp200Ok ) - { - - TInt startIndex = StrToIntL( aAction->ArgumentValue( KStartingIndex ) ); - TInt requestCount = StrToIntL( aAction->ArgumentValue( KRequestedCount ) ); - - TInt numberReturned = StrToIntL( aAction->ArgumentValue( KNumberReturned ) ); - TInt totalMatches = StrToIntL( aAction->ArgumentValue( KTotalMatches ) ); - - HBufC8* resURI = NULL; - - if (iType == EFileAttributes) - { - iPathResolver->ParseBrowseResponseL( aAction->ArgumentValue( KResult ), &iResult, *iObjectId, &resURI); - } - else - { - iPathResolver->LockReset(); - iPathResolver->ParseBrowseResponseL( aAction->ArgumentValue( KResult ), &iResult); - } - - if (iType == EPrepareDirList) - { - - if ( startIndex+numberReturned < totalMatches) - { - iStartIndex += KRequestedCountLimit; - iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(),*iObjectId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8); - iAVCPManager.RegisterForAction(*this); - } - else - { - iPathResolver->UnlockReset(); - TInt num(iResult.Count()); - TPckg numPckg(num); - // size of directory list - iMessage.WriteL(1, numPckg); - iMessage.Complete(KErrNone); - // don't destroy and wait for next command - } - } - else - { - if (SetAttForObject(iResult, *iObjectName)) - { - if (iType == EFileAttributes && resURI) - { - CleanupStack::PushL(resURI); - SendHeadRequestL(*resURI); - CleanupStack::PopAndDestroy(resURI); - resURI = NULL; - } - else - { - TPckg attrPckg(iAttr); - iMessage.WriteL(2,attrPckg); - iMessage.Complete(KErrNone); - delete this; - } - } - else - { - iMessage.Complete(KErrNotFound); - delete resURI; - delete this; - } - } - } - else - { - iPathResolver->UnlockReset(); - iMessage.Complete(KErrAbort); - delete this; - } - - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::InterpretL(TInt aErrorCode, CUpnpHttpMessage* aMessage) - { - DEBUGSTRING(("HTTP Interpret %d", aErrorCode)); - // transfer pending - if (aErrorCode == KHttpGetStarted) - { - return; - } - iAVCPManager.UnregisterForHttp(*this); - if (aErrorCode == EHttp200Ok || aErrorCode == EHttpPartialContent) - { - // set some attrs - iAttr.iMimeType = aMessage->GetHeaderValue(UpnpHTTP::KHdrContentType); - TDesC8& size = aMessage->GetHeaderValue(UpnpHTTP::KHdrContentLength); - TLex8 intLex( size ); - intLex.Val( iAttr.iSize ); - } - - TPckg attrPckg(iAttr); - iMessage.WriteL(2,attrPckg); - iMessage.Complete(KErrNone); - delete this; - } - -// ----------------------------------------------------------------------------- -// CUpnpBrowseCommand::ResolvedId -// ----------------------------------------------------------------------------- -// -void CUpnpBrowseCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement) - { - DEBUGSTRING(("ResolvedId %d", aErrCode)); - if (aErrCode == KErrNone) - { - iObjectId = aIdElement->Id().AllocL(); - iObjectName = aIdElement->Name().AllocL(); - DEBUGSTRING(("Resolved object %S %S", iObjectId, iObjectName)); - if (iType == EPrepareDirList) - { - iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8); - } - else - { - iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata, KDefaultBrowseFilter, 0, 0, KNullDesC8); - } - iAVCPManager.RegisterForAction(*this); - } - else - { - iMessage.Complete(KErrNotFound); - delete this; - } - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpcommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpcommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpCommand -* -*/ - - -// INCLUDE FILES -#include "upnpcommand.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" -#include "upnpavcpenginesession.h" -// commands -#include "upnpdevicelistcommand.h" -#include "upnpbrowsecommand.h" -#include "upnpdownloadcommand.h" -#include "upnpuploadcommand.h" -#include "upnpcreatecommand.h" -#include "upnpdeletecommand.h" -#include "upnpmetadatacommand.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUpnpCommand::CUpnpCommand -// C++ default constructor can NOT contain any code, that -// might leae. -// ----------------------------------------------------------------------------- -CUpnpCommand::CUpnpCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - iAVCPManager(aAVCPManager), - iSession(aSession), - iMessage(aMessage) - { - iType = (TAVCPEngineRqst)iMessage.Function(); - iId = aAVCPManager.NewCommandId(); - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::BaseConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpCommand::BaseConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpCommand* CUpnpCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpCommand* command = NULL; - switch (aMessage.Function()) - { - case EPrepareDeviceList: - command = CUpnpDeviceListCommand::NewL(aAVCPManager, aSession, aMessage); - break; - case EPrepareDirList: - case EDirAttributes: - case EFileAttributes: - command = CUpnpBrowseCommand::NewL(aAVCPManager, aSession, aMessage); - break; - case EGetFile: - command = CUpnpDownloadCommand::NewL(aAVCPManager, aSession, aMessage); - break; - case EPutFile: - command = CUpnpUploadCommand::NewL(aAVCPManager, aSession, aMessage); - break; - case EDeleteFile: - case EDeleteDirectory: - command = CUpnpDeleteCommand::NewL(aAVCPManager, aSession, aMessage); - break; - case ECreateFile: - case ECreateDirectory: - command = CUpnpCreateCommand::NewL(aAVCPManager, aSession, aMessage); - break; - case EPrepareMetadata: - case ESetMetadata: - command = CUpnpMetadataCommand::NewL(aAVCPManager, aSession, aMessage); - break; - } - - return command; - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::~CUpnpCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpCommand::~CUpnpCommand() - { - iSession.RemoveCommand(this); - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::Id -// ----------------------------------------------------------------------------- -// -TInt CUpnpCommand::Id() - { - return iId; - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpCommand::SessionId() - { - return iSessionId; - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::ReadDes8FromMessageLC -// ----------------------------------------------------------------------------- -// -HBufC8* CUpnpCommand::ReadDes8FromMessageLC(TInt aIndex) - { - HBufC8* result = NULL; - TInt length = iMessage.GetDesLength( aIndex ); - result = HBufC8::NewLC(length); - TPtr8 resultPtr = result->Des(); - iMessage.ReadL( aIndex, resultPtr ); - return result; - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::ReadDes16FromMessageLC -// ----------------------------------------------------------------------------- -// -HBufC* CUpnpCommand::ReadDes16FromMessageLC(TInt aIndex) - { - HBufC* result = NULL; - TInt length = iMessage.GetDesLength( aIndex ); - result = HBufC::NewLC(length); - TPtr resultPtr = result->Des(); - iMessage.ReadL( aIndex, resultPtr ); - return result; - } - -// ----------------------------------------------------------------------------- -// CUpnpCommand::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpCommand::RunError(TInt /*aErrorCode*/) - { - if (iMessage.Handle() != 0) - iMessage.Complete(KErrAbort); - delete this; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpcreatecommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpcreatecommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,228 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpCreateCommand -* -*/ - - -#include "upnpcreatecommand.h" - -#include "upnppathresolver.h" -#include "upnppathelement.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" - -#include "upnpavcpenginehelper.h" -using namespace UpnpAVCPEngine; -#include "upnpstring.h" - - -_LIT8(KCreateFileTemplate, - " \ - \ - %S \ - object.item \ - \ - \ - "); - -_LIT8(KCreateDirTemplate, -" \ - \ - %S \ - object.container \ - \ - "); - - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpCreateCommand* CUpnpCreateCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpCreateCommand* self = new( ELeave ) CUpnpCreateCommand(aAVCPManager, aSession, aMessage); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpCreateCommand::ConstructL() - { - CUpnpCommand::BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::CUpnpCreateCommand -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpCreateCommand::CUpnpCreateCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - CUpnpCommand( aAVCPManager, - aSession, - aMessage) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::~CUpnpCreateCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpCreateCommand::~CUpnpCreateCommand() - { - delete iObjectId; - delete iTargetName; - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpCreateCommand::SessionId() - { - return CUpnpCommand::SessionId(); - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpCreateCommand::RunError(TInt aErrorCode) - { - return CUpnpCommand::RunError(aErrorCode); - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::ExecuteL -// ----------------------------------------------------------------------------- -// -void CUpnpCreateCommand::ExecuteL() - { - //ASSERT(iType == ECreateDirectory || iType == ECreateFile ); - - HBufC8* uuid = NULL; - HBufC8* path = NULL; - DEBUGSTRING(("Execute Create command ")); - uuid = ReadDes8FromMessageLC(0); - DEBUGSTRING8((" uuid: %S",uuid)); - path = ReadDes8FromMessageLC(1); - DEBUGSTRING8((" path: %S",path)); - - TPtr8 pathPtr = path->Des(); - // removes also last element of path - iTargetName = GetLastPathElementL(pathPtr); - - iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession)); - iPathResolver->ResolveIdL(*path, *this); - - CleanupStack::PopAndDestroy(path); - CleanupStack::PopAndDestroy(uuid); - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::SetResultL -// ----------------------------------------------------------------------------- -// -void CUpnpCreateCommand::SetResultL(const RMessage2& /*aMessage*/) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpCreateCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) - { - DEBUGSTRING(("Interpret action response %d", aErrorCode)); - if (aErrorCode == EHttp200Ok ) - { - if (iType == ECreateDirectory) - { - iMessage.Complete(KErrNone); - } - else - { - if(iPathResolver->BrowseCreateObjectL( aAction->ArgumentValue( KResult ))) - { - iMessage.Complete(KErrNone); - } - else - { - iMessage.Complete(KErrAbort); - } - } - - } - else - { - iMessage.Complete(KErrAbort); - } - delete this; - } - -// ----------------------------------------------------------------------------- -// CUpnpCreateCommand::ResolvedId -// ----------------------------------------------------------------------------- -// -void CUpnpCreateCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement) - { - if (aErrCode == KErrNone) - { - iElement = aIdElement; - iObjectId = aIdElement->Id().AllocL(); - HBufC8* createMsg; - if (iType == ECreateDirectory ) - { - createMsg = HBufC8::NewLC(KCreateDirTemplate().Length() + iObjectId->Length() + iTargetName->Length()); - createMsg->Des().AppendFormat(KCreateDirTemplate, iObjectId, iTargetName); - } - else - { - createMsg = HBufC8::NewLC(KCreateFileTemplate().Length() + iObjectId->Length() + iTargetName->Length()); - createMsg->Des().AppendFormat(KCreateFileTemplate, iObjectId, iTargetName); - } - HBufC8* encoded = UpnpString::EncodeXmlStringL( createMsg ); - CleanupStack::PopAndDestroy(createMsg); - CleanupStack::PushL(encoded); - - iSessionId = iAVCPManager.CdsCreateObjectActionL(iPathResolver->UUID(), *iObjectId, *encoded); - iAVCPManager.RegisterForAction(*this); - - CleanupStack::PopAndDestroy(encoded); - - } - else - { - iMessage.Complete(KErrNotFound); - delete this; - } - - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpdeletecommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpdeletecommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpDeleteCommand -* -*/ - - -#include "upnpdeletecommand.h" - -#include "upnppathresolver.h" -#include "upnppathelement.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" - - -#include "upnpavcpenginehelper.h" -using namespace UpnpAVCPEngine; - - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpDeleteCommand* CUpnpDeleteCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpDeleteCommand* self = new( ELeave ) CUpnpDeleteCommand(aAVCPManager, aSession, aMessage); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpDeleteCommand::ConstructL() - { - CUpnpCommand::BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::CUpnpDeleteCommand -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpDeleteCommand::CUpnpDeleteCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - CUpnpCommand( aAVCPManager, - aSession, - aMessage) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::~CUpnpDeleteCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpDeleteCommand::~CUpnpDeleteCommand() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpDeleteCommand::SessionId() - { - return CUpnpCommand::SessionId(); - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpDeleteCommand::RunError(TInt aErrorCode) - { - return CUpnpCommand::RunError(aErrorCode); - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::ExecuteL -// ----------------------------------------------------------------------------- -// -void CUpnpDeleteCommand::ExecuteL() - { - //ASSERT(iType == EDeleteDirectory || iType == EDeleteFile ); - - HBufC8* uuid = NULL; - HBufC8* path = NULL; - DEBUGSTRING(("Execute Delete command")); - - uuid = ReadDes8FromMessageLC(0); - DEBUGSTRING8((" uuid: %S",uuid)); - path = ReadDes8FromMessageLC(1); - DEBUGSTRING8((" path: %S",path)); - - iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession)); - - iPathResolver->ResolveIdL(*path, *this); - - CleanupStack::PopAndDestroy(path); - CleanupStack::PopAndDestroy(uuid); - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::SetResultL -// ----------------------------------------------------------------------------- -// -void CUpnpDeleteCommand::SetResultL(const RMessage2& /*aMessage*/) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpDeleteCommand::InterpretL(TInt aErrorCode, CUpnpAction* /*aAction*/) - { - DEBUGSTRING(("Interpret action response %d", aErrorCode)); - if (aErrorCode == EHttp200Ok) - { - iMessage.Complete(KErrNone); - } - else - { - iMessage.Complete(KErrAbort); - } - delete this; - } - -// ----------------------------------------------------------------------------- -// CUpnpDeleteCommand::ResolvedId -// ----------------------------------------------------------------------------- -// -void CUpnpDeleteCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement) - { - if (aErrCode == KErrNone) - { - //remove from remote MS - iSessionId = iAVCPManager.CdsDestroyObjectActionL(iPathResolver->UUID(), aIdElement->Id()); - iAVCPManager.RegisterForAction(*this); - // remove from local cache - iPathResolver->RemoveElementD(aIdElement); - } - else - { - iMessage.Complete(KErrNotFound); - delete this; - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpdevicelistcommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpdevicelistcommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpDeviceListCommand -* -*/ - - -#include "upnpdevicelistcommand.h" - -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" - - -// ----------------------------------------------------------------------------- -// CUpnpDeviceListCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpDeviceListCommand* CUpnpDeviceListCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpDeviceListCommand* self = new( ELeave ) CUpnpDeviceListCommand(aAVCPManager, aSession, aMessage); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpDeviceListCommand::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpDeviceListCommand::ConstructL() - { - CUpnpCommand::BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpDeviceListCommand::CUpnpDeviceListCommand -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpDeviceListCommand::CUpnpDeviceListCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - CUpnpCommand( aAVCPManager, - aSession, - aMessage) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpDeviceListCommand::~CUpnpDeviceListCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpDeviceListCommand::~CUpnpDeviceListCommand() - { - delete[] iDevices; - } - - -// ----------------------------------------------------------------------------- -// CUpnpDeviceListCommand::ExecuteL -// ----------------------------------------------------------------------------- -// -void CUpnpDeviceListCommand::ExecuteL() - { - //ASSERT(iType == EPrepareDeviceList); - - RPointerArray devices = iAVCPManager.DeviceList(); - iDeviceCount = devices.Count(); - DEBUGSTRING8(("Execute DeviceListCommand no. %d",iDeviceCount)); - - // set command id - TPckg idPckg(iId); - iMessage.WriteL(0, idPckg); - - // set device count - list only MS devices - TPckg devCountPckg(iDeviceCount); - iMessage.WriteL(1, devCountPckg); - - iMessage.Complete(KErrNone); - - if ( iDeviceCount > 0) - { - iDevices = new(ELeave)TAVDevice[iDeviceCount]; - for (TInt i = 0; i < iDeviceCount; i++) - { - CUpnpDevice* device = devices[i]; - iDevices[i].iUDN.Copy( device->Uuid() ); - iDevices[i].iFriendlyName.Copy( device->DescriptionProperty(KAVCPEngineFriendlyName) ); - } - } - else - { - delete this; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpDeviceListCommand::SetResultL -// ----------------------------------------------------------------------------- -// -void CUpnpDeviceListCommand::SetResultL(const RMessage2& aMessage) - { - DEBUGSTRING8(("Set Result from DeviceListCommand")); - //ASSERT(aMessage.Function() == EDownloadDeviceList); - if (iDevices) - { - TPtr8 result(reinterpret_cast(iDevices), sizeof(TAVDevice)*iDeviceCount, sizeof(TAVDevice)*iDeviceCount); - aMessage.WriteL(1, result); - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpdownloadcommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpdownloadcommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,257 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpDownloadCommand -* -*/ - - -#include "upnpdownloadcommand.h" - -#include "upnppathresolver.h" -#include "upnppathelement.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" -#include "upnphttpmessagefactory.h" - -#include "upnpstring.h" - -#include "upnpavcpenginehelper.h" -using namespace UpnpAVCPEngine; - -_LIT8(KFilterFlag, "res,res@protocolInfo"); - -// Operation option flags -const TUint KRemoteAccessOptionGetToStartOfFile = 0x01; - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpDownloadCommand* CUpnpDownloadCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpDownloadCommand* self = new( ELeave ) CUpnpDownloadCommand(aAVCPManager, aSession, aMessage); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpDownloadCommand::ConstructL() - { - CUpnpCommand::BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::CUpnpDownloadCommand -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpDownloadCommand::CUpnpDownloadCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - CUpnpCommand( aAVCPManager, - aSession, - aMessage) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::~CUpnpDownloadCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpDownloadCommand::~CUpnpDownloadCommand() - { - delete iObjectId; - delete iDestPath; - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpDownloadCommand::SessionId() - { - return CUpnpCommand::SessionId(); - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpDownloadCommand::RunError(TInt aErrorCode) - { - return CUpnpCommand::RunError(aErrorCode); - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::ExecuteL -// ----------------------------------------------------------------------------- -// -void CUpnpDownloadCommand::ExecuteL() - { - //ASSERT(iType == EGetFile); - - HBufC8* uuid = NULL; - HBufC8* srcPath = NULL; - HBufC* destPath = NULL; - - DEBUGSTRING(("Execute Download command ")); - - uuid = ReadDes8FromMessageLC(0); - DEBUGSTRING8((" uuid: %S",uuid)); - srcPath = ReadDes8FromMessageLC(1); - DEBUGSTRING8((" srcPath: %S",srcPath)); - destPath = ReadDes16FromMessageLC(2); - DEBUGSTRING16((" destPath: %S",destPath)); - - TPckg posPkg(iPosition); - iMessage.ReadL( 3,posPkg ); - - // convert to 8-bit representation - iDestPath = HBufC8::NewL(destPath->Length()); - iDestPath->Des().Copy(*destPath); - - iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession)); - - iPathResolver->ResolveIdL(*srcPath, *this); - - - CleanupStack::PopAndDestroy(destPath); - CleanupStack::PopAndDestroy(srcPath); - CleanupStack::PopAndDestroy(uuid); - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::SetResultL -// ----------------------------------------------------------------------------- -// -void CUpnpDownloadCommand::SetResultL(const RMessage2& /*aMessage*/) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpDownloadCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) - { - DEBUGSTRING(("Interpret action response %d", aErrorCode)); - HBufC8* resURI = NULL; - if (aErrorCode == EHttp200Ok && - iPathResolver->GetResUriL( aAction->ArgumentValue( KResult ), *iObjectId, resURI)) - { - - DEBUGSTRING8(("Send HTTP GET request for %S", resURI)); - // encode URI - CleanupStack::PushL(resURI); - HBufC8* resURIencoded = UpnpString::StringReplaceL(*resURI, _L8(" "), _L8("%20")); - CleanupStack::PopAndDestroy(resURI); - - CleanupStack::PushL(resURIencoded); - CUpnpHttpMessage* msg = RUpnpHttpMessageFactory::HttpGetL( *resURIencoded ); - CleanupStack::PopAndDestroy(resURIencoded); - - CleanupStack::PushL( msg ); - msg->SetInFilenameL( *iDestPath, ETrue ); - msg->SetHttpPriority( EPriorityLess ); - - if (iPosition.iStart != 0 || iPosition.iLength != 0 ) - { - DEBUGSTRING8((" Use ramge header. From %d to %d (flag:%d) ", - iPosition.iStart, iPosition.iLength, iPosition.iFlags)); - iUseRange = ETrue; - if (iPosition.iFlags == KRemoteAccessOptionGetToStartOfFile) - msg->SetRangeL(iPosition.iStart, iPosition.iLength, ETrue); - else - msg->SetRangeL(iPosition.iStart, iPosition.iLength, EFalse); - } - - iAVCPManager.SendL(msg); - iSessionId = msg->SessionId(); - iAVCPManager.RegisterForHttp(*this); - - CleanupStack::PopAndDestroy( msg ); - } - else - { - DEBUGSTRING8((" No resouse URI found")); - iMessage.Complete(KErrAbort); - delete this; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpDownloadCommand::InterpretL(TInt aErrorCode, CUpnpHttpMessage* /*aMessage*/) - { - DEBUGSTRING(("HTTP Interpret %d", aErrorCode)); - if (aErrorCode == KHttpGetStarted) - { - // transfer pending - return; - } - iAVCPManager.UnregisterForHttp(*this); - if (aErrorCode == EHttp200Ok || aErrorCode == EHttpPartialContent) - { - if (iUseRange && aErrorCode == EHttp200Ok) - { - iPosition.iLength = 0; - TPckg posPkg(iPosition); - iMessage.WriteL( 3,posPkg ); - } - iMessage.Complete(KErrNone); - delete this; - } - else - { - iMessage.Complete(KErrAbort); - delete this; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpDownloadCommand::ResolvedId -// ----------------------------------------------------------------------------- -// -void CUpnpDownloadCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement) - { - DEBUGSTRING(("ResolvedId %d", aErrCode)); - if (aErrCode == KErrNone) - { - iObjectId = aIdElement->Id().AllocL(); - - iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata,KFilterFlag , 0, 0, KNullDesC8); - - iAVCPManager.RegisterForAction(*this); - } - else - { - iMessage.Complete(KErrNotFound); - delete this; - } -}; - -//End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpmetadatacommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpmetadatacommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpMetadataCommand -* -*/ - - -#include "upnpmetadatacommand.h" - -#include "upnppathresolver.h" -#include "upnppathelement.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" - -#include "upnpavcpenginehelper.h" -using namespace UpnpAVCPEngine; - -#include "upnpstring.h" - - -_LIT8(KFilterFlag, "*"); - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpMetadataCommand* CUpnpMetadataCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpMetadataCommand* self = new( ELeave ) CUpnpMetadataCommand(aAVCPManager, aSession, aMessage); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpMetadataCommand::ConstructL() - { - CUpnpCommand::BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::CUpnpMetadataCommand -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpMetadataCommand::CUpnpMetadataCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - CUpnpCommand( aAVCPManager, - aSession, - aMessage) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::~CUpnpMetadataCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpMetadataCommand::~CUpnpMetadataCommand() - { - delete iObjectId; - delete iResult; - delete iOldMetadata; - delete iNewMetadata; - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpMetadataCommand::SessionId() -{ - return CUpnpCommand::SessionId(); -} - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpMetadataCommand::RunError(TInt aErrorCode) - { - return CUpnpCommand::RunError(aErrorCode); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::ExecuteL -// ----------------------------------------------------------------------------- -// -void CUpnpMetadataCommand::ExecuteL() - { - //ASSERT(iType == EPrepareMetadata || iType == ESetMetadata); - - HBufC8* uuid = NULL; - HBufC8* path = NULL; - if (iType == EPrepareMetadata) - { - DEBUGSTRING(("Execute Metadata command (EPrepareMetadata)")); - // set command id - TPckg numPckg(iId); - iMessage.WriteL(0, numPckg); - - uuid = ReadDes8FromMessageLC(2); - DEBUGSTRING8((" uuid: %S",uuid)); - path = ReadDes8FromMessageLC(3); - DEBUGSTRING8((" path: %S",path)); - } - else - { - DEBUGSTRING(("Execute Metadata command (ESetMetadata)")); - uuid = ReadDes8FromMessageLC(0); - DEBUGSTRING8((" uuid: %S",uuid)); - path = ReadDes8FromMessageLC(1); - DEBUGSTRING8((" path: %S",path)); - - HBufC8* old = ReadDes8FromMessageLC(2); - iOldMetadata = UpnpString::EncodeXmlStringL(old); - CleanupStack::PopAndDestroy( old ); - - HBufC8* newXML = ReadDes8FromMessageLC(3); - iNewMetadata = UpnpString::EncodeXmlStringL( newXML ); - CleanupStack::PopAndDestroy( newXML); - } - - iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession)); - - iPathResolver->ResolveIdL(*path, *this); - - CleanupStack::PopAndDestroy(path); - CleanupStack::PopAndDestroy(uuid); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::SetResultL -// ----------------------------------------------------------------------------- -// -void CUpnpMetadataCommand::SetResultL(const RMessage2& aMessage) - { - //ASSERT(aMessage.Function() == EDownloadMetadata); - if (iResult) - { - TPtr8 result = iResult->Des(); - aMessage.WriteL(1, result); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpMetadataCommand::InterpretL(TInt aErrorCode, CUpnpAction* aAction) - { - DEBUGSTRING(("Interpret action response %d", aErrorCode)); - if (aErrorCode == EHttp200Ok) - { - - if (iType == EPrepareMetadata) - { - iResult = aAction->ArgumentValue( KResult ).AllocL(); - TInt num = iResult->Length(); - TPckg numPckg(num); - // size of metadata information - iMessage.WriteL(1, numPckg); - iMessage.Complete(KErrNone); - // don't destroy and wait for next command - } - else - { - // for set metadata - iMessage.Complete(KErrNone); - delete this; - } - - } - else - { - iMessage.Complete(KErrAbort); - delete this; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadataCommand::ResolvedId -// ----------------------------------------------------------------------------- -// -void CUpnpMetadataCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement) - { - - if (aErrCode == KErrNone) - { - iObjectId = aIdElement->Id().AllocL(); - if (iType == EPrepareMetadata) - { - iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata, KFilterFlag, 0, 0, KNullDesC8); - } - else //set metadata - { - iSessionId = iAVCPManager.CdsUpdateObjectActionL(iPathResolver->UUID(), *iObjectId, *iOldMetadata, *iNewMetadata); - delete iOldMetadata; - iOldMetadata = NULL; - delete iNewMetadata; - iNewMetadata = NULL; - } - iAVCPManager.RegisterForAction(*this); - } - else - { - iMessage.Complete(KErrNotFound); - delete this; - } - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnppathelement.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnppathelement.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpPathElement -* -*/ - - -// INCLUDE FILES -#include "upnppathelement.h" - - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::CUpnpPathElement -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpPathElement::CUpnpPathElement() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpPathElement::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpPathElement* CUpnpPathElement::NewL() - { - CUpnpPathElement* self = new( ELeave ) CUpnpPathElement; - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::~CUpnpPathElement -// Destructor -// ----------------------------------------------------------------------------- -// -CUpnpPathElement::~CUpnpPathElement() - { - delete iParentId; - delete iId; - delete iName; - delete iOriginalName; - delete iImportURI; - } - - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::SetParentIdL -// ----------------------------------------------------------------------------- -// -void CUpnpPathElement::SetParentIdL(const TDesC8& aParentId) - { - - delete iParentId; - iParentId = NULL; - - iParentId = aParentId.AllocL(); - - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::SetIdL -// ----------------------------------------------------------------------------- -// -void CUpnpPathElement::SetIdL(const TDesC8& aId) - { - - delete iId; - iId = NULL; - - iId = aId.AllocL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::SetNameL -// ----------------------------------------------------------------------------- -// -void CUpnpPathElement::SetNameL(const TDesC8& aName) - { - delete iName; - iName = NULL; - - iName = aName.AllocL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::SetImportURIL -// ----------------------------------------------------------------------------- -// -void CUpnpPathElement::SetImportURIL(const TDesC8& aImportURI) - { - delete iImportURI; - iImportURI = NULL; - - iImportURI = aImportURI.AllocL(); - } -// ----------------------------------------------------------------------------- -// CUpnpPathElement::SetOriginalNameL -// ----------------------------------------------------------------------------- -// -void CUpnpPathElement::SetOriginalNameL(const TDesC8& aOriginalName) - { - delete iOriginalName; - iOriginalName = NULL; - - iOriginalName = aOriginalName.AllocL(); - } -// ----------------------------------------------------------------------------- -// CUpnpPathElement::DeleteOriginalName -// ----------------------------------------------------------------------------- -// -void CUpnpPathElement::DeleteOriginalName() - { - delete iOriginalName; - iOriginalName = NULL; - } -// ----------------------------------------------------------------------------- -// CUpnpPathElement::OriginalName -// ----------------------------------------------------------------------------- -// -const TDesC8& CUpnpPathElement::OriginalName() const - { - if (iOriginalName) - { - return *iOriginalName; - } - else - { - return KNullDesC8; - } - } -// ----------------------------------------------------------------------------- -// CUpnpPathElement::ParentId -// ----------------------------------------------------------------------------- -// -const TDesC8& CUpnpPathElement::ParentId() const - { - if (iParentId) - { - return *iParentId; - } - else - { - return KNullDesC8; - } - - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::Id -// ----------------------------------------------------------------------------- -// -const TDesC8& CUpnpPathElement::Id() const - { - if (iId) - { - return *iId; - } - else - { - return KNullDesC8; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::Name -// ----------------------------------------------------------------------------- -// -const TDesC8& CUpnpPathElement::Name() const - { - if (iName) - { - return *iName; - } - else - { - return KNullDesC8; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::ImportURI -// ----------------------------------------------------------------------------- -// -const TDesC8& CUpnpPathElement::ImportURI() const - { - if (iImportURI) - { - return *iImportURI; - } - else - { - return KNullDesC8; - } - } -// ----------------------------------------------------------------------------- -// CUpnpPathElement::MatchName -// ----------------------------------------------------------------------------- -// -TBool CUpnpPathElement::MatchName(const CUpnpPathElement& aElement1, const CUpnpPathElement& aElement2) - { - return (aElement1.Name().Compare(aElement2.Name()) == 0) && - (aElement1.ParentId().Compare(aElement2.ParentId()) == 0); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathElement::MatchAll -// ----------------------------------------------------------------------------- -// -TBool CUpnpPathElement::MatchAll(const CUpnpPathElement& aElement1, const CUpnpPathElement& aElement2) - { - return (aElement1.Name().Compare(aElement2.Name()) == 0) && - (aElement1.ParentId().Compare(aElement2.ParentId()) == 0) && - (aElement1.Id().Compare(aElement2.Id()) == 0); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnppathresolver.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnppathresolver.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,695 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpPathResolver -* -*/ - - - -// INCLUDE FILES -#include "upnppathresolver.h" -#include "upnppathelement.h" -#include "upnpresolvehandler.h" -#include "upnpavcpmanager.h" - -#include "upnpavcpenginecommon.h" -#include "upnpavcpenginehelper.h" -using namespace UpnpAVCPEngine; - -#include "upnpstring.h" - -#include -#include - -#include "upnpdominterface.h" - -_LIT8(KIndexFormat, "(%d)"); - -const static TInt KMaxElementsLimit = 1000; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::CUpnpPathResolver -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpPathResolver::CUpnpPathResolver(CUpnpAVCPManager& aManager): - iManager(aManager), iUptodate(ETrue) - { - iSystemId = -1; - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::ConstructL(const TDesC8& aUUID) - { - iUUID = aUUID.AllocL(); - iDOMImpl.OpenL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpPathResolver* CUpnpPathResolver::NewL(CUpnpAVCPManager& aManager, const TDesC8& aUUID) - { - CUpnpPathResolver* self = new( ELeave ) CUpnpPathResolver(aManager); - - CleanupStack::PushL( self ); - self->ConstructL(aUUID); - CleanupStack::Pop( self ); - - return self; - } - - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::~CUpnpPathResolver -// Destructor -// ----------------------------------------------------------------------------- -// -CUpnpPathResolver::~CUpnpPathResolver() - { - delete iUUID; - iAVCPSessions.Reset(); - iPathElements.ResetAndDestroy(); - iResolveHandlers.ResetAndDestroy(); - iDOMImpl.Close(); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::UUID -// ----------------------------------------------------------------------------- -// -const TDesC8& CUpnpPathResolver::UUID() const - { - return *iUUID; - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::Match -// ----------------------------------------------------------------------------- -// -TBool CUpnpPathResolver::Match(const CUpnpPathResolver& aElement1, const CUpnpPathResolver& aElement2) - { - return (aElement1.UUID().Compare(aElement2.UUID()) == 0); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::RegisterSession -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::RegisterSession(CUpnpAVCPEngineSession* aSession) - { - TInt index = iAVCPSessions.Find(aSession); - if (index == KErrNotFound) - { - iAVCPSessions.AppendL(aSession); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::UnregisterSession -// ----------------------------------------------------------------------------- -// -TInt CUpnpPathResolver::UnregisterSession(CUpnpAVCPEngineSession* aSession) - { - TInt index = iAVCPSessions.Find(aSession); - if (index != KErrNotFound) - { - iAVCPSessions.Remove(index); - } - return iAVCPSessions.Count(); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::AddElementL -// ----------------------------------------------------------------------------- -// -const TDesC8& CUpnpPathResolver::AddElementL(const TDesC8& aParentId, const TDesC8& aId, const TDesC8& aName, const TDesC8& aImportURI) - { - // if we exceed max capacity for our cache, set to destroy all elements - if (iPathElements.Count() > KMaxElementsLimit) - iUptodate = EFalse; - - - CUpnpPathElement* elem = CUpnpPathElement::NewL(); - CleanupStack::PushL(elem); - elem->SetParentIdL(aParentId); - elem->SetIdL(aId); - elem->SetNameL(aName); - - TIdentityRelation matcher( CUpnpPathElement::MatchAll ); - // check if exist the same element - TInt idx = iPathElements.Find( elem, matcher ); - - if (idx != KErrNotFound) - { - if(aImportURI != KNullDesC8()) - { - iPathElements[idx]->SetImportURIL(aImportURI); - } - CleanupStack::PopAndDestroy(elem); - return iPathElements[idx]->Name(); - } - else - { - // check name duplication - TIdentityRelation matcherName( CUpnpPathElement::MatchName ); - TInt index = 0; - TInt dupIndex = iPathElements.Find( elem, matcherName ); - - while (dupIndex != KErrNotFound) - { - HBufC8* newName = HBufC8::NewLC(aName.Length() + 10 /*integer*/); - *newName = aName; - newName->Des().AppendFormat(KIndexFormat, ++index ); - // change to new name - elem->SetNameL(*newName); - CleanupStack::PopAndDestroy( newName ); - dupIndex = iPathElements.Find( elem, matcherName ); - // check if exists the same element - idx = iPathElements.Find( elem, matcher ); - if (idx != KErrNotFound) - { - if(aImportURI != KNullDesC8()) - { - iPathElements[idx]->SetImportURIL(aImportURI); - } - CleanupStack::PopAndDestroy(elem); - return iPathElements[idx]->Name(); - } - } - if(aImportURI != KNullDesC8()) - { - elem->SetImportURIL(aImportURI); - } - CleanupStack::Pop(elem); - iPathElements.AppendL(elem); - return elem->Name(); - } - - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::GetElementId -// ----------------------------------------------------------------------------- -// -CUpnpPathElement* CUpnpPathResolver::GetElementL(const TDesC8& aParentId, const TDesC8& aName) const - { - CUpnpPathElement* elem = CUpnpPathElement::NewL(); - CleanupStack::PushL(elem); - elem->SetNameL(aName); - elem->SetParentIdL(aParentId); - TIdentityRelation matcher( CUpnpPathElement::MatchName ); - TInt idx = iPathElements.Find( elem, matcher ); - CleanupStack::PopAndDestroy(elem); - if (idx != KErrNotFound) - { - return iPathElements[idx]; - } - else - { - return NULL; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::RemoveElement -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::RemoveElementD(CUpnpPathElement* aElement) - { - TInt index = iPathElements.Find(aElement); - if (index != KErrNotFound) - { - iPathElements.Remove(index); - delete aElement; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::ResolveIdL -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::ResolveIdL(const TDesC8& aPath, MUpnpResolverObserver& aObserver) - { - CUpnpResolveHandler* handler = CUpnpResolveHandler::NewL(iManager,*this, aObserver); - CleanupStack::PushL(handler); - iResolveHandlers.AppendL(handler); - handler->ResolveL(aPath); - CleanupStack::Pop(handler); - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::RemoveHandler -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::RemoveHandler(CUpnpResolveHandler* aHandler) - { - TInt index = iResolveHandlers.Find(aHandler); - if (index != KErrNotFound) - { - iResolveHandlers.Remove(index); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::LockReset -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::LockReset() - { - DEBUGSTRING8(("-> Obtain lock for resets")); - iLocked = ETrue; - } - - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::UnlockReset -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::UnlockReset() - { - DEBUGSTRING8(("<- Release lock for resets")); - iLocked = EFalse; - if (!iUptodate) - { - DEBUGSTRING8(("Remove all path elements")); - iPathElements.ResetAndDestroy(); - iUptodate = ETrue; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::StateChangedL -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::StateChangedL(const TDesC8& aSystemId) - { - - TLex8 updateidLex( aSystemId ); - TInt systemUpdate; - TInt err = updateidLex.Val( systemUpdate ); - if (err == KErrNone) - { - DEBUGSTRING8(("StateChangedL (old: %d)->(new: %d) ", iSystemId,systemUpdate)); - if (iSystemId != -1 && iSystemId != systemUpdate) - { - if (!iLocked) - { - DEBUGSTRING8(("Remove all path elements")); - iPathElements.ResetAndDestroy(); - } - else - { - iUptodate = EFalse; - } - } - iSystemId = systemUpdate; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::SetModifiedTimeL -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::SetModifiedTimeL(TXmlEngElement& aDateElement, TFileInfo& aEntry) - { - if (aDateElement.Value().Length()) - { - HBufC8* date = aDateElement.Value().AllocLC(); - - TPtrC8 datePtr = date->Des(); - - TInt position = datePtr.Locate('-'); - TInt step = 0; - TInt dateParts[3]; - while (position != KErrNotFound && step <3) - { - TLex8 lex(datePtr.Left(position)); - TInt value(0) ; - lex.Val(value); - - dateParts[step] = value; - step++; - - - datePtr.Set(datePtr.Mid(position+1)); - position = datePtr.Locate('-'); - } - - TLex8 lex(datePtr); - TInt value(0) ; - lex.Val(value); - - dateParts[step] = value; - - // implement data validation - aEntry.iModified = TDateTime(dateParts[0], TMonth(dateParts[1] -1), dateParts[2] -1, 0, 0, 0, 0); - CleanupStack::PopAndDestroy(date); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::ParseBrowseResponse -// ----------------------------------------------------------------------------- -// -void CUpnpPathResolver::ParseBrowseResponseL(const TDesC8& aResponse, RArray* aDirList, const TDesC8& aObjectId, HBufC8** aResUri) - { - - RXmlEngDocument doc = ParseXmlL(aResponse); - - // Does return resorce URI? - TBool isReturnUri = aObjectId.Compare(KNullDesC8) != 0; - //Start browsing document tree - TXmlEngElement root = doc.DocumentElement(); - CleanupClosePushL( doc ); - - if(root.NotNull()) - { - - RArray elements; - CleanupClosePushL( elements ); - // get list of containers - UpnpDomInterface::GetElementListL(root, elements, KContainer, EFalse); - // get list of items - UpnpDomInterface::GetElementListL(root, elements, KItem, EFalse); - - for (TInt i = 0; i < elements.Count(); i++) - { - TXmlEngElement objElem = elements[i]; - TXmlEngElement titleElem; - // check title - if ( UpnpDomInterface::GetElementL(objElem, titleElem, KTitle ) && - titleElem.Value().Length()) - { - // check if it's item or container - TBool isItem = UpnpDomInterface::CheckTagL(objElem, KItem); - - TPtrC8 id = UpnpDomInterface::GetAttrValueL( objElem, KId); - TPtrC8 parentId = UpnpDomInterface::GetAttrValueL( objElem, KParentId); - TPtrC8 title = titleElem.Value(); - - // try to add new path element, if name is taken, new name will be given - const TDesC8& newTitle = AddElementL(parentId, id, title); - // check if return dir list - if (aDirList) - { - TFileInfo entry; - // set name - entry.iName = newTitle; - - // set date - TXmlEngElement dateElem; - if (UpnpDomInterface::GetElementL(objElem, dateElem, KDate ) ) - { - SetModifiedTimeL(dateElem, entry); - } - - if (isItem) // for items - { - entry.iAtt |= KEntryAttNormal; - // get size from res if exist - RArray resElements; - CleanupClosePushL( resElements ); - if (UpnpDomInterface::GetElementListL(objElem, resElements, KRes, EFalse)) - { - // get prefer resource - TXmlEngElement res = GetPreferResourceL(resElements); - // maybe res URI should be returned - if (isReturnUri && UpnpDomInterface::CheckAttributeValueL(objElem, KId, aObjectId)) - { - if (res.NotNull() && res.Value().Length()) - { - *aResUri = res.Value().AllocL(); - } - } - // set size base on res@size - TPtrC8 size = UpnpDomInterface::GetAttrValueL( res, KSize); - TLex8 intLex( size ); - intLex.Val( entry.iSize ); - - //TPtrC8 importUri = UpnpDomInterface::GetAttrValueL( res, KImportUri); - TPtrC8 restricted = UpnpDomInterface::GetAttrValueL( objElem, KRestricted); - // check if read-only flag should be set - if (restricted.Compare(KOne) == 0 || restricted.CompareF(KTrue) == 0) - { - entry.iAtt |= KEntryAttReadOnly; - } - - } - CleanupStack::PopAndDestroy(&resElements); - } - else // for containers - { - entry.iAtt |= KEntryAttDir; - } - - // add to dir result - aDirList->Append(entry); - } - } - } - CleanupStack::PopAndDestroy(&elements); - } - - //Cleanup - CleanupStack::PopAndDestroy(&doc); - } - - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::GetResUri -// ----------------------------------------------------------------------------- -// -TBool CUpnpPathResolver::GetResUriL(const TDesC8& aResponse, const TDesC8& aId, HBufC8*& aResUri) - { - TInt found(EFalse); - delete aResUri; - aResUri = NULL; - - RXmlEngDocument doc = ParseXmlL(aResponse); - CleanupClosePushL( doc ); - - //Start browsing document tree - TXmlEngElement root = doc.DocumentElement(); - - if(root.NotNull()) - { - TXmlEngElement item; - if ( UpnpDomInterface::GetDirectoryElementL(root, item, KItem, KId, aId) ) - { - RArray resElements; - CleanupClosePushL(resElements); - if (UpnpDomInterface::GetElementListL(item, resElements, KRes, EFalse) ) - { - TXmlEngElement res = GetPreferResourceL(resElements); - - if (res.Value().Length()) - { - found = ETrue; - aResUri = res.Value().AllocL(); - } - } - CleanupStack::PopAndDestroy(&resElements); - } - } - - CleanupStack::PopAndDestroy(&doc); - - return found; - } -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::BrowseCreateObjectL -// ----------------------------------------------------------------------------- -// -TBool CUpnpPathResolver::BrowseCreateObjectL(const TDesC8& aResponse) - { - TInt found(EFalse); - RXmlEngDocument doc = ParseXmlL(aResponse); - CleanupClosePushL( doc ); - //Start browsing document tree - TXmlEngElement root = doc.DocumentElement(); - - if(root.NotNull()) - { - TXmlEngElement item; - if ( UpnpDomInterface::GetElementL(root, item, KItem) ) - { - - TPtrC8 id = UpnpDomInterface::GetAttrValueL( item, KId); - TPtrC8 parentid = UpnpDomInterface::GetAttrValueL( item, KParentId); - - if (id.Length() && parentid.Length()) - { - RArray resElements; - CleanupClosePushL(resElements); - - if(UpnpDomInterface::GetElementListL(item, resElements, KRes, EFalse)) - { - TPtrC8 import; - TXmlEngElement resElement = GetResourceWithImportURIL(resElements, import); - - - if(import.Length()) - { - - TXmlEngElement titleElem; - - if(UpnpDomInterface::GetElementL(item, titleElem, KTitle)) - { - if ( titleElem.Value().Length()) - { - found = ETrue; - TPtrC8 title = titleElem.Value(); - AddElementL(parentid, id, title, import); - } - } - } - - CleanupStack::PopAndDestroy(&resElements); - - } - } - } - } - - - //Cleanup - CleanupStack::PopAndDestroy(&doc); - - return found; - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::GetItemL -// ----------------------------------------------------------------------------- -// -TBool CUpnpPathResolver::GetItemL(const TDesC8& aResponse, const TDesC8& aId) - { - TInt found(EFalse); - - RXmlEngDocument doc = ParseXmlL(aResponse); - CleanupClosePushL( doc ); - //Start browsing document tree - TXmlEngElement root = doc.DocumentElement(); - - if(root.NotNull()) - { - TXmlEngElement item; - if ( UpnpDomInterface::GetDirectoryElementL(root, item, KItem, KId, aId) ) - { - RArray resElements; - CleanupClosePushL(resElements); - if (UpnpDomInterface::GetElementListL(item, resElements, KRes, EFalse) ) - { - found = ETrue; - } - CleanupStack::PopAndDestroy(&resElements); - } - } - - //Cleanup - CleanupStack::PopAndDestroy(&doc); - - return found; - } - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::ParseXmlL -// ----------------------------------------------------------------------------- -// -RXmlEngDocument CUpnpPathResolver::ParseXmlL(const TDesC8& aXml) - { - - //Create a parser - RXmlEngDOMParser parser; - User::LeaveIfError( parser.Open(iDOMImpl) ); - CleanupClosePushL(parser); - - //Handler to the parsed document - RXmlEngDocument doc; - - doc = parser.ParseL(aXml); - CleanupClosePushL( doc ); - - if(doc.IsNull()) - { - User::Leave(KErrUnknown); - } - - CleanupStack::Pop(&doc); - CleanupStack::PopAndDestroy(&parser); - return doc; - } - - -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::GetPreferResource -// ----------------------------------------------------------------------------- -// -TXmlEngElement CUpnpPathResolver::GetPreferResourceL(const RArray& aElements) - { - //DEBUGSTRING8(("GetPreferResource ")); - if (aElements.Count() > 0) - { - for (TInt i = 0; i < aElements.Count(); i++) - { - TXmlEngElement elem = aElements[i]; - TPtrC8 protocol = UpnpDomInterface::GetAttrValueL(elem, KProtocolInfo); - if (protocol.Left(KProtocolInfoBegin().Length()).Compare(KProtocolInfoBegin) == 0) - { - return elem; - } - } - DEBUGSTRING8(("GetPreferResource: Return empty element (no http-get elements) ")); - } - else - { - DEBUGSTRING8(("GetPreferResource: Return empty element (size of list = 0) ")); - } - return TXmlEngElement(); - } -// ----------------------------------------------------------------------------- -// CUpnpPathResolver::GetResourceWithImportURIL -// ----------------------------------------------------------------------------- -// -TXmlEngElement CUpnpPathResolver::GetResourceWithImportURIL(const RArray& aElements, TPtrC8& aImportURI) - { - aImportURI.Set(KNullDesC8); - - if (aElements.Count() > 0) - { - for (TInt i = 0; i < aElements.Count(); i++) - { - TXmlEngElement elem = aElements[i]; - - aImportURI.Set(UpnpDomInterface::GetAttrValueL(elem, KImportUri)); - if (aImportURI != KNullDesC8) - { - return elem; - } - } - } - return TXmlEngElement(); - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpresolvehandler.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpresolvehandler.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpResolveHandler -* -*/ - - -#include "upnpresolvehandler.h" -#include "upnppathresolver.h" -#include "upnppathelement.h" - -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" - - -#include "upnpstring.h" - -#include "upnpavcpenginehelper.h" -#include "upnpmdebug.h" -using namespace UpnpAVCPEngine; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpResolveHandler* CUpnpResolveHandler::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver) - { - CUpnpResolveHandler* self = new( ELeave ) CUpnpResolveHandler(aAVCPManager,aResolver, aObserver); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::CUpnpResolveHandler -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpResolveHandler::CUpnpResolveHandler(CUpnpAVCPManager& aAVCPManager, - CUpnpPathResolver& aResolver, - MUpnpResolverObserver& aObserver): - iAVCPManager(aAVCPManager), - iResolver(aResolver), - iObserver(aObserver), - iPathIndex(-1) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::~CUpnpResolveHandler -// ----------------------------------------------------------------------------- -// -CUpnpResolveHandler::~CUpnpResolveHandler() - { - iResolver.RemoveHandler(this); - - delete iPath; - delete iLastId; - iPathElements.ResetAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::ConstructL -// ----------------------------------------------------------------------------- -// -void CUpnpResolveHandler::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpResolveHandler::SessionId() - { - return iSessionId; - } - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::ResolveL -// ----------------------------------------------------------------------------- -// -void CUpnpResolveHandler::ResolveL(const TDesC8& aPath) - { - - delete iPath; - iPath = NULL; - - iPath = aPath.AllocL(); - DEBUGSTRING8(("\tCResolveHandler::ResolveL %S", iPath)); - - UpnpAVCPEngine::ParsePathToElementsL(iPath->Des(),iPathElements); - - DEBUGSTRING8(("\tCount of path elements %d", iPathElements.Count())); - if (iPathElements.Count() == 0 || (iPathElements.Count() == 1 && iPathElements[0]->Length() == 0)) - { - CUpnpPathElement* elem = CUpnpPathElement::NewL(); - CleanupStack::PushL(elem); - elem->SetIdL(KRootId()); - elem->SetNameL(KRootName()); - - iObserver.ResolvedIdL(KErrNone, elem); - CleanupStack::PopAndDestroy(elem); - delete this; - } - else - { - iPathIndex = 0; - iLastId = KRootId().AllocL(); - iResolver.LockReset(); - CheckNextElementL(); - } - } - - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::CheckNextElementL -// ----------------------------------------------------------------------------- -// -void CUpnpResolveHandler::CheckNextElementL(TBool aSendAction) - { - DEBUGSTRING8(("\tCheckNextElementL %d", aSendAction)); - CUpnpPathElement* element = iResolver.GetElementL(*iLastId,*iPathElements[iPathIndex]); - - if (element) - { - - iPathIndex++; - - delete iLastId; - iLastId = NULL; - - iLastId = element->Id().AllocL(); - DEBUGSTRING8(("\tFind element for index %d with id %S", iPathIndex,iLastId)); - if (iPathIndex == iPathElements.Count() ) - { - iObserver.ResolvedIdL(KErrNone, element); - iResolver.UnlockReset(); - delete this; - } - else - { - CheckNextElementL(); - } - } - else if (aSendAction) - { - DEBUGSTRING8(("\tSend browse action for %S", iLastId)); - iSessionId = iAVCPManager.CdsBrowseActionL(iResolver.UUID(),*iLastId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8); - DEBUGSTRING8(("\tSend browse action for %S with session id %d", iLastId, iSessionId)); - iAVCPManager.RegisterForAction(*this); - } - else - { - iObserver.ResolvedIdL(KErrNotFound, NULL); - iResolver.UnlockReset(); - delete this; - } - - } - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpResolveHandler::InterpretL(TInt aErrorCode, CUpnpAction* aAction) - { - DEBUGSTRING(("\tInterpret %d", aErrorCode)); - if (aErrorCode == EHttp200Ok) - { - - TInt startIndex = StrToIntL( aAction->ArgumentValue( KStartingIndex ) ); - TInt requestCount = StrToIntL( aAction->ArgumentValue( KRequestedCount ) ); - - TInt numberReturned = StrToIntL( aAction->ArgumentValue( KNumberReturned ) ); - TInt totalMatches = StrToIntL( aAction->ArgumentValue( KTotalMatches ) ); - - iResolver.ParseBrowseResponseL(aAction->ArgumentValue( KResult )); - - if ( startIndex+numberReturned < totalMatches) - { - iStartIndex += KRequestedCountLimit; - iSessionId = iAVCPManager.CdsBrowseActionL(iResolver.UUID(),*iLastId, KBrowseDirectChildren, KDefaultBrowseFilter, iStartIndex, KRequestedCountLimit, KNullDesC8); - iAVCPManager.RegisterForAction(*this); - } - else - { - CheckNextElementL(EFalse); - } - - } - else - { - iObserver.ResolvedIdL(KErrNotFound, NULL); - iResolver.UnlockReset(); - delete this; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpResolveHandler::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpResolveHandler::RunError(TInt aErrorCode) - { - DEBUGSTRING(("\tRunError %d", aErrorCode)); - TRAP_IGNORE( iObserver.ResolvedIdL(KErrNotFound, NULL) ); - delete this; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengine/src/upnpuploadcommand.cpp --- a/upnpavcontrolpoint/avcpengine/src/upnpuploadcommand.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: CUpnpUploadCommand -* -*/ - - -#include "upnpuploadcommand.h" - -#include "upnppathresolver.h" -#include "upnppathelement.h" -#include "upnpavcpmanager.h" -#include "upnpavcontrolpoint.h" -#include "upnphttpmessagefactory.h" - -#include "upnpavcpenginehelper.h" -using namespace UpnpAVCPEngine; - - -_LIT8(KBrowseFilter, "res,res@protocolInfo,res@importUri"); - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUpnpUploadCommand* CUpnpUploadCommand::NewL(CUpnpAVCPManager& aAVCPManager, CUpnpAVCPEngineSession& aSession, const RMessage2& aMessage) - { - CUpnpUploadCommand* self = new( ELeave ) CUpnpUploadCommand(aAVCPManager, aSession, aMessage); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpUploadCommand::ConstructL() - { - CUpnpCommand::BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::CUpnpUploadCommand -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpUploadCommand::CUpnpUploadCommand(CUpnpAVCPManager& aAVCPManager, - CUpnpAVCPEngineSession& aSession, - const RMessage2& aMessage): - CUpnpCommand( aAVCPManager, - aSession, - aMessage) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::~CUpnpUploadCommand -// desctructor -// ----------------------------------------------------------------------------- -// -CUpnpUploadCommand::~CUpnpUploadCommand() - { - delete iObjectId; - delete iImportURI; - delete iSrcPath; - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::SessionId -// ----------------------------------------------------------------------------- -// -TInt CUpnpUploadCommand::SessionId() - { - return CUpnpCommand::SessionId(); - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::RunError -// ----------------------------------------------------------------------------- -// -void CUpnpUploadCommand::RunError(TInt aErrorCode) - { - return CUpnpCommand::RunError(aErrorCode); - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::ExecuteL -// ----------------------------------------------------------------------------- -// -void CUpnpUploadCommand::ExecuteL() - { - //ASSERT(iType == EPutFile); - - HBufC8* uuid = NULL; - HBufC8* dstPath = NULL; - HBufC* srcPath = NULL; - - DEBUGSTRING(("Execute Upload command")); - - uuid = ReadDes8FromMessageLC(0); - DEBUGSTRING8((" uuid: %S",uuid)); - srcPath = ReadDes16FromMessageLC(1); - DEBUGSTRING16((" srcPath: %S",srcPath)); - dstPath = ReadDes8FromMessageLC(2); - DEBUGSTRING8((" dstPath: %S",dstPath)); - - // convert to 8-bit representation - iSrcPath = HBufC8::NewL(srcPath->Length()); - iSrcPath->Des().Copy(*srcPath); - - iPathResolver = &(iAVCPManager.PathResolverL(*uuid, &iSession)); - - iPathResolver->ResolveIdL(*dstPath, *this); - - CleanupStack::PopAndDestroy(dstPath); - CleanupStack::PopAndDestroy(srcPath); - CleanupStack::PopAndDestroy(uuid); - } - -// ----------------------------------------------------------------------------- -// CCUploadCommand::SetResultL -// ----------------------------------------------------------------------------- -// -void CUpnpUploadCommand::SetResultL(const RMessage2& /*aMessage*/) - { - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpUploadCommand::InterpretL(TInt aErrorCode, CUpnpAction* /*aAction*/) - { - DEBUGSTRING(("Interpret action response %d", aErrorCode)); - - if (aErrorCode == EHttp200Ok) - { - if( iImportURI) - { - CUpnpHttpMessage* msg = RUpnpHttpMessageFactory::HttpPostL( *iImportURI ); - CleanupStack::PushL( msg ); - msg->SetOutFilenameL( *iSrcPath ); - iAVCPManager.SendL(msg); - iSessionId = msg->SessionId(); - iAVCPManager.RegisterForHttp(*this); - - CleanupStack::PopAndDestroy( msg ); - } - else - { - iMessage.Complete(KErrPathNotFound); - delete this; - } - } - else - { - iMessage.Complete(KErrAbort); - delete this; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::Interpret -// ----------------------------------------------------------------------------- -// -void CUpnpUploadCommand::InterpretL(TInt aErrorCode, CUpnpHttpMessage* /*aMessage*/) - { - DEBUGSTRING(("HTTP Interpret %d", aErrorCode)); - if (aErrorCode == KHttpPostStarted) - { - // transfer pending - return; - } - iAVCPManager.UnregisterForHttp(*this); - if (aErrorCode == EHttp200Ok) - { - iMessage.Complete(KErrNone); - delete this; - } - else - { - iMessage.Complete(KErrNotFound); - delete this; - } - } - -// ----------------------------------------------------------------------------- -// CUpnpUploadCommand::ResolvedId -// ----------------------------------------------------------------------------- -// -void CUpnpUploadCommand::ResolvedIdL(TInt aErrCode, CUpnpPathElement* aIdElement) - { - - if (aErrCode == KErrNone) - { - iObjectId = aIdElement->Id().AllocL(); - iImportURI = (aIdElement->ImportURI()!= KNullDesC8()) ? aIdElement->ImportURI().AllocL(): NULL; - - iSessionId = iAVCPManager.CdsBrowseActionL(iPathResolver->UUID(), *iObjectId, KBrowseMetadata, KBrowseFilter, 0, 0, KNullDesC8); - - iAVCPManager.RegisterForAction(*this); - } - else - { - iMessage.Complete(KErrNotFound); - delete this; - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/BWINS/AVCPEngineClientU.DEF --- a/upnpavcontrolpoint/avcpengineclient/BWINS/AVCPEngineClientU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -EXPORTS - ??0RUpnpAVCPEngineMSClient@@QAE@XZ @ 1 NONAME ; RUpnpAVCPEngineMSClient::RUpnpAVCPEngineMSClient(void) - ??0RUpnpAVCPEngineRFSClient@@QAE@XZ @ 2 NONAME ; RUpnpAVCPEngineRFSClient::RUpnpAVCPEngineRFSClient(void) - ?AlbumL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 3 NONAME ; class TPtrC8 CUpnpMetadata::AlbumL(void) - ?ArtistL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 4 NONAME ; class TPtrC8 CUpnpMetadata::ArtistL(void) - ?AsXmlL@CUpnpMetadata@@QAEAAVRXmlEngDocument@@XZ @ 5 NONAME ; class RXmlEngDocument & CUpnpMetadata::AsXmlL(void) - ?ClassL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 6 NONAME ; class TPtrC8 CUpnpMetadata::ClassL(void) - ?CommitL@CUpnpMetadata@@QAEXAAVTRequestStatus@@@Z @ 7 NONAME ; void CUpnpMetadata::CommitL(class TRequestStatus &) - ?CommitL@CUpnpMetadata@@QAEXXZ @ 8 NONAME ; void CUpnpMetadata::CommitL(void) - ?Connect@RUpnpAVCPEngineClient@@UAEHXZ @ 9 NONAME ; int RUpnpAVCPEngineClient::Connect(void) - ?CreateFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 10 NONAME ; int RUpnpAVCPEngineRFSClient::CreateFileL(class TDesC8 const &, class TDesC16 const &) - ?CreatorL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 11 NONAME ; class TPtrC8 CUpnpMetadata::CreatorL(void) - ?DeleteDirectoryL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 12 NONAME ; int RUpnpAVCPEngineRFSClient::DeleteDirectoryL(class TDesC8 const &, class TDesC16 const &) - ?DeleteFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 13 NONAME ; int RUpnpAVCPEngineRFSClient::DeleteFileL(class TDesC8 const &, class TDesC16 const &) - ?FetchL@CUpnpMetadata@@QAEXABVTDesC16@@@Z @ 14 NONAME ; void CUpnpMetadata::FetchL(class TDesC16 const &) - ?FetchL@CUpnpMetadata@@QAEXABVTDesC16@@AAVTRequestStatus@@@Z @ 15 NONAME ; void CUpnpMetadata::FetchL(class TDesC16 const &, class TRequestStatus &) - ?GenreL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 16 NONAME ; class TPtrC8 CUpnpMetadata::GenreL(void) - ?GetDeviceListL@RUpnpAVCPEngineMSClient@@QAEHAAV?$RArray@VTAVDevice@@@@@Z @ 17 NONAME ; int RUpnpAVCPEngineMSClient::GetDeviceListL(class RArray &) - ?GetDirectoryAttributeL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@AAPAVCRsfwDirEntAttr@@@Z @ 18 NONAME ; int RUpnpAVCPEngineRFSClient::GetDirectoryAttributeL(class TDesC8 const &, class TDesC16 const &, class CRsfwDirEntAttr * &) - ?GetDirectoryL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@AAV?$RPointerArray@VCRsfwDirEnt@@@@@Z @ 19 NONAME ; int RUpnpAVCPEngineRFSClient::GetDirectoryL(class TDesC8 const &, class TDesC16 const &, class RPointerArray &) - ?GetFileAttributeL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@AAPAVCRsfwDirEntAttr@@@Z @ 20 NONAME ; int RUpnpAVCPEngineRFSClient::GetFileAttributeL(class TDesC8 const &, class TDesC16 const &, class CRsfwDirEntAttr * &) - ?GetFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@1HHIAAH@Z @ 21 NONAME ; int RUpnpAVCPEngineRFSClient::GetFileL(class TDesC8 const &, class TDesC16 const &, class TDesC16 const &, int, int, unsigned int, int &) - ?IdL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 22 NONAME ; class TPtrC8 CUpnpMetadata::IdL(void) - ?MakeDirectoryL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@@Z @ 23 NONAME ; int RUpnpAVCPEngineRFSClient::MakeDirectoryL(class TDesC8 const &, class TDesC16 const &) - ?NewL@CUpnpMetadata@@SAPAV1@AAVRUpnpAVCPEngineMSClient@@@Z @ 24 NONAME ; class CUpnpMetadata * CUpnpMetadata::NewL(class RUpnpAVCPEngineMSClient &) - ?PutFileL@RUpnpAVCPEngineRFSClient@@QAEHABVTDesC8@@ABVTDesC16@@1@Z @ 25 NONAME ; int RUpnpAVCPEngineRFSClient::PutFileL(class TDesC8 const &, class TDesC16 const &, class TDesC16 const &) - ?SetAlbumL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 26 NONAME ; void CUpnpMetadata::SetAlbumL(class TDesC8 const &) - ?SetArtistL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 27 NONAME ; void CUpnpMetadata::SetArtistL(class TDesC8 const &) - ?SetClassL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 28 NONAME ; void CUpnpMetadata::SetClassL(class TDesC8 const &) - ?SetCreatorL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 29 NONAME ; void CUpnpMetadata::SetCreatorL(class TDesC8 const &) - ?SetGenreL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 30 NONAME ; void CUpnpMetadata::SetGenreL(class TDesC8 const &) - ?SetTitleL@CUpnpMetadata@@QAEXABVTDesC8@@@Z @ 31 NONAME ; void CUpnpMetadata::SetTitleL(class TDesC8 const &) - ?TitleL@CUpnpMetadata@@QAE?AVTPtrC8@@XZ @ 32 NONAME ; class TPtrC8 CUpnpMetadata::TitleL(void) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/EABI/AVCPEngineClientU.DEF --- a/upnpavcontrolpoint/avcpengineclient/EABI/AVCPEngineClientU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -EXPORTS - _ZN13CUpnpMetadata10SetArtistLERK6TDesC8 @ 1 NONAME - _ZN13CUpnpMetadata11SetCreatorLERK6TDesC8 @ 2 NONAME - _ZN13CUpnpMetadata3IdLEv @ 3 NONAME - _ZN13CUpnpMetadata4NewLER23RUpnpAVCPEngineMSClient @ 4 NONAME - _ZN13CUpnpMetadata6AlbumLEv @ 5 NONAME - _ZN13CUpnpMetadata6AsXmlLEv @ 6 NONAME - _ZN13CUpnpMetadata6ClassLEv @ 7 NONAME - _ZN13CUpnpMetadata6FetchLERK7TDesC16 @ 8 NONAME - _ZN13CUpnpMetadata6FetchLERK7TDesC16R14TRequestStatus @ 9 NONAME - _ZN13CUpnpMetadata6GenreLEv @ 10 NONAME - _ZN13CUpnpMetadata6TitleLEv @ 11 NONAME - _ZN13CUpnpMetadata7ArtistLEv @ 12 NONAME - _ZN13CUpnpMetadata7CommitLER14TRequestStatus @ 13 NONAME - _ZN13CUpnpMetadata7CommitLEv @ 14 NONAME - _ZN13CUpnpMetadata8CreatorLEv @ 15 NONAME - _ZN13CUpnpMetadata9SetAlbumLERK6TDesC8 @ 16 NONAME - _ZN13CUpnpMetadata9SetClassLERK6TDesC8 @ 17 NONAME - _ZN13CUpnpMetadata9SetGenreLERK6TDesC8 @ 18 NONAME - _ZN13CUpnpMetadata9SetTitleLERK6TDesC8 @ 19 NONAME - _ZN21RUpnpAVCPEngineClient7ConnectEv @ 20 NONAME - _ZN23RUpnpAVCPEngineMSClient14GetDeviceListLER6RArrayI9TAVDeviceE @ 21 NONAME - _ZN23RUpnpAVCPEngineMSClientC1Ev @ 22 NONAME - _ZN23RUpnpAVCPEngineMSClientC2Ev @ 23 NONAME - _ZN24RUpnpAVCPEngineRFSClient11CreateFileLERK6TDesC8RK7TDesC16 @ 24 NONAME - _ZN24RUpnpAVCPEngineRFSClient11DeleteFileLERK6TDesC8RK7TDesC16 @ 25 NONAME - _ZN24RUpnpAVCPEngineRFSClient13GetDirectoryLERK6TDesC8RK7TDesC16R13RPointerArrayI11CRsfwDirEntE @ 26 NONAME - _ZN24RUpnpAVCPEngineRFSClient14MakeDirectoryLERK6TDesC8RK7TDesC16 @ 27 NONAME - _ZN24RUpnpAVCPEngineRFSClient16DeleteDirectoryLERK6TDesC8RK7TDesC16 @ 28 NONAME - _ZN24RUpnpAVCPEngineRFSClient17GetFileAttributeLERK6TDesC8RK7TDesC16RP15CRsfwDirEntAttr @ 29 NONAME - _ZN24RUpnpAVCPEngineRFSClient22GetDirectoryAttributeLERK6TDesC8RK7TDesC16RP15CRsfwDirEntAttr @ 30 NONAME - _ZN24RUpnpAVCPEngineRFSClient8GetFileLERK6TDesC8RK7TDesC16S5_iijRi @ 31 NONAME - _ZN24RUpnpAVCPEngineRFSClient8PutFileLERK6TDesC8RK7TDesC16S5_ @ 32 NONAME - _ZN24RUpnpAVCPEngineRFSClientC1Ev @ 33 NONAME - _ZN24RUpnpAVCPEngineRFSClientC2Ev @ 34 NONAME - _ZTI13CUpnpMetadata @ 35 NONAME ; ## - _ZTI21RUpnpAVCPEngineClient @ 36 NONAME ; ## - _ZTV13CUpnpMetadata @ 37 NONAME ; ## - _ZTV21RUpnpAVCPEngineClient @ 38 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/group/avcpengineclient.mmp --- a/upnpavcontrolpoint/avcpengineclient/group/avcpengineclient.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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 specification for AVCPEngineClient -* -*/ - -#include "../../../group/upnpplatformvar.hrh" - -TARGET avcpengineclient.dll -TARGETTYPE dll -UID 0x1000008d 0x101F977B -CAPABILITY CAP_CLIENT_DLL -VENDORID VID_DEFAULT - -VERSION 10.1 -paged - -SOURCEPATH ../src - -SOURCE upnpavcpengineclient.cpp -SOURCE upnpavcpenginemsclient.cpp -SOURCE upnpavcpenginerfsclient.cpp -SOURCE upnpmetadata.cpp - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../inc -USERINCLUDE ../../inc -USERINCLUDE ../inc - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY insock.lib -LIBRARY estlib.lib - -LIBRARY inetprotutil.lib -LIBRARY upnpipserversutils.lib -//LibXml2 -LIBRARY xmlengineutils.lib -LIBRARY xmlenginedom.lib - -// remote storage -LIBRARY rsfwcommon.lib -LIBRARY rsfwmountman.lib - -//to be removed when mountentry moved to mountman -LIBRARY rsfwmountstore.lib -DEFFILE AVCPEngineClient - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/group/bld.inf --- a/upnpavcontrolpoint/avcpengineclient/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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 info for AVCPEngineClient -* -*/ - -#include "../../../group/upnpplatformvar.hrh" - -PRJ_EXPORTS -../inc/upnpavcpenginerfsclient.h |../../inc/upnpavcpenginerfsclient.h -../inc/upnpavcpenginemsclient.h MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpenginemsclient.h) -../inc/upnpavcpengineclient.h MW_LAYER_PLATFORM_EXPORT_PATH(upnpavcpengineclient.h) -../inc/upnpmetadata.h MW_LAYER_PLATFORM_EXPORT_PATH(upnpmetadata.h) - -PRJ_MMPFILES -avcpengineclient.mmp - -//end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/inc/upnpavcpengineclient.h --- a/upnpavcontrolpoint/avcpengineclient/inc/upnpavcpengineclient.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: RUpnpAVCPEngineClient -* -*/ - - -#ifndef C_RUPNPAVCPENGINECLIENT_H -#define C_RUPNPAVCPENGINECLIENT_H - -// INCLUDES -#include -#include -#include "upnpavcpenginecommon.h" - -// CLASS DECLARATION -/** -* Generic class for client-interface. -* It enables to connect to server and starts server if it is not started. -*/ -class RUpnpAVCPEngineClient : public RSessionBase - { - public: - /** - * C++ default constructor. - */ - RUpnpAVCPEngineClient(); - /** - * Connect to server, if server is not started, it starts. - * - * @return status of operation, if OK, KErrNone - */ - IMPORT_C virtual TInt Connect(); - /** - * Return version of client, used for connect - * - * @return version - */ - TVersion Version() const; - }; - -#endif // C_RUPNPAVCPENGINECLIENT_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginemsclient.h --- a/upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginemsclient.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: RUpnpAVCPEngineMSClient -* -*/ - - -#ifndef C_RUPNPAVCPENGINEMSCLIENT_H -#define C_RUPNPAVCPENGINEMSCLIENT_H - -// INCLUDES -#include -#include -#include "upnpavcpengineclient.h" - -// FORWARD DECLARATIONS -class TAVDevice; -class CUpnpMetadata; - - -// CLASS DECLARATION -/** -* Class used for accessing MS's metadata. -* Also it provides list of currently active MSs -*/ -class RUpnpAVCPEngineMSClient : public RUpnpAVCPEngineClient - { - public: - /** - * C++ default constructor. - */ - IMPORT_C RUpnpAVCPEngineMSClient(); - /** - * Get list of available MS devices - * - * @param aDeviceList array to update - */ - IMPORT_C TInt GetDeviceListL(RArray& aDeviceList); - /** - * Requests for preparing metadata for given path - * - * @param aUUID UDN of MS - * @param aPathName pathname - * @param aIdPckg id of command with result (metadata) - * @param aSizePckg size of metadata - */ - void PrepareMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, - TPckg& aIdPckg, TPckg& aSizePckg); - - /** - * Requests for preparing metadata for given path - * - * @param aUUID UDN of MS - * @param aPathName pathname - * @param aIdPckg id of command with result (metadata) - * @param aSizePckg size of metadata - */ - void PrepareMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, - TPckg& aIdPckg, TPckg& aSizePckg); - - - /** - * Requests for downloading metadata from result of previous run command - * - * @param aId id of command with result (metadata) - * @param aMetaData buffer for metadata - */ - void DownloadMetadataL(TInt aId, TDes8& aMetaData); - - /** - * Requests for downloading metadata from result of previous run command - * - * @param aId id of command with result (metadata) - * @param aMetaData buffer for metadata - */ - void DownloadMetadata(TRequestStatus& aStatus, TInt aId, TDes8& aMetaData); - - /** - * Requests for set metadata for given path - * - * @param aUUID UDN of MS - * @param aPathName pathname - * @param aOldMetaData old metadata - * @param aNewMetaData new metadata - */ - void SetMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData); - - /** - * Requests for set metadata for given path - * - * @param aUUID UDN of MS - * @param aPathName pathname - * @param aOldMetaData old metadata - * @param aNewMetaData new metadata - */ - void SetMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData); - }; - -#endif // C_RUPNPAVCPENGINEMSCLIENT_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginerfsclient.h --- a/upnpavcontrolpoint/avcpengineclient/inc/upnpavcpenginerfsclient.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: RUpnpAVCPEngineRFSClient -* -*/ - - -#ifndef C_RUPNPAVCPENGINERFSCLIENT_H -#define C_RUPNPAVCPENGINERFSCLIENT_H - -// INCLUDES -#include -#include - -#include "upnpavcpengineclient.h" - -// FORWARD DECLARATIONS -class CRsfwDirEnt; -class CRsfwDirEntAttr; - - -// CLASS DECLARATION -/** -* Class provides function used by UPnPAccess plugin -* It makes possible to pass requests to AVCPEngine. -*/ -class RUpnpAVCPEngineRFSClient : public RUpnpAVCPEngineClient - { - public: - /** - * C++ default constructor. - */ - IMPORT_C RUpnpAVCPEngineRFSClient(); - /** - * Requests for get directory listing - * - * @param aUUID UDN of MS - * @param aPathName path of directory - * @param aDirList array of directory to be updated - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt GetDirectoryL(const TDesC8& aUUID, const TDesC& aPathName, RPointerArray& aDirList); - /** - * Requests for get directory attribute - * - * @param aUUID UDN of MS - * @param aPathName path of directory - * @param aDirAtt structure to be updated - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt GetDirectoryAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aDirAtt); - /** - * Requests for get file attribute - * - * @param aUUID UDN of MS - * @param aPathName path of file - * @param aDirAtt structure to be updated - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt GetFileAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aFileAtt); - /** - * Requests for get (download) file from MS and store it in local cached file - * - * @param aUUID UDN of MS - * @param aSrcPathName source file (MS) - * @param aDstPathName destination file (local) - * @param aStart start position to read - * @param aLength length to read - * @param aRead number of byte that were read - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt GetFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName, - TInt aStart, TInt aLength, TUint aFlags, TInt& aRead); - /** - * Requests for delete file - * - * @param aUUID UDN of MS - * @param aPathName path of file - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt DeleteFileL(const TDesC8& aUUID, const TDesC& aPathName); - /** - * Requests for delete directory - * - * @param aUUID UDN of MS - * @param aPathName path of directory - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt DeleteDirectoryL(const TDesC8& aUUID, const TDesC& aPathName); - /** - * Requests for create file - * - * @param aUUID UDN of MS - * @param aPathName path of file - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt CreateFileL(const TDesC8& aUUID, const TDesC& aPathName); - /** - * Requests for create directory - * - * @param aUUID UDN of MS - * @param aPathName path of directory - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt MakeDirectoryL(const TDesC8& aUUID, const TDesC& aPathName); - /** - * Requests for put (upload) file from local to MS - * - * @param aUUID UDN of MS - * @param aSrcPathName source file (local) - * @param aDstPathName destination file (MS) - * @return KErrNone if successful, otherwise one of the other system-wide error codes - */ - IMPORT_C TInt PutFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName); - private: - /** - * Convert information about attributes store in TFileInfo into CDirEntAttr - * - * @param aFileInfo file information - * @return converted object of CDirEntAttr - */ - CRsfwDirEntAttr* RUpnpAVCPEngineRFSClient::GetFileAttributesL(TFileInfo& aFileInfo); - /** - * Convert information about file store in TFileInfo into CDirEnt - * - * @param aFileInfo file information - * @return converted object of CDirEnt - */ - CRsfwDirEnt* RUpnpAVCPEngineRFSClient::GetFileInformationL(TFileInfo& aFileInfo); - }; - -#endif // C_RUPNPAVCPENGINERFSCLIENT_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/inc/upnpmetadata.h --- a/upnpavcontrolpoint/avcpengineclient/inc/upnpmetadata.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Describes UPnP metadata for item/container -* -*/ - - -#ifndef C_CUPNPMETADATA_H -#define C_CUPNPMETADATA_H - -// INCLUDES -#include -#include - -#include -#include - -//rsfw -#include -#include - -// FORWARD DECLARATIONS -class RUpnpAVCPEngineMSClient; - -enum TMetadataStatus -{ - EPreparingMetadata, - EDownloadingMetadata, - EUploadingMetadata -}; - -// CLASS DECLARATION -/** -* Describes UPnP metadata for item/container -* -* @lib AVCPEngineClient.lib -* @since Series 60 3.1 -*/ -class CUpnpMetadata : public CActive - { - - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - IMPORT_C static CUpnpMetadata* NewL(RUpnpAVCPEngineMSClient& aSession); - /** - * Destructor. - */ - virtual ~CUpnpMetadata(); - - public: // New functions - /** - * Return ID of object - * - * @return id - */ - IMPORT_C TPtrC8 IdL(); - /** - * Return title of object - * - * @return title - */ - IMPORT_C TPtrC8 TitleL(); - /** - * Set new title - * - * @param aTitle new title - */ - IMPORT_C void SetTitleL(const TDesC8& aTitle) ; - /** - * Return creator of object - * - * @return creator - */ - IMPORT_C TPtrC8 CreatorL(); - /** - * Set new creator - * - * @param aCreator new creator - */ - IMPORT_C void SetCreatorL(const TDesC8& aCreator); - /** - * Return class of object - * - * @return class - */ - IMPORT_C TPtrC8 ClassL(); - /** - * Set new class - * - * @param aClass new clas - */ - IMPORT_C void SetClassL(const TDesC8& aClass); - /** - * Return atrist of object - * - * @return atrist - */ - IMPORT_C TPtrC8 ArtistL(); - /** - * Set new atrist - * - * @param aArtist new atrist - */ - IMPORT_C void SetArtistL(const TDesC8& aArtist); - /** - * Return genre of object - * - * @return genre - */ - IMPORT_C TPtrC8 GenreL(); - /** - * Set new genre - * - * @param aGenre new genre - */ - IMPORT_C void SetGenreL(const TDesC8& aGenre); - /** - * Return album of object - * - * @return album - */ - IMPORT_C TPtrC8 AlbumL(); - /** - * Set new album - * - * @param aAlbum new album - */ - IMPORT_C void SetAlbumL(const TDesC8& aAlbum); - /** - * Return whole metada as XML - * - * @return document with metadata - */ - IMPORT_C RXmlEngDocument& AsXmlL(); - /** - * Fetch metadata for given path - * - * @param aPathName path name on MS's drive - */ - IMPORT_C void FetchL( const TDesC& aPathName ); - /** - * Fetch metadata for given path - * - * @param aPathName path name on MS's drive - */ - IMPORT_C void FetchL(const TDesC& aPathName, TRequestStatus& aStatus ); - /** - * Approve changes made in metadata and send them to update in MS - */ - IMPORT_C void CommitL(); - /** - * Approve changes made in metadata and send them to update in MS - */ - IMPORT_C void CommitL( TRequestStatus& aStatus ); - protected: // from CActive - /** - * From CActive invoke when local request should be cancelled - */ - void DoCancel(); - /** - * From CActive invoke when RunL leaves - */ - TInt RunError( TInt aError ); - /** - * From CActive invoke when asynchronous action is completed - */ - void RunL(); - private: - /** - * C++ default constructor. - */ - CUpnpMetadata(RUpnpAVCPEngineMSClient& aSession); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - /** - * Get object XML element from inside stored XML - * - * @param aObject element for object XML - * @return ETrue if found, else EFalse - */ - TBool ObjectL(TXmlEngElement& aObject); - /** - * Get value of element with given name - * (it has to be child of object element) - * - * @param aName name of element - * @return value of element - */ - TPtrC8 GetElementL( const TDesC8& aName); - /** - * Set value of element with given name - * (it is child of object element) - * - * @param aNamespace namespace of element - * @param aName name of element - * @param aValue value of element - */ - void SetElementL( const TDesC8& aNamespace, const TDesC8& aName, const TDesC8& aValue); - /** - * Normalize slashes in path - * - * @param aData path to normalize - */ - void Normalize(TDes8& aData); - /** - * Get metadata synchnronous - */ - void GetMetadataL(); - /** - * Get metadata asynchnronous - */ - void GetMetadataL(TRequestStatus& aStatus); - /** - * Parse metadata - */ - void ParseMetadataL(); - /** - * Prepare information about file, check if drive is upnp, normalize path slashes - * - * @param aPathName path to check - */ - void PrepareDataL(const TDesC& aPathName ); - private: - // sesion to server AVCPEngine - RUpnpAVCPEngineMSClient& iSession; - // UDN of MS - HBufC8* iUuid; - // pathname - HBufC8* iPathName; - // metadata - HBufC8* iMetaData; - // new metadata (used during Commit operation - HBufC8* iUpdatedMetaData; - // pointer to metadata - TPtr8 iMetaDataPtr; - // document with parsed metadata - RXmlEngDocument iDocument; - // client-interface to RS Fwk - // RRsfwControl iRsfwControl; - // command id (it's id of command used to fetch metadata) - TInt iId; - // package for id - TPckg iIdPckg; - // size of metadata - TInt iSize; - // package for size - TPckg iSizePckg; - // request status fo - TRequestStatus* iClientStatus; - // state of asynchrounus performing - TMetadataStatus iState; - RXmlEngDOMImplementation iDOMImpl; - }; - -#endif // C_CUPNPMETADATA_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/src/upnpavcpengineclient.cpp --- a/upnpavcontrolpoint/avcpengineclient/src/upnpavcpengineclient.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Base class to connect with server AVCPEngine -* -*/ - - -// INCLUDE FILES -#include -#include "upnpavcpengineclient.h" - -#include - -// Number of message slots to reserve for this client server session. -const TUint KDefaultMessageSlots = 10; -const TUid KServerUid3 = {0x101F977A}; - -// Function prototypes -static TInt StartServer( void ); -static TInt CreateServerProcess( void ); - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineClient::RUpnpAVCPEngineClient -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -RUpnpAVCPEngineClient::RUpnpAVCPEngineClient() - :RSessionBase() - { - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineClient::Connect -// Connect to ... session. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineClient::Connect() - { - TInt error = ::StartServer(); - - if ( KErrNone == error ) - { - error = CreateSession( KAVCPEngineName, - Version(), - KDefaultMessageSlots ); - } - return error; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineClient::Version -// Version information. -// ----------------------------------------------------------------------------- -// -TVersion RUpnpAVCPEngineClient::Version() const - { - return( TVersion( KAVCPEngineMajorVersionNumber, - KAVCPEngineMinorVersionNumber, - KAVCPEngineBuildVersionNumber ) ); - } - -// ----------------------------------------------------------------------------- -// StartServer -// Static method to start the server. -// ----------------------------------------------------------------------------- -// -static TInt StartServer() - { - TInt result; - - TFindServer findMessageHandler( KAVCPEngineName ); - TFullName name; - - result = findMessageHandler.Next( name ); - if ( result == KErrNone ) - { - // Server already running - return KErrNone; - } - result = CreateServerProcess(); - if ( result != KErrNone ) - { - return result; - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CreateServerProcess -// Static method to create the server process. -// ----------------------------------------------------------------------------- -// -static TInt CreateServerProcess() - { - TInt result; - - const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); - RProcess server; - - result = server.Create( KAVCPEngineFilename, KNullDesC, serverUid ); - if ( result != KErrNone ) - { - return result; - } - - TRequestStatus stat = KRequestPending; - server.Rendezvous(stat); - if ( stat != KRequestPending ) - { - server.Kill( 0 ); // abort startup - } - else - { - server.Resume(); // logon OK - start the server - } - - User::WaitForRequest(stat); // wait for start or death - result = (server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); - server.Close(); - - return result; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginemsclient.cpp --- a/upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginemsclient.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class used for accessing MS's metadata. -* -*/ - - -// INCLUDE FILES -#include -#include "upnpavcpenginemsclient.h" - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::RUpnpAVCPEngineMSClient -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C RUpnpAVCPEngineMSClient::RUpnpAVCPEngineMSClient() - :RUpnpAVCPEngineClient() - { - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::GetDeviceListL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineMSClient::GetDeviceListL(RArray& aDeviceList) - { - TInt id; - TInt size; - TPckg idPckg(id); - TPckg sizePckg(size); - SendReceive(EPrepareDeviceList,TIpcArgs(&idPckg,&sizePckg)); - if ( size > 0 ) - { - TAVDevice* devices = new(ELeave)TAVDevice[size]; - TPtr8 result(reinterpret_cast(devices), sizeof(TAVDevice)*size, sizeof(TAVDevice)*size); - SendReceive(EDownloadDeviceList,TIpcArgs(id, &result)); - - for (TInt i = 0; i < size; i++) - { - aDeviceList.AppendL(devices[i]); - } - delete[] devices; - } - return size; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::PrepareMetadataL -// ----------------------------------------------------------------------------- -// -void RUpnpAVCPEngineMSClient::PrepareMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, TPckg& aIdPckg, TPckg& aSizePckg) - { - User::LeaveIfError( SendReceive(EPrepareMetadata,TIpcArgs(&aIdPckg,&aSizePckg, &aUUID, &aPathName )) ); - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::PrepareMetadata -// ----------------------------------------------------------------------------- -// -void RUpnpAVCPEngineMSClient::PrepareMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, TPckg& aIdPckg, TPckg& aSizePckg) - { - SendReceive(EPrepareMetadata,TIpcArgs(&aIdPckg,&aSizePckg, &aUUID, &aPathName ), aStatus) ; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::DownloadMetadataL -// ----------------------------------------------------------------------------- -// -void RUpnpAVCPEngineMSClient::DownloadMetadataL(TInt aId, TDes8& aMetaData) - { - User::LeaveIfError( SendReceive(EDownloadMetadata,TIpcArgs(aId, &aMetaData))); - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::DownloadMetadataL -// ----------------------------------------------------------------------------- -// -void RUpnpAVCPEngineMSClient::DownloadMetadata(TRequestStatus& aStatus, TInt aId, TDes8& aMetaData) - { - SendReceive(EDownloadMetadata,TIpcArgs(aId, &aMetaData), aStatus); - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::SetMetadataL -// ----------------------------------------------------------------------------- -// -void RUpnpAVCPEngineMSClient::SetMetadataL(const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData) - { - User::LeaveIfError( SendReceive(ESetMetadata,TIpcArgs(&aUUID, &aPathName, &aOldMetaData, &aNewMetaData) ) ); - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineMSClient::SetMetadata -// ----------------------------------------------------------------------------- -// -void RUpnpAVCPEngineMSClient::SetMetadata(TRequestStatus& aStatus, const TDesC8& aUUID, const TDesC8& aPathName, const TDesC8& aOldMetaData, const TDesC8& aNewMetaData) - { - SendReceive(ESetMetadata,TIpcArgs(&aUUID, &aPathName, &aOldMetaData, &aNewMetaData), aStatus); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginerfsclient.cpp --- a/upnpavcontrolpoint/avcpengineclient/src/upnpavcpenginerfsclient.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class provides function used by UPnPAccess plugin -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include - - -#include "upnpavcpenginecommon.h" -#include "upnpavcpenginerfsclient.h" - -typedef TBuf8 TFileName8; - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::RUpnpAVCPEngineRFSClient -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -EXPORT_C RUpnpAVCPEngineRFSClient::RUpnpAVCPEngineRFSClient() - :RUpnpAVCPEngineClient() - { - } - - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::GetDirectoryL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetDirectoryL(const TDesC8& aUUID, const TDesC& aPathName, RPointerArray& aDirList) - { - TFileName8 pathname; - pathname.Copy(aPathName); - - TInt id; - TInt size; - TPckg idPckg(id); - TPckg sizePckg(size); - TInt err = SendReceive(EPrepareDirList,TIpcArgs(&idPckg,&sizePckg, &aUUID, &pathname )) ; - if (err != KErrNone) - { - return err; - } - - if ( size > 0 ) - { - TFileInfo* dirs = new TFileInfo[size]; - // put array on cleanup stack - TPtr8 result(reinterpret_cast(dirs), sizeof(TFileInfo)*size, sizeof(TFileInfo)*size); - err = SendReceive(EDownloadDirList,TIpcArgs(id, &result)); - - for (TInt i = 0; i < size; i++) - { - CRsfwDirEnt* entry = GetFileInformationL(dirs[i]); - aDirList.AppendL(entry); - } - delete[] dirs; - } - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::GetDirectoryAttributeL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetDirectoryAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aDirAtt) - { - if (aPathName.Compare(KNullDesC) == 0) - { - TFileInfo fi; - fi.iAtt |= KEntryAttDir; - aDirAtt = GetFileAttributesL(fi); - return KErrNone; - } - - TFileName8 pathname; - pathname.Copy(aPathName); - TFileInfo fileInfo; - TPckg attrPckg(fileInfo); - TInt err = SendReceive(EDirAttributes, TIpcArgs(&aUUID, &pathname, &attrPckg) ); - //convert TFileInfo to CDirEntAttr - if (err == KErrNone) - aDirAtt = GetFileAttributesL(fileInfo); - - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::GetFileAttributeL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetFileAttributeL(const TDesC8& aUUID, const TDesC& aPathName, CRsfwDirEntAttr*& aFileAtt) - { - TFileName8 pathname; - pathname.Copy(aPathName); - - TFileInfo fileInfo; - TPckg attrPckg(fileInfo); - TInt err = SendReceive(EFileAttributes, TIpcArgs(&aUUID, &pathname, &attrPckg) ) ; - //convert TFileInfo to CDirEntAttr - if (err == KErrNone) - aFileAtt = GetFileAttributesL(fileInfo); - - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::GetFileL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::GetFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName, - TInt aStart, TInt aLength, TUint aFlags, TInt& aRead) - { - TFileName8 srcpathname; - srcpathname.Copy(aSrcPathName); - - TFilePosition position; - position.iStart = aStart; - position.iLength = aLength; - position.iFlags = aFlags; - - TPckg posPckg(position); - - TInt err = SendReceive(EGetFile, TIpcArgs(&aUUID, &srcpathname, &aDstPathName, &posPckg) ) ; - aRead = position.iLength; - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::DeleteFileL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::DeleteFileL(const TDesC8& aUUID, const TDesC& aPathName) - { - TFileName8 pathname; - pathname.Copy(aPathName); - TInt err = SendReceive(EDeleteFile, TIpcArgs(&aUUID, &pathname) ); - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::DeleteDirectoryL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::DeleteDirectoryL(const TDesC8& aUUID, const TDesC& aPathName) - { - TFileName8 pathname; - pathname.Copy(aPathName); - TInt err = SendReceive(EDeleteDirectory, TIpcArgs(&aUUID, &pathname) ); - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::CreateFileL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::CreateFileL(const TDesC8& aUUID, const TDesC& aPathName) - { - TFileName8 pathname; - pathname.Copy(aPathName); - TInt err = SendReceive(ECreateFile, TIpcArgs(&aUUID, &pathname) ); - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::MakeDirectoryL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::MakeDirectoryL(const TDesC8& aUUID, const TDesC& aPathName) - { - TFileName8 pathname; - pathname.Copy(aPathName); - TInt err = SendReceive(ECreateDirectory, TIpcArgs(&aUUID, &pathname) ); - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::PutFileL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RUpnpAVCPEngineRFSClient::PutFileL(const TDesC8& aUUID, const TDesC& aSrcPathName, const TDesC& aDstPathName) - { - TFileName8 dstpathname; - dstpathname.Copy(aDstPathName); - TInt err = SendReceive(EPutFile, TIpcArgs(&aUUID, &aSrcPathName, &dstpathname) ); - return err; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::GetAttributes -// ----------------------------------------------------------------------------- -// -CRsfwDirEntAttr* RUpnpAVCPEngineRFSClient::GetFileAttributesL(TFileInfo& aFileInfo) - { - CRsfwDirEntAttr* result = CRsfwDirEntAttr::NewLC(); - - result->SetMimeTypeL(aFileInfo.iMimeType); - result->SetModified(aFileInfo.iModified); - result->SetAtt(aFileInfo.iAtt); - result->SetSize(aFileInfo.iSize); - CleanupStack::Pop(result); - return result; - } - -// ----------------------------------------------------------------------------- -// RUpnpAVCPEngineRFSClient::GetFileInformation -// ----------------------------------------------------------------------------- -// - CRsfwDirEnt* RUpnpAVCPEngineRFSClient::GetFileInformationL(TFileInfo& aFileInfo) - { - return CRsfwDirEnt::NewL(aFileInfo.iName, GetFileAttributesL(aFileInfo)); - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/avcpengineclient/src/upnpmetadata.cpp --- a/upnpavcontrolpoint/avcpengineclient/src/upnpmetadata.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,556 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Class for fetching and updating MS metadata -* -*/ - - - -// INCLUDE FILES -#include "upnpmetadata.h" -#include "upnpavcpenginemsclient.h" -#include -#include -#include -#include - - -_LIT(KUPnP16, "upnp"); - -_LIT8(KId, "id"); -_LIT8(KUPnP, "upnp"); -_LIT8(KDc, "dc"); -_LIT8(KArtist, "artist"); -_LIT8(KAlbum, "album"); -_LIT8(KGenre, "genre"); -_LIT8(KClass, "class"); -_LIT8(KCreator, "creator"); -_LIT8(KTitle, "title"); - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::CUpnpMetadata -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUpnpMetadata::CUpnpMetadata(RUpnpAVCPEngineMSClient& aSession): - CActive(EPriorityStandard), - iSession(aSession), - iMetaDataPtr(NULL,0), - iIdPckg(iId), - iSizePckg(iSize) - { - CActiveScheduler::Add(this); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::ConstructL() - { -// User::LeaveIfError( iRsfwControl.Connect() ); - iDOMImpl.OpenL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CUpnpMetadata* CUpnpMetadata::NewL(RUpnpAVCPEngineMSClient& aSession) - { - CUpnpMetadata* self = new( ELeave ) CUpnpMetadata(aSession); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::~CUpnpMetadata -// Destructor -// ----------------------------------------------------------------------------- -// -CUpnpMetadata::~CUpnpMetadata() - { - delete iUuid; - delete iPathName; - delete iMetaData; - delete iUpdatedMetaData; - iDocument.Close(); - iDOMImpl.Close(); - //iRsfwControl.Close(); - } - - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::FetchL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::FetchL(const TDesC& aPathName ) - { - - PrepareDataL(aPathName); - GetMetadataL(); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::FetchL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::FetchL(const TDesC& aPathName, TRequestStatus& aStatus ) - { - PrepareDataL(aPathName); - GetMetadataL(aStatus); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::CommitL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::CommitL() - { - //Dump XML tree into buffer - RBuf8 xmlBuf; - CleanupClosePushL(xmlBuf); - TXmlEngSerializationOptions options(TXmlEngSerializationOptions::KOptionIndent); - - iDocument.SaveL( xmlBuf, iDocument.DocumentElement(), options); - - iSession.SetMetadataL(*iUuid, *iPathName, *iMetaData, xmlBuf); - - CleanupStack::PopAndDestroy(&xmlBuf); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::CommitL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::CommitL(TRequestStatus& aStatus) - { - - iClientStatus = &aStatus; - *iClientStatus = KRequestPending; - - //Dump XML tree into buffer - RBuf8 xmlBuf; - CleanupClosePushL(xmlBuf); - TXmlEngSerializationOptions options(TXmlEngSerializationOptions::KOptionIndent); - - iDocument.SaveL( xmlBuf, iDocument.DocumentElement(), options); - delete iUpdatedMetaData; - iUpdatedMetaData = NULL; - - iUpdatedMetaData = xmlBuf.AllocL(); - CleanupStack::PopAndDestroy(&xmlBuf); - - iSession.SetMetadata(iStatus, *iUuid, *iPathName, *iMetaData, *iUpdatedMetaData); - SetActive(); - iState = EUploadingMetadata; - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::PrepareData -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::PrepareDataL(const TDesC& aPathName ) - { - - TParse parseFilename; - parseFilename.Set( aPathName, NULL, NULL ); - - - TChar drive = parseFilename.Drive()[0]; - drive.UpperCase(); - - CRsfwMountMan* mountman = NULL; - mountman = CRsfwMountMan::NewL(0, NULL); - User::LeaveIfNull(mountman); - CleanupStack::PushL(mountman); - - const CRsfwMountEntry* entry = - mountman->MountEntryL(drive); - - if (!entry) - { - CleanupStack::PopAndDestroy(mountman); - User::Leave(KErrNotFound); - } - - HBufC* uri = entry->Item(EMountEntryItemUri)->Alloc(); - - if (!uri) - User::Leave(KErrNoMemory); - - CleanupStack::PushL(uri); - // parse URI - TUriParser uriParser; - User::LeaveIfError( uriParser.Parse(*uri) ); - - if ( uriParser.Extract( EUriScheme ).Compare(KUPnP16) == 0) - { - delete iUuid; - iUuid = NULL; - - delete iPathName; - iPathName = NULL; - - // filename normalize - iPathName = HBufC8::NewL( parseFilename.FullName().Length()); - iPathName->Des().Append(parseFilename.Path()); - TPtr8 path = iPathName->Des(); - Normalize( path ); - iPathName->Des().Append(parseFilename.NameAndExt()); - - // uuid - iUuid = HBufC8::NewL(uriParser.Extract( EUriHost ).Length()); - iUuid->Des().Copy(uriParser.Extract( EUriHost )); - } - else - { - CleanupStack::PopAndDestroy(uri); - CleanupStack::PopAndDestroy(mountman); - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy(uri); - CleanupStack::PopAndDestroy(mountman); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Normalize -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::Normalize(TDes8& aData) - { - for (TInt i = 0; i < aData.Length(); i++) - { - if (aData[i] == '\\') - { - aData[i] = '/'; - } - } - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::ParseMetadataL -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::ParseMetadataL() - { - iDocument.Close(); - // Create a parser - RXmlEngDOMParser parser; - User::LeaveIfError( parser.Open(iDOMImpl) ); - CleanupClosePushL(parser); - // Handler to DOM document - iDocument = parser.ParseL( *iMetaData ); - CleanupStack::PopAndDestroy(&parser); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::GetMetadataL -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::GetMetadataL() - { - iSession.PrepareMetadataL(*iUuid, *iPathName, iIdPckg, iSizePckg); - if (iSize > 0) - { - delete iMetaData; - iMetaData = NULL; - iMetaData = HBufC8::NewL(iSize); - iMetaDataPtr.Set(iMetaData->Des()); - iSession.DownloadMetadataL(iId, iMetaDataPtr); - ParseMetadataL(); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::GetMetadataL -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::GetMetadataL(TRequestStatus& aStatus) - { - iClientStatus = &aStatus; - *iClientStatus = KRequestPending; - iSession.PrepareMetadata(iStatus, *iUuid, *iPathName, iIdPckg, iSizePckg); - SetActive(); - iState = EPreparingMetadata; - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::DoCancel -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::DoCancel() - { - if (iClientStatus) - { - User::RequestComplete(iClientStatus, KErrCancel); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::RunError -// ----------------------------------------------------------------------------- -// -TInt CUpnpMetadata::RunError( TInt aError ) - { - if (iClientStatus) - { - User::RequestComplete(iClientStatus, aError); - } - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::RunL -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::RunL() - { - if (iStatus.Int() == KErrNone) - { - switch (iState) - { - case EPreparingMetadata: - if (iSize > 0) - { - delete iMetaData; - iMetaData = NULL; - iMetaData = HBufC8::NewL(iSize); - iMetaDataPtr.Set(iMetaData->Des()); - iSession.DownloadMetadata(iStatus, iId, iMetaDataPtr); - SetActive(); - iState = EDownloadingMetadata; - } - break; - case EDownloadingMetadata: - ParseMetadataL(); - User::RequestComplete(iClientStatus, iStatus.Int()); - break; - case EUploadingMetadata: - delete iUpdatedMetaData; - iUpdatedMetaData = NULL; - User::RequestComplete(iClientStatus, iStatus.Int()); - break; - } - } - else - { - User::RequestComplete(iClientStatus, iStatus.Int()); - } - } - - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::ObjectL -// ----------------------------------------------------------------------------- -// -TBool CUpnpMetadata::ObjectL(TXmlEngElement& aObject) - { - TXmlEngElement root = iDocument.DocumentElement(); - - RXmlEngNodeList argElems; - CleanupClosePushL(argElems); - root.GetChildElements( argElems ); - - if ( argElems.Count() == 1 ) - { - aObject = argElems.Next(); - - } - - CleanupStack::PopAndDestroy(&argElems); - return !aObject.IsNull(); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::GetElementL -// ----------------------------------------------------------------------------- -// -TPtrC8 CUpnpMetadata::GetElementL( const TDesC8& aName) - { - TXmlEngElement result; - TXmlEngElement object; - if (ObjectL(object) && UpnpDomInterface::GetElementL( object, result, aName) ) - { - return result.Value(); - } - - return KNullDesC8(); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::SetElementL -// ----------------------------------------------------------------------------- -// -void CUpnpMetadata::SetElementL( const TDesC8& aNamespace, const TDesC8& aName, const TDesC8& aValue) - { - TXmlEngElement result; - TXmlEngElement object; - if (ObjectL(object)) - { - if (!UpnpDomInterface::GetElementL( object, result, aName) ) - { - result = object.AddNewElementUsePrefixL(aName, aNamespace); - } - result.SetTextL( aValue ); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Id -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CUpnpMetadata::IdL() - { - TXmlEngElement object; - if (ObjectL(object)) - { - return UpnpDomInterface::GetAttrValueL( object, KId ); - } - else - { - return KNullDesC8(); - } - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Title -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CUpnpMetadata::TitleL() - { - return GetElementL(KTitle); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::SetTitleL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::SetTitleL(const TDesC8& aTitle) - { - SetElementL(KDc, KTitle, aTitle); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Creator -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CUpnpMetadata::CreatorL() - { - return GetElementL(KCreator); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::SetCreator -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::SetCreatorL(const TDesC8& aCreator) - { - SetElementL(KDc,KCreator, aCreator); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Class -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CUpnpMetadata::ClassL() - { - return GetElementL(KClass); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::SetClass -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::SetClassL(const TDesC8& aClass) - { - SetElementL(KUPnP, KClass, aClass); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Artist -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CUpnpMetadata::ArtistL() - { - return GetElementL(KArtist); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::SetArtist -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::SetArtistL(const TDesC8& aArtist) - { - SetElementL(KUPnP, KArtist, aArtist); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Genre -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CUpnpMetadata::GenreL() - { - return GetElementL(KGenre); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::SetGenre -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::SetGenreL(const TDesC8& aGenre) - { - SetElementL(KUPnP, KGenre, aGenre); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::Album -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CUpnpMetadata::AlbumL() - { - return GetElementL(KAlbum); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::SetAlbum -// ----------------------------------------------------------------------------- -// -EXPORT_C void CUpnpMetadata::SetAlbumL(const TDesC8& aAlbum) - { - SetElementL(KUPnP, KAlbum, aAlbum); - } - -// ----------------------------------------------------------------------------- -// CUpnpMetadata::AsXmlL -// ----------------------------------------------------------------------------- -// -EXPORT_C RXmlEngDocument& CUpnpMetadata::AsXmlL() - { - return iDocument; - } - - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/group/bld.inf --- a/upnpavcontrolpoint/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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 info for the UPnP Stack subsystem -* -*/ - -#include - -PRJ_PLATFORMS -WINSCW ARMV5 -//DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES - -#include "../avcontrolframework/group/bld.inf" - -// UPnP Stack ROM -#include "../rom/bld.inf" - -/* -commented-out due to s60 distribution policy -#include "../avcpengine/group/bld.inf" -#include "../avcpengineclient/group/bld.inf" -#include "../upnpaccessplugin/group/bld.inf" -*/ - - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/rom/bld.inf --- a/upnpavcontrolpoint/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/** @file -* Copyright (c) 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" -* 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 info for the UPnP Stack ROM -* -*/ - -#include - -PRJ_PLATFORMS -WINSCW ARMV5 -//DEFAULT - -PRJ_EXPORTS -../rom/upnpavcontrolpoint.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpavcontrolpoint.iby) - - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/rom/upnpavcontrolpoint.iby --- a/upnpavcontrolpoint/rom/upnpavcontrolpoint.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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 UPnP UPnP AVControl Point subsystem -* -*/ - - -#ifndef __UPNPAVCONTROLPOINT_IBY__ -#define __UPNPAVCONTROLPOINT_IBY__ - -#ifdef __UPNP_STACK -#ifdef __UPNP_AVCP - -file=ABI_DIR\BUILD_DIR\avcontrolframework.dll \sys\bin\avcontrolframework.dll -#ifdef __UPNP_REMOTE_STORAGE -#ifdef __REMOTE_STORAGE_FW -file=ABI_DIR\BUILD_DIR\avcpengine.exe \Sys\Bin\avcpengine.exe -file=ABI_DIR\BUILD_DIR\avcpengineclient.dll \sys\bin\avcpengineclient.dll -ECOM_PLUGIN(upnpaccess.dll, upnpaccess.rsc) -#endif // __REMOTE_STORAGE_FW -#endif // __UPNP_REMOTE_STORAGE - -#endif // __UPNP_AVCP -#endif // __UPNP_STACK - -#endif // __UPNPAVCONTROLPOINT_IBY__ - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/upnpaccessplugin/data/101F9779.rss --- a/upnpavcontrolpoint/upnpaccessplugin/data/101F9779.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: ECOM registration for UPnPAccess -* -*/ - - -// INCLUDES -#include "ecom/registryinfo.rh" - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// REGISTRY_INFO theInfo -// Declares info for the "remoteaccess/upnp" implementation -// -// ----------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x101F9779; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x101F96E3; - implementations = - { - // Info for CUpnpAccess - IMPLEMENTATION_INFO - { - implementation_uid = 0x101F9779; // why is it the same UID as UID3? - version_no = 1; - display_name = "upnp"; - default_data = "remoteaccess/upnp||UPnP"; - opaque_data = "params"; - } - }; - } - }; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/upnpaccessplugin/group/bld.inf --- a/upnpavcontrolpoint/upnpaccessplugin/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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 info for UPnPAccess -* -*/ - - - -PRJ_MMPFILES -upnpaccessplugin.mmp - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/upnpaccessplugin/group/upnpaccessplugin.mmp --- a/upnpavcontrolpoint/upnpaccessplugin/group/upnpaccessplugin.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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 specification for UPnPAccess -* -*/ - -#include "../../../group/upnpplatformvar.hrh" - -TARGET upnpaccess.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x101F9779 -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE upnpaccess.cpp - -VERSION 10.1 -paged - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../../inc -USERINCLUDE ../../inc -USERINCLUDE ../inc - -SOURCEPATH ../data - -START RESOURCE 101F9779.rss -HEADER -TARGET upnpaccess.rsc -TARGETPATH resource/plugins -END - -LIBRARY bafl.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY euser.lib -LIBRARY inetprotutil.lib - -// UPnP -LIBRARY avcpengineclient.lib - -// Remote Storage -LIBRARY rsfwcommon.lib - -LIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/upnpaccessplugin/inc/upnpaccess.h --- a/upnpavcontrolpoint/upnpaccessplugin/inc/upnpaccess.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,327 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: UPnP plugin interface for RSFW -* -*/ - - -#ifndef C_CUPNPACCESS_H -#define C_CUPNPACCESS_H - -// INCLUDES -#include -#include "upnpavcpenginerfsclient.h" - -// CLASS DECLARATION - -/** - * UPnP plugin for Rsfw. - * It enables mounting MS as new filesystem. - * - * @lib upnpaccess.lib - * @since Series 60 3.1 - */ -class CUpnpAccess: public CRsfwRemoteAccess - { - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CUpnpAccess* NewL(); - - /** - * Destructor. - */ - virtual ~CUpnpAccess(); - /** - * Set up parameters for operation. - * @param aRsfwRemoteAccessObserver MRsfwRemoteAccessObserver for receiving - * asynchronous events from the accessor plugin, - * e.g. changes in connectivity. - * This parameter may be NULL - * NOTICE: this function is not supported by UPnP access plugin - */ - void SetupL(MRsfwRemoteAccessObserver* /* aRsfwRemoteAccessObserver */); - - /** - * Opens a connection to the server given by aServerName parameter. - * For UPnPAccess only serve has to be defined and - * value should be equal to UDN of MS - * So format URI for mounting has to be: - * upnp://UDN - * - * @param aUri URI of the remote repository. - * The URI must not contain authority part (user name/password) - * @param aFriendlyName server friendly name for access control dialog - * (can be empty) - * @param aUserName user name for access control (can be empty) - * @param aPassword password for access control (can be empty) - * @param aAuxData auxiliary parameters for connection setup (eg IAP info) - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint OpenL(const TUriC& aUri, - const TDesC& aFriendlyName, - const TDesC& aUserName, - const TDesC& aPassword, - const TDesC& aAuxData, - MRsfwRemoteAccessResponseHandler* aResponseHandler) ; - - /** - * Gets contents of the directory given by aPathName parameter. - * - * @param aPathName path name of the directory - * @param aDirentsp an array of directory entries to be filled. - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint GetDirectoryL(const TDesC& aPathName, - RPointerArray& aDirEnts, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - - /** - * Gets attributes of the directory given by aPathName parameter. - * This function may also be called if the type of the object is - * not yet known (e.g., the object could be a file). - * - * @param aPathName path name of the directory - * @param aAttr attribute structure to be filled - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint GetDirectoryAttributesL( - const TDesC& aPathName, - CRsfwDirEntAttr*& aAttr, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Gets attributes of the file given by aPathName parameter. - * - * @param aPathName path name of the file - * @param aAttr attribute structure to be filled - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint GetFileAttributesL(const TDesC& aPathName, CRsfwDirEntAttr*& aAttr, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Sets attributes of the file or directory given by aPathName parameter. - * This function is typically only used for files and even then - * the implementation may do nothing since standard file attributes - * are implied by the contents of the file or set in conjunction with - * other operations on the file system object. - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aPathName path name of the file or directory - * @param aAttr attribute structure - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint SetAttributesL(const TDesC& aPathName, - CRsfwDirEntAttr& aAttr, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Gets a remote file and copies it to a local file. - * Note that byte ranges are not be implemented by all - * file access protocols. - * - * @param aRemotePathName path name of the remote file - * @param aLocalPathName path name of the local file - * @param aOffset offset of the first byte to be accessed - * @param aLength length of data to be accessed/was accessed (NULL/0=all) - * @param aFlags operation qualifier. - * The following flags have been defined: - * KRemoteAccessOptionGetToStartOfFile: even if an offset is specified - * the fetched data is still put at the beginning of the local file. - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint GetFileL(const TDesC& aRemotePathName, - const TDesC& aLocalPathName, - TInt aOffset, - TInt* aLength, - TUint aFlags, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Puts a file to the server. - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aLocalPathName path name of the local file - * @param aRemotePathName path name of the remote file - * @param aMimeType MIME-type of the file - * (will be put to Content-Type, e.g. text/plain or - * application/octet-stream) - * @param aOffset offset of the first byte to be accessed - * @param aLength length of data to be accessed (NULL/0=all) - * @param aTotalLength total length of the file - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint PutFileL(const TDesC& aLocalPathName, - const TDesC& aRemotePathName, - const TDesC8& aMimeType, - TInt aOffset, - TInt aLength, - TInt aTotalLength, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Puts a file to the server. - * - * @param aLocalPathName path name of the local file - * @param aRemotePathName path name of the remote file - * @param aMimeType MIME-type of the file (will be put to Content-Type, - * e.g. text/plain or application/octet-stream) - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint PutFileL(const TDesC& aLocalPathName, - const TDesC& aRemotePathName, - const TDesC8& aMimeType, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Creates an empty file on the remote server - * - * @param aPathName path name of the new file - * @param aOverWriting whether we are overwriting an existing file - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint CreateFileL(const TDesC& aPathName, TBool aOverWriting, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Makes a directory. - * - * @param aPathName path name of the new directory - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint MakeDirectoryL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Deletes a directory. - * - * @param aPathName path name of the directory to be deleted - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint DeleteDirectoryL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Deletes a file. - * - * @param aPathName path name of the file to be deleted - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint DeleteFileL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Renames a file or a directory. - * (may involve movement to another directory). - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aSrcPathName path name of the object to be renamed - * @param aDstPathName new path name of the object - * @param aOverwrite allow overwriting an existing object - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint RenameL(const TDesC& aSrcPathName, - const TDesC& aDstPathName, - TBool aOverwrite, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - - /** - * Obtains a lock for the given file system object - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aPathName path name of the object to be locked - * @param aLockFlags indicates whether a write or read lock is requested - * @param aTimeout the timeout that is requested and granted - * @param aLockToken lock token - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint ObtainLockL(const TDesC& aPathName, - TUint aLockFlags, - TUint& aTimeout, - TDesC8*& aLockToken, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Releases the lock of the given file system object - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aPathName path name of the object to be locked - * @param aResponseHandler response handler - */ - TUint ReleaseLockL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - /** - * Refreshes the lock of the given file system object - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aPathName path name of the object to be locked - * @param aTimeout the timeout that is requested and granted - * @param aResponseHandler response handler - * @return identifier of the created transaction - */ - TUint RefreshLockL(const TDesC& aPathName, - TUint& aTimeout, - MRsfwRemoteAccessResponseHandler* aResponseHandler); - - /** - * Sets lock token for the a given resource - * This lock token value replaces any previously cached token value - * - * @param aPathName path name - * @param aLockToken lock token - * @return error code - */ - TInt SetLockToken(const TDesC& aPathName, const TDesC8& aLockToken); - - /** - * Cancels a transaction - * Eventually the transaction will/should call HandleRemoteAccessResponseL - * with status KErrCancel - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aId the identifier of the transaction to be canceled - */ - void Cancel(TUint aId); - - /** - * Cancels a transaction - * Eventually the transaction will/should call HandleRemoteAccessResponseL - * with status KErrCancel - * NOTICE: this function is not supported by UPnP access plugin - * - * @param aTargetPath the identifier of the transaction to be canceled - */ - void Cancel(TDesC& aTargetPath); - - private: - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); - - private: - // UDN of MS - HBufC8* iUUID; - // client to target server - RUpnpAVCPEngineRFSClient iAVCPEngineClient; - }; - -#endif // C_CUPNPACCESS_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/upnpaccessplugin/inc/upnpmydebug.h --- a/upnpavcontrolpoint/upnpaccessplugin/inc/upnpmydebug.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/** @file -* Copyright (c) 2002-2004 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: Debug definitions for UPnPAccess -* -*/ - - -#ifndef C_UPNPMYDEBUG_H -#define C_UPNPMYDEBUG_H - -// MACROS -#define APPEND_TO_DEBUG_FILE - -// CONSTANTS -_LIT(KDebugDirName, "avcp"); -_LIT(KDebugFileName, "upnpaccess.txt"); - -#endif // MYDEBUG_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpavcontrolpoint/upnpaccessplugin/src/upnpaccess.cpp --- a/upnpavcontrolpoint/upnpaccessplugin/src/upnpaccess.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,406 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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: Implements remote access plugin API - loopback to File Server - * -*/ - - -// INCLUDE FILES -#include "upnpaccess.h" -#include "upnpmdebug.h" - -#include -#include - -// ============================= LOCAL FUNCTIONS =============================== - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - {{0x101F9779}, (TProxyNewLPtr)CUpnpAccess::NewL} - }; - -// ---------------------------------------------------------------------------- -// ImplementationGroupProxy -// Exported proxy for instantiation method resolution -// ---------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* -ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -// ============================ MEMBER FUNCTIONS ============================== -// ---------------------------------------------------------------------------- -// CUpnpAccess::ConstructL -// Symbian 2nd phase constructor can leave. -// ---------------------------------------------------------------------------- -// -void CUpnpAccess::ConstructL() - { - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::NewL -// Two-phased constructor. -// ---------------------------------------------------------------------------- -// -CUpnpAccess* CUpnpAccess::NewL() - { - CUpnpAccess* self = new (ELeave) CUpnpAccess; - DEBUGSTRING(("in NewL 0x%x", self)); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// Destructor -CUpnpAccess::~CUpnpAccess() - { - DEBUGSTRING(("in destructor 0x%x", this)); - delete iUUID; - iAVCPEngineClient.Close(); - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::SetupL -// ---------------------------------------------------------------------------- -// - void CUpnpAccess::SetupL(MRsfwRemoteAccessObserver*) - { - DEBUGSTRING(("in SetupL")); - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::OpenL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::OpenL(const TUriC& aUri, - const TDesC& /* aFriendlyName */, - const TDesC& /* aUserName */, - const TDesC& /* aPassword */, - const TDesC& /* aAuxData */, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - - TPtrC host(aUri.Extract(EUriHost)); - DEBUGSTRING16(("open plugin for '%S'", &host)); - - iUUID = HBufC8::NewL(host.Length()); - iUUID->Des().Copy(host); - - User::LeaveIfError(iAVCPEngineClient.Connect()); - - aResponseHandler->HandleRemoteAccessResponse(0, KErrNone); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::GetDirectoryL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::GetDirectoryL(const TDesC& aPathName, - RPointerArray& aDirEnts, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("get directory '%S'", &aPathName)); - - TInt err = iAVCPEngineClient.GetDirectoryL(*iUUID, aPathName, aDirEnts); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::GetDirectoryAttributesL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::GetDirectoryAttributesL(const TDesC& aPathName, - CRsfwDirEntAttr*& aAttr, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - // This function reads attributes of a directory - // (not attributes of the files in the directory) - DEBUGSTRING16(("Get directory attributes of '%S'", &aPathName)); - - TInt err = iAVCPEngineClient.GetDirectoryAttributeL(*iUUID, aPathName, aAttr); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::GetFileAttributesL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::GetFileAttributesL(const TDesC& aPathName, - CRsfwDirEntAttr*& aAttr, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("Get file attributes of '%S'", &aPathName)); - - TInt err = iAVCPEngineClient.GetFileAttributeL(*iUUID, aPathName, aAttr); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::SetAttributesL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::SetAttributesL(const TDesC& aPathName, - CRsfwDirEntAttr& /*aAttr*/, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("Set attributes of '%S'", - &aPathName)); - - aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::GetFileL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::GetFileL(const TDesC& aRemotePathName, - const TDesC& aLocalPathName, - TInt aOffset, - TInt* aLength, - TUint aFlags, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - - DEBUGSTRING16(("get file '%S'", &aRemotePathName)); - DEBUGSTRING16((" into file '%S'", &aLocalPathName)); - - TInt length = 0; - if (aLength) - { - length = *aLength; - } - DEBUGSTRING(("offset=%d, length=%d", aOffset, length)); - - TInt read; - TInt err = iAVCPEngineClient.GetFileL(*iUUID, - aRemotePathName, aLocalPathName, aOffset, length, aFlags, read); - - if (aLength) { - *aLength = read; - } - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::MakeDirectoryL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::MakeDirectoryL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("Make directory '%S'", &aPathName)); - - TInt err = iAVCPEngineClient.MakeDirectoryL(*iUUID, aPathName); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::CreateFileL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::CreateFileL(const TDesC& aPathName, TBool aOverWriting, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("Create file '%S'", &aPathName)); - - TInt err(0); - if (aOverWriting) - { - DEBUGSTRING16(("delete file '%S'", &aPathName)); - err = iAVCPEngineClient.DeleteFileL(*iUUID, aPathName); - } - - if (err == KErrNone) - err = iAVCPEngineClient.CreateFileL(*iUUID, aPathName); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::PutFileL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::PutFileL(const TDesC& aLocalPathName, - const TDesC& aRemotePathName, - const TDesC8& /*aMimeType*/, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("put file '%S'", &aLocalPathName)); - DEBUGSTRING16((" to remote file '%S'", &aRemotePathName)); - - TInt err = iAVCPEngineClient.PutFileL(*iUUID, aLocalPathName, aRemotePathName); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::PutFileL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::PutFileL(const TDesC& aLocalPathName, - const TDesC& aRemotePathName, - const TDesC8& /*aMimeType*/, - TInt /* aOffset */, - TInt /* aLength */, - TInt /* aTotalLength */, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("put file '%S'", &aLocalPathName)); - DEBUGSTRING16((" to remote file '%S'", &aRemotePathName)); - - aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::DeleteDirectoryL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::DeleteDirectoryL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("delete directory '%S'", &aPathName)); - - TInt err = iAVCPEngineClient.DeleteDirectoryL(*iUUID, aPathName); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::DeleteFileL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::DeleteFileL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("delete file '%S'", &aPathName)); - - TInt err = iAVCPEngineClient.DeleteFileL(*iUUID, aPathName); - - aResponseHandler->HandleRemoteAccessResponse(0, err); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::RenameL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::RenameL(const TDesC& aSrcPathName, - const TDesC& aDstPathName, - TBool /*aOverwrite*/, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - - DEBUGSTRING16(("Rename '%S' to '%S'", &aSrcPathName, &aDstPathName)); - aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::ObtainLockL -// ---------------------------------------------------------------------------- -// - -TUint CUpnpAccess::ObtainLockL(const TDesC& aPathName , - TUint /* aLockFlags */, - TUint& /*aTimeOut*/, - TDesC8*& /* aLockToken */, - MRsfwRemoteAccessResponseHandler* aResponseHandler ) - { - DEBUGSTRING16(("obtain lock '%S'", &aPathName)); - - aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::ReleaseLockL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::ReleaseLockL(const TDesC& aPathName, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("release lock '%S'", &aPathName)); - - aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::RefreshLockL -// ---------------------------------------------------------------------------- -// -TUint CUpnpAccess::RefreshLockL(const TDesC& aPathName, TUint& /*aTimeOut*/, - MRsfwRemoteAccessResponseHandler* aResponseHandler) - { - DEBUGSTRING16(("refresh lock '%S'", &aPathName)); - - aResponseHandler->HandleRemoteAccessResponse(0, KErrNotSupported); - return 0; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::SetLockToken -// ---------------------------------------------------------------------------- -// -TInt CUpnpAccess::SetLockToken(const TDesC& /* aPathName */, - const TDesC8& /* aLockToken */) - { - return KErrNotSupported; - } - -// ---------------------------------------------------------------------------- -// CUpnpAccess::CancelL -// ---------------------------------------------------------------------------- -// -void CUpnpAccess::Cancel(TDesC& /* aTargetPath */) - { - // Nothing to cancel - } -// ---------------------------------------------------------------------------- -// CUpnpAccess::CancelL -// ---------------------------------------------------------------------------- -// -void CUpnpAccess::Cancel(TUint /* aId */) - { - // Nothing to cancel - } - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/20007564.cre Binary file upnpframework/install/20007564.cre has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/20009cae.cre Binary file upnpframework/install/20009cae.cre has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/cenrep.pkg --- a/upnpframework/install/cenrep.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -; -; Copyright (c) 2006-2007 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: pkg file for upnpfw central repositories -; - -;Languages -&EN - -; Header -#{ "UPnPFramework CenRep file"}, (0x10202BE9), 1, 0, 0, TYPE=SP - -; Supports Series 60 v3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Localised vendor name -%{"Nokia-EN"} -; Unique vendor name -:"Nokia" - -"\epoc32\release\arm5\urel\z\private\20009cae.cre"-"!:\private\10202be9\persists\20009cae.cre" -"\epoc32\release\arm5\urel\z\private\20007564.cre"-"!:\private\10202be9\persists\20007564.cre" diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/homesynccenrep.pkg --- a/upnpframework/install/homesynccenrep.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -; -; Copyright (c) 2006-2007 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: pkg file for homesync central repository -; - - -;Languages -&EN - -; Header -#{ "MediaServant CenRep file"}, (0x10202BE9), 1, 0, 0, TYPE=SP - -; Supports Series 60 v3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Localised vendor name -%{"Nokia-EN"} -; Unique vendor name -:"Nokia" - -"\epoc32\release\armv5\urel\z\private\10202be9\10281fab.cre"-"!:\private\10202be9\persists\10281fab.cre" \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/make_upnpframework_sis.bat --- a/upnpframework/install/make_upnpframework_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Bat for creating and signing upnpframework sis-files -rem - -makesis cenrep.pkg -signsis cenrep.sis cenrep.sisx rd.cer rd-key.pem - -makesis upnpframework.pkg -signsis upnpframework.sis upnpframework.sisx rd.cer rd-key.pem diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/make_upnpframework_stub_sis.bat --- a/upnpframework/install/make_upnpframework_stub_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Bat for creating upnpframework_stub.sis -rem - -makesis -s upnpframework_stub.pkg diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/upnpframework.pkg --- a/upnpframework/install/upnpframework.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -; -; Copyright (c) 2006-2007 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: pkg file for upnp framework -; - - -; upnpframework.pkg -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"UPnPFramework"},(0x10006CCA),1,1,0, TYPE=SA, RU - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - - -; UpnpSettings -"\epoc32\release\armv5\urel\upnpsettingsengine.dll"-"!:\sys\bin\upnpsettingsengine.dll" - -;UPnP utilities -"\epoc32\release\armv5\urel\upnputilities.dll"-"!:\sys\bin\upnputilities.dll" - -; UPnP (Home Media) Extension Plugin interface -"\epoc32\release\armv5\urel\upnpextensionpluginif.dll"-"!:\sys\bin\upnpextensionpluginif.dll" - -;UPnP AV Controller -"\epoc32\release\armv5\urel\upnpavcontrollerclient.dll"-"!:\sys\bin\upnpavcontrollerclient.dll" -"\epoc32\release\armv5\urel\upnpavcontrollerserver.exe"-"!:\sys\bin\upnpavcontrollerserver.exe" -"\epoc32\release\armv5\urel\upnpavcontrollerhelper.dll"-"!:\sys\bin\upnpavcontrollerhelper.dll" - -;UPnP Security -"\epoc32\release\armv5\urel\upnpsecuritymanagerclient.dll"-"!:\sys\bin\upnpsecuritymanagerclient.dll" -"\epoc32\release\armv5\urel\upnpsecuritymanagerserver.exe"-"!:\sys\bin\upnpsecuritymanagerserver.exe" -"\epoc32\data\Z\resource\UPnPNotifier.RSC"-"!:\resource\UPnPNotifier.RSC" -"\epoc32\release\armv5\urel\upnpsecurity.dll"-"!:\sys\bin\upnpsecurity.dll" -"\epoc32\release\armv5\urel\upnpsecuritymanagerplugin.dll"-"!:\sys\bin\upnpsecuritymanagerplugin.dll" -"\epoc32\data\Z\resource\plugins\upnpsecuritymanagerplugin.rsc"-"!:\resource\plugins\upnpsecuritymanagerplugin.rsc" - -;UPnP musicadapter -"\epoc32\release\armv5\urel\upnpmusicadapter.dll"-"!:\sys\bin\upnpmusicadapter.dll" - -;UPnP CommonUI -"\epoc32\release\armv5\urel\UPnPCommonUI.dll"-"!:\sys\bin\UPnPCommonUI.dll" -"\epoc32\data\Z\resource\apps\upnpcommonui.mif"-"!:\resource\apps\upnpcommonui.mif" -"\epoc32\data\Z\resource\UPnPCommonUI.rsc"-"!:\resource\UPnPCommonUI.rsc" - -;UPnP AIW Engine -"\epoc32\release\armv5\urel\upnpaiwengine.dll"-"!:\sys\bin\upnpaiwengine.dll" - -;UPnP File Transfer Engine -"\epoc32\release\armv5\urel\upnpfiletransferengine.dll"-"!:\sys\bin\upnpfiletransferengine.dll" -"\epoc32\data\Z\resource\UPnPFileTransferEngineResources.rsc"-"!:\resource\UPnPFileTransferEngineResources.rsc" - -;UPnP AIW Provider -"\epoc32\release\armv5\urel\upnpaiwprovider.dll"-"!:\sys\bin\upnpaiwprovider.dll" -"\epoc32\data\Z\resource\plugins\upnpaiwprovider.rsc"-"!:\resource\plugins\upnpaiwprovider.rsc" -"\epoc32\data\Z\resource\UPnPAiwEngineResources.rsc"-"!:\resource\UPnPAiwEngineResources.rsc" -"\epoc32\data\Z\resource\UPnPAiwMenuResources.rsc"-"!:\resource\UPnPAiwMenuResources.rsc" - -;UPnP Command -"\epoc32\release\armv5\urel\upnpcommand.dll"-"!:\sys\bin\upnpcommand.dll" -"\epoc32\data\Z\resource\upnpcommandresources.rsc"-"!:\resource\upnpcommandresources.rsc" -"\epoc32\release\armv5\urel\upnpcommandplugin.dll"-"!:\sys\bin\upnpcommandplugin.dll" -"\epoc32\data\Z\resource\plugins\upnpcommandplugin.rsc"-"!:\resource\plugins\upnpcommandplugin.rsc" - -;UPnP Sharing Application Engine -"\epoc32\release\armv5\urel\upnpapplicationengine.dll"-"!:\sys\bin\upnpapplicationengine.dll" -"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_jpeg_lrg.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_lrg.jpg" -"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_jpeg_sm.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_sm.jpg" -"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_png_lrg.png"-"!:\system\apps\upnp\upnp_ms_png_lrg.png" -"\epoc32\release\armv5\urel\z\system\apps\upnp\upnp_ms_png_sm.png"-"!:\system\apps\upnp\upnp_ms_png_sm.png" - -;UPnP Settings UI -"\epoc32\release\armv5\urel\upnpmultiselectionui.dll"-"!:\sys\bin\upnpmultiselectionui.dll" -"\epoc32\data\Z\resource\CUPnPMultiselectionUi.RSC"-"!:\resource\CUPnPMultiselectionUi.RSC" -"\epoc32\release\armv5\urel\upnpsharingui.dll"-"!:\sys\bin\upnpsharingui.dll" -"\epoc32\data\Z\resource\upnpsharingui.rsc"-"!:\resource\upnpsharingui.rsc" - - - -;UPnP Wizard -"\epoc32\release\armv5\urel\upnpappwizard.dll"-"!:\sys\bin\upnpappwizard.dll" -"\epoc32\data\Z\resource\cupnpappwizard.rsc"-"!:\resource\cupnpappwizard.rsc" - -;UPnP content sharing server -"\epoc32\release\armv5\urel\upnpcontentserver.exe"-"!:\sys\bin\upnpcontentserver.exe" -"\epoc32\release\armv5\urel\upnpcontentserverclient.dll"-"!:\sys\bin\upnpcontentserverclient.dll" - -;DLNA Profiler -"\epoc32\release\armv5\urel\dlnaprofiler.dll"-"!:\sys\bin\dlnaprofiler.dll" - -;UPnP XML Parser -"\epoc32\release\armv5\urel\upnpxmlparser.dll"-"!:\sys\bin\upnpxmlparser.dll" - - -;UPnP Playback plugins -"\epoc32\release\armv5\urel\upnpplaybackplugins.dll"-"!:\sys\bin\upnpplaybackplugins.dll" -"\epoc32\data\Z\resource\plugins\upnpplaybackplugins.rsc"-"!:\resource\plugins\upnpplaybackplugins.rsc" - -;UPnP Gs plugins -"\epoc32\release\armv5\urel\upnpgsplugin.dll"-"!:\sys\bin\upnpgsplugin.dll" -"\epoc32\data\Z\resource\upnpgspluginrsc.rsc"-"!:\resource\upnpgspluginrsc.rsc" -"\epoc32\data\Z\resource\apps\upnpgspluginrsc.mif"-"!:\resource\apps\upnpgspluginrsc.mif" -"\epoc32\data\Z\resource\plugins\upnpgsplugin.rsc"-"!:\resource\plugins\upnpgsplugin.rsc" - - -; cenrtral repository -;@"cenrep.sisx", (0x10202BE9) - -; End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/upnpframework_stub.pkg --- a/upnpframework/install/upnpframework_stub.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -; -; Copyright (c) 2006-2007 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: pkg file for upnp framework stubs -; - - -; upnpframework_stub.pkg -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"UPnPFramework"},(0x10006CCA),1,1,0, TYPE=SA - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/upnpframework_stub.sis Binary file upnpframework/install/upnpframework_stub.sis has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/install/upnpframework_udeb.pkg --- a/upnpframework/install/upnpframework_udeb.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -; -; Copyright (c) 2006-2007 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: pkg file for udeb version of upnp framework -; - - -; upnpframework_udeb.pkg -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"UPnPFramework"},(0x10006CCA),1,0,0, TYPE=SA, RU - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; UpnpSettings -"\epoc32\release\armv5\udeb\upnpsettingsengine.dll"-"!:\sys\bin\upnpsettingsengine.dll" - -;UPnP utilities -"\epoc32\release\armv5\udeb\upnputilities.dll"-"!:\sys\bin\upnputilities.dll" - -; UPnP (Home Media) Extension Plugin interface -"\epoc32\release\armv5\udeb\upnpextensionpluginif.dll"-"!:\sys\bin\upnpextensionpluginif.dll" - -;UPnP AV Controller -"\epoc32\release\armv5\udeb\upnpavcontrollerclient.dll"-"!:\sys\bin\upnpavcontrollerclient.dll" -"\epoc32\release\armv5\udeb\upnpavcontrollerserver.exe"-"!:\sys\bin\upnpavcontrollerserver.exe" -"\epoc32\release\armv5\udeb\upnpavcontrollerhelper.dll"-"!:\sys\bin\upnpavcontrollerhelper.dll" - -;UPnP Security -"\epoc32\release\armv5\udeb\upnpsecuritymanagerclient.dll"-"!:\sys\bin\upnpsecuritymanagerclient.dll" -"\epoc32\release\armv5\udeb\upnpsecuritymanagerserver.exe"-"!:\sys\bin\upnpsecuritymanagerserver.exe" -"\epoc32\data\Z\resource\UPnPNotifier.RSC"-"!:\resource\UPnPNotifier.RSC" -"\epoc32\release\armv5\udeb\upnpsecurity.dll"-"!:\sys\bin\upnpsecurity.dll" -"\epoc32\release\armv5\udeb\upnpsecuritymanagerplugin.dll"-"!:\sys\bin\upnpsecuritymanagerplugin.dll" -"\epoc32\data\Z\resource\plugins\upnpsecuritymanagerplugin.rsc"-"!:\resource\plugins\upnpsecuritymanagerplugin.rsc" - -;UPnP musicadapter -"\epoc32\release\armv5\udeb\upnpmusicadapter.dll"-"!:\sys\bin\upnpmusicadapter.dll" - -;UPnP CommonUI -"\epoc32\release\armv5\udeb\UPnPCommonUI.dll"-"!:\sys\bin\UPnPCommonUI.dll" -"\epoc32\data\Z\resource\apps\upnpcommonui.mif"-"!:\resource\apps\upnpcommonui.mif" -"\epoc32\data\Z\resource\UPnPCommonUI.rsc"-"!:\resource\UPnPCommonUI.rsc" - -;UPnP AIW Engine -"\epoc32\release\armv5\udeb\upnpaiwengine.dll"-"!:\sys\bin\upnpaiwengine.dll" - -;UPnP File Transfer Engine -"\epoc32\release\armv5\udeb\upnpfiletransferengine.dll"-"!:\sys\bin\upnpfiletransferengine.dll" -"\epoc32\data\Z\resource\UPnPFileTransferEngineResources.rsc"-"!:\resource\UPnPFileTransferEngineResources.rsc" - -;UPnP AIW Provider -"\epoc32\release\armv5\udeb\upnpaiwprovider.dll"-"!:\sys\bin\upnpaiwprovider.dll" -"\epoc32\data\Z\resource\plugins\upnpaiwprovider.rsc"-"!:\resource\plugins\upnpaiwprovider.rsc" -"\epoc32\data\Z\resource\UPnPAiwEngineResources.rsc"-"!:\resource\UPnPAiwEngineResources.rsc" -"\epoc32\data\Z\resource\UPnPAiwMenuResources.rsc"-"!:\resource\UPnPAiwMenuResources.rsc" - -;UPnP Command -"\epoc32\release\armv5\udeb\upnpcommand.dll"-"!:\sys\bin\upnpcommand.dll" -"\epoc32\data\Z\resource\upnpcommandresources.rsc"-"!:\resource\upnpcommandresources.rsc" -"\epoc32\release\armv5\udeb\upnpcommandplugin.dll"-"!:\sys\bin\upnpcommandplugin.dll" -"\epoc32\data\Z\resource\plugins\upnpcommandplugin.rsc"-"!:\resource\plugins\upnpcommandplugin.rsc" - -;UPnP Sharing Application Engine -"\epoc32\release\armv5\udeb\upnpapplicationengine.dll"-"!:\sys\bin\upnpapplicationengine.dll" -"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_jpeg_lrg.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_lrg.jpg" -"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_jpeg_sm.jpg"-"!:\system\apps\upnp\upnp_ms_jpeg_sm.jpg" -"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_png_lrg.png"-"!:\system\apps\upnp\upnp_ms_png_lrg.png" -"\epoc32\release\armv5\udeb\z\system\apps\upnp\upnp_ms_png_sm.png"-"!:\system\apps\upnp\upnp_ms_png_sm.png" - -;UPnP Settings UI -"\epoc32\release\armv5\udeb\upnpmultiselectionui.dll"-"!:\sys\bin\upnpmultiselectionui.dll" -"\epoc32\data\Z\resource\CUPnPMultiselectionUi.RSC"-"!:\resource\CUPnPMultiselectionUi.RSC" -"\epoc32\release\armv5\udeb\upnpsharingui.dll"-"!:\sys\bin\upnpsharingui.dll" -"\epoc32\data\Z\resource\upnpsharingui.rsc"-"!:\resource\upnpsharingui.rsc" - -;UPnP Wizard -"\epoc32\release\armv5\udeb\upnpappwizard.dll"-"!:\sys\bin\upnpappwizard.dll" -"\epoc32\data\Z\resource\cupnpappwizard.rsc"-"!:\resource\cupnpappwizard.rsc" - -;UPnP content sharing server -"\epoc32\release\armv5\udeb\upnpcontentserver.exe"-"!:\sys\bin\upnpcontentserver.exe" -"\epoc32\release\armv5\udeb\upnpcontentserverclient.dll"-"!:\sys\bin\upnpcontentserverclient.dll" - -;DLNA Profiler -"\epoc32\release\armv5\udeb\dlnaprofiler.dll"-"!:\sys\bin\dlnaprofiler.dll" - -;UPnP XML Parser -"\epoc32\release\armv5\udeb\upnpxmlparser.dll"-"!:\sys\bin\upnpxmlparser.dll" - -;UPnP Playback plugins -"\epoc32\release\armv5\udeb\upnpplaybackplugins.dll"-"!:\sys\bin\upnpplaybackplugins.dll" -"\epoc32\data\Z\resource\plugins\upnpplaybackplugins.rsc"-"!:\resource\plugins\upnpplaybackplugins.rsc" - -; cenrtral repository -;@"cenrep.sisx", (0x10202BE9) - -; End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/rom/bld.inf --- a/upnpframework/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2006-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: Exports for upnpframework -* -*/ - - -// For compatibility with S60 3.2 and IAD branch -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// ROM build -upnpframework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpframework.iby) -upnpframeworkresources.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpframeworkresources.iby) -// LOC files -UPNP_LOC_EXPORT(upnpframework.loc) -// IAD support -../install/20009cae.cre /epoc32/release/arm5/urel/z/private/20009cae.cre -../install/20007564.cre /epoc32/release/arm5/urel/z/private/20007564.cre -../install/upnpframework_stub.sis /epoc32/data/z/system/install/upnpframework_stub.sis -// upnpframework common headers -../inc/upnpframeworkfeatures_mmp.hrh |../../inc/upnpframeworkfeatures_mmp.hrh -../inc/upnplogging.h |../../inc/upnplogging.h -../inc/upnppanic.h |../../inc/upnppanic.h -../inc/upnplog.h |../../inc/upnplog.h - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/rom/upnpframework.iby --- a/upnpframework/rom/upnpframework.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2006-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: upnpframework subsystem ROM include file -* -*/ - -#ifndef __UPNPFRAMEWORK_IBY__ -#define __UPNPFRAMEWORK_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // UPNP utilities - file=ABI_DIR\BUILD_DIR\upnputilities.dll \sys\bin\upnputilities.dll - - - // UPNP (Home Media) Extension plugin interface - file=ABI_DIR\BUILD_DIR\upnpextensionpluginif.dll \sys\bin\upnpextensionpluginif.dll - - // musicadapter - file=ABI_DIR\BUILD_DIR\upnpmusicadapter.dll \sys\bin\upnpmusicadapter.dll - - // CommonUI - file=ABI_DIR\BUILD_DIR\upnpcommonui.dll \sys\bin\UPnPCommonUI.dll - data=DATAZ_\resource\apps\upnpcommonui.mif \resource\apps\upnpcommonui.mif - - // UPnP AIW Engine - file=ABI_DIR\BUILD_DIR\upnpaiwengine.dll \sys\bin\upnpaiwengine.dll - - // UPnP AIW Provider (AIW Provider) - ECOM_PLUGIN(upnpaiwprovider.dll,upnpaiwprovider.rsc) - - // UPnP File Transfer Engine - file=ABI_DIR\BUILD_DIR\upnpfiletransferengine.dll \sys\bin\upnpfiletransferengine.dll - - // UpnpCommand ECom plugin - ECOM_PLUGIN( upnpcommandplugin.dll, upnpcommandplugin.rsc ) - -#endif // FF_UPNP_FRAMEWORK_2_0 - - // UPnPCommand static linked library - file=ABI_DIR\BUILD_DIR\upnpcommand.dll \sys\bin\upnpcommand.dll - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // The stub sis file - data=ZSYSTEM\install\upnpframework_stub.sis system\install\upnpframework_stub.sis - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPFRAMEWORK_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/rom/upnpframeworkresources.iby --- a/upnpframework/rom/upnpframeworkresources.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2006-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: includes binaries for rombuild -* -*/ - -#ifndef __UPNPFRAMEWORKRESOURCES_IBY__ -#define __UPNPFRAMEWORKRESOURCES_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // Common UI - data=DATAZ_\resource\UPnPCommonUI.rsc \resource\UPnPCommonUI.rsc - - // AIW provider - data=DATAZ_\resource\UPnPAiwEngineResources.RSC \resource\UPnPAiwEngineResources.rsc - data=DATAZ_\resource\UPnPAiwMenuResources.rsc \resource\UPnPAiwMenuResources.rsc - - // UpnpCommand - data=DATAZ_\resource\upnpcommandresources.RSC \resource\upnpcommandresources.rsc - - // File transfer engine - data=DATAZ_\resource\UPnPFileTransferEngineResources.rsc \resource\UPnPFileTransferEngineResources.rsc - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPFRAMEWORKRESOURCES_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/bwins/upnpaiwengineU.DEF --- a/upnpframework/upnpaiwengine/bwins/upnpaiwengineU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - ?CopyPlaylistToExternalL@CUPnPAiwEngine@@QAEXABVTDesC16@@AAV?$RPointerArray@VTDesC16@@@@@Z @ 1 NONAME ; void CUPnPAiwEngine::CopyPlaylistToExternalL(class TDesC16 const &, class RPointerArray &) - ?CopyToExternalL@CUPnPAiwEngine@@QAEXAAV?$RPointerArray@VTDesC16@@@@@Z @ 2 NONAME ; void CUPnPAiwEngine::CopyToExternalL(class RPointerArray &) - ?DisableExternal@CUPnPAiwEngine@@QAEXXZ @ 3 NONAME ; void CUPnPAiwEngine::DisableExternal(void) - ?EnableExternalL@CUPnPAiwEngine@@QAEXXZ @ 4 NONAME ; void CUPnPAiwEngine::EnableExternalL(void) - ?EngineState@CUPnPAiwEngine@@QAE?AW4TUPnPEngineState@@XZ @ 5 NONAME ; enum TUPnPEngineState CUPnPAiwEngine::EngineState(void) - ?FilterDrmL@CUpnpDrmFilter@@QAEXXZ @ 6 NONAME ; void CUpnpDrmFilter::FilterDrmL(void) - ?MoveToExternalL@CUPnPAiwEngine@@QAEXAAV?$RPointerArray@VTDesC16@@@@@Z @ 7 NONAME ; void CUPnPAiwEngine::MoveToExternalL(class RPointerArray &) - ?NewL@CUPnPAiwEngine@@SAPAV1@XZ @ 8 NONAME ; class CUPnPAiwEngine * CUPnPAiwEngine::NewL(void) - ?NewL@CUpnpDrmFilter@@SAPAV1@AAV?$RPointerArray@VTDesC16@@@@0@Z @ 9 NONAME ; class CUpnpDrmFilter * CUpnpDrmFilter::NewL(class RPointerArray &, class RPointerArray &) - ?OpenExternalMediaL@CUPnPAiwEngine@@QAEXXZ @ 10 NONAME ; void CUPnPAiwEngine::OpenExternalMediaL(void) - ?PlayL@CUPnPAiwEngine@@QAEXABVTDesC16@@@Z @ 11 NONAME ; void CUPnPAiwEngine::PlayL(class TDesC16 const &) - ?ReleaseInstance@CUPnPAiwEngine@@SAXXZ @ 12 NONAME ; void CUPnPAiwEngine::ReleaseInstance(void) - ?RemoveEngineObserver@CUPnPAiwEngine@@QAEXXZ @ 13 NONAME ; void CUPnPAiwEngine::RemoveEngineObserver(void) - ?SetEngineObserver@CUPnPAiwEngine@@QAEXPAVMUPnPAiwEngineObserver@@@Z @ 14 NONAME ; void CUPnPAiwEngine::SetEngineObserver(class MUPnPAiwEngineObserver *) - ?ShowConnectionErrorL@CUPnPAiwEngine@@QAEXXZ @ 15 NONAME ; void CUPnPAiwEngine::ShowConnectionErrorL(void) - ?TimerCallback@CUPnPAiwEngine@@UAEXXZ @ 16 NONAME ; void CUPnPAiwEngine::TimerCallback(void) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/data/upnpaiwengineresources.rss --- a/upnpframework/upnpaiwengine/data/upnpaiwengineresources.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Resource definitions for project UpnpAiwEngine -* -*/ - - -NAME UPAE - -// INCLUDES -#include -#include -#include -#include -#include -#include // For "Processing" wait note. -#include - -// RESOURCE IDENTIFIERS - -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF { buf=""; } - -// -------------------------------------------------------------------------- -// R_AIW_DRM_SKIP_INFO_NOTE -// "Skipping DRM protected files." - note -// Used to indicate that DRM protected files will be skipped. -// -------------------------------------------------------------------------- -// -RESOURCE DIALOG r_aiw_drm_skip_info_note - { - flags = EAknInformationNoteFlags | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EGeneralLayout; - singular_label = qtn_iupnp_drm_file_text; - imageid = EMbmAvkonQgn_note_info; - imagemask = EMbmAvkonQgn_note_info_mask; - animation = R_QGN_NOTE_INFO_ANIM; - }; - } - }; - } - -// -------------------------------------------------------------------------- -// R_AIW_ENABLE_SHARING_WAIT_NOTE -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_aiw_enable_sharing_wait_note - { - flags = EAknWaitNoteFlags | EEikDialogFlagWait; - buttons=R_AVKON_SOFTKEYS_CANCEL; - items= - { - DLG_LINE - { - type=EAknCtNote; - id=EGeneralNote; - control=AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_iupnp_command_prep_playback; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -// --------------------------------------------------------------------------- -// R_AIW_DRM_FILTERING_WAIT_NOTE -// --------------------------------------------------------------------------- -RESOURCE DIALOG r_aiw_drm_filtering_wait_note - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_gen_note_processing; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -// -------------------------------------------------------------------------- -// r_aiw_info_copy_ext_one_text -// Note shown when one file has been copied to extenal server device. -// -------------------------------------------------------------------------- -RESOURCE TBUF r_aiw_info_copy_ext_one_text - { - buf = qtn_iupnp_info_copy_ext_one; - } - -// -------------------------------------------------------------------------- -// r_aiw_info_copy_ext_many_text -// Note shown when many files have been copied to extenal server device. -// -------------------------------------------------------------------------- -RESOURCE TBUF r_aiw_info_copy_ext_many_text - { - buf = qtn_iupnp_info_copy_ext_many; - } - -// -------------------------------------------------------------------------- -// r_aiw_info_move_ext_one_text -// Note shown when one file has been moved to extenal server device. -// -------------------------------------------------------------------------- -RESOURCE TBUF r_aiw_info_move_ext_one_text - { - buf = qtn_iupnp_info_move_ext_one; - } - -// -------------------------------------------------------------------------- -// r_aiw_info_move_ext_many_text -// Note shown when many files have been copied to extenal server device. -// -------------------------------------------------------------------------- -RESOURCE TBUF r_aiw_info_move_ext_many_text - { - buf = qtn_iupnp_info_move_ext_many; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/eabi/upnpaiwengineU.DEF --- a/upnpframework/upnpaiwengine/eabi/upnpaiwengineU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -EXPORTS - _ZN14CUPnPAiwEngine11EngineStateEv @ 1 NONAME - _ZN14CUPnPAiwEngine13TimerCallbackEv @ 2 NONAME - _ZN14CUPnPAiwEngine15CopyToExternalLER13RPointerArrayI7TDesC16E @ 3 NONAME - _ZN14CUPnPAiwEngine15DisableExternalEv @ 4 NONAME - _ZN14CUPnPAiwEngine15EnableExternalLEv @ 5 NONAME - _ZN14CUPnPAiwEngine15MoveToExternalLER13RPointerArrayI7TDesC16E @ 6 NONAME - _ZN14CUPnPAiwEngine15ReleaseInstanceEv @ 7 NONAME - _ZN14CUPnPAiwEngine17SetEngineObserverEP22MUPnPAiwEngineObserver @ 8 NONAME - _ZN14CUPnPAiwEngine18OpenExternalMediaLEv @ 9 NONAME - _ZN14CUPnPAiwEngine20RemoveEngineObserverEv @ 10 NONAME - _ZN14CUPnPAiwEngine20ShowConnectionErrorLEv @ 11 NONAME - _ZN14CUPnPAiwEngine23CopyPlaylistToExternalLERK7TDesC16R13RPointerArrayIS0_E @ 12 NONAME - _ZN14CUPnPAiwEngine4NewLEv @ 13 NONAME - _ZN14CUPnPAiwEngine5PlayLERK7TDesC16 @ 14 NONAME - _ZN14CUpnpDrmFilter10FilterDrmLEv @ 15 NONAME - _ZN14CUpnpDrmFilter4NewLER13RPointerArrayI7TDesC16ES3_ @ 16 NONAME - _ZTI13CUPnPAiwTimer @ 17 NONAME ; ## - _ZTI14CUPnPAiwEngine @ 18 NONAME ; ## - _ZTI14CUpnpDrmFilter @ 19 NONAME ; ## - _ZTV13CUPnPAiwTimer @ 20 NONAME ; ## - _ZTV14CUPnPAiwEngine @ 21 NONAME ; ## - _ZTV14CUpnpDrmFilter @ 22 NONAME ; ## - _ZThn8_N14CUPnPAiwEngine13TimerCallbackEv @ 23 NONAME ; ## diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/group/bld.inf --- a/upnpframework/upnpaiwengine/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2005-2007 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 information file for project UpnpAiwEngine -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// None - -PRJ_MMPFILES -upnpaiwengine.mmp - -PRJ_TESTMMPFILES -// None - -PRJ_TESTEXPORTS -// None - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/group/upnpaiwengine.mmp --- a/upnpframework/upnpaiwengine/group/upnpaiwengine.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2005-2007 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 project UpnpAiwEngine -* -*/ - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" -#include -#include "../inc/upnpaiwengineuids.hrh" - -// Build target -TARGET upnpaiwengine.dll -CAPABILITY CAP_GENERAL_DLL -TARGETTYPE DLL -UID 0x10009D8D KUPnPAiwEngineDllUid -VENDORID VID_DEFAULT - -// SIS installation + IAD support -VERSION 10.1 -paged - -SOURCEPATH ../data -START RESOURCE upnpaiwengineresources.rss -HEADER -TARGET upnpaiwengineresources.rsc -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -USERINCLUDE ../../../inc -USERINCLUDE ../../inc -USERINCLUDE ../inc -USERINCLUDE ../data -USERINCLUDE ../../upnputilities/inc - -MW_LAYER_SYSTEMINCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT - -SOURCEPATH ../src -SOURCE upnpaiwtimer.cpp -SOURCE upnpaiwengine.cpp -SOURCE upnpdrmfilter.cpp - -// Core -LIBRARY euser.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY efsrv.lib -LIBRARY charconv.lib // For Unicode -LIBRARY CommonEngine.lib // For StringLoader - -// UPnP -LIBRARY upnpavobjects.lib -LIBRARY upnpavcontrollerclient.lib -LIBRARY upnpavcontrollerhelper.lib -LIBRARY upnpcommonui.lib -LIBRARY upnpipserversutils.lib -LIBRARY upnpfiletransferengine.lib - -// Dialogs -LIBRARY avkon.lib - -// UPnP Utilities -LIBRARY upnputilities.lib - -// DRM -LIBRARY drmcommon.lib - -// MIME -LIBRARY apgrfx.lib -LIBRARY apmime.lib - -// commDB -LIBRARY commdb.lib - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/inc/upnpaiwengine.h --- a/upnpframework/upnpaiwengine/inc/upnpaiwengine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,583 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the CUPnPAiwEngine class. -* -*/ - - -#ifndef UPNP_AIW_ENGINE_H -#define UPNP_AIW_ENGINE_H - -// INCLUDES -// System -#include -#include - -// avcontroller api -#include "upnpavrenderingsessionobserver.h" -#include "upnpavdeviceobserver.h" -#include "upnpitemresolverobserver.h" - -// upnpframework / internal api's -#include "upnpcommonui.h" - -// aiwengine internal -#include "upnpaiwengineobserver.h" -#include "upnpaiwtimerobserver.h" - - -// ENUMERATIONS -enum TUPnPEngineState - { - EUPnPEngineNotConnected = 1, - EUPnPEngineConnectionLost, - EUPnPEngineConnected, - EUPnPEngineActive, - EUPnPEngineBrowsingHomeNetwork - }; - -enum TUPnPAiwEngineDeviceType - { - EUPnPAiwEngineTargetDeviceWithAudioSupport = 1, - EUPnPAiwEngineTargetDeviceWithImageAndVideoSupport, - EUPnPAiwEngineTargetDeviceWithImageSupport - }; - -enum TUPnPAiwEngineTransferMode - { - EAiwEngineCopy = 0, - EAiwEngineCopyPlaylist, - EAiwEngineMove - }; - -// FORWARD DECLARATIONS -class CAknWaitDialog; -class CUPnPAiwTimer; -class MUPnPAVController; -class MUPnPAVRenderingSession; -class MUPnPAVSessionBase; - -// CLASS DECLARATION - -/** -* CUPnPAiwEngine -* The class works as an engine component between the UPnP AIW, UPnP Common -* UI components and UPnPAVController components. -* @since S60 3.0 -*/ -class CUPnPAiwEngine : public CBase, - public MUPnPAVRenderingSessionObserver, - public MUPnPAiwTimerObserver, - public MProgressDialogCallback, - public MUPnPAVDeviceObserver, - public MUPnPItemResolverObserver - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CUPnPAiwEngine* NewL(); - - /** - * Releases the instance. - * - * @since S60 3.0 - */ - IMPORT_C static void ReleaseInstance(); - - /** - * Destructor. - */ - virtual ~CUPnPAiwEngine(); - - public: // Methods from MUPnPAVDeviceObserver - - // Unnecessary callback methods - void UPnPDeviceDiscovered( const CUpnpAVDevice& /*aDevice*/ ) {} - void UPnPDeviceDisappeared (const CUpnpAVDevice& /*aDevice*/ ) {} - - /** - * Notifies that the WLAN connection has been lost. All sessions - * are now usable and must be closed. - * - * @since Series 60 3.1 - * @return None - */ - void WLANConnectionLost(); - - public: // UPnP Aiw Engine call back - - /** - * Sets the observer instance. - * - * @since S60 3.0 - * @param aObserver (MUPnPAiwEngineObserver*) observer instance - */ - IMPORT_C void SetEngineObserver( MUPnPAiwEngineObserver* aObserver ); - - /** - * Removes the observer instance. - * - * @since S60 3.0 - */ - IMPORT_C void RemoveEngineObserver(); - - public: - - /** - * Returns the state of the UPnP AIW Engine. - * - * @since S60 3.0 - * @return TUPnPEngineState State of the engine - */ - IMPORT_C TUPnPEngineState EngineState(); - - /** - * Opens the External media UI. - * - * Leaves if the UpnpAiwEngine is already in use, if the - * UpnpAvController instantiation fails, or if the device selection/ - * browse dialog leaves. - * - * @since S60 3.0 - */ - IMPORT_C void OpenExternalMediaL(); - - /** - * Enables the showing of local media files on a remote renderer - * device. - * - * Leaves if the UpnpAiwEngine is already in use, if the - * UpnpAvController instantiation fails, or if the device selection - * dialog leaves. - * - * @since S60 3.0 - */ - IMPORT_C void EnableExternalL(); - - /** - * Disables the showing of local media files on remote renderer - * device. - * - * @since S60 3.0 - */ - IMPORT_C void DisableExternal(); - - /** - * Copies local files to a remote media server. - * - * @since S60 3.0 - * @param aFileNames (RPointerArray&) Reference to an array - * of TDesC objects containing the list of file names. All - * files that are successfully copied are removed from the - * list. - */ - IMPORT_C void CopyToExternalL( RPointerArray& aFileNames ); - - /** - * Copies a local playlist to a remote media server. - * - * @since S60 3.0 - * @param aFileNames (RPointerArray&) Reference to an array - * of TDesC objects containing the list of file names. All - * files that are successfully copied are removed from the - * list. - * @param aPlaylistName (const TDesC&) name of the playlist - */ - IMPORT_C void CopyPlaylistToExternalL( - const TDesC& aPlaylistName, - RPointerArray& aFileNames ); - - /** - * Moves local files to a remote media server. - * - * @since S60 3.0 - * @param aFileNames (RPointerArray&) Reference to an array - * of TDesC objects containing the list of file names. All - * files that are successfully moved removed from the list. - */ - IMPORT_C void MoveToExternalL( RPointerArray& aFileNames ); - - /** - * Plays (sends for rendering) local media file using the selected - * UPnP Media renderer. Only image and video files are supported - * after Upnp Fw 2.0. - * - * Leaves if the given filename is not valid, file is not a media - * file, if the UpnpAiwEngine is not ready (enable external to done), - * or if the bearer or remote upnp device is lost. - * - * @since S60 3.0 - * @param aFileName (const TDesC&) reference to the file name of - * the media file. - */ - IMPORT_C void PlayL( const TDesC& aFileName ); - - /** - * Displays connection error if creating of control point fails. - * - * @since S60 3.1 - */ - IMPORT_C void ShowConnectionErrorL(); - - public: // Methods to update the singleton reference counter - - /** - * Sets the initial value of the user counter to zero. - * - * @since S60 3.0 - */ - void InitialiseUserCounter(); - - /** - * Increases the value of the user counter. - * - * @since S60 3.0 - */ - void IncreaseUserCounter(); - - /** - * Decreases the value of the user counter. - * - * @since S60 3.0 - */ - void DecreaseUserCounter(); - - /** - * Gets the value of the user counter. - * - * @since S60 3.0 - * @return TInt - */ - TInt UserCounter() const; - - /** - * Displays connection lost error if copying files fails. - * - * @since S60 3.2.3 - */ - void ShowConnectionLostCopyErrorL(); - - private: - - /** - * Transfers (copies/moves) local files/playlist to a remote media - * server. - * - * Leaves if the given parameters are not valid, if the UpnpAiwEngine - * is already in use, if user cancels the operation, or if the bearer - * or remote upnp device is lost. - * - * @since S60 3.0 - * @param aMode (TUPnPAiwEngineTransferMode) transfer mode - * @param aFileNames (RPointerArray&) Reference to an array - * of TDesC objects containing the list of file names. All - * files that are successfully copied are removed from the - * list. - * @param aPlaylistName (const TDesC&) name of the playlist - */ - void TransferToExternalL( TUPnPAiwEngineTransferMode aMode, - RPointerArray& aFilePaths, - const TDesC& aPlaylistName ); - - /** - * Starts a rendering session with UpnpAvController. Queries the - * target rendering device. - * - * Leaves if any instantiation fails or used cancels the device - * selection. - * - * @since S60 3.0 - * @param aDeviceType (TUPnPAiwEngineDeviceType) type of the device - */ - void StartRenderingSessionL( TUPnPAiwEngineDeviceType aDeviceType ); - - /** - * Handles the UPnP device disappeared call back method. - * - * @since S60 3.0 - * @param aDevice (const CUpnpAVDevice&) pointer to the device info - */ - void HandleUPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice ); - - /** - * Waits for local media server file sharing activation (or user - * cancel). - * - * @since S60 3.1 - * @param aSession (MUPnPAVSessionBase*) pointer to the AVController - * session. - */ - void StartLocalFileSharingL( MUPnPAVSessionBase *aSession ); - - public: // Call back methods of MUPnPAVRenderingSessionObserver - - // Unused callback methods - void VolumeResult( TInt /*aError*/, - TInt /*aVolumeLevel*/, - TBool /*aActionResponse*/ ) {} - void MuteResult( TInt /*aError*/, - TBool /*aMute*/, - TBool /*aActionResponse*/ ) {} - void PositionInfoResult( TInt /*aError*/, - const TDesC8& /*aTrackPosition*/, - const TDesC8& /*aTrackLength*/ ) {} - void SetNextURIResult( TInt /*aError*/ ) {} - - /** - * UPnP AV Controller calls this method to indicate that the requested - * interaction operation (play, stop, etc.) is complete. In other - * words, the target rendering device has changed it's state - * accordingly. - * - * @since Series 60 3.1 - * @param aError (TInt) error code - * @param aOperation (TAVInteractOperation) operation Id - */ - void InteractOperationComplete( TInt aError, - TUPnPAVInteractOperation aOperation ); - - /** - * UPnP AV Controller calls this method as a response to SetUri - * action. - * - * @since Series 60 3.1 - * @param aError (TInt) error code - */ - void SetURIResult( TInt aError ); - - /** - * Notifies that the Media Renderer we have a session with has - * disappeared. Session is now unusable and must be closed. - * - * @since Series 60 3.1 - * @param aReason (TUPnPDeviceDisconnectedReason) reason code - */ - void MediaRendererDisappeared( - TUPnPDeviceDisconnectedReason aReason ); - - public: // Call back methods of MUPnPAVSessionObserverBase - - /** - * Notifies that the Media Server startup has completed. - * - * @since Series 60 3.1 - * @return aError (TInt) error code - */ - void ReserveLocalMSServicesCompleted( TInt aError ); - - public: // Call back methods of MAknProgressDialogCallback - - /** - * ProgressDialog call back method. - * Get's called when a dialog is dismissed. - * - * @since S60 3.0 - * @param aButtonId (TInt) ID of the button pressed - */ - void DialogDismissedL( TInt aButtonId ); - - public: // Timer related methods - - /** - * Starts the UPnPAiWTimer. - * - * @since S60 3.0 - */ - void StartTimer(); - - /** - * Stops the UPnPAiWTimer. - * - * @since S60 3.0 - */ - void StopTimer(); - - /** - * Callback method for the UPnPAiwTimer. - * - * @since S60 3.0 - */ - void TimerCallback(); - - private: // Helper methods - - /** - * Method for selecting a device. - * - * Leaves if the engine is not ready (UpnpAvController not - * instantiated), if the user cancels the operation, or if the bearer - * is lost during the device selection. - * - * @since S60 3.1 - * @param aDeviceType (TUPnPDeviceTypesToSearch) type of device - * @param aDlgTitle title used in device selection dialog - * @return CUpnpAVDevice* selected upnp av device. - */ - CUpnpAVDevice* SelectDeviceL( - TUPnPDeviceTypesToSearch aDeviceType, - TUPnPDialogTitle aDlgTitle ); - - /** - * Method for releasing upnp resource. - * - * @since S60 3.1 - * @param none - * @return none - */ - void ReleaseUpnpResourceL(); - - /** - * Method for playing a local file - * - * @since S60 3.1 - * @param none - * @return none - */ - void InitPlayL(); - - /** - * Method for playing a local video - * - * @since S60 3.1 - * @param aFilePath file path - * @return none - */ - void StartVideoPlayL( const TDesC& aFileName ); - - /** - * Shows info note after the file transfer has been completed. - * - * @since S60 5.1 - * @param aMode Type of file transfer (copy or move) - * @param aCount Number of files copied to server - * @param aDevice Device files were copied to - * @return none - */ - void ShowTransferInfoNoteL( - TUPnPAiwEngineTransferMode aMode, - TInt aCount, - const CUpnpAVDevice& aServerName ) const; - - /** - * creates upnpitem using helper resolve local item - * - * @since S60 5.1 - * @param aFileName - */ - void CreateUpnpItemAndSetUriL( const TDesC& aFileName ); - - /** - * Helper method to create MUPnPItemResolver. - * - * @since S60 5.1 - * @param aFilePath file path - * @return Pointer to resolver instance that is put to cleanupstack. - */ - MUPnPItemResolver* CreateResolverLC( const TDesC& aFilePath ); - - /** - * Static cleanup function for MUPnPItemResolver. - * Method makes sure that MUPnPItemResolver is properly cleaned up. - * - * @since S60 5.1 - * @param aResolver TAny pointer to CUPnPAiwEngine object. - */ - static void CleanupResolver( TAny* aAiwEngine ); - - /** - * starts asynchronous CActiveSchedulerWait - */ - void Wait(); - - /** - * stops asynchronous CActiveSchedulerWait - */ - void StopWait(); - - private: // Construction methods - - // Constructor - CUPnPAiwEngine(); - - /** - * ConstructL. - */ - void ConstructL(); - - private: // from MUPnPItemResolverObserver - - /** - * see MUPnPItemResolverObserver - */ - void ResolveComplete( - const MUPnPItemResolver& aResolver, - TInt aError ); - - private: // Data members - - // State of the engine - TUPnPEngineState iEngineState; - - // Reference to the AV Controller ECom plug-in - MUPnPAVController* iAVController; // owned - - // Reference to the AIW Provider instance - MUPnPAiwEngineObserver* iObserver; // not owned - - // File sharing activation wait note and related member vars - CAknWaitDialog* iFileSharingActivationWaitNote; // owned; - TBool iLocalFileSharingActivated; - TInt iFileSharingError; - - // CoeEnv and the resource offset (needed when loading and - // unloading resources) - CEikonEnv* iCoeEnv; // not owned - TInt iResFileOffset; - - // Wait note dialog - CAknWaitDialog* iWaitNoteDialog; // owned - - // Timer - CUPnPAiwTimer* iUPnPAiwTimer; // owned - - MUPnPAVRenderingSession* iRenderingSession; // owned - - CUPnPCommonUI* iCommonUI; //owned - HBufC16* iFileName; - - TBool iRenderingSessionInUse; - TBool iVideoPlay; - TBool iVideoPlayCancel; - TBool iVideoPlayWait; - private: // Singleton data members - - // Counter, which maintains the number of users of this singleton - TInt iNumberOfUsers; - - /** - * For async operations - */ - CActiveSchedulerWait iWait; - - MUPnPItemResolver* iResolver; - - TInt iResolveResult; - }; - -#endif // UPNP_AIW_ENGINE_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/inc/upnpaiwengine.rh --- a/upnpframework/upnpaiwengine/inc/upnpaiwengine.rh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Resource headers for project UpnpAiwEngine -* -*/ - - -#ifndef UPNP_AIW_ENGINE_RH -#define UPNP_AIW_ENGINE_RH - -// -------------------------------------------------------------------------- -// Enumeration for identifying the UPnPAiwEngine resources. -// -------------------------------------------------------------------------- -// -enum TUPnPAiwProviderResources - { - EUPnPAiwFileTransferProgressNote = 1, - EUPnPAiwWaitingNote - }; - -#endif // UPNP_AIW_ENGINE_RH - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/inc/upnpaiwengineobserver.h --- a/upnpframework/upnpaiwengine/inc/upnpaiwengineobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: This interface class defines the call back interface for the -* UpnpAiwEngine. -* -*/ - - -#ifndef UPNP_AIW_ENGINE_OBSERVER_H -#define UPNP_AIW_ENGINE_OBSERVER_H - -/** -* Defines the call back interface for the UPnP AIW Engine. -* -* @since S60 3.0 -*/ -class MUPnPAiwEngineObserver - { - - public: - - /** - * Indicates that the play operation is complete. - * - * @since S60 3.0 - * @param aStatus Status information - */ - virtual void PlayCompleteL( TInt aStatus ) = 0; - - /** - * Indicates that the connection with the target UPnP - * device has been lost. - * - * @since S60 3.0 - */ - virtual void ConnectionLostL() = 0; - - }; - -#endif // UPNP_AIW_ENGINE_OBSERVER_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/inc/upnpaiwengineuids.hrh --- a/upnpframework/upnpaiwengine/inc/upnpaiwengineuids.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Resource headers for project UpnpAiwEngine -* -*/ - - -#ifndef UPNP_AIW_ENGINE_UIDS_HRH -#define UPNP_AIW_ENGINE_UIDS_HRH - -#define KUPnPAiwEngineDllUid 0x10208A4D - -#endif // UPNP_AIW_ENGINE_UIDS_HRH - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/inc/upnpaiwtimer.h --- a/upnpframework/upnpaiwengine/inc/upnpaiwtimer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the CUPnPAIWTimer class. -* -*/ - - -#ifndef UPNP_AIW_TIMER_H -#define UPNP_AIW_TIMER_H - -// INCLUDES -#include -#include -#include -#include -#include "upnpaiwtimerobserver.h" - -// CLASS DECLARATION - -/** -* CUPnPAiWTimer class. -*/ -class CUPnPAiwTimer : public CBase, - public MBeating - { - - public: - - /** - * Static NewL method to construct the timer. - * - * @since S60 3.0 - * @param aInterval (TInt) Timer interval in seconds - * @param aCallback (MUPnPAiwTimerObserver*) call back reference - * @return CUPnPAVTimer* timer instance - */ - static CUPnPAiwTimer* NewL( TInt aInterval, - MUPnPAiwTimerObserver* aCallback ); - - // Destructor - virtual ~CUPnPAiwTimer(); - - private: - - /** - * ConstructL. - * - * @since S60 3.0 - * @param aInterval (TInt) Timer interval in seconds - * @param aCallback (MUPnPAiwTimerObserver*) call back reference - */ - void ConstructL( TInt aInterval, - MUPnPAiwTimerObserver* aCallback ); - - /** - * Constructor. - * - * @since S60 3.0 - */ - CUPnPAiwTimer(); - - private: // for MBeating - - /** - * Called when the beat is in sync. - * - * @since S60 3.0 - */ - void Beat(); - - /** - * Called when the beat needs to be syncronized. - * - * @since S60 3.0 - */ - void Synchronize(); - - private: // Data members - - // Heartbeat active object - CHeartbeat* iHeartbeat; // owned - - // Call back pointer - MUPnPAiwTimerObserver *iCallback; // not owned - - // Interval in seconds - TInt iInterval; - - // Heartbeat counter - TInt iCounter; - - }; - -#endif // UPNP_AIW_TIMER_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/inc/upnpaiwtimerobserver.h --- a/upnpframework/upnpaiwengine/inc/upnpaiwtimerobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: This interface class defines the call back interface for the -* UPnPAiwEngineTimer. -* -*/ - - -#ifndef UPNP_AIW_TIMER_OBSERVER_H -#define UPNP_AIW_TIMER_OBSERVER_H - -/** -* Defines the call back interface for the timer of the UPnP Aiw Engine. -* -* @since S60 3.0 -*/ -class MUPnPAiwTimerObserver - { - - public: - - /** - * Callback method for the UPnPAiWTimer. - * - * @since S60 3.0 - */ - virtual void TimerCallback() = 0; - - }; - -#endif // UPNP_AIW_TIMER_OBSERVER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/inc/upnpdrmfilter.h --- a/upnpframework/upnpaiwengine/inc/upnpdrmfilter.h Mon Nov 01 13:44:24 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: Header file for the CUpnpDrmFilter class. -* -*/ - - -#ifndef C_UPNPDRMFILTER_H -#define C_UPNPDRMFILTER_H - -#include -#include -#include -#include - - -/** - * Class for filtering Drm files out from a list of files. - * @since S60 3.2 - * @lib upnpaiwengine.dll - */ -class CUpnpDrmFilter : public CActive, - public MAknBackgroundProcess - { - -public: - - /** state for filtering DRM */ - enum TDrmFilterState - { - EIdle = 1, - EFilter, - EFilterComplete, - EFilterStop - }; - - /** - * Two-Phased Constructor - * @param aFiles (RPointerArray&) Reference to an array of - * TDesC objects containing the list of file names. - * @param aDRMProtectedFiles (RPointerArray&) Reference to an - * empty array of TDesC objects, the method will append DRM - * protected files on this list. - * @return new instance of CUpnpDrmFilter - */ - IMPORT_C static CUpnpDrmFilter* NewL( RPointerArray& aFiles, - RPointerArray& aDRMProtectedFiles ); - - /** - * Constructor - * @param aFiles (RPointerArray&) Reference to an array of - * TDesC objects containing the list of file names. - * @param aDRMProtectedFiles (RPointerArray&) Reference to an - * empty array of TDesC objects, the method will append DRM - * protected files on this list. - */ - CUpnpDrmFilter( RPointerArray& aFiles, - RPointerArray& aDRMProtectedFiles ); - /** - * Virtual Destructor - */ - virtual ~CUpnpDrmFilter(); - - /** - * Start filter music files. - */ - IMPORT_C void FilterDrmL(); - -private: - - /** - * 2nd phase constructor - */ - void ConstructL(); - - /** - * Filter 20 files every time - */ - void Filter(); - - /** - * From CActive - * Handles an active object's request completion event. - */ - void RunL(); - - /** - * From CActive - * Handles an active error. - */ - void RunError(); - - /** - * From CActive - * Implements cancellation of an outstanding request. - */ - void DoCancel(); - - /** - * Performs incremental filter operation. - */ - void DoTaskStep(); - - /** - * End filter operation. - */ - void Complete(); - - /** - * Completes one cycle of the process. - * From MProgressDialogCallback. - */ - void StepL(); - - /** - * Return true when the process is done. - * From MProgressDialogCallback. - */ - TBool IsProcessDone() const; - - /** - * Show the wait note when filtering files. - */ - void ShowWaitNoteL(); - - -private: // data - - /** - * Reference to an array of TDesC objects containing - * the list of file names. - */ - RPointerArray& iFiles; //Not own - - /** - * Reference to an empty array of TDesC objects used to append DRM - * protected files on this list. - */ - RPointerArray& iDRMProtectedFiles; //Not own - - - /** - * The state of current operation. - */ - TDrmFilterState iState; - - /** - * The next start point to filter DRM file from iFiles array - */ - TInt iStartPoint; - - /** - * The latest point has been filter - */ - TInt iCurrentPoint; - - /** - * The total number of file need to filter. - */ - TInt iTotalNum; - - /** - * Used to append the DRM file index in iFile array. - */ - RArray iRemovedIndexArray; - - /** - * The total number of filtered files. - */ - TInt iFilteredCount; - - /** - * The total number of abnormal files except DRM files. - */ - TInt iAbnormalFileCount; - - }; - -#endif // C_UPNPDRMFILTER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/src/upnpaiwengine.cpp --- a/upnpframework/upnpaiwengine/src/upnpaiwengine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1709 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the class CUPnPAiwEngine. - * -*/ - - -// INCLUDE FILES -// System -#include -#include -#include -#include -#include - -// Upnp stack -#include - -// avcontroller api -#include "upnpavcontroller.h" -#include "upnpavcontrollerfactory.h" -#include "upnpavrenderingsession.h" -#include "upnpavsessionbase.h" -#include "upnpavdevice.h" - -// avcontroller / avcontroller helper api -#include "upnpitemresolver.h" -#include "upnpitemresolverfactory.h" -#include "upnpitemutility.h" -#include "upnpresourceselector.h" - -// upnpframework internal api's -#include "upnpfiletransferengine.h" // Upnp Fw / UpnpFileTransferEngine -#include "upnpcommonutils.h" // Upnp Fw / UpnpUtilities - -// aiw engine internal -#include // Upnp Fw / UpnpAiwEngine -#include "upnpaiwengine.h" // Upnp Fw / UpnpAiwEngine -#include "upnpaiwtimer.h" // Upnp Fw / UpnpAiwEngine - -// logging -_LIT( KComponentLogfile, "upnpaiwengine.log" ); -#include "upnplog.h" - -const TInt KSlash = 92; -const TInt KDot = 46; - -// CONSTANTS -_LIT( KResFileName, "\\resource\\upnpaiwengineresources.rsc" ); -const TInt KAiwTimerIntervalInSeconds = 1; - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::NewL -// NewL. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPAiwEngine* CUPnPAiwEngine::NewL() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::NewL" ); - - CUPnPAiwEngine* self = NULL; - - // If this is the first time we are getting the instance of this - // singleton class, create the instance and store it into the - // Thread Local Storage - if( !Dll::Tls() ) - { - self = new (ELeave) CUPnPAiwEngine; - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - TInt err = Dll::SetTls( static_cast( self ) ); - if( err != KErrNone ) - { - delete self; - self = NULL; - } - else - { - // Initialise the user counter to zero - self->InitialiseUserCounter(); - } - } - else - { - self = static_cast( Dll::Tls() ); - } - - // Increase number of users by one - self->IncreaseUserCounter(); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ReleaseInstance -// Releases the instance. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::ReleaseInstance() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ReleaseInstance" ); - - CUPnPAiwEngine* instance = NULL; - - // Get the instance from the TLS if there is an instance - if( Dll::Tls() ) - { - instance = static_cast( Dll::Tls() ); - } - - // If there still were an instance in the TLS - if( instance ) - { - - // Decrease the number of instance - instance->DecreaseUserCounter(); - - // If the instance count is now 0, empty the TLS - if( instance->UserCounter() <= 0 ) - { - // Empty the TLS - TInt err = Dll::SetTls( NULL ); - if( err ) - { - // ignore - } - - // Delete the instance - delete instance; - instance = NULL; - } - } - } - -// -------------------------------------------------------------------------- -// Constructor -// -------------------------------------------------------------------------- -// -CUPnPAiwEngine::CUPnPAiwEngine() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CUPnPAiwEngine" ); - - iRenderingSessionInUse = EFalse; - iVideoPlay = EFalse; - iFileName = NULL; - iVideoPlayCancel = EFalse; - iVideoPlayWait = EFalse; - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPAiwEngine::~CUPnPAiwEngine() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::~CUPnPAiwEngine" ); - // Delete resolvers - // Delete for resolvers is done using temporary variables so that we can - // first nullify the members and then delete the actual objects. - // This is because local resolver deletion uses active scheduler loops - // and therefore other asynchronous events may orrur. So we may end - // up here in Cleanup again, during the resolver is being deleted. - // if deletion is done the conventional way, the objects get deleted - // twice, which is not what we want. :-) - MUPnPItemResolver* tempResolver = iResolver; - iResolver = NULL; - delete tempResolver; - StopTimer(); - - // If wait note is shown, finish it - if (iWaitNoteDialog) - { - TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() ); - } - - if (iRenderingSession && iAVController) - { - TRAP_IGNORE( iAVController->StopRenderingSession( - *iRenderingSession ) ); - iRenderingSession = NULL; - } - - delete iCommonUI; - - // Delete the UPnP AV Controller - delete iAVController; - delete iFileName; - - // Un-load resource file - if (iResFileOffset) - { - CEikonEnv::Static()->DeleteResourceFile(iResFileOffset); - iResFileOffset = 0; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ConstructL -// Second phase constructor -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::ConstructL() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ConstructL" ); - - iCoeEnv = CEikonEnv::Static(); - RFs& fileSession = iCoeEnv->FsSession(); - - // Load resource file - TFileName rscFileName(KResFileName); - TFileName dllName; - Dll::FileName(dllName); - TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' - rscFileName.Insert( 0, drive); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile(fileSession, rscFileName); - - // Check if the resource file exists or not - if ( !BaflUtils::FileExists(fileSession, rscFileName) ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, resource file does not \ -exist!" ); - User::Leave(KErrNotFound); - } - - if (iCoeEnv) - { - // Read the resource file offset - iResFileOffset = iCoeEnv->AddResourceFileL(rscFileName); - } - - // Set initial state of the connection to the UPnPAVController - iCommonUI = CUPnPCommonUI::NewL(); - iAVController = NULL; - iRenderingSession = NULL; - iEngineState = EUPnPEngineNotConnected; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::SetEngineObserver -// Sets the observer instance. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::SetEngineObserver( - MUPnPAiwEngineObserver* aObserver ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::SetEngineObserver" ); - - if( aObserver ) - { - iObserver = aObserver; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::RemoveEngineObserver -// Sets the observer instance. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::RemoveEngineObserver() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::RemoveEngineObserver" ); - - iObserver = NULL; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::EngineState -// Gets the state of the UPnP AIW Engine. -// -------------------------------------------------------------------------- -// -EXPORT_C TUPnPEngineState CUPnPAiwEngine::EngineState() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::EngineState" ); - - return iEngineState; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::OpenExternalMediaL -// Opens the External media UI. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::OpenExternalMediaL() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::OpenExternalMediaL" ); - - TInt status = KErrNone; - - if( !iAVController && - iEngineState == EUPnPEngineNotConnected ) - { - TRAP( status, - iAVController = - UPnPAVControllerFactory::NewUPnPAVControllerL() ); - - if( status == KErrNone && - iAVController ) - { - // Update engine state - iEngineState = EUPnPEngineBrowsingHomeNetwork; - TInt leaveCode = KErrNone; - - TRAP( leaveCode, - status = iCommonUI->ExecuteDeviceDialogL( *iAVController ) ); - - // Handle status and leave codes - if( leaveCode != KErrNone && - status == KErrNone ) - { - status = leaveCode; - } - - // Clean up and return the engine state - delete iAVController; - iAVController = NULL; - iEngineState = EUPnPEngineNotConnected; - } - else // If the instantiation of UpnpAvController fails - - { - TRAP_IGNORE( ShowConnectionErrorL() ); - status = KErrCouldNotConnect; - } - } - else // If the UpnpAvController is already instantiated - - { - status = KErrInUse; - } - - if( status != KErrNone ) - { - User::Leave( status ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::EnableExternalL -// Enables the showing of local media files on a remote renderer device. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::EnableExternalL() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::EnableExternalL" ); - - TInt status = KErrNone; - - if( !iAVController && - iEngineState == EUPnPEngineNotConnected ) - { - TRAP( status, - iAVController = - UPnPAVControllerFactory::NewUPnPAVControllerL() ); - - if( status == KErrNone && - iAVController ) - { - iAVController->SetDeviceObserver( *this ); - TRAP( status, StartRenderingSessionL( - EUPnPAiwEngineTargetDeviceWithImageSupport ) ); - - // If the rendering session was created successfully - if( status == KErrNone && - iRenderingSession ) - { - // Start local file sharing - TRAP( status, - StartLocalFileSharingL( iRenderingSession ) ); - { - // If the file sharing failed to start, undo the enable - // external by calling disable external. - if( status != KErrNone ) - { - DisableExternal(); - } - } - } - else - { - delete iAVController; - iAVController = NULL; - iEngineState = EUPnPEngineNotConnected; - } - } - else // If the instantiation of UpnpAvController fails - - { - TRAP_IGNORE( ShowConnectionErrorL() ); - status = KErrCouldNotConnect; - } - } - else - { - status = KErrInUse; - } - - if( status != KErrNone ) - { - User::Leave( status ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::DisableExternal -// Disables the showing of local media files on a remote renderer device. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::DisableExternal() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::DisableExternal" ); - - if( iAVController ) - { - if( iRenderingSession ) - { - // If STOP action is required, use the timer to delay the - // destruction (give some time for AvController to send the STOP - // action message) - if( iEngineState == EUPnPEngineActive ) - { - TRAP_IGNORE( iRenderingSession->StopL() ); - StartTimer(); - } - else - { - // Stop local file sharing - TRAP_IGNORE( iRenderingSession->ReleaseLocalMSServicesL() ); - - // Stop the rendering session - TRAP_IGNORE( iAVController->StopRenderingSession( - *iRenderingSession ) ); - iRenderingSession = NULL; - } - } - - // Delete the UPnP AV Controller - delete iAVController; - iAVController = NULL; - } - - // Update engine state - iRenderingSessionInUse = EFalse; - iEngineState = EUPnPEngineNotConnected; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::PlayL -// Plays (sends for rendering) local media file using the selected -// UPnP Media renderer. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::PlayL( const TDesC& aFileName ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::PlayL" ); - - TInt status = KErrNone; - - if( aFileName != KNullDesC ) - { - - if( iAVController && - iRenderingSession && - ( iEngineState == EUPnPEngineConnected || - iEngineState == EUPnPEngineActive ) ) - { - - // Check the file type - TUPnPItemType fileType = ETypeOther; - TRAPD( mimeError, - fileType = UPnPCommonUtils::ResolveFileTypeL( - aFileName ) ); - if( mimeError == KErrNone ) - { - if( fileType == ETypeAudio ) - { - status = KErrNotSupported; - if( iObserver ) - { - iObserver->PlayCompleteL( status ); - } - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \ -audio files not supported!" ); - } - else if ( fileType == ETypeVideo ) - { - if( iRenderingSessionInUse ) - { - //if the previous operation not finished - delete iFileName; iFileName = NULL; - iFileName = aFileName.AllocL(); - iVideoPlayWait = ETrue; - } - else - { - TRAP( status, StartVideoPlayL( aFileName ) ); - } - } - else if ( fileType == ETypeImage ) - { - if( !iVideoPlay ) //if no video is being played - - { - if( iRenderingSessionInUse ) - { - //if the previous operation not finished - iVideoPlayWait = EFalse; - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \ -iRenderingSessionInUse: ETrue" ); - delete iFileName; - iFileName = NULL; - iFileName = aFileName.AllocL(); - } - else - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \ -iRenderingSessionInUse: EFalse" ); - TRAP( status , CreateUpnpItemAndSetUriL( aFileName ) ); - if( KErrNone == status ) - { - iRenderingSessionInUse = ETrue; - } - else - { - // Failed, notify MG, the image playing is - // complete - if( iObserver ) - { - iObserver->PlayCompleteL( status ); - } - } - } - } - else - { - //notify MG, the music playing is complete - if( iObserver ) - { - iObserver->PlayCompleteL( status ); - } - } - - } - else // Unsupported file - - { - status = KErrNotSupported; - } - } - else // Failed to resolve MIME type - - { - status = KErrArgument; - } - } - else // Rendering session not available (Enable External not done) - - { - status = KErrNotReady; - } - } - else - { - status = KErrArgument; - } - - if( status != KErrNone ) - { - User::Leave( status ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::CopyToExternalL -// Copies local files to a remote media server. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::CopyToExternalL( - RPointerArray& aFileNames ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CopyToExternalL" ); - - // Check parameters - if( aFileNames.Count() <= 0 ) - { - User::Leave( KErrArgument ); - } - - // Check engine state - if( iAVController ) - { - User::Leave( KErrInUse ); - } - - // Create UPnPAVController - TRAPD( avControllerError, - iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL() ); - if( avControllerError != KErrNone ) - { - TRAP_IGNORE( ShowConnectionErrorL() ); - User::Leave( KErrCouldNotConnect ); - } - - // Update engine state - iEngineState = EUPnPEngineConnected; - - // Do the transfer - TRAPD( transferError, - TransferToExternalL( EAiwEngineCopy, aFileNames, KNullDesC ) ); - - // Clean up - delete iAVController; - iAVController = NULL; - - // Update engine state - iEngineState = EUPnPEngineNotConnected; - - if( transferError != KErrNone ) - { - User::Leave( transferError ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::CopyToExternalL -// Copies local files to a remote media server. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::CopyPlaylistToExternalL( - const TDesC& aPlaylistName, - RPointerArray& aFileNames ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CopyPlaylistToExternalL" ); - - // Check parameters - if( aFileNames.Count() <= 0 || - aPlaylistName == KNullDesC ) - { - User::Leave( KErrArgument ); - } - - // Check engine state - if( iAVController ) - { - User::Leave( KErrInUse ); - } - - // Create UPnPAVController - TRAPD( avControllerError, - iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL() ); - if( avControllerError != KErrNone ) - { - TRAP_IGNORE( ShowConnectionErrorL() ); - User::Leave( KErrCouldNotConnect ); - } - - // Update engine state - iEngineState = EUPnPEngineConnected; - - // Do the transfer - TRAPD( transferError, - TransferToExternalL( EAiwEngineCopyPlaylist, - aFileNames, - aPlaylistName ) ); - - // Clean up - delete iAVController; - iAVController = NULL; - - // Update engine state - iEngineState = EUPnPEngineNotConnected; - - if( transferError != KErrNone ) - { - User::Leave( transferError ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::MoveToExternalL -// Moves local files to a remote media server. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::MoveToExternalL( - RPointerArray& aFileNames ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::MoveToExternalL" ); - - // Check parameters - if( aFileNames.Count() <= 0 ) - { - User::Leave( KErrArgument ); - } - - // Check engine state - if( iAVController ) - { - User::Leave( KErrInUse ); - } - - // Create UPnPAVController - TRAPD( avControllerError, - iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL() ); - if( avControllerError != KErrNone ) - { - TRAP_IGNORE( ShowConnectionErrorL() ); - User::Leave( KErrCouldNotConnect ); - } - - // Update engine state - iEngineState = EUPnPEngineConnected; - - // Do the transfer - TRAPD( transferError, - TransferToExternalL( EAiwEngineMove, aFileNames, KNullDesC ) ); - - // Clean up - delete iAVController; - iAVController = NULL; - - // Update engine state - iEngineState = EUPnPEngineNotConnected; - - if( transferError != KErrNone ) - { - User::Leave( transferError ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::TransferToExternalL -// Transfers (copies/moves) local files/playlists to a remote media server. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::TransferToExternalL(TUPnPAiwEngineTransferMode aMode, - RPointerArray& aFilePaths, const TDesC& aPlaylistName) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::TransferToExternalL" ); - - // Parameters were already checked - - // Select the target server device - // Title should be according to ui spec. - TUPnPDialogTitle title = EUPnPCopyToTitle; - if (aMode == EAiwEngineMove) - { - title = EUPnPMoveToTitle; - } - CUpnpAVDevice* targetDevice = SelectDeviceL( - EUPnPSearchServerDevicesWithCopyCapability, title); - - CleanupStack::PushL(targetDevice); - - // Create a browsing session - TInt status = KErrNone; - MUPnPAVBrowsingSession* browsingSession= NULL; - TRAP( status, browsingSession = - &iAVController->StartBrowsingSessionL( *targetDevice ) ); - - if (status == KErrNone && browsingSession) - { - // Create a file transfer engine instance - CUpnpFileTransferEngine* ftEngine= NULL; - TRAP( status, - ftEngine = CUpnpFileTransferEngine::NewL( browsingSession ) ); - if ( status == KErrNone && ftEngine ) - { - CleanupStack::PushL( ftEngine ); - - // Update engine state - iEngineState = EUPnPEngineActive; - - // Number of files in the array. - TInt count = aFilePaths.Count(); - - // Do the copy/move - if ( aMode == EAiwEngineMove ) - { - TRAP( status, ftEngine->MoveLocalFilesToRemoteServerL( - &aFilePaths ) ); - } - else if ( aMode == EAiwEngineCopyPlaylist) - { - TRAP( status, ftEngine->CopyLocalPlaylistToRemoteServerL( - aPlaylistName, - &aFilePaths ) ); - } - else - { - TRAP( status, ftEngine->CopyLocalFilesToRemoteServerL( - &aFilePaths ) ); - } - - // Clean up - // aFilePaths is not updates until ftEngine is deleted! - CleanupStack::PopAndDestroy( ftEngine ); - ftEngine = NULL; - - // Update engine state - if ( status == KErrNone ) - { - iEngineState = EUPnPEngineConnected; - - // Shows proper info note. - // - // Calculate number of transferred files based on original - // file count and items remaining in aFilePaths - // (those were NOT transferred) - ShowTransferInfoNoteL( - aMode, - count - aFilePaths.Count(), - *targetDevice ); - } - else if (KErrSessionClosed == status || KErrCouldNotConnect == status - || KErrDisconnected == status ) - { - iEngineState = EUPnPEngineConnectionLost; - if ( aMode != EAiwEngineMove ) - { - ShowConnectionLostCopyErrorL(); - } - else - { - ShowConnectionErrorL(); - } - } - else if ( KErrNotFound == status ) - { - ShowTransferInfoNoteL ( - aMode, - 0, - *targetDevice ); - } - else - { - iEngineState = EUPnPEngineConnected; - } - } - - // Stop browsing session - iAVController->StopBrowsingSession( *browsingSession ); - } - - // Clean up - CleanupStack::PopAndDestroy( targetDevice ); - targetDevice = NULL; - - // Get the titles (of the files that failed to be transfered) from - // the item array and store them in the file name array. - TChar slash( KSlash ); - TChar dot( KDot ); - TInt fileCount = aFilePaths.Count(); - RPointerArray fileTitles; - for ( TInt index = 0; index < fileCount; index++ ) - { - TInt offset1 = aFilePaths[index]->LocateReverse( slash ); - TInt offset2 = aFilePaths[index]->LocateReverse( dot ); - - HBufC16* fileTitle= NULL; - - if ( KErrNotFound != offset1 && KErrNotFound != offset2 && - offset2 > ( offset1 + 1 ) ) - { - - fileTitle = aFilePaths[index]-> - Mid( ( offset1 + 1 ), ( offset2 - offset1 - 1 ) ).Alloc(); - - } - if (fileTitle) - { - fileTitles.AppendL(fileTitle); - } - } - aFilePaths.ResetAndDestroy(); - for (TInt index = 0; index < fileTitles.Count(); index++) - { - aFilePaths.AppendL(fileTitles[index]); - } - - fileTitles.Reset(); - fileTitles.Close(); - - if (status != KErrNone) - { - User::Leave(status); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::StartRenderingSessionL -// Starts a rendering session with UpnpAvController. Queries the target -// rendering device. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::StartRenderingSessionL(TUPnPAiwEngineDeviceType aType) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::StartRenderingSessionL" ); - - TInt status = KErrNone; - - if (iAVController) - { - if ( !iRenderingSession) - { - CUpnpAVDevice* tempDevice = CUpnpAVDevice::NewL(); - CleanupStack::PushL(tempDevice); - - // Launch the device selection dialog - - if (aType == EUPnPAiwEngineTargetDeviceWithAudioSupport) - { - status = iCommonUI->SelectDeviceL( *iAVController, - *tempDevice, - EUPnPSearchRenderingDevicesWithAudioCapability, - EUPnPSelectDeviceTitle); - } - else - if (aType - == EUPnPAiwEngineTargetDeviceWithImageAndVideoSupport) - { - status = iCommonUI->SelectDeviceL( *iAVController, - *tempDevice, - EUPnPSearchRenderingDevicesWithVideoCapability, - EUPnPSelectDeviceTitle); - } - else - if (aType == EUPnPAiwEngineTargetDeviceWithImageSupport) - { - status - = iCommonUI->SelectDeviceL( - *iAVController, - *tempDevice, - EUPnPSearchRenderingDevicesWithImageCapability, - EUPnPSelectDeviceTitle); - } - else - { - status = KErrNotSupported; - } - - if (status == KErrNone) - { - // Create a rendering session and register to observe the - // callbacks - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \ -creating rendering session." ); - iRenderingSession - = &(iAVController->StartRenderingSessionL( *tempDevice) ); - iRenderingSession->SetObserver( *this); - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, \ -rendering session created." ); - - // Update the engine state - iEngineState = EUPnPEngineConnected; - } - - // Clean up - CleanupStack::PopAndDestroy(tempDevice); - tempDevice = NULL; - } - else - { - status = KErrInUse; - } - } - else - { - status = KErrNotReady; - } - - if (status != KErrNone) - { - User::Leave(status); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::InteractOperationComplete -// UPnP AV Controller calls this method to indicate that the requested -// interaction operation (play, stop, etc.) is complete. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::InteractOperationComplete(TInt aError, - TUPnPAVInteractOperation aOperation) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::InteractOperationComplete" ); - - if (iObserver && !iVideoPlayCancel) - { - // If the play operation is complete (stop) or the play fails, do - // the call back - if (aOperation == EUPnPAVPlay || aOperation == EUPnPAVPlayUser - || aOperation == EUPnPAVStop || aOperation == EUPnPAVStopUser) - { - iEngineState = EUPnPEngineConnected; - TRAP_IGNORE( iObserver->PlayCompleteL( aError ) ); - } - } - if (aOperation == EUPnPAVPlay || aOperation == EUPnPAVStop) - { - iRenderingSessionInUse = EFalse; - if (iFileName) // If there is a pending item - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, pending item" ); - TRAP_IGNORE( InitPlayL() ); - delete iFileName; - iFileName = NULL; - iVideoPlayCancel = EFalse; // No need to send StopL - } - else - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no pending item" ); - - if (iVideoPlayCancel) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, stop previous \ -video item," ); - iRenderingSessionInUse = ETrue; - TRAP_IGNORE( iRenderingSession->StopL() ); - iVideoPlayCancel = EFalse; //StopL sent - } - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::SetURIResult -// UPnP AV Controller calls this method to indicate that ... -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::SetURIResult(TInt aError) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::SetURIResult" ); - - iRenderingSessionInUse = EFalse; - if (aError != KErrNone && iObserver && !iVideoPlayCancel) - { - TRAP_IGNORE( iObserver->PlayCompleteL( aError ) ); - } - else - if ( !iRenderingSession) - { - if (iObserver) - { - TRAP_IGNORE( iObserver->PlayCompleteL( KErrNotReady ) ); - } - } - - if (iFileName) //if there is a pending item - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, pending item" ); - TRAP_IGNORE( InitPlayL() ); - delete iFileName; - iFileName = NULL; - iVideoPlayCancel = EFalse; //no need to send StopL - } - else - if ( !iVideoPlayCancel) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no pending item" ); - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no cancellation from \ -video play" ); - TRAP( aError, iRenderingSession->PlayL() ); - //if play failed, send the result right way - if (aError && iObserver) - { - TRAP_IGNORE( iObserver->PlayCompleteL( aError ) ); - } - else - if (KErrNone == aError) - { - iRenderingSessionInUse = ETrue; - } - } - else - if (iVideoPlayCancel) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, no pending item" ); - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, stop previous \ -video item" ); - TRAP_IGNORE( iRenderingSession->StopL() ); - iRenderingSessionInUse = ETrue; - iVideoPlayCancel = EFalse; //StopL sent - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ReleaseUpnpResourceL -// Release Upnp resouces -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::ReleaseUpnpResourceL() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ReleaseUpnpResourceL" ); - - // Inform the client about the connection lost - if (iObserver) - { - iObserver->ConnectionLostL(); - } - - // Stop the rendering session - if ( iRenderingSession && iAVController ) - { - //iRenderingSession->ReleaseLocalMSServicesL(); - iRenderingSession->RemoveObserver(); - iAVController->StopRenderingSession( *iRenderingSession); - iRenderingSession = NULL; - } - - // Disconnect UPnPAVController - delete iAVController; - iAVController = NULL; - - iRenderingSessionInUse = EFalse; - // Update engine state - iEngineState = /*EUPnPEngineConnectionLost;*/EUPnPEngineNotConnected; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::WLANConnectionLost -// UPnP AV Controller calls this method to indicate that ... -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::WLANConnectionLost() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::WLANConnectionLost" ); - - iFileSharingError = KErrDisconnected; - if ( iFileSharingActivationWaitNote ) - { - TRAP_IGNORE( iFileSharingActivationWaitNote->ProcessFinishedL() ); - } - TRAP_IGNORE( iCommonUI->DismissDialogL( KErrDisconnected ) ); - TRAP_IGNORE( ReleaseUpnpResourceL() ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::MediaRendererDisappeared -// Notifies that the Media Renderer we have a session with has disappeared. -// Session is now unusable and must be closed. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::MediaRendererDisappeared( - TUPnPDeviceDisconnectedReason aReason) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::MediaRendererDisappeared" ); - - if (EDisconnected == aReason) - { - TRAP_IGNORE( ShowConnectionErrorL() ); - TRAP_IGNORE( ReleaseUpnpResourceL() ); - } - - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::InitialiseUserCounter -// Sets the initial value of the user counter to zero. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::InitialiseUserCounter() - { - iNumberOfUsers = 0; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::IncreaseUserCounter -// Increases the value of the user counter by one. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::IncreaseUserCounter() - { - iNumberOfUsers++; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::DecreaseUserCounter -// Decreases the value of the user counter by one. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::DecreaseUserCounter() - { - iNumberOfUsers--; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::UserCounter -// Gets the value of the user counter. -// -------------------------------------------------------------------------- -// -TInt CUPnPAiwEngine::UserCounter() const - { - return iNumberOfUsers; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::StartTimer() -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::StartTimer() - { - // Stop the timer - StopTimer(); - - // Start the timer - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, starting timer" ); - TRAPD( err, - iUPnPAiwTimer = CUPnPAiwTimer::NewL( KAiwTimerIntervalInSeconds, - this ) ) - ; - if (err) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, timer start failed!" ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::StopTimer() -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::StopTimer() - { - // Stop the timer if it is running - if (iUPnPAiwTimer) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, stopping timer" ); - delete iUPnPAiwTimer; - iUPnPAiwTimer = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::TimerCallback -// Callback method for the UPnPAiWTimer. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::TimerCallback() - { - StopTimer(); - if( iAVController ) - { - if( iRenderingSession ) - { - // Stop local file sharing - TRAP_IGNORE( iRenderingSession->ReleaseLocalMSServicesL() ); - - // Stop the rendering session - TRAP_IGNORE( iAVController->StopRenderingSession( - *iRenderingSession ) ); - iRenderingSession = NULL; - } - - // Disconnect UPnPAVController - delete iAVController; - iAVController = NULL; - - // Update engine state - iEngineState = EUPnPEngineNotConnected; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ShowConnectionErrorL() -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAiwEngine::ShowConnectionErrorL() - { - iCommonUI->DisplayConnectionErrorNoteL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ShowConnectionLostCopyErrorL() -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::ShowConnectionLostCopyErrorL() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ShowConnectionLostErrorL" ); - iCommonUI->DisplayConnectionLostCopyErrorNoteL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ShowTransferInfoNoteL -// Show correct info note after file transfer is completed. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::ShowTransferInfoNoteL( - TUPnPAiwEngineTransferMode aMode, - TInt aCount, - const CUpnpAVDevice& aServerName ) const - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ShowTransferInfoNoteL" ); - - // Converts device name into unicode string. - HBufC* deviceString = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - aServerName.FriendlyName() ); - CleanupStack::PushL( deviceString ); - - HBufC* infoText= NULL; - if ( aCount == 1 ) - { - if ( aMode == EAiwEngineMove ) - { - // File moved. - infoText = StringLoader::LoadLC( - R_AIW_INFO_MOVE_EXT_ONE_TEXT, - *deviceString ); - } - else - { - // File copied. - infoText = StringLoader::LoadLC( - R_AIW_INFO_COPY_EXT_ONE_TEXT, - *deviceString ); - } - } - else - { - if ( aMode == EAiwEngineMove ) - { - // Files moved. - infoText = StringLoader::LoadLC( - R_AIW_INFO_MOVE_EXT_MANY_TEXT, - *deviceString, - aCount); - } - else - { - // Files copied. - infoText = StringLoader::LoadLC( - R_AIW_INFO_COPY_EXT_MANY_TEXT, - *deviceString, - aCount ); - } - } - - // Shows the dialog. - CAknInformationNote* infoNote = - new ( ELeave ) CAknInformationNote( ETrue ); - infoNote->ExecuteLD( *infoText ); - - CleanupStack::PopAndDestroy( infoText ); - CleanupStack::PopAndDestroy( deviceString ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ReserveLocalMSServicesCompleted -// Notifies that the Media Server startup has completed. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::ReserveLocalMSServicesCompleted(TInt aError) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::\ -ReserveLocalMSServicesCompleted" ); - - iFileSharingError = aError; - if (aError == KErrNone) - { - iLocalFileSharingActivated = ETrue; - } - if (iFileSharingActivationWaitNote) - { - TRAP_IGNORE( iFileSharingActivationWaitNote->ProcessFinishedL() ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::StartLocalFileSharingL -// Waits for local media server file sharing activation (or user cancel). -// -------------------------------------------------------------------------- -void CUPnPAiwEngine::StartLocalFileSharingL(MUPnPAVSessionBase *aSession) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::StartLocalFileSharingL" ); - - // Leave if the parameter is not valid - if ( !aSession) - { - User::Leave(KErrArgument); - } - - // Initialize the sharing error variable - iFileSharingError = KErrNone; - iLocalFileSharingActivated = EFalse; - - // Start the local media server - aSession->ReserveLocalMSServicesL(); - - // Instantiate and launch the wait note until the sharing is - // enabled of user cancels the operation - if ( !iLocalFileSharingActivated && iFileSharingError == KErrNone) - { - // Instantiate and launch the wait note until the sharing is - // enabled of user cancels the operation - iFileSharingActivationWaitNote = new(ELeave)CAknWaitDialog( - ( REINTERPRET_CAST( CEikDialog**, - &iFileSharingActivationWaitNote ) ), ETrue ); - iFileSharingActivationWaitNote->SetCallback( this); - TRAPD( fileSharingActivationError, - iFileSharingActivationWaitNote->ExecuteLD( - R_AIW_ENABLE_SHARING_WAIT_NOTE ) ) - ; - - // Cancel sharing activation is user pressed cancel - if (iFileSharingError == KErrCancel) - { - TRAP_IGNORE( aSession->CancelReserveLocalMSServicesL() ); - } - - // If sharing failed, and the user did not cancel the operations, - // forward the leave code. - if (fileSharingActivationError != KErrNone && iFileSharingError - != KErrCancel) - { - iFileSharingError = fileSharingActivationError; - } - } - - if (iFileSharingError != KErrNone) - { - User::Leave(iFileSharingError); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::DialogDismissedL -// ProgressDialog call back method. Get's called when a dialog is -// dismissed. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::DialogDismissedL(TInt aButtonId) - { - if (aButtonId == EAknSoftkeyCancel) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, user cancelled the file \ -sharing activation" ); - iFileSharingError = KErrCancel; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::DialogDismissedL -// Method for selecting a device. -// -------------------------------------------------------------------------- -// -CUpnpAVDevice* CUPnPAiwEngine::SelectDeviceL( - TUPnPDeviceTypesToSearch aDeviceType, TUPnPDialogTitle aDlgTitle) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::SelectDeviceL" ); - - CUpnpAVDevice* device= NULL; - - // Leave if the engine is not in right state - if ( !iAVController) - { - User::Leave(KErrNotReady); - } - else - { - // Create new UpnpAvDevice instance - device = CUpnpAVDevice::NewL(); - CleanupStack::PushL(device); - - // Do the device selection - TInt ret = iCommonUI->SelectDeviceL( *iAVController, *device, - aDeviceType, aDlgTitle); - - if (ret != KErrNone) - { - CleanupStack::PopAndDestroy(device); - device = NULL; - User::Leave(ret); - } - CleanupStack::Pop(device); // Will be returned from the method - } - - return device; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::StarVideoPlayL -// Method for Playing a local video -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::StartVideoPlayL(const TDesC& aFileName) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::StartVideoPlayL" ); - - //check if selected renderer supports playing video - TInt status = KErrNone; - if (iRenderingSession->Device().VideoCapability() ) - { - // Launch the video player dialog to render the - // item on the selected rendering device. - MUPnPItemResolver* resolver = CreateResolverLC( aFileName ); - - // Update engine state - iEngineState = EUPnPEngineActive; - iRenderingSessionInUse = ETrue; - iVideoPlay = ETrue; - - status = iCommonUI->ExecuteVideoPlayerL( *iRenderingSession, - resolver->Item() ); - iVideoPlay = EFalse; - iRenderingSessionInUse = EFalse; - - if (KErrSessionClosed == status || KErrDisconnected == status) - { - if (KErrSessionClosed == status) - { - ReleaseUpnpResourceL(); - } - } - else - { - // Re-register to observe the rendering - // session and update engine state - iRenderingSession->RemoveObserver(); - iRenderingSession->SetObserver( *this); - iEngineState = EUPnPEngineConnected; - } - - //notify MG, the video playing is complete - if (iObserver) - { - iObserver->PlayCompleteL(status); - } - - if (KErrCancel == status) - { - TRAP_IGNORE( iRenderingSession->StopL() ); - iRenderingSessionInUse = ETrue; - iVideoPlayCancel = ETrue; - } - - CleanupStack::PopAndDestroy(); // resolver - } - else //if not - { - status = KErrNotSupported; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::InitPlayL -// Method for Playing a local file -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::InitPlayL() - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::InitPlayL" ); - - //if pending an item - TInt error = KErrNone; - - if (iVideoPlay || iVideoPlayWait) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, start video play" ); - TRAP_IGNORE( StartVideoPlayL( *iFileName ) ); - iVideoPlayWait = EFalse; - } - else - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine, start image play" ); - TRAP( error , CreateUpnpItemAndSetUriL( *iFileName ) ); - if (KErrNone == error) - { - iRenderingSessionInUse = ETrue; - } - else - { - iObserver->PlayCompleteL(error); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::Wait -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::Wait() - { - StopWait(); - iWait.Start(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::StopWait -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::StopWait() - { - if (iWait.IsStarted() ) - { - if (iWait.CanStopNow() ) - { - iWait.AsyncStop(); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::CreateUpnpItemAndSetUriL -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::CreateUpnpItemAndSetUriL(const TDesC& aFileName) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateUpnpItemAndSetUriL" ); - - // Creates resolver to iResolver member variable. - MUPnPItemResolver* resolver = CreateResolverLC( aFileName ); - - // Sets uri. - const CUpnpElement& element = UPnPItemUtility::ResourceFromItemL( - iResolver->Item() ); - iRenderingSession->SetURIL( element.Value(), iResolver->Item() ); - - // Cleanup - CleanupStack::PopAndDestroy(); // resolver - - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateUpnpItemAndSetUriL -END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::ResolveComplete -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::ResolveComplete( - const MUPnPItemResolver& /*aResolver*/, - TInt aError ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ResolveComplete" ); - - iResolveResult = aError; - StopWait(); - - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::ResolveComplete -END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::CreateResolverLC -// -------------------------------------------------------------------------- -// - MUPnPItemResolver* CUPnPAiwEngine::CreateResolverLC( const TDesC& aFilePath ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateResolverLC" ); - - // If member variable exists, resolving operation is ongoing. - if ( iResolver ) - { - User::Leave( KErrInUse ); - } - - // Creates resolver - TUPnPSelectDefaultResource selector; - iResolver = UPnPItemResolverFactory::NewLocalItemResolverL( - aFilePath, - *iAVController, - selector ); - CleanupStack::PushL( TCleanupItem( CleanupResolver, this ) ); - - // Starts async resolver. - iResolveResult = KErrNone; - iResolver->ResolveL( *this ); - Wait(); - - // If error occured, resolves it in here. It will cleanup resolver. - User::LeaveIfError( iResolveResult ); - - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CreateResolverLC -END" ); - - return iResolver; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEngine::CleanupResolver -// Static method to cleanup resolver object. -// -------------------------------------------------------------------------- -// -void CUPnPAiwEngine::CleanupResolver( TAny* aAiwEngine ) - { - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CleanupResolver" ); - - CUPnPAiwEngine* aiwEngine = reinterpret_cast( aAiwEngine ); - if ( aiwEngine ) - { - MUPnPItemResolver* tempResolver = aiwEngine->iResolver; - aiwEngine->iResolver = NULL; - delete tempResolver; - __LOG( "[UpnpAiwEngine]\t\t Resolver cleaned up." ); - } - - __LOG( "[UpnpAiwEngine]\t CUPnPAiwEngine::CleanupResolver -END" ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/src/upnpaiwtimer.cpp --- a/upnpframework/upnpaiwengine/src/upnpaiwtimer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the class CUPnPAiwTimer. -* -*/ - - -// INCLUDES -#include "upnpaiwtimer.h" -#include "upnpaiwtimerobserver.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPAiwTimer::NewL -// Construct the timer, add CHeartbeat to Active Scheduler and start it. -// -------------------------------------------------------------------------- -// -CUPnPAiwTimer* CUPnPAiwTimer::NewL( TInt aInterval, - MUPnPAiwTimerObserver* aCallback - ) - { - CUPnPAiwTimer* self = new (ELeave) CUPnPAiwTimer(); - CleanupStack::PushL( self ); - self->ConstructL( aInterval, aCallback ); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwTimer::CUPnPAiwTimer -// Constructor -// -------------------------------------------------------------------------- -// -CUPnPAiwTimer::CUPnPAiwTimer() - { - // No implementation - } - -// -------------------------------------------------------------------------- -// CUPnPAiwTimer::ConstructL -// Constructs the timer. -// -------------------------------------------------------------------------- -// -void CUPnPAiwTimer::ConstructL( TInt aInterval, - MUPnPAiwTimerObserver* aCallback ) - { - - // Check the parameters - if( aInterval <= 0 || - !aCallback ) - { - User::Leave( KErrArgument ); - } - else - { - iInterval = aInterval; - iCallback = aCallback; - } - - // Create CHeartbeat object - iHeartbeat = CHeartbeat::NewL( EPriorityLow ); - - iCounter = 0; - - // Start the heartbeat timer (beating exactly on the second) - iHeartbeat->Start( ETwelveOClock, this ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwTimer::~CUPnPAiwTimer() -// Destructor. -// -------------------------------------------------------------------------- -// -CUPnPAiwTimer::~CUPnPAiwTimer() - { - // Cancel any outstanding request - if( iHeartbeat ) - { - iHeartbeat->Cancel(); - delete iHeartbeat; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwTimer::Beat() -// Called when the beat is in sync. -// -------------------------------------------------------------------------- -// -void CUPnPAiwTimer::Beat() - { - // Increase heartbeat counter - iCounter++; - - // If interval is reached, do the call back - if( iCounter == iInterval ) - { - if( iCallback ) - { - iCallback->TimerCallback(); - } - iCounter = 0; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwTimer::Synchronize() -// Called when the beat needs to be syncronized. -// -------------------------------------------------------------------------- -// -void CUPnPAiwTimer::Synchronize() - { - // not used - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwengine/src/upnpdrmfilter.cpp --- a/upnpframework/upnpaiwengine/src/upnpdrmfilter.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +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: Header file for the CUpnpDrmFilter class. -* -*/ - - -// INCLUDE FILES -// System -#include -#include - -// upnpframework / avcontroller helper api -#include "upnpfileutility.h" - -// aiwengine internal -#include // Upnp Fw / UpnpAiwEngine -#include "upnpdrmfilter.h" - -// logging -_LIT( KComponentLogfile, "upnpaiwengine.log" ); -#include "upnplog.h" - -// Constants -// The number of filtering file Every loop. -const TInt KStepFileNumber = 20; - -// --------------------------------------------------------------------------- -// Two-Phased Constructor -// --------------------------------------------------------------------------- -// -EXPORT_C CUpnpDrmFilter* CUpnpDrmFilter::NewL( - RPointerArray& aFiles, - RPointerArray& aDRMProtectedFiles ) - { - __LOG( "CUpnpDrmFilter::NewL Begin" ); - - CUpnpDrmFilter* self = - new( ELeave )CUpnpDrmFilter( aFiles, aDRMProtectedFiles ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -CUpnpDrmFilter::CUpnpDrmFilter( RPointerArray& aFiles, - RPointerArray& aDRMProtectedFiles ): - CActive( CActive::EPriorityStandard ), - iFiles( aFiles ), - iDRMProtectedFiles( aDRMProtectedFiles ) - { - __LOG( "CUpnpDrmFilter::CUpnpDrmFilter Begin" ); - - iState = EIdle; - CActiveScheduler::Add( this ); - - __LOG( "CUpnpDrmFilter::CUpnpDrmFilter End" ); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CUpnpDrmFilter::~CUpnpDrmFilter() - { - __LOG( "CUpnpDrmFilter::~CUpnpDrmFilter Begin" ); - - iRemovedIndexArray.Close(); - - __LOG( "CUpnpDrmFilter::~CUpnpDrmFilter End" ); - } - -// --------------------------------------------------------------------------- -// Start the delete operation -// --------------------------------------------------------------------------- -// -EXPORT_C void CUpnpDrmFilter::FilterDrmL() - { - __LOG( "CUpnpDrmFilter::FilterDrmL Begin" ); - - iFilteredCount = 0; - iTotalNum = iFiles.Count(); - iState = EFilter; - - // Start filter. - TRequestStatus* status = &iStatus; - *status = KRequestPending; - User::RequestComplete( status, KErrNone ); - SetActive(); - ShowWaitNoteL(); - - if (iFilteredCount > 0 ) - { - CAknNoteDialog* dlg = new( ELeave ) CAknNoteDialog(); - dlg->ExecuteDlgLD( R_AIW_DRM_SKIP_INFO_NOTE ); - } - - __LOG( "CUpnpDrmFilter::FilterDrmL End" ); - } - -// --------------------------------------------------------------------------- -// 2nd Phase Constructor -// --------------------------------------------------------------------------- -// -void CUpnpDrmFilter::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// Filters the drm file name from the file name array -// which file will be copied to the home network. -// --------------------------------------------------------------------------- -// -void CUpnpDrmFilter::Filter() - { - __LOG( "CUpnpDrmFilter::Filter Begin" ); - - if ( iTotalNum <= KStepFileNumber + iStartPoint ) - { - for ( TInt index = 0; index < iTotalNum - iStartPoint; index++ ) - { - TBool isProtected = ETrue; - TRAPD( drmError, - isProtected = UPnPFileUtility::IsFileProtectedL( - *iFiles[index+iStartPoint] ) ); - - iCurrentPoint++; - - __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\ - Filter complete , iCurrentPoint :%d" , iCurrentPoint ); - - if ( drmError || isProtected ) - { - __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\ - Filter , drmError :%d" , drmError ); - - // Add the file to aDRMProtectedFiles array. - iDRMProtectedFiles.AppendL( iFiles[index + iStartPoint] ); - // save the drm file index to array. These files will be removed - // from the aFiles array soon. - iRemovedIndexArray.AppendL( index + iStartPoint ); - } - if ( KErrNone != drmError ) - { - iAbnormalFileCount ++; - } - } - iState = EFilterComplete; - iStartPoint = 0; - } - else - { - for ( TInt index = 0; index < KStepFileNumber; index++ ) - { - TBool isProtected = ETrue; - TRAPD( drmError, - isProtected = UPnPFileUtility::IsFileProtectedL( - *iFiles[index+iStartPoint] ) ); - - iCurrentPoint++; - - __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\ - Filter , iCurrentPoint :%d" , iCurrentPoint ); - if ( drmError || isProtected ) - { - __LOG1( "[UpnpAiwEngine]\t CUpnpDrmFilter::\ - Filter , drmError :%d" , drmError ); - - // Add the file to aDRMProtectedFiles array. - iDRMProtectedFiles.AppendL( iFiles[index + iStartPoint] ); - // save the drm file index to array. These files will be removed - // from the aFiles array soon. - iRemovedIndexArray.AppendL( index + iStartPoint ); - } - if ( KErrNone != drmError ) - { - iAbnormalFileCount ++; - } - } - iStartPoint += KStepFileNumber; - } - - //Set a new request to filter the next 20 files - TRequestStatus* status = &iStatus; - *status = KRequestPending; - User::RequestComplete( status, KErrNone ); - SetActive(); - - __LOG( "CUpnpDrmFilter::Filter End" ); - } - -// ---------------------------------------------------------------------------- -// Handles request completion event -// ---------------------------------------------------------------------------- -// -void CUpnpDrmFilter::RunL() - { - __LOG( "CUpnpDrmFilter::RunL End" ); - if ( KErrNone == iStatus.Int() ) - { - DoTaskStep(); - } - else - { - __LOG( "CUpnpDrmFilter::RunL iStatus != KErrNone" ); - } - __LOG( "CUpnpDrmFilter::RunL End" ); - } - -//---------------------------------------------------------------------------- -// Handles exception -//---------------------------------------------------------------------------- -// -void CUpnpDrmFilter::RunError() - { - __LOG( "CUpnpDrmFilter::RunError Begin" ); - - Complete(); - - __LOG( "CUpnpDrmFilter::RunError End" ); - } - -// --------------------------------------------------------------------------- -// Cancel the filter operation -// --------------------------------------------------------------------------- -// -void CUpnpDrmFilter::DoCancel() - { - __LOG( "CUpnpDrmFilter::DoCancel Begin" ); - - Complete(); - - __LOG( "CUpnpDrmFilter::DoCancel End" ); - } - -// --------------------------------------------------------------------------- -// filter files -// --------------------------------------------------------------------------- -// -void CUpnpDrmFilter::DoTaskStep() - { - __LOG( "CUpnpDrmFilter::DoTaskStep Begin" ); - - switch( iState ) - { - case EFilter: - { - Filter(); - break; - } - case EFilterComplete: - { - Complete(); - break; - } - default: - { - break; - } - } - - __LOG( "CUpnpDrmFilter::DoTaskStep End" ); - } - -// --------------------------------------------------------------------------- -// End state for a delete operation -// --------------------------------------------------------------------------- -// -void CUpnpDrmFilter::Complete() - { - __LOG( "CUpnpDrmFilter::Complete Begin" ); - - if ( iTotalNum > iCurrentPoint ) - { - - for ( TInt index = iCurrentPoint; index < iTotalNum ; index++ ) - { - //remove the drm files from iFiles array. - iFiles.Remove( index ); - } - } - - iFilteredCount = iRemovedIndexArray.Count() - iAbnormalFileCount; - iAbnormalFileCount = 0; - - - for ( TInt index = iRemovedIndexArray.Count() - 1; index >= 0 ; index-- ) - { - //remove the drm files from iFiles array. - iFiles.Remove( iRemovedIndexArray[index] ); - } - - // Remove the empty slots in the array - iFiles.Compress(); - //close the iRemovedIndexArray - iRemovedIndexArray.Close(); - - //filter complete, start to copy file - __LOG1( "CUpnpDrmFilter::Complete() iFiles.Count = %d ",\ - iFiles.Count()); - iCurrentPoint = 0; - iState = EFilterStop; - - __LOG( "CUpnpDrmFilter::Complete End" ); - } - -// -------------------------------------------------------------------------- -// Completes one cycle of the process. -// --------------------------------------------------------------------------- -void CUpnpDrmFilter::StepL() - { - - } -// --------------------------------------------------------------------------- -// Return when the progress finish. -// --------------------------------------------------------------------------- -TBool CUpnpDrmFilter::IsProcessDone(void) const - { - __LOG( "CUpnpDrmFilter::IsProcessDone" ); - - TBool ret(EFalse); - if ( iState == EFilterStop ) - { - ret = ETrue; - } - else - { - __LOG( "CUpnpDrmFilter::IsProcessDone iState != EFilterComplete" ); - } - return ret; - } - -void CUpnpDrmFilter::ShowWaitNoteL() - { - __LOG( "CUpnpDrmFilter::ShowWaitNoteL Begin" ); - - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL(reinterpret_cast(waitNoteWrapper)); - waitNoteWrapper->ExecuteL( - R_AIW_DRM_FILTERING_WAIT_NOTE, // TInt aResId, - *this, // MAknBackgroundProcess& aBackgroundProcess - ETrue ); - CleanupStack::PopAndDestroy( waitNoteWrapper ); - - __LOG( "CUpnpDrmFilter::ShowWaitNoteL End" ); - } - -// END OF FILE diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/data/10208a15.rss --- a/upnpframework/upnpaiwprovider/data/10208a15.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 1020 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: Resource file for the UpnpAiwProvider interface. -* -*/ - - -// RESOURCE IDENTIFIER -// n/a - -// INCLUDES -#include -#include -#include "ecom/registryinfov2.rh" -#include "upnpaiwprovideruids.hrh" - -// RESOURCE DEFINITIONS - -// -------------------------------------------------------------------------- -// theInfo -// AIW interface definition for the UPnP AIW Media Provider. -// -------------------------------------------------------------------------- -RESOURCE REGISTRY_INFO theInfo - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = KUPnPAiwProviderDllUid; - interfaces = - { - - // ------------------------------------------------------------------- - // Menu services - // ------------------------------------------------------------------- - INTERFACE_INFO - { - interface_uid = KAiwClassMenu; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPAiwEnableExternalMenuServiceUid; - version_no = 2; - display_name = "EnableExternal"; - default_data = "*"; - opaque_data = KAiwCmdUPnPEnableExternalStr; - }, - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPAiwCopyToExternalMenuServiceUid; - version_no = 2; - display_name = "CopyToExternal"; - default_data = "*"; - opaque_data = KAiwCmdUPnPCopyStr; - }, - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPAiwMoveToExternalMenuServiceUid; - version_no = 2; - display_name = "MoveToExternal"; - default_data = "*"; - opaque_data = KAiwCmdUPnPMoveStr; - }, - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPAiwPlayOnExternalMenuServiceUid; - version_no = 2; - display_name = "PlayOnExternal"; - default_data = "*"; - opaque_data = KAiwCmdUPnPPlayStr; - } - }; - }, - - // ------------------------------------------------------------------- - // Base services - // ------------------------------------------------------------------- - INTERFACE_INFO - { - interface_uid = KAiwClassBase; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPAiwEnableExternalMenuServiceUid; - version_no = 2; - display_name = "EnableExternal"; - default_data = "*"; - opaque_data = KAiwCmdUPnPEnableExternalStr; - }, - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPAiwPlayOnExternalBaseServiceUid; - version_no = 2; - display_name = "PlayOnExternal"; - default_data = "*"; - opaque_data = KAiwCmdUPnPPlayStr; - }, - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPAiwOpenExternalBaseServiceUid; - version_no = 2; - display_name = "OpenExternal"; - default_data = "*"; - opaque_data = KAiwCmdUPnPOpenStr; - } - }; - } - }; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/data/upnpaiwmenuresources.rss --- a/upnpframework/upnpaiwprovider/data/upnpaiwmenuresources.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: AIW menu resource definitions for UpnpAiwProvider. -* -*/ - - -// RESOURCE IDENTIFIER -NAME UPAM - -// INCLUDES -#include -#include -#include - -// RESOURCE DEFINITIONS - -// -------------------------------------------------------------------------- -// R_AIW_ENABLE_EXTERNAL_MENU -// Menu item for the "Enable External" menu service. This menu item is shown, -// when the UPnP External screen is OFF (not active). -// -------------------------------------------------------------------------- -RESOURCE MENU_PANE r_aiw_enable_external_menu - { - items= - { - MENU_ITEM - { - command = KAiwCmdUPnPEnableExternal; - txt = qtn_iupnp_aiw_enable_external_string; - } - }; - } - -// -------------------------------------------------------------------------- -// R_AIW_DISABLE_EXTERNAL_MENU -// Menu item for the "Disable External" menu service. This menu item is shown, -// when the UPnP External screen is ON (active). -// -------------------------------------------------------------------------- -RESOURCE MENU_PANE r_aiw_disable_external_menu - { - items= - { - MENU_ITEM - { - command = KAiwCmdUPnPEnableExternal; - txt = qtn_iupnp_aiw_disable_external_string; - } - }; - } - -// -------------------------------------------------------------------------- -// R_AIW_COPY_TO_EXTERNAL_MENU -// Menu item for the "Copy to External" menu service. -// -------------------------------------------------------------------------- -RESOURCE MENU_PANE r_aiw_copy_to_external_menu - { - items= - { - MENU_ITEM - { - command = KAiwCmdUPnPCopy; - txt = qtn_iupnp_aiw_copy_to_external_string; - } - }; - } - -// -------------------------------------------------------------------------- -// R_AIW_MOVE_TO_EXTERNAL_MENU -// Menu item for the "Move to External" menu service. -// -------------------------------------------------------------------------- -RESOURCE MENU_PANE r_aiw_move_to_external_menu - { - items= - { - MENU_ITEM - { - command = KAiwCmdUPnPMove; - txt = qtn_iupnp_aiw_move_to_external_string; - } - }; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/group/bld.inf --- a/upnpframework/upnpaiwprovider/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2005-2007 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 info for the UpnpAiwProvider component -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// None - -PRJ_MMPFILES -upnpaiwprovider.mmp - -PRJ_TESTMMPFILES -// None - -PRJ_TESTEXPORTS -// None - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/group/upnpaiwprovider.mmp --- a/upnpframework/upnpaiwprovider/group/upnpaiwprovider.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2005-2007 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 specification file for UpnpAiwProvider -* -*/ - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" -#include "../inc/upnpaiwprovideruids.hrh" -#include - -// Build target -TARGET upnpaiwprovider.dll -CAPABILITY CAP_ECOM_PLUGIN -TARGETTYPE PLUGIN -UID 0x10009D8D KUPnPAiwProviderDllUid -VENDORID VID_DEFAULT - -// SIS installation + IAD support -VERSION 10.1 -paged - -SOURCEPATH ../data -START RESOURCE 10208a15.rss -HEADER -TARGET upnpaiwprovider.rsc -TARGETPATH resource/plugins -END - -SOURCEPATH ../data -START RESOURCE upnpaiwmenuresources.rss -HEADER -TARGET upnpaiwmenuresources.rsc -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -USERINCLUDE ../../../inc -USERINCLUDE ../../inc -USERINCLUDE ../inc -USERINCLUDE ../data -USERINCLUDE ../../upnpaiwengine/inc - -MW_LAYER_SYSTEMINCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT - -SOURCEPATH ../src -SOURCE upnpaiwprovider.cpp -SOURCE upnpaiwenableexternalservice.cpp -SOURCE upnpaiwcopytoexternalservice.cpp -SOURCE upnpaiwmovetoexternalservice.cpp -SOURCE upnpaiwopenexternalservice.cpp -SOURCE upnpaiwplayonexternalbaseservice.cpp -SOURCE upnpaiwplayonexternalmenuservice.cpp - -// Core -LIBRARY euser.lib - -// AIW and ECom -LIBRARY servicehandler.lib - -// UPnP -LIBRARY upnpaiwengine.lib - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/inc/upnpaiwcopytoexternalservice.h --- a/upnpframework/upnpaiwprovider/inc/upnpaiwcopytoexternalservice.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the UpnpAiwCopyToExternalService. -* -*/ - - -#ifndef _UPNP_AIW_COPY_TO_EXTERNAL_SERVICE_H -#define _UPNP_AIW_COPY_TO_EXTERNAL_SERVICE_H - -// INCLUDES -#include -#include "upnpaiwengineobserver.h" - -// FUNCTION PROTOTYPES -class CUPnPAiwEngine; -class CUpnpDrmFilter; - -// CLASS DECLARATION - -/** -* CUPnPAiwCopyToExternalService -* The class implements the "Copy to external" service of the -* UPnP AIW Media Provider. -* @since Series S60 3.0 -*/ -class CUPnPAiwCopyToExternalService : public CAiwServiceIfMenu, - public MUPnPAiwEngineObserver - { - - public: // Constructors and destructor - - // Two-phased constructor. - static CUPnPAiwCopyToExternalService* NewL(); - - // Destructor. - virtual ~CUPnPAiwCopyToExternalService(); - - public: // Methods from the CAiwServiceIfMenu - - // Unnecessary methods - void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/ ) {} - void HandleServiceCmdL( - const TInt& /*aCmdId*/, - const CAiwGenericParamList& /*aInParamList*/, - CAiwGenericParamList& /*aOutParamList*/, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/ ) {} - - /** - * Initialises menu pane by adding provider specific menu items. - * The AIW Framework gives the parameters to be used in addition. - * @param aMenuPane Menu pane handle - * @param aIndex position of item where to add menu items. - * @param aCascadeId ID of cascade menu item. - * @param aInParamList input parameter list for provider's parameters - * checking - */ - void InitializeMenuPaneL( CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt aCascadeId, - const CAiwGenericParamList& aInParamList); - - /** - * Handle a menu command invoked by the Handler. - * @param aMenuCmdId Command ID for the menu command, - * defined by the provider when adding the menu commands. - * @param aInParamList Input parameters, could be empty list - * @param aOutParamList Output parameters, could be empty list - * @param aCmdOptions Options for the command, see KAiwCmdOpt* - * constants. - * @param aCallback callback if asynchronous command handling is wanted - * by consumer. The provider may or may not support this, leaves - * with KErrNotSupported, it not. - */ - void HandleMenuCmdL( TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - public: // MUPnPAiwEngineObserver - - /** - * Indicates that the play operation is complete. - * - * @since Series 60 3.0 - * @param aStatus status information - * @return None - */ - void PlayCompleteL( TInt /*aStatus*/ ) {} - - /** - * Indicates that the connection with the target UPnP - * device has been lost. - * - * @since Series 60 3.0 - * @param None - * @return None - */ - void ConnectionLostL(); - - private: // private methods - - /** - * Deletes the contents of the iFileNames pointer array - * - * @since Series 60 3.0 - * @param None - * @returns None - */ - void EmptyFileNameArray(); - - - private: // construction - - // Constructor - CUPnPAiwCopyToExternalService(); - - // ConstructL - void ConstructL(); - - private: // Data members - - // reference to the engine component - CUPnPAiwEngine* iEngine; // not owned (singleton) - - // reference to the client (call back reference) - MAiwNotifyCallback* iClient; // not owned - - // The list of file names received as a parameter - RPointerArray iFileNames; // owned - - // The playlist name (if we are doing a playlist copy) - HBufC* iPlaylistName; // owned - }; - -#endif // _UPNP_AIW_COPY_TO_EXTERNAL_SERVICE_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/inc/upnpaiwenableexternalservice.h --- a/upnpframework/upnpaiwprovider/inc/upnpaiwenableexternalservice.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the UpnpAiwEnableExternalService. -* -*/ - - -#ifndef _UPNP_AIW_ENABLE_EXTERNAL_SERVICE_H -#define _UPNP_AIW_ENABLE_EXTERNAL_SERVICE_H - -// INCLUDES -#include - -// FUNCTION PROTOTYPES -class CUPnPAiwEngine; - -// CLASS DECLARATION - -/** -* CUPnPAiwEnableExternalService -* The class implements the "Enable external" service of the -* UPnP AIW Media Provider. -* @since Series S60 3.0 -*/ -class CUPnPAiwEnableExternalService : public CAiwServiceIfMenu - { - - public: // Constructors and destructor - - // Two-phased constructor. - static CUPnPAiwEnableExternalService* NewL(); - - // Destructor. - virtual ~CUPnPAiwEnableExternalService(); - - public: // Methods from the CAiwServiceIfMenu - - // Unnecessary method - void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/) {} - - /** - * Executes generic service commands included in criteria. - * @param aCmdId Command to be executed - * @param aInParamList Input parameters, can be an empty list - * @param aOutParamList Output parameters, can be an empty list - * @param aCmdOptions Options for the command, see KAiwCmdOpt* - * constants. - * @param aCallback callback for asynchronous command handling, - * parameter checking, etc. - * @see enum TServiceCmdOptions in GENERICPARAM.HRH - * @exception KErrArgument if callback is missing when required. - * @exception KErrNotSupported if no provider support service - */ - void HandleServiceCmdL( const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - /** - * Initialises menu pane by adding provider specific menu items. - * The AIW Framework gives the parameters to be used in addition. - * @param aMenuPane Menu pane handle - * @param aIndex position of item where to add menu items. - * @param aCascadeId ID of cascade menu item. - * @param aInParamList input parameter list for provider's parameters - * checking - */ - void InitializeMenuPaneL( CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt aCascadeId, - const CAiwGenericParamList& aInParamList); - - /** - * Handle a menu command invoked by the Handler. - * @param aMenuCmdId Command ID for the menu command, - * defined by the provider when adding the menu commands. - * @param aInParamList Input parameters, could be empty list - * @param aOutParamList Output parameters, could be empty list - * @param aCmdOptions Options for the command, see KAiwCmdOpt* - * constants. - * @param aCallback callback if asynchronous command handling is wanted - * by consumer. The provider may or may not support this, leaves - * with KErrNotSupported, it not. - */ - void HandleMenuCmdL( TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - private: // construction - - // Constructor - CUPnPAiwEnableExternalService(); - - // ConstructL - void ConstructL(); - - private: // Data members - - // reference to the engine component - CUPnPAiwEngine* iEngine; // not owned (singleton pointer) - - // reference to the client (call back reference) - MAiwNotifyCallback* iClient; // not owned - - }; - -#endif // _UPNP_AIW_ENABLE_EXTERNAL_SERVICE_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/inc/upnpaiwmovetoexternalservice.h --- a/upnpframework/upnpaiwprovider/inc/upnpaiwmovetoexternalservice.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the UpnpAiwMoveToExternalService. -* -*/ - - -#ifndef _UPNP_AIW_MOVE_TO_EXTERNAL_SERVICE_H -#define _UPNP_AIW_MOVE_TO_EXTERNAL_SERVICE_H - -// INCLUDES -#include -#include "upnpaiwengineobserver.h" - -// FUNCTION PROTOTYPES -class CUPnPAiwEngine; -class CUpnpDrmFilter; - -// CLASS DECLARATION - -/** -* CUPnPAiwMoveToExternalService -* The class implements the "Move to external" service of the -* UPnP AIW Media Provider. -* @since Series S60 3.0 -*/ -class CUPnPAiwMoveToExternalService : public CAiwServiceIfMenu, - public MUPnPAiwEngineObserver - { - - public: // Constructors and destructor - - // Two-phased constructor. - static CUPnPAiwMoveToExternalService* NewL(); - - // Destructor. - virtual ~CUPnPAiwMoveToExternalService(); - - public: // Methods from the CAiwServiceIfMenu - - // Unnecessary methods - void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/ ) {} - void HandleServiceCmdL( - const TInt& /*aCmdId*/, - const CAiwGenericParamList& /*aInParamList*/, - CAiwGenericParamList& /*aOutParamList*/, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/) {} - - /** - * Initialises menu pane by adding provider specific menu items. - * The AIW Framework gives the parameters to be used in addition. - * @param aMenuPane Menu pane handle - * @param aIndex position of item where to add menu items. - * @param aCascadeId ID of cascade menu item. - * @param aInParamList input parameter list for provider's parameters - * checking - */ - void InitializeMenuPaneL( CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt aCascadeId, - const CAiwGenericParamList& aInParamList); - - /** - * Handle a menu command invoked by the Handler. - * @param aMenuCmdId Command ID for the menu command, - * defined by the provider when adding the menu commands. - * @param aInParamList Input parameters, could be empty list - * @param aOutParamList Output parameters, could be empty list - * @param aCmdOptions Options for the command, see KAiwCmdOpt* - * constants. - * @param aCallback callback if asynchronous command handling is wanted - * by consumer. The provider may or may not support this, leaves - * with KErrNotSupported, it not. - */ - void HandleMenuCmdL( TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - public: // MUPnPAiwEngineObserver - - // Unnecessary callback method - void PlayCompleteL( TInt /*aStatus*/ ) {} - - /** - * Indicates that the connection with the target UPnP - * device has been lost. - * - * @since Series 60 3.0 - * @param None - * @return None - */ - void ConnectionLostL(); - - private: // private methods - - /** - * Deletes the contents of the iFileNames pointer array - * - * @since Series 60 3.0 - * @param None - * @returns None - */ - void EmptyFileNameArray(); - - - private: // construction - - // Constructor - CUPnPAiwMoveToExternalService(); - - // ConstructL - void ConstructL(); - - private: // Data members - - // reference to the engine component - CUPnPAiwEngine* iEngine; // not owned (singleton) - - // reference to the client (call back reference) - MAiwNotifyCallback* iClient; // not owned - - // The list of file names received as a parameter - RPointerArray iFileNames; // owned - }; - -#endif // _UPNP_AIW_MOVE_TO_EXTERNAL_SERVICE_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/inc/upnpaiwopenexternalservice.h --- a/upnpframework/upnpaiwprovider/inc/upnpaiwopenexternalservice.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the UpnpAiwOpenExternalService. -* -*/ - - -#ifndef _UPNP_AIW_OPEN_EXTERNAL_SERVICE_H -#define _UPNP_AIW_OPEN_EXTERNAL_SERVICE_H - -// INCLUDES -#include - -// FUNCTION PROTOTYPES -class CUPnPAiwEngine; - -// CLASS DECLARATION - -/** -* CUPnPAiwOpenExternalService -* The class implements the "Open external" service of the -* UPnP AIW Media Provider. -* @since Series S60 3.0 -*/ -class CUPnPAiwOpenExternalService : public CAiwServiceIfBase - { - - public: // Constructors and destructor - - // Two-phased constructor. - static CUPnPAiwOpenExternalService* NewL(); - - // Destructor. - virtual ~CUPnPAiwOpenExternalService(); - - public: // Methods from the CAiwServiceIfMenu - - // Unnecessary method - void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/) {} - - /** - * Executes generic service commands included in criteria. - * @param aCmdId Command to be executed - * @param aInParamList Input parameters, can be an empty list - * @param aOutParamList Output parameters, can be an empty list - * @param aCmdOptions Options for the command, see KAiwCmdOpt* - * constants. - * @param aCallback callback for asynchronous command handling, - * parameter - * checking, etc. - * @see enum TServiceCmdOptions in GENERICPARAM.HRH - * @exception KErrArgument if callback is missing when required. - * @exception KErrNotSupported if no provider support service - */ - void HandleServiceCmdL( const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - private: // construction - - // Constructor - CUPnPAiwOpenExternalService(); - - // ConstructL - void ConstructL(); - - private: // Data members - - // reference to the engine component - CUPnPAiwEngine* iEngine; // not owned (singleton) - - }; - -#endif // _UPNP_AIW_OPEN_EXTERNAL_SERVICE_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalbaseservice.h --- a/upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalbaseservice.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the UpnpAiwPlayOnExternalBaseService. -* -*/ - - -#ifndef _UPNP_AIW_PLAY_ON_EXTERNAL_BASE_SERVICE_H -#define _UPNP_AIW_PLAY_ON_EXTERNAL_BASE_SERVICE_H - -// INCLUDES -#include -#include "upnpaiwengineobserver.h" - -// FUNCTION PROTOTYPES -class CUPnPAiwEngine; -class CUpnpDrmFilter; - -// CLASS DECLARATION - -/** -* CUPnPAiwPlayOnExternalBaseService -* The class implements the "Play on external" base service of the -* UPnP AIW Media Provider. -* @since Series S60 3.0 -*/ -class CUPnPAiwPlayOnExternalBaseService : public CAiwServiceIfBase, - public MUPnPAiwEngineObserver - { - - public: // Constructors and destructor - - // Two-phased constructor. - static CUPnPAiwPlayOnExternalBaseService* NewL(); - - // Destructor. - virtual ~CUPnPAiwPlayOnExternalBaseService(); - - public: // Methods from the CAiwServiceIfBase - - // Unnecessary method - void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/ ) {} - - /** - * Executes generic service commands included in criteria. - * @param aCmdId Command to be executed - * @param aInParamList Input parameters, can be an empty list - * @param aOutParamList Output parameters, can be an empty list - * @param aCmdOptions Options for the command, see KAiwCmdOpt* - * constants. - * @param aCallback callback for asynchronous command handling, - * parameter checking, etc. - * @see enum TServiceCmdOptions in GENERICPARAM.HRH - * @exception KErrArgument if callback is missing when required. - * @exception KErrNotSupported if no provider support service - */ - void HandleServiceCmdL( const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - public: // MUPnPAiwEngineObserver - - /** - * Indicates that the play operation is complete. - * - * @since Series 60 3.0 - * @param aStatus status information - * @return None - */ - void PlayCompleteL( TInt aStatus ); - - /** - * Indicates that the connection with the target UPnP - * device has been lost. - * - * @since Series 60 3.0 - * @param None - * @return None - */ - void ConnectionLostL(); - - private: // private methods - - /** - * Deletes the contents of the iFileNames pointer array - * - * @since Series 60 3.0 - * @param None - * @returns None - */ - void EmptyFileNameArray(); - - - private: // construction - - // Constructor - CUPnPAiwPlayOnExternalBaseService(); - - // ConstructL - void ConstructL(); - - private: // Data members - - // reference to the engine component - CUPnPAiwEngine* iEngine; // not owned (singleton) - - // iActiveDrmFilter does the filtering DRM file work - CUpnpDrmFilter* iActiveDrmFilter; // owned - - // reference to the client (call back reference) - MAiwNotifyCallback* iClient; // not owned - - // The list of file names received as a parameter - RPointerArray iFileNames; // owned - - // Filename of the file that is played - HBufC16* iFileName; // owned - }; - -#endif // _UPNP_AIW_PLAY_ON_EXTERNAL_BASE_SERVICE_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalmenuservice.h --- a/upnpframework/upnpaiwprovider/inc/upnpaiwplayonexternalmenuservice.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Header file for the UpnpAiwPlayOnExternalMenuService. -* -*/ - - -#ifndef _UPNP_AIW_PLAY_ON_EXTERNAL_MENU_SERVICE_H -#define _UPNP_AIW_PLAY_ON_EXTERNAL_MENU_SERVICE_H - -// INCLUDES -#include -#include "upnpaiwengineobserver.h" - -// FUNCTION PROTOTYPES -class CUPnPAiwEngine; - -// CLASS DECLARATION - -/** -* CUPnPAiwPlayOnExternalMenuService -* The class implements the "Play on external" menu service of the -* UPnP AIW Media Provider. -* @since Series S60 3.0 -*/ -class CUPnPAiwPlayOnExternalMenuService : public CAiwServiceIfMenu, - public MUPnPAiwEngineObserver - { - - public: // Constructors and destructor - - // Two-phased constructor. - static CUPnPAiwPlayOnExternalMenuService* NewL(); - - // Destructor. - virtual ~CUPnPAiwPlayOnExternalMenuService(); - - public: // Methods from the CAiwServiceIfMenu - - // Unnecessary methods - void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/ ) {} - void HandleServiceCmdL( - const TInt& /*aCmdId*/, - const CAiwGenericParamList& /*aInParamList*/, - CAiwGenericParamList& /*aOutParamList*/, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/ ) {} - - /** - * Initialises menu pane by adding provider specific menu items. - * The AIW Framework gives the parameters to be used in addition. - * @param aMenuPane Menu pane handle - * @param aIndex position of item where to add menu items. - * @param aCascadeId ID of cascade menu item. - * @param aInParamList input parameter list for provider's parameters - * checking - */ - void InitializeMenuPaneL( CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt aCascadeId, - const CAiwGenericParamList& aInParamList); - - /** - * Handle a menu command invoked by the Handler. - * @param aMenuCmdId Command ID for the menu command, - * defined by the provider when adding the menu commands. - * @param aInParamList Input parameters, could be empty list - * @param aOutParamList Output parameters, could be empty list - * @param aCmdOptions Options for the command, see KAiwCmdOpt* - * constants. - * @param aCallback callback if asynchronous command handling is wanted - * by consumer.The provider may or may not support this, leaves - * with KErrNotSupported, it not. - */ - void HandleMenuCmdL( TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL); - - public: // MUPnPAiwEngineObserver - - /** - * Indicates that the play operation is complete. - * - * @since Series 60 3.0 - * @param aStatus status information - * @return None - */ - void PlayCompleteL( TInt aStatus ); - - /** - * Indicates that the connection with the target UPnP - * device has been lost. - * - * @since Series 60 3.0 - * @param None - * @return None - */ - void ConnectionLostL(); - - private: // private methods - - /** - * Deletes the contents of the iFileNames pointer array - * - * @since Series 60 3.0 - * @param None - * @returns None - */ - void EmptyFileNameArray(); - - private: // construction - - // Constructor - CUPnPAiwPlayOnExternalMenuService(); - - // ConstructL - void ConstructL(); - - private: // Data members - - // reference to the engine component - CUPnPAiwEngine* iEngine; // not owned (singleton) - - // reference to the client (call back reference) - MAiwNotifyCallback* iClient; // not owned - - // The list of file names received as a parameter - RPointerArray iFileNames; // owned - - // Filename of the file that is played - HBufC16* iFileName; // owned - }; - -#endif // _UPNP_AIW_PLAY_ON_EXTERNAL_MENU_SERVICE_H - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/inc/upnpaiwprovideruids.hrh --- a/upnpframework/upnpaiwprovider/inc/upnpaiwprovideruids.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Specifies the interface and DLL UIDs used in the Upnp - Framework's AIW Provider interface. -* -*/ - - -#ifndef _UPNP_AIW_PROVIDER_UIDS_HRH -#define _UPNP_AIW_PROVIDER_UIDS_HRH - -// The UPnP AIW Provider Interface UID -#define KUPnPAiwProviderDllUid 0x10208A15 - -// The implementation UID(s) -#define KUPnPAiwEnableExternalMenuServiceUid 0x10208A16 -#define KUPnPAiwCopyToExternalMenuServiceUid 0x10208A17 -#define KUPnPAiwMoveToExternalMenuServiceUid 0x10208A18 -#define KUPnPAiwPlayOnExternalMenuServiceUid 0x10208A19 -#define KUPnPAiwPlayOnExternalBaseServiceUid 0x10208A0C -#define KUPnPAiwOpenExternalBaseServiceUid 0x10208A0D - -#endif // _UPNP_AIW_PROVIDER_UIDS_HRH - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwcopytoexternalservice.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwcopytoexternalservice.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwCopyToExternalService -* -*/ - - -#include -#include -#include -#include -#include "upnpaiwengine.h" -#include "upnpaiwcopytoexternalservice.h" - -_LIT( KComponentLogfile, "upnpaiwprovider.log" ); -#include "upnplog.h" - -// CONSTANTS -_LIT( KResFileName, "\\resource\\upnpaiwmenuresources.rsc" ); - -// -------------------------------------------------------------------------- -// CUPnPAiwCopyToExternalService::NewL -// NewL. -// -------------------------------------------------------------------------- -CUPnPAiwCopyToExternalService* CUPnPAiwCopyToExternalService::NewL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::NewL" ); - - CUPnPAiwCopyToExternalService* self = - new (ELeave) CUPnPAiwCopyToExternalService; - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwCopyToExternalService::CUPnPAiwMoveToExternalService -// Constructor. -// -------------------------------------------------------------------------- -CUPnPAiwCopyToExternalService::CUPnPAiwCopyToExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\ -CUPnPAiwCopyToExternalService" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwCopyToExternalService::~CUPnPAiwCopyToExternalService -// Destructor. -// -------------------------------------------------------------------------- -CUPnPAiwCopyToExternalService::~CUPnPAiwCopyToExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\ -~CUPnPAiwCopyToExternalService" ); - - // Empty the file name array and close it - EmptyFileNameArray(); - iFileNames.Close(); - - // Delete the playlist name (if not yet deleted) - delete iPlaylistName; - - // Release the engine instance - if( iEngine ) - { - CUPnPAiwEngine::ReleaseInstance(); - iEngine = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwCopyToExternalService::ConstructL -// Second phase constructor. -// -------------------------------------------------------------------------- -void CUPnPAiwCopyToExternalService::ConstructL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\ -ConstructL" ); - - // Create the engine and register as an observer for call backs - iEngine = CUPnPAiwEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwCopyToExternalService::InitializeMenuPaneL -// AIW Framework's method for initialising the menu -// -------------------------------------------------------------------------- -void CUPnPAiwCopyToExternalService::InitializeMenuPaneL( - CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt /*aCascadeId*/, - const CAiwGenericParamList& /*aInParamList*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\ -InitializeMenuPaneL" ); - - // Update the drive letter to the path of the resource file name - TUPnPEngineState engineState = iEngine->EngineState(); - if( engineState == EUPnPEngineNotConnected || - engineState == EUPnPEngineConnectionLost ) - { - - TFileName resFile( KResFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' - resFile.Insert( 0, drive ); - - // Add the play menu item to the menu pane - aMenuPane.AddMenuItemsL( resFile, - R_AIW_COPY_TO_EXTERNAL_MENU, - KAiwCmdUPnPCopy, - aIndex ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwCopyToExternalService::HandleMenuCmdL -// AIW Framework's method for handling menu commands -// -------------------------------------------------------------------------- -void CUPnPAiwCopyToExternalService::HandleMenuCmdL( - TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwCopyToExternalService::\ -HandleMenuCmdL" ); - - // Empty the file name array - EmptyFileNameArray(); - - // The playlist name (if we are doing a playlist copy) - delete iPlaylistName; - iPlaylistName = NULL; - - // Get the file name parameters - if( aInParamList.Count() > 0 ) - { - for( TInt index = 0; index < aInParamList.Count(); index++ ) - { - // Get the filenames - if ( aInParamList[index].SemanticId() == EGenericParamFile ) - { - // Store the file name in the array - HBufC* fileName = HBufC::NewLC( - aInParamList[index].Value().AsDes().Length() ); - fileName->Des().Append( aInParamList[index].Value().AsDes() ); - iFileNames.AppendL( fileName ); - CleanupStack::Pop( fileName ); - } - // Get the playlist name if it is not set already (only the first - // playlist name will be used) - if( aInParamList[index].SemanticId() == EGenericParamAlbumName && - !iPlaylistName ) - { - iPlaylistName = HBufC::NewL( - aInParamList[index].Value().AsDes().Length() ); - iPlaylistName->Des().Append( - aInParamList[index].Value().AsDes() ); - } - } - } - - if( aMenuCmdId == KAiwCmdUPnPCopy ) - { - if( iEngine ) - { - if( iFileNames.Count()>0 ) - { - // Do the copy - TInt returnValue = KErrArgument; - if( iPlaylistName == NULL ) - { - // Normal copy - TRAP( returnValue, - iEngine->CopyToExternalL( iFileNames ) ); - } - else - { - // Playlist copy - TRAP( returnValue, - iEngine->CopyPlaylistToExternalL( - *iPlaylistName, - iFileNames ) ); - } - - // Do some error translation regarding DRM protected files - if ( returnValue == KErrNotSupported || - returnValue == KErrPermissionDenied ) - { - returnValue = KErrAccessDenied; - } - - // Add the return value on the out param list - TAiwGenericParam statusParameter( - EGenericParamError, - returnValue ); - aOutParamList.AppendL( statusParameter ); - - // Add the files that FAILED to copy to out param list. - // finally, reset the array. - for( TInt index=0; indexHandleNotifyL( KAiwCmdUPnPCopy, - eventCode, - *emptyParamlist, - *emptyParamlist ); - - // Clean up - CleanupStack::PopAndDestroy( emptyParamlist ); - emptyParamlist = NULL; - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwenableexternalservice.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwenableexternalservice.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwEnableExternalService -* -*/ - - -#include -#include -#include -#include -#include "upnpaiwengine.h" -#include "upnpaiwenableexternalservice.h" - -_LIT( KComponentLogfile, "upnpaiwprovider.log" ); -#include "upnplog.h" - -// CONSTANTS -_LIT( KResFileName, "\\resource\\upnpaiwmenuresources.rsc" ); - -// -------------------------------------------------------------------------- -// CUPnPAiwEnableExternalService::NewL -// NewL. -// -------------------------------------------------------------------------- -CUPnPAiwEnableExternalService* CUPnPAiwEnableExternalService::NewL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::NewL" ); - - CUPnPAiwEnableExternalService* self = - new (ELeave) CUPnPAiwEnableExternalService; - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEnableExternalService::CUPnPAiwEnableExternalService -// Constructor. -// -------------------------------------------------------------------------- -CUPnPAiwEnableExternalService::CUPnPAiwEnableExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\ -CUPnPAiwEnableExternalService" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEnableExternalService::~CUPnPAiwEnableExternalService -// Destructor. -// -------------------------------------------------------------------------- -CUPnPAiwEnableExternalService::~CUPnPAiwEnableExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\ -~CUPnPAiwEnableExternalService" ); - - // Release the engine instance - if( iEngine ) - { - - // If the UPnP is enabled, disable it - TInt engineState = KErrGeneral; - engineState = iEngine->EngineState(); - - if( engineState != EUPnPEngineNotConnected ) - { - iEngine->DisableExternal(); - } - - CUPnPAiwEngine::ReleaseInstance(); - iEngine = NULL; - } - - // Set the client call back reference to NULL - iClient = NULL; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEnableExternalService::ConstructL -// Second phase constructor. -// -------------------------------------------------------------------------- -void CUPnPAiwEnableExternalService::ConstructL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::ConstructL" ); - - // Create the engine and register as an observer for call backs - iEngine = CUPnPAiwEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEnableExternalService::HandleServiceCmdL -// AIW Framework's method for handling service commands -// -------------------------------------------------------------------------- -void CUPnPAiwEnableExternalService::HandleServiceCmdL( - const TInt& aCmdId, - const CAiwGenericParamList& /*aInParamList*/, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* aCallback ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\ -HandleServiceCmdL" ); - - // Cast the aCallback reference to non-const and store the reference - iClient = const_cast( aCallback ); - - if( aCmdId == KAiwCmdUPnPEnableExternal ) - { - - TInt status = KErrNone; - - if( iEngine ) - { - TInt engineState = KErrGeneral; - engineState = iEngine->EngineState(); - - if( engineState == EUPnPEngineNotConnected ) - { - TRAP( status, iEngine->EnableExternalL() ); - } - else - { - iEngine->DisableExternal(); - - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \ -send stopped event." ); - - // send STOPPED event - CAiwGenericParamList* emptyParamlist = - CAiwGenericParamList::NewLC(); - if( iClient ) - { - iClient->HandleNotifyL( KAiwCmdUPnPPlay, - KAiwEventStopped, - *emptyParamlist, - *emptyParamlist ); - } - CleanupStack::PopAndDestroy( emptyParamlist ); - emptyParamlist = NULL; - } - } - else - { - status = KErrDied; - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \ -engine is dead!" ); - } - - // Add the return value on the out param list - TAiwGenericParam statusParameter( EGenericParamError, status ); - aOutParamList.AppendL( statusParameter ); - - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEnableExternalService::InitializeMenuPaneL -// AIW Framework's method for initialising the menu -// -------------------------------------------------------------------------- -void CUPnPAiwEnableExternalService::InitializeMenuPaneL( - CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt /*aCascadeId*/, - const CAiwGenericParamList& /*aInParamList*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\ -InitializeMenuPaneL" ); - - // Update the drive letter to the path of the resource file name - TFileName resFile( KResFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' - resFile.Insert( 0, drive ); - - // Select the correct menu resource, depending on the state of Provider - if( iEngine ) - { - TUPnPEngineState engineState = iEngine->EngineState(); - if( engineState == EUPnPEngineNotConnected || - engineState == EUPnPEngineConnectionLost ) - { - aMenuPane.AddMenuItemsL( resFile, - R_AIW_ENABLE_EXTERNAL_MENU, - KAiwCmdUPnPEnableExternal, - aIndex ); - } - else - { - aMenuPane.AddMenuItemsL( resFile, - R_AIW_DISABLE_EXTERNAL_MENU, - KAiwCmdUPnPEnableExternal, - aIndex ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwEnableExternalService::HandleMenuCmdL -// AIW Framework's method for handling menu commands -// -------------------------------------------------------------------------- -void CUPnPAiwEnableExternalService::HandleMenuCmdL( - TInt aMenuCmdId, - const CAiwGenericParamList& /*aInParamList*/, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* aCallback ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService::\ -HandleMenuCmdL" ); - - // Cast the aCallback reference to non-const and store the reference - iClient = const_cast( aCallback ); - - TInt status = KErrNone; - - if( iEngine ) - { - TInt engineState = iEngine->EngineState(); - - if( aMenuCmdId == KAiwCmdUPnPEnableExternal ) - { - if( engineState == EUPnPEngineNotConnected ) - { - TRAP( status, iEngine->EnableExternalL() ); - } - else - { - iEngine->DisableExternal(); - - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \ -send stopped event." ); - - // send STOPPED event - CAiwGenericParamList* emptyParamlist = - CAiwGenericParamList::NewLC(); - if( iClient ) - { - iClient->HandleNotifyL( KAiwCmdUPnPPlay, - KAiwEventStopped, - *emptyParamlist, - *emptyParamlist ); - } - CleanupStack::PopAndDestroy( emptyParamlist ); - emptyParamlist = NULL; - } - } - } - else - { - status = KErrDied; - __LOG( "[UpnpAiwProvider]\t CUPnPAiwEnableExternalService, \ -engine is dead!" ); - } - - // Add the return value on the out param list - TAiwGenericParam statusParameter( EGenericParamError, status ); - aOutParamList.AppendL( statusParameter ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwmovetoexternalservice.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwmovetoexternalservice.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,267 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwMoveToExternalService -* -*/ - - -#include -#include -#include -#include -#include "upnpaiwengine.h" -#include "upnpaiwmovetoexternalservice.h" -#include "upnpdrmfilter.h" - -_LIT( KComponentLogfile, "upnpaiwprovider.log" ); -#include "upnplog.h" - -// CONSTANTS -_LIT( KResFileName, "\\resource\\upnpaiwmenuresources.rsc" ); - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::NewL -// NewL. -// -------------------------------------------------------------------------- -CUPnPAiwMoveToExternalService* CUPnPAiwMoveToExternalService::NewL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::NewL" ); - - CUPnPAiwMoveToExternalService* self = - new (ELeave) CUPnPAiwMoveToExternalService; - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::CUPnPAiwMoveToExternalService -// Constructor. -// -------------------------------------------------------------------------- -CUPnPAiwMoveToExternalService::CUPnPAiwMoveToExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -CUPnPAiwMoveToExternalService" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::~CUPnPAiwMoveToExternalService -// Destructor. -// -------------------------------------------------------------------------- -CUPnPAiwMoveToExternalService::~CUPnPAiwMoveToExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -~CUPnPAiwMoveToExternalService" ); - - // Empty the file name array and close it - EmptyFileNameArray(); - iFileNames.Close(); - - // Release the engine instance - if( iEngine ) - { - CUPnPAiwEngine::ReleaseInstance(); - iEngine = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::ConstructL -// Second phase constructor. -// -------------------------------------------------------------------------- -void CUPnPAiwMoveToExternalService::ConstructL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::ConstructL" ); - - // Create the engine and register as an observer for call backs - iEngine = CUPnPAiwEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::InitializeMenuPaneL -// AIW Framework's method for initialising the menu -// -------------------------------------------------------------------------- -void CUPnPAiwMoveToExternalService::InitializeMenuPaneL( - CAiwMenuPane& aMenuPane, - TInt aIndex, - TInt /*aCascadeId*/, - const CAiwGenericParamList& /*aInParamList*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -InitializeMenuPaneL" ); - - TUPnPEngineState engineState = iEngine->EngineState(); - if( engineState == EUPnPEngineNotConnected || - engineState == EUPnPEngineConnectionLost ) - { - // Update the drive letter to the path of the resource file name - TFileName resFile( KResFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' - resFile.Insert( 0, drive ); - - // Add the play menu item to the menu pane - aMenuPane.AddMenuItemsL( resFile, - R_AIW_MOVE_TO_EXTERNAL_MENU, - KAiwCmdUPnPMove, - aIndex ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwMoveToExternalService::HandleMenuCmdL -// AIW Framework's method for handling menu commands -// -------------------------------------------------------------------------- -void CUPnPAiwMoveToExternalService::HandleMenuCmdL( - TInt aMenuCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwMoveToExternalService::\ -HandleMenuCmdL" ); - - // Empty the file name array - EmptyFileNameArray(); - - // Get the file name parameters - if( aInParamList.Count() > 0 ) - { - for( TInt index = 0; index < aInParamList.Count(); index++ ) - { - // Get the filenames - if ( aInParamList[index].SemanticId() == EGenericParamFile ) - { - // Store the file name in the array - HBufC* fileName = HBufC::NewLC( - aInParamList[index].Value().AsDes().Length() ); - fileName->Des().Append( - aInParamList[index].Value().AsDes() ); - iFileNames.AppendL( fileName ); - CleanupStack::Pop( fileName ); - } - } - } - - if( aMenuCmdId == KAiwCmdUPnPMove ) - { - if( iEngine ) - { - if( iFileNames.Count()>0 ) - { - // Do the move - TInt returnValue = KErrArgument; - TRAP( returnValue, - iEngine->MoveToExternalL( iFileNames ) ); - - // Do some error translation regarding DRM protected files - if ( returnValue == KErrNotSupported || - returnValue == KErrPermissionDenied ) - { - returnValue = KErrAccessDenied; - } - - // Add the return value on the out param list - TAiwGenericParam statusParameter( - EGenericParamError, - returnValue ); - aOutParamList.AppendL( statusParameter ); - - // Add the files that FAILED to copy to out param list. - // finally, reset the array. - for( TInt index=0; indexHandleNotifyL( KAiwCmdUPnPMove, - eventCode, - *emptyParamlist, - *emptyParamlist ); - - // Clean up - CleanupStack::PopAndDestroy( emptyParamlist ); - emptyParamlist = NULL; - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwopenexternalservice.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwopenexternalservice.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwOpenExternalService -* -*/ - - -#include -#include -#include -#include "upnpaiwengine.h" -#include "upnpaiwopenexternalservice.h" - -_LIT( KComponentLogfile, "upnpaiwprovider.log" ); -#include "upnplog.h" - -// -------------------------------------------------------------------------- -// CUPnPAiwOpenExternalService::NewL -// NewL. -// -------------------------------------------------------------------------- -CUPnPAiwOpenExternalService* CUPnPAiwOpenExternalService::NewL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::NewL" ); - - CUPnPAiwOpenExternalService* self = - new (ELeave) CUPnPAiwOpenExternalService; - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService -// Constructor. -// -------------------------------------------------------------------------- -CUPnPAiwOpenExternalService::CUPnPAiwOpenExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ -CUPnPAiwOpenExternalService" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService -// Destructor. -// -------------------------------------------------------------------------- -CUPnPAiwOpenExternalService::~CUPnPAiwOpenExternalService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ -~CUPnPAiwOpenExternalService" ); - - // Release the engine instance - if( iEngine ) - { - CUPnPAiwEngine::ReleaseInstance(); - iEngine = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwOpenExternalService::ConstructL -// Second phase constructor. -// -------------------------------------------------------------------------- -void CUPnPAiwOpenExternalService::ConstructL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ -ConstructL" ); - - // Create the engine - iEngine = CUPnPAiwEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwOpenExternalService::HandleServiceCmdL -// AIW Framework's method for handling service commands -// -------------------------------------------------------------------------- -void CUPnPAiwOpenExternalService::HandleServiceCmdL( - const TInt& aCmdId, - const CAiwGenericParamList& /*aInParamList*/, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/ ) - { - // Process the command only if the id matches - if( aCmdId == KAiwCmdUPnPOpen ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService::\ -HandleServiceCmdL" ); - - TInt returnValue = KErrNone; - - if( iEngine ) - { - TRAP( returnValue, - iEngine->OpenExternalMediaL() ); - } - else - { - returnValue = KErrDied; - __LOG( "[UpnpAiwProvider]\t CUPnPAiwOpenExternalService, \ -engine is dead!" ); - } - - // Add the return value on the out param list - TAiwGenericParam statusParameter( - EGenericParamError, - returnValue ); - aOutParamList.AppendL( statusParameter ); - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalbaseservice.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalbaseservice.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,339 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwPlayOnExternalBaseService -* -*/ - - -#include -#include -#include -#include "upnpaiwengine.h" -#include "upnpaiwplayonexternalbaseservice.h" -#include "upnpdrmfilter.h" - -_LIT( KComponentLogfile, "upnpaiwprovider.log" ); -#include "upnplog.h" - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalBaseService::NewL -// NewL. -// -------------------------------------------------------------------------- -CUPnPAiwPlayOnExternalBaseService* CUPnPAiwPlayOnExternalBaseService::NewL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::NewL" ); - - CUPnPAiwPlayOnExternalBaseService* self = - new (ELeave) CUPnPAiwPlayOnExternalBaseService; - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalBaseService::CUPnPAiwPlayOnExternalBaseService -// Constructor. -// -------------------------------------------------------------------------- -CUPnPAiwPlayOnExternalBaseService::CUPnPAiwPlayOnExternalBaseService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\ -CUPnPAiwPlayOnExternalBaseService" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalBaseService::~CUPnPAiwPlayOnExternalBaseService -// Destructor. -// -------------------------------------------------------------------------- -CUPnPAiwPlayOnExternalBaseService::~CUPnPAiwPlayOnExternalBaseService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\ -~CUPnPAiwPlayOnExternalBaseService" ); - - // Empty the file name array and close it - EmptyFileNameArray(); - iFileNames.Close(); - - // Delete the filename of the file that is played - delete iFileName; - iFileName = NULL; - - // Set the client call back reference to NULL - iClient = NULL; - - // Release the engine instance - if( iEngine ) - { - CUPnPAiwEngine::ReleaseInstance(); - iEngine = NULL; - } - - // Release the DRM filter AO - delete iActiveDrmFilter; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalBaseService::ConstructL -// Second phase constructor. -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalBaseService::ConstructL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\ -ConstructL" ); - - // Create the engine and register as an observer for call backs - iEngine = CUPnPAiwEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalBaseService::HandleServiceCmdL -// AIW Framework's method for handling service commands -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalBaseService::HandleServiceCmdL( - const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* aCallback ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\ -HandleServiceCmdL" ); - - // Cast the aCallback reference to non-const and store the reference - iClient = const_cast(aCallback); - - // Empty the file name array - EmptyFileNameArray(); - - // Get the file name parameters - if( aInParamList.Count() > 0 ) - { - for( TInt index = 0; index < aInParamList.Count(); index++ ) - { - if ( aInParamList[index].SemanticId() == EGenericParamFile ) - { - // Store the file name in the array - HBufC* fileName = HBufC::NewLC( - aInParamList[index].Value().AsDes().Length() ); - fileName->Des().Append( - aInParamList[index].Value().AsDes() ); - iFileNames.AppendL( fileName ); - CleanupStack::Pop( fileName ); - } - } - } - - // Process the command only if the command ID matches - if( aCmdId == KAiwCmdUPnPPlay ) - { - if( iEngine ) - { - if( iFileNames.Count() == 1 ) - { - - // Filter out the DRM protected files - RPointerArray drmFiles; - - iActiveDrmFilter = CUpnpDrmFilter::NewL( iFileNames, - drmFiles ); - - iActiveDrmFilter->FilterDrmL(); - - TInt returnValue = KErrArgument; - if( iFileNames.Count() == 1 ) - { - // Delete and reallocate the filename of the file that is - // going to be played - delete iFileName; iFileName = NULL; - iFileName = iFileNames[0]->AllocL(); - - // Register to observe the Engine call backs and then call - // Play on UPnP AIW Engine - iEngine->SetEngineObserver( this ); - TRAP( returnValue, iEngine->PlayL( *iFileNames[0] ) ); - } - - // If there were DRM protected files, return code is - // KErrAccessDenied - if( drmFiles.Count() > 0 ) - { - returnValue = KErrAccessDenied; - } - - // Add the return value on the out param list - TAiwGenericParam statusParameter( - EGenericParamError, - returnValue ); - aOutParamList.AppendL( statusParameter ); - - // Add the drm protected files into the outparameter list - for( TInt index=0; indexAppendL( fileParameter ); - - // Convert the error code into AIW event code - TInt eventCode; - if( aStatus == KErrNone ) - { - eventCode = KAiwEventCompleted; - } - else - { - eventCode = KAiwEventError; - } - - // Make the call back - iClient->HandleNotifyL( KAiwCmdUPnPPlay, - eventCode, - *eventParamList, - *inParamList ); - - // Clean up - CleanupStack::PopAndDestroy( inParamList ); - inParamList = NULL; - CleanupStack::PopAndDestroy( eventParamList ); - eventParamList = NULL; - delete iFileName; - iFileName = NULL; - - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalBaseService::ConnectionLostL -// Indicates that the connection with the target UPnP device has -// been lost. -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalBaseService::ConnectionLostL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalBaseService::\ -ConnectionLostL" ); - - // If there is a client that has registered as an observer - if( iClient ) - { - // Create parameter lists - CAiwGenericParamList* emptyParamlist = CAiwGenericParamList::NewLC(); - - TInt eventCode = KAiwEventStopped; - - // Make the call back - iClient->HandleNotifyL( KAiwCmdUPnPPlay, - eventCode, - *emptyParamlist, - *emptyParamlist ); - - // Clean up - CleanupStack::PopAndDestroy( emptyParamlist ); - emptyParamlist = NULL; - if( iEngine ) - { - iEngine->RemoveEngineObserver(); - } - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalmenuservice.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwplayonexternalmenuservice.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwPlayOnExternalMenuService -* -*/ - - -#include -#include -#include -#include "upnpaiwengine.h" -#include "upnpaiwplayonexternalmenuservice.h" - -_LIT( KComponentLogfile, "upnpaiwprovider.log" ); -#include "upnplog.h" - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::NewL -// NewL. -// -------------------------------------------------------------------------- -CUPnPAiwPlayOnExternalMenuService* CUPnPAiwPlayOnExternalMenuService::NewL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::NewL" ); - - CUPnPAiwPlayOnExternalMenuService* self = - new (ELeave) CUPnPAiwPlayOnExternalMenuService; - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::CUPnPAiwPlayOnExternalMenuService -// Constructor. -// -------------------------------------------------------------------------- -CUPnPAiwPlayOnExternalMenuService::CUPnPAiwPlayOnExternalMenuService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\ -CUPnPAiwPlayOnExternalMenuService" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::~CUPnPAiwPlayOnExternalMenuService -// Destructor. -// -------------------------------------------------------------------------- -CUPnPAiwPlayOnExternalMenuService::~CUPnPAiwPlayOnExternalMenuService() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\ -~CUPnPAiwPlayOnExternalMenuService" ); - - // Empty the file name array and close it - EmptyFileNameArray(); - iFileNames.Close(); - - // Delete the filename of the file that is played - delete iFileName; - iFileName = NULL; - - // Set the client call back reference to NULL - iClient = NULL; - - // Release the engine instance - if( iEngine ) - { - CUPnPAiwEngine::ReleaseInstance(); - iEngine = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::ConstructL -// Second phase constructor. -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalMenuService::ConstructL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\ -ConstructL" ); - - // Create the engine and register as an observer for call backs - iEngine = CUPnPAiwEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::InitializeMenuPaneL -// AIW Framework's method for initialising the menu -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalMenuService::InitializeMenuPaneL( - CAiwMenuPane& /*aMenuPane*/, - TInt /*aIndex*/, - TInt /*aCascadeId*/, - const CAiwGenericParamList& /*aInParamList*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\ -InitializeMenuPaneL" ); - - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService, \ -supported anymore (after Upnp Fw 2.0)!" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::HandleMenuCmdL -// AIW Framework's method for handling menu commands -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalMenuService::HandleMenuCmdL( - TInt /*aMenuCmdId*/, - const CAiwGenericParamList& /*aInParamList*/, - CAiwGenericParamList& /*aOutParamList*/, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* /*aCallback*/ ) - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\ -HandleMenuCmdL" ); - - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService, \ -supported anymore (after Upnp Fw 2.0)!" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::EmptyFileNameArray -// Empties the file name array (data member variable). -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalMenuService::EmptyFileNameArray() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\ -EmptyFileNameArray" ); - - // delete the list of file names and close the file name array - for( TInt index=0; indexAppendL( fileParameter ); - - // Convert the error code into AIW event code - TInt eventCode; - if( aStatus == KErrNone ) - { - eventCode = KAiwEventCompleted; - } - else - { - eventCode = KAiwEventError; - } - - // Make the call back - iClient->HandleNotifyL( KAiwCmdUPnPPlay, - eventCode, - *eventParamList, - *inParamList ); - - // Clean up - CleanupStack::PopAndDestroy( inParamList ); - inParamList = NULL; - CleanupStack::PopAndDestroy( eventParamList ); - eventParamList = NULL; - delete iFileName; - iFileName = NULL; - - // Stop observing the AIW Engine - if( iEngine ) - { - iEngine->RemoveEngineObserver(); - } - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAiwPlayOnExternalMenuService::ConnectionLostL -// Indicates that the connection with the target UPnP device has -// been lost. -// -------------------------------------------------------------------------- -void CUPnPAiwPlayOnExternalMenuService::ConnectionLostL() - { - __LOG( "[UpnpAiwProvider]\t CUPnPAiwPlayOnExternalMenuService::\ -ConnectionLostL" ); - - // If there is a client that has registered as an observer - if( iClient ) - { - // Create parameter lists - CAiwGenericParamList* emptyParamlist = CAiwGenericParamList::NewLC(); - - TInt eventCode = KAiwEventStopped; - - // Make the call back - iClient->HandleNotifyL( KAiwCmdUPnPPlay, - eventCode, - *emptyParamlist, - *emptyParamlist ); - - // Clean up - CleanupStack::PopAndDestroy( emptyParamlist ); - emptyParamlist = NULL; - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpaiwprovider/src/upnpaiwprovider.cpp --- a/upnpframework/upnpaiwprovider/src/upnpaiwprovider.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Implementation of the UpnpAiwProvider. -* -*/ - - -#include -#include "upnpaiwprovideruids.hrh" -#include "upnpaiwenableexternalservice.h" -#include "upnpaiwcopytoexternalservice.h" -#include "upnpaiwmovetoexternalservice.h" -#include "upnpaiwplayonexternalbaseservice.h" -#include "upnpaiwplayonexternalmenuservice.h" -#include "upnpaiwopenexternalservice.h" - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwEnableExternalMenuServiceUid, - CUPnPAiwEnableExternalService::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwCopyToExternalMenuServiceUid, - CUPnPAiwCopyToExternalService::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwMoveToExternalMenuServiceUid, - CUPnPAiwMoveToExternalService::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwPlayOnExternalMenuServiceUid, - CUPnPAiwPlayOnExternalMenuService::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwPlayOnExternalBaseServiceUid, - CUPnPAiwPlayOnExternalBaseService::NewL), - IMPLEMENTATION_PROXY_ENTRY(KUPnPAiwOpenExternalBaseServiceUid, - CUPnPAiwOpenExternalService::NewL) - }; - -// -------------------------------------------------------------------------- -// Exported proxy for instantiation method resolution -// -------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/BWINS/upnpcommonuiu.def --- a/upnpframework/upnpcommonui/BWINS/upnpcommonuiu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -EXPORTS - ?DismissDialogL@CUPnPCommonUI@@QAEXH@Z @ 1 NONAME ; void CUPnPCommonUI::DismissDialogL(int) - ?GetUpperMostItem@CUPnPBrowseCacheItem@@QBEHXZ @ 2 NONAME ; int CUPnPBrowseCacheItem::GetUpperMostItem(void) const - ??1CUPnPCommonUI@@UAE@XZ @ 3 NONAME ; CUPnPCommonUI::~CUPnPCommonUI(void) - ?SelectDeviceL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@AAVCUpnpAVDevice@@W4TUPnPDeviceTypesToSearch@@W4TUPnPDialogTitle@@@Z @ 4 NONAME ; int CUPnPCommonUI::SelectDeviceL(class MUPnPAVController &, class CUpnpAVDevice &, enum TUPnPDeviceTypesToSearch, enum TUPnPDialogTitle) - ?SetFirstItem@CUPnPBrowseCacheItem@@QAEXH@Z @ 5 NONAME ; void CUPnPBrowseCacheItem::SetFirstItem(int) - ??1CUPnPBrowseDialog@@UAE@XZ @ 6 NONAME ; CUPnPBrowseDialog::~CUPnPBrowseDialog(void) - ?NewL@CUPnPNaviPaneContainer@@SAPAV1@ABVTRect@@VTPoint@@PAVCAknNavigationControlContainer@@@Z @ 7 NONAME ; class CUPnPNaviPaneContainer * CUPnPNaviPaneContainer::NewL(class TRect const &, class TPoint, class CAknNavigationControlContainer *) - ?GetItem@CUPnPBrowseCacheItem@@QAEPBVCUpnpObject@@H@Z @ 8 NONAME ; class CUpnpObject const * CUPnPBrowseCacheItem::GetItem(int) - ?GetHighlightedItem@CUPnPBrowseCacheItem@@QBEHXZ @ 9 NONAME ; int CUPnPBrowseCacheItem::GetHighlightedItem(void) const - ?ContainerId@CUPnPBrowseCacheItem@@QBEABVHBufC8@@XZ @ 10 NONAME ; class HBufC8 const & CUPnPBrowseCacheItem::ContainerId(void) const - ?ExecuteBrowseDialogL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@ABVCUpnpAVDevice@@@Z @ 11 NONAME ; int CUPnPCommonUI::ExecuteBrowseDialogL(class MUPnPAVController &, class CUpnpAVDevice const &) - ?ExecuteDeviceDialogL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@@Z @ 12 NONAME ; int CUPnPCommonUI::ExecuteDeviceDialogL(class MUPnPAVController &) - ?NewL@CUPnPCommonUI@@SAPAV1@XZ @ 13 NONAME ; class CUPnPCommonUI * CUPnPCommonUI::NewL(void) - ?PlayL@CUPnPLocalPlayer@@QAEXABVCUpnpObject@@@Z @ 14 NONAME ; void CUPnPLocalPlayer::PlayL(class CUpnpObject const &) - ?DisplayConnectionErrorNoteL@CUPnPCommonUI@@QAEXXZ @ 15 NONAME ; void CUPnPCommonUI::DisplayConnectionErrorNoteL(void) - ?NewL@CUPnPBrowseDialog@@SAPAV1@HAAVMUPnPAVController@@ABVCUpnpAVDevice@@AAVCUPnPCommonUI@@@Z @ 16 NONAME ; class CUPnPBrowseDialog * CUPnPBrowseDialog::NewL(int, class MUPnPAVController &, class CUpnpAVDevice const &, class CUPnPCommonUI &) - ?NewL@CUPnPLocalPlayer@@SAPAV1@AAVMUPnPAVController@@AAVMUPnPAVBrowsingSession@@AAVCUPnPCommonUI@@@Z @ 17 NONAME ; class CUPnPLocalPlayer * CUPnPLocalPlayer::NewL(class MUPnPAVController &, class MUPnPAVBrowsingSession &, class CUPnPCommonUI &) - ?ExecuteVideoPlayerL@CUPnPCommonUI@@QAEHAAVMUPnPAVRenderingSession@@ABVCUpnpObject@@@Z @ 18 NONAME ; int CUPnPCommonUI::ExecuteVideoPlayerL(class MUPnPAVRenderingSession &, class CUpnpObject const &) - ?ExecuteMusicPlayerL@CUPnPCommonUI@@QAEHAAVMUPnPAVController@@PAVCUPnPPlayListFiller@@PBVCUpnpAVDevice@@@Z @ 19 NONAME ; int CUPnPCommonUI::ExecuteMusicPlayerL(class MUPnPAVController &, class CUPnPPlayListFiller *, class CUpnpAVDevice const *) - ?NewL@CUPnPBrowseCacheItem@@SAPAV1@ABVTDesC8@@HH@Z @ 20 NONAME ; class CUPnPBrowseCacheItem * CUPnPBrowseCacheItem::NewL(class TDesC8 const &, int, int) - ?SetHighLightedItem@CUPnPBrowseCacheItem@@QAEXH@Z @ 21 NONAME ; void CUPnPBrowseCacheItem::SetHighLightedItem(int) - ??1CUPnPBrowseCacheItem@@UAE@XZ @ 22 NONAME ; CUPnPBrowseCacheItem::~CUPnPBrowseCacheItem(void) - ?SetItemArrayL@CUPnPBrowseCacheItem@@QAEXABV?$RPointerArray@VCUpnpObject@@@@@Z @ 23 NONAME ; void CUPnPBrowseCacheItem::SetItemArrayL(class RPointerArray const &) - ?GetNumberOfItems@CUPnPBrowseCacheItem@@QBEHXZ @ 24 NONAME ; int CUPnPBrowseCacheItem::GetNumberOfItems(void) const - ?DisplayConnectionLostCopyErrorNoteL@CUPnPCommonUI@@QAEXXZ @ 25 NONAME ; void CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL(void) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/EABI/upnpcommonuiu.def --- a/upnpframework/upnpcommonui/EABI/upnpcommonuiu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -EXPORTS - _ZN13CUPnPCommonUI13SelectDeviceLER17MUPnPAVControllerR13CUpnpAVDevice24TUPnPDeviceTypesToSearch16TUPnPDialogTitle @ 1 NONAME - _ZN13CUPnPCommonUI14DismissDialogLEi @ 2 NONAME - _ZN13CUPnPCommonUI19ExecuteMusicPlayerLER17MUPnPAVControllerP19CUPnPPlayListFillerPK13CUpnpAVDevice @ 3 NONAME - _ZN13CUPnPCommonUI19ExecuteVideoPlayerLER23MUPnPAVRenderingSessionRK11CUpnpObject @ 4 NONAME - _ZN13CUPnPCommonUI20ExecuteBrowseDialogLER17MUPnPAVControllerRK13CUpnpAVDevice @ 5 NONAME - _ZN13CUPnPCommonUI20ExecuteDeviceDialogLER17MUPnPAVController @ 6 NONAME - _ZN13CUPnPCommonUI27DisplayConnectionErrorNoteLEv @ 7 NONAME - _ZN13CUPnPCommonUI35DisplayConnectionLostCopyErrorNoteLEv @ 8 NONAME - _ZN13CUPnPCommonUI4NewLEv @ 9 NONAME - _ZN13CUPnPCommonUID0Ev @ 10 NONAME - _ZN13CUPnPCommonUID1Ev @ 11 NONAME - _ZN13CUPnPCommonUID2Ev @ 12 NONAME - _ZN16CUPnPLocalPlayer4NewLER17MUPnPAVControllerR22MUPnPAVBrowsingSessionR13CUPnPCommonUI @ 13 NONAME - _ZN16CUPnPLocalPlayer5PlayLERK11CUpnpObject @ 14 NONAME - _ZN20CUPnPBrowseCacheItem12SetFirstItemEi @ 15 NONAME - _ZN20CUPnPBrowseCacheItem13SetItemArrayLERK13RPointerArrayI11CUpnpObjectE @ 16 NONAME - _ZN20CUPnPBrowseCacheItem18SetHighLightedItemEi @ 17 NONAME - _ZN20CUPnPBrowseCacheItem4NewLERK6TDesC8ii @ 18 NONAME - _ZN20CUPnPBrowseCacheItem7GetItemEi @ 19 NONAME - _ZN22CUPnPNaviPaneContainer4NewLERK5TRect6TPointP30CAknNavigationControlContainer @ 20 NONAME - _ZNK20CUPnPBrowseCacheItem11ContainerIdEv @ 21 NONAME - _ZNK20CUPnPBrowseCacheItem16GetNumberOfItemsEv @ 22 NONAME - _ZNK20CUPnPBrowseCacheItem16GetUpperMostItemEv @ 23 NONAME - _ZNK20CUPnPBrowseCacheItem18GetHighlightedItemEv @ 24 NONAME - _ZTI13CUPnPCommonUI @ 25 NONAME - _ZTI16CUPnPLocalPlayer @ 26 NONAME - _ZTI17CUPnPBrowseDialog @ 27 NONAME - _ZTI20CUPnPBrowseCacheItem @ 28 NONAME - _ZTI22CUPnPNaviPaneContainer @ 29 NONAME - _ZTI27CCustomCtrlDlgCustomControl @ 30 NONAME - _ZTI6CImage @ 31 NONAME - _ZTV13CUPnPCommonUI @ 32 NONAME - _ZTV16CUPnPLocalPlayer @ 33 NONAME - _ZTV17CUPnPBrowseDialog @ 34 NONAME - _ZTV20CUPnPBrowseCacheItem @ 35 NONAME - _ZTV22CUPnPNaviPaneContainer @ 36 NONAME - _ZTV27CCustomCtrlDlgCustomControl @ 37 NONAME - _ZTV6CImage @ 38 NONAME - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,527 +0,0 @@ - - - - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - 2005-08-31T11:03:11Z - 2005-08-31T11:03:17Z - Illustrator - - - - JPEG - 256 - 208 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgA0AEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F XYqp3FzbW0RluJUhiHWSRgqj6TQYql8fmryvK/pxaxYvIDQotzETXp0DYqmMNxBMvKGRZV/mRgw3 +WKr8VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdiqSa x5dvNRQhdd1CyX+W2MEY/wCCEXP/AIbFWCan+Rkl8/rnzFPNIRUPcx+sTX/L9QYKVJ5fyE12M1g1 G1l8PUEkf6lkxpUP/wAqh85WrcooopWHRoplU/8AD8MaVExeX/zIsPsi/jp/vmZmH/JNj4YqjIta /MGz/vZrxKf7/iLf8nFPjiqOtvPvmlNpJY5SNjzjUH/heOKprb/mHqx/vrWBv9Tmv6y2NqmMHn0N T1bEr7rJX8CoxtUfF5y05/tRTIfkpH/EsKouPzHpL/7tK/6yt/AHFUSmqac/2bhPpPH9dMVV0mhf 7Eit8iDiq/FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXnHm2NNZuri01DlLaRyM i2/N1j+BqAlVIBPucyYRADWSxuLyPo8H+8Ml3YeBtrmVKfezZKkIyLSvMtuP9D81aolOn1iRbkf8 OMHAFsouK+/M63/u9ftr2nQXVmkf3mEg4PDCeIoqPzh+Z0H9/p2lXoHa3kmhY/8AIzkK5HwgnjRK fmX5ki/3u8o3CgdWtbmG4r7haIfoweEvGqH81vLzgDUtF1S07E3FlyX6Cheo3yJxFPEHRef/AMpL s8TdW0Un7SzW8kDA7dSyJ+vI+GU8QTK2k/Lm+p9Uv7KRj2iulLf8Dz/hg4Sto8eVNJdQ8MknE9Cr Ky/qwJWnypEPsXBH+stf1EYq1/hudfsyofnUf1xV36EvF7K3yP8AWmKr0sb2PorD/VP9DiqqpvU6 tIPnX+OKqyXVyOrV+YGKqy3U3cA4qqLct3XFV4mB7HFVwkU4q3yGKt1GKuxV2KuxV2KuxV2KuxV2 KuxV2KvPNTH+5O7/AOM8n/EzmVHkGo80PJJHDE8sh4xxqXdtzRVFSdskhi0H5u/lpJcPbHzDaQzR sUdLhmgowNCKyhBkeIJosg0/zP5Z1Cn1DV7K8r09C4ilr/wDHDYRScKMKqijCqooxV0lrbzjjNEk q+DqGH44qgJ/JvlS5/vtItCT1ZYUQ/eoB7Yqgx+WnlJWL2ttLZyHq9tcTRn/AInT8MaVVXyZfQb2 PmfWbfwR7n1ox16LIp8fHI8ATZVBZfmNbf7z+a1uFH2YrqxhPj1kQq2ROILxFeutfmtbfaTRr5B4 fWIJD/xJMHhBPGqJ5+87QbXnlL1VHWW1vYm+6N1VvxyPgp41VPzXt49r7y9rFqf2nFsJox0/aR/f wweEU8StF+b/AJAchZ797SQ/7rubeeM9u/Ar38cj4ZTxBNbXzv5Hu6ehrVgzHopnjRv+BYq2DhK2 nEEllcJzt5ElT+aNgw/AnIpVfSXFXemMVb44q6mKt0xV2KuxV2KuxV2KuxV2KuxV2KvP9SH+5K7/ AOM0n/EzmVHkGo80v1Uf7ib3/jBL/wAQOSQ+O9KsbW78w+YBPCkwW4WgkUNSrP4j2zO7MxxkZ8QB 5fpdb2pklHhokc/0JlJ5T0OX7Vmg/wBWqf8AESM2UtDhP8IdbHXZh/EVW10F7Kn6N1G/06n2fqt1 JHT5bnKT2ZiPKx8W2PamUc6PwTi11z8yLL/eLzlqW3T60wu/Hr61a5VLsodJH726Pax6xCc2v5p/ nRaD/jsWOoEf8tVmkdev++AmVS7MyDlIFtj2tDrEpza/n/8AmfB/vb5f0u9p/wAss01vXr09Vpfb /PpUdDmHQH4t0e0sJ6kfBObX/nJm4T/jpeS76Hx+qXEV14/5MXtlR0+Uc4n726OrwnlIfcnNp/zk 7+XbU+vWuraZ4/WrM0H/ACKeXKjY5gj4N0ZxlyIPxT2x/Pz8ob6gh8y26E/8tCTW/wDyeSPI+IGf CWR2HnfybqVP0fr2n3ZPQQXUMh+5WOHiCKTbkCAQag7gjCqwnFVhOKqUiq6lXAZT1BFRiqWXPl3y /cf3+m2sh8WhjJ++lcCpXN+X/lB25rp4ikHR4ZJIyO37DDFW18qyQf7w67q9mOyxXjlO/VW5V64O EJtWWPz5bf7yea5io/YuraCevXYsQGyPhhPEVLUfO35l6HaNezfo/VrSD4rhRFJDMEHVhxbj89jT wwHEF4i9D8o+Z7PzNoFtrFqhiScESQsQWjkQ8XUkddxse4yiQoswU2eRV64ErIZfUZh4Yqq4q7FX Yq7FXYq7FXYq7FWBaiP9yV3/AMZpP+JHMuPINR5pfqw/3E3v/GCX/iBwofJHlSFpfMnmNVBZjcRh VG5JLSbDNj2Tzn8P0uo7Y/g+P6Get5K80JCJm0i8EZ35ehJ08Tttm18aHeHT8Eu4sj8l/lTfeYLd ry6n+oWauY1qnKV2XZqKSvEA7VP3ZRn1QgaG5bcWAy35JrrP5G6jBwbSbxLsMwV45h6TKCacuQLB gOp6HwrlcNcD9QpnPSnoU6sPyL0NYF+v39zLPQcjB6caA9wA6yE5VLXyvYBmNIOpY35y/Ka40S0f UNOnN5Yx7zo60ljH822zL49KZkYNWJmjsWnLpzEWOTBRb+2Zji2uFv7Yrad+WfJdvrH6RvLuwjub CxsruSZ5VBAmFpM8FPcOgb6MxNVKIoGrJH3i3L0ombIuog/caYlN5L8tzfb06Ef6i+n/AMQ44ZaP Ef4Qxjrsw/iKy38k6baNy02e805q1BtbmWM123+0fDKT2bh6Aj4t0e1cw5kH4Jpbf47sqfUPOmsI F+ytzN9bUUptSUUptlR7Lj0kW+PbM+sQmdv50/Oizpw8yWuoKvRbyxiTYU2LQhWPTrlR7Mn0l9jd HtmPWJ+aYwfm/wDm7bgC70jRtQA720k8DHp19QuK5UdBmH80t8e1sJ/nD4JhB+fnmGPbUvJFygH2 ns7yK4r7heKH6K5UdNmHOLdHX4Dykjov+ciPKYoL/SNa04/tNPZ1T6Gjd6j6MqMZDnGQ+DfHNjly lE/FkflX81fIvmu+bT9E1L6xfqjSvavDPE4RSAx/eIq7ch0OQEgW2mUk5JUu14/7hNQ/5hpv+TZx VF/84/8A/KCSf8xs3/EI8x8vNnHkza7uOMjivQ0ytku0mb1JJfYD+OKplirsVdirsVdirsVdirsV YLqA/wByN1/xmk/4kcy48g1Hml+rD/cTe/8AMPL/AMQOFD5u/I3VtO0n8xtfvdQj526zKnqU5GJn MoEgHt7ZlaGBlGYHl+l1nacxGUCfP9D6utrq2uoEntpVmhkFUkQhlI9iMBBBotAIO4VcCXYq7FVk 0Uc0TwyqHikUo6HoVYUIOINIIt5X5u/KyCwsZdQ0iV5I4AXntpaFgg3ZkYAdPA/fmywaziNSdfm0 vCLiwS20+a5njt4IzJPMwjijXcszGgA+ZzOlIAWXCiCTQ5l76fKUHl78uptLjANw9tdvdyj9uZ7O YMfkv2R7DOc/MHJn4ulivdxB6n8sMWn4etG/fwl4NLYyQzPDItJI2KOPAqaHOijISAI6vLTBiSDz DQt/bJMbXC39sUWuFv7Yra4W/tii1wt/bFbXC29sVtJfy1Xh+f8AqA/7VR/VDnO67+/Puet7K/xc e8/e+gScoc9LtdP+4XUP+Yab/k2cVRv/ADj/AP8AKCyf8x03/EI8x8vNnHkyLU7jjdzCvRjlbJFe WZfUluPYL+s4qn2KuxV2KuxV2KuxV2KuxVg9+P8Achdf8ZZP+JHMuPINR5oDVh/uIvv+YeX/AIgc KHyl+XgDeZfNKftGeMj5BpR/HNh2UfVP4fpdL23yh8f0PTNL1LVtLk9TT7qS3JNSEPwn/WU/CfpG baeOMuYdFDLKPIst0/8ANHXYQFvLeG7UdWFYnP0iq/8AC5iy0UTyNOTHXSHMWntr+aekuALm0nhY 9eHGRR9NUP4ZRLQy6EN8dfHqCmcX5g+VXFWumjPg0Un/ABqrZWdJk7mwazH3qj+evKqUrfA1/ljl P6lwDS5O5J1ePvQHmDzzoY0u4hs5vrVxPG0aIqsFHMFasWAFBXplmLSz4gTsGvNq4cJANlD/AJPe UBJdN5gukrHATHYqe8lKPJ/sQaD3+WQ7U1NDwx15uR2NpLPinkOT0fzSFOkzK37UdwKHv/osuanB 9Xy+8O81P0/P/cl4l520f6vq5nVaR3I5f7Ndm/gc3fZebix8PWLzfbODgy8Q5S+9j4tvbNk6i1wt vbFFrxbe2K2uFt7YotcLb2xW1wtvbFbYt5BXh/zkLqQ/7VX/ABrBnPa3+/Puew7J/wAWHvP3veSc odgl+uH/AHDX/wDzDTf8mzgVH/8AOP8A/wAoLJ/zHTf8QjyjLzZx5I7WrjjqNyK9JG/XlbJMfJUv qT3fsqfrOKsrxV2KuxV2KuxV2KuxV2KsKvx/p9z/AMZX/wCJHMuPINR5oDVx/uIvv+YeX/iBwofL P5bxBvN/mgAdGhP3l8z+y/qn8HSdun0w+P6HpAtvbNy85a4W3titrhbe2KLXC29sVtcLb2xW0fou hT6pqUFjCKNK1GfsqjdmPyGVZswxwMj0btNhllmIDq9+0uztrCxgsrVeEECBI19h3Puepzk8kzOR keZe7xYxCIjHkEJ5oP8AuMY9aLOaf9Gs2W6Yer5f7oNGsNQ+f+5kwnzrpIuNPd1WskB9RfkPtfhl 3Z2bgyjuls4/a+DxMJI5x3/W8+Ft7Z0zxdrhbe2KLXC29sVtcLb2xRa4W3titrhbe2K2wbyavD/n IvUx/wBqr/jWDOe1v9+fc9l2R/i0fefve5k5juyS/XD/ALhr/wD5h5f+IHFUx/5x/wD+UFk/5jpv +IR5Rl5s48lLzDccdYvBXpK/68rZJz+XcvO4vvZY/wBbYqzbFXYq7FXYq7FWN65+YGhaLN6N3BqT yVP9xpt9Mm3UiRITGfobFUnH55flkoH1jVJbM0BIurK9goGNBVpIVXr74qmNl+a/5Z3tBB5o0zk2 yrJdRRMTWlAshQ1xVLX1bSry8ne0vYLhWlYq0UqODyY0pxJ65lxOwaip6uP9xF9/zDy/8QOFD4/8 s+ZX0Lzb5glFuLhJnjV1LFCOPI7GjfqzP7L+qfw/S6rtfDxxiL7/AND0Gy/Mry7NQXMc1q3clQ6D 6VJb/hc3FvPS0cxy3T6y8yeWrugg1GAs3RXb02P+xficbaJYZjmE3jiR1DoQyHowNQfpGFqJVBbe 2KLXC29sVt6J5C0VbG1N9Kv+k3Q+CvVYuo/4Lr92c92lqeOXAOUfveu7F0fhw8SX1S+79rNYpM1j u0H5hBfTmUbkpPQfO2lGZGm+r5f7oOHrfo+f+5kgtStQysCKgihGY4LlkW8wvdNNtdywU2Rjx/1T uPwzrdPl8SAl3vnusw+FllDuP2dFIW3tlzjWuFt7Yra4W3tii1wtvbFbXC3xRbzfyyvD/nJDVB/2 qh/xCDOe1v8Afn3Pbdjf4tH3n73tZOUOzQGtn/cNf/8AMPL/AMQOKpn/AM4//wDKCyf8x03/ABCP KMvNnHklHmi4469fivSd/wBeVsk//KyXnc6j7JF+tsVehYq7FXYq7FWC+c/P11p17JpmmKgmjAE1 y45cWYVoi9KgHqa/LN52f2VHJDjmdjyDz/aXbEsU+CAFjmSxCLz75zjcsdUaUdkkht+P/CRo345n y7GwnlYdfHt/MOYiURH+annKJv3w0+aMdP8AR5kcj3YTla/7HKZdhw6SLkQ9oZdYfahrr8xtOu2K 6t5O0y+U/akd1Yn/AJ5yW0nif28x5dhy6SDlQ7fxnnEoP/EP5P3D8b3yU9qT1e0WBYxua/3c0Dd+ y5jy7HzDlRcmHbOA8yR8E20tPyfvj6Gm6vLpUzjgLe6aSFCTtwrOFVya9FkOYuTR5sfOJczFq8WT 6ZBEX3/ON35c3yzvJDJbXtzQteWjCIllrxPA80PX+XIYNTPEbHVlm08cg3fOv5nflvqfkTzD+jLm QXVpOnrWF6q8RJHUghl34up+0K+B750Ol1AyxsOl1GE45UWIcGzJpx7V7ae8tn5200kLfzRsyH7w RjTE0eadWfnbzfa09PUpXA7TcZa/TIGOGmmWDGej0b8q/MXmjzPr62d3Fbvp1svq3twEZXC9EUUb jV226dKntmJrdR4UL/iPJs0nZkMkxzoc30JbygAAdBnLvWphDL0xVR1i4iS2QO6rz9ZV5ECpFtKx pX2UnMjTjc/D/dBxNZ9I+P8AuZIm8hqDmO5bBvNNiElS4A6/A36xm67Jzc4fF5f2h0/05B7j+j9K Q8R4ZuXmG6DFXYq7FXYq8u09VX/nJMkAAtpZLEdz6dN/oGc/r/7/AOD2vYn+LD3l7UTmO7VL9bP+ 4e//AOYeX/iBxVNv+cf/APlBZP8AmOm/4hHlGXmzjyYr5vnp5k1IeFxJ/wASytkyf8nped1qnskP 63xV6birsVdirsVeMz20V/58ntbmrRTahJE4BoePqlevyzsozMNKJR5iAP2PCzgMmsMZcjkI+1GX UX5RfX7mx/xELK8tZXt54p5BGqSRsUZayotaMOoama6Gv1VAmAIP473az7L0hJAmYn8eSonkHQtR FdI8y2l3y+wqGOSvh8Uch8R2yf8ALEo/XjI/Hua/5CifoyA/j3oK9/J/zKtTBPazDsObq33FKfjl ke2sR5iQa5dhZhyMT+Pcx2//ACx88Q1P6NaVfGKSJ/wDcvwzIj2ngP8AF97TLsvUR/h+5i2seWtf sIXk1DTLm3gGzySwuse9B9ojj3pl8M+Oe0ZA/Fplp8kN5RI+D0b/AJx/80Xcsep+Vbh2nWwRL3Su bElIXYo8NTSipIoK+Aamc72ppxCdjkXp+zNQcmPfmFf/AJyY0KLUfJEGqKtZ9IuVbn4Q3FInH0v6 f3YOyclZeH+cPuT2nC8fF3F8uiD2zpeF57jXCDHhRxomw0ye+vbezgAM9zIsUYOw5OQoqfDfBMiM TI8gyhciAOZfRHkHynfeTtBSK9tY1a6cyS3sc8TLI/QLuVpxXanzzl9dmjlnYlt8Xo9HilijRG/w ZnbavY0HK4iU+BkT+BOa8ucnNrcI6hkYMp6EGoxVA+are4u7O3WCMyFDdFgu9A2nXUY+9nAzI08g Cb8v90GjPEkCvP8A3JZVPHUZjt7FPOGl3d7ol7b2UhhvWiY2sgANJV+JPtAihYUPtl+ly+HkEujj avTjLiMD1fNtv+ZHmy3bjMYZ2XZhLFxNRtvwKZ2vhAvDSwRTa2/Ne5G1zpyP4mOQr+DK368HgNZw DvTS2/NDQ5Npre4hPjRXX8Gr+GROAsDhKaW/njyvPSl6EY/syK6U+kin45E4pdzA45Jnb6tpdzT6 veQy16BJFY/cDkTEhiQXnVl/60kP+2Uf+IZzuv8A7/4Padif4sPeXsxOY7tUs8xn/cBqf/MJP/yb bFU8/wCcf/8AlBZP+Y6b/iEeUZebOPJgfnO6U+aNWodhdTL9KuQf1ZWyZd+SMvO81f2jh/W+KvWM VdirsVdirx63/wDJjH/tqP8A8njnXy/xP/kn+h4iH+Pf8lD/ALpJfzN/KO2mn1LXNHM0l9LcS3F1 Zn956hkkLOYgByBBatN8wdHq9hGXKnY6zB6pEd5eRtpckbtHIhR0JDIwoQR1BBza260yZJcWnmPy /aaZJBf3llLeQfWBHHNJHxQsRGRxK05IA2Y0eDITsDRcicp4xHcixaNsfzF/MS0p6WuXLU6etxn/ AOTqvkZaLCf4Qse0Mw5SLNm82a/5i/KXzLLrMyzTW0tqkbqixniZ4iahAB+GYkNPDFqYCPW/uLnH UzzaWZl0I+8JD/zj+7f8rPvFBPE6LKSvYkXcFD+OPbPIfjvbexeR/Hc9N/M9Vvfy71qGShJtDKf9 aIiQfiuavQms8fe7LWi8Evc+ThBnacLx3G2IMPCjjR2i3A0/V7K+IJFtPHKwHUhGBI+7Ks+HjhKP eC2Yc3BMS7i+pPL9/bXtirROlzZXKiqmjxup8Qf9vOGnAxNSFEPbwmJCwbBSvzB+V+o3BN35cuUh Vqk2V0z8R/xjlUO1PZh9OQZMLvNF/NjQ3MiaTcSAH+8sZFmr/sI2L/euKo7yl+YPmfUNbXRNdtJr Q+hdSLJdW728gZLaUBTyCDv4VxVUm/5yr8ssD6OmO38vO4Va/OiNiqEl/wCcm9DmH/HKAr/y9A/8 ysVSR9RPmS9nvLTQV+pytz9e5gi4JWnL9/Iijr4GuXw1OWP0ykPi0T02KXOMT8GMebYtFjmittPt 41mSpubiLmqsT0VFJpQeNKnOm7HyZskTKZuPIPNdrwxY5CMBUuZY+Ic3XC6XiXCHDwo4mxDjwrxI j8uwV/OmxH/aql/4k+cn2wP8I/zQ9b2Ibwf5x/Q+gic1ztUs8xH/AHAan/zCz/8AJtsVT7/nH/8A 5QWT/mOm/wCIR5Rl5s48nl3nKenmrWh4X1yP+SzZWyZz+QknO91n2jg/4k+KvYsVdirsVdirxe3l /wCQllf+1q4/5LnOvl/if/JP9DxUB/h3/JQ/7pkWq+fvL9rql3bStL6sE8kUlIyRyRyDvXxGarFp JmAPkHYZ9ZAZJA95YtY6FY+ePPn1qKAppVuqPeuw4mTh0Bp/P9nxoMyMuU6fDR+o8mnTYhqc230D n+PNM/zi0Fbi4S/jXe2CRsB0CMNvuOY3Zmajwn+K/m5nbGC4mY/hr5PMl072zePOcTLbWD0Pyj80 jpWe0P8AyXizAyf41j9x+4u20pvS5PfH7wlP/OPhr+aF5/2xJv8AqLt8p7Z+kfjvc/sbkfx3PRPM nDVLfUNAEzW6XyTWAmXdoxMDFyG43XlXrmhgSJAh3cgCCDyeSX//ADjt5wglY6b5hingSpRbpFDN 4CiR/wDMz6c20O0M8f4r99Otn2bgl/DXuJY/eflX+bFh6kj6ZbXsCVp6D8Hb3Cq1yx/4HMqHbGUf VGJ+Y/W4s+xcZ+mUh9v6khvbPzTpcfPVvLl7aqSeLAKVNPD1fRb/AIXMmHbcf4oke6j+pxJ9hz/h kD77H60x8tfmhqnliRXsrq4sUc1e2ubaRoCSBUsGRogdvtA198OXU6PP9fP3G/mxxabW4Po5e8V8 nrvlr/nKPTbkpBqlrBPJtyl06dC3/Ih2/wCN8wZ9k4p/3WSJ8j+z9Tmx7Wyw/vcch5gfr/W9B038 3vIOpABdSFrKesV0rQkfNyPT/wCGzDy9k6iH8N+7f9rmYu19PP8Air37fsT2LVrC8j9SxuormPqG hkWRafNScwJ45R+oEe9z4ZIyHpIPuSTUrDSZW5TWNtMwrRpIY3O/uynIM2O3clrY8ntLe3tSNy0U MUZ271VRiFLz7zT5qWUsgnN1L2AYso+np92bfR9j5cpuQ4Yef6A6jW9sYsIqJ4p+X6SwWRXkkaRz VmNSc7HFhjjiIx5B4zLnlkkZS5loQ5bwtfEuEOPCjibEOHhRxLPIi8fzssh/2qpf+JPnH9tf4z/m h7PsE3p/84/oe+E5rHcJb5hP+4HUv+YWf/k22Ksg/wCcf/8AlBZP+Y6b/iEeUZebOPJ4952np5v1 weGoXQ/5LNlbJn//ADjxJzvtc9o7f/iUmKvbMVdirsVdirw5GCfmsUHQ6qT9LSkn9edYTej/AMz9 DxwjWt/5KfpQ3mLTjJ5k1Qhal7yegHcmVsOnNYo/1R9zhaw/v5j+mfvepeSdGh0XSUgAH1iU+pct 4uR9n5KNs5zWajxZ306PYdn6TwcQB+o7lvzBYR37XsTiqvGin6VOQjMw4ZDoWyWMZDOJ5EAPKH0l opWjdaMhKn5jbOqhMSAI6vBZQYSMTzBpMtVg9D8pfM3astof+niLMOf+NY/cfuLt9Cb0mT3x+8MW /wCcd2r+Z95/2xZv+ou3yrtn6R+O92nY3I/juZDLq1fOYh5f9LLhT/nvTNDHmHdnk9KJzLalhOKr CcVS280LQryUzXenWtzKesk0Mbt97KTgVjGp/lB+XeoK/r6RHzf/AHYGckb12Vyyf8LgMQm2L3f/ ADjr5SWMjSr2806Rq1ZJCF/4GEwD78nCcofSSPcaa54oT+qIl7xaT3X5E+arVl/Q/mclRU8rpVqC fD93K/8Aw+ZMe0NRHbjPxo/e4k+zNPI3wV7rH3IO48qfnhZMwjljvbdKklJ5IS3ypNIf+SeXR7Sl /FDHL/NaJdkivTkyR/zkhvrnz1ArSa1oF+IgaeqJDID/AMjxBmdh7axx54+H+rX7HX5+wssuWTi/ rX+1L080aYF5XMN1aV/37byEf8FEJE/HM/H21p5cyY+8fqt12TsPUx5AS9x/XSKt9f0C4YLDqFuz t0j9RQ9f9UkN+GZuPW4J8px+bg5NDnhzhL5JiFUio3GZQpxDbdBhRbqDFUJ5K/8AJ3WX/bKl/wCJ PnGduf4z/mh7f2f/AMW/zj+h7wTmrd0lnmE/7gdS/wCYWb/k22Ksj/5x/wD+UFk/5jpv+IR5Rl5s 48nh/nqannPXx4ajd/8AJ98rZPRf+cbZOV/r3tFb/wDEpMVe64q7FXYq7FXgnq/8hh4/9ren/JXO r/5B/wCZ+h5Gv8N/z/0oPyxH5hl/MnzPqmpXcv6Bs9UvorOJqNG0guZFUFqEoIwNgaVNPDNbqdRW GMBzMRfup2uDRwOc5COUj87ewadqEUqgxurjxUg/qzTO5Rdm81xe6gjxlYkEPpSUNH5KeW/scskf SPi1QjU5Hvp5b+Z/mC18q6pbyXdpPJbXysVmgCmkkdAykMydip6+Phm97KyccDHrF5jtrQnxeMfx feEDN5o0zXfyg81S2PqAQS2YkWVeJBa5jp0J8MuyxI1OP3S+5jooGOmyA98fvSP/AJxxav5m3v8A 2xZv+oq3zH7Z+kfjvdn2PyP47kJp+sCb80rMdBJrkQ4/612Ns0Du3089rbP9uJT70FcIkUUh5NHs X6IUP+ST/GuTGQo4QhZPL0Z/u5mX/WAP6qZIZkcCFl8vXg+w6OPmQf1ZIZQjhQcukaknWBiP8mjf qrkhMI4SgpYpozSRGQ/5QI/XkrVRJxQsJxSsJxVA3ul6XekG9s4LkqKKZo0kIHWg5A4FSDUvy28j 6gzPdaTCzMCNuSqK+CA8PwxpWMXP5C+TBzksHubC4avGSF/TC19oRCT/AMFhgTHeJI92zGeOMxUg D790qufyV162SmleZZmY9RcgMo/5GLcN+OZcO0dRHlM/Hf77cLJ2Xpp84D4bfdSWXHkD80rSQRwt Zakg6ykelX6fUX/k3mXDtzOOfDL4fqLhZPZ/TnkZR+P7FDyP5d85w/mnZ6vqmkta2i2ktrJKnqNG p4u4YsyJ1bbNfrNSc+XjIranY6DRjT4+AG97e2E5Q5aW+YD/ALgtR/5hZv8Ak22Ksl/5x/8A+UFk /wCY6b/iEeUZebOPJ4D5+mp538wjw1O8/wCoh8rZPS/+cY35ah5g9orb/iUmKvfcVdirsVdir59u CI/zuEY2rqsZof8AKYN/HOoib0f+Y8rKNa3/AD1HSvP2n+X/ADn5m03V4Xawl1e+dZokEnH1Lh+S uhK1X5fdlOXsqWXHCcDvwR2+DlY+1Y4sk4TG3Gd/iy6PR/y415/rPl7zRJp9y4qkMcyoeR7+jOBL 9AOajLoc2P6ol2uLXYcn0yCPutD8/adp9vBpfmqNZVLm6u7izWZ5V29IfE7U4/F88xHLYf5huvM8 UBPmDzGt1CjchFDaRW5Ygf78BJ79OJy3DinOVQBJ8mrNlhCNzIA80mtLwXX5V+e7kRrEjTacERQB 8IuV3PiT3OdCdNLDkwxkblUr+Tz0dTHNDNKIqPpr5of/AJxq5H8yb1/2To84B9xdW1f15R2x9I9/ 63M7I6sM8oXM97+a2jtspfWoJGG9KC6Dkfhmgd0+z8VdirsVUbq9tLROdzMkSnpyIBPyHfCBapTN 5w0lDSISTHsVWg/4ah/DJjGWPEl9z+YFrBMI5bNzGy15KwJ60+yQP14fDXibTzd5Puv7+Mwk95It /vj5YOGQWwrpH5PvP7i7jRj0Al4tv/kv/TDxSC0F0nlKCReVvdHiehKhgfpBGPio4UDN5R1JamN4 5B4VIP4in45IZQvCgJ9B1iL7Vq7f6lH/AOIk5LjCKKXzQzRGksbRnwYEfryVoUCcVWE4qsJxVYTg VLfMB/3B6j/zCzf8mzirJ/8AnH//AJQWT/mOm/4hHlOXmzjyfOv5gy089+Yx4ape/wDUQ+VsnqH/ ADi0/LUPMX/GK2/4lJir6ExV2KuxV2KvnbzhfWmkfnkbu9kMVnBd2k8spVjRPRjZjRQSab9BnTaa JnpKHOj95eZ1JENXZ5WPuD1xfMf5XeYGHqXelX0jUAS6EPM7U+zMA34ZpvD1OLlxx91/odwZ6bLz 4Je+v0qdz+VP5c6gnqDSYVDj4ZLZ3jHzURsF/DLYdq6mH8Xzpqn2Rpp/w/IlKpvyQ0FEppuqahYk bqqyhkB/1eKn/hsyR23M/XCEvg4suwogeic4/H+xjmpf84/6m7c7XWo7hu31mN0I/wBkrS/qzPw+ 0OMc8fD7q/Y6/N7O5TyycXvv9qXeYfJOseU/yj83xai0L/WXsGheBiwIS6jBryVSPtZDLr8eo1GM wvbi5+5t03Z+TTYMgnW/Dy97H/8AnGILJ551B6/FFpkq07UkuLc9f+eeY3bB2Dn9kjmwD8rQz/mP 5c6s36QgJ7nZwSc0LuX2zirsVSfzRrb6VYBoqG5mbhFXcDapantkoRsoJefPcT3EplnkaWRursan MgBrVosKoPVErKn+r/E4qEF6eBLvTxVUhluYDWCV4j4oxU/hjSoXRPOvmtfzJttJbUppNPlRjJby UkB427uN3BYfEoOxwcAK8Reo/wCILyP7So49wQfwOA4gvGV6+aYD8NxbkKepUhvwNMicSeNHfo7R L6JZhbxSI42dVAP3ihyuyGVBBz+TdEl+ykkP+o5/425YfEK8IS+fyDGd4Lxl8A6A/iCP1ZLxUcKW XHkXWUqYmimHYBip/wCGAH45LxAjhSjVPJPme7sbmyitAJLiJ4g7yIEXmOPJmBOwrXYE4eMLRZh+ Xfk9vKflqPS5JxcXBkae4kUEJzegISu9AFA3ymUrLICnyh5zsNQ1L8yfMNlp9tLd3curXwjghQu7 f6Q/RVqcil9BfkR+WereT9MvrzWeMep6oYv9FVg3oxRciAzL8PNi5rStKDfrir1PFXYq7FXYq+f/ AM4vKrX/AJ8u5vW9D1LS3eM8eQZvjjqdxsPT7ZvtDqeDCAO8um1ejGTKST0DyLU7K+025NveJwfq jjdHA7oe/wCsZtsWYTGzqc+mljO/JTs9Z1Oyk52F3PaydQ0EjxtX5oRk5xifqALVAyB9JLIbD85f zH048YdcnlC7FbkJcdPEzK7fjmJLQ4J/wj4fscuOszw6n4/tZLp3/OTnnK2ot9Y2V6g6sFkhkP0q zL/wmY0+yMZ5Ehyodq5BzALvPf8AzkFY+bPI+o6DJo8ljeXgh9OVZlmiBinjlNarGwqqHscjp+zT iyCXFYH6mWftAZcZjVEoX/nGaRh5o191JDLpEhVhsQRKm4yvtc7Bu7LGxYl+T/8A5Mzy7/zFr/xE 5onbvtLFXYqwD84dRudM0nTtQWIy2cV16d6VFWVJEIVh4fEB+rLMXNjJjOm31pfW6XFrKssL9GX9 RHY+2XMEyiwqqtawzULipGwIOKtfoaFvsuy/MA/0xpVraBcfsOrexqDjSqL6LqCf7pLDxWjfqxpW OaP5d1o/mdHqZtJEsLVD6tw44LVrdkAXlTkeTDphCHo02FUFNgVNPKF6V1GWxLbSRNOqf8Y2RSR/ yMGVZRsziy3KGbsVdirsVWTLI0ZWN/TY7c6ciPkDtXwriqV+X/KXl7QFl/RdmkM9wxe6uj8c8zse TNLK1Xarb9aeGKpvirsVdirsVdiryP8AOS9stP8AMGmy3kywLe2zRwO+yloJCzgsdh/frmz0UTKB roXC1GSMZC9rYDrmmWur6VJE3FjxMltNXZZADxYHw8fbMqEjE21TgJxo8kD5K0u2ttFt7oIDc3SC WSWm9G3VQfADLdRlMpeTTpcIhHzKJ8xeXLPWbN0dVS8Vf9HuQPiVh0BPdT3H8crx5DE2G7JjExRe aeW/Ld5reoPbkmCG3/3rkIqVNacAP5jQ5scmoEY33uqx6UykR3PStP8AKHl2yTjHZJK1N5JgJWP/ AAVQPozAlnnLq7OGnhHkEx/JzT7bS/OHnkWi8Rb6VyhHUL6iiQrTw5Zh66RMI25GmgIk0wX8j0Zv zU0AKCT6spoPAW8hP4DNW5j7JxV2KqF/YWeoWc1lewrcWlwpSaFxVWU4gq8O8yfk95q8u3Umo+T7 iS6tD8RtQR66gfslT8EwHbv7ZfHIDzYGKR2X5l39jObTXNOZJozxl4AxyKR/NFJ3+kZYxZTp35ge VLoAfXRA56pOrR0/2RHD8cKsksdR0+6ANrdRTg9PSdX/AOIk4qmcWFCKjxVfL0xVJ9S1fSrIE3l5 Bb07SyKh+4kYqwrXPzT8vWqsljyv5xsOAKR193YfqBwKyD8n9N8yX2oXfm3WkMEVzB9W023IKj0m dZGdVO4UlFoT9r5ZRll0ZxD1TKmbsVdirsVdirsVdirsVdirsVdirxr/AJyh0V7nyZY6tGvJtMuw sp/liuV4E/8AIxYx9ObXsnJw5CO8Ot7Tx3AHuL5jh1O9gRkguJYkcEOqOygg9QQDvm+NHmHSxJHI vUvy/wBct7/RIrTkBdWQ9N467lAfgYDwpt8812ohUr73a6XJca6hks0sUMTzSsEijUs7saAKBUkn KHJeY+WfP2kaU2oi5gmYXd09xE8QVjxf9lgzJ0zKniJAcKGeIJTW4/N7RFQ+hZ3LvTYP6aCvzDPl fgFs/MjuTr8n9VmvNN/MbXbgqJH0WUsm9OTLMEUewEYXMLtAUAHK0kuKyo/8426W13+ZCXfGqada TzluwLgQD7/VOatzX1firsVdirsVS/V/L+h6zF6WqWEF4gFF9ZFZl/1WPxL9BwgkLTBtV/IPyRdl mszc6c56LFJ6iV91lDt/w2TGQseEMWvv+ccLxamw1uOTwSeBo/8AhkZ/1ZLxUcCBP5HfmRbMPquq WxUElTHczoR4Egxr+GS8UI4Vh/Kn84ASBfsQO4vn3/HHxQvCVT/lSX5l3TEXWq2/E05NLczvXt09 Nq4+KF4Ux07/AJxwlJDalrSqNuUdtCWJ8aO7LT/gcicqeFnXlz8oPI+husyWZvrpN1uL0iUg9ahK LGPnxrkDMlkIhmmQS7FXYq7FXYq7FXYq7FXYq7FXYq7FUPqGn2Oo2U1jfwJc2dwpjnglUMjqeoIO GMjE2OaJRBFF4r5m/wCcVvLl5M8/l/VJtK5GotZl+swj2QlkkUf6zNmzx9qSH1C3X5Ozon6TTAr/ AP5xq/NLSJvrOj3Npeun901tO0E30iVY1H/B5kjtLHLY2HHOgyR3DE/NPlb85YYWg1vStTe2TdzH EZYdt/ie3DIfpOXQzYjyIYTx5eUgWAziWGRopkaORdmRwVYfMHLuJp4W7Gy1DUbpLTT7aW8upDSO CBGkkY+yqCTkJTA5tkYE8numneS9Y8h/k9q6apbsnmPzhPbWVnpyjnMsMbGQgotTyYF6qP8AJrvt ml1mcTIA5B22mxGEd3p/5BflvqPlPRbu/wBYiEGq6oyf6OaFooIwSqtTozMxLD5d8w3Ieq4q7FXY q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FVG6srO7ThdQR3 CbjjKiuN+uzA+GEEhBFrbPTtPslZbO1htlY1YQxrGCffiBiSTzUABT/RNidS/SUkYlvVX04ZpPiM SH7SxV2Tl+1Tdu/QUCUZirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdi rsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirs VdirsVdir//Z - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer_list_icon.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_graf_upnp_ext_renderer_list_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - - - -]> - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_1.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_1.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - -]> - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_2.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_2.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_3.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_3.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_4.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_4.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_5.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_5.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_6.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_6.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_7.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_7.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_8.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_8.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_9.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_indi_upnp_search_9.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ - - - - -]> - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_prop_folder_current.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_prop_folder_current.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_locked_small.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_locked_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ - - - - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - Adobe PDF library 6.66 - - - - - - - 2005-08-31T13:44:30+03:00 - 2005-08-31T12:00:58Z - Illustrator - 2005-08-31T13:44:30+03:00 - - - - JPEG - 256 - 256 - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7 FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F XYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXY q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq 7FXYq7FULeapptlT65dRW5P2RI6qT8gTU5Tl1OPH9chH3ltx4Zz+kEoX/FPlv/q5W/8AyMXKP5R0 /wDPj8238lm/my+Tv8U+W/8Aq5W//Ixcf5R0/wDPj81/JZv5svk7/FPlv/q5W/8AyMXH+UdP/Pj8 1/JZv5svk7/FPlv/AKuVv/yMXH+UdP8Az4/NfyWb+bL5O/xT5b/6uVv/AMjFx/lHT/z4/NfyWb+b L5O/xT5b/wCrlb/8jFx/lHT/AM+PzX8lm/my+SJs9X0q9bjaXkM7fyRurN9wNcuxarFk+iUZe4tW TBOH1RI+CLy9qdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVSvzPrB0j Rbi9QAyqAsIPTm5oK/LrmF2hqvAwymOfT3uVo8Hi5BHo8Vurq4urh7i4kaWaQ8nkY1JOeeZMkpyM pGyXsYQERQFAKWQZuxV2KuxV2KuxVtWZGDKSrKaqw2II8MIJG4QRb0TyN53nnnTStUcySPta3Lfa J/kc969jnVdj9rykRiymyeR/QXn+0uzhEeJD4hn2dQ6J2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K uxV2KuxV2KuxV2KuxV2KsW/Mn/lGH/4yx/rzS9v/AOLH3h2fZH9/8C8lzhnq3Yq7FXYq7FXYq7FX YquikkikSWNisiEMjDqCDUHDGRBscwggEUXuOgarHquk218tA0q/vVH7Mg2cffnpGi1Iz4ozHXn7 +rxOqwHFkMe5MMymh2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVi35k/8ow/ /GWP9eaXt/8AxY+8Oz7I/v8A4F5LnDPVuxV2KuxV2KuxV2KuxV2Ksr8jebU0eZ7S8J+oTty5Dcxv 05U8COubvsftMac8M/ol9hdV2lofFHFH6h9r1WCeGeJZoJFlicVR0IKkexGdtCcZC4mwXmJRMTR2 K/JMXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYqxb8yf+UYf/jNH+s5pe3/APFj 7w7Psj+/+BeS5wz1bsVdirsVdirsVdirsVdirh1xQmGn6tqVgSbO5kg5faCMQD8x0OWYtVlxfRIx aMuCE/qAKbL5z8zHrfN/wKf805kHtrV/zz9n6nFPZ+H+b96qvnHzIet83/Ap/wA05We29X/PPyH6 mJ0GH+aqr5u8xH/j9b/gU/5pyB7c1n+qH5D9TE6DD/NVV816+f8Aj8b/AIFP6ZWe3dZ/qh+Q/UxO hw/zVVfNOu97tv8AgU/pkD2/rf8AVD8h+pidFi/mqq+Ztb/5am+5f6ZWfaDW/wCqH5D9TE6LF/NV F8yaz/y1N9y/0yB9odd/qh+Q/Ux/J4u5UHmLWP8AlpP3L/TIn2i13+qH5R/Uj8nj7l48w6t/y0n7 l/pkf9EWu/1Q/KP6kflMfc3/AIg1b/loP3L/AEwf6I9f/qh+Uf1I/KY+53+INW/5aD9y/wBMf9Ee v/1Q/KP6l/KY+5afMOr/APLSfuX+mH/RFrv9UPyj+pP5TH3Ktp5q1GGUGdhPF+0pABp7EAZn6L2q 1WOf7w+JDqCAD8CGGTQwkNtizG2uIrmBJ4jyjkHJTnpem1EM2MZIG4yDppwMSQeYVMuYuxV2KuxV 2KuxVjnn7/lHn/4yx/rznfan/Ez/AFg5/Zv978HmgzzJ6BeuRQqDAhcMiheMCFQZFC8YELxkVXjA xXjIqvGBivGRVUGBivGRVeMCF65FC8YELxkUKgwIXjIoXAYEOIxVacKVhySsk0An9HL7M1Pvz2D2 NJOgHlKX3ur1f1pjnVOM7FXYq7FXYq7FWOefv+Uef/jLH+vOd9qf8TP9YOf2b/e/B5oM8yegXrkU KgwIXDIoXjAhUGRQvGBC8ZFV4wMV4yKrxgYrxkVVBgYrxkVXjAheuRQvXAheMihUGBC8ZFC8HAhx OKrDhSsOFWSaB/xzx/rNnsHsZ/iA/rSdXq/rTHOrcZ2KuxV2KuxV2Ksc8/f8o8//ABlj/XnO+1P+ Jn+sHP7N/vfg80GeZPQLxkULxgQvGRQvGBC8ZFC8YELxgVUGRYrxgVeMiheMCF4yKF4yKF4wIXjI oXjAhUByKFwOBC8HAhdXArq4qtJwqtJwpZLoH/HOH+s2ev8AsZ/iA/rSdXq/rTHOrcV2KuxV2Kux V2Ksc8/f8o8//GWP9ec77U/4mf6wc/s3+9+DzQZ5k9AvGBC8ZFC8YELxkVXrgQvGRQvGBC8ZFC8Y EJZ5l816B5Y0xtS1u7S0thsnLd5G/kjQfEzewzJ0ehy6mfBijxH7vf3NeTJGAsvDvMn/ADlTemV4 vLWkRxxA0S61BmdmHj6MTIFP+zOdvo/YmNXmmb7o/rP6g67J2gf4R82Jy/8AOSH5ovIGS7tolBqU S2jIO/T4uR/HNrH2R0IH0yP+cWg63Im2jf8AOUvne1lX9J2NlqMH7QVXt5T8nVnQf8BmJqPYrSyH olOB+Y/HxZR10xzAL278uvzl8o+d6W1o7WWrheT6bc0DkDqYnHwyAe2/iBnFdrez2o0Xql6sf84f p7vu83NxaiM+XNnwOaFvXg4ELwcihcDgVcDgQurgQ6uKtE4UrScKWTeX/wDjnD/WbPXvY3/ER/Wk 6rV/WmWdW4rsVdirsVdirsVY55//AOUef/jLH+vOd9qf8TP9YOf2b/e/B5mM8yegXjAqoMiheMCF wyKF64CheMiheMCF4wIUNU1Sz0rTLrU71/TtLOJ5538EQcjTxO2wyeDDLLMQjvKRoMJSERZfF3n7 z1q/nLX5dTvnZYAWWxtK1SCGuyD3/mbuc9l7L7Mx6PEIQ5/xHvP45PP5sxySspp+X35P+bPOoNzZ IlnpStxfUbmoQkdVjUAtIR7beJzG7V7f0+i9MvVP+aP09zPDppZOXJ6jD/zida+mvreZXMn7RS0A X6KzHOYl7cyvbFt/W/465f8AJ/mxrzh/zjL5q0i0lvdEvI9bhiBZ7dYzBc0G54R8pFens1T2GbHs /wBssGWQjlicZPW7j89q+XxacmhlHcbvIbW6vLG8jubaR7a7tnDxSoSjo6GoII3BBzrpwjOJjIXE /a4YJBfan5PfmAPOvk6DUJ+I1S1b6tqSLsPVQAiQDwkUhvnUds8Y7f7K/JakwH0S3j7u74cndafL xxvqzkHNG3LwcCFwOBC4HArdcVdXFWicVWk4VZR5d/45o/12z172N/xEf1pOq1n1pnnVOK7FXYq7 FXYq7FWOef8A/lHn/wCMsf68532p/wATP9YOf2b/AHvweZjPMnoV4wIXjAheMiheMCF4yKF4wIXD IoXrgQ8p/wCclNbksfIMVhExDapdxxSU2rFEDK3/AA6pnVex+mE9WZn+CJPxO33W4OvnUK7y+bfL GiSa75j03R4yVa/uYoC46qrsAz/7FanPR9bqRgwzyH+GJLqMcOKQHe+6NM06y0zT7fT7GJYLO1jW KCJeiogoBnh2bLLJMzkblI2XoYxAFBGA5SleDgQ+RP8AnIryxbaJ+Yks9qgS31eBb4ouyiVmZJaf 6zJzP+tnrXslrJZtGBLnjPD8OY++vg6bWQ4Z+9kH/OKWsSQebtV0ktSC+shPT/iy2kUL/wALM2YH txpxLTwydYzr4SH7Az0MvUQ+ogc8wdmuBwKuBxQurgV3LFDuWKurilaThVlflz/jmL/rtnrnsb/i I/rSdTrPrTPOqcV2KuxV2KuxV2Ksc8//APKOv/xlj/XnO+1H+Jn+sHP7N/vfg8yGeZvQrxkULxgQ vGRQvGBC8YELwciheMCFwOBXhn/OVDN+jfLq1PEzXJK9iQsdP152/sSPXl90f0ur7S5ReX/kmqt+ aXl8MAR60hod9xC5B+g50/tGf8Bye4feHC0n94H2YDnjjvlwOBC8HAh81/8AOV3/ACkOhf8AMJL/ AMnc9I9h/wC5yf1h9zq+0PqDH/8AnGn/AMmhB/zCXP8AxEZn+2H+In+tFq0X94+uwc8lduuBwK2D gQu5YFdyxQ7lirq4pWk4VZb5a/45i/67Z657Hf4iP60nUaz+8TTOpcV2KuxV2KuxV2Ksb/MD/lHX /wCMsf68532o/wATP9YOf2b/AHvweZDPM3oV4wIXjAheMiheMCF4yKrgcCF4OBC8HIoeF/8AOVH/ ABz/AC7/AMZbr/iMedx7E/Xl90f0ur7S5ReY/kl/5NLQP+Msn/JiTOm9o/8AEcnuH+6Dh6T+8D7K Bzx13y8HAhcDgQ+bP+crf+Ug0L/mEl/5OZ6P7D/3OT+sPudV2h9QY/8A841/+TPg/wCYS4/4iM2H th/iJ/rRatF/ePrkHPJXcLgcCF1cCurirdcVdXFXVxVonFWXeWf+OWv+u2et+x3+Ij+tJ1Gt/vE1 zqXEdirsVdirsVdirG/zA/5R1/8AjLH+vOd9qP8AEz/WDn9m/wB78HmIzzR6FeMiq8YELwcCF4OR QuBwIXg4ELwcih5z5z/PPy95T8wT6Je2F3PcQLGzSw+lwIkQOKcnU9D4Z0XZ3s1m1WEZYyiAb530 +DhZtbHHLhILx784/wA1dH8822lxafaXFq1i8zSG44UYShAOPBm/kzr/AGf7EyaKUzOUZcVcr6W6 /V6kZQKHJiP5f+ZLXy15x03XLuJ5reyd3kiipzIaNk25EDq3jm27V0ctTp54okAy7/e4+DIITEj0 e7j/AJyk8of9WnUPuh/6qZwv+grUfz4fb+p2X8ow7iuH/OU3lD/q06h90H/VTH/QTqP58Pt/Uv8A KEO4t/8AQ1Hk/wD6tOofdB/1Uwf6CdR/Ph9v6kfyhDuLyj85vzK0rz3qenXenWs9qlnA8Ui3HCpL PyqODNnVez3Y+TQwlGZEuI3s4eqzjIQQlv5UedbDyb5vj1u+gluLdIJYjHBx51kAAPxFRmT252dP Wac4oEA2Dv5MNPlEJWXulj/zlD5RvL23tE0rUFe4kSJWYQ0BdgoJpJ75w+X2L1EImRnDYX1/U541 0SaovZgc41zW64q3XArdcVdXFWq4q1XCrMfK/wDxyl/12z1n2P8A8RH9aTp9b/eJtnUuI7FXYq7F XYq7FWN/mD/yjr/8ZY/15zvtR/ih/rBz+zf734PMBnmj0S8YELwcCFwORQvBwIXg4ELwciq4HAh8 ofn/AP8Akz9R/wCMVt/yYTPVfZb/ABGPvl95dBr/AO9LzrOhcN2KuxV2KuxV2KuxVMfLv/KQaZ/z Fwf8nFzH1f8Acz/qn7mUPqD74Bzwd6JdXArq4q3XFDq4q1XFLq4qzLyt/wAclf8AXbPWfZD/ABEf 1pOm1v8AeJvnUOI7FXYq7FXYq7FWNfmD/wAo4/8Axlj/AF5zvtR/ih/rB2HZv978HmAOeavQrwci hcDgQvBwKvBwIXg5FC4HAhcDgQ+Uvz+/8mdqP/GK2/5MJnqnst/iMffL7y6DX/3pedZ0LhuxV2Ku xV2KuxV2Kpj5d/5SDTP+YuD/AJOLmPq/7mf9U/cyh9Qfe1c8IejdXFW64FdXFXVxV1cVarhVmvlT /jkL/rt+vPV/ZD/Eh/Wk6bXf3icZ1DhuxV2KuxV2KuxVjX5hf8o4/wDxlj/XnPe0/wDih/rB2HZv 978Hl4OeaPQrwcCrgcCF4OBC4HIoXg4ELgcCrwcCHyl+fv8A5M7Uf+MVt/yYXPU/Zf8AxKPvl95e f1/96XnedC4bsVdirsVdirsVdiqYeXf+Ug0z/mLg/wCTi5j6v+6n/VP3MofUH3pXPCnpG64FdXFD q4q6uKurirq4pZt5S/446/67/rz1f2R/xIf1pOl1394nOdO4bsVdirsVdirsVY1+Yf8Ayjj/APGW P9ec97T/AOKH+sHYdmf3vweXA55q9EuBwIXg4ELgciq4HAheDgQvBwIXA4EPlT8/P/Jm6j/xitv+ TC56l7L/AOJR98vvLz+v/vS87zoXDdirsVdirsVdirsVTDy9/wAd/TP+YuD/AJOLmPq/7qf9U/cy h9QfeNc8LeldXFW64FdyxV3LFXVxVquFWc+Uf+OMv/GR/wBeeq+yP+JD+tJ0mu/vE6zp3DdirsVd irsVdirGfzE/5Rt/+Msf68572n/xQ/1g7Dsz+9+BeWg55s9EvBwKuByKFwOBC8HAhcDgVeDgQuBw IfKv59/+TM1D/jFbf8mFz1L2X/xKPvl95ef1/wDen4PPM6BwnYq7FXYq7FXYq7FUw8vf8d/TP+Yu D/k4uY+r/up/1T9zKH1B93Vzwx6Z1cVbrih1cVdXFXVxVquKWd+T/wDjjL/xkf8AXnqvsl/iQ/rS dHr/AO8+Cd50zhuxV2KuxV2KuxVjP5if8o2//GWP9ec97T/4of6wdh2Z/e/AvLAc82ejXA4ELgcC F4OBVwOBC4HAhcDgVeDgQ8c/Mj8ktf8ANXm261qzv7SCCdIlWOb1OYMcYQ14ow7Z2HZHtHi0unGK UZEi+VdT73V6nQyyTMgQxj/oWfzZ/wBXSw++b/qnmy/0Y6f+ZP7P1uP/ACZPvDf/AELL5s/6uth9 83/VPH/Rlp/5k/s/Wv8AJk+8O/6Fk82f9XWw++b/AKp4/wCjLT/zJ/Z+tf5Mn3hv/oWPzb/1dbD7 5v8Aqng/0Zaf+ZP7P1o/k2feG/8AoWLzb/1dbD75v+qeP+jPT/zJ/Z+tf5Nn3h3/AELD5t/6uun/ AHzf9U8f9Gen/mT+z9a/ybPvDf8A0LB5t/6uun/fN/1Twf6M9P8AzJ/Z+tf5Nn3hE6Z/zjV5rtNS tLp9UsGS3mjlZVM1SEcMQKx+2V5vbDBOEoiE9wR0/WmPZ0wQbD6Mrnnbt264q3XArq4odXFXVxS1 XCrPfJv/ABxV/wCMj/rz1P2S/wASH9aTo9f/AHnwTzOmcJ2KuxV2KuxV2KsY/MX/AJRp/wDjLH+v Oe9pv8UP9YOw7M/vfgXlYOebvRrgcCrwcCFwOBC4HAq4HAhcDgQuBwKvBwIXA4ENg4FXA4ELgcCt g4oXA4FbrgQ3XFW64FdXFW64odXFXVxV1cVariln/kz/AI4i/wDGR/156n7J/wCJD+tJ0Wv/ALz4 J7nSuE7FXYq7FXYq7FWMfmN/yjT/APGWP9ec/wC03+KH+sHYdmf33wLykHPN3pF4OBC4HAhcDgVc DgQuBwIXA4FXA4ELgcCrgcCFwOBC4HArYOKGwcCrq4FbrihuuBW+WNK6uKt1wIdXFXVxV1cVarhS 9B8lf8cNf+Mj/rz1H2T/AMSH9aToe0P734J9nSuE7FXYq7FXYq7FUu8xaQNW0i4sqhXcViY9A6mq /wBDmD2lo/zOCWPqeXv6N+mzeHMSeM3tjeWNy1tdxNDMnVGH4jxHuM8sz6eeKRhMcMg9VjyRmLib CkDlDNcDgQuBwIXA4FXA4ELgcCFwOBVwOBC4HArYOBC4HFVwOBDdcCt1xQ3XArdcVdXArdcUOrir q4q6uKuriqta2tzdzrBbRtLK3RV/WfAZfp9NkzTEMYMpFjOYiLOwen6Lpw07TYbWoLoKyMO7sanP XuytCNLp44uo5+883nNRl8SZkjc2DS7FXYq7FXYq7FXYqpT2trcALcQpMo6CRQw/EHK8mGE9pAS9 4tlGZjyNKH6G0j/lht/+RSf0yn8jg/mQ/wBKGfjz/nH5t/ofSP8Alht/+RSf0x/I4P5kP9KF8ef8 4/N36H0n/lit/wDkUn9MfyOD+ZD/AEoXx5/zj83fojSf+WKD/kUn9MfyOD+ZD/ShfHn/ADj83foj Sf8Alig/5FJ/TH8jg/mQ/wBKF8ef84/N36I0r/lig/5FJ/TH8jg/1OH+lC+NP+cfm3+idK/5YoP+ RSf0x/I4P9Th/pQvjT/nH5u/ROlf8scH/IpP6Y/kcH+pw/0oR40/5x+bv0Tpf/LHB/yLT+mP5DB/ qcP9KF8af84/N36K0v8A5Y4P+Raf0wfkMH+pw/0oXxp/zj83forS/wDljg/5Fp/TH8hg/wBTh/pQ vjT7z83forTP+WOD/kWn9MfyGn/1OH+lH6l8afefm3+i9M/5ZIP+Raf0x/Iaf/U4f6UfqXxp95+b v0Xpn/LJD/yLT+mP5DT/AOpw/wBKP1L40+8/N36L0z/lkh/5Fp/TH8hp/wDU4f6UfqXxp95+bv0X pn/LJD/yLT+mP5DT/wCpw/0o/UvjT7z83fovTf8Alkh/5Fp/TH8hp/8AU4f6UfqXxp95+bv0Xpv/ ACyQ/wDItP6Y/kNP/qcP9KP1L40+8/N36M03/lkh/wCRaf0x/Iaf/U4f6UfqXxp95+bv0Zpv/LJD /wAi0/pj+Q0/+pw/0o/UvjT7z83fozTf+WSH/kWn9MfyGn/1OH+lH6l8afefm79Gab/yyQ/8i0/p j+Q0/wDqcP8ASj9S+NPvPzVYbe3hBEMSRg9Qihf1ZdjwwxioREfcKYykTzKplrF2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux V2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV 2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2 KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K uxV2KuxV2Kv/2Q== - - - - - - - uuid:613db75f-bcf9-4a78-b76d-0d89ef07a31b - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_small.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_folder_small.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_music.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_music.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_images.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_images.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_videos.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_prop_mserv_other_videos.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/bitmaps/qgn_server_icon.svg --- a/upnpframework/upnpcommonui/bitmaps/qgn_server_icon.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/data/upnpcommonui.rss --- a/upnpframework/upnpcommonui/data/upnpcommonui.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1338 +0,0 @@ -/* -* Copyright (c) 2005 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: Resource definitions for the Common UI -* -*/ - - -// RESOURCE IDENTIFIER -NAME UPCU - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // animation frames -#include // Loc strings for upnpframework subsystem - -#include "upnpcommonui.hrh" - - -// CONSTANTS -// None - -// MACROS -// None - -// RESOURCE DEFINITIONS - -// -------------------------------------------------------------------------- -// -// RSS_SIGNATURE -// -// -------------------------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE - { - } - -// -------------------------------------------------------------------------- -// -// TBUF -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF - { - buf = ""; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_external_media_title - { - buf = qtn_iupnp_title_ext_media_2; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_external_waiting_note - { - buf = qtn_iupnp_main_empty; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_EXTERNAL_EMPTY_FOLDER -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_external_empty_folder - { - buf = qtn_iupnp_no_files_found; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_BROWSE_DIALOG_MENUBAR -// -// -------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_upnpcommonui_browse_dialog_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_upnpcommonui_browse_option_menu; - } - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_MENUPANE_MARKABLE_LIST_IMPLEMENTATION -// -// -------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_upnpcommonui_menupane_markable_list_implementation - { - items = - { - MENU_ITEM - { - command=EAknCmdMark; - txt=qtn_options_list_mark_one; - }, - MENU_ITEM - { - command=EAknMarkAll; - txt=qtn_options_list_mark_all; - }, - MENU_ITEM - { - command=EAknCmdUnmark; - txt=qtn_options_list_unmark_one; - }, - MENU_ITEM - { - command=EAknUnmarkAll; - txt=qtn_options_list_unmark_all; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_MENUPANE_SHOW_SUB_MENU -// -// -------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_upnpcommonui_menupane_show_sub_menu - { - items = - { - MENU_ITEM - { - command = EUPnPShowLocal; - txt = qtn_iupnp_on_device; - }, - MENU_ITEM - { - command = EUPnPShowExt; - txt = qtn_iupnp_via_homenet; - } - - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_MENUPANE_PLAY_SUB_MENU -// -// -------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_upnpcommonui_menupane_play_sub_menu - { - items = - { - MENU_ITEM - { - command = EUPnPPlayLocal; - txt = qtn_iupnp_on_device; - }, - MENU_ITEM - { - command = EUPnPPlayExt; - txt = qtn_iupnp_via_homenet; - } - - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_BROWSE_OPTION_MENU -// -// -------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_upnpcommonui_browse_option_menu - { - items = - { - MENU_ITEM - { - command = EUPnPOpen; - txt = qtn_options_open; - }, - MENU_ITEM - { - command = EUPnPShow; - txt = qtn_iupnp_show_ext_main; - cascade = r_upnpcommonui_menupane_show_sub_menu; - }, - MENU_ITEM - { - command = EUPnPPlay; - txt = qtn_iupnp_play_ext_main; - cascade = r_upnpcommonui_menupane_play_sub_menu; - }, - MENU_ITEM - { - command = EUPnPFind; - txt = qtn_options_find; - }, - MENU_ITEM - { - command = EUPnPCopy; - txt = qtn_iupnp_copy_main; - }, - MENU_ITEM - { - cascade= r_upnpcommonui_menupane_markable_list_implementation; - command=EAknCmdEditListMenu; - txt=qtn_options_list; - }, - MENU_ITEM - { - command = EUPnPHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_EXTERNAL_DEVICE_DIALOG_MENUBAR -// -// -------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_upnpcommonui_external_device_dialog_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_upnpcommonui_external_device_option_menu; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_COMMONUI_EXTERNAL_DEVICE_OPTION_MENU -// -// -------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_upnpcommonui_external_device_option_menu - { - items = - { - MENU_ITEM - { - command = EUPnPOpen; - txt = qtn_options_open; - }, - MENU_ITEM - { - command = EUPnPFind; - txt = qtn_options_find; - }, - MENU_ITEM - { - command = EUPnPHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - - -// -------------------------------------------------------------------------- -// -// R_COMMONUI_SOFTKEYS_OPTION_BACK__OPEN -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_options_back__open - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyOpen; txt= qtn_msk_open; } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_OPTION_BACK__SHOW -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_options_back__show - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyOk; txt= text_softkey_show; } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_sOFTKEYS_OPTIONS_BACK__PLAY -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_options_back__play - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyOk; txt= qtn_msk_play; } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_BROWSE_DIALOG -// -// -------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnpcommonui_browse_dialog - { - flags = EAknDialogMarkableList; - buttons = r_upnpcommonui_softkeys_options_back__open; - items = - { - DLG_LINE - { - id = EUPnPBrowseListBoxId; - type = EAknCtSingleGraphicListBox; - control = LISTBOX - { - flags = EAknListBoxMarkableList; //EAknListBoxSelectionList; - }; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_EXTERNAL_MEDIA_SELECT_DIALOG -// -// -------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnpcommonui_external_media_select_dialog - { - flags = EEikDialogFlagNoDrag | - EEikDialogFlagNoTitleBar | - EEikDialogFlagFillAppClientRect | - EEikDialogFlagCbaButtons | - EEikDialogFlagWait; - buttons = r_upnpcommonui_softkeys_empty_back; - items = - { - DLG_LINE - { - id = EUPnPExternDevicesListBoxId; - type = EAknCtSingleGraphicListBox; - control = LISTBOX - { - flags = EAknListBoxSelectionList; - }; - } - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_VIDEO_PLAYER_DIALOG -// -// -------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnpcommonui_video_player_dialog - { - flags = EEikDialogFlagNoDrag | - EEikDialogFlagNoTitleBar | - EEikDialogFlagFillAppClientRect | - EEikDialogFlagCbaButtons | - EEikDialogFlagWait; - buttons = r_upnpcommonui_softkeys_empty_back; - items = - { - DLG_LINE - { - id = EUPnPVideoPlayerListBoxId; - type = ECustomCtrlDlgCtCustomControl; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_VIDEO_PLAYBACK_WAIT_NOTE_DIALOG -// -// -------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnpcommonui_video_playback_wait_note_dialog - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EUPnPVideoDialogWaitNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_iupnp_prog_prep_playback; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_PLAY_STOP -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_play_stop - { - buttons = - { - CBA_BUTTON - { - id = EUPnPPlayCmd; - txt = qtn_iupnp_play_ext_main; - }, - CBA_BUTTON - { - id = EUPnPStopCmd; - txt = text_softkey_stop; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_PAUSE_STOP -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_pause_stop - { - buttons = - { - CBA_BUTTON - { - id = EUPnPPauseCmd; - txt = text_softkey_pause; - }, - CBA_BUTTON - { - id = EUPnPStopCmd; - txt = text_softkey_stop; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_sOFTKEYS_CONTINUE_STOP -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_continue_stop - { - buttons = - { - CBA_BUTTON - { - id = EUPnPContinueCmd; - txt = qtn_iupnp_sk_continue; - }, - CBA_BUTTON - { - id = EUPnPStopCmd; - txt = text_softkey_stop; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_REPLAY_BACK -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_replay_back - { - buttons = - { - CBA_BUTTON - { - id = EUPnPReplayCmd; - txt = qtn_iupnp_sk_replay; - }, - CBA_BUTTON - { - id = EUPnPBackCmd; - txt = text_softkey_back; - } - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_EMPTY_CANCEL -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_empty_cancel - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyEmpty; - }, - CBA_BUTTON - { - id = EAknSoftkeyCancel; - txt = text_softkey_cancel; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_VIDEO_NAVI_TIME -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_video_navi_time - { - buf = qtn_iupnp_sep_slash; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SELECT_DEVICE_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_select_device_text - { - buf = qtn_iupnp_select_device; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SELECT_PLAYER_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_select_player_text - { - buf = qtn_iupnp_select_player; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_COPY_TO_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_copy_to_text - { - buf = qtn_fldr_copy_to_prompt; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_MOVE_TO_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_move_to_text - { - buf = qtn_fldr_move_to_prmpt; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_TITLE_SHOWING -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_title_showing - { - buf = qtn_iupnp_title_showing; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_NOMEMORY_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_nomemory_text - { - buf = qtn_memlo_ram_out_of_mem; - } - -// -------------------------------------------------------------------------- -// R_UPNPCOMMONUI_DEVICE_MEMORY_LOW -// -------------------------------------------------------------------------- -RESOURCE TBUF r_upnpcommonui_device_memory_low - { - buf = qtn_memlo_device_memory_full; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_INFO_COPY_ONE_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_info_copy_one_text - { - buf = qtn_iupnp_info_copy_one; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_INFO_COPY_MANY_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_info_copy_many_text - { - buf = qtn_iupnp_info_copy_many; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_RENDERING_FAILED_UNKNOWN_ERROR_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_rendering_failed_unknown_error_text - { - buf = qtn_iupnp_err_rendering_failed_unknown; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_NOT_SUPPORTED_ERROR_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_not_supported_error_text - { - buf = qtn_iupnp_err_not_supported; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_general_failure_error_text - { - buf = qtn_iupnp_err_general_failure; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_conn_lost_copy_error_text - { - buf = qtn_iupnp_err_conn_lost_copy; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_EMPTY_BACK -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_empty_back - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyEmpty; - }, - CBA_BUTTON - { - id = EUPnPBackCmd; - txt = text_softkey_back; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_EMTPY_STOP -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_empty_stop - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyEmpty; - }, - CBA_BUTTON - { - id = EUPnPStopCmd; - txt = text_softkey_stop; - } - }; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_ERROR_CON_TEXT -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_error_con_text - { - buf=qtn_iupnp_err_con_failed; - } - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_BROWSE_UPDATE_WAIT_NOTE_DIALOG -// -// -------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnpcommonui_browse_update_wait_note_dialog - { - flags = EAknProgressNoteFlags | EEikDialogFlagWait; - buttons = r_upnpcommonui_softkeys_empty_cancel; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EUPnPBrowseDialogProgressNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_iupnp_wait_list_update; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ANIMATION_FOR_SELECTION_DIALOG -// -//---------------------------------------------------- -// -RESOURCE BMPANIM_DATA r_upnpcommonui_animation_for_selection_dialog - { - frameinterval = 250; - playmode = EAknBitmapAnimationPlayModeCycle; - frames = r_upnpcommonui_animation_for_selection_dialog_images; - bmpfile = "Z:"APP_RESOURCE_DIR"\\UPnPCommonUI.mif"; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ANIMATION_FOR_SELECTION_DIALOG_IMAGES -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_upnpcommonui_animation_for_selection_dialog_images - { - items= - { - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_1 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_1_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_2 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_2_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_3 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_3_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_4 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_4_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_5 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_5_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_6 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_6_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_7 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_7_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_8 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_8_mask;}, - BMPANIM_FRAME {bmpid=EMbmUpnpcommonuiQgn_indi_upnp_search_9 ; maskid=EMbmUpnpcommonuiQgn_indi_upnp_search_9_mask;} - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SERVER_SERVER_SEARCH_MAIN -// -// -------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_server_search_main - { - buf = qtn_iupnp_server_search_main; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNPCOMMONUI_SOFTKEYS_SHOW_STOP -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_softkeys_show_stop - { - buttons = - { - CBA_BUTTON - { - id = EAknSoftkeyShow; - txt = text_softkey_show; - }, - CBA_BUTTON - { - id = EUPnPStopCmd; - txt = text_softkey_stop; - } - }; - } - -// CONSTANTS -#define KStartingYearForDateEditor 1 -#define KEndingYearForDateEditor 9999 -#define KFileNameEditorMaxWidth 255 -#define KFileNameEditorNumOfLines 0 -#define KFileNameEditorMaxLength 255 - - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCEDFIND_WAIT_NOTE_DIALOG -// -//---------------------------------------------------- -// - -RESOURCE DIALOG r_upnpcommonui_advancedfind_wait_note_dialog - { - flags = EAknProgressNoteFlags | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_iupnp_finding_results_note; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_MEDIA_TYPE_SETTING_PAGE -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_media_type_setting_page - { - label = qtn_iupnp_media_type_title; - type = EAknCtPopupSettingList; - editor_resource_id = r_upnpcommonui_media_type_editor; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_FILE_NAME_SETTING_PAGE -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_file_name_setting_page - { - type = EEikCtEdwin;//text editor - editor_resource_id = r_upnpcommonui_file_name_editor; - } -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ARTIST_SETTING_PAGE -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_artist_setting_page - { - type = EEikCtEdwin;//text editor - editor_resource_id = r_upnpcommonui_file_name_editor; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ALBUM_NAME_SETTING_PAGE -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_album_name_setting_page - { - type = EEikCtEdwin;//text editor - editor_resource_id = r_upnpcommonui_file_name_editor; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_GENRE_SETTING_PAGE -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_genre_setting_page - { - type = EEikCtEdwin;//text editor - editor_resource_id = r_upnpcommonui_file_name_editor; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_DATE_FROM_SETTING_PAGE -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_date_from_setting_page - { - type = EEikCtDateEditor; //date editor - editor_resource_id = r_upnpcommonui_date_editor; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_DATE_UNTIL_SETTING_PAGE -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_upnpcommonui_date_until_setting_page - { - type = EEikCtDateEditor; //date editor - editor_resource_id = r_upnpcommonui_date_editor; - } - - - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_UPNPADFIND_SOFTKEYS_OK_BACK__oK -// -//---------------------------------------------------- -// -RESOURCE CBA r_upnpcommonui_upnpadvfind_softkeys_ok_back__ok - { - //flags = 0; - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOk; txt = text_softkey_ok;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyOpen; txt = qtn_msk_change; } - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCED_FIND_MAIN_DIALOG -// -//---------------------------------------------------- -// -RESOURCE DIALOG r_upnpcommonui_advanced_find_main_dialog - { - flags = EAknDialogMultiselectionList; - - buttons = r_upnpcommonui_upnpadvfind_softkeys_ok_back__ok; - items = - { - DLG_LINE - { - type = KAknCtLastControlId; - id = EMultiSelectionListBoxId; - control = AVKON_SETTING_ITEM_LIST - { - flags = EAknSettingItemIncludeHiddenInOrdinal; - initial_number = 1; - items = - { - AVKON_SETTING_ITEM - { - identifier = EAdvancedFindMediaType; - setting_page_resource = r_upnpcommonui_media_type_setting_page; - associated_resource = r_upnpcommonui_media_type_popup_texts; - name = qtn_iupnp_media_type; - }, - AVKON_SETTING_ITEM - { - identifier = EAdvancedFindFileName; - setting_page_resource = r_upnpcommonui_file_name_setting_page; - name = qtn_iupnp_find_file; - }, - AVKON_SETTING_ITEM - { - identifier = EAdvancedFindArtist; - setting_page_resource = r_upnpcommonui_artist_setting_page; - name = qtn_iupnp_find_artist; - }, - AVKON_SETTING_ITEM - { - identifier = EAdvancedFindAlbum; - setting_page_resource = r_upnpcommonui_album_name_setting_page; - name = qtn_iupnp_find_album; - }, - AVKON_SETTING_ITEM - { - identifier = EAdvancedFindGenre; - setting_page_resource = r_upnpcommonui_genre_setting_page; - name = qtn_iupnp_find_genre; - }, - AVKON_SETTING_ITEM - { - identifier = EAdvancedFindDateFrom; - setting_page_resource = r_upnpcommonui_date_from_setting_page; - name = qtn_iupnp_find_date_from; - }, - AVKON_SETTING_ITEM - { - identifier = EAdvancedFindDateUntil; - setting_page_resource = r_upnpcommonui_date_until_setting_page; - name = qtn_iupnp_find_date_until; - } - }; - }; - } - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_MEDIA_TYPE_EDITOR -// -//---------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_upnpcommonui_media_type_editor - { - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_MEDIA_TYPE_POPUP_TEXTS -// -//---------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_upnpcommonui_media_type_popup_texts - { - setting_texts_resource = r_upnpcommonui_advanced_find_media_types_texts; - popped_up_texts_resource = r_upnpcommonui_media_type_texts_popped_up; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCED_FIND_MEDIA_TYPES_TEXTS -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_upnpcommonui_advanced_find_media_types_texts - { - items = - { - AVKON_ENUMERATED_TEXT { value = EAdvancedFindAll; text = qtn_iupnp_mt_all; }, - AVKON_ENUMERATED_TEXT { value = EAdvancedFindImages; text = qtn_iupnp_mt_image; }, - AVKON_ENUMERATED_TEXT { value = EAdvancedFindVideo; text = qtn_iupnp_mt_video; }, - AVKON_ENUMERATED_TEXT { value = EAdvancedFindMusic; text = qtn_iupnp_mt_music; } - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_MEDIA_TYPE_TEXTS_POPPED_UP -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_upnpcommonui_media_type_texts_popped_up - { - items = - { - LBUF { txt = qtn_iupnp_mt_all; }, - LBUF { txt = qtn_iupnp_mt_image; }, - LBUF { txt = qtn_iupnp_mt_video; }, - LBUF { txt = qtn_iupnp_mt_music; } - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_DATE_EDITOR -// -//---------------------------------------------------- -// -RESOURCE DATE_EDITOR r_upnpcommonui_date_editor - { - minDate = DATE - { - year=KStartingYearForDateEditor; - }; - - maxDate = DATE - { - year=KEndingYearForDateEditor; - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_FILE_NAME_EDITOR -// -//---------------------------------------------------- -// -RESOURCE EDWIN r_upnpcommonui_file_name_editor - { - width = KFileNameEditorMaxWidth; - lines = KFileNameEditorNumOfLines; - maxlength = KFileNameEditorMaxLength; - default_case = EAknEditorTextCase; - } - - - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_TITLE -// -//---------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_title - { - buf = qtn_iupnp_search_results; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILE -// -//---------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_file - { - buf = qtn_iupnp_nof_file; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILES -// -//---------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_files - { - buf = qtn_iupnp_nof_files; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_NO_RESULTS -// -//---------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_advanced_find_search_result_no_results - { - buf = qtn_iupnp_no_files_found; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_RESULT_WINDOW_MENUBAR -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_upnpcommonui_result_window_menubar - { - titles = - { - MENU_TITLE { menu_pane = r_upnpcommonui_result_window_menu;} - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_RESULT_WINDOW_MENU -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_upnpcommonui_result_window_menu - { - items = - { - MENU_ITEM - { - command = EUPnPShow; - txt = qtn_iupnp_show_ext_main; - cascade = r_upnpcommonui_menupane_show_sub_menu; - }, - MENU_ITEM - { - command = EUPnPPlay; - txt = qtn_iupnp_play_ext_main; - cascade = r_upnpcommonui_menupane_play_sub_menu; - }, - MENU_ITEM - { - command = EUPnPCopy; - txt = qtn_iupnp_copy_main; - }, - MENU_ITEM - { - cascade = R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION; - command = EAknCmdEditListMenu; - txt = qtn_options_list; - }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_ADVANCED_FIND_RESULT_DIALOG -// -//---------------------------------------------------- -// -RESOURCE DIALOG r_upnpcommonui_advanced_find_result_dialog - { - flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EEikDialogFlagFillAppClientRect | - EEikDialogFlagCbaButtons | EEikDialogFlagWait; - - buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; - items = - { - DLG_LINE - { - id = EAdvFindResultBoxId; - type = EAknCtDoubleGraphicListBox; - control = LISTBOX - { - flags = EAknListBoxMarkableList; - }; - } - }; - } - -//---------------------------------------------------- -// -// R_COMMONUI_ADVANCED_FIND_TOO_MANY_RESULTS_ERROR -// -//---------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_advanced_find_too_many_results_error - { - buf=qtn_iupnp_too_big_cache_note_text; - } - -//---------------------------------------------------- -// -// R_UPNPCOMMONUI_NO_ITEMS_TO_PLAY_TEXT -// -//---------------------------------------------------- -// -RESOURCE TBUF r_upnpcommonui_no_items_to_play_text - { - buf=qtn_iupnp_no_items_to_play_text; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/group/bld.inf --- a/upnpframework/upnpcommonui/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2006 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 information file for CommonUI -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../inc/upnpcommonui.h |../../../inc/upnpcommonui.h -../inc/upnplocalplayer.h |../../../inc/upnplocalplayer.h -../inc/upnpnavipanecontainer.h |../../../inc/upnpnavipanecontainer.h - -PRJ_MMPFILES -upnpcommonui.mmp - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE upnpcommonui.mif -OPTION HEADERFILE upnpcommonui.mbg -OPTION SOURCEDIR ../bitmaps -OPTION SOURCES \ - -c8,8 qgn_graf_upnp_ext_renderer \ - -c8,8 qgn_graf_upnp_ext_renderer_list_icon \ - -c8,8 qgn_server_icon \ - -c8,8 qgn_prop_mserv_music \ - -c8,8 qgn_prop_mserv_other_images \ - -c8,8 qgn_prop_mserv_other_videos \ - -c8,8 qgn_prop_mserv_folder_small \ - -c8,8 qgn_prop_mserv_folder_locked_small \ - -c8,8 qgn_prop_folder_current \ - -c8,8 qgn_indi_upnp_search_1 \ - -c8,8 qgn_indi_upnp_search_2 \ - -c8,8 qgn_indi_upnp_search_3 \ - -c8,8 qgn_indi_upnp_search_4 \ - -c8,8 qgn_indi_upnp_search_5 \ - -c8,8 qgn_indi_upnp_search_6 \ - -c8,8 qgn_indi_upnp_search_7 \ - -c8,8 qgn_indi_upnp_search_8 \ - -c8,8 qgn_indi_upnp_search_9 -END -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/group/upnpcommonui.mmp --- a/upnpframework/upnpcommonui/group/upnpcommonui.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Common UI Project specification file -* -*/ - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" -#include - -TARGET upnpcommonui.dll -TARGETTYPE dll -UID 0x1000008d 0x10208A1A - -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -// SIS installation + IAD support -VERSION 10.1 -paged - -// Include paths -USERINCLUDE ../inc -USERINCLUDE ../../inc -USERINCLUDE ../../../inc - -APP_LAYER_SYSTEMINCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT - -START RESOURCE ../data/upnpcommonui.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -SOURCEPATH ../src -SOURCE upnpexternaldevicedialog.cpp -SOURCE upnpbrowsecacheitem.cpp -SOURCE upnpbrowsedialog.cpp -SOURCE upnpselectiondialog.cpp -SOURCE upnpcommonui.cpp -SOURCE upnpvideoplayerdialog.cpp -SOURCE upnpnavipanecontainer.cpp -SOURCE upnpadvfinddialog.cpp -SOURCE upnpadvfindlist.cpp -SOURCE upnpimageplayer.cpp -SOURCE upnpadvfindresultwindow.cpp -SOURCE upnplocalplayer.cpp - -// Core platform and UI -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY bafl.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY avkon.lib -LIBRARY aknlayout.lib -LIBRARY AKNSKINS.lib -LIBRARY AknIcon.lib -LIBRARY AknLayout2Scalable.lib -LIBRARY eikctl.lib -LIBRARY eikdlg.lib -LIBRARY featmgr.lib -LIBRARY egul.lib -LIBRARY CommonEngine.lib -LIBRARY fbscli.lib -LIBRARY efsrv.lib -LIBRARY hlplch.lib -LIBRARY gdi.lib -LIBRARY apsettingshandlerui.lib -LIBRARY apengine.lib -LIBRARY aknskinsrv.lib -LIBRARY CommonDialogs.lib -LIBRARY PlatformEnv.lib -LIBRARY commdb.lib -LIBRARY ServiceHandler.lib -LIBRARY commonui.lib -LIBRARY apmime.lib //TDataType -LIBRARY charconv.lib -LIBRARY remconcoreapi.lib -LIBRARY remconinterfacebase.lib - -// ECom -library ecom.lib - -// S60 Upnp Stack -LIBRARY upnpipserversutils.lib -LIBRARY upnpavobjects.lib -LIBRARY avmediaserverclient.lib - -// Upnp Framework -LIBRARY upnputilities.lib -LIBRARY upnpavcontrollerclient.lib -LIBRARY upnpavcontrollerhelper.lib -LIBRARY upnpfiletransferengine.lib -LIBRARY upnpmusicadapter.lib -LIBRARY upnpxmlparser.lib -LIBRARY upnpsettingsengine.lib - -// Logging -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/group/upnpcommonui_uid_.cpp --- a/upnpframework/upnpcommonui/group/upnpcommonui_uid_.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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: -* -*/ -// Makmake-generated uid source file -#include -#pragma data_seg(".SYMBIAN") -__EMULATOR_IMAGE_HEADER2(0x10000079,0x1000008d,0x053898ad,EPriorityForeground,0x000ffffeu,0x00000000u,0x053898ad,0x101fb657,0x00010000,0) -#pragma data_seg() diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpadvfinddialog.h --- a/upnpframework/upnpcommonui/inc/upnpadvfinddialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: advanced find dialog class header -* -*/ - - - -#ifndef UPNPADVANCEDFINDDIALOG_H -#define UPNPADVANCEDFINDDIALOG_H - -// INCLUDES -#include -#include -#include -#include //for status pane - -// FORWARD DECLARATIONS -class CUPnPAdvancedFindList; -class MUPnPAVController; -class MUPnPAVBrowsingSession; -class CUPnPCommonUI; - -// CLASS DECLARATION - -/** -* Class declaration for UPnP Advanced find dialog -* @since Series 60 3.1 -*/ -NONSHARABLE_CLASS( CUPnPAdvancedFindDialog ) : public CAknDialog - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUPnPAdvancedFindDialog* NewL( - TInt aMenuResource, - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPCommonUI& aCommonUI ); - - /** - * Destructor. - */ - virtual ~CUPnPAdvancedFindDialog(); - - public: // New functions - - /** - * Called from CommonUI to destroy the advFind dialog itself - * when the selected media server disappears - * @since Series 60 3.1 - * @param aError exit error - * @return None - */ - void DismissItselfL( TInt aError ); - - public: // Functions from base classes - - /** - * From CAknDialog, handles menu commands - * @since Series 60 Series3.1 - * @param aCommandId, command to be handled - */ - void ProcessCommandL( TInt aCommandId ); - - /** - * From CAknDialog, handles key events. - * @since Series 60 Series3.1 - * @param aKeyEvent Event to handled. - * @param aType Type of the key event. - * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). - */ - TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, - TEventCode aType ); - - protected: // Functions from base classes - /** - * From CAknDialog, handles layout initialization - * @since Series 60 Series3.1 - * @param none - * @return none - */ - void PreLayoutDynInitL(); - - /** - * From CAknDialog, handles focus changes of the dialog - * @since Series 60 Series3.1 - * @param aButtonId, pressed button id - * @return True if ready to close dialog, False otherwise - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * Creates custom control - * @since Series 60 Series3.1 - * @param aControlType, control type - * @return SEikControlInfo control info - */ - virtual SEikControlInfo CreateCustomControlL( TInt aControlType ); - - private: - - /** - * C++ default constructor. - */ - CUPnPAdvancedFindDialog::CUPnPAdvancedFindDialog( - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPCommonUI& aCommonUI ); - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( TInt aMenuResource ); - - private: - - /** - * Set dialog title - */ - void SetTitleL(); - - private: // Data - - // list member variable for dialog data - CUPnPAdvancedFindList* iSettingsList; // not owned - // title pane - CAknTitlePane* iTitlePane; // not owned - // status pane - CEikStatusPane* iStatusPane; // not owned - - MUPnPAVController& iAVControl; // not owned - MUPnPAVBrowsingSession& iBrowseSession; // not owned - - // title text before find - HBufC* iOriginalTitleText; // owned - CUPnPCommonUI& iCommonUI; //not owned - - TBool iClose; - }; - -#endif // UPNPADVANCEDFINDDIALOG_H - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpadvfindlist.h --- a/upnpframework/upnpcommonui/inc/upnpadvfindlist.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,323 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: List for data of settings dialog -* -*/ - - -#ifndef UPNPADVANCEDFINDLIST_H -#define UPNPADVANCEDFINDLIST_H - -// INCLUDES -// System -#include -#include - -// upnpframework / avcontroller api -#include "upnpavbrowsingsessionobserver.h" - -// commonui internal -#include "upnpcommonui.h" - - -const TInt KMaxNameLength = 256; -const TInt KGranularityOfArrays = 8; -const TInt KSizeOfTBufC16 = 32; - -// FORWARD DECLARATIONS -class MUPnPAVController; -class MUPnPAVBrowsingSession; -class CAdvancedFindResultWindow; -class CUPnPAdvancedFindDialog; -class CUPnPCommonUI; - -/** -* Settings list class declaration -* @since Series 60 3.1 -*/ -NONSHARABLE_CLASS( CUPnPAdvancedFindList ) : public CAknSettingItemList, - public MUPnPAVBrowsingSessionObserver, - public MProgressDialogCallback - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUPnPAdvancedFindList* NewL( - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPAdvancedFindDialog& aParent, - CUPnPCommonUI& aCommonUI ); - - /** - * Destructor. - */ - virtual ~CUPnPAdvancedFindList(); - - public: // Functions from base classes - - /** - * From CAknSettingItemList, this launches the setting page. - * @since Series 60 Series3.1 - * @param aIndex, index of selected list item - * @param aCalledFromMenu, indicates if editing is called trough menu - * or from keyboard - * @return none - */ - void EditItemL ( TInt aIndex, TBool aCalledFromMenu ); - - /** - * Launch up CAknSettingItemList - * @since Series 60 3.1 - * @param none - * @return error code - */ - TInt MakeQueryL( ); - - public: //From MProgressDialogCallback - - /** - * Callback method Get's called when a dialog is dismissed - * @since Series 60 3.1 - * @param aButtonId the reason when the dialog is dismissed - * @return none - */ - void DialogDismissedL( TInt aButtonId ); - - public: //From MUPnPAVBrowsingSessionObserver - - /** - * Returns a browse result received from a Media Server. - * - * @since Series 60 3.1 - * @param aBrowseResponse browse response xml document - * @param aError system wide error code - * @param aMatches number of returned items - * @param aTotalCount total number of objects on container - * @param aUpdateId update id number - * @return None - */ - void BrowseResponse( - const TDesC8& /*aBrowseResponse*/, - TInt /*aError*/, - TInt /*aMatches*/, - TInt /*aTotalCount*/, - const TDesC8& /*aUpdateId*/ - ){}; - - /** - * Returns a search result received from a Media Server. - * - * @param aSearchResponse search response xml document - * @param aError system wide error code - * @param aMatches number of returned items - * @param aTotalCount total number of resulted items - * @param aUpdateId update id number - * @return None - */ - void SearchResponse( - const TDesC8& aSearchResponse, - TInt aError, - TInt aMatches, - TInt aTotalCount, - const TDesC8& aUpdateId - ); - - /** - * Returns processed search results received from a Media Server. - * - * @since Series 60 3.1 - * @param TInt aError status information - * @param aTotalCount TInt total number of objects - * @param RPointerArray of CUpnpObject objects - * @return None - */ - void SearchResponseL( - TInt aStatus, - const RPointerArray& aResultArray ); - - /** - * Returns search capabilities of the requested Media Server. - * - * @since Series 60 3.1 - * @param TInt aError status information - * @param HBufC8& the search capabilities string - * @return None - */ - void SearchCapabilitiesResponse( TInt /*aError*/, - const TDesC8& /*aSearchCapabilities*/ ){}; - - /** - * Notifies that the create container operation is complete. - * - * @since Series 60 3.1 - * @param aError status information - * @param aObjectId (const TDesC8&) object ID of the new container - */ - void CreateContainerResponse( TInt /*aError*/, - const TDesC8& /*aObjectId = KNullDesC8*/ ) - {}; - - /** - * Notifies that the requested UPnP Object deletion is complete. - * - * @since Series 60 3.1 - * @param aError status information - * @return None - */ - void DeleteObjectResponse( TInt /*aError*/ ){}; - - /** - * Notifies that the Media Server we have a session with has - * disappeared. Session is now unusable and must be closed. - * - * @since Series 60 3.1 - * @param aReason reason code - * @return None - */ - void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason ); - - /** - * Notifies that the Media Server we have a session with has - * disappeared. Session is now unusable and must be closed. - * - * @since Series 60 3.1 - * @param aReason reason code - * @return None - */ - void MediaServerDisappearedL( TUPnPDeviceDisconnectedReason aReason ); - - /** - * Notifies that a local media server has been on sharing - * - * @since Series 60 3.1 - * @param aReason reason code - * @return None - */ - void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){}; - - public: //business logic - - /** - * Check if the setting page is open - * - * @since Series 60 3.1 - * @param none - * @return TBool ETrue if the setting is open - */ - TBool IsSettingPageOpen() const; - - protected: // Functions from base classes - - /** - * Handles a change to the control's resources - * - * @since Series 60 3.1 - * @param aType a message UID value. - * @return None - */ - void HandleResourceChange( TInt aType ); - - private: - - /** - * C++ default constructor. - */ - CUPnPAdvancedFindList( MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPAdvancedFindDialog& aParent, - CUPnPCommonUI& aCommonUI ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * From CAknSettingItemList, Framework method to create a setting item. - * @since Series 60 Series3.1 - * @param aIdentifier, list item id to be created - * @return CAknSettingItem, pointer to list item - */ - CAknSettingItem* CreateSettingItemL( TInt aIdentifier ); - - /** - * Get search criteria - * @since Series 60 Series3.1 - * @param none - * @return search criteria - */ - HBufC8* BuildSearchCriteriaL() const; - - private: // Data - - //time variable for date from item - TTime iDateFrom; - //time variable for date Until item - TTime iDateUntil; - //time variable for initial date from item - TTime iDateInitial; - - // Boolean flag telling if Search response received - TBool iSearchResponseReceived; - - // text for artist selection item - TBuf iArtistText; - // text for album selection item - TBuf iAlbumText; - // text for Genre selection item - TBuf iGenreText; - - TBuf iFileName; - - //chosen media type - TInt iMediatype; - - // wait note dialog - CAknWaitDialog* iWaitNoteDialog; - - - MUPnPAVController& iAVControl; - - //observer for browse results - MUPnPAVBrowsingSessionObserver* iBrowseObserver; - - //Array for search result - RPointerArray iResultArray; - - CAdvancedFindResultWindow* iFindResultWindow; //not owned - CUPnPCommonUI& iCommonUI; - CUPnPAdvancedFindDialog& iAdvancedFindDialog; - - MUPnPAVBrowsingSession& iBrowseSession; - - CUPnPCommonUI::TUPnPAction iAction; - - TInt iExitCode; - - // iShowingErrorNote tells if we are showing the error note. - // During the error note is shown, we cannot destroy our parent dialog - // because then the continuation after error note fails (crashes) - TBool iShowingErrorNote; - - TBool iClose; - TBool iSettingPageOpen; - - TUPnPDeviceDisconnectedReason iCloseReason; - - }; -#endif // UPNPADVANCEDFINDLIST_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpadvfindresultwindow.h --- a/upnpframework/upnpcommonui/inc/upnpadvfindresultwindow.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,381 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implements CAdvancedFindResultWindow class -* -*/ - - -#ifndef ADVANCEDFINDRESULTWINDOW_H -#define ADVANCEDFINDRESULTWINDOW_H - -// INCLUDES -#include -#include //for status pane -#include -#include -#include "upnpdeviceobserver.h" -#include "upnpcommonui.h" - -// FORWARD DECLARATIONS -class CUPnPCommonUI; -class MUPnPAVController; -class CUpnpImagePlayer; -class CUPnPMusicAdapter; -class CUPnPLocalPlayer; -class CUPnPPeriodic; - -// DATA TYPES - -// CLASS DECLARATION - -/** -* CAdvancedFindResultWindow dialog class -* @since Series 60 3.1 -*/ -NONSHARABLE_CLASS( CAdvancedFindResultWindow ) : - public CAknDialog, - public MUPnPDeviceObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CAdvancedFindResultWindow* NewL( - TInt aMenuResource, - RPointerArray& aResultArray, - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ); - - /** - * Destructor. - */ - virtual ~CAdvancedFindResultWindow(); - - public: //from MUPnPDeviceObserver - - /** - * This is called when the WLAN or a media server to be browsing - * has disappeard - * To close itself - * @since Series 60 3.1 - * @param aError exit reason - * @return none - */ - void DeviceDisappeared( TInt aError ); - - public: //new functions - - /** - * Close the browse dialog itself - * @since Series 60 3.1 - * @param aError exit reason - * @return None - */ - void DismissItselfL( TInt aError ); - - /** - * Callback method for the iImageControlTimer. - * - * @since Series 60 3.2.3 - * @param aDlg current dialog which to be called - * @return Tint - */ - static TInt ImageControlTimerCallbackL(TAny* aDlg); - - protected: // New functions - - /** - * To load list items when the dialog is initialized - * @since Series 60 3.1 - * @param none - * @return none - */ - void LoadListItemsL(); - - /** - * 2nd constructor - */ - void ConstructL( TInt aMenuResource, - RPointerArray& aResultArray ); - - /** - * Modifies navigation pane text - * @since Series 60 3.1 - */ - void SetNaviPaneTextL(); - - /** - * Loads a possibly skinned icon and adds it to icon array - * @since Series 60 3.1 - * @param CAknIconArray, array of icons - * @param MAknsSkinInstance, skin instance - * @param TDesC, reference to icon file - * @param TAknsItemID, skinned icon id - * @param TInt, bitmap id - * @param TInt, bitmap mask id - */ - - void AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ); - - /** - * Mark or unmark a menu item - * @since Series 60 3.1 - * @param aItem a menu item to be marked - * @param aMark a menu item should be marked or not - * @return none - */ - void MarkUnmarkL(TInt aItem, TBool aMark); - - /** - * Play a seleted item - * @since Series 60 3.1 - * @param aLocal if the selected item is a local or remote - * @return none - */ - void PlayL( TBool aLocal ); - - /** - * Show or play an item on remote renderer - * @since Series 60 3.1 - * @param none - * @return none - */ - void ShowPlayExtL(); - - /** - * Show or play an item on local renderer - * @since Series 60 3.1 - * @param none - * @return none - */ - - void ShowPlayLocalL(); - - /** - * updates command button area - * @since Series 60 3.23 - * @param aMark use for two states, item marked or no marked - * @param aTempCounter is the number of the current item in the list. - * @return None - */ - void UpdateCommandButtonAreaL( TBool aMark, TInt aTempCounter ); - - /** - * updates command button area - * @since Series 60 3.23 - * @param aMark use for two states, item marked or no marked - * @param aTempCounter is the number of the current item in the list. - * @return None - */ - void UpdateCommandButtonArea( TBool aMark, TInt aTempCounter ); - - protected: // Functions from base classes - - /** - * From CAknSelectionListDialog, handles layout initialization - * @since Series 60 3.1 - */ - void PreLayoutDynInitL(); - - /** - * From CAknDialog, handles menu commands - * @since Series 60 3.1 - * @param aCommandId, command to be handled - * @return none - */ - void ProcessCommandL( TInt aCommandId ); - - /** - * From CAknSelectionListDialog, handles key events. - * @since Series 60 3.1 - * @param TKeyEvent, Event to handled. - * @param TEventCode, Type of the key event. - * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). - */ - TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, - TEventCode aType ); - - /** - * From CAknSelectionListDialog, handles focus changes of the dialog - * @since Series 60 3.1 - * @param TInt, pressed button id - * @return TBool, ETrue if ready to close dialog, EFalse otherwise - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * Menu observer interface. From MEikMenuObserver - * @since Series 60 3.1 - * @param aResourceId resource ID identifying the menu pane - * to initialise. - * @param aMenuPane The in-memory representation of the menu pane - * @return none - */ - void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane); - - private: - /** - * C++ default constructor. - */ - CAdvancedFindResultWindow( MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ); - - /** - * From CoeControl - * @param TCoeHelpContext, context of desired help - * @return none - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - - /** - * Show a video on a remote renderer - * @since Series 60 3.1 - * @param none - * @return none - */ - void ShowVideoExtL(); - - /** - * Show an image on a remote renderer - * @since Series 60 3.1 - * @param none - * @return void - */ - void ShowImageExtL(); - - /** - * Shows current image - * @since Series 60 3.2.3 - * @param aShowImage (TBool) shows current image and draws showing - * icon - * @return None - */ - void ShowCurrentImageL( TBool aShowImage ); - - /** - * Starts imageControl timer - * @since Series 60 3.2.3 - * @param None - * @return None - */ - void StartImageControlTimer(); - - /** - * Stops ImageControl - * @since Series 60 3.2.3 - * @param None - * @return None - */ - void StopImageControlL(); - - /** - * Handle different errors returned from other dialogs - * @since Series 60 3.1 - * @param exiting reason - * @return none - */ - void HandleErrorL( TInt aError ); - - /** - * Handel copy - * @since Series 60 3.1 - * @param none - * - * @return none - */ - void HandleCopyL(); - - /** - * Updates softkeys - * @since Series 60 3.2 - * @param aResourceId (TInt) softkey resource - * @return None - */ - void UpdateSoftkeysL( TInt aResourceId ); - - /** - * Check if any audio item is marked - * @since Series 60 3.1 - * @param None - * @return ETrue if at least one audio item is marked - */ - TBool IsAudioItemMarked( void ); - - private: //data - - //used for CUpnpFileTransferEngine only - MUPnPAVBrowsingSession& iBrowseSession; - // find results (NOT OWNED) - RPointerArray iResultArray; - // dialog control item (NOT OWNED) - CAknDoubleGraphicStyleListBox* iListBox; - // navi pane decorator - CAknNavigationDecorator* iNaviDecorator; - // navipane member (NOT OWNED) - CAknNavigationControlContainer* iNaviPane; - // title pane (NOT OWNED) - CAknTitlePane* iTitlePane; - - MUPnPAVController& iAVControl; - - // pointer to device selection - CUPnPCommonUI& iCommonUI; - - //ImageControl periodic timer (own) - CUPnPPeriodic* iImageControlTimer; - - CUpnpImagePlayer* iImagePlayer; - - CUPnPLocalPlayer* iLocalPlayer; - - CUpnpAVDevice* iTargetDevice; - - // the media server device (NOT OWNED) - const CUpnpAVDevice* iSourceDevice; - - TInt iChildDialogOpen; - - //flag to either media server disappears or media renderer disappear - TBool iMSDisappear; - - CUPnPCommonUI::TUPnPAction iAction; - - TInt iCopyIndex; - - TBool iIsMusicItem; - - /** - * for music playing, this is to prevent user to pop up renderer - * selection and select renderer multiple times - */ - TBool iMusicPlay; - - // Flag to tell if the image control view is active - TBool iImageControlActive; - - // The Index of last show image - TInt iLastImageItemIndex; - // Flag to tell if the the Hash (#) key is Holding down - TBool iHashKeyFlag; - }; -#endif -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpbrowsecacheitem.h --- a/upnpframework/upnpcommonui/inc/upnpbrowsecacheitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Header file for the UPnPSelectionDialog class implementation -* -*/ - - -#ifndef __UPNP_BROWSE_CACHE_ITEM_H__ -#define __UPNP_BROWSE_CACHE_ITEM_H__ - -// FORWARD DECLARATIONS -class CUpnpObject; - -class CUPnPBrowseCacheItem : public CBase - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - //IMPORT_C static CUPnPBrowseCacheItem* NewL(); - - /** - * Two-phased constructor. - */ - IMPORT_C static CUPnPBrowseCacheItem* NewL( - const TDesC8& aContainer, - TInt aHighLightedItem, - TInt aFirstItem); - - /** - * Destructor. - */ - IMPORT_C virtual ~CUPnPBrowseCacheItem(); - - /** - * Returns the container Id - * @since Series 60 3.1 - * @param None - * @return HBufC8& the container Id - */ - IMPORT_C const HBufC8& ContainerId() const; - - /** - * Sets the item array - * @since Series 60 3.1 - * @param aBrowseArray CUpnpObjectList Pointer - * @return None - */ - IMPORT_C void SetItemArrayL( - const RPointerArray& aBrowseArray ); - - /** - * Sets the index of the first item - * @since Series 60 3.1 - * @param aFirstItem (TInt) index of the first item - * @return None - */ - IMPORT_C void SetFirstItem( const TInt aFirstItem ); - - /** - * Sets the total count of items in this container - * @since Series 60 3.2 - * @param aTotalCount (TInt) number of items in this container - * @return None - */ - void SetTotalCount( const TInt aTotalCount ); - - /** - * Sets the index of the highlighted item - * @since Series 60 3.1 - * @param aHighLightedItem (TInt) index of the first item - * @return None - */ - IMPORT_C void SetHighLightedItem(const TInt aHighLightedItem); - - /** - * Returns an object - * @since Series 60 3.1 - * @param aItemToGet (TInt) index of the item - * @return CUpnpObject& the object - */ - IMPORT_C const CUpnpObject* GetItem(const TInt aItemToGet); - - /** - * Returns the number of items - * @since Series 60 3.1 - * @param None - * @return TInt& the number of items - */ - IMPORT_C TInt GetNumberOfItems() const; - - /** - * Returns the index of the top most item - * @since Series 60 3.1 - * @param None - * @return TInt& the index of the top most item - */ - IMPORT_C TInt GetUpperMostItem() const; - - /** - * Returns the total count of items in this container - * @since Series 60 3.2 - * @param None - * @return TInt total number of items - */ - TInt GetTotalCount() const; - - /** - * Returns the index of the highlighted item - * @since Series 60 3.1 - * @param None - * @return TInt& the index the highlighted item - */ - IMPORT_C TInt GetHighlightedItem() const; - - protected: - - /** - * C++ default constructor. - */ - CUPnPBrowseCacheItem(); - - private: - - /** - * 2nd constructor - */ - void ConstructL( const TDesC8& aContainer, - TInt aHighLightedItem, - TInt aFirstItem ); - - protected: // Data - - // Object ID - HBufC8* iContainerData; //owned - - //array of items - RPointerArray iItemArray; // owned - - //first Item in Array - TInt iFirstItem; - - //first Item in Array - TInt iTotalCount; - - //highlighted item - TInt iHighLightedItem; - - }; - -#endif // __UPNP_BROWSE_CACHE_ITEM_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpbrowsedialog.h --- a/upnpframework/upnpcommonui/inc/upnpbrowsedialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,674 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Header file for the UPnPSelectionDialog class implementation -* -*/ - - -#ifndef __UPNP_BROWSE_DIALOG_H__ -#define __UPNP_BROWSE_DIALOG_H__ - -// INCLUDES -// System -#include - -// upnpframework / avcontroller api -#include "upnpavbrowsingsessionobserver.h" -#include "upnpavrenderingsessionobserver.h" - -// commonui internal -#include "upnpdeviceobserver.h" - -// FORWARD DECLARATIONS -class CUPnPMusicAdapter; -class CUPnPLocalPlayer; -class CUPnPBrowseCacheItem; -class CAknIconArray; -class CUPnPCommonUI; -class CUpnpImagePlayer; -class CUPnPBrowsePlaylistFiller; -class CUPnPPeriodic; - -/** -* Browse dialog class of Common UI library -*/ -class CUPnPBrowseDialog : public CAknDialog, - public MUPnPAVBrowsingSessionObserver, - public MProgressDialogCallback, - public MUPnPDeviceObserver - - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CUPnPBrowseDialog* NewL( - TInt aMenuResource, - MUPnPAVController& aAVControl, - const CUpnpAVDevice& aDevice, - CUPnPCommonUI& aCommonUI ); - - /** - * Destructor. - */ - IMPORT_C virtual ~CUPnPBrowseDialog(); - - public: // Methods from MUPnPAVBrowsingSessionObserver - - /** - * Returns a browse result received from a Media Server. - * - * @since Series 60 3.1 - * @param aBrowseResponse browse response xml document - * @param aError system wide error code - * @param aMatches number of returned items - * @param aTotalCount total number of objects on container - * @param aUpdateId update id number - * @return None - */ - void BrowseResponse( - const TDesC8& aBrowseResponse, - TInt aError, - TInt aMatches, - TInt aTotalCount, - const TDesC8& aUpdateId - ); - - /** - * Returns a search result received from a Media Server. - * - * @param aSearchResponse search response xml document - * @param aError system wide error code - * @param aMatches number of returned items - * @param aTotalCount total number of resulted items - * @param aUpdateId update id number - * @return None - */ - void SearchResponse( - const TDesC8& /*aSearchResponse*/, - TInt /*aError*/, - TInt /*aMatches*/, - TInt /*aTotalCount*/, - const TDesC8& /*aUpdateId*/ - ){}; - - /** - * Notifies that the create container operation is complete. - * - * @since Series 60 3.1 - * @param TInt, status information - * @param aObjectId (const TDesC8&) object ID of the new container - */ - void CreateContainerResponse( TInt /*aError*/, - const TDesC8& /*aObjectId = KNullDesC8*/ ){}; - - /** - * Notifies that the requested UPnP Object deletion is complete. - * - * @since Series 60 3.1 - * @param TInt, status information - * @return None - */ - void DeleteObjectResponse( TInt /*aError*/ ){}; - - /** - * Returns search capabilities of the requested Media Server. - * - * @since Series 60 3.1 - * @param TInt, status information - * @param HBufC8&, the search capabilities string - * @return None - */ - void SearchCapabilitiesResponse( TInt /*aError*/, - const TDesC8& /*aSearchCapabilities*/ ){}; - - - /** - * Notifies that the Media Server we have a session with has - * disappeared. Session is now unusable and must be closed. - * - * @since Series 60 3.1 - * @param aReason reason code - * @return None - */ - void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason ); - - /** - * Notifies that the Local Media Server has been put on sharing state - * - * @since Series 60 3.1 - * @param aReason reason code - * @return None - */ - void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){}; - - protected: // from CoeControl - - /** - * Gets the control's help context. - * @param TCoeHelpContext, context of desired help - * @return none - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - - public: // From MProgressDialogCallback - - /** - * Callback function for progress bar. - * - * @since Series 60 3.1 - * @param aButtonId, id of the button pressed - * @return None - */ - void DialogDismissedL( TInt aButtonId ); - - public: // New functions - - /** - * Sends the browse request to UPnP AV Controller. When result set - * arrives, UPnP AV Controller will call the "BrowseResponse" call - * back method. - * - * @param TInt index of the iBrowseArray object, if -1 is given, - * the root container will be browsed. - * @return None - */ - void SendBrowseRequestL( TInt aIndex ); - - /** - * Callback method for the iImageControlTimer. - * - * @since Series 60 3.1 - * @param aDlg current dialog which to be called - * @return Tint - */ - static TInt ImageControlTimerCallbackL(TAny* aDlg); - - - protected: // Functions from base classes - - /** - * From CAknDialog, handles menu commands - * @param aCommandId, command to be handled - * @return none - */ - void ProcessCommandL( TInt aCommandId ); - - /** - * From CAknDialog, handles key events. - * @param TKeyEvent, Event to handled. - * @param TEventCode, Type of the key event. - * @return TKeyResponse, response code (EKeyWasConsumed, - * EKeyWasNotConsumed). - */ - TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, - TEventCode aType); - - /** - * From CAknDialog, handles layout initialization - */ - void PreLayoutDynInitL(); - - /** - * Menu observer interface. From MEikMenuObserver - * @since Series 60 3.1 - * @param aResourceId resource ID identifying the menu pane to - * initialise. - * @param aMenuPane The in-memory representation of the menu pane - * @return none - */ - void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane); - - /** - * From CAknDialog, handles focus changes of the dialog - * @param aButtonId, pressed button id - * @return True if ready to close dialog, False otherwise - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * From CoeControl - */ - void HandleResourceChange(TInt aType); - - - public: // Methods from MUPnPDeviceObserver - - /** - * Notifies that the target renderer disappeared - * - * @since Series 60 3.1 - * @param aError exit reason - * @return None - */ - void DeviceDisappeared( TInt aError ); - - private: // New Functions - - /** - * Loads a possibly skinned icon and adds it to icon array - * @since Series 60 3.1 - * @param CAknIconArray, array of icons - * @param MAknsSkinInstance, skin instance - * @param TDesC, reference to icon file - * @param TAknsItemID, skinned icon id - * @param TInt, bitmap id - * @param TInt, bitmap mask id - */ - void AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId); - - /** - * Marks one item - * @since Series 60 3.1 - * @param aItemIndex (TInt) index of item that should be marked - * @return None - */ - void MarkItemL( TInt aItemIndex ); - - /** - * Unmarks one item - * @since Series 60 3.1 - * @param aItemIndex (TInt) index of item that should be unmarked - * @return None - */ - void UnmarkItem( TInt aItemIndex ); - - /** - * Marks all items. Does not mark any containers. - * @since Series 60 3.1 - * @return None - */ - void MarkAllItemsL(); - - /** - * Unmarks all items - * @since Series 60 3.1 - * @return None - */ - void UnmarkAllItems(); - - /** - * Unmarks one item - * @since Series 60 3.1 - * @param aItemIndex (TInt) index of item that should be unmarked - * @return None - */ - void UnMarkItemL( TInt aItemIndex ); - - /** - * Plays music file - * @since Series 60 3.1 - * @param none - * @return none - */ - void PlayL(TBool aLocal); - - /** - * Show image, video and music on external media renderer - * @since Series 60 3.1 - * @param none - * @return none - */ - void ShowPlayExtL(); - - /** - * Displays wait note - * @since Series 60 3.1 - * @param TInt, note resource - */ - void DisplayWaitNoteL( TInt aResource ); - - - /** - * Dismisses wait note - * @since Series 60 3.2.3 - */ - void DismissWaitNoteL(); - - /** - * Called when target device responds to browse query - * @since Series 60 3.1 - * @param TInt, query status - * @param aTotalCount TInt total number of objects - * @param RPointerArray&, returned item array - * @return None - */ - void BrowseResponseL( - TInt aError, - TInt aTotalCount, - const RPointerArray& aResultArray ); - - - - - /** - * updates selected items array - * @since Series 60 3.1 - * @param None - * @return None - */ - void SelectedArrayCheckL(void); - - /** - * updates command button area - * @since Series 60 3.23 - * @param aMark use for two states, item marked or no marked - * @param aTempCounter is the number of the current item in the list. - * @return None - */ - void UpdateCommandButtonAreaL( TBool aMark, TInt aTempCounter ); - - /** - * updates command button area - * @since Series 60 3.23 - * @param aMark use for two states, item marked or no marked - * @param aTempCounter is the number of the current item in the list. - * @return None - */ - void UpdateCommandButtonArea( TBool aMark, TInt aTempCounter ); - - private: - - /** - * C++ default constructor. - */ - CUPnPBrowseDialog( MUPnPAVController& aAVControl, - CUPnPCommonUI& aCommonUI, - const CUpnpAVDevice& aDevice ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( TInt aMenuResource ); - - /** - * Loads listbox items - * @since Series 60 3.1 - * @return none - */ - void LoadListItemsL( void ); - - /** - * Delete old list items - * @since Series 60 3.1 - * @return none - */ - void DeleteListItemsL( void ); - - /** - * Clears dialog title - * @since Series 60 3.1 - * @return none - */ - void ClearTitleL(); - - /** - * Updates navi pane text - * @since Series 60 3.1 - * @return none - */ - void UpdateNaviPaneTextL(); - - /** - * Check if the container with the specified container Id exists - * @since Series 60 3.1 - * @param aCheckContainerId the container Id to be checked - * @return the found result - */ - TInt CacheCheck( const TDesC8& aCheckContainerId ); - - /** - * Update the cache if any new container is found - * @since Series 60 3.1 - * @param aContainerId the container Id to be checked - * @param aNewItem check if the container is new or not - * @return the found result - */ - void CacheItemUpdateL( const TDesC8& aContainerId, TBool aNewItem ); - - /** - * Send dummy browse response - * @since Series 60 3.1 - * @param aCacheIndex the index in the cache array - * - * @return none - */ - void SendDummyBrowseResponseL( TInt aCacheIndex ); - - /** - * Starts ImageControl - * @since Series 60 3.1 - * @param None - * @return none - */ - void StartImageControlL(); - - /** - * Stops ImageControl - * @since Series 60 3.1 - * @param None - * @return None - */ - void StopImageControlL(); - - /** - * Updates softkeys - * @since Series 60 3.1 - * @param aResourceId (TInt) softkey resource - * @return None - */ - void UpdateSoftkeysL( TInt aResourceId ); - - /** - * Starts imageControl timer - * @since Series 60 3.1 - * @param None - * @return None - */ - void StartImageControlTimer( void ); - - /** - * Shows current image - * @since Series 60 3.1 - * @param aShowImage (TBool) shows current image and draws showing - * icon - * @return None - */ - void ShowCurrentImageL( TBool aShowImage ); - - /** - * Shows current video - * @since Series 60 3.1 - * @param none - * @return none - */ - void ShowVideoDialogExtL( ); - - /** - * Handel copy - * @since Series 60 3.1 - * @param None - * - * @return none - */ - void HandleCopyL(); - - /** - * Create a playlist filler representing current music selection - * for starting music playback - * @since Series 60 3.1 - * @param none - * - * @return CUPnPPlayListFiller filler instance - */ - CUPnPPlayListFiller* CreateFillerLC(); - - /** - * Handle different errors returned from other dialogs - * @since Series 60 3.1 - * @param exiting reason - * @return none - */ - void HandleErrorL( TInt aError ); - - /** - * Check if any audio item is marked - * @since Series 60 3.1 - * @param None - * @return ETrue if at least one audio item is marked - */ - TBool IsAudioItemMarked( void ); - - private: // Data - - //listbox - CEikColumnListBox* iListBox; //not owned - //browse result array - RPointerArray iResultArray; //item inside not owned - //navi pane - CAknNavigationDecorator* iNaviDecorator; //owned - // navi pane - CAknNavigationControlContainer* iNaviPane; //not owned - //AV controller - MUPnPAVBrowsingSession* iBrowseSession; //owned - - CUPnPCommonUI& iCommonUI; //not owned - - MUPnPAVController& iAVControl; //not owned - //parent container - RPointerArray iParentId; //owned - // parent name - RPointerArray iParentName; //owned - //common UI - - //wait dialog - CAknWaitDialog* iWaitNoteDialog; //owned - //temporary browse result array - RPointerArray iTempArray; // items inside not owned - //browse direction - TInt iBrowseFlag; - - // stores selected item index - TInt iSelectedItem; - - //exit timer - TBool iFirstResultArray; - TInt iCurrentItem; - TBool iAllObjectsReceived; - - TInt iPrevHighlighteditem; - TInt iUppermostItem; - TInt iBrowseDirection; - - TBool iDummyBrowseResponse; - HBufC8* iCurrentFolderId; //owned - TBool iBrowseRequestSent; - - RPointerArray iBrowseCacheItems; //owned - - CPeriodic* iPeriodic; //owned - - //Array for selected items - RPointerArray iSelectedItemsArray; //owned - //Flag to tell if the image control view is active - TBool iImageControlActive; - //ImageControl periodic timer - CUPnPPeriodic* iImageControlTimer; //owned - - CUpnpImagePlayer* iImagePlayer; //owned - - CUPnPLocalPlayer* iLocalPlayer; //owned - - CUpnpAVDevice* iTargetDevice; //owned - - const CUpnpAVDevice& iSourceDevice; //not owned - - // title pane - CAknTitlePane* iTitlePane; //not owned - - //Flag to tell if shift and Ok was pressed the same time - TBool iShiftAndOkPressed; - - TInt iLastImageItemIndex; - - TInt iChildDialogOpen; - - //flag to either media server disappears or media renderer disappear - TBool iMSDisappear; - - TInt iTotalCount; - - CUPnPCommonUI::TUPnPAction iAction; - - TInt iCopyIndex; - - TBool iRoot; - - TBool iIsMusicItem; - - TBool iAllObjectsReceviedInOneBrowse; - - TInt iNumObjectReceviedInOnBrowse; - - /** - * for music playing, this is to prevent user to pop up renderer - * selection and select renderer multiple times - */ - TBool iMusicPlay; - - TInt iError; - - // is PreLayoutDynInitL done. Used when exiting dialog - TBool iDlgPreLayoutDone; - - // Flag to tell if the the Hash (#) key is Holding down - TBool iHashKeyFlag; - - // Flag to tell if need repeat browse request to get all objects - // which an original browse request desired - TBool iNeedRepeatRequest; - - // Flag to tell if the browse request is original browse request. - TBool iOriginalBrowseRequest; - - // Current number of objects receved from original browse request - TInt iCurrentRecevedObjectIndex; - - // Count of objects which an original browse request desired - TInt iNeedRecevedObjectCount; - - // Server return count of objects in first browse request - TInt iServerReturnObjectCount; - - // If wait note is cancel before the browse dialog is displayed, - // set a value for leave. - TInt iErrorForCancel; - - // Flag to tell if the copying is onging, ETrue: Ongoing - TBool iCopying; - - // Flag to tell if the application should be closed, ETrue: should be closed - TBool iApplicationClose; - }; - -#endif // __UPNP_BROWSE_DIALOG_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpcommonui.h --- a/upnpframework/upnpcommonui/inc/upnpcommonui.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,349 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Header file for the Common UI class -* -*/ - - -#ifndef CUPNPCOMMONUI_H -#define CUPNPCOMMONUI_H - -// INCLUDES -#include -#include -#include - -// CONSTANTS - -// Application UID's needed in code -const TInt KMediaGalleryUID3 = { 0x101F8599 }; - -enum TUPnPBrowseActionIds - { - EUPnPBrowseOpen = 1, - EUPnPBrowseFind, - EUPnPBrowseShowExt, - EUPnPBrowsePlayExt, - EUPnPBrowseCopy - }; - -enum TUPnPBrowseIncomingActionId - { - EUPnPSelectContainer = 1, - EUPnPBrowseFolders - }; - -enum TUPnPDialogTitle - { - EUPnPSelectDeviceTitle = 1, /* "Select device:" */ - EUPnPSelectFolderTitle, /* "Select folder:" */ - EUPnPCopyToTitle, /* "Copy to:" */ - EUPnPMoveToTitle /* "Move to: */ - }; - -enum TUPnPDeviceTypesToSearch - { - EUPnPSearchAllDevices = 1, - EUPnPSearchAllServerDevices, - EUPnPSearchServerDevicesWithCopyCapability, - EUPnPSearchServerDevicesWithSearchCapability, - EUPnPSearchAllRenderingDevices, - EUPnPSearchRenderingDevicesWithImageCapability, - EUPnPSearchRenderingDevicesWithVideoCapability, - EUPnPSearchRenderingDevicesWithImageAndVideoCapability, - EUPnPSearchRenderingDevicesWithAudioCapability - }; - -enum TUPnPPopUpSoftkey - { - EUPnPSoftkeyCopy = 1, - EUPnPSoftkeyMove, - EUPnPSoftkeySelect - }; - -// FORWARD DECLARATIONS -class CAknViewAppUi; -class CUPnPExternalDeviceDialog; -class CUPnPBrowseDialog; -class CUPnPAdvancedFindDialog; -class CUPnPVideoPlayerDlg; -class CUPnPSelectionDialog; -class MUPnPAVController; -class MUPnPAVRenderingSession; -class MUPnPAVBrowsingSession; -class CUPnPPlayListFiller; -class CUPnPMusicAdapter; - -class CUpnpObject; -class CUpnpAVDevice; -class CUpnpContainer; - - - - -// CLASS DECLARATION - -/** -* CUPnPCommonUI class -* -* Collection UI class. -*/ -class CUPnPCommonUI : public CBase - { - public: - - enum TUPnPAction - { - EUPnPNone = 0, - EUPnPBrowse, - EUPnPSearch, - EUPnPCopy, - EUPnPShow - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CUPnPCommonUI* NewL(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CUPnPCommonUI(); - - public: // Business logic methods - - /** - * Executes device selection dialog - * - * @since Series 60 3.1 - * @param aAVControl (MUPnPAVController&) controller for remote devices - * @return TInt, Error code - */ - IMPORT_C TInt ExecuteDeviceDialogL( MUPnPAVController& aAVControl ); - - /** - * Executes browse dialog - * - * @since Series 60 3.1 - * @param aAVControl (MUPnPAVController&) controller for remote devices - * @return TInt, Error code - */ - IMPORT_C TInt ExecuteBrowseDialogL( MUPnPAVController& aAVControl, - const CUpnpAVDevice& aDevice ); - - /** - * Executes video player - * - * @since Series 60 3.1 - * @param aRenderingSession (MUPnPAVRenderingSession& ) - * the rendering session to used for the playback - * @param aObject (CUpnpObject&) the video item to be played - * @return TInt, Error code - */ - IMPORT_C TInt ExecuteVideoPlayerL( - MUPnPAVRenderingSession& aRenderingSession, - const CUpnpObject& aObject ); - - /** - * Executes music player - * - * @since Series 60 3.1 - * @param aAVControl UPnPAVControl reference - * @param aFiller Object that contains playlist information - * @param aRenderer the selected renderer device - * @return TInt error code - */ - IMPORT_C TInt ExecuteMusicPlayerL( MUPnPAVController& aAVControl, - CUPnPPlayListFiller* aFiller, - const CUpnpAVDevice* aTargetDevice ); - - /** - * Displays a UPnP device selection pop-up dialog. - * - * @since Series 60 3.1 - * @param aAVControl (MUPnPAVController&) reference to a - * CUPnPAVControl - * @param aDevice (CUpnpAVDevice&) reference to the device - * @param aType (TUPnPDeviceTypesToSearch), type of device that is - * requested - * @param aTitle (TUPnPDialogTitle) the title for the dialog - * @return TInt exiting reason - */ - IMPORT_C TInt SelectDeviceL( MUPnPAVController& aAVControl, - CUpnpAVDevice& aDevice, - TUPnPDeviceTypesToSearch aType, - TUPnPDialogTitle aTitle ); - - /** - * Dismiss dialog - * when media server disappears - * - * @since Series 60 3.1 - * @param aError exit error - * - * @return None - */ - IMPORT_C void DismissDialogL( TInt aError ); - - /** - * Displays an Connection failed error note needed in aiw engine. - * - * @since Series 60 3.1 - */ - IMPORT_C void DisplayConnectionErrorNoteL(); - - /** - * Displays an Connection lost error note if copying files fails. - * - * @since Series 60 3.2.3 - */ - IMPORT_C void DisplayConnectionLostCopyErrorNoteL(); - - public: // Common API internal interface - - /** - * Executes the Advanced Find Dialog. - * - * @since Series 60 3.1 - * @param aAVControl (MUPnPAVController&) reference to AVController - * @param aBrowsingSession (MUPnPAVBrowsingSession&) reference to the - * rendering session - * @return TInt the status - */ - TInt ExecuteAdvFindDialogL( MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession ); - - /** - * Display a error message - * - * @since Series 60 3.1 - * @param aResource The string from the resource file - * @param aMaxNumberOfResultsShown The integer filled up in the string - * @return None - */ - void DisplayErrorTextL( TInt aResource, - TInt aMaxNumberOfResultsShown ); - - /** - * Displays error note - * - * @since Series 60 3.1 - * @param TInt, note resource - * @return None - */ - void DisplayErrorTextL( TInt aResource ); - - /** - * Displays error note - * - * @since Series 60 3.1 - * @param TInt, note resource - * @param aInfo, note resource - * @return None - */ - void DisplayErrorTextL( TInt aResource, const TDesC& aInfo ); - - - /** - * Displays Information text - * - * @since Series 60 3.1 - * @param TInt, note resource - * @param TInt, number of files copied - * @return None - */ - void DisplayInfoTextL( TInt aResource, - TInt aNumberOfCopy ); - - /** - * Displays Information text - * - * @since Series 60 3.1 - * @param TInt, note resource - * @return None - */ - void DisplayInfoTextL( TInt aResource ); - - /** - * Return number of dialogs created in CommonUI - * - * @since Series 60 3.1 - * @param none - * @return any of dialog created - */ - TBool PresenceOfDialog(); - - /** - * Handle common error code from other dialogs - * - * @since Series 60 3.1 - * @param aError error code - * @return none - */ - void HandleCommonErrorL( TInt aError, - TInt aNumCopyItem ); - - /** - * Get current upnp action - * - * @since Series 60 3.1 - * @param aAction current upnp action - * @return none - */ - void GetUpnpAction( TUPnPAction aAction ); - - private: - - /** - * C++ default constructor - */ - CUPnPCommonUI(); - - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Get Copy location - * @since Series 60 3.1 - * @param aLocation current copy loaction - */ - void GetCopyLocationL( TDes& aLocation ) const; - - private: // Data - - CAknViewAppUi* iAppUi; // Not owned - CUPnPExternalDeviceDialog* iExternalDeviceSelection; // Not owned - CUPnPBrowseDialog* iBrowseSelection; //not owned - CUPnPAdvancedFindDialog* iAdvFindDialog; //not owned - CUPnPVideoPlayerDlg* iVideoPlayerDialog; //not owned - CUPnPSelectionDialog* iDeviceSelection; //not owned - TInt iResFileOffset; - CEikonEnv* iCoeEnv; //not owned - CUPnPMusicAdapter* iMusicAdapter; //owned - CUPnPCommonUI::TUPnPAction iAction; - - /** - * Flag the FeatureManager is initialized or not - */ - TBool iFeatureManagerInitialized; - }; - -#endif // CUPNPCOMMONUI_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpcommonui.hrh --- a/upnpframework/upnpcommonui/inc/upnpcommonui.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* -* Copyright (c) 2005 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: Header file for the Common UI -* -*/ - - -#ifndef UPNPCOMMONUI_HRH -#define UPNPCOMMONUI_HRH - -// DATA TYPES -enum TUPnPCommonUICommandIds - { - EUPnPOpen = 0x7000, - EUPnPFind, - EUPnPHelp, - EUPnPShow, - EUPnPShowExt, - EUPnPPlay, - EUPnPPlayExt, - EUPnPPlayLocal, - EUPnPShowLocal, - EUPnPCopy, - EUPnPUnmark, - EUPnPMark, - EUPnPSubMark, - EUPnPMarkAll, - EUPnPunMark, - EUPnPSubunMark, - EUPnPunMarkAll, - EUPnPMute, - EUPnPUnmute, - EUPnPRepeatPlay, - EUPnPRandom, - EUPnPRepeatOn, - EUPnPRepeatOff, - EUPnPRandomOn, - EUPnPRandomOff - }; - -enum TUPnPExternDeviceDlgLineId - { - EUPnPExternDevicesListBoxId = 1 - }; - -enum TUPnPBrowseDlgLineId - { - EUPnPBrowseListBoxId = 1 - }; - -enum TUPnPVideoPlayerDlgLineId - { - EUPnPVideoPlayerListBoxId = 1, - EUPnPVideoDialogWaitNote - }; - -enum TUPnPCustomControlDialog - { - ECustomCtrlDlgCtCustomControl = 1000 - }; -// MultiViews enumerate command codes -enum TUPnPMediaPlayerCommandIds - { - EUPnPPauseCmd = 1, // start value must not be 0 - EUPnPContinueCmd, - EUPnPReplayCmd, - EUPnPStopCmd, - EUPnPBackCmd, - EUPnPPlayCmd - }; - - -// MultiViews application view ids. -enum TUPnPMediaPlayerViewNumber - { - EUPnPVideoPlayerViewId = 1, - EUPnPMusicPlayerViewId - }; - -enum TUPnPWaitingNote - { - EUPnPWaitingNote=1, - EUPnPBrowseDialogProgressNote - }; - -enum TImageControlDlgLineId // dialog line ids - { - EImageResultBoxId = 1 - }; - -enum THomeConnectMultiSelectionDlgLineId - { - EMultiSelectionListBoxId = 1 - }; - -enum TCbaButtons - { - EAknSoftkeyContinue = 1 - }; - -enum THomeConnectAdvancedFindList - { - EAdvancedFindMediaType = 0, //menee .rss fileen indikaattoriksi - EAdvancedFindFileName, - EAdvancedFindArtist, - EAdvancedFindAlbum, - EAdvancedFindGenre, - EAdvancedFindDateFrom, - EAdvancedFindDateUntil - }; - -enum THomeConnectAdvancedFindMediaTypes - { - EAdvancedFindAll = 0, - EAdvancedFindImages, - EAdvancedFindVideo, - EAdvancedFindMusic - }; - -enum TAdvancedFindType - { - EArtists = 0, - EAlbums, - EGenres - }; - -enum THomeConnectCommandIds - { - EHomeConnectCmdAppOpen = 1, - EAdvancedFindCmdAppHelp, - EAdvancedFindCmdAppChange, - EHomeConnectCmdTrust, - EHomeConnectCmdUnTrust, - EHomeConnectCmdBlock, - EHomeConnectCmdUnBlock - }; - -enum TAdvancedFindResultDlgLineId // dialog line ids - { - EAdvFindResultBoxId = 1 - }; - -#endif // UPNPCOMMONUI_HRH - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpdeviceobserver.h --- a/upnpframework/upnpcommonui/inc/upnpdeviceobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2006 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: CommonUI internal renderer device observer interface -* -*/ - - -#ifndef M_UPNPDEVICEOBSERVER_H -#define M_UPNPDEVICEOBSERVER_H - -// INCLUDES - -// FORWARD DECLARATIONS - -/** -* Defines the response interface for the image play in the -* UPnP CommonUI. -* -* @since Series 60 3.1 -*/ -class MUPnPDeviceObserver - { - - public: - - /** - * Notifies the dialog which should exit - * - * @since Series 60 3.1 - * @param aError reason of exit - * @return None - */ - virtual void DeviceDisappeared( TInt aError ) = 0; - - }; - -#endif // MUPnPDeviceObserver - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpexternaldevicedialog.h --- a/upnpframework/upnpcommonui/inc/upnpexternaldevicedialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -/* -* Copyright (c) 2005 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: Header file for the UPnPSelectionDialog class implementation -* -*/ - - -#ifndef __UPNP_EXTERNAL_DEVICE_DIALOG_H__ -#define __UPNP_EXTERNAL_DEVICE_DIALOG_H__ - -// INCLUDES -#include -#include // CAknNavigationDecorator -#include "upnpavdeviceobserver.h" -#include "upnpnavipanecontainer.h" - -// FORWARD DECLARATIONS -class CAknIconArray; -class MAknsSkinInstance; -class CAknTitlePane; -class CUPnPCommonUI; -class CAknNavigationDecorator; -class MUPnPAVController; - -class CUpnpItem; -class CUpnpAVDeviceList; -/** -* External device dialog class of Common UI library -*/ -NONSHARABLE_CLASS( CUPnPExternalDeviceDialog ) : public CAknDialog, - public MUPnPAVDeviceObserver - { - private: - /** - * C++ default constructor - */ - CUPnPExternalDeviceDialog( MUPnPAVController& aAVControl, - CUPnPCommonUI& aCommonUI ); - - /** - * EPOC default constructor. - */ - void ConstructL(TInt aMenuResource ); - - - public: // Methods from MUPnPAVDeviceObserver - /** - * Notifies that a new UPnP device was discovered. - * - * @since Series 60 3.1 - * @param CUpnpDevice - * @return None - */ - void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ); - - /** - * Notifies that a UPnP device was dissapeared. - * - * @since Series 60 3.1 - * @param CUpnpDevice - * @return None - */ - void UPnPDeviceDisappeared (const CUpnpAVDevice& aDevice ); - - /** - * Notifies that the WLAN connection has been lost. All sessions - * are now usable and must be closed. - * - * @since Series 60 3.1 - * @return None - */ - void WLANConnectionLost(); - - protected: // Functions from base classes - - /** - * From CAknDialog, handles layout initialization - * @since Series 60 3.1 - * @return none - */ - void PreLayoutDynInitL(); - - /** - * From CEikdialog This function is called by the EIKON dialog - * framework just before the dialog is activated, after it - *has called PreLayoutDynInitL() and the dialog has been sized. - * - * @param none - * @since Series 60 3.1 - * @return none - */ - void PostLayoutDynInitL(); - - /** - * From CAknDialog, handles focus changes of the dialog - * @since Series 60 3.1 - * @param TInt, pressed button id - * @return True if ready to close dialog, False otherwise - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * From CAknDialog, dynamically modifies menu - * @since Series 60 3.1 - * @param TInt, menu resource - * @param CEikMenuPane, menu pane resource - */ - void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane); - - /** - * From CAknDialog, handles menu commands - * @since Series 60 3.1 - * @param TInt, command to be handled - */ - void ProcessCommandL (TInt aCommand); - - /** - * From CoeControl - */ - void HandleResourceChange(TInt aType); - - - public: - - /** - * Two-phased constructor. - * @param TInt, menu resource used with the dialog - * @param CUPnPAVControl&, AV controller - * @param CUPnPCommonUI&, pointer to common ui - */ - static CUPnPExternalDeviceDialog* NewL( - TInt aMenuResource, - MUPnPAVController& aAVControl, - CUPnPCommonUI& aCommonUI); - - // Destructor - virtual ~CUPnPExternalDeviceDialog(); // destruct and give statistics - - - private: // New Functions - - /** - * Loads a possibly skinned icon and adds it to icon array - * @since Series 60 3.1 - * @param CAknIconArray, array of icons - * @param MAknsSkinInstance, skin instance - * @param TDesC, reference to icon file - * @param TAknsItemID, skinned icon id - * @param TInt, bitmap id - * @param TInt, bitmap mask id - */ - void AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId); - - - /** - * Display Media Server Names. - * @since Series 60 3.1 - */ - void DisplayMediaServersL(); - - /** - * Execute Browse dialog - * @since Series 60 3.1 - * @return dialog return code - */ - TInt ExecuteBrowseL(); - - /** - * Execute AdvFind dialog - * @since Series 60 3.1 - * @return dialog return code - */ - TInt ExecuteFindL(); - /** - * Notifies that a new UPnP device was discovered. - * - * @since Series 60 3.1 - * @param CUpnpDevice, new device - * @return None - */ - void UPnPDeviceDiscoveredL(const CUpnpAVDevice& aDevice); - - /** - * Notifies that a UPnP device was dissapeared. - * - * @since Series 60 3.1 - * @param CUpnpDevice, disappeared device - * @return None - */ - void UPnPDeviceDisappearedL(const CUpnpAVDevice& aDevice); - - /** - * From CoeControl - * @param TCoeHelpContext, context of desired help - */ - void GetHelpContext(TCoeHelpContext& aContext) const; - - /** - * Updates navi pane animation - * - * @since Series 60 3.1 - * @param TBool, animation on/off - */ - void UpDateAnimationWindowL(TBool aAnimationState); - - - - private: - CEikColumnListBox* iListBox; //not owned - MUPnPAVController& iAVControl; - - CUpnpAVDeviceList* iDeviceArray; //owned - CUPnPCommonUI& iCommonUI; //not owned - // title pane - CAknTitlePane* iTitlePane; //not owned - CAknNavigationDecorator* iNaviDecorator; //owned - // animation timer - //not owned - CUPnPNaviPaneContainer* iNaviContainer; - CEikStatusPane* iStatusPane; //not owned - //not owned - CAknNavigationControlContainer* iNaviPaneContainer; - - MUPnPAVDeviceObserver* iPreDeviceObserver; - TBool iNaviPaneActive; - }; - -#endif // __UPNP_EXTERNAL_DEVICE_DIALOG_H__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpimageplayer.h --- a/upnpframework/upnpcommonui/inc/upnpimageplayer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -/* -* Copyright (c) 2006 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: Plays remote images on a renderer -* -*/ - - -#ifndef C_CUPNPIMAGEPLAYER_H -#define C_CUPNPIMAGEPLAYER_H - - -#include - -#include -#include "upnpavrenderingsessionobserver.h" -#include "upnpcommonui.h" - -// FORWARD DECLARATIONS -class MUPnPAVController; -class MUPnPAVRenderingSession; -class CUpnpAVDevice; -class CUpnpObject; -class MUPnPDeviceObserver; -class CUPnPCommonUI; - - -// CLASS DECLARATION - -/** -* UPnP AV Controller callback dispatcher -* -* -* @lib - -* @since Series 60 3.1 -*/ - -NONSHARABLE_CLASS( CUpnpImagePlayer ) : public CBase, - public MUPnPAVRenderingSessionObserver - { - - private: - /** - * Defines the image playing state - */ - enum TPendingOperation - { - EImageIdle = 0, //when no action on image has been set - EImageInitialising, //image uri has been set, callback not called - EImageShowing, //image play has been set, callback not called - EImageNext //another image is acting when the previous - //one's action has not been completed - }; - - public: // Constructors and destructor - - static CUpnpImagePlayer* NewL( MUPnPAVController& aAVControl, - MUPnPDeviceObserver& aDialog, - CUPnPCommonUI& aCommonUI ); - - /** - * Destructor. - */ - virtual ~CUpnpImagePlayer(); - - public: - - /** - * Set the renderer to show the image - * @since Series 60 3.1 - * @param aTargetDevice the selected renderer to show the image - * @return none - */ - void SetTargetDeviceL(const CUpnpAVDevice& aTargetDevice); - - /** - * Show the image - * @since Series 60 3.1 - * @param the image to be shown - * @return none - */ - void PlayL(const CUpnpObject& aItem); - - /** - * Stop showing the image - * @since Series 60 3.1 - * @param none; - * @return none - */ - void Stop(); - - - protected: //Functions from MUPnPAVRenderingSessionObserver - - /** - * UPnP AV Controller calls this method to return the result for the - * 'get volume' request. Parameter contains the volume level of the - * media renderer device to which the 'get volume' request was sent. - * - * @since Series 60 3.1 - * @param aError error code - * @param aVolumeLevel TInt volume level (between 0 - 100) - * @param aActionResponse EFalse if caused by pressing hardware key - * ETrue if caused by rendering session - * @return None - */ - void VolumeResult( TInt /*aError*/, TInt /*aVolumeLevel*/, - TBool /*aActionResponse*/ ){}; - - /** - * UPnP AV Controller calls this method to return the result for the - * 'get mute' request. Parameter contains the state of the mute of the - * media renderer device to which the 'get mute' request was sent. - * - * @since Series 60 3.1 - * @param aError error code - * @param aMute TBool the state of the mute (ETrue or EFalse) - * @param aActionResponse EFalse if caused by pressing hardware key - * ETrue if caused by rendering session - * @return None - */ - void MuteResult( TInt /*aError*/, TBool /*aMute*/, - TBool /*aActionResponse*/ ){}; - - /** - * UPnP AV Controller calls this method to indicate that the - * requested interaction operation (play, stop, etc.) is complete. - * In other words, the target rendering device has changed it's - * state accordingly. - * - * @since Series 60 3.1 - * @param aErrorCode TInt error code - * @param aOperation TInt operation (TAVInteractOperation) - * @return None - */ - void InteractOperationComplete( - TInt aError, - TUPnPAVInteractOperation aOperation - ); - - /** - * UPnP AV Controller calls this method as a response to Position - * Info action. The current position and the total length of the - * track that is currently playing is returned. The results are in - * (hh:mm:ss) format. - * - * UPnPAVController releases the memory allocated for aTrackPosition - * and aTrackLength. - * - * @since Series 60 3.0 - * @param aStatus TInt error code - * @param aTrackPosition TDesC8& track position - * @param aTrackLength TDesC8& track length - * @return None - */ - void PositionInfoResult( - TInt /*aError*/, - const TDesC8& /*aTrackPosition*/, - const TDesC8& /*aTrackLength*/ - ){}; - - /** - * UPnP AV Controller calls this method to return the result for the - * 'set uri' request. - * - * @since Series 60 3.1 - * @param aError error code - * @return None - */ - void SetURIResult( TInt aError ); - - /** - * UPnP AV Controller calls this method to return the result for the - * 'set next uri' request. - * - * @since Series 60 3.1 - * @param aError error code - * @return None - */ - void SetNextURIResult( TInt /*aError*/){}; - - /** - * Notifies that the Media Renderer we have a session with has - * disappeared. Session is now unusable and must be closed. - * - * @since Series 60 3.1 - * @return None - */ - void MediaRendererDisappeared( - TUPnPDeviceDisconnectedReason aReason ); - - /** - * Notifies that the Local Media Server has been put on sharing state - * - * @since Series 60 3.1 - * @param aReason reason code - * @return None - */ - void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){}; - - private: - - /** - * C++ default constructor. - */ - CUpnpImagePlayer( MUPnPAVController& aAVControl, - MUPnPDeviceObserver& aDialog, - CUPnPCommonUI& aCommonUI ); - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - - /** - * UPnP AV Controller calls this method to indicate that the - * requested interaction operation (play, stop, etc.) is complete. - * In other words, the target rendering device has changed it's - * state accordingly. - * - * @since Series 60 3.1 - * @param aErrorCode TInt error code - * @param aOperation TInt operation (TAVInteractOperation) - * @return None - */ - void InteractOperationCompleteL( - TInt aError, - TUPnPAVInteractOperation aOperation - ); - - /** - * UPnP AV Controller calls this method to return the result for the - * 'set uri' request. - * - * @since Series 60 3.1 - * @param aError error code - * @return None - */ - void SetURIResultL( TInt aError ); - - private: - - MUPnPAVRenderingSession* iRendSession; //owned - MUPnPAVController& iAVControl; //not owned - const CUpnpAVDevice* iTargetDevice; //not owned - - TPendingOperation iImageState; - - HBufC8* iUri; //OWNED - - const CUpnpItem* iItem; //not owned - - MUPnPDeviceObserver& iDialog; //not owned - - CUPnPCommonUI& iCommonUI; //Not owned - - TBool iFirstStart; - - CUPnPCommonUI::TUPnPAction iAction; - }; - - -#endif // C_CUPNPIMAGEPLAYER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnplocalplayer.h --- a/upnpframework/upnpcommonui/inc/upnplocalplayer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Plays remote images,videos and music locally on device -* -*/ - - -#ifndef C_CUPNPLOCALPLAYER_H -#define C_CUPNPLOCALPLAYER_H - -#include -#include -#include -#include -#include -#include "upnpfiletransfersessionobserver.h" - -// FORWARD DECLARATIONS - -class MUPnPAVBrowsingSession; -class CUpnpObject; -class CDocumentHandler; -class CAknWaitDialog; -class CUPnPCommonUI; -class MUPnPAVController; -class MUPnPFileDownloadSession; -class MUPnPAVBrowsingSessionObserver; - - -// CLASS DECLARATION - -/** -* CUPnPLocalPlayer -* The class works is used to play or show the remote item in -* local devices . -* -* @since S60 3.1 -*/ - -class CUPnPLocalPlayer: public CBase, - public MAknServerAppExitObserver, - public MProgressDialogCallback, - public MUPnPFileTransferSessionObserver - { - public: // Constructors and destructor - - IMPORT_C static CUPnPLocalPlayer* NewL( - MUPnPAVController& aAVController, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ); - /** - * Destructor. - */ - virtual ~CUPnPLocalPlayer(); - - public: // new function - - /** - * Play a given item - * - * @since Series 60 3.1 - * @param CUpnpObject given item to be played - * @return none - */ - IMPORT_C void PlayL( const CUpnpObject& aItem ); - - public: // Call back methods of MUPnPFileTransferSessionObserver - - /** - * Notifies that the transfer has been started - * - * @since Series 60 3.2 - * @param aKey identifies the transfer - * @param aStatus status (error) code - * @return none - */ - void TransferStarted( TInt aKey, - TInt aStatus ); - - /** - * Notifies that the transfer has been completed - * - * @since Series 60 3.2 - * @param aKey identifies the transfer - * @param aStatus status (error) code - * @param aFilePath - */ - void TransferCompleted( TInt aKey, - TInt aStatus, - const TDesC& aFilePath ); - - /** - * Notifies transfer progress, not implemented since the transfer - * progress is not cared in the download and play/show case - * - * @since Series 60 3.2 - * @param aKey identifies the transfer - * @param aBytes amount of bytes downloaded - * @param aTotalBytes total amount of bytes - */ - void TransferProgress( TInt /*aKey*/, - TInt /*aBytes*/, - TInt /*aTotalBytes*/ ){}; - - /** - * Notifies that the Media Server we have a session with has - * disappeared. Session is now unusable and must be closed. - * - * @since Series 60 3.2 - * @return None - */ - void MediaServerDisappeared( TUPnPDeviceDisconnectedReason aReason ); - - protected: // From MProgressDialogCallback - - /** - * Callback function for progress bar. - * - * @since Series 60 3.1 - * @param aButtonId, id of the button pressed - * @return None - */ - void DialogDismissedL( TInt aButtonId ); - - protected: //from MAknServerAppExitObserver - - /** - * Notifies that the image or video player has quit. - * - * @since Series 60 3.1 - * @return aReason (TInt), the reason for quitting - */ - void HandleServerAppExit( TInt aReason ); - - private: - - /** - * Constructs the local player - */ - CUPnPLocalPlayer( MUPnPAVController& aAVController, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ); - /** - * Perform the second phase construction - */ - void ConstructL(); - - private: - - /** - * Notifies that the copy operation is complete. - * - * @since Series 60 3.2 - * @param aStatus TInt status information - * @param aFilepath filepath for a downloaded file (CopyToPhoneL) - * @return None - */ - void CopyCompleteL( TInt aError, - const TDesC& aFilepath ); - /** - * Start the current waiting note - * @since Series 60 3.1 - * @param none - * @return none - */ - void StartWaitingNoteL(); - - /** - * Finish the current waiting note - * @since Series 60 3.1 - * @param none - * @return none - */ - void FinishNote(); - - /** - * Removes those res-elements from the item that can't be used for - * local playback. - * @since Series 60 3.1 - * @param CUpnpObject item to be checked - * @return TBool is there any usable res element left. - */ - TBool IsLocallySupportedL( CUpnpObject& aItem ); - - - private: - - MUPnPAVBrowsingSession* iBrowseSession; //not owned - MUPnPAVBrowsingSessionObserver* iBrowseSessionObserver; - CUpnpObject* iItem; //owned - RFs iFs; //owned - CDocumentHandler* iDocumentHandler;//owned - CAknWaitDialog* iWaitNoteDialog; //owned - HBufC* iFilePath; //owned - TInt iExitReason; - TBool iWaitingNote; - MUPnPFileDownloadSession* iDownloadSession; - MUPnPAVController* iAVController; //not owned - - CUPnPCommonUI& iCommonUI; //Not owned - }; - - #endif // C_CUPNPLOCALPLAYER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpnavipanecontainer.h --- a/upnpframework/upnpcommonui/inc/upnpnavipanecontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -/* -* Copyright (c) 2005 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: Header file for UPnP navi pane container -* -*/ - - - -#ifndef UPNPNAVIPANECONTAINER_H -#define UPNPNAVIPANECONTAINER_H - - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CUPnPPeriodic; - -// CLASS DECLARATION - -/** -* CUPnPNaviPaneContainer -* Container class for navi pane -* -* @lib -* @since 3.0 -*/ - -enum TAnimationFrames - { - EFrame1, - EFrame2, - EFrame3, - EFrame4, - EFrame5, - EFrame6, - EFrame7, - EFrame8, - EFrame9 - }; - - - -class CUPnPNaviPaneContainer : public CCoeControl - { - public: // Constructors and destructor - - /** - * Symbian constructor can leave - */ - IMPORT_C static CUPnPNaviPaneContainer* NewL( - const TRect& aRect, - TPoint aPosition, - CAknNavigationControlContainer* aParent ); - - /** - * Destructor. - */ - virtual ~CUPnPNaviPaneContainer(); - - - private: // Functions from base classes - - - /** - * From CoeControl - * @return Number of contained component controls. - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl - * @param aIndex index of a contained component control. - */ - - CCoeControl* ComponentControl(TInt aIndex) const; - - /* - * From CCoeControl - * @param aRect drawable area. - */ - void Draw(const TRect& aRect) const; - - private: // Constructors - - /** - * C++ default constructor - */ - CUPnPNaviPaneContainer(); - - /** - * Symbian second phase constructor - */ - void ConstructL( const TRect& aRect, - TPoint aPosition, - CAknNavigationControlContainer* aParent = NULL ); - - /** - * sets postion and activates and deactivates window - */ - void DrawAnimation(); - - /** - * loads animation frame - */ - static CGulIcon* LoadIconL( TAnimationFrames aAnimationState, - TAny* aDlg ); - - /** - * deletes the animation frame which enum is given as parameter - */ - void DeleteIcon(TAnimationFrames aAnimationState); - - /** - * updates animation, changes the animation frame to next - */ - static TBool UpdateAnimationL(TAny* aDlg); - - private: // data - - CGulIcon* iIcon1; // owned - CGulIcon* iIcon2; // owned - CGulIcon* iIcon3; // owned - CGulIcon* iIcon4; // owned - CGulIcon* iIcon5; // owned - CGulIcon* iIcon6; // owned - CGulIcon* iIcon7; // owned - CGulIcon* iIcon8; // owned - CGulIcon* iIcon9; // owned - CGulIcon* iNavipaneIcon; // owned - CEikLabel* iLabel; //owned - CUPnPPeriodic* iPeriodic; //owned - TInt iAnimationIndex; - TPoint iPosition; - CAknsBasicBackgroundControlContext* iSkinContext; // owned - TBool iFirstDrawDelayWaited; - - TInt iResFileOffset; - CEikonEnv* iCoeEnv; //not owned - }; -#endif // UPNPNAVIPANECONTAINER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpselectiondialog.h --- a/upnpframework/upnpcommonui/inc/upnpselectiondialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Header file for the UPnPSelectionDialog class implementation -* -*/ - - -#ifndef __UPNP_SELECTION_DIALOG_H__ -#define __UPNP_SELECTION_DIALOG_H__ - -// INCLUDES -#include "upnpavdeviceobserver.h" -#include "upnpcommonui.h" - -// FORWARD DECLARATIONS -class MUPnPAVController; -class CUpnpAVDeviceList; -/** -* Device selection dialog class of Common UI library -*/ -NONSHARABLE_CLASS( CUPnPSelectionDialog ): public CBase, - public MUPnPAVDeviceObserver - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUPnPSelectionDialog* NewL(MUPnPAVController& aAVControl); - /** - * Destructor. - */ - virtual ~CUPnPSelectionDialog(); - - public: // Methods from MUPnPAVDeviceObserver - /** - * Notifies that a new UPnP device was discovered. - * - * @since Series 60 3.1 - * @param CUpnpAVDevice - * @return None - */ - void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice); - - /** - * Notifies that a UPnP device was dissapeared. - * - * @since Series 60 3.1 - * @param CUpnpAVDevice - * @return None - */ - void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice); - - /** - * Notifies that the WLAN connection has been lost. All sessions - * are now usable and must be closed. - * - * @since Series 60 3.1 - * @return None - */ - void WLANConnectionLost(); - - public: - - /** - * Starts selection popup - * - * @since Series 60 3.1 - * @param CUpnpAVDevice, selected device - */ - TInt StartPopupL(CUpnpAVDevice& aDevice); - - /** - * Creates a selection popup. - * - * @since Series 60 3.1 - * @param const TDesC&, popup title - * @param aDeviceType TUPnPDeviceTypesToSearch type of devices to - * search - * @return None - */ - void CreatePopupL( const TDesC& aTitle, - TUPnPDeviceTypesToSearch aDeviceType ); - - /** - * Destroy the selection dialog rather than pressing "Cancel" button - * - * @since Series 60 3.1 - * @param TInt exiting error - * @return None - */ - void DismissItself( TInt aError ); - - private: - - /** - * C++ default constructor. - */ - CUPnPSelectionDialog(MUPnPAVController& aAVControl); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - - private: // New Functions - - /** - * Loads a possibly skinned icon and adds it to icon array - * @since Series 60 3.1 - * @param CAknIconArray, array of icons - * @param MAknsSkinInstance, skin instance - * @param TDesC, reference to icon file - * @param TAknsItemID, skinned icon id - * @param TInt, bitmap id - * @param TInt, bitmap mask id - */ - void AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId); - - /** - * Loads listbox items - * @since Series 60 3.1 - */ - void LoadListItemsL(void); - - /** - * From CAknDialog, handles layout initialization - * @param const TDesC&, dialog title - */ - void PreLayoutDynInitL(const TDesC& aTitle); - - /** - * Notifies that a new UPnP device was discovered. - * - * @since Series 60 3.1 - * @param CUpnpAVDevice, new device - * @return None - */ - void UPnPDeviceDiscoveredL(const CUpnpAVDevice& aDevice); - - /** - * Notifies that a UPnP device was dissapeared. - * - * @since Series 60 3.1 - * @param CUpnpAVDevice, disappeared device - * @return None - */ - void UPnPDeviceDisappearedL(const CUpnpAVDevice& aDevice); - - /** - * Checks if a given device matches with the search criteria. - * - * @since Series 60 3.1 - * @param aDevice (CUpnpAVDevice*) the device - * @return TBool - */ - TBool MatchWithSearchCriteria( CUpnpAVDevice *aDevice ); - - /** - * Updates command set of the dialog by the search type of the devices. - * - * @since Series S60 5.1 - * @param none - * @return none - */ - void UpdateCommandSetL(); - - private: - - CAknPopupList* iPopup; //not owned - CAknSingleGraphicPopupMenuStyleListBox* iListBox; //owned - CUpnpAVDeviceList* iDeviceArray; //owned - - - MUPnPAVController& iAVControl; - TUPnPDeviceTypesToSearch iTypeOfDevicesToSearch; - //observer for device appearance - MUPnPAVDeviceObserver* iDeviceObserver; - - TInt iExitReason; - }; - -#endif // __UPNP_SELECTION_DIALOG_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/inc/upnpvideoplayerdialog.h --- a/upnpframework/upnpcommonui/inc/upnpvideoplayerdialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,630 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Header file for UPnP Video player class implementation -* -*/ - - -#ifndef __UPNP_VIDEOPLAYER_DIALOG_H__ -#define __UPNP_VIDEOPLAYER_DIALOG_H__ - -// INCLUDES -#include -#include "upnpavrenderingsessionobserver.h" -#include //for MRemConCoreApiTargetObserver - -// FORWARD DECLARATIONS -class CCustomCtrlDlgCustomControl; -class MUPnPAVRenderingSession; -class MUPnPAVController; -class CUpnpObject; -class CUpnpAVDevice; -class CUPnPCommonUI; -class MProgressDialogCallback; -class CEikLabel; - -class CAknVolumePopup; -class CRemConCoreApiTarget; -class CRemConInterfaceSelector; -class CUPnPPeriodic; - -/** -* Video player class of Common UI library -*/ -NONSHARABLE_CLASS( CUPnPVideoPlayerDlg ) : public CAknDialog, - public MUPnPAVRenderingSessionObserver, - public MProgressDialogCallback - , public MRemConCoreApiTargetObserver - { - - public: // Constructors and destructor - - /** - * C++ default constructors. - */ - CUPnPVideoPlayerDlg( MUPnPAVRenderingSession& aRenderingSession, - const CUpnpObject& aObject, - CUPnPCommonUI& aCommonUI ); - - - /** - * Two-phased constructors. - */ - static CUPnPVideoPlayerDlg* NewL( - MUPnPAVRenderingSession& aRenderingSession, - const CUpnpObject& aObject, - CUPnPCommonUI& aCommonUI ); - - /** - * Destructor. - */ - virtual ~CUPnPVideoPlayerDlg(); - - public: // Methods from MUPnPAVRenderingSessionObserver - - /** - * UPnP AV Controller calls this method to return the result for the - * 'get volume' request. Parameter contains the volume level of the - * media renderer device to which the 'get volume' request was sent. - * - * @since Series 60 3.1 - * @param aError error code - * @param aVolumeLevel TInt volume level (between 0 - 100) - * @param aActionResponse EFalse if caused by pressing hardware key - * ETrue if caused by rendering session - */ - void VolumeResult( TInt aError, TInt aVolumeLevel, - TBool aActionResponse ); - - /** - * UPnP AV Controller calls this method to indicate that the requested - * interaction operation (play, stop, etc.) is complete. In other - * words, the target rendering device has changed it's state - * accordingly. - * - * @since Series 60 3.1 - * @param aErrorCode TInt error code - * @param aOperation TInt operation (TAVInteractOperation) - * @return None - */ - void InteractOperationComplete( - TInt aErrorCode, - TUPnPAVInteractOperation aOperation ); - - /** - * UPnP AV Controller calls this method to return the result for the - * 'get mute' request. Parameter contains the state of the mute of the - * media renderer device to which the 'get mute' request was sent. - * - * @since Series 60 3.1 - * @param aError error code - * @param aMute TBool the state of the mute (ETrue or EFalse) - * @param aActionResponse EFalse if caused by pressing hardware key - * ETrue if caused by rendering session - */ - void MuteResult( TInt aError, TBool aMute, TBool aActionResponse ); - - /** - * UPnP AV Controller calls this method as a response to Position - * Info action. The current position and the total length of the - * track that is currently playing is returned. The results are in - * (hh:mm:ss) format. - * - * UPnPAVController releases the memory allocated for aTrackPosition - * and aTrackLength. - * - * @since Series 60 3.1 - * @param aStatus TInt error code - * @param aTrackPosition TDesC8& track position - * @param aTrackLength TDesC8& track length - */ - void PositionInfoResult( TInt aError, - const TDesC8& aTrackPosition, - const TDesC8& aTrackLength ); - - /** - * UPnP AV Controller calls this method to return the result for the - * 'set uri' request. - * - * @since Series 60 3.1 - * @param aError error code - * @return None - */ - void SetURIResult( TInt aError ); - - /** - * UPnP AV Controller calls this method to return the result for the - * 'set next uri' request. - * - * @since Series 60 3.1 - * @param aError error code - * @return None - */ - void SetNextURIResult( TInt /*aError*/ ){}; - - /** - * Notifies that the Media Renderer we have a session with has - * disappeared. Session is now unusable and must be closed. - * - * @since Series 60 3.1 - * @return None - */ - void MediaRendererDisappeared( - TUPnPDeviceDisconnectedReason aReason ); - - /** - * Notifies that the Local Media Server has been put on sharing state - * - * @since Series 60 3.1 - * @param aReason reason code - * @return None - */ - void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){}; - - public: // Functions from base classes - - /** - * CreateCustomControlL - * - * Draw this CUPnPVideoPlayerDlg to the screen. - * @param aRect the rectangle of this view that needs updating - */ - SEikControlInfo CreateCustomControlL( TInt aControlType ); - - /** - * From CAknDialog, handles key events. - * @param TKeyEvent, Event to handled. - * @param TEventCode, Type of the key event. - * @return TKeyResponse, response code (EKeyWasConsumed, - * EKeyWasNotConsumed). - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - public: //new function - - /** - * Called from CommonUI to destroy the video dialog itself - * both in single Media server disappears or WLAN lost case - * @since Series 60 3.1 - * @param aError exit reason (KErrSessionClosed and - * KErrDisconnected) - * @return None - */ - void DismissItselfL( TInt aError ); - - /** - * Handle different errors - * @since Series 60 3.1 - * @param exiting reason - * @return none - */ - void HandleErrorL( TInt aError ); - - protected: // Functions from base classes - - /** - * From CoeControl - * @param None - * @return None - */ - void HandleResourceChange(TInt aType); - - /** - * From CAknDialog - * @param None - * @return None - */ - void SizeChanged(); - - protected: // Functions from base classes - - /** - * From CEikDialog, handles layout initialization - * @param None - * @return None - */ - void PreLayoutDynInitL(); - - /** - * From CAknDialog, handles focus changes of the dialog - * @param aButtonId, pressed button id - * @return True if ready to close dialog, False otherwise - */ - TBool OkToExitL( TInt aButtonId ); - - private: // New Functions - - /** - * Updates navi pane - * - * @since Series 60 3.1 - * @param None - * @return None - */ - void UpdateNaviPaneL( ); - - /** - * Check the status pane capabilities. - * - * @since Series 60 3.1 - * @param aPaneId Status pane Id. - * @return indication of success - */ - TBool CheckStatusPaneCapabilities( const TPaneId& aPaneId ); - - /** - * Set navigation label from descriptor. - * - * @since Series 60 3.1 - * @param aText Text to be displayed on the navi label. - * @return none - */ - void SetNaviLabelL( const TDesC& aText ); - - - /** - * UPnP AV Controller calls this method to indicate that the requested - * interaction operation (play, stop, etc.) is complete. In other - * words, the target rendering device has changed it's state - * accordingly. - * - * @since Series 60 3.1 - * @param aErrorCode TInt error code - * @param aOperation TInt operation (TAVInteractOperation) - * @return None - */ - void InteractOperationCompleteL( - TInt aErrorCode, - TUPnPAVInteractOperation aOperation ); - - /** - * UPnP AV Controller calls this method to return the result for the - * 'set uri' request. - * - * @since Series 60 3.1 - * @param aError error code - * @return None - */ - void SetURIResultL( TInt aError ); - - /** - * For set cba string, encapsulation it in this function. - * - * @since Series 60 3.2 - * @param None - * @return None - */ - void ContinueAfterPauseL(); - - private: - - /** - * 2nd phase constructors. - */ - void ConstructL(); - - /** - * Clears dialog title - * - * @since Series 60 3.1 - * @param none - * @return none - */ - void ClearTitleL(); - - /** - * Updates softkey texts - * - * @since Series 60 3.1 - * @param TInt, state - * @return none - */ - void UpdateSoftkeysL(TInt aState); - - /** - * Timer callback for volume indicator hiding. - * - * @since Series 60 3.1 - * @return TInt, error code - */ - static TInt HideVolumeIdicator(TAny* aPtr); - - /** - * Shows volume indicator - * - * @since Series 60 3.1 - * @param none - * @return none - */ - void ShowVolumeIndicatorL(); - - /** - * Timer callback - * - * @since Series 60 3.1 - * @param TAny*, caller - * @return TInt - */ - static TInt TimerIndicatorL(TAny* aPtr); - - /** - * Resolves the target UPnP device capabilites - * @since Series 60 3.1 - * @param None - * @return none - */ - void ResolveTargetDeviceCapabilitiesL(); - - /** - * Stop the video playback wait note - * @since Series 60 3.1 - * @param None - * @return none - */ - void FinishWaitNoteL(); - - /** - * Prepare the video playback - * - * @since Series 60 3.1 - * @param None - * @return None - */ - void PreparePlayBackL(); - - /** - * Start wait note - * - * @since Series 60 3.1 - * @param None - * @return An error code - */ - TInt StartWaitNoteL(); - - /** - * Start displaying timer on the navi pane - * - * @since Series 60 3.1 - * @param None - * @return None - */ - void StartDisplayTimer(); - - /** - * Calls respective observer function - * - * @since Series 60 3.1 - * @param none - * @return none - */ - void DoChangeVolumeL(); - - /** - * Timer callback - * - * @since Series 60 3.1 - * @param TAny*, caller - * @return TInt - */ - static TInt ChangeVolume( TAny* aPtr ); - - public: // Call back methods of MAknProgressDialogCallback - - /** - * ProgressDialog call back method. - * Get's called when a dialog is dismissed. - * - * @since S60 3.1 - * @param aButtonId (TInt) ID of the button pressed - */ - void DialogDismissedL( TInt aButtonId ); - - private:// From MRemConCoreApiTargetObserver - - - /** - * Side volume key API from MRemConCoreApiTargetObserver - * @since 3.2 - * @see MRemConCoreApiTargetObserver - */ - virtual void MrccatoCommand(TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ); - private: // Data - - enum TUPnPVideoStates - { - EUPnPVideoPause = 0x600, - EUPnPVideoPlay, - EUPnPVideoStop - }; - - CUPnPPeriodic* iTimer; //owned - CAknNavigationDecorator* iNaviDecorator; //owned - CAknNavigationControlContainer* iNaviPane; // Not owned - - MUPnPAVRenderingSession& iRendSession; //not owned - - const CUpnpObject* iItem; //not owned - const CUpnpAVDevice* iTargetDevice; // Not owned - const CUpnpAVDevice* iSourceDevice; // Not owned - - HBufC* iMinSecFormatString; //owned - HBufC* iHourMinSecFormatString; //owned - HBufC* iTimerNavi; - TInt64 iPlaybackPosInSeconds; - TInt64 iTotalLengthInSeconds; - TInt iCurrentVolume; - TInt iNewVolume; - TInt iTimerRefresh; - - CCustomCtrlDlgCustomControl* iContainer; //not owned - - //Volume adjust indicator - TBool iAdjustingVolume; - // Target device capabilites - TBool iPauseCapability; - TBool iVolumeCapability; - // title text before video player - HBufC* iOriginalTitleText; //owned - - CUPnPCommonUI& iCommonUI; - - TBool iPause; - - // Flag if the remote renderer is playing and the elapsed time needs - // be updated. This means that the renderer has started the playback - // already and it is not in paused state. - TBool iRendererPlaying; - - // The time interval of getting GetPositionInfoL - TInt iGetPositionInfoInterval; - - CUPnPCommonUI::TUPnPAction iAction; - - CAknWaitDialog* iVideoPlaybackWaitNote; // owned; - - TInt iExitCode; - - //ETrue if volume is up, EFalse if volume is down - TBool iVolumeUp; - - TBool iVolumeKeyPressHold; - CUPnPPeriodic* iVolumeTimer; // owned - CAknVolumePopup* iVolumePopup; // owned - - // owned by iInterfaceSelector - CRemConCoreApiTarget* iCoreTarget; - CRemConInterfaceSelector* iInterfaceSelector; // owned - - }; - -////////////////////////////////////////////////////////////////////////////// -// -// -----> CImage (definition) -// -////////////////////////////////////////////////////////////////////////////// -class CImage : public CCoeControl - { - public: - - /** - * C++ default constructor. - */ - CImage(MUPnPAVRenderingSession& aRendSession); - - //destructor - virtual ~CImage(); - - private: // Methods - - /** - * Draws the display - * - * @param TRect&, Rectangle to be drawn - * @return none - */ - void Draw(const TRect& aRect) const; - - /** - * Draws the display - * - * @param TRect&, Rectangle to be drawn - * @return none - */ - void DrawL(const TRect& aRect) const; - - /** - * Draws the label - * - * @param TRect&, Rectangle to be drawn - * @return none - */ - void DrawLabelL(const TRect& aRect) const; - - private: // Data - - // Data members defined and used by this class. - MUPnPAVRenderingSession& iRendSession; - CFbsBitmap* iBitmap; //owned - CFbsBitmap* iMask; //owned - }; - -////////////////////////////////////////////////////////////////////////////// -// -// -----> CCustomCtrlDlgCustomControl (definition) -// -////////////////////////////////////////////////////////////////////////////// -class CCustomCtrlDlgCustomControl : public CCoeControl - { - - public: - - /** - * Construct From Resource. - */ - void ConstructFromResourceL( TResourceReader& aReader ); - - /** - * Sets AV controller - * - * @since Series 60 3.1 - * @param MUPnPAVRenderingSession&, AV controller - * @return none - */ - void SetRenderingSession( MUPnPAVRenderingSession& aAVRendSession ); - - //destructor - virtual ~CCustomCtrlDlgCustomControl(); - - private: - - /** - * Draws the display - * - * @param TRect&, Rectangle to be drawn - * @return none - */ - void Draw( const TRect& aRect ) const; - - /** - * From CAknDialog - * @param none - * @return none - */ - void SizeChanged(); - - /** - * From CAknDialog - * @param none - * @return the number of component controls contained by this control - */ - TInt CountComponentControls() const; - - /** - * From CAknDialog - * @param the index of the control to get - * @return the component control with an index of aIndex - */ - CCoeControl* ComponentControl(TInt aIndex) const; - - private: - - // Data members defined and used by this class. - CImage* iImage; //owned - MUPnPAVRenderingSession* iRendSession; //not owned - - }; - -#endif // __UPNP_VIDEOPLAYER_DIALOG_H__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpadvfinddialog.cpp --- a/upnpframework/upnpcommonui/src/upnpadvfinddialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,303 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Advanced find dialog component source code -* -*/ - - - -// INCLUDE FILES -// System -#include -#include - -// upnpframework / avcontroller api -#include "upnpavbrowsingsession.h" -#include "upnpavdevice.h" - -// upnpframework / internal api's -#include "upnpcommonutils.h" - -// common ui internal -#include "upnpcommonui.h" -#include -#include "upnpadvfinddialog.h" -#include "upnpadvfindlist.h" - -// debug stuff -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -// CONSTANTS -const TInt KLength = 100; - -// ============================ MEMBER FUNCTIONS ============================ -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindDialog::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindDialog::ConstructL(TInt aMenuResource) - { - __LOG( "CUPnPAdvancedFindDialog::ConstructL" ); - CAknDialog::ConstructL(aMenuResource); - - iOriginalTitleText = HBufC16::NewL( KMaxFileName ); - } - - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindDialog::CUPnPAdvancedFindDialog -// default constructor -// -------------------------------------------------------------------------- -CUPnPAdvancedFindDialog::CUPnPAdvancedFindDialog( - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPCommonUI& aCommonUI ): - iAVControl(aAVControl), - iBrowseSession(aBrowsingSession), - iCommonUI(aCommonUI) - - { - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindDialog::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPAdvancedFindDialog* CUPnPAdvancedFindDialog::NewL( - TInt aMenuResource, - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPCommonUI& aCommonUI ) - { - __LOG( "CUPnPAdvancedFindDialog::NewL" ); - - CUPnPAdvancedFindDialog* self = new ( ELeave ) CUPnPAdvancedFindDialog( - aAVControl, aBrowsingSession, aCommonUI ); - CleanupStack::PushL( self ); - self->ConstructL( aMenuResource ); - CleanupStack::Pop(); - return self; - } - -// Destructor -CUPnPAdvancedFindDialog::~CUPnPAdvancedFindDialog() - { - __LOG( "CUPnPAdvancedFindDialog destructor" ); - // Set original title pane text - if( iOriginalTitleText && iTitlePane ) - { - TRAP_IGNORE( iTitlePane->SetTextL( *iOriginalTitleText ) ); - delete iOriginalTitleText; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindDialog::OkToExitL( TInt aButtonId ) -// called by framework when trying to close the dialog -// -------------------------------------------------------------------------- -// -TBool CUPnPAdvancedFindDialog::OkToExitL( TInt aButtonId ) - { - __LOG( "CUPnPAdvancedFindDialog::OkToExitL" ); - TInt error = KErrNone; - TBool retval = EFalse; - - if ( aButtonId == EAknSoftkeyOk ) - { - iSettingsList->SetMopParent( this ); - error = iSettingsList->MakeQueryL(); - - iTitlePane = (CAknTitlePane*)iStatusPane->ControlL( - TUid::Uid( EEikStatusPaneUidTitle ) ); - SetTitleL(); - TryExitL( error ); - } - else if ( aButtonId == EAknSoftkeyOptions ) - { - DisplayMenuL(); - } - else if ( aButtonId == EAknSoftkeyBack || - aButtonId == KErrSessionClosed || - aButtonId == KErrDisconnected || - aButtonId == EAknCmdExit || - aButtonId == EEikCmdExit ) - { - retval = ETrue; //back to previous dialog - } - else if( aButtonId == EAknSoftkeyOpen ) - { - TKeyEvent tmpEvent; - tmpEvent.iCode = EKeyOK; - tmpEvent.iModifiers = 0; - tmpEvent.iRepeats = 0; - tmpEvent.iScanCode = 0; - TEventCode eventType = EEventKey; - OfferKeyEventL( tmpEvent, eventType ); - } - return retval; - } - -// --------------------------------------------------------- -// CUPnPAdvancedFindDialog::PreLayoutDynInitL() -// called by framework before dialog is shown -// --------------------------------------------------------- -// -void CUPnPAdvancedFindDialog::PreLayoutDynInitL() - { - __LOG( "CUPnPAdvancedFindDialog::PreLayoutDynInitL" ); - iStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); - iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL( - TUid::Uid( EEikStatusPaneUidTitle ) ); - - // Take backup of title text - iOriginalTitleText->Des().Copy( *iTitlePane->Text() ); - // set dialog title - SetTitleL(); - } - - -// --------------------------------------------------------- -// CUPnPAdvancedFindDialog::ProcessCommandL() -// --------------------------------------------------------- -// -void CUPnPAdvancedFindDialog::ProcessCommandL ( TInt aCommand ) - { - __LOG( "CUPnPAdvancedFindDialog::ProcessCommandL" ); - HideMenu(); - CAknDialog::ProcessCommandL( aCommand ); - } - -// --------------------------------------------------------- -// CUPnPAdvancedFindDialog::OfferKeyEventL() -// called by framework when key is pressed -// --------------------------------------------------------- -// -TKeyResponse CUPnPAdvancedFindDialog::OfferKeyEventL( - const TKeyEvent &aKeyEvent, - TEventCode aType ) - { - __LOG( "CUPnPAdvancedFindDialog::OfferKeyEventL" ); - if ( aType != EEventKey ) - { - return EKeyWasNotConsumed; - } - switch ( aKeyEvent.iCode ) - { - case EKeyDownArrow: // flow through - case EKeyUpArrow: - { - iSettingsList->OfferKeyEventL( aKeyEvent, aType ); - break; - } - case EKeyOK: - { - TInt selected_item = iSettingsList->ListBox()->CurrentItemIndex(); - iSettingsList->EditItemL( selected_item, ETrue ); - if( !iClose ) - { - iSettingsList->HandleChangeInItemArrayOrVisibilityL(); - } - - break; - } - default: - { - CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - break; - } - } - - return EKeyWasConsumed; - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindDialog::CreateCustomControlL -// -------------------------------------------------------------------------- -// -SEikControlInfo CUPnPAdvancedFindDialog::CreateCustomControlL( - TInt aControlType ) - { - __LOG( "CUPnPAdvancedFindDialog::CreateCustomControlL" ); - SEikControlInfo controlInfo; - controlInfo.iControl = NULL; - controlInfo.iTrailerTextId = 0; - controlInfo.iFlags = 0; - switch ( aControlType ) - { - case KAknCtLastControlId: - { - iSettingsList = CUPnPAdvancedFindList::NewL( iAVControl, - iBrowseSession, - *this, - iCommonUI ); - controlInfo.iControl = iSettingsList; - break; - } - default: - { - break; - } - } - return controlInfo; - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindDialog::DismissItselfL -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindDialog::DismissItselfL( TInt aError ) - { - iClose = ETrue; - if( iSettingsList ) - { - //if setting page is not open, close it, otherwise, do nothing - if( !iSettingsList->IsSettingPageOpen() ) - { - TryExitL( aError ); - } - } - else - { - TryExitL( aError ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindDialog::SetTitleL -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindDialog::SetTitleL() - { - const CUpnpAVDevice* device = &( iBrowseSession.Device() ); - - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - ( ( CUpnpAVDevice* )device )->FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - HBufC* titleString = UpnpString::ToUnicodeL( - friendlyname.Left( KLength ) ); - CleanupStack::PushL( titleString ); - - iTitlePane->SetTextL( *titleString ); - CleanupStack::PopAndDestroy( titleString ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - } -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpadvfindlist.cpp --- a/upnpframework/upnpcommonui/src/upnpadvfindlist.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1039 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: List in advanced find results dialog -* -*/ - - -// INCLUDE FILES -// System -#include -#include -#include -#include -#include //for text editor flags -#include - -// upnp stack api's -#include - -// upnpframework / avcontroller api -#include "upnpavbrowsingsession.h" - -// upnpramework / avcontroller helper api -#include "upnpconstantdefs.h" // upnp definitions - -// upnpframework / xml parser api -#include "upnpxmlparser.h" - -// common ui internal -#include "upnpcommonui.hrh" -#include -#include "upnpadvfindresultwindow.h" -#include "upnpadvfindlist.h" -#include "upnpadvfinddialog.h" - - -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -//CONSTANTS -_LIT( KDate, "%d0000:" ); //Initial value for date elements -_LIT8( KAttributeRefID, "@refID" ); -_LIT8( KTimeFormat8, "%d-%02d-%02d" ); -const TInt KMaxRequestCount = 50; -const TInt KTmpDateFormatLength = 12; -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::CUPnPAdvancedFindList -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPAdvancedFindList::CUPnPAdvancedFindList( - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPAdvancedFindDialog& aParent, - CUPnPCommonUI& aCommonUI ): - iAVControl(aAVControl), - iCommonUI(aCommonUI), - iAdvancedFindDialog(aParent), - iBrowseSession(aBrowsingSession), - iShowingErrorNote(EFalse) - { - - // Set date to January first of current year - iDateFrom.HomeTime(); - TInt year = iDateFrom.DateTime().Year(); - TBuf<10> tempBuf; - tempBuf.Format( KDate(), year ); - iDateFrom.Set( tempBuf ); - - iDateUntil.HomeTime(); - - iDateInitial.Set( tempBuf ); - - - - // backup existing browsesession observer and set this as current observer - iBrowseObserver = iBrowseSession.Observer(); - iBrowseSession.RemoveObserver(); - iBrowseSession.SetObserver( *this ); - - iSearchResponseReceived = EFalse; - - iAction = CUPnPCommonUI::EUPnPNone; - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindList::ConstructL() - { - } -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPAdvancedFindList* CUPnPAdvancedFindList::NewL( - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession, - CUPnPAdvancedFindDialog& aParent, - CUPnPCommonUI& aCommonUI ) - { - __LOG( "CUPnPAdvancedFindList newL" ) ; - CUPnPAdvancedFindList* self = new (ELeave) CUPnPAdvancedFindList( - aAVControl, - aBrowsingSession, - aParent, - aCommonUI ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::NewL -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPAdvancedFindList::~CUPnPAdvancedFindList() - { - __LOG( "CUPnPAdvancedFindList::~CUPnPAdvancedFindList" ); - if ( iWaitNoteDialog ) - { - // Stop showing wait note - TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() ); - delete iWaitNoteDialog; - iWaitNoteDialog = NULL; - } - - iBrowseSession.RemoveObserver(); - if( iBrowseObserver ) - { - iBrowseSession.SetObserver( *iBrowseObserver ); - } - - iResultArray.ResetAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::MediaServerDisappeared -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindList::MediaServerDisappeared( - TUPnPDeviceDisconnectedReason aReason ) - { - iClose = ETrue; - iCloseReason = aReason; - TRAP_IGNORE( MediaServerDisappearedL( aReason ) ); - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::MediaServerDisappearedL -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindList::MediaServerDisappearedL( - TUPnPDeviceDisconnectedReason aReason ) - { - __LOG( "CUPnPAdvancedFindList::MediaServerDisappearedL" ); - - if( aReason == EDisconnected ) - { - iExitCode = KErrSessionClosed; - } - else if( aReason == EWLANLost) - { - iExitCode = KErrDisconnected; - } - else - { - __PANICD( __FILE__, __LINE__); - } - - if( iWaitNoteDialog ) //if it is on searching - { - __LOG( "CUPnPAdvancedFindList::iWaitNoteDialog ETrue" ); - DialogDismissedL( EEikBidCancel ); - iWaitNoteDialog->ProcessFinishedL(); - //no need to call DialogDismissedL; - delete iWaitNoteDialog; - iWaitNoteDialog = NULL; - } - else - { - if( iFindResultWindow ) - { - __LOG( "CUPnPAdvancedFindList::iFindResultWindow->DismissItselfL" ); - iFindResultWindow->DismissItselfL( iExitCode ); - iFindResultWindow = NULL; - } - else //notify AdvancedFindDialog to close itself - { - if ( !iShowingErrorNote ) - { - iAdvancedFindDialog.DismissItselfL( iExitCode ); - } - else - { - __LOG( "CUPnPAdvancedFindList::iShowingErrorNote ETrue" ); - } - } - } - __LOG( "CUPnPAdvancedFindList::MediaServerDisappearedL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::DialogDismissedL -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindList::DialogDismissedL( TInt aButtonId ) - { - __LOG( "CUPnPBrowseDialog::DialogDismissedL" ); - - // If button is cancel, inform observer parent class - // that cancel has been made - if( aButtonId == EEikBidCancel ) - { - __LOG( "CUPnPBrowseDialog::DialogDismissedL: \ - Cancel was pressed." ); - - iAction = CUPnPCommonUI::EUPnPNone; - iBrowseSession.CancelSearch(); - } - - __LOG( "CUPnPBrowseDialog::DialogDismissedL end" ); - //Do nothing - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::SearchResponse -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindList::SearchResponse( const TDesC8& aSearchResponse, - TInt aError, TInt /*aMatches*/, TInt /*aTotalCount*/, const TDesC8& - /*aUpdateId*/ ) - { - __LOG( "CUPnPBrowseDialog::SearchResponse" ); - RPointerArray array; - - if( aError == KErrNone ) - { - CUPnPXMLParser* parser = NULL; - TRAP( aError, parser = CUPnPXMLParser::NewL(); - parser->ParseResultDataL( array, - aSearchResponse ) ); - - delete parser; - } - - TRAP_IGNORE( SearchResponseL( aError, array ) ); - - array.ResetAndDestroy(); - - __LOG( "CUPnPBrowseDialog::SearchResponse -end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::SearchResponseL -// Response to FindMetadataL function. -// -------------------------------------------------------------------------- -void CUPnPAdvancedFindList::SearchResponseL( - TInt aError, - const RPointerArray& aResultArray ) - { - - __LOG( "CUPnPBrowseDialog::SearchResponseL" ); - iExitCode = aError; - if( KErrNone == aError ) - { - iSearchResponseReceived = ETrue; - TBuf previousTitleName; - previousTitleName.Zero(); - //Go through the search result and add data to database - - - for( TInt count = 0; count < aResultArray.Count(); count++ ) - { - //If an Item is found - CUpnpObject* tmpObject = aResultArray[count]; - - //If it is right type and name is longer than zero - if ( tmpObject->ObjectType() == EUPnPItem ) - { - CUpnpItem* item = static_cast( tmpObject ); - - if ( item->Title().Length() > 0 ) - { - - //Copy the item - item = CUpnpItem::NewL(); - CleanupStack::PushL( item ); - item->CopyL( *aResultArray[count] ); - //And if item is correct type - iResultArray.AppendL( item ); // item ownership transferred - CleanupStack::Pop( item ); - } - } - } - } - else - { - iCommonUI.GetUpnpAction( iAction ); - iCommonUI.HandleCommonErrorL( aError, NULL ); - __LOG( "CUPnPAdvancedFindList: \ - SearchResponse operation failed!" ); - } - if ( iWaitNoteDialog ) - { - TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() ); - } - __LOG( "CUPnPBrowseDialog::SearchResponseL -end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::CreateSettingItemL -// Creates list items -// -------------------------------------------------------------------------- -// -CAknSettingItem* CUPnPAdvancedFindList::CreateSettingItemL( - TInt aIdentifier ) - { - CAknSettingItem* settingItem = NULL; - switch (aIdentifier) - { - case EAdvancedFindMediaType: - { - iMediatype = 0; - settingItem = new (ELeave) CAknEnumeratedTextPopupSettingItem( - aIdentifier, iMediatype ); - break; - } - case EAdvancedFindFileName: - { - settingItem = new (ELeave) CAknTextSettingItem( aIdentifier, - iFileName ); - settingItem->SetSettingPageFlags( - CAknTextSettingPage::EZeroLengthAllowed ); - break; - } - case EAdvancedFindArtist: - { - settingItem = new (ELeave) CAknTextSettingItem( aIdentifier, - iArtistText ); - settingItem->SetSettingPageFlags( - CAknTextSettingPage::EZeroLengthAllowed ); - settingItem->SetHidden( ETrue ); - break; - } - case EAdvancedFindAlbum: - { - settingItem = new (ELeave) CAknTextSettingItem( aIdentifier, - iAlbumText ); - settingItem->SetSettingPageFlags( - CAknTextSettingPage::EZeroLengthAllowed ); - settingItem->SetHidden( ETrue ); - break; - } - case EAdvancedFindGenre: - { - settingItem = new (ELeave) CAknTextSettingItem( aIdentifier, - iGenreText ); - settingItem->SetSettingPageFlags( - CAknTextSettingPage::EZeroLengthAllowed ); - settingItem->SetHidden( ETrue ); - break; - } - case EAdvancedFindDateFrom: - { - settingItem = new (ELeave) CAknTimeOrDateSettingItem( - aIdentifier, - CAknTimeOrDateSettingItem::EDate, - iDateFrom ); - break; - } - case EAdvancedFindDateUntil: - { - settingItem = new (ELeave) CAknTimeOrDateSettingItem( - aIdentifier, - CAknTimeOrDateSettingItem::EDate, - iDateUntil ); - break; - } - default: - break; - } - return settingItem; - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::EditItemL -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindList::EditItemL ( TInt aIndex, TBool aCalledFromMenu ) - { - CAknSettingItemArray* arrayForTrueIndex = - CAknSettingItemList::SettingItemArray(); - TInt indexForEditing = arrayForTrueIndex-> - ItemIndexFromVisibleIndex( aIndex ); - arrayForTrueIndex = NULL; - switch ( indexForEditing ) - { - case EAdvancedFindMediaType: - { - iSettingPageOpen = ETrue; - CAknSettingItemList::EditItemL( indexForEditing, - aCalledFromMenu ); - CAknSettingItemArray* arrayForHideCommands = - CAknSettingItemList::SettingItemArray(); - StoreSettingsL(); - if ( iMediatype == EAdvancedFindMusic ) - { - CAknSettingItem* settingItem = - arrayForHideCommands->At( EAdvancedFindArtist ); - settingItem->SetHidden( EFalse ); - settingItem = NULL; - CAknSettingItem* settingItem2 = - arrayForHideCommands->At( EAdvancedFindAlbum ); - settingItem2->SetHidden( EFalse ); - settingItem2 = NULL; - CAknSettingItem* settingItem3 = - arrayForHideCommands->At( EAdvancedFindGenre ); - settingItem3->SetHidden( EFalse ); - settingItem3 = NULL; - } - else - { - CAknSettingItem* settingItem = - arrayForHideCommands->At( EAdvancedFindArtist ); - settingItem->SetHidden( ETrue ); - settingItem = NULL; - CAknSettingItem* settingItem2 = - arrayForHideCommands->At( EAdvancedFindAlbum ); - settingItem2->SetHidden(ETrue); - settingItem2 = NULL; - CAknSettingItem* settingItem3 = - arrayForHideCommands->At( EAdvancedFindGenre ); - settingItem3->SetHidden( ETrue ); - settingItem3 = NULL; - } - arrayForHideCommands = NULL; - } - break; - case EAdvancedFindFileName: - { - iSettingPageOpen = ETrue; - CAknSettingItemList::EditItemL( indexForEditing, - aCalledFromMenu ); - StoreSettingsL(); - } - break; - case EAdvancedFindArtist: - { - iSettingPageOpen = ETrue; - CAknSettingItemList::EditItemL( indexForEditing, - aCalledFromMenu ); - StoreSettingsL(); - } - break; - case EAdvancedFindAlbum: - { - iSettingPageOpen = ETrue; - CAknSettingItemList::EditItemL( indexForEditing, - aCalledFromMenu ); - StoreSettingsL(); - } - break; - case EAdvancedFindGenre: - { - iSettingPageOpen = ETrue; - CAknSettingItemList::EditItemL( indexForEditing, - aCalledFromMenu ); - StoreSettingsL(); - } - break; - case EAdvancedFindDateFrom: - { - iSettingPageOpen = ETrue; - CAknSettingItemList::EditItemL( indexForEditing, - aCalledFromMenu ); - StoreSettingsL(); - } - break; - case EAdvancedFindDateUntil: - { - iSettingPageOpen = ETrue; - CAknSettingItemList::EditItemL( indexForEditing, - aCalledFromMenu ); - StoreSettingsL(); - - } - break; - default: - break; - } - - iSettingPageOpen = EFalse; - //load settings to screen - CAknSettingItemList::LoadSettingsL(); - CAknSettingItemList::DrawDeferred(); - - - if( iClose ) - { - MediaServerDisappearedL(iCloseReason); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::MakeQueryL -// -------------------------------------------------------------------------- -// -TInt CUPnPAdvancedFindList::MakeQueryL() - { - //Search criteria string - HBufC8* searchCriteria = BuildSearchCriteriaL(); - CleanupStack::PushL( searchCriteria ); - - HBufC8* sortCriteria = KSortCriteria().AllocL(); - CleanupStack::PushL( sortCriteria ); - - iAction = CUPnPCommonUI::EUPnPSearch; - // Make the search request - iBrowseSession.SearchL( - KContainerIdRoot, /* object id of the container */ - *searchCriteria, /* criteria */ - KFilterCommon, /* filter */ - 0, /* start index */ - KMaxRequestCount + 1, /* request count + 1 */ - *sortCriteria ); /* sort criteria */ - CleanupStack::PopAndDestroy( sortCriteria ); - CleanupStack::PopAndDestroy( searchCriteria ); - - TInt ret = KErrNone; - iWaitNoteDialog = new(ELeave) CAknWaitDialog( ( - REINTERPRET_CAST( CEikDialog**, - &iWaitNoteDialog ) ), - ETrue ); - iWaitNoteDialog->SetCallback( this ); - - ret = iWaitNoteDialog->ExecuteLD( - R_UPNPCOMMONUI_ADVANCEDFIND_WAIT_NOTE_DIALOG ); - - //Make result window - //ret is KErrNone only when the DialogDismissedL by the FW. - // ( not canceling) - if( ret != KErrNone && iExitCode == KErrNone ) - { - //If there was more than request count received - if( iResultArray.Count() > KMaxRequestCount ) - { - //Delete Item from array - delete iResultArray[KMaxRequestCount]; - //Remove from array - iResultArray.Remove( KMaxRequestCount ); - - iShowingErrorNote = ETrue; - //Display error note - iCommonUI.DisplayErrorTextL( - R_UPNPCOMMONUI_ADVANCED_FIND_TOO_MANY_RESULTS_ERROR, - KMaxRequestCount ); - iShowingErrorNote = EFalse; - } - - // During running DisplayErrorTextL() - // We also need to care about whether iExitCode been changed or not. - if ( iExitCode != KErrNone ) - { - iResultArray.ResetAndDestroy(); - return iExitCode; - } - else - { - iFindResultWindow = CAdvancedFindResultWindow::NewL( - R_UPNPCOMMONUI_RESULT_WINDOW_MENUBAR, - iResultArray, - iAVControl, - iBrowseSession, - iCommonUI ); - - iFindResultWindow->SetMopParent( this ); - - iShowingErrorNote = ETrue; - - iExitCode = iFindResultWindow->ExecuteLD( - R_UPNPCOMMONUI_ADVANCED_FIND_RESULT_DIALOG ); - iShowingErrorNote = EFalse; - - iFindResultWindow = NULL; - } - } - CAknSettingItemList::LoadSettingsL(); - CAknSettingItemList::DrawDeferred(); - - //Delete result array - iResultArray.ResetAndDestroy(); - iSearchResponseReceived = EFalse; - - if( iExitCode != KErrSessionClosed && - iExitCode != KErrDisconnected && - iExitCode != EAknCmdExit && - iExitCode != EEikCmdExit ) - { - iExitCode = KErrNone; - } - __LOG( "CUPnPAdvancedFindList::MakeQueryL End" ); - return iExitCode; - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::HandleResourceChange -// -------------------------------------------------------------------------- -// -void CUPnPAdvancedFindList::HandleResourceChange( TInt aType ) - { - __LOG( "CUPnPAdvancedFindList::HandleResourceChange" ); - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EMainPane, mainPaneRect ); - - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( - TRect( TPoint( 0, 0 ), mainPaneRect.Size() ), - AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); - - ListBox()->SetRect( layoutRect.Rect() ); - } - - // Base call - CAknSettingItemList::HandleResourceChange( aType ); - } - - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::BuildSearchCriteriaL -// -------------------------------------------------------------------------- -// -HBufC8* CUPnPAdvancedFindList::BuildSearchCriteriaL() const - { - __LOG( "CUPnPAdvancedFindList::BuildSearchCriteriaL" ); - //Search criteria string - HBufC8* searchCriteria = NULL; - HBufC8* tmpStr = NULL; - - //Date variables for handling date search - TBuf8 tmpDateFormat; - TDateTime tmpDate; - - searchCriteria = HBufC8::NewL( - KElementClass().Length() + - KCriteriaSpace().Length() + - KCriteriaDerivedFrom().Length() + - KCriteriaSpace().Length() + - KCriteriaQuot().Length() + - KClassVideo().Length() + - KCriteriaQuot().Length() + - KCriteriaSpace().Length() + - KCriteriaAnd().Length() + - KCriteriaSpace().Length() + - KAttributeRefID().Length() + - KCriteriaSpace().Length() + - KCriteriaExists().Length() + - KCriteriaSpace().Length() + - KCriteriaFalse().Length() ); - TPtr8 strPtr = searchCriteria->Des(); - - strPtr.Copy( KElementClass() ); - strPtr.Append( KCriteriaSpace ); - strPtr.Append( KCriteriaDerivedFrom ); - strPtr.Append( KCriteriaSpace ); - strPtr.Append( KCriteriaQuot ); - - //Set search for the mediatype - __LOG1( "iMediatype: %d", iMediatype ); - switch( iMediatype ) - { - case EAdvancedFindAll: - { - strPtr.Append( KClassItem() ); - break; - } - case EAdvancedFindImages: - { - strPtr.Append( KClassImage() ); - break; - } - case EAdvancedFindVideo: - { - strPtr.Append( KClassVideo() ); - break; - } - case EAdvancedFindMusic: - { - strPtr.Append( KClassAudio() ); - break; - } - default: - { - __PANICD( __FILE__, __LINE__ ); - break; - } - } - - strPtr.Append( KCriteriaQuot ); - strPtr.Append( KCriteriaSpace ); - strPtr.Append( KCriteriaAnd ); - strPtr.Append( KCriteriaSpace ); - strPtr.Append( KAttributeRefID ); - strPtr.Append( KCriteriaSpace ); - strPtr.Append( KCriteriaExists ); - strPtr.Append( KCriteriaSpace ); - strPtr.Append( KCriteriaFalse ); - CleanupStack::PushL( searchCriteria ); - - //Check if filename has been entered to search criteria - __LOG1( "iFileName.Length: %d", iFileName.Length() ); - if( iFileName.Length() > 0 ) - { - __LOG( "add name condition" ); - tmpStr = UpnpString::FromUnicodeL( iFileName ); - - //If inserted, add to search string - searchCriteria = searchCriteria->ReAllocL( - searchCriteria->Length() + - KCriteriaSpace().Length() + - KCriteriaAnd().Length() + - KCriteriaSpace().Length() + - KElementTitle().Length() + - KCriteriaSpace().Length() + - KCriteriaContains().Length() + - KCriteriaSpace().Length() + - KCriteriaQuot().Length() + - tmpStr->Length() + - KCriteriaQuot().Length() - ); - - //pop out the old searchCriteria - CleanupStack::Pop(); - //push the new searchCriteria which is created by ReAllocL - CleanupStack::PushL( searchCriteria ); - - strPtr.Set( searchCriteria->Des() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaAnd() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KElementTitle() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaContains() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( *tmpStr ); - strPtr.Append( KCriteriaQuot() ); - delete tmpStr; - tmpStr = NULL; - - } - - //Add possibly artists to search criteria - if( iArtistText.Length() > 0 && iMediatype == EAdvancedFindMusic ) - { - __LOG( "add artists condition" ); - tmpStr = UpnpString::FromUnicodeL( iArtistText ); - searchCriteria = searchCriteria->ReAllocL( - searchCriteria->Length() + - KCriteriaSpace().Length() + - KCriteriaAnd().Length() + - KCriteriaSpace().Length() + - KCriteriaOB().Length() + - KElementArtist().Length() + - KCriteriaSpace().Length() + - KCriteriaContains().Length() + - KCriteriaSpace().Length() + - KCriteriaQuot().Length() + - tmpStr->Length() + - KCriteriaQuot().Length() + - KCriteriaSpace().Length() + - KCriteriaCB().Length() - ); - - //pop out the old searchCriteria - CleanupStack::Pop(); - //push the new searchCriteria which is created by ReAllocL - CleanupStack::PushL( searchCriteria ); - - strPtr.Set( searchCriteria->Des() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaAnd() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaOB() ); - strPtr.Append( KElementArtist() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaContains() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( *tmpStr ); //Artist name - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaCB() ); - delete tmpStr; - tmpStr = NULL; - } - - //Add possibly albums to search criteria - if( iAlbumText.Length() > 0 && iMediatype == EAdvancedFindMusic ) - { - __LOG( "add albums condition" ); - tmpStr = UpnpString::FromUnicodeL( iAlbumText ); - searchCriteria = searchCriteria->ReAllocL( - searchCriteria->Length() + - KCriteriaSpace().Length() + - KCriteriaAnd().Length() + - KCriteriaSpace().Length() + - KCriteriaOB().Length() + - KElementAlbum().Length() + - KCriteriaSpace().Length() + - KCriteriaContains().Length() + - KCriteriaSpace().Length() + - KCriteriaQuot().Length() + - tmpStr->Length() + - KCriteriaQuot().Length() + - KCriteriaSpace().Length() + - KCriteriaCB().Length() - ); - - //pop out the old searchCriteria - CleanupStack::Pop(); - //push the new searchCriteria which is created by ReAllocL - CleanupStack::PushL( searchCriteria ); - - strPtr.Set( searchCriteria->Des() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaAnd() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaOB() ); - strPtr.Append( KElementAlbum() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaContains() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( *tmpStr ); //Artist name - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaCB() ); - delete tmpStr; - tmpStr = NULL; - } - - //Add possibly genres to search criteria - if( iGenreText.Length() > 0 && iMediatype == EAdvancedFindMusic ) - { - __LOG( "add genres condition" ); - tmpStr = UpnpString::FromUnicodeL( iGenreText ); - - searchCriteria = searchCriteria->ReAllocL( - searchCriteria->Length() + - KCriteriaSpace().Length() + - KCriteriaAnd().Length() + - KCriteriaSpace().Length() + - KCriteriaOB().Length() + - KElementGenre().Length() + - KCriteriaSpace().Length() + - KCriteriaContains().Length() + - KCriteriaSpace().Length() + - KCriteriaQuot().Length() + - tmpStr->Length() + - KCriteriaQuot().Length() + - KCriteriaSpace().Length() + - KCriteriaCB().Length() - ); - - //pop out the old searchCriteria - CleanupStack::Pop(); - //push the new searchCriteria which is created by ReAllocL - CleanupStack::PushL( searchCriteria ); - - strPtr.Set( searchCriteria->Des() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaAnd() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaOB() ); - strPtr.Append( KElementGenre() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaContains() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( *tmpStr ); //Genre name - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaCB() ); - delete tmpStr; - tmpStr = NULL; - } - - // To check whether need to add time condition - TBool addTimeCondition = ETrue; - - if( iFileName.Length() > 0 ) - { - __LOG( "iFileName > 0" ); - - // Make temp TDateTime item with current home time to compare with date - // until. - TTime tempTTimeforCurrent; - tempTTimeforCurrent.HomeTime(); - TDateTime tempTDateTimeforCurrent = tempTTimeforCurrent.DateTime(); - TDateTime tempTDateTimeforUntil = iDateUntil.DateTime(); - TBuf8 tempDateFormatCurrent; - TBuf8 tempDateFormatUntil; - tempDateFormatCurrent.Format( KTimeFormat8(), - tempTDateTimeforCurrent.Year(), - tempTDateTimeforCurrent.Month() + 1, - tempTDateTimeforCurrent.Day() + 1 ); - tempDateFormatUntil.Format( KTimeFormat8(), - tempTDateTimeforUntil.Year(), - tempTDateTimeforUntil.Month() + 1, - tempTDateTimeforUntil.Day() +1 ); - - if( ( iDateFrom == iDateInitial ) && - ( tempDateFormatCurrent == tempDateFormatUntil ) ) - { - // Time criterias are not included into the find query - // if they are not altered when Title search - __LOG( "time criterias are not altered" ); - addTimeCondition = EFalse; - } - } - - if ( addTimeCondition ) - { - __LOG( "add time conditions" ); - - // Add time from - tmpDate = iDateFrom.DateTime(); - //Format the date according to UPnP - tmpDateFormat.Format( KTimeFormat8, - tmpDate.Year(), - tmpDate.Month() + 1, - tmpDate.Day() + 1 ); - - searchCriteria = searchCriteria->ReAllocL( - searchCriteria->Length() + - KCriteriaSpace().Length() + - KCriteriaAnd().Length() + - KCriteriaSpace().Length() + - KElementDate().Length() + - KCriteriaSpace().Length() + - KCriteriaGTE().Length() + - KCriteriaSpace().Length() + - KCriteriaQuot().Length() + - tmpDateFormat.Length() + - KCriteriaQuot().Length() - ); - CleanupStack::Pop(); - CleanupStack::PushL( searchCriteria ); - - strPtr.Set( searchCriteria->Des() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaAnd() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KElementDate() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaGTE() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( tmpDateFormat ); - strPtr.Append( KCriteriaQuot() ); - - // Add time until - tmpDate = iDateUntil.DateTime(); - tmpDateFormat.Format( KTimeFormat8, - tmpDate.Year(), - tmpDate.Month() + 1, - tmpDate.Day() + 1 ); - - searchCriteria = searchCriteria->ReAllocL( - searchCriteria->Length() + - KCriteriaSpace().Length() + - KCriteriaAnd().Length() + - KCriteriaSpace().Length() + - KElementDate().Length() + - KCriteriaSpace().Length() + - KCriteriaLTE().Length() + - KCriteriaSpace().Length() + - KCriteriaQuot().Length() + - tmpDateFormat.Length() + - KCriteriaQuot().Length() - ); - CleanupStack::Pop(); - CleanupStack::PushL( searchCriteria ); - - strPtr.Set( searchCriteria->Des() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaAnd() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KElementDate() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaLTE() ); - strPtr.Append( KCriteriaSpace() ); - strPtr.Append( KCriteriaQuot() ); - strPtr.Append( tmpDateFormat ); - strPtr.Append( KCriteriaQuot() ); - } - - //Encode the searchcriteria for xml compatibility - HBufC8* xmlEncodedSearchCriteria = - UpnpString::EncodeXmlStringL( searchCriteria ); - - CleanupStack::PopAndDestroy( searchCriteria ); //searchCriteria - - __LOG( "CUPnPAdvancedFindList::BuildSearchCriteriaL - end" ); - return xmlEncodedSearchCriteria; - } - -// -------------------------------------------------------------------------- -// CUPnPAdvancedFindList::IsSettingPageOpen -// -------------------------------------------------------------------------- -// -TBool CUPnPAdvancedFindList::IsSettingPageOpen() const - { - return iSettingPageOpen; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpadvfindresultwindow.cpp --- a/upnpframework/upnpcommonui/src/upnpadvfindresultwindow.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1640 +0,0 @@ -/* -* Copyright (c) 2005 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: Find results dialog class source code -* -*/ - - -// INCLUDE FILES -// System -#include -#include -#include -#include -#include -#include -#include - -// upnp stack api's -#include -#include -#include -#include - -// upnpframework / avcontroller api -#include "upnpavcontroller.h" //start browse session and rendering session -#include "upnpavbrowsingsession.h" -#include "upnpavrenderingsession.h" -#include "upnpavdevice.h" - -// upnpframework / avcontroller helper api -#include "upnpconstantdefs.h" // upnp definitions -#include "upnpitemutility.h" - -// upnpframework / internal api's -#include "upnpcommonutils.h" -#include "upnpfiletransferengine.h" -#include "upnpmusicadapter.h" -#include "upnpplaylistfiller.h" - -// common ui internal -#include -#include -#include -#include "upnpadvfindresultwindow.h" -#include "upnpcommonui.hrh" -#include "upnpimageplayer.h" -#include "upnplocalplayer.h" -#include "upnpcommonui.h" -#include "upnpperiodic.h" - -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -//CONSTANTS -_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" ); -const TInt KMbmFileBufferSize = 256; -_LIT8( KUnknown, "Unknown" ); -_LIT( KUPNP_HLP_SEARCH, "UPNP_HLP_SEARCH" ); - -// Format string for image not showing -_LIT( KImageFormatString, "%d\t%S\t\t" ); - -// Format string for image showing -_LIT( KImageShowingFormatString, "%d\t%S\t\t%d" ); - -const TInt KLength = 100; - -// The delay from the Start() function of CPeriodic class -// to the generation of the first event, in microseconds. -const TInt KImageTimerDelay = 800000; - -// A callback specifying a function to be called -// when the CPeriodic is scheduled after a timer event, in microseconds. -const TInt KImageTimerInterval = 800000; - -enum TUPnPIconTypes - { - EUPnPIconMusic = 1, - EUPnPIconVideo, - EUPnPIconImage, - EUPnPIconImageShowing, - EUPnPIconOther, - EUPnPIconLast - }; - - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CAdvancedFindResultWindow* CAdvancedFindResultWindow::NewL( - TInt aMenuResource, - RPointerArray& aResultArray, - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ) - { - CAdvancedFindResultWindow* self = new(ELeave) CAdvancedFindResultWindow( - aAVControl, - aBrowseSession, - aCommonUI ); - CleanupStack::PushL( self ); - self->ConstructL( aMenuResource, aResultArray ); - CleanupStack::Pop(); - return self; - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// - -void CAdvancedFindResultWindow::ConstructL( - TInt aMenuResource, - RPointerArray& aResultArray ) - { - - - - iTargetDevice = CUpnpAVDevice::NewL(); - - iImageControlTimer = CUPnPPeriodic::NewL( CActive::EPriorityUserInput ); - - //iCommonUI = CUPnPCommonUI::NewL(); - - for( TInt index = 0; index < aResultArray.Count(); index++ ) - { - iResultArray.AppendL( aResultArray[index] ); - } - - CAknDialog::ConstructL( aMenuResource ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::CAdvancedFindResultWindow -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- - -CAdvancedFindResultWindow::CAdvancedFindResultWindow( - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ): - iBrowseSession(aBrowseSession), - iAVControl(aAVControl), - iCommonUI(aCommonUI) - { - iSourceDevice = &( iBrowseSession.Device() ); - iChildDialogOpen = 0; - iMSDisappear = EFalse; - iAction = CUPnPCommonUI::EUPnPNone; - iIsMusicItem = EFalse; - iLastImageItemIndex = KErrNotFound; - iHashKeyFlag = EFalse; - } - -// Destructor -CAdvancedFindResultWindow::~CAdvancedFindResultWindow() - { - if ( iNaviDecorator && iNaviPane ) - { - iNaviPane->Pop( iNaviDecorator ); - } - delete iNaviDecorator; - - iResultArray.Close(); - - if ( iImagePlayer ) - { - iImagePlayer->Stop(); - delete iImagePlayer; - } - delete iLocalPlayer; - - if ( iImageControlTimer ) - { - iImageControlTimer->Cancel(); - delete iImageControlTimer; - } - - delete iTargetDevice; - } - -// --------------------------------------------------------- -// CAdvancedFindResultWindow::OkToExitL( TInt aButtonId ) -// called by framework when the softkey is pressed -// --------------------------------------------------------- -// - -TBool CAdvancedFindResultWindow::OkToExitL( TInt aButtonId ) - { - // Translate the button presses into commands for the appui & current - // view to handle - - switch ( aButtonId ) - { - case EAknSoftkeyOk: - { - if ( iResultArray.Count() > 0 ) - { - TRAPD( error, ShowPlayExtL() ); - HandleErrorL( error ); - } - break; - } - case EUPnPStopCmd: - { - StopImageControlL(); - break; - } - case EUPnPPlayCmd: - { - if( !iMusicPlay ) - { - StopImageControlL(); - TRAPD( error, PlayL( EFalse ) ); - if( KErrNone != error ) - { - iMusicPlay = EFalse; - } - HandleErrorL( error ); - } - break; - } - case EAknSoftkeyShow: - { - StopImageControlL(); - TRAPD( error, ShowVideoExtL() ); - HandleErrorL( error ); - break; - } - case KErrSessionClosed: - case KErrDisconnected: - case EAknCmdExit: // fall through - case EAknSoftkeyBack: - { - iNaviPane->PushDefaultL(); - return ETrue; - } - case EAknSoftkeyOptions: - { - CAknDialog::DisplayMenuL(); - SetNaviPaneTextL(); - break; - } - default: - { - break; - }//switch (aButtonId) - } - - return EFalse; - } - -// --------------------------------------------------------- -// CAdvancedFindResultWindow::PreLayoutDynInitL() -// called by framework before dialog is shown -// --------------------------------------------------------- -// -void CAdvancedFindResultWindow::PreLayoutDynInitL() - { - iListBox = static_cast( - Control(EAdvFindResultBoxId) ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - - CAknIconArray* icons = new (ELeave) CAknIconArray( EUPnPIconLast ); - CleanupStack::PushL( icons ); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) ); - - - TFileName mbmFileName( KAknCommonUIMbmFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - mbmFileName.Insert( 0, drive ); - - - //marked icon - AppendIconToArrayL( icons, - skin, - KAvkonBitmapFile, - KAknsIIDQgnIndiMarkedAdd, - EMbmAvkonQgn_indi_marked_add, - EMbmAvkonQgn_indi_marked_add_mask ); - // Music icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_prop_mserv_music, - EMbmUpnpcommonuiQgn_prop_mserv_music_mask ); - // Video icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_prop_mserv_other_videos, - EMbmUpnpcommonuiQgn_prop_mserv_other_videos_mask ); - // Image icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_prop_mserv_other_images, - EMbmUpnpcommonuiQgn_prop_mserv_other_images_mask ); - // Image showing icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon, - EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon_mask ); - //Other icon - AppendIconToArrayL( icons, - skin, - KCommonDialogsBitmapFile, - KAknsIIDQgnPropFmgrFileSound, - EMbmCommondialogsQgn_prop_fmgr_file_other, - EMbmCommondialogsQgn_prop_fmgr_file_other_mask ); - iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons ); - CleanupStack::Pop(icons); - // set dialog title - CEikStatusPane* statusPane = - ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); - iTitlePane = (CAknTitlePane*)statusPane->ControlL( - TUid::Uid( EEikStatusPaneUidTitle ) ); - // Set the text string. - HBufC* tempStr = StringLoader::LoadLC( - R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_TITLE ); - iTitlePane->SetTextL( *tempStr ); - CleanupStack::PopAndDestroy( tempStr ); - LoadListItemsL(); - SetNaviPaneTextL(); - iListBox->ActivateL(); - } - -// --------------------------------------------------------- -// CAdvancedFindResultWindow::PostLayoutDynInitL() -// Called by framework before dialog is shown. -// Needed because filter is not active until PreLayoutDynInitL(). -// --------------------------------------------------------- -// -/*void CAdvancedFindResultWindow::PostLayoutDynInitL() - { - }*/ - -// --------------------------------------------------------- -// CAdvancedFindResultWindow::OfferKeyEventL() -// called by framework when key is pressed -// --------------------------------------------------------- -// -TKeyResponse CAdvancedFindResultWindow::OfferKeyEventL ( - const TKeyEvent &aKeyEvent, - TEventCode aType ) - { - TInt tempCounter = iListBox->CurrentItemIndex(); - if (aType != EEventKey) - { - if ( aKeyEvent.iScanCode == EStdKeyHash ) - { - if ( aType == EEventKeyDown ) - { - iHashKeyFlag = ETrue; - } - else - { - iHashKeyFlag = EFalse; - } - } - iListBox->OfferKeyEventL( aKeyEvent, aType ); - - if ( aType == EEventKeyUp && !iHashKeyFlag ) - { - if ( !iImageControlActive ) - { - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - UpdateCommandButtonAreaL( ETrue, tempCounter ); - } - else - { - UpdateCommandButtonAreaL( EFalse, tempCounter ); - } - } - } - return EKeyWasConsumed; - } - else - { - if ( aKeyEvent.iCode == EKeyDownArrow || - aKeyEvent.iCode == EKeyUpArrow ) - { - if ( iImageControlActive ) - { - iImageControlTimer->Cancel(); - StartImageControlTimer(); - } - - if ( aKeyEvent.iCode == EKeyDownArrow ) - { - tempCounter++; - } - else - { - tempCounter--; - } - if ( tempCounter >= iResultArray.Count() ) - { - tempCounter = 0; - } - if ( tempCounter < 0 ) - { - tempCounter = iResultArray.Count()-1; - } - if( iImageControlActive ) - { - if( UPnPItemUtility::BelongsToClass( - *iResultArray[tempCounter], KClassImage ) ) // image - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP ); - } - else if ( UPnPItemUtility::BelongsToClass( - *iResultArray[tempCounter], KClassVideo ) ) // video - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_SHOW_STOP ); - } - else if ( UPnPItemUtility::BelongsToClass( - *iResultArray[tempCounter], KClassAudio ) ) // music - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_PLAY_STOP ); - } - else - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP ); - } - } - } - - CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - if ( ( tempCounter < iResultArray.Count() ) && tempCounter > -1 ) - { - if ( !iImageControlActive ) - { - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - UpdateCommandButtonAreaL( ETrue, tempCounter ); - } - else - { - UpdateCommandButtonAreaL( EFalse, tempCounter ); - } - } - } - } - return EKeyWasConsumed; - } - -// --------------------------------------------------------- -// CAdvancedFindResultWindow::SetNaviPaneText() -// Sets navi pane text referring to the count of selected files -// --------------------------------------------------------- -// -void CAdvancedFindResultWindow::SetNaviPaneTextL() - { - TInt itemCount = iResultArray.Count(); - HBufC* naviText; - if (itemCount == 1) - { - naviText = StringLoader::LoadLC( - R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILE, - itemCount ); - - } - else - { - naviText = StringLoader::LoadLC( - R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_FILES, - itemCount ); - } - // push text to navi pane - CEikStatusPane* statusPane = - ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); - iNaviPane = ( CAknNavigationControlContainer * )statusPane->ControlL( - TUid::Uid(EEikStatusPaneUidNavi ) ); - // delete previous navidecorator - delete iNaviDecorator; iNaviDecorator = NULL; - - iNaviDecorator = iNaviPane->CreateNavigationLabelL( *naviText ); - iNaviPane->PushL( *iNaviDecorator ); - CleanupStack::PopAndDestroy( naviText ); - DrawDeferred(); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::AppendIconToArrayL -// Load a possibly skinned icon (with mask) and append it to an -// icon array. -// -------------------------------------------------------------------------- -// - -void CAdvancedFindResultWindow::AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ) - { - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - TBuf buffer( aMbmFile ); - AknsUtils::CreateIconLC( aSkin, aID, bitmap, mask, - aMbmFile, aBitmapId, aMaskId ); - CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); - icon->SetBitmapsOwnedExternally( EFalse ); - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop( mask ); - CleanupStack::Pop( bitmap ); - bitmap = NULL; - mask = NULL; - CleanupStack::PushL( icon ); - aArray->AppendL( icon ); - // aArray now owns the icon, no need to delete. - CleanupStack::Pop( icon ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ProcessCommandL -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::ProcessCommandL( TInt aCommand ) - { - TInt error = KErrNone; - - HideMenu(); - TInt selected_item = iListBox->CurrentItemIndex(); - switch (aCommand) - { - case EUPnPPlayExt: - case EUPnPShowExt: //fall through - { - TRAP( error, ShowPlayExtL() ); - break; - } - case EUPnPPlayLocal: // - case EUPnPShowLocal: //fall through - { - TRAP( error, ShowPlayLocalL() ); - if( KErrSessionClosed == error ) - { - iMSDisappear = ETrue; - } - break; - } - case EUPnPCopy: - { - TRAP( error, HandleCopyL() ); - if( KErrNotFound == error ) - { - iCopyIndex = 0; - } - if( error == KErrSessionClosed ) //if server lost - { - iMSDisappear = ETrue; - } - break; - } - case EAknCmdHelp: - { - TRAPD( error, HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() ) ); - if ( error != KErrNone ) - { - __LOG1( "CAdvancedFindResultWindow: \ - LaunchHelpApplicationL returned err=%d", error ); - } - break; - } - case EAknCmdMark: - { - MarkUnmarkL( iListBox->CurrentItemIndex(), ETrue ); - break; - } - case EAknMarkAll: - { - MarkUnmarkL( -1, ETrue ); - break; - } - case EAknCmdUnmark: - { - MarkUnmarkL( iListBox->CurrentItemIndex(), EFalse ); - break; - } - case EAknUnmarkAll: - { - MarkUnmarkL( -1, EFalse ); - break; - } - case EAknCmdExit: - { - //User::Exit(0); - TryExitL( aCommand ); //no need to go to next - return; - } - default: - CAknDialog::ProcessCommandL( aCommand ); - break; - } - HandleErrorL( error ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::MarkUnmarkL -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::MarkUnmarkL( TInt aItem, TBool aMark ) - { - CTextListBoxModel* model = iListBox->Model(); - TInt itemCount = model->NumberOfItems(); - CListBoxView* listBoxView = iListBox->View(); - if ( aMark ) - { - for ( TUint i = 0; i < itemCount; i++ ) - { - if ( aItem == -1 || aItem == i ) - { - listBoxView->SelectItemL( i ); - } - } - UpdateCommandButtonAreaL( ETrue, iListBox->CurrentItemIndex() ); - } - else - { - for ( TUint i = 0; i < itemCount; i++ ) - { - if ( aItem == -1 || aItem == i ) - { - listBoxView->DeselectItem( i ); - } - } - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - UpdateCommandButtonArea( ETrue, iListBox->CurrentItemIndex() ); - } - else - { - UpdateCommandButtonArea( EFalse, iListBox->CurrentItemIndex() ); - } - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::PlayL -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::PlayL( TBool aLocal ) - { - TInt error = KErrNone; - - // create a playlist representation - CUPnPPlayListFiller* filler = - CUPnPPlayListFiller::NewL(); - CleanupStack::PushL( filler ); - TInt firstAudioItem = KErrNotFound; - TBool focusedItemFound = EFalse; - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() > 0 ) - { - // play the marked files - for (TInt i = 0; i < indexes->Count(); i++) - { - filler->InsertObjectL( - *iSourceDevice, *iResultArray[ indexes->At( i ) ] ); - - if( UPnPItemUtility::BelongsToClass( - *iResultArray[ indexes->At(i) ], KClassAudio ) - && firstAudioItem == KErrNotFound ) - { - firstAudioItem = i; - } - if( iResultArray[ indexes->At( i ) ]->Id() - == iResultArray[ iListBox->CurrentItemIndex() ]->Id() ) - { - filler->SetSelectedIndex( i ); - focusedItemFound = ETrue; - } - } - - if( !focusedItemFound ) - { - filler->SetSelectedIndex( firstAudioItem ); - } - } - else - { - // play all found files - for( TInt i = 0; i < iResultArray.Count(); i++ ) - { - filler->InsertObjectL( - *iSourceDevice, *iResultArray[ i ] ); - } - filler->SetSelectedIndex( iListBox->CurrentItemIndex() ); - } - - if( !aLocal ) - { - - iChildDialogOpen++; - error = iCommonUI.SelectDeviceL( - iAVControl, - *iTargetDevice, - EUPnPSearchRenderingDevicesWithAudioCapability, - EUPnPSelectDeviceTitle ); - if ( KErrNone == error ) - { - CleanupStack::Pop( filler ); // musicadapter handles delete - - iMusicPlay = ETrue; - //filler ownership transferred - error = iCommonUI.ExecuteMusicPlayerL( iAVControl, - filler, - iTargetDevice ); - iMusicPlay = EFalse; - iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL( - R_AVKON_STATUS_PANE_LAYOUT_USUAL); - iAvkonEnv->LoadAknLayoutL(); - iAvkonAppUi->ReportResourceChangedToAppL( - KEikDynamicLayoutVariantSwitch ); - - } - else - { - CleanupStack::PopAndDestroy( filler ); - } - iChildDialogOpen--; - } - else - { - CleanupStack::Pop( filler ); - iChildDialogOpen++; - iMusicPlay = ETrue; - //filler ownership transferred - error = iCommonUI.ExecuteMusicPlayerL( iAVControl, filler, NULL ); - iMusicPlay = EFalse; - iChildDialogOpen--; - iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL( - R_AVKON_STATUS_PANE_LAYOUT_USUAL); - iAvkonEnv->LoadAknLayoutL(); - iAvkonAppUi->ReportResourceChangedToAppL( - KEikDynamicLayoutVariantSwitch ); - } - if( KErrNone != error ) - { - User::Leave( error ); - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ShowPlayExtL -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::ShowPlayExtL() - { - //if audio file is either in marked items or highlighted, play it - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - if( IsAudioItemMarked() && !iMusicPlay ) - { - TRAPD( err, PlayL( EFalse ) ); - if( KErrNone != err ) - { - iMusicPlay = EFalse; - } - } - } - else // if no marked items - { - if ( ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassVideo ) == 0 ) - { - ShowVideoExtL(); - } - else if ( ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassImage ) == 0 ) - { - ShowImageExtL(); - } - else if ( ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassAudio ) == 0 && - !iMusicPlay ) - { - PlayL( EFalse ); - } - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ShowPlayLocalL -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::ShowPlayLocalL() - { - //if audio file is either in marked items or highlighted, play it - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( !iMusicPlay && UPnPItemUtility::BelongsToClass( - *iResultArray[iListBox->CurrentItemIndex()], KClassAudio) ) - { - TRAPD( err, PlayL( ETrue ) ); - if( KErrNone != err ) - { - iMusicPlay = EFalse; - } - } - else // if no marked items - { - if ( !indexes->Count() ) - { - if ( ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassVideo ) == 0 || - ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassImage ) == 0 ) - { - if( !iLocalPlayer ) - { - iLocalPlayer = CUPnPLocalPlayer::NewL( iAVControl, - iBrowseSession, - iCommonUI ); - } - const CUpnpObject* item = - iResultArray[iListBox->CurrentItemIndex()]; - - iLocalPlayer->PlayL( *item ); - } - } - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::LoadListItemsL -// loads items in result array to dialog. -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::LoadListItemsL() - { - MarkUnmarkL( -1, EFalse ); //deselect all items - CTextListBoxModel* model = iListBox->Model(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - HBufC16* item = HBufC16::NewL(256); - CleanupStack::PushL( item ); - listBoxItems->Reset(); - if( !iResultArray.Count() ) - { - // show "no results" text - HBufC* noResultsText = StringLoader::LoadLC( - R_UPNPCOMMONUI_ADVANCED_FIND_SEARCH_RESULT_NO_RESULTS ); - iListBox->View()->SetListEmptyTextL( *noResultsText ); - CleanupStack::PopAndDestroy( noResultsText ); - } - else - { - for (TInt i=0; i < iResultArray.Count(); i++) - { - if( ( iResultArray[i])-> - ObjectClass().Find( KClassAudio ) == 0 ) - { - if( ( iResultArray[i]->Title().Length() ) != 0 ) - { - // Get title and replace illegal characters. - HBufC8* tmptitle = - UPnPCommonUtils::FixListboxItemTextL( - iResultArray[ i ]->Title().Left( KLength ) ); - - CleanupStack::PushL( tmptitle ); - TPtrC8 tmpnameptr = *tmptitle; - iResultArray[i]->SetTitleL( tmpnameptr ); - - HBufC* tmpStr = - UpnpString::ToUnicodeL( tmpnameptr.Left( KLength ) ); - CleanupStack::PushL( tmpStr ); - HBufC8* artist = NULL; - - const RUPnPElementsArray& elms = - iResultArray[i]->GetElements(); - TInt count = elms.Count(); - for( TInt i = 0; i < count; i++) - { - if( elms[ i ]->Name() == KElementArtist() ) - { - artist = elms[ i ]->Value().AllocL(); - i = count; - } - } - if( !artist ) - { - TBufC8<7> buf( KUnknown() ); - artist = buf.AllocL(); - } - CleanupStack::PushL( artist ); - HBufC* tmpStr2 = - UpnpString::ToUnicodeL( artist->Left( KLength ) ); - CleanupStack::PushL( tmpStr2 ); - item->Des().Format( _L("%d\t%S\t%S\t"), - EUPnPIconMusic, - tmpStr, - tmpStr2 ); - CleanupStack::PopAndDestroy( tmpStr2 ); - CleanupStack::PopAndDestroy( artist ); - CleanupStack::PopAndDestroy( tmpStr ); - CleanupStack::PopAndDestroy( tmptitle ); - } - } - else if( (iResultArray[i])->ObjectClass().Find( KClassVideo ) - == 0 ) //if video - { - if( ( iResultArray[i]->Title().Length() ) != 0 ) - { - // Get title and replace illegal characters. - HBufC8* tmptitle = - UPnPCommonUtils::FixListboxItemTextL( - iResultArray[ i ]->Title().Left( KLength ) ); - - CleanupStack::PushL( tmptitle ); - TPtrC8 tmpnameptr = *tmptitle; - iResultArray[i]->SetTitleL( tmpnameptr ); - - HBufC* tmpStr = - UpnpString::ToUnicodeL( tmpnameptr.Left( KLength ) ); - CleanupStack::PushL( tmpStr ); - item->Des().Format( _L("%d\t%S\t\t"), - EUPnPIconVideo, - tmpStr ); - CleanupStack::PopAndDestroy( tmpStr ); - CleanupStack::PopAndDestroy( tmptitle ); - } - - } - else if( ( iResultArray[i] )->ObjectClass().Find( KClassImage ) - == 0 ) //if image - { - if( ( iResultArray[i]->Title().Length() ) != 0 ) - { - // Get title and replace illegal characters. - HBufC8* tmptitle = - UPnPCommonUtils::FixListboxItemTextL( - iResultArray[ i ]->Title().Left( KLength ) ); - - CleanupStack::PushL( tmptitle ); - TPtrC8 tmpnameptr = *tmptitle; - iResultArray[i]->SetTitleL( tmpnameptr ); - - HBufC* tmpStr = UpnpString::ToUnicodeL( - tmpnameptr.Left( KLength ) ); - CleanupStack::PushL( tmpStr ); - item->Des().Format( _L("%d\t%S\t\t"), - EUPnPIconImage, - tmpStr ); - CleanupStack::PopAndDestroy( tmpStr ); - CleanupStack::PopAndDestroy( tmptitle ); - } - } - else //if not recoganized media file type - { - if( ( iResultArray[i]->Title().Length() ) != 0 ) - { - // Get title and replace illegal characters. - HBufC8* tmptitle = - UPnPCommonUtils::FixListboxItemTextL( - iResultArray[ i ]->Title().Left( KLength ) ); - - CleanupStack::PushL( tmptitle ); - TPtrC8 tmpnameptr = *tmptitle; - iResultArray[i]->SetTitleL( tmpnameptr ); - - HBufC* tmpStr = UpnpString::ToUnicodeL( - tmpnameptr.Left( KLength ) ); - CleanupStack::PushL( tmpStr ); - item->Des().Format( _L("%d\t%S\t\t"), - EUPnPIconOther, - tmpStr ); - CleanupStack::PopAndDestroy( tmpStr ); - CleanupStack::PopAndDestroy( tmptitle ); - } - } - listBoxItems->AppendL( item->Des() ); - } //for - iListBox->HandleItemAdditionL(); // Update listbox - iListBox->SetCurrentItemIndexAndDraw( 0 ); // select new item - if( (iResultArray[0])-> - ObjectClass().Find( KClassImage ) == 0 || - (iResultArray[0])-> - ObjectClass().Find( KClassVideo ) == 0) - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW ); - } - else if( ( iResultArray[0] )->ObjectClass() - .Find( KClassAudio ) == 0 ) - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY ); - } - else - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - } - - - CleanupStack::PopAndDestroy( item ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::DynInitMenuPaneL(TInt aResourceId, -// CEikMenuPane *aMenuPane) -// creates dynamical menu according to result array users -// selections/highlighted item -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane *aMenuPane ) - { - TInt selected_item = iListBox->CurrentItemIndex(); - if ( aResourceId == R_UPNPCOMMONUI_RESULT_WINDOW_MENU ) - { - aMenuPane->SetItemDimmed( EUPnPShow, ETrue ); - aMenuPane->SetItemDimmed( EUPnPPlay, ETrue ); - if (iResultArray.Count() == 0) - { - aMenuPane->SetItemDimmed( EUPnPCopy, ETrue ); - aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue ); - } - else - { - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) //if items are marked - { - if( UPnPItemUtility::BelongsToClass( - *iResultArray[selected_item], - KClassAudio ) - && IsAudioItemMarked() ) - { - //if an audio is focused - aMenuPane->SetItemDimmed(EUPnPPlay, EFalse); - } - else - { - aMenuPane->SetItemDimmed(EUPnPPlay, ETrue); - } - } - //check highlited items - else if ( ( ( iResultArray[iListBox->CurrentItemIndex()])-> - ObjectClass().Find( KClassVideo ) == 0 || - ( iResultArray[iListBox->CurrentItemIndex()])-> - ObjectClass().Find( KClassImage ) == 0 ) ) - { - aMenuPane->SetItemDimmed( EUPnPShow, EFalse ); - } - else if ( ( iResultArray[iListBox->CurrentItemIndex()])-> - ObjectClass().Find( KClassAudio ) - == 0 ) //if music - { - aMenuPane->SetItemDimmed( EUPnPPlay, EFalse ); - } - } - - // hide help option if not supported - if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); - } - } - else if( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION ) - { - TBool markHidden = iListBox->View()->ItemIsSelected( selected_item ); - TBool unmarkHidden = !iListBox->View()-> - ItemIsSelected( selected_item ); - TBool markAllHidden = iListBox->Model()->NumberOfItems() == 0 || - iListBox->SelectionIndexes()->Count()==iListBox->Model()-> - NumberOfItems(); - TBool unmarkAllHidden = iListBox->Model()->NumberOfItems() == 0 || - iListBox->SelectionIndexes()->Count() == 0; - aMenuPane->SetItemDimmed( EAknCmdMark, markHidden ); - aMenuPane->SetItemDimmed( EAknCmdUnmark, unmarkHidden ); - aMenuPane->SetItemDimmed( EAknMarkAll, markAllHidden ); - aMenuPane->SetItemDimmed( EAknUnmarkAll, unmarkAllHidden ); - } - - CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::GetHelpContext -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::GetHelpContext( - TCoeHelpContext& aContext ) const - { - __LOG( "CAdvancedFindResultWindow::GetHelpContext"); - -// aContext.iMajor = TUid::Uid( KMediaGalleryUID3 ); - aContext.iContext = KUPNP_HLP_SEARCH; - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ShowVideoExtL -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::ShowVideoExtL() - { - - TInt error = KErrGeneral; - iAction = CUPnPCommonUI::EUPnPShow; - iChildDialogOpen++; - error = iCommonUI.SelectDeviceL( - iAVControl, - *iTargetDevice, - EUPnPSearchRenderingDevicesWithVideoCapability, - EUPnPSelectDeviceTitle ); - iChildDialogOpen--; - if ( KErrNone == error ) - { - const CUpnpObject* selectedObject = iResultArray[iListBox-> - CurrentItemIndex()]; - - if( iSourceDevice ) - { - - MUPnPAVRenderingSession* renderingSession = - &(iAVControl.StartRenderingSessionL( *iTargetDevice ) ); - iChildDialogOpen++; - - TInt ret = KErrNone; - //trap here to release rendering session properly - TRAP( error, ret = iCommonUI.ExecuteVideoPlayerL( - *renderingSession, - *selectedObject ) ); - - if( ret < KErrNone ) - { - error = ret; - } - - //set back panel and navi text - - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - iSourceDevice->FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - HBufC* titleString = - UpnpString::ToUnicodeL( friendlyname.Left( KLength ) ); - CleanupStack::PushL( titleString ); - - iTitlePane->SetTextL( *titleString ); - CleanupStack::PopAndDestroy( titleString ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - - SetNaviPaneTextL(); - - renderingSession->RemoveObserver(); - iAVControl.StopRenderingSession( *renderingSession ); - - iChildDialogOpen--; - } - } - if( KErrNone != error ) - { - User::Leave( error ); - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ShowImageExtL -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::ShowImageExtL() - { - TInt error = KErrNone; - iAction = CUPnPCommonUI::EUPnPShow; - iChildDialogOpen++; - error= iCommonUI.SelectDeviceL( - iAVControl, - *iTargetDevice, - EUPnPSearchRenderingDevicesWithImageCapability, - EUPnPSelectDeviceTitle ); - iChildDialogOpen--; - - if ( KErrNone == error ) - { - if( !iImagePlayer ) - { - iImagePlayer = CUpnpImagePlayer::NewL( iAVControl, - *this, - iCommonUI ); - } - iImagePlayer->SetTargetDeviceL( *iTargetDevice ); - - StartImageControlTimer(); - iImageControlActive = ETrue; - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP ); - } - else - { - User::Leave( error ); - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ShowCurrentImageL -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::ShowCurrentImageL( TBool aShowImage ) - { - TInt currentItemIndex = iListBox->CurrentItemIndex(); - if ( currentItemIndex < 0 ) - { - currentItemIndex = 0; - } - - CDesCArray* listBoxItems = - static_cast( iListBox->Model()->ItemTextArray() ); - - if( iLastImageItemIndex >= 0 ) // if last item was image - { - TBuf lastItem; - HBufC *lastTmpItem = UpnpString::ToUnicodeL( - iResultArray[iLastImageItemIndex]->Title().Left( KLength ) ); - CleanupStack::PushL( lastTmpItem ); - lastItem.Format( KImageFormatString(), - EUPnPIconImage, - lastTmpItem); - CleanupStack::PopAndDestroy ( lastTmpItem ); - - listBoxItems->Delete( iLastImageItemIndex ); - listBoxItems->InsertL( iLastImageItemIndex, lastItem ); - iListBox->HandleItemAdditionL(); - if( !( UPnPItemUtility::BelongsToClass( - *iResultArray[iListBox->CurrentItemIndex()], KClassImage ) ) ) - { - iLastImageItemIndex = KErrNotFound; - } - } - - if( UPnPItemUtility::BelongsToClass( - *iResultArray[iListBox->CurrentItemIndex()], KClassImage ) ) - { - if( ( CUpnpItem* )iResultArray[currentItemIndex] - ->Title().Length() != 0 ) - { - HBufC *tmpItem = UpnpString::ToUnicodeL( - iResultArray[ currentItemIndex ]->Title().Left( KLength ) ); - CleanupStack::PushL( tmpItem ); - - TBuf item; - // if not showing an image - if ( !aShowImage ) - { - item.Format( KImageFormatString(), EUPnPIconImage, tmpItem); - iLastImageItemIndex = KErrNotFound; - listBoxItems->Delete( currentItemIndex ); - listBoxItems->InsertL( currentItemIndex, item ); - } - else // if showing an image - { - - item.Format( KImageShowingFormatString() ,EUPnPIconImage, - tmpItem, - EUPnPIconImageShowing ); - if(iImagePlayer) - { - iAction = CUPnPCommonUI::EUPnPShow; - TRAPD( error, iImagePlayer->PlayL( - *iResultArray[currentItemIndex] ) ); - - HandleErrorL( error ); - - } - - // listBoxItem.Set( item ); - listBoxItems->Delete( currentItemIndex ); - listBoxItems->InsertL( currentItemIndex, item ); - iLastImageItemIndex = currentItemIndex; - } - CleanupStack::PopAndDestroy ( tmpItem ); - iListBox->HandleItemAdditionL(); - iListBox->SetCurrentItemIndexAndDraw( currentItemIndex ); - } - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::StartImageControlTimer -// Starts periodic timer -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::StartImageControlTimer() - { - __LOG( "CAdvancedFindResultWindow::StartImageControlTimer" ); - iImageControlTimer->Start( - KImageTimerDelay, - KImageTimerInterval, - TCallBack( ImageControlTimerCallbackL, this ) ); - __LOG( "CAdvancedFindResultWindow::StartImageControlTimer-END" ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::ImageControlTimerCallbackL -// Callback method for the Timer. -// -------------------------------------------------------------------------- -TInt CAdvancedFindResultWindow::ImageControlTimerCallbackL( TAny* aDlg ) - { - __LOG( "CAdvancedFindResultWindow::ImageControlTimerCallbackL" ); - - static_cast< CAdvancedFindResultWindow* >( aDlg )-> - iImageControlTimer->Cancel(); - static_cast< CAdvancedFindResultWindow* >( aDlg )-> - ShowCurrentImageL( ETrue ); - - __LOG( "CAdvancedFindResultWindow::ImageControlTimerCallbackL-END" ); - return KErrNone; -} - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::StopImageControlL -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::StopImageControlL() - { - __LOG( "CAdvancedFindResultWindow::StopImageControlL" ); - - if ( iImageControlActive ) - { - iImageControlActive = EFalse; - iImageControlTimer->Cancel(); - ShowCurrentImageL( EFalse ); - - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - if( UPnPItemUtility::BelongsToClass( - *iResultArray[iListBox->CurrentItemIndex()], - KClassAudio ) - && IsAudioItemMarked() ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY ); - } - else - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - } - else // check the hightlighted item - { - TInt tempCounter = iListBox->CurrentItemIndex(); - if( UPnPItemUtility::BelongsToClass( - *iResultArray[tempCounter], KClassImage ) || - UPnPItemUtility::BelongsToClass( - *iResultArray[tempCounter], KClassVideo ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW ); - } - else if( UPnPItemUtility::BelongsToClass( - *iResultArray[tempCounter], KClassAudio ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY ); - } - else - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - } - - iAction = CUPnPCommonUI::EUPnPNone; - iImagePlayer->Stop(); - } - - __LOG( "CAdvancedFindResultWindow::StopImageControlL-END" ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::DismissItselfL -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::DismissItselfL( TInt aError ) - { - __LOG( "CAdvancedFindResultWindow::DismissItselfL" ); - iMSDisappear = ETrue; - if( iChildDialogOpen > 0 ) //if video or music dialog open - { - __LOG( "CAdvancedFindResultWindow::iCommonUI.DismissDialogL" ); - iCommonUI.DismissDialogL( aError ); - } - else - { - __LOG( "CAdvancedFindResultWindow::TryExitL" ); - TryExitL( aError ); //media server disappeared or WLAN lost - } - __LOG( "CAdvancedFindResultWindow::DismissItselfL End" ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::DeviceDisappeared -// called by image play only, no implementation -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::DeviceDisappeared( TInt aError ) - { - TRAP_IGNORE( HandleErrorL( aError ) ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::HandleCopyL -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::HandleCopyL() - { - iAction = CUPnPCommonUI::EUPnPCopy; - iCopyIndex = NULL; - RPointerArray tempArrayForCopy; - CleanupResetAndDestroyPushL( tempArrayForCopy ); - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - for (TInt count=0; count < indexes->Count(); count++) - { - CUpnpItem* tempItem = CUpnpItem::NewL(); - CleanupStack::PushL( tempItem ); - tempItem->CopyL( *iResultArray[indexes->At(count)] ); - tempArrayForCopy.AppendL( tempItem ); - CleanupStack::Pop( tempItem ); - } - iCopyIndex = indexes->Count(); - } - else - { - CUpnpItem* tempItem = CUpnpItem::NewL(); - CleanupStack::PushL( tempItem ); - tempItem-> - CopyL( *iResultArray[iListBox->CurrentItemIndex()] ); - tempArrayForCopy.AppendL( tempItem ); - CleanupStack::Pop( tempItem ); - iCopyIndex = 1; - } - - CUpnpFileTransferEngine* ftEngine = NULL; - // Instantiate the UPnP File Transfer Engine - ftEngine = CUpnpFileTransferEngine::NewL( &iBrowseSession ); - CleanupStack::PushL( ftEngine ); - - ftEngine->CopyRemoteItemsToHandsetL( tempArrayForCopy ); - // Clean up ftEngine - CleanupStack::PopAndDestroy( ftEngine ); - ftEngine = NULL; - - // Clean up tempArrayForCopy - CleanupStack::PopAndDestroy( &tempArrayForCopy ); - } -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::HandleErrorL -// -------------------------------------------------------------------------- -// -void CAdvancedFindResultWindow::HandleErrorL( TInt aError ) - { - iCommonUI.GetUpnpAction( iAction ); - //if media server or WLAN lost, close the browse dialog - if( ( KErrSessionClosed == aError && iMSDisappear )|| - KErrDisconnected == aError || - EAknCmdExit == aError || - EEikCmdExit == aError ) - { - if( iChildDialogOpen > 0 ) - { - //if some dialos are open on the top of browse dialog, - //close those dialogs and do the corresponding action via - //errors returned from them - iCommonUI.DismissDialogL( aError ); - } - else //if no, do the corresponding action via the error - { - TryExitL( aError ); - } - } - else - { - // if media renderer disappears - if( KErrSessionClosed == aError && !iMSDisappear ) - { - StopImageControlL(); - } - - iCommonUI.HandleCommonErrorL( aError, iCopyIndex ); - iAction = CUPnPCommonUI::EUPnPNone; - iCopyIndex = NULL; - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::UpdateSoftkeysL -// Update CBA-keys -// -------------------------------------------------------------------------- - -void CAdvancedFindResultWindow::UpdateSoftkeysL( TInt aResourceId ) - { - __LOG( "CAdvancedFindResultWindow::UpdateSoftkeysL" ); - CEikButtonGroupContainer* cba = &ButtonGroupContainer(); - cba->SetCommandSetL( aResourceId ); - cba->DrawDeferred(); - __LOG( "CAdvancedFindResultWindow::UpdateSoftkeysL-END" ); - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::IsAudioItemMarked -// -------------------------------------------------------------------------- -TBool CAdvancedFindResultWindow::IsAudioItemMarked( void ) - { - TBool mark = EFalse; - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) //if items are marked - { - for (TInt count=0; count < indexes->Count(); count++) - { - if ( ( iResultArray[indexes->At(count)])-> - ObjectClass().Find( KClassAudio ) - == 0 ) //audio - { - mark = ETrue; - count = indexes->Count(); - } - } - } - __LOG( "CAdvancedFindResultWindow::IsAudioItemMarked-END" ); - return mark; - - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::UpdateCommandButtonAreaL( -// TBool aMark, TInt tempCounter ) -// Updates command button area -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::UpdateCommandButtonAreaL( TBool aMark, - TInt aTempCounter ) - { - if( aTempCounter>=0 && iResultArray.Count() ) - { - if( !aMark ) // no marked items in the list box - { - if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassImage ) ) || - ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassVideo ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW ); - } - else if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassAudio ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY ); - } - else if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassContainer ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN ); - } - else - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - } - else // at least one marked item in the list box - { - if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassContainer ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN ); - } - else if( !IsAudioItemMarked() ) - { - //if no audio item have been marked. - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - else - { - if( !( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassAudio ) ) ) - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - else - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY ); - } - } - } - } - } - -// -------------------------------------------------------------------------- -// CAdvancedFindResultWindow::UpdateCommandButtonArea( -// TBool aMark, TInt tempCounter ) -// Updates command button area -// -------------------------------------------------------------------------- -void CAdvancedFindResultWindow::UpdateCommandButtonArea( TBool aMark, - TInt aTempCounter ) - { - TInt error = KErrNone; - TRAP( error, UpdateCommandButtonAreaL( aMark, aTempCounter ) ); - if( error ) - { - __LOG1( "UpdateCommandButtonAreaL error,error=%d", error ); - } - } -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpbrowsecacheitem.cpp --- a/upnpframework/upnpcommonui/src/upnpbrowsecacheitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Source file for UPnP Browse cache item implementation -* -*/ - - -// INCLUDES -#include -#include "upnpbrowsecacheitem.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::CUPnPBrowseCacheItem -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPBrowseCacheItem::CUPnPBrowseCacheItem() - { - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -void CUPnPBrowseCacheItem::ConstructL( const TDesC8& aContainer, - TInt aHighLightedItem, - TInt aFirstItem ) - { - iContainerData = aContainer.AllocL(); - iFirstItem = aFirstItem; - iHighLightedItem = aHighLightedItem; - iItemArray.ResetAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -EXPORT_C CUPnPBrowseCacheItem* CUPnPBrowseCacheItem::NewL( - const TDesC8& aContainer, - TInt aHighLightedItem, - TInt aFirstItem ) - { - CUPnPBrowseCacheItem* self = new( ELeave ) CUPnPBrowseCacheItem; - - CleanupStack::PushL( self ); - self->ConstructL( aContainer, aHighLightedItem, aFirstItem ); - CleanupStack::Pop(); - return self; - } - -// Destructor -CUPnPBrowseCacheItem::~CUPnPBrowseCacheItem() - { - if ( iItemArray.Count() > 0 ) - { - iItemArray.ResetAndDestroy(); - } - iItemArray.Close(); - delete iContainerData; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::ContainerId -// -------------------------------------------------------------------------- -EXPORT_C const HBufC8& CUPnPBrowseCacheItem::ContainerId() const - { - return *iContainerData; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::SetItemArrayL -// -------------------------------------------------------------------------- -EXPORT_C void CUPnPBrowseCacheItem::SetItemArrayL( - const RPointerArray& aBrowseArray ) - { - iItemArray.ResetAndDestroy(); - for ( TInt index=0; index < aBrowseArray.Count(); index++ ) - { - iItemArray.AppendL( aBrowseArray[ index ] ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::SetFirstItem -// -------------------------------------------------------------------------- -EXPORT_C void CUPnPBrowseCacheItem::SetFirstItem( const TInt aFirstItem ) - { - iFirstItem = aFirstItem; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::SetTotalCount -// -------------------------------------------------------------------------- -void CUPnPBrowseCacheItem::SetTotalCount( const TInt aTotalCount ) - { - iTotalCount = aTotalCount; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::SetHighLightedItem -// -------------------------------------------------------------------------- -EXPORT_C void CUPnPBrowseCacheItem::SetHighLightedItem( - const TInt aHighLightedItem ) - { - iHighLightedItem = aHighLightedItem; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::GetItem -// -------------------------------------------------------------------------- -EXPORT_C const CUpnpObject* CUPnPBrowseCacheItem::GetItem( - const TInt aItemToGet ) - { - return iItemArray[ aItemToGet ]; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::GetNumberOfItems -// -------------------------------------------------------------------------- -EXPORT_C TInt CUPnPBrowseCacheItem::GetNumberOfItems() const - { - return iItemArray.Count(); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::GetTotalCount -// -------------------------------------------------------------------------- -TInt CUPnPBrowseCacheItem::GetTotalCount() const - { - return iTotalCount; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::GetUpperMostItem -// -------------------------------------------------------------------------- -EXPORT_C TInt CUPnPBrowseCacheItem::GetUpperMostItem() const - { - return iFirstItem; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseCacheItem::GetHighlightedItem -// -------------------------------------------------------------------------- -EXPORT_C TInt CUPnPBrowseCacheItem::GetHighlightedItem() const - { - return iHighLightedItem; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpbrowsedialog.cpp --- a/upnpframework/upnpcommonui/src/upnpbrowsedialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3069 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Source file for UPnP Browse UI Implementation -* -*/ - - -// INCLUDE FILES -// System -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// upnp stack api's -#include -#include - -// upnpframework / avcontroller api -#include "upnpavcontroller.h" //start browse session and rendering session -#include "upnpavdevice.h" -#include "upnpavbrowsingsession.h" -#include "upnpavrenderingsession.h" - -// upnpframework / avcontroller helper api -#include "upnpconstantdefs.h" // upnp definitions - -// upnpframework / xml parser api -#include "upnpxmlparser.h" - -// upnpframework / utility class UPnPItemUtility -#include "upnpitemutility.h" - -// upnpframework / internal api's -#include "upnpfiletransferengine.h" -#include "upnpmusicadapter.h" -#include "upnpbrowseplaylistfiller.h" - -// common ui internal -#include "upnpcommonui.h" -#include -#include -#include "upnpcommonutils.h" - -#include "upnplocalplayer.h" -#include "upnpbrowsedialog.h" -#include "upnpcommonui.hrh" -#include "upnpbrowsecacheitem.h" -#include "upnpimageplayer.h" -#include "upnpperiodic.h" - -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - - -//CONSTANTS -_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" ); -_LIT( KFormatString, "%d\t%S\t\t" ); -_LIT( KFormatString2, "%d\t%S\t\t%d" ); -_LIT( KUPNP_HLP_REMOTE_DEVICES, "UPNP_HLP_REMOTE_DEVICES" ); -_LIT( KUPNP_HLP_CONTENT_VIEW, "UPNP_HLP_CONTENT_VIEW" ); - -const TInt KBrowseBack = -1; -const TInt KBrowseRoot = -2; -const TInt KBrowseForward = -3; -const TInt KBrowseRequestCount = 20; -const TInt KWindowBrowseTricker = 3; - -const TInt KImageTimerDelay = 800000; -const TInt KImageTimerInterval = 800000; - -const TInt KLength = 100; - -// CONSTANTS -enum TUPnPIconTypes - { - EUPnPIconFolder = 1, - //EUPnPIconFolderLocked, - EUPnPIconMusic, - EUPnPIconVideo, - EUPnPIconImage, - EUPnPIconImageShowing, - EUPnPIconOther, - EUPnPIconLast - }; -enum TUPnPBrowseDirection - { - EBackward= 1, - EForward - }; - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -CUPnPBrowseDialog* CUPnPBrowseDialog::NewL( TInt aMenuResource, - MUPnPAVController& aAVControl, - const CUpnpAVDevice& aDevice, - CUPnPCommonUI& aCommonUI) - { - __LOG( "CUPnPBrowseDialog::NewL" ); - - CUPnPBrowseDialog* self = new (ELeave) CUPnPBrowseDialog( - aAVControl, aCommonUI, aDevice ); - CleanupStack::PushL( self ); - self->ConstructL( aMenuResource ); - - CleanupStack::Pop( self ); - - __LOG( "CUPnPBrowseDialog::NewL-END" ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::ConstructL( TInt aMenuResource ) - - { - // Register as an observer to file operations (browse results) - - __LOG( "CUPnPBrowseDialog::ConstructL" ); - - iBrowseSession = &iAVControl.StartBrowsingSessionL( iSourceDevice ); - iBrowseSession->SetObserver( *this ); - - iFirstResultArray = ETrue; - CAknDialog::ConstructL( aMenuResource ); - - iTargetDevice = CUpnpAVDevice::NewL(); - iImageControlTimer = CUPnPPeriodic::NewL( CActive::EPriorityUserInput ); - - iError = KErrNone; - iDlgPreLayoutDone = EFalse; - iErrorForCancel = KErrNone; - __LOG( "CUPnPBrowseDialog::ConstructL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::CUPnPBrowseDialog -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -CUPnPBrowseDialog::CUPnPBrowseDialog( MUPnPAVController& aAVControl, - CUPnPCommonUI& aCommonUI, - const CUpnpAVDevice& aDevice ): - iCommonUI( aCommonUI ), - iAVControl( aAVControl ), - iSourceDevice(aDevice) - { - __LOG( "CUPnPBrowseDialog::CUPnPBrowseDialog" ); - - iBrowseRequestSent = EFalse; - iChildDialogOpen = 0; - iLastImageItemIndex = KErrNotFound; - iMSDisappear = EFalse; - iAction = CUPnPCommonUI::EUPnPNone; - iCopyIndex = NULL; - iRoot = ETrue; - - iIsMusicItem = EFalse; - iHashKeyFlag = EFalse; - __LOG( "CUPnPBrowseDialog::CUPnPBrowseDialog-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::~CUPnPBrowseDialog -// C++ default destructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -CUPnPBrowseDialog::~CUPnPBrowseDialog() - { - __LOG( "CUPnPBrowseDialog::~CUPnPBrowseDialog" ); - // Unregister as an observer to file operations (browse results) - TRAPD( err, DismissWaitNoteL() ); - if ( err != KErrNone ) - { - __LOG( "CUPnPBrowseDialog::~CUPnPBrowseDialog \ - delete WaitNote error" ); - } - - if ( iCurrentFolderId && !iBrowseRequestSent ) - { - TRAP_IGNORE( CacheItemUpdateL( *iCurrentFolderId, EFalse ) ); - } - - delete iCurrentFolderId; - - delete iTargetDevice; - delete iImagePlayer; - iParentId.ResetAndDestroy(); - iParentName.ResetAndDestroy(); - iResultArray.Close(); - iBrowseCacheItems.ResetAndDestroy(); - iTempArray.Close(); - if ( iNaviPane && iNaviDecorator ) - { - iNaviPane->Pop( iNaviDecorator ); - } - - delete iNaviDecorator; - - iSelectedItemsArray.ResetAndDestroy(); - - if ( iImageControlTimer ) - { - iImageControlTimer->Cancel(); - delete iImageControlTimer; - } - - delete iLocalPlayer; - - if( iBrowseSession ) - { - iBrowseSession->CancelBrowse(); - iBrowseSession->RemoveObserver(); - iAVControl.StopBrowsingSession( *iBrowseSession ); - } - - __LOG( "CUPnPBrowseDialog::~CUPnPBrowseDialog-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DialogDismissedL(); -// MProgressDialogCallback, progressbar callback function -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::DialogDismissedL( TInt aButtonId ) - { - __LOG( "CUPnPBrowseDialog::DialogDismissedL" ); - // If button is cancel, inform observer parent class - // that cancel has been made - if( aButtonId == EEikBidCancel ) - { - __LOG( "CUPnPBrowseDialog::DialogDismissedL: \ - Cancel was pressed."); - iAction = CUPnPCommonUI::EUPnPNone; - iBrowseSession->CancelBrowse(); - iBrowseRequestSent = EFalse; - - TInt cachedItemIndex = CacheCheck( *iCurrentFolderId ); - - if ( cachedItemIndex > -1 ) - { - delete iBrowseCacheItems[ cachedItemIndex ]; - iBrowseCacheItems[ cachedItemIndex ] = NULL; - iBrowseCacheItems.Remove( cachedItemIndex ); - iBrowseCacheItems.Compress(); - } - // If button is cancel, - // the browse dialog should not been displayed,leave it in the - // function of PreLayoutDynInitL. - iErrorForCancel = EEikBidCancel; - } - __LOG( "CUPnPBrowseDialog::DialogDismissedL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::PreLayoutDynInitL(); -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::PreLayoutDynInitL() - { - __LOG( "CUPnPBrowseDialog::PreLayoutDynInitL" ); - - // Browse dialog title text - TUid titlePaneUid; - titlePaneUid.iUid = EEikStatusPaneUidTitle; - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - CEikStatusPaneBase::TPaneCapabilities titlesubPane = - statusPane->PaneCapabilities( titlePaneUid ); - - if ( titlesubPane.IsPresent() && titlesubPane.IsAppOwned() ) - { - iTitlePane = (CAknTitlePane*) statusPane->ControlL( titlePaneUid ); - - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - iSourceDevice.FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - HBufC *tmpbuf = UpnpString::ToUnicodeL( - friendlyname.Left( KLength ) ); - CleanupStack::PushL( tmpbuf ); - iTitlePane->SetTextL( *tmpbuf ); - - CleanupStack::PopAndDestroy( tmpbuf ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - } - - iListBox = static_cast( - Control( EUPnPBrowseListBoxId ) ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - CAknIconArray* icons = new ( ELeave ) CAknIconArray( EUPnPIconLast ); - CleanupStack::PushL( icons ); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - TFileName mbmFileName( KAknCommonUIMbmFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - mbmFileName.Insert( 0, drive ); - - AppendIconToArrayL( icons, - skin, - KAvkonBitmapFile, - KAknsIIDQgnIndiMarkedAdd, - EMbmAvkonQgn_indi_marked_add, - EMbmAvkonQgn_indi_marked_add_mask ); - - // Folder icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDQgnPropFolderSmall, - EMbmUpnpcommonuiQgn_prop_mserv_folder_small, - EMbmUpnpcommonuiQgn_prop_mserv_folder_small_mask ); - - - // Music icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_prop_mserv_music, - EMbmUpnpcommonuiQgn_prop_mserv_music_mask ); - - // Video icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_prop_mserv_other_videos, - EMbmUpnpcommonuiQgn_prop_mserv_other_videos_mask ); - - // Image icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_prop_mserv_other_images, - EMbmUpnpcommonuiQgn_prop_mserv_other_images_mask ); - - //Image showing icon - AppendIconToArrayL( icons, - skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon, - EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_list_icon_mask ); - - - // Other icon - AppendIconToArrayL( icons, - skin, - KCommonDialogsBitmapFile, - KAknsIIDQgnPropFmgrFileSound, - EMbmCommondialogsQgn_prop_fmgr_file_other, - EMbmCommondialogsQgn_prop_fmgr_file_other_mask ); - - iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); - - CleanupStack::Pop(icons); - - // Hide "No data" text - iListBox->View()->SetListEmptyTextL( KNullDesC() ); - - // Send browse request - SendBrowseRequestL( KBrowseRoot ); - - iDlgPreLayoutDone = ETrue; - - if( iError < KErrNone ) - { - __LOG1( "CUPnPBrowseDialog::PreLayoutDynInitL leave %d", iError ); - User::Leave( iError ); - } - - if( iErrorForCancel == EEikBidCancel ) - { - User::Leave( EEikBidCancel ); - } - __LOG( "CUPnPBrowseDialog::PreLayoutDynInitL-END" ); - - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::OkToExitL( TInt aButtonId ) -// called by framework when the softkey is pressed -// -------------------------------------------------------------------------- -TBool CUPnPBrowseDialog::OkToExitL( TInt aButtonId ) - { - __LOG( "CUPnPBrowseDialog::OkToExitL" ); - - TBool returnValue = EFalse; - TInt error = KErrNone; - switch (aButtonId ) - { - // Connection failed. Dialog must be closed - case KErrDisconnected: - case KErrSessionClosed: //fall through - { - // exit only if PreLayoutDynInitL is done - if( iDlgPreLayoutDone ) - { - return ETrue; - } - else - { - return EFalse; - } - } - case EAknSoftkeyOptions: - { - SelectedArrayCheckL(); - DisplayMenuL(); - break; - } - case EUPnPStopCmd: - { - StopImageControlL(); - break; - } - case EAknSoftkeyBack: - { - // Check if we are in the root - if ( !iParentId.Count() ) - { - ClearTitleL(); - return ETrue; - } - else - { - if ( iBrowseRequestSent ) - { - iBrowseSession->CancelBrowse(); - iBrowseRequestSent = EFalse; - } - - iListBox->ClearSelection(); - iSelectedItemsArray.ResetAndDestroy(); - SendBrowseRequestL( KBrowseBack ); - } - - break; - } - case EUPnPPlayCmd: //for lsk only, play on external renderer - { - if( !iMusicPlay ) - { - StopImageControlL(); - TRAP( error, PlayL( EFalse ) ); - if( KErrNone != error ) - { - iMusicPlay = EFalse; - } - } - - break; - } - case EAknSoftkeyOpen: //fall thougth - case EAknSoftkeyOk: - { - // Shift and Ok pressed so the external device dialog must not be - // opened - if ( iShiftAndOkPressed ) - { - iShiftAndOkPressed = EFalse; - return EFalse; - } - if ( !iResultArray.Count() || iImageControlActive ) - { - return EFalse; // Do nothing if empty - } - else if ( iResultArray[iListBox->CurrentItemIndex()]-> - ObjectType() == EUPnPContainer ) - { - if ( !iBrowseRequestSent ) - { - iListBox->ClearSelection(); - iSelectedItemsArray.ResetAndDestroy(); - SendBrowseRequestL( iListBox->CurrentItemIndex() ); - } - } - else - { - // Play or Show on external device - // Select device according to the media type - TRAP( error, ShowPlayExtL() ); - - /* if something happens, set iMusicPlay = EFalse, - * no matter what kinda of media file playing - * before - */ - - if( KErrNone != error ) - { - iMusicPlay = EFalse; - } - } - break; - } - case EAknSoftkeyShow: - { - StopImageControlL(); - TRAP( error, ShowVideoDialogExtL() ); - break; - } - case EAknSoftkeyCancel: - case EAknSoftkeyExit: - case EAknCmdExit: - case EEikCmdExit: //fall through - { - ClearTitleL(); - return ETrue; //back to previous dialog - } - default: - { - break; - } - }//switch - - HandleErrorL( error ); - __LOG( "CUPnPBrowseDialog::OkToExitL End" ); - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::OfferKeyEventL(); -// called by framework when key is pressed -// -------------------------------------------------------------------------- -TKeyResponse CUPnPBrowseDialog::OfferKeyEventL( - const TKeyEvent &aKeyEvent, - TEventCode aType ) - { - __LOG( "CUPnPBrowseDialog::OfferKeyEventL" ); - TInt currentItemIndex = iListBox->CurrentItemIndex(); - TInt tempCounter = currentItemIndex; - // Shift and Ok pressed at same time so the event must consumed - if ( ( aKeyEvent.iModifiers & EModifierShift ) != 0 && - aType == EEventKeyDown && ( aKeyEvent.iScanCode == EStdKeyDevice3 ) ) - { - iShiftAndOkPressed = ETrue; - return EKeyWasConsumed; - } - if ( aType != EEventKey ) - { - if ( aKeyEvent.iScanCode == EStdKeyHash ) - { - if ( aType == EEventKeyDown ) - { - iHashKeyFlag = ETrue; - } - else - { - iHashKeyFlag = EFalse; - } - } - CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - if ( aType == EEventKeyUp && !iHashKeyFlag ) - { - if ( ( tempCounter < iResultArray.Count() ) && tempCounter > -1 ) - { - - if ( !iImageControlActive ) - { - const CArrayFix* indexes = - iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - UpdateCommandButtonAreaL( ETrue, tempCounter ); - } - else - { - UpdateCommandButtonAreaL( EFalse, tempCounter ); - } - } - - } - } - return EKeyWasConsumed; - } - - // Shift (pen) key cannot be used marking folders - if ( currentItemIndex < 0 ) - { - currentItemIndex = 0; - } - - - if ( ( aKeyEvent.iCode == EKeyUpArrow ) && - ( currentItemIndex == 0 ) ) - { - return EKeyWasConsumed; - } - - CTextListBoxModel* model = iListBox->Model(); - TInt numberOfItems = model->NumberOfItems(); - - if ( iAllObjectsReceived && ( currentItemIndex == numberOfItems-1 ) - && aKeyEvent.iCode == EKeyDownArrow ) - { - return EKeyWasConsumed; - } - - // If selection is approaching the end of the list - if ( ( aKeyEvent.iCode == EKeyDownArrow ) && ( !iRoot ) && - ( ( currentItemIndex + KWindowBrowseTricker ) >= numberOfItems ) && - ( iUppermostItem + numberOfItems < iTotalCount ) && - ( !iAllObjectsReceived ) && - ( !iBrowseRequestSent ) ) - { - TInt startIndex = iUppermostItem + numberOfItems; - iAction = CUPnPCommonUI::EUPnPBrowse; - iOriginalBrowseRequest = ETrue; - iBrowseSession->BrowseL( *iCurrentFolderId, - KFilterCommon, /* filter */ - MUPnPAVBrowsingSession::EDirectChildren, - startIndex, /* start index */ - KBrowseRequestCount, /* request count */ - KSortNone ); /* sort criteria */ - iBrowseRequestSent = ETrue; - iCurrentItem = currentItemIndex; - iBrowseDirection = EForward; - } - if ( ( aKeyEvent.iCode == EKeyUpArrow ) && ( !iRoot ) && - ( ( (currentItemIndex - KWindowBrowseTricker ) <= 0 ) ) && - ( !iBrowseRequestSent ) && ( iUppermostItem > 0 ) ) - { - TInt requestCount = KBrowseRequestCount; - TInt startIndex = KErrNotFound; - - // To keep order of items of listbox don't change. - if ( iNeedRepeatRequest ) - { - startIndex = iUppermostItem - iServerReturnObjectCount; - requestCount = iServerReturnObjectCount; - if ( startIndex < 0 ) - { - startIndex = 0; - } - } - else - { - startIndex = iUppermostItem - KBrowseRequestCount; - if ( startIndex < 0 ) - { - requestCount = iUppermostItem; - startIndex = 0; - } - } - iAction = CUPnPCommonUI::EUPnPBrowse; - iOriginalBrowseRequest = ETrue; - iBrowseSession->BrowseL( *iCurrentFolderId, - KFilterCommon, /* filter */ - MUPnPAVBrowsingSession::EDirectChildren, - startIndex, /* start index */ - requestCount, /* request count */ - KSortNone ); /* sort criteria */ - - iBrowseRequestSent = ETrue; - iCurrentItem = currentItemIndex; - iBrowseDirection = EBackward; - - if ( iAllObjectsReceived ) - { - iAllObjectsReceived = EFalse; - } - - } - - // it is checked that currentItemIndex is valid - iCurrentItem = currentItemIndex; - - if ( ( aKeyEvent.iCode == EKeyDownArrow) && - ( currentItemIndex + 1) == numberOfItems ) - { - return EKeyWasConsumed; - } - - else if ( ( aKeyEvent.iCode == EKeyUpArrow) && - ( currentItemIndex == 0 ) && - ( iBrowseRequestSent ) ) - { - return EKeyWasConsumed; - } - else if ( aKeyEvent.iCode == EKeyDownArrow ) - { - if ( ( numberOfItems - 1 ) > iCurrentItem ) - { - iCurrentItem++; - } - else - { - iCurrentItem = 0; - } - } - else if ( aKeyEvent.iCode == EKeyUpArrow ) - { - //if already if first item, should then go to the last one. - if ( iCurrentItem > 0 ) - { - iCurrentItem--; - } - } - - if ( aKeyEvent.iCode == EKeyDownArrow || - aKeyEvent.iCode == EKeyUpArrow ) - { - if ( iImageControlActive ) - { - iImageControlTimer->Cancel(); - StartImageControlTimer(); - } - if ( aKeyEvent.iCode == EKeyDownArrow ) - { - tempCounter++; - } - else - { - tempCounter--; - } - if ( ( tempCounter < iResultArray.Count() ) && tempCounter > -1 ) - { - if( iImageControlActive ) - { - // image or container - if ( ( iResultArray[tempCounter] )->ObjectClass() - .Find( KClassImage ) == 0 || - ( iResultArray[tempCounter] )->ObjectClass() - .Find( KClassContainer ) == 0 ) - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP ); - } - else if ( ( iResultArray[tempCounter] )->ObjectClass() - .Find( KClassVideo ) == 0 ) //video - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_SHOW_STOP ); - } - else if ( ( iResultArray[tempCounter] )->ObjectClass() - .Find( KClassAudio ) == 0 ) //music - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_PLAY_STOP ); - } - else - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP ); - } - } - } - } - - if ( ( currentItemIndex >= 0 ) && - ( currentItemIndex < iListBox->Model()->NumberOfItems() ) ) - { - if ( ( ( iResultArray[currentItemIndex])->ObjectType() - != EUPnPContainer) || - !( aKeyEvent.iModifiers & EModifierShift ) ) - { - if( aKeyEvent.iCode == EKeyEscape ) - { - __LOG( "OfferKeyEventL EKeyEscape" ); - if( !iCopying ) - { - CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - } - else - { - __LOG( "Copying ongoing, app should be closed" ); - iApplicationClose = ETrue; - __LOG( "Copying ongoing, app should be closed-end" ); - } - __LOG( "OfferKeyEventL EKeyEscape -end" ); - } - else - { - CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - } - } - } - - // no items in list, all events can be handled by system - else if ( iListBox->Model()->NumberOfItems() == 0) - { - CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - } - - - __LOG( "CUPnPBrowseDialog::OfferKeyEventL End" ); - return EKeyWasConsumed; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::ProcessCommandL( TInt aCommand ) -// called by framework when menu item is selected -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::ProcessCommandL( TInt aCommand ) - { - __LOG( "CUPnPBrowseDialog::ProcessCommandL" ); - - TInt error = KErrNone; - TInt selected_item = iListBox->CurrentItemIndex(); - if ( selected_item < 0 ) - { - selected_item = 0; - } - - // Menu commands control - HideMenu(); - switch ( aCommand ) - { - case EAknCmdExit: - case EEikCmdExit:// fall through - { - TryExitL( aCommand ); - return; - } - case EUPnPOpen: - { - if ( iResultArray[selected_item]->ObjectType() == EUPnPContainer) - { - iListBox->ClearSelection(); - iSelectedItemsArray.ResetAndDestroy(); - SendBrowseRequestL( selected_item ); - } - break; - } - case EUPnPFind: - { - if ( iNaviDecorator ) - { - iNaviPane->Pop( iNaviDecorator ); - delete iNaviDecorator; - iNaviDecorator = NULL; - } - // cancel idle timer because player uses own timer - error = iCommonUI.ExecuteAdvFindDialogL( iAVControl, - *iBrowseSession ); - - //only MS or WLAN lost can make advfind dlg exit - if( KErrSessionClosed == error ) - { - iMSDisappear = ETrue; - } - - //if not media server or wlan lost, update its navipane - if( !iMSDisappear && error != KErrDisconnected ) - { - UpdateNaviPaneTextL(); - } - - break; - } - case EUPnPHelp: - { - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() ); - break; - } - case EUPnPPlayExt: - case EUPnPShowExt: //fall through - { - TRAP( error, ShowPlayExtL() ); - if( KErrNone != error ) - { - iMusicPlay = EFalse; - } - break; - } - case EUPnPShowLocal: //show image & video on local - { - if( !iLocalPlayer ) - { - iLocalPlayer = CUPnPLocalPlayer::NewL( iAVControl, - *iBrowseSession, - iCommonUI ); - } - const CUpnpObject* item = - iResultArray[ iListBox->CurrentItemIndex() ]; - - iAction = CUPnPCommonUI::EUPnPShow; - TRAP( error, iLocalPlayer->PlayL( *item ) ); - if( KErrSessionClosed == error ) - { - iMSDisappear = ETrue; - } - break; - } - case EUPnPPlayLocal: //play music on local - { - if( ( iResultArray[ iListBox->CurrentItemIndex() ] - ->ObjectClass().Find( KClassAudio ) == 0 || - iIsMusicItem ) && !iMusicPlay ) - { - TRAP( error, PlayL( ETrue ) ); - if( KErrNone != error ) - { - iMusicPlay = EFalse; - } - } - break; - } - case EUPnPCopy: - { - TRAP( error, HandleCopyL() ); - iCopying = EFalse; - __LOG1( "HandleCopyL is finished: %d", error ); - if( iApplicationClose ) - { - __LOG( "copying is onging, exit" ); - TryExitL( EAknCmdExit ); - return; - } - - //During copying, sometimes we get the httperr, - //but doesn't handle it, at here I transfer the httperr - //to symbian error. - if ( KErrHttpPartialResponseReceived == error || - KErrHttpRequestNotSent == error || - KErrHttpResponseNotReceived == error ) - { - error = KErrSessionClosed; - } - - __LOG1( "CUPnPBrowseDialog::HandleCopyL: %d", error ); - - if( KErrSessionClosed == error ) //if server lost - { - iMSDisappear = ETrue; - } - else if( KErrNotFound == error ) - { - if( iResultArray[iListBox->CurrentItemIndex()]-> - ObjectType() == EUPnPContainer ) - { - if( iCopyIndex > 0 ) //if the container is not empty - { - iCommonUI.DisplayErrorTextL( - R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT ); - iAction = CUPnPCommonUI::EUPnPNone; - } - else //if the container is empty - { - iCopyIndex = ETrue; - } - - } - else - { - iCopyIndex = EFalse; - } - } - break; - } - case EAknCmdMark: - { - MarkItemL( iListBox->CurrentItemIndex() ); - break; - } - case EAknMarkAll: - { - MarkAllItemsL(); - break; - } - case EAknCmdUnmark: - { - UnmarkItem( iListBox->CurrentItemIndex() ); - break; - } - case EAknUnmarkAll: - { - UnmarkAllItems(); - break; - } - default: - { - CAknDialog::ProcessCommandL( aCommand ); - break; - } - } - - HandleErrorL( error ); - __LOG( "CUPnPBrowseDialog::ProcessCommandL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane -// *aMenuPane) -// called by framework before menu panel is shown -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane *aMenuPane ) - { - __LOG( "CUPnPBrowseDialog::DynInitMenuPaneL" ); - - TVolumeInfo info; - - TInt selected_item = iListBox->CurrentItemIndex(); - - if ( aResourceId == R_UPNPCOMMONUI_BROWSE_OPTION_MENU ) - { - iIsMusicItem = EFalse; - if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - aMenuPane->SetItemDimmed( EUPnPHelp, ETrue ); - } - - if ( !iSourceDevice.SearchCapability() ) - { - aMenuPane->SetItemDimmed( EUPnPFind, ETrue ); - } - if ( iResultArray.Count() == 0 ) - { - aMenuPane->SetItemDimmed( EUPnPOpen, ETrue ); - aMenuPane->SetItemDimmed( EUPnPFind, ETrue ); - aMenuPane->SetItemDimmed( EUPnPCopy, ETrue ); - aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue ); - aMenuPane->SetItemDimmed( EUPnPShow, ETrue ); - aMenuPane->SetItemDimmed( EUPnPPlay, ETrue ); - } - // Something marked - else if( iSelectedItemsArray.Count() ) - { - // Only one video or image be able to show on external device - for ( TInt count = 0; - count < iSelectedItemsArray.Count(); - count++) - { - if ( ( iSelectedItemsArray[ count ] )-> - ObjectClass().Find( KClassAudio ) == 0 ) - { - //if marked items have at least one audio item - iIsMusicItem = ETrue; - count = iSelectedItemsArray.Count(); - } - else - { - iIsMusicItem = EFalse; - } - } - - aMenuPane->SetItemDimmed( EUPnPShow, ETrue ); - if ( UPnPItemUtility::BelongsToClass( - *iResultArray[selected_item], KClassAudio ) - && IsAudioItemMarked() ) - { - aMenuPane->SetItemDimmed( EUPnPPlay, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EUPnPPlay, ETrue ); - } - - // we must enable unmark all - aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse ); - - //only items are marked, disable EUPnPOpen - aMenuPane->SetItemDimmed( EUPnPOpen, ETrue ); - - } - else if( selected_item >= 0 ) //if no marked items - { - // Focus on a container - if ( iResultArray[ selected_item ]-> - ObjectType() == EUPnPContainer ) - { - aMenuPane->SetItemDimmed( EUPnPShow, ETrue ); - aMenuPane->SetItemDimmed( EUPnPPlay, ETrue ); - if ( iResultArray[ selected_item ]->ObjectClass() - .Find( KClassPlaylist ) == 0 ) - { - //aMenuPane->SetItemDimmed(EUPnPPlay, ETrue); - } - - aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue ); - } - else //if hightlighted item - { - // show edit list menu - aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse ); - aMenuPane->SetItemDimmed( EUPnPOpen, ETrue ); - if( ( iResultArray[ selected_item ] )-> - ObjectClass().Find( KClassAudio ) == 0 ) - { - aMenuPane->SetItemDimmed( EUPnPShow, ETrue ); - aMenuPane->SetItemDimmed( EUPnPPlay, EFalse ); - } - else if( ( ( iResultArray[ selected_item ] )->ObjectClass() - .Find( KClassImage ) == 0 - || ( iResultArray[ selected_item ])->ObjectClass() - .Find( KClassVideo ) == 0 ) - && !iSelectedItemsArray.Count() ) - { - if( iIsMusicItem ) - { - aMenuPane->SetItemDimmed( EUPnPPlay, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EUPnPPlay, ETrue ); - } - aMenuPane->SetItemDimmed( EUPnPShow, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EUPnPShow, ETrue ); - if( iIsMusicItem ) - { - aMenuPane->SetItemDimmed( EUPnPPlay, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EUPnPPlay, ETrue ); - } - } - } - } - - } - else if ( aResourceId == - R_UPNPCOMMONUI_MENUPANE_MARKABLE_LIST_IMPLEMENTATION ) - { - TBool markHidden = iListBox->View()->ItemIsSelected( selected_item ); - TBool unmarkHidden = !iListBox->View()-> - ItemIsSelected( selected_item ); - TBool markAllHidden = iListBox->Model()->NumberOfItems() == 0 || - iListBox->SelectionIndexes()->Count() == - iListBox->Model()->NumberOfItems(); - TBool unmarkAllHidden = iListBox->Model()->NumberOfItems() == 0 || - iSelectedItemsArray.Count() == 0; - - if ( iResultArray[ selected_item ]->ObjectType() == EUPnPContainer ) - { - aMenuPane->SetItemDimmed( EAknCmdMark, ETrue ); - aMenuPane->SetItemDimmed( EAknCmdUnmark, ETrue ); - aMenuPane->SetItemDimmed( EAknMarkAll, ETrue ); - } - else - { - aMenuPane->SetItemDimmed( EAknCmdMark, markHidden ); - aMenuPane->SetItemDimmed( EAknCmdUnmark, unmarkHidden ); - aMenuPane->SetItemDimmed( EAknMarkAll, markAllHidden ); - aMenuPane->SetItemDimmed( EAknUnmarkAll, unmarkAllHidden ); - } - } - CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane ); - __LOG( "CUPnPBrowseDialog::DynInitMenuPaneL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DeleteListItemsL -// Delete old items from browse list. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::DeleteListItemsL() - { - __LOG ( "CUPnPBrowseDialog::DeleteListItemsL" ); - - CTextListBoxModel* model = iListBox->Model(); - TInt currentItem = iListBox->CurrentItemIndex(); - if ( currentItem < 0 ) - { - currentItem = 0; - } - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - listBoxItems->Delete( 0,listBoxItems->Count() ); - AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( iListBox, - currentItem, - ETrue ); - __LOG ( "CUPnPBrowseDialog::DeleteListItemsL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::LoadListItemsL -// Loads browse result set to the screen -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::LoadListItemsL() - { - __LOG( "CUPnPBrowseDialog::LoadListItemsL" ); - - CTextListBoxModel* model = iListBox->Model(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - - TBuf item; - - if( !iResultArray.Count() ) - { - iListBox->View()->SetListEmptyTextL( - *StringLoader::LoadLC( R_UPNPCOMMONUI_EXTERNAL_EMPTY_FOLDER ) ); - CleanupStack::PopAndDestroy(); - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - else - { - for (TInt i=0; i < iResultArray.Count(); i++) - { - // Get title and replace illegal characters. - HBufC8* tmptitle = - UPnPCommonUtils::FixListboxItemTextL( - iResultArray[i]->Title().Left( KLength ) ); - CleanupStack::PushL( tmptitle ); - - TPtrC8 tmpnameptr = *tmptitle; - iResultArray[i]->SetTitleL( tmpnameptr ); - - HBufC *tmpItem = UpnpString::ToUnicodeL( - tmpnameptr.Left( KLength ) ); - CleanupStack::PushL( tmpItem ); - - if ( iResultArray[ i ]->ObjectType() == EUPnPContainer ) - { - item.Format( KFormatString(), EUPnPIconFolder, tmpItem ); - } - else - { - if ( (iResultArray[ i ] )->ObjectClass() - .Find( KClassAudio ) == 0 ) - { - item.Format( KFormatString(), EUPnPIconMusic, - tmpItem ); - } - else if ( ( iResultArray[ i ] )->ObjectClass() - .Find( KClassVideo ) == 0 ) - { - item.Format( KFormatString(), EUPnPIconVideo, - tmpItem ); - } - else if ( ( iResultArray[ i ] )->ObjectClass() - .Find( KClassImage ) == 0 ) - { - item.Format( KFormatString(), EUPnPIconImage, - tmpItem ); - } - else - { - item.Format( KFormatString(), EUPnPIconOther, - tmpItem ); - } - } - CleanupStack::PopAndDestroy ( tmpItem ); - CleanupStack::PopAndDestroy ( tmptitle ); - listBoxItems->AppendL( item ); - - if ( iSelectedItemsArray.Count() ) - { - for ( TInt index = 0; - index < iSelectedItemsArray.Count(); - index++ ) - { - for ( TInt i = 0; i < iResultArray.Count() ; i++ ) - { - if ( !( iResultArray[ i ])->Id().CompareC( - iSelectedItemsArray[ index ]->Id() ) ) - { - MarkItemL( i ); - i = iResultArray.Count(); - } - } - } - } - } //for - - iListBox->HandleItemAdditionL(); // Update listbox - // Ensure iCurrentItem isn't out of bounds - if ( iCurrentItem < 0 ) - { - iCurrentItem = 0; - } - if ( iCurrentItem >= model->NumberOfItems() ) - { - iCurrentItem = model->NumberOfItems() - 1; - } - - // select new item - iListBox->SetCurrentItemIndexAndDraw( iCurrentItem ); - if( !iImageControlActive ) - { - if( (iResultArray[iCurrentItem])-> - ObjectClass().Find( KClassImage ) == 0 || - (iResultArray[iCurrentItem])-> - ObjectClass().Find( KClassVideo ) == 0) - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW); - } - else if( ( iResultArray[iCurrentItem] )->ObjectClass() - .Find( KClassAudio ) == 0 ) - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY); - } - else if( ( iResultArray[iCurrentItem] )->ObjectClass() - .Find( KClassContainer ) == 0 ) - { - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN); - } - else - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - } - } - - - - __LOG( "CUPnPBrowseDialog::LoadListItemsL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::SendBrowseRequestL -// Sends the browse request to UPnP AV Controller. When result set arrives, -// UPnP AV Controller will call the "BrowseResponse" call back method, -// which is implemented below. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::SendBrowseRequestL( TInt aIndex ) - { - __LOG1( "CUPnPBrowseDialog::SendBrowseRequestL, index: %d", aIndex ); - iFirstResultArray = ETrue; - - iNeedRepeatRequest = EFalse; - iOriginalBrowseRequest = ETrue; - iServerReturnObjectCount = 0; - - iBrowseDirection = EForward; - - TInt cache = 0; - iDummyBrowseResponse = EFalse; - if( iBrowseSession ) - { - // If the given index is negative, get the root ("0") container - if( KBrowseRoot == aIndex ) - { - iUppermostItem = 0; - //Set browse flag for root browse - iBrowseFlag = KBrowseRoot; - - // Clear parent id table - iParentId.ResetAndDestroy(); - - // Clear temporary array for browse view - iTempArray.Reset(); - - // Clear previous browse view - - iCurrentFolderId = KContainerIdRoot().AllocL(); - - // Make the browse request - cache = CacheCheck( *iCurrentFolderId ); - if ( cache > 0 ) - { - //update current cache item - CacheItemUpdateL( *iCurrentFolderId, EFalse ); - } - else - { - //not founded in cache create new cache item - CacheItemUpdateL( *iCurrentFolderId, ETrue ); - } - - iAction = CUPnPCommonUI::EUPnPBrowse; - iBrowseSession->BrowseL( *iCurrentFolderId, - KFilterCommon, /* filter */ - MUPnPAVBrowsingSession::EDirectChildren, - 0, /* start index */ - KBrowseRequestCount,/* request count */ - KSortNone ); /* sort criteria */ - } - else if( KBrowseBack == aIndex ) // Back operation - { - if ( iParentId.Count() > 0 ) - { - // Set browse flag so that cleanup can be done in response - iBrowseFlag = KBrowseBack; - - TInt startIndex = - iPrevHighlighteditem - KBrowseRequestCount; - - if ( startIndex < 0 ) - { - startIndex = 0; - } - - TInt requestCount = KBrowseRequestCount * 2; - CacheItemUpdateL( *iCurrentFolderId, EFalse ); - - delete iCurrentFolderId; iCurrentFolderId = NULL; - iCurrentFolderId = - iParentId[ iParentId.Count() - 1 ]->AllocL(); - cache = CacheCheck( *iCurrentFolderId ); - - if ( cache < 0 ) - { - iUppermostItem = 0; - iBrowseRequestSent = ETrue; - iAction = CUPnPCommonUI::EUPnPBrowse; - iBrowseSession->BrowseL( - *iCurrentFolderId, - KFilterCommon, /* filter */ - MUPnPAVBrowsingSession::EDirectChildren, - startIndex, /* start index */ - requestCount, /* request count */ - KSortNone ); /* sort criteria */ - } - else - { - iDummyBrowseResponse = ETrue; - } - } - } - else - { - // If there is an object in the browse array with the given - // index, get the container id of that object - iPrevHighlighteditem = iListBox->CurrentItemIndex(); - if( iResultArray.Count() >= aIndex ) - { - iBrowseFlag = KBrowseForward; - - // store selected item index - iSelectedItem = aIndex; - - //update current cache item - CacheItemUpdateL( *iCurrentFolderId, EFalse ); - delete iCurrentFolderId; iCurrentFolderId = NULL; - iCurrentFolderId = - iResultArray[ aIndex ]->Id().AllocL(); - - // compare if the array what is about to be requested - // Make the browse request - cache = CacheCheck( *iCurrentFolderId ); - if ( cache < 0 ) - { - //not founded in cache create new cache item - CacheItemUpdateL( *iCurrentFolderId, ETrue ); - iUppermostItem = 0; - iBrowseRequestSent = ETrue; - iAction = CUPnPCommonUI::EUPnPBrowse; - iBrowseSession->BrowseL( - ( ( CUpnpContainer*)iResultArray[aIndex])->Id(), - /* CUpnpContainer (containing the object id of - the container */ - KFilterCommon, /* filter */ - MUPnPAVBrowsingSession::EDirectChildren, - 0, /* start index */ - KBrowseRequestCount, /* request count */ - KSortNone ); /* sort criteria */ - } - else - { - iDummyBrowseResponse = ETrue; - } - - - } - } - if ( iDummyBrowseResponse ) - { - SendDummyBrowseResponseL( cache ); - } - else - { - // Display waiting note if browse request is sent - DisplayWaitNoteL( R_UPNPCOMMONUI_BROWSE_UPDATE_WAIT_NOTE_DIALOG ); - } - } - else - { - __LOG( " CUPnPBrowseDialog::SendBrowseRequestL: \ - FAILED AV control point is NULL" ); - - } - - __LOG( "CUPnPBrowseDialog::SendBrowseRequestL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::BrowseResponse -// Returns browse results from UPnP AV control point. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::BrowseResponse( const TDesC8& aBrowseResponse, - TInt aError, TInt /*aMatches*/, TInt aTotalCount, const TDesC8& - /*aUpdateId*/ ) - { - __LOG1( "CUPnPBrowseDialog::BrowseResponse: %d", aError ); - - RPointerArray array; - - if( aError == KErrNone ) - { - iRoot = EFalse; - CUPnPXMLParser* parser = NULL; - TRAP( aError, parser = CUPnPXMLParser::NewL(); - parser->ParseResultDataL( array, - aBrowseResponse ) ); - - delete parser; - } - - TRAP_IGNORE( BrowseResponseL( aError, aTotalCount, array ) ); - - array.ResetAndDestroy(); - - __LOG( "CUPnPBrowseDialog::BrowseResponse -end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::BrowseResponseL -// Returns browse results from UPnP AV control point. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::BrowseResponseL( - TInt aStatus, - TInt aTotalCount, - const RPointerArray& aResultArray ) - { - __LOG( "CUPnPBrowseDialog::BrowseResponseL" ); - - CUPnPCommonUI::TUPnPAction currentAction = iAction; - TInt currentCopyIndex = iCopyIndex; - iAction = CUPnPCommonUI::EUPnPBrowse; - TRAPD( error, HandleErrorL( aStatus ) ); - iAction = currentAction; - iCopyIndex = currentCopyIndex; - User::LeaveIfError( error ); - - if( KErrNone == aStatus ) - { - iTotalCount = aTotalCount; - SelectedArrayCheckL(); - iAllObjectsReceived = EFalse; - iBrowseRequestSent = EFalse; - if( iBrowseFlag != KBrowseRoot ) - { - if ( iFirstResultArray ) - { - if( iBrowseFlag == KBrowseBack ) //Back browse was made - { - delete iParentId[ iParentId.Count() - 1 ]; - iParentId.Remove( iParentId.Count() - 1 ); - - // delete non-relevant parent name - delete iParentName[iParentName.Count() - 1]; - iParentName.Remove( iParentName.Count() - 1 ); - } - else //Forward browse has been made - { - // Save Parent Id - if ( iResultArray.Count() > 0 ) - { - HBufC8* containerId = - ( iResultArray[ 0 ]->ParentId() ).AllocL(); - iParentId.AppendL( containerId ); - - // store parent name - HBufC8* name = - ( iResultArray[ iSelectedItem ]->Title() ).AllocL(); - iParentName.AppendL( name ); - } - } - } - } - // If the result array in response to first browse request - if ( iFirstResultArray ) - { - DeleteListItemsL(); - iResultArray.Reset(); - - // If Server don't return all of the objects requested in - // an first browse request So need repeat browse request - // to get all objects which the first browse request desired - TInt tempCount = iTotalCount; - if ( tempCount > KBrowseRequestCount ) - { - tempCount = KBrowseRequestCount; - } - iServerReturnObjectCount = aResultArray.Count(); - if ( iServerReturnObjectCount < tempCount ) - { - iNeedRepeatRequest = ETrue; - } - } - - CTextListBoxModel* model = iListBox->Model(); - - // If response to an original browse request, so could get count of - // all objects which the original browse request desired - // PS: the first browse request is actually an original browse request - if ( iOriginalBrowseRequest ) - { - TInt tempCount = 0; - if ( iBrowseDirection == EForward ) - { - tempCount = iTotalCount - iUppermostItem - - model->NumberOfItems(); - } - else if ( iBrowseDirection == EBackward ) - { - tempCount = iUppermostItem; - } - - if ( tempCount > KBrowseRequestCount ) - { - tempCount = KBrowseRequestCount; - } - iNeedRecevedObjectCount = tempCount; - iCurrentRecevedObjectIndex = 0; - iOriginalBrowseRequest = EFalse; - } - - if( ( aResultArray.Count() + - iUppermostItem + - model->NumberOfItems() ) >= aTotalCount && - aResultArray.Count() == 0 ) - { - iAllObjectsReceived = ETrue; - } - else //if not all the objects are recevied - { - if ( aResultArray.Count() < KBrowseRequestCount ) - { - iAllObjectsReceviedInOneBrowse = EFalse; - iNumObjectReceviedInOnBrowse+=aResultArray.Count(); - if( iNumObjectReceviedInOnBrowse >= KBrowseRequestCount ) - { - iAllObjectsReceviedInOneBrowse = ETrue; - } - } - } - - // Copy the items from the array received as a parameter - for( TInt index=0; index < aResultArray.Count(); index++ ) - { - - if ( iBrowseDirection == EForward ) - { - if ( ( aResultArray[index]->ObjectType() == - EUPnPContainer ) ) - { - CUpnpContainer* container = CUpnpContainer::NewL(); - - CleanupStack::PushL( container ); - container->CopyL( *aResultArray[ index ] ); - CleanupStack::Pop( container ); - iResultArray.AppendL( container ); - } - else - { - CUpnpItem* item = CUpnpItem::NewL(); - - CleanupStack::PushL( item ); - item->CopyL( *aResultArray[ index ] ); - CleanupStack::Pop( item ); - iResultArray.AppendL( item ); - } - } - else if ( iBrowseDirection == EBackward ) - { - if ( aResultArray[ index ]->ObjectType() == EUPnPContainer ) - { - CUpnpContainer* container = CUpnpContainer::NewL(); - CleanupStack::PushL( container ); - container->CopyL( *aResultArray[ index ] ); - CleanupStack::Pop( container ); - iResultArray.InsertL( container, index ); - iUppermostItem--; - } - else - { - CUpnpItem* item = CUpnpItem::NewL(); - - CleanupStack::PushL( item ); - item->CopyL( *aResultArray[ index ] ); - CleanupStack::Pop( item ); - iResultArray.InsertL( item, index ); - iUppermostItem--; - } - } - } - - if ( iResultArray.Count() > ( KBrowseRequestCount * 2 ) ) - { - if ( iBrowseDirection == EForward ) - { - for ( ; - ( KBrowseRequestCount * 2 ) < iResultArray.Count(); ) - { - delete iResultArray[ 0 ]; - iResultArray[ 0 ] = NULL; - iResultArray.Remove( 0 ); - if ( iCurrentItem > 0 ) - { - iCurrentItem--; - } - iUppermostItem++; - } - } - else if ( iBrowseDirection == EBackward ) - { - for ( ; - ( KBrowseRequestCount * 2 ) < iResultArray.Count(); ) - { - delete iResultArray[ ( iResultArray.Count() - 1 ) ]; - iResultArray[ ( iResultArray.Count() - 1 ) ] = NULL; - iResultArray.Remove( iResultArray.Count() - 1 ); - iCurrentItem++; - } - } - } - - // Reload the list items - if ( iFirstResultArray ) - { - if ( !iDummyBrowseResponse ) - { - iCurrentItem = 0; - } - iFirstResultArray = EFalse; - // update navi pane text - UpdateNaviPaneTextL(); - // Redraw the list - iListBox->ActivateL(); - iListBox->DrawDeferred(); - } - DeleteListItemsL(); - LoadListItemsL(); - - // If count of CDS objects requesed in an original browse request - // isn't complete, countinue send browse request - iCurrentRecevedObjectIndex += aResultArray.Count(); - if ( iNeedRepeatRequest && - iCurrentRecevedObjectIndex < iNeedRecevedObjectCount ) - { - TInt startIndex = KErrNotFound; - if ( iBrowseDirection == EForward ) - { - TInt numberOfItems = iListBox->Model()->NumberOfItems(); - startIndex = iUppermostItem + numberOfItems; - } - else if ( iBrowseDirection == EBackward ) - { - startIndex = iUppermostItem - iServerReturnObjectCount; - } - iAction = CUPnPCommonUI::EUPnPBrowse; - iBrowseSession->BrowseL( *iCurrentFolderId, - KFilterCommon, /* filter */ - MUPnPAVBrowsingSession::EDirectChildren, - startIndex, /* start index */ - iServerReturnObjectCount,/* request count */ - KSortNone ); /* sort criteria */ - iBrowseRequestSent = ETrue; - } - else - { - DismissWaitNoteL(); - } - } - else - { - __LOG( "CUPnPBrowseDialog: \ - Browse operation failed!" ); - DismissWaitNoteL(); - //Delete the current browsed container id in the cache and - // handle the error - DialogDismissedL( KErrNotFound ); - } - - - __LOG( "CUPnPBrowseDialog::BrowseResponseL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::ClearTitleL -// Sets title back to default. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::ClearTitleL() - { - __LOG( "tCUPnPBrowseDialog::ClearTitleL" ); - - TUid titlePaneUid; - titlePaneUid.iUid = EEikStatusPaneUidTitle; - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - CEikStatusPaneBase::TPaneCapabilities titlesubPane = - statusPane->PaneCapabilities( titlePaneUid ); - - CAknTitlePane* titlePane = - ( CAknTitlePane* ) statusPane->ControlL( titlePaneUid ); - __LOG( "CUPnPBrowseDialog::ClearTitleL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::AppendIconToArrayL -// Load a possibly skinned icon (with mask) and append it to an -// icon array. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId) - { - __LOG( "CUPnPBrowseDialog::AppendIconToArrayL" ); - - __ASSERTD( aArray != NULL, __FILE__, __LINE__ ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - - AknsUtils::CreateIconL( - aSkin, aID, bitmap, mask, aMbmFile, aBitmapId, aMaskId ); - - CleanupStack::PushL( bitmap ); - CleanupStack::PushL( mask ); - - CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); - - icon->SetBitmapsOwnedExternally( EFalse ); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop( mask ); - CleanupStack::Pop( bitmap ); - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL( icon ); - aArray->AppendL( icon ); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop( icon ); - __LOG( "CUPnPBrowseDialog::AppendIconToArrayL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::MarkItemL -// Marks one item -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::MarkItemL( TInt aItemIndex ) - { - __LOG( "CUPnPBrowseDialog::MarkItemL" ); - - CTextListBoxModel* model = iListBox->Model(); - CListBoxView* listBoxView = iListBox->View(); - - if( iResultArray[ aItemIndex ] ) - { - if( iResultArray[ aItemIndex ]->ObjectType() == EUPnPItem ) - { - listBoxView->SelectItemL( aItemIndex ); - } - } - UpdateCommandButtonAreaL( ETrue, iListBox->CurrentItemIndex() ); - __LOG( "CUPnPBrowseDialog::MarkItemL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::UnmarkItemL -// Unmarks one item -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::UnmarkItem( TInt aItemIndex ) - { - __LOG( "CUPnPBrowseDialog::UnmarkItemL" ); - - CTextListBoxModel* model = iListBox->Model(); - CListBoxView* listBoxView = iListBox->View(); - listBoxView->DeselectItem( aItemIndex ); - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) - { - UpdateCommandButtonArea( ETrue, iListBox->CurrentItemIndex() ); - } - else - { - UpdateCommandButtonArea( EFalse, iListBox->CurrentItemIndex() ); - } - __LOG( "CUPnPBrowseDialog::UnmarkItemL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::MarkAllItemsL -// Marks all items. Does not mark any containers. -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::MarkAllItemsL() - { - __LOG( "CUPnPBrowseDialog::MarkAllItemsL" ); - - CTextListBoxModel* model = iListBox->Model(); - TInt itemCount = model->NumberOfItems(); - CListBoxView* listBoxView = iListBox->View(); - - // Go through the items and select all items - for( TInt index = 0; index < itemCount; index++ ) - { - if( iResultArray[ index ]->ObjectType() == EUPnPItem ) - { - listBoxView->SelectItemL( index ); - } - } - UpdateCommandButtonAreaL( ETrue, iListBox->CurrentItemIndex() ); - __LOG( "CUPnPBrowseDialog::MarkAllItemsL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::UnmarkAllItems -// Unmarks all items -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::UnmarkAllItems() - { - __LOG( "CUPnPBrowseDialog::UnmarkAllItems" ); - - CTextListBoxModel* model = iListBox->Model(); - TInt itemCount = model->NumberOfItems(); - CListBoxView* listBoxView = iListBox->View(); - iSelectedItemsArray.ResetAndDestroy(); - for( TInt index = 0; index < itemCount; index++ ) - { - listBoxView->DeselectItem( index ); - } - UpdateCommandButtonArea( EFalse, iListBox->CurrentItemIndex() ); - __LOG( "CUPnPBrowseDialog::UnmarkAllItems-END" ); - } -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::ShowPlayExtL -// show image or video on external device -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::ShowPlayExtL() - { - __LOG( "CUPnPBrowseDialog::ShowPlayExtL" ); - - SelectedArrayCheckL(); - //if there is(are) audio item(s) marked, start playing it(them) on remote - //renderer - if ( iSelectedItemsArray.Count() > 0 ) - { - if( IsAudioItemMarked() ) - { - //if marked items have at least one audio item - iIsMusicItem = ETrue; - } - else - { - iIsMusicItem = EFalse; - } - //if at least one audio file is either in marked items - //play it - if( iIsMusicItem && !iMusicPlay ) - { - PlayL( EFalse ); - } - } - else // if no marked items - { - if ( ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassVideo ) == 0 ) - { - ShowVideoDialogExtL(); - } - else if ( ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassImage ) == 0 ) - { - StartImageControlL(); - } - else if ( ( iResultArray[iListBox->CurrentItemIndex()] )-> - ObjectClass().Find( KClassAudio ) == 0 && - !iMusicPlay ) - { - PlayL( EFalse ); - } - } - - __LOG( "CUPnPBrowseDialog::ShowPlayExtL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::CreateFillerLC -// Creates a playlist representing current selection for music playback -// -------------------------------------------------------------------------- - -CUPnPPlayListFiller* CUPnPBrowseDialog::CreateFillerLC() - { - CUPnPPlayListFiller* filler = NULL; - - if ( iSelectedItemsArray.Count() > 0 ) - { - // Play marked items only - filler = CUPnPPlayListFiller::NewL(); - CleanupStack::PushL( filler ); - TInt firstAudioItem = KErrNotFound; - TBool focusedItemFound = EFalse; - for( TInt i = 0; i < iSelectedItemsArray.Count(); i++ ) - { - filler->InsertObjectL( - iSourceDevice, *iSelectedItemsArray[ i ] ); - - if( UPnPItemUtility::BelongsToClass( *iSelectedItemsArray[ i ] - , KClassAudio ) - && firstAudioItem == KErrNotFound ) - { - firstAudioItem = i; - } - if( iSelectedItemsArray[i]->Id() == iResultArray[ iListBox-> - CurrentItemIndex() ]->Id() ) - { - filler->SetSelectedIndex( i ); - focusedItemFound = ETrue; - } - } - // if focused item was not found set index to first audio item - if( !focusedItemFound ) - { - filler->SetSelectedIndex( firstAudioItem ); - } - } - else - { - // play entire container starting from current pointer - TInt currentIndex = iListBox->CurrentItemIndex(); - if( currentIndex < 0 ) - { - currentIndex = 0; - } - - if( iParentId.Count() == 0 ) - { - //root level - filler = CUPnPBrowsePlaylistFiller::NewL( - KContainerIdRoot, - iUppermostItem, - iTotalCount ); - } - else if( iParentId.Count() > 0) - { - //any other level - filler = CUPnPBrowsePlaylistFiller::NewL( - iResultArray[ 0 ]->ParentId(), - iUppermostItem, - iTotalCount ); - } - else - { - User::Leave( KErrNotFound ); - } - CleanupStack::PushL( filler ); - for( TInt i = 0; i < iResultArray.Count(); i++ ) - { - filler->InsertObjectL( iSourceDevice, *iResultArray[ i ] ); - } - filler->SetSelectedIndex( currentIndex ); - } - - return filler; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::PlayL -// Plays selected music file -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::PlayL( TBool aLocal ) - { - __LOG( "CUPnPBrowseDialog::PlayL" ); - TInt error = KErrNone; - if( !aLocal ) - { - if( !iImageControlActive ) //if not played via image control - { //start device dialog - iChildDialogOpen++; - error = iCommonUI.SelectDeviceL( - iAVControl, - *iTargetDevice, - EUPnPSearchRenderingDevicesWithAudioCapability, - EUPnPSelectDeviceTitle ); - iChildDialogOpen--; - } - if ( KErrNone == error ) - { - CUPnPPlayListFiller* filler = CreateFillerLC(); - CleanupStack::Pop( filler ); - iChildDialogOpen++; - iMusicPlay = ETrue; - //filler ownership transferred - error = iCommonUI.ExecuteMusicPlayerL( - iAVControl, filler, iTargetDevice ); - - iMusicPlay = EFalse; - iChildDialogOpen--; - iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL( - R_AVKON_STATUS_PANE_LAYOUT_USUAL); - iAvkonEnv->LoadAknLayoutL(); - iAvkonAppUi->ReportResourceChangedToAppL( - KEikDynamicLayoutVariantSwitch ); - } - else - { - __LOG( "CUPnPBrowseDialog::PlayL SelectDeviceL failed" ); - } - } - else - { - CUPnPPlayListFiller* filler = CreateFillerLC(); - CleanupStack::Pop( filler ); - iChildDialogOpen++; - iMusicPlay = ETrue; - //filler ownership transferred - error = iCommonUI.ExecuteMusicPlayerL( iAVControl, filler, NULL ); - - iMusicPlay = EFalse; - iChildDialogOpen--; - iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL( - R_AVKON_STATUS_PANE_LAYOUT_USUAL); - iAvkonEnv->LoadAknLayoutL(); - iAvkonAppUi->ReportResourceChangedToAppL( - KEikDynamicLayoutVariantSwitch ); - } - - if( KErrNone != error ) - { - User::Leave( error ); - } - __LOG( "CUPnPBrowseDialog::PlayL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DisplayWaitNoteL -// -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::DisplayWaitNoteL( TInt aResource ) - { - __LOG( "CUPnPBrowseDialog::DisplayWaitNoteL" ); - - // Wait dialog is terminated from Ready function - iWaitNoteDialog = new( ELeave )CAknWaitDialog( - ( REINTERPRET_CAST ( CEikDialog**,&iWaitNoteDialog ) ), ETrue ); - iWaitNoteDialog->SetCallback( this ); - iWaitNoteDialog->ExecuteLD( aResource ); - - __LOG( "CUPnPBrowseDialog::DisplayWaitNoteL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DismissWaitNoteL -// -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::DismissWaitNoteL() - { - __LOG( "CUPnPBrowseDialog::DismissWaitNoteL" ); - - if ( iWaitNoteDialog ) - { - iWaitNoteDialog->ProcessFinishedL(); - delete iWaitNoteDialog; - iWaitNoteDialog = NULL; - } - - __LOG( "CUPnPBrowseDialog::DismissWaitNoteL-END" ); - } - - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::GetHelpContext -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::GetHelpContext( TCoeHelpContext& aContext ) const - { - __LOG( "CUPnPBrowseDialog::GetHelpContext" ); - -// aContext.iMajor = TUid::Uid( KMediaGalleryUID3 ); - - aContext.iContext = KUPNP_HLP_REMOTE_DEVICES; - - TInt count = iResultArray.Count(); - for ( TInt index = 0; index < count; index++ ) - { - if ( iResultArray[ index ]->ObjectType() != EUPnPContainer ) - { - // show content help if folder contains items - aContext.iContext = KUPNP_HLP_CONTENT_VIEW; - // end loop - index = count; - } - } - __LOG( "CUPnPBrowseDialog::GetHelpContext-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::MediaServerDisappeared -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::MediaServerDisappeared( - TUPnPDeviceDisconnectedReason aReason ) - { - __LOG( "CUPnPBrowseDlg::MediaServerDisappeared" ); - - TInt error = KErrNone; - if( aReason == EDisconnected ) - { - error = KErrSessionClosed; - iMSDisappear = ETrue; - } - else if( aReason == EWLANLost ) - { - error = KErrDisconnected; - } - else - { - __PANICD( __FILE__, __LINE__ ); - } - - TRAPD( err, DismissWaitNoteL() ); - if ( err != KErrNone ) - { - __LOG( "CUPnPBrowseDlg::MediaServerDisappeared \ - delete WaitNote error" ); - } - - //Only HandleCopyL will set iAction to CUPnPCommonUI::EUPnPCopy, after - //HandleCopyL be called, HandleErrorL also will be called. So at here - //HandleErrorL shouldn't be called. Otherwise will result ESLX-7M88UF - if ( iAction != CUPnPCommonUI::EUPnPCopy ) - { - TRAP_IGNORE( HandleErrorL( error ) ); - } - - __LOG( "CUPnPBrowseDlg::MediaServerDisappeared - END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::UpdateNaviPaneTextL -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::UpdateNaviPaneTextL() - { - __LOG( "CUPnPBrowseDialog::UpdateNaviPaneTextL" ); - - // Set text to navi pane - CEikStatusPane* sp = - ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); - iNaviPane = ( CAknNavigationControlContainer * )sp->ControlL( - TUid::Uid( EEikStatusPaneUidNavi ) ); - - // old decorator is popped and deleted - if ( iNaviDecorator ) - { - iNaviPane->Pop( iNaviDecorator ); - delete iNaviDecorator; - iNaviDecorator = NULL; - } - - if ( iImageControlActive ) - { - if( iTitlePane ) - { - iTitlePane->SetTextL( *StringLoader::LoadLC( - R_UPNPCOMMONUI_TITLE_SHOWING ) ); - CleanupStack::PopAndDestroy(); - } - - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - iTargetDevice->FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - HBufC *tmpbuf = UpnpString::ToUnicodeL( - friendlyname.Left( KLength ) ); - CleanupStack::PushL( tmpbuf ); - - iNaviDecorator = iNaviPane->CreateNavigationLabelL( *tmpbuf ); - CleanupStack::PopAndDestroy( tmpbuf ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - iNaviPane->PushL( *iNaviDecorator ); - } - // parent name is given - else if ( iParentName.Count() > 0 ) - { - //set back the title - if( iTitlePane ) - { - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - iSourceDevice.FriendlyName() ); - CleanupStack::PushL( tmpfriendlyname ); - - TPtrC8 friendlyname = *tmpfriendlyname; - HBufC *tmpbuf = UpnpString::ToUnicodeL( - friendlyname.Left( KLength ) ); - CleanupStack::PushL( tmpbuf ); - - iTitlePane->SetTextL( *tmpbuf ); - CleanupStack::PopAndDestroy( tmpbuf ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - } - - // Get name and replace illegal characters. - HBufC8* tmpname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - *iParentName[ iParentName.Count() - 1 ] ); - - CleanupStack::PushL( tmpname ); - TPtrC8 tmpnameptr = *tmpname; - - HBufC* buf = UpnpString::ToUnicodeL( tmpnameptr.Left( KLength ) ); - CleanupStack::PushL(buf); - // ownership of decorator is transfered to application - iNaviDecorator = iNaviPane->CreateNavigationLabelL( *buf ); - CleanupStack::PopAndDestroy( buf ); - CleanupStack::PopAndDestroy( tmpname ); - iNaviPane->PushL( *iNaviDecorator ); - } - __LOG( "CUPnPBrowseDialog::UpdateNaviPaneTextL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::CacheCheck -// Checks if the wanted container is in Cache -// -------------------------------------------------------------------------- - -TInt CUPnPBrowseDialog::CacheCheck( const TDesC8& aCheckContainerId ) - { - __LOG( "CUPnPBrowseDialog::CacheCheck" ); - - TInt retContainerCacheArrayId = -1; - for ( TInt index = 0; index < iBrowseCacheItems.Count(); index++ ) - { - if ( aCheckContainerId.Compare( - iBrowseCacheItems[ index ]->ContainerId() ) == 0 ) - { - // item is in cache - retContainerCacheArrayId = index; - break; - } - } - - __LOG( "CUPnPBrowseDialog::CacheCheck-END" ); - return retContainerCacheArrayId; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::SendDummyBrowseResponseL -// sends dummy response as browseresponse from cache -// -------------------------------------------------------------------------- - -void CUPnPBrowseDialog::SendDummyBrowseResponseL( TInt aCacheIndex ) - { - __LOG( "CUPnPBrowseDialog::SendDummyBrowseResponseL" ); - iTempArray.Reset(); - - TInt numberOfItems = iBrowseCacheItems[ aCacheIndex ]->GetNumberOfItems(); - for ( TInt index = 0; index < numberOfItems; index++ ) - { - iTempArray.Appendl( iBrowseCacheItems[ aCacheIndex ]-> - GetItem( index ) ); - } - iUppermostItem = iBrowseCacheItems[ aCacheIndex ]->GetUpperMostItem(); - iTotalCount = iBrowseCacheItems[ aCacheIndex ]->GetTotalCount(); - iCurrentItem = iBrowseCacheItems[ aCacheIndex ]->GetHighlightedItem(); - BrowseResponseL( KErrNone, iTotalCount, iTempArray ); - __LOG( "CUPnPBrowseDialog::SendDummyBrowseResponseL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::CacheItemUpdateL -// updates containers cache -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::CacheItemUpdateL( const TDesC8& aContainerId, - TBool aNewItem ) - { - __LOG( "CUPnPBrowseDialog::CacheItemUpdateL" ); - if ( aNewItem ) - { - __LOG( "CUPnPBrowseDialog::CacheItemUpdateL, NewItem" ); - CUPnPBrowseCacheItem* test = CUPnPBrowseCacheItem::NewL( - aContainerId, - iPrevHighlighteditem, - iUppermostItem ); - CleanupStack::PushL( test ); - iBrowseCacheItems.AppendL( test ); - CleanupStack::Pop( test ); - } - else //update current item - { - TInt cacheItemIndex = CacheCheck( aContainerId ); - if ( cacheItemIndex > -1 ) - { - iBrowseCacheItems[ cacheItemIndex ]->SetFirstItem( - iUppermostItem ); - iBrowseCacheItems[ cacheItemIndex ]->SetHighLightedItem( - iCurrentItem ); - iBrowseCacheItems[ cacheItemIndex ]->SetTotalCount( - iTotalCount ); - //iResultArray ownership transferred here - iBrowseCacheItems[cacheItemIndex]->SetItemArrayL( iResultArray ); - } - } - __LOG( "CUPnPBrowseDialog::CacheItemUpdateL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::SelectedArrayCheckL -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::SelectedArrayCheckL( void ) - { - __LOG( "CUPnPBrowseDialog::SelectedArrayCheckL" ); - const CArrayFix* indexes = iListBox->SelectionIndexes(); - //add possible new selections - if ( indexes->Count() ) - { - for ( TInt selectionCount = 0; selectionCount < indexes->Count(); - selectionCount++ ) - { - TBool alreadyInArray = EFalse; - for ( TInt i = 0; i < iSelectedItemsArray.Count(); i++ ) - { - //checks if the selected BrowseArray item is - //in the selected items array - if ( !( iSelectedItemsArray[ i ]->Id().CompareC( ( - iResultArray[ indexes->At( selectionCount ) ] - )->Id() ) ) ) - - { - alreadyInArray = ETrue; - i = iSelectedItemsArray.Count(); - } - } - //if not in array add it there - if ( !alreadyInArray ) - { - CUpnpItem* itemForSelectionArray = CUpnpItem::NewL(); - - itemForSelectionArray->CopyL( *iResultArray[ indexes->At( - selectionCount ) ] ); - - iSelectedItemsArray.AppendL( itemForSelectionArray ); - } - } - } - CTextListBoxModel* model = iListBox->Model(); - TInt numberOfItems = model->NumberOfItems(); - - //delete unselectedItems from selected items array - if ( numberOfItems ) - { - const CArrayFix* indexes = iListBox->SelectionIndexes(); - - //check all items in the current dialog - for ( TInt listItemIndex = 0; listItemIndex < numberOfItems; - listItemIndex++ ) - { - TBool notSelected = ETrue; - - //check all selected items - for ( TInt index = 0; index < indexes->Count() ; index++ ) - { - if ( listItemIndex == indexes->At( index ) ) - { - notSelected = EFalse; - index = indexes->Count(); - } - } - //if not selected, check if the item is in selected items array - if ( notSelected ) - { - //check selected items array - for ( TInt selectionArray = 0; - selectionArray < iSelectedItemsArray.Count() ; - selectionArray++ ) - - { - if ( !( iSelectedItemsArray[ selectionArray ]-> - Id().CompareC( - ( ( CUpnpItem* )iResultArray[ listItemIndex ] ) - ->Id() ) ) ) - { - delete iSelectedItemsArray[ selectionArray ]; - iSelectedItemsArray.Remove( selectionArray ); - iSelectedItemsArray.Compress(); - selectionArray = iSelectedItemsArray.Count(); - } - } - } - } - } - __LOG( "CUPnPBrowseDialog::SelectedArrayCheckL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::StartImageControlL -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::StartImageControlL() - { - __LOG( "CUPnPBrowseDialog::StartImageControlL" ); - TInt error = KErrNone; - - iChildDialogOpen++; - error = iCommonUI.SelectDeviceL( - iAVControl, - *iTargetDevice, - EUPnPSearchRenderingDevicesWithImageCapability, - EUPnPSelectDeviceTitle ); - iChildDialogOpen--; - if ( KErrNone == error ) - { - if( !iImagePlayer ) - { - iImagePlayer = CUpnpImagePlayer::NewL( iAVControl, - *this, - iCommonUI ); - } - - TRAP( error, iImagePlayer->SetTargetDeviceL( *iTargetDevice ) ); - - if( KErrNone == error ) - { - StartImageControlTimer(); - iImageControlActive = ETrue; - UpdateNaviPaneTextL(); - UpdateSoftkeysL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP ); - } - else - { - __LOG( "CUPnPBrowseDialog::StartImageControlL SetTargetDeviceL \ -didn't selected" ); - } - } - else - { - __LOG( "CUPnPBrowseDialog::StartImageControlL SelectDevice \ -didn't selected" ); - } - if( KErrNone != error ) - { - User::Leave( error ); - } - - __LOG( "CUPnPBrowseDialog::StartImageControlL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::StopImageControlL -// -------------------------------------------------------------------------- - -void CUPnPBrowseDialog::StopImageControlL() - { - __LOG( "CUPnPBrowseDialog::StopImageControlL" ); - if ( iImageControlActive ) - { - iImageControlActive = EFalse; - iImageControlTimer->Cancel(); - ShowCurrentImageL( EFalse ); - UpdateNaviPaneTextL(); - TInt currentItemIndex = iListBox->CurrentItemIndex(); - if ( currentItemIndex < 0 ) - { - currentItemIndex = 0; - } - UpdateCommandButtonAreaL( EFalse, currentItemIndex ); - iAction = CUPnPCommonUI::EUPnPNone; - iImagePlayer->Stop(); - } - - __LOG( "CUPnPBrowseDialog::StopImageControlL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::UpdateSoftkeysL -// Update CBA-keys -// -------------------------------------------------------------------------- - -void CUPnPBrowseDialog::UpdateSoftkeysL( TInt aResourceId ) - { - __LOG( "CUPnPBrowseDialog::UpdateSoftkeysL" ); - CEikButtonGroupContainer* cba = &ButtonGroupContainer(); - cba->SetCommandSetL( aResourceId ); - cba->DrawDeferred(); - __LOG( "CUPnPBrowseDialog::UpdateSoftkeysL-END" ); - } - -// -------------------------------------------------------------------------- -// UPnPImagePlayerDialog::ImageControlTimerCallbackL -// Callback method for the Timer. -// -------------------------------------------------------------------------- -TInt CUPnPBrowseDialog::ImageControlTimerCallbackL( TAny* aDlg ) - { - __LOG( "CUPnPBrowseDialog::ImageControlTimerCallbackL" ); - static_cast< CUPnPBrowseDialog* >( aDlg )->iImageControlTimer->Cancel(); - if ( !( static_cast< CUPnPBrowseDialog* >( aDlg )->iBrowseRequestSent ) ) - { - static_cast< CUPnPBrowseDialog* >( aDlg )->ShowCurrentImageL( ETrue ); - } - else - { - static_cast(aDlg)->StartImageControlTimer(); - } - __LOG( "CUPnPBrowseDialog::ImageControlTimerCallbackL-END" ); - return KErrNone; -} - - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::StartImageControlTimer -// Starts periodic timer -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::StartImageControlTimer( void ) - { - __LOG( "CUPnPBrowseDialog::StartImageControlTimer" ); - iImageControlTimer->Start( - KImageTimerDelay, - KImageTimerInterval, - TCallBack( ImageControlTimerCallbackL, this ) ); - __LOG( "CUPnPBrowseDialog::StartImageControlTimer-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::ShowCurrentImageL -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::ShowCurrentImageL( TBool aShowImage ) - { - __LOG( "CUPnPBrowseDialog::ShowCurrentImageL" ); - - TInt currentItemIndex = iListBox->CurrentItemIndex(); - if ( currentItemIndex < 0 ) - { - currentItemIndex = 0; - } - - CTextListBoxModel* model = iListBox->Model(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast< CDesCArray* >( textArray ); - - if( iLastImageItemIndex >= 0 ) //if last item was image - { - TBuf lastItem; - HBufC *lastTmpItem = UpnpString::ToUnicodeL( - iResultArray[ iLastImageItemIndex ]->Title().Left( KLength ) ); - CleanupStack::PushL( lastTmpItem ); - lastItem.Format( KFormatString(), - EUPnPIconImage, - lastTmpItem); - CleanupStack::PopAndDestroy ( lastTmpItem ); - - listBoxItems->Delete( iLastImageItemIndex ); - listBoxItems->InsertL( iLastImageItemIndex, lastItem ); - iListBox->HandleItemAdditionL(); - if( ( iResultArray[ iListBox->CurrentItemIndex() ] )-> - ObjectClass().Find( KClassImage ) != 0 ) - { - iLastImageItemIndex = KErrNotFound; - } - } - - if ( ( iResultArray[ iListBox->CurrentItemIndex() ] )-> - ObjectClass().Find( KClassImage ) == 0 ) - { - if( ( CUpnpItem* )iResultArray[ currentItemIndex ] - ->Title().Length() != 0 ) - { - HBufC *tmpItem = UpnpString::ToUnicodeL( - iResultArray[ currentItemIndex ]-> - Title().Left( KLength ) ); - CleanupStack::PushL( tmpItem ); - - TBuf item; - //if not showing an image - if ( !aShowImage ) - { - item.Format( KFormatString(), EUPnPIconImage, tmpItem); - iLastImageItemIndex = KErrNotFound; - listBoxItems->Delete( currentItemIndex ); - listBoxItems->InsertL( currentItemIndex, item ); - } - else //if showing an image - { - - item.Format( KFormatString2() ,EUPnPIconImage, - tmpItem, - EUPnPIconImageShowing ); - if(iImagePlayer) - { - __LOG( "CUPnPBrowseDialog::iImagePlayer->PlayL" ); - iAction = CUPnPCommonUI::EUPnPShow; - TRAPD( error, iImagePlayer->PlayL( - *iResultArray[currentItemIndex] ) ); - - HandleErrorL( error ); - - } - - //listBoxItem.Set( item ); - listBoxItems->Delete( currentItemIndex ); - listBoxItems->InsertL( currentItemIndex, item ); - iLastImageItemIndex = currentItemIndex; - } - CleanupStack::PopAndDestroy ( tmpItem ); - iListBox->HandleItemAdditionL(); - iListBox->SetCurrentItemIndexAndDraw( currentItemIndex ); - } - } - - __LOG( "CUPnPBrowseDialog::ShowCurrentImageL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::ShowVideoDialogExt -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::ShowVideoDialogExtL() - { - __LOG( "CUPnPBrowseDialog::ShowVideoDialogExtL" ); - - TInt error = KErrNone; - - const CUpnpObject* selectedObject = - iResultArray[ iListBox->CurrentItemIndex() ]; - - if( !iImageControlActive ) //if showing video is not from image timer - { //then start select device dialog - iChildDialogOpen++; - error = iCommonUI.SelectDeviceL( - iAVControl, - *iTargetDevice, - EUPnPSearchRenderingDevicesWithVideoCapability, - EUPnPSelectDeviceTitle ); - iChildDialogOpen--; - } - else //if target renderer exists, check video capability - { - if( !iTargetDevice->VideoCapability() ) - { - User::Leave( KErrNotSupported ); - } - } - if( KErrNone == error ) - { - iAction = CUPnPCommonUI::EUPnPShow; - MUPnPAVRenderingSession* renderingSession = NULL; - renderingSession = &( iAVControl.StartRenderingSessionL( - *iTargetDevice ) ); - - iChildDialogOpen++; - //trap here to release rendering session properly, better to - //create and destroy the rendering ession inside the video player - TInt ret = KErrNone; - TRAP( error, ret = iCommonUI.ExecuteVideoPlayerL( - *renderingSession, - *selectedObject ) ); - - if( ret < KErrNone && error == KErrNone ) - { - error = ret; - } - renderingSession->RemoveObserver(); - iAVControl.StopRenderingSession( *renderingSession ); - - iChildDialogOpen--; - - //if not media server or wlan lost, update its navipane - if( !iMSDisappear && error != KErrDisconnected ) - { - UpdateNaviPaneTextL(); - } - } - else - { - __LOG( "ShowVideoDialogExtL: SetTargetDeviceL FAILED" ); - } - - if( KErrNone != error ) - { - User::Leave( error ); - } - - __LOG( "CUPnPBrowseDialog::ShowVideoDialogExtL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::HandleCopyL() -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::HandleCopyL() - { - __LOG( "CUPnPBrowseDialog::HandleCopyL" ); - - iAction = CUPnPCommonUI::EUPnPCopy; - iCopyIndex = NULL; - TInt selected_item = iListBox->CurrentItemIndex(); - iCopying = ETrue; - if( iResultArray[ selected_item ]->ObjectType() == EUPnPContainer ) - { - // Instantiate the UPnP File Transfer Engine - CUpnpFileTransferEngine* ftEngine = - CUpnpFileTransferEngine::NewL( iBrowseSession ); - CleanupStack::PushL( ftEngine ); - - TBool playlistContainer = EFalse; - playlistContainer = UPnPCommonUtils::IsPlaylistContainerL( - *iResultArray[ iListBox->CurrentItemIndex() ] ); - - // Copy container to phone memory - TInt copyErr = KErrNone; - if( playlistContainer ) - { - TRAP( copyErr, ftEngine->CopyRemotePlaylistToHandsetL( - ( CUpnpContainer* )iResultArray[ - iListBox->CurrentItemIndex() ] ) ); - } - else - { - TRAP( copyErr, ftEngine->CopyRemoteContainerToHandsetL( - ( CUpnpContainer* )iResultArray[ - iListBox->CurrentItemIndex() ] ) ); - } - - iCopyIndex = ftEngine->ItemCopiedFromContainer(); - - User::LeaveIfError( copyErr ); - - // Clean up ftEngine - CleanupStack::PopAndDestroy( ftEngine ); - ftEngine = NULL; - } - else - { - RPointerArray tempArrayForCopy; - CleanupResetAndDestroyPushL( tempArrayForCopy ); - if ( iSelectedItemsArray.Count() ) - { - for ( TInt count=0; - count < iSelectedItemsArray.Count(); - count++ ) - { - CUpnpItem* tempItem = CUpnpItem::NewL(); - CleanupStack::PushL( tempItem ); - - - tempItem->CopyL( *iSelectedItemsArray[ count ] ); - - //ownership transferred - tempArrayForCopy.AppendL( tempItem ); - CleanupStack::Pop( tempItem ); - } - iCopyIndex = iSelectedItemsArray.Count(); - } - else - { - CUpnpItem* tempItem = CUpnpItem::NewL(); - CleanupStack::PushL( tempItem ); - tempItem->CopyL( *iResultArray[selected_item] ); - //ownership transferred - tempArrayForCopy.AppendL( tempItem ); - CleanupStack::Pop( tempItem ); - iCopyIndex = 1; - } - // Instantiate the UPnP File Transfer Engine - CUpnpFileTransferEngine* ftEngine = NULL; - ftEngine = CUpnpFileTransferEngine::NewL( iBrowseSession ); - CleanupStack::PushL( ftEngine ); - // Copy to phone - ftEngine->CopyRemoteItemsToHandsetL( tempArrayForCopy ); - // Clean up ftEngine - CleanupStack::PopAndDestroy( ftEngine ); - ftEngine = NULL; - CleanupStack::PopAndDestroy( &tempArrayForCopy ); - } - iCopying = EFalse; - UnmarkAllItems(); - - __LOG( "CUPnPBrowseDialog::HandleCopyL-END" ); - - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DeviceDisappeared( TInt aError ) -// called in image play -//--------------------------------------------------------------------------- -void CUPnPBrowseDialog::DeviceDisappeared( TInt aError ) - { - TRAP_IGNORE( HandleErrorL( aError ) ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::HandleErrorL( TInt aError ) -// Handle errors in all the case EGKL-6ZPH89 -//--------------------------------------------------------------------------- -void CUPnPBrowseDialog::HandleErrorL( TInt aError ) - { - iCommonUI.GetUpnpAction( iAction ); - //if media server or WLAN lost, close the browse dialog - if( ( KErrSessionClosed == aError && iMSDisappear ) || - KErrDisconnected == aError || - EAknCmdExit == aError || - EEikCmdExit == aError ) - { - if( iError == KErrNone ) - { - iError = aError; - } - - if( iChildDialogOpen > 0 ) - { - //if some dialos are open on the top of browse dialog, - //close those dialogs and do the corresponding action via - //errors returned from them - iCommonUI.DismissDialogL( aError ); - } - else //if no, do the corresponding action via the error - { - TryExitL( aError ); - } - } - else - { - // if media renderer disappears - if( KErrSessionClosed == aError && !iMSDisappear ) - { - StopImageControlL(); - UpdateNaviPaneTextL(); - } - - iCommonUI.HandleCommonErrorL( aError, iCopyIndex ); - iAction = CUPnPCommonUI::EUPnPNone; - iCopyIndex = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::HandleResourceChange -// -------------------------------------------------------------------------- -// -void CUPnPBrowseDialog::HandleResourceChange(TInt aType) - { - __LOG("[UPnPCommonUI]\t CUPnPBrowseDialog::HandleResourceChange"); - CAknDialog::HandleResourceChange(aType); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::IsAudioItemMarked -// -------------------------------------------------------------------------- -TBool CUPnPBrowseDialog::IsAudioItemMarked( void ) - { - TBool mark = EFalse; - const CArrayFix* indexes = iListBox->SelectionIndexes(); - if ( indexes->Count() ) //if items are marked - { - for (TInt count=0; count < indexes->Count(); count++) - { - if ( ( iResultArray[indexes->At(count)])-> - ObjectClass().Find( KClassAudio ) - == 0 ) //audio - { - mark = ETrue; - count = indexes->Count(); - } - } - } - __LOG( "CUPnPBrowseDialog::IsAudioItemMarked-END" ); - return mark; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::UpdateCommandButtonAreaL( -// TBool aMark, TInt tempCounter ) -// Updates command button area -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::UpdateCommandButtonAreaL( TBool aMark, - TInt aTempCounter ) - { - if( aTempCounter>=0 && iResultArray.Count() ) - { - if( !aMark ) // no marked items in the list box - { - if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassImage ) ) || - ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassVideo ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__SHOW ); - } - else if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassAudio ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY ); - } - else if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassContainer ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN ); - } - else - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - } - else // at least one marked item in the list box - { - if( ( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassContainer ) ) ) - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN ); - } - else if( !IsAudioItemMarked() ) - { - //if no audio item have been marked. - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - else - { - if( !( UPnPItemUtility::BelongsToClass( - *iResultArray[aTempCounter], KClassAudio ) ) ) - { - UpdateSoftkeysL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - else - { - UpdateSoftkeysL( - R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__PLAY ); - } - } - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::UpdateCommandButtonArea( TBool aMark, TInt tempCounter ) -// Updates command button area -// -------------------------------------------------------------------------- -void CUPnPBrowseDialog::UpdateCommandButtonArea( TBool aMark, - TInt aTempCounter ) - { - TInt error = KErrNone; - TRAP( error, UpdateCommandButtonAreaL( aMark, aTempCounter ) ); - if( error ) - { - __LOG1( "UpdateCommandButtonAreaL error,error=%d", error ); - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpcommonui.cpp --- a/upnpframework/upnpcommonui/src/upnpcommonui.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,669 +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: Implementation of Common UI. -* -*/ - - -// INCLUDE FILES -// System -#include -#include -#include -#include -#include -#include //PathInfo - -// upnp stack api -#include - -// upnpframework / avcontroller api -#include "upnpavcontroller.h" -#include "upnpavrenderingsession.h" -#include "upnpavdevice.h" -#include "upnpmediaserversettings.h" - -// upnpframework / internal api's -#include "upnpmusicadapter.h" - -// commonui internal -#include "upnpcommonui.h" -#include -#include "upnpexternaldevicedialog.h" -#include "upnpbrowsedialog.h" -#include "upnpvideoplayerdialog.h" -#include "upnpadvfinddialog.h" -#include "upnpselectiondialog.h" - -// debug stuff -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -// CONSTANTS -// Filename of rsc file -_LIT( KUPnPCommonUiRscFile, "\\resource\\upnpcommonui.rsc" ); - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::CUPnPCommonUI -// -------------------------------------------------------------------------- -// -CUPnPCommonUI::CUPnPCommonUI() - { - __LOG( "CUPnPCommonUI::CUPnPCommonUI" ); - iFeatureManagerInitialized = EFalse; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::ConstructL() - { - __LOG( "CUPnPCommonUI::ConstructL" ); - - iCoeEnv = CEikonEnv::Static(); - RFs& fileSession = iCoeEnv->FsSession(); - - // Load common ui resource file - TFileName rscFileName( KUPnPCommonUiRscFile ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - rscFileName.Insert( 0, drive ); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - // Check if the resource file exists or not - if ( !BaflUtils::FileExists( fileSession, rscFileName ) ) - { - User::Leave( KErrNotFound ); - } - iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ); - - FeatureManager::InitializeLibL(); - iFeatureManagerInitialized = ETrue; - - // Get AppUI pointer - iAppUi = static_cast( iCoeEnv->EikAppUi() ); - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::NewL() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPCommonUI* CUPnPCommonUI::NewL() - { - __LOG( "CUPnPCommonUI::NewL" ); - - CUPnPCommonUI* self = new ( ELeave) CUPnPCommonUI(); - CleanupStack::PushL( self ); - - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPCommonUI::~CUPnPCommonUI() - { - __LOG( "CUPnPCommonUI::~CUPnPCommonUI" ); - - if ( iFeatureManagerInitialized ) - { - FeatureManager::UnInitializeLib(); - } - - // Un-Load resource file - if ( iResFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResFileOffset ); - iResFileOffset = 0; - } - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::ExecuteDeviceDialogL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CUPnPCommonUI::ExecuteDeviceDialogL( - MUPnPAVController& aAVControl ) - { - __LOG( "CUPnPCommonUI::ExecuteDeviceDialogL" ); - - TInt returnValue = KErrArgument; - - iExternalDeviceSelection = CUPnPExternalDeviceDialog::NewL( - R_UPNPCOMMONUI_EXTERNAL_DEVICE_DIALOG_MENUBAR, - aAVControl, - *this ); - - - iExternalDeviceSelection->SetMopParent( iAppUi ); - returnValue = iExternalDeviceSelection->ExecuteLD( - R_UPNPCOMMONUI_EXTERNAL_MEDIA_SELECT_DIALOG ); - iExternalDeviceSelection = NULL; - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::ExecuteBrowseDialogL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CUPnPCommonUI::ExecuteBrowseDialogL( - MUPnPAVController& aAVControl, - const CUpnpAVDevice& aDevice) - { - __LOG( "CUPnPCommonUI::ExecuteBrowseDialogL" ); - - - TInt returnValue = KErrArgument; - - TInt error = KErrNone; - - - iBrowseSelection = CUPnPBrowseDialog::NewL( - R_UPNPCOMMONUI_BROWSE_DIALOG_MENUBAR, aAVControl, aDevice, *this ); - - iBrowseSelection->SetMopParent( iAppUi ); - TRAP( error, returnValue = iBrowseSelection->ExecuteLD( - R_UPNPCOMMONUI_BROWSE_DIALOG ) ); - iBrowseSelection = NULL; - - if( error != KErrNone ) - { - returnValue = error; - } - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::ExecuteVideoPlayerL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CUPnPCommonUI::ExecuteVideoPlayerL( - MUPnPAVRenderingSession& aRenderingSession, - const CUpnpObject& aObject ) - { - __LOG( "CUPnPCommonUI::ExecuteVideoPlayerL" ); - - TInt returnValue = KErrArgument; - - iVideoPlayerDialog = CUPnPVideoPlayerDlg::NewL( - aRenderingSession, aObject, *this ); - iVideoPlayerDialog->SetMopParent( iAppUi ); - TRAPD( error, returnValue = iVideoPlayerDialog->ExecuteLD( - R_UPNPCOMMONUI_VIDEO_PLAYER_DIALOG ) ); - iVideoPlayerDialog = NULL; - - if( error != KErrNone ) - { - returnValue = error; - } - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::ExecuteMusicPlayerL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CUPnPCommonUI::ExecuteMusicPlayerL( - MUPnPAVController& aAVControl, - CUPnPPlayListFiller* aFiller, - const CUpnpAVDevice* aTargetDevice ) - { - TInt returnValue = KErrArgument; - - iMusicAdapter = CUPnPMusicAdapter::NewL( aAVControl ); - TInt error = KErrNone; - if( aTargetDevice ) - { - //play in remote - TRAP( error, returnValue = iMusicAdapter->ExecuteMusicInRemoteL( - iCoeEnv->EikAppUi(), - aFiller, - *aTargetDevice ) ); - } - else - { - //play in local - TRAP( error, returnValue = iMusicAdapter->ExecuteMusicInLocalL( - iCoeEnv->EikAppUi(), - aFiller ) ); - } - delete iMusicAdapter; - iMusicAdapter = 0; - - if( error != KErrNone ) - { - returnValue = error; - } - return returnValue; - } - - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::SelectDeviceL -// Displays a UPnP device selection pop-up dialog. -// -------------------------------------------------------------------------- -EXPORT_C TInt CUPnPCommonUI::SelectDeviceL( MUPnPAVController& aAVControl, - CUpnpAVDevice& aDevice, - TUPnPDeviceTypesToSearch aType, - TUPnPDialogTitle aTitle ) - { - __LOG( "CUPnPCommonUI::SelectDeviceL" ); - - - TInt returnValue = KErrGeneral; - - // Create the selection popup - delete iDeviceSelection; iDeviceSelection = NULL; - iDeviceSelection = CUPnPSelectionDialog::NewL( aAVControl ); - - // Read the title string - HBufC* title = NULL; - if( aTitle == EUPnPCopyToTitle ) - { - title = StringLoader::LoadLC( R_UPNPCOMMONUI_COPY_TO_TEXT ); - } - else if( aTitle == EUPnPMoveToTitle ) - { - title = StringLoader::LoadLC( R_UPNPCOMMONUI_MOVE_TO_TEXT ); - } - else - { - if( aType == EUPnPSearchRenderingDevicesWithAudioCapability ) - { - title = StringLoader::LoadLC( R_UPNPCOMMONUI_SELECT_PLAYER_TEXT ); - } - else - { - title = StringLoader::LoadLC( R_UPNPCOMMONUI_SELECT_DEVICE_TEXT ); - } - } - - if( aType == EUPnPSearchAllDevices || - aType == EUPnPSearchAllServerDevices || - aType == EUPnPSearchServerDevicesWithCopyCapability || - aType == EUPnPSearchServerDevicesWithSearchCapability || - aType == EUPnPSearchAllRenderingDevices || - aType == EUPnPSearchRenderingDevicesWithImageCapability || - aType == EUPnPSearchRenderingDevicesWithVideoCapability || - aType == EUPnPSearchRenderingDevicesWithImageAndVideoCapability || - aType == EUPnPSearchRenderingDevicesWithAudioCapability ) - { - iDeviceSelection->CreatePopupL( *title, aType ); - returnValue = iDeviceSelection->StartPopupL( aDevice ); - } - else - { - CleanupStack::PopAndDestroy( title ); - title = NULL; - return KErrNotSupported; - } - - // Clean up - CleanupStack::PopAndDestroy( title ); - title = NULL; - delete iDeviceSelection; iDeviceSelection = NULL; - - __LOG1( "CUPnPCommonUI::SelectDeviceL: %d", returnValue ); - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::DisplayConnectionErrorNote() -// Displays error note R_UPNP_ERROR_CON_TEXT -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPCommonUI::DisplayConnectionErrorNoteL() - { - HBufC* errorText = StringLoader::LoadLC( R_UPNPCOMMONUI_ERROR_CON_TEXT ); - CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue ); - errorNote->ExecuteLD( *errorText ); - CleanupStack::PopAndDestroy( errorText ); - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL() -// Displays error note R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL() - { - __LOG( "CUPnPCommonUI::DisplayConnectionLostCopyErrorNoteL" ); - HBufC* errorText = StringLoader::LoadLC( - R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT ); - CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue ); - errorNote->ExecuteLD( *errorText ); - CleanupStack::PopAndDestroy( errorText ); - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::ExecuteAdvFindDialogL() -// -------------------------------------------------------------------------- -// -TInt CUPnPCommonUI::ExecuteAdvFindDialogL( - MUPnPAVController& aAVControl, - MUPnPAVBrowsingSession& aBrowsingSession) - - { - __LOG( "CUPnPCommonUI::ExecuteAdvFindDialogL" ); - - - TInt returnValue = KErrArgument; - TInt error = KErrNone; - - iAdvFindDialog = CUPnPAdvancedFindDialog::NewL( - R_UPNPCOMMONUI_ADVANCED_FIND_MAIN_DIALOG, - aAVControl, - aBrowsingSession, - *this ); - - iAdvFindDialog->SetMopParent( iAppUi ); - - TRAP( error, returnValue = iAdvFindDialog->ExecuteLD( - R_UPNPCOMMONUI_ADVANCED_FIND_MAIN_DIALOG ) ); - - iAdvFindDialog = NULL; - - if( KErrNone != error ) - { - returnValue = error; - } - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::DismissDialogL() -// called only when the media server disconnected or WLAN connection is lost -// to close the dialogs which are running on the top of the mother class -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPCommonUI::DismissDialogL( TInt aError ) - { - if( iDeviceSelection && KErrSessionClosed == aError ) - { - iDeviceSelection->DismissItself( aError ); - } - - if( iVideoPlayerDialog ) - { - iVideoPlayerDialog->DismissItselfL( aError ); - iVideoPlayerDialog = NULL; - } - - if( iMusicAdapter ) - { - iMusicAdapter->Dismiss( aError ); - //iMusicAdapter = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::DisplayErrorTextL -// -// -------------------------------------------------------------------------- -void CUPnPCommonUI::DisplayErrorTextL( TInt aResource ) - { - CAknErrorNote* errorNote = new( ELeave )CAknErrorNote(); - errorNote->ExecuteLD( *StringLoader::LoadLC( aResource ) ); - CleanupStack::PopAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::DisplayErrorTextL -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::DisplayErrorTextL( TInt aResource, const TDesC& aInfo ) - { - HBufC* errorText = StringLoader::LoadLC( aResource, aInfo ); - CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue ); - errorNote->ExecuteLD( *errorText ); - CleanupStack::PopAndDestroy( errorText ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DisplayErrorNote -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::DisplayErrorTextL( TInt aResource, - TInt aMaxNumberOfResultsShown ) - { - HBufC* errorText = StringLoader::LoadLC( aResource, - aMaxNumberOfResultsShown ); - CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( ETrue ); - errorNote->ExecuteLD( *errorText ); - CleanupStack::PopAndDestroy( errorText ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DisplayInfoTextL -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::DisplayInfoTextL( TInt aResource, - TInt aNumberOfCopy ) - { - CAknInformationNote* errorNote = - new( ELeave )CAknInformationNote( ETrue ); - errorNote->ExecuteLD( *StringLoader::LoadLC( aResource, - aNumberOfCopy ) ); - CleanupStack::PopAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DisplayInfoTextL -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::DisplayInfoTextL( TInt aResource ) - { - CAknInformationNote* errorNote = - new( ELeave )CAknInformationNote( ); - errorNote->ExecuteLD( *StringLoader::LoadLC( aResource ) ); - CleanupStack::PopAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::PresenceOfDialog -// -------------------------------------------------------------------------- -// -TBool CUPnPCommonUI::PresenceOfDialog() - { - if( iBrowseSelection || iAdvFindDialog || iDeviceSelection ) - { - return ETrue; - } - return EFalse; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::GetUpnpAction() -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::GetUpnpAction( TUPnPAction aAction ) - { - iAction = aAction; - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::HandleCommonErrorL -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::HandleCommonErrorL( TInt aError, - TInt aCopyIndex ) - { - - //specified errors for every action should be handled first - // common erros last - __LOG1( "CUPnPCommonUI::HandleCommonErrorL: %d", aError ); - - if( KErrNone <= aError && ( iAction == CUPnPCommonUI::EUPnPNone || - iAction != CUPnPCommonUI::EUPnPCopy ) ) - { - iAction = EUPnPNone; - return; - } - switch( aError ) - { - case KErrCancel: - { - break; - } - case KErrServerBusy: - { - DisplayErrorTextL( R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT ); - break; - } - case KErrNoMemory: - { - DisplayErrorTextL( R_UPNPCOMMONUI_NOMEMORY_TEXT ); - break; - } - case KErrDiskFull: - { - HBufC* copyLocation = HBufC::NewLC( KMaxFileName ); - TPtr copyLocationPtr( copyLocation->Des() ); - GetCopyLocationL( copyLocationPtr ); - TPtr driveName = copyLocationPtr.LeftTPtr( 2 ); - DisplayErrorTextL( R_UPNPCOMMONUI_DEVICE_MEMORY_LOW, driveName ); - CleanupStack::PopAndDestroy( copyLocation ); - break; - } - case KErrSessionClosed: - case KErrDisconnected: - { - if( iAction == CUPnPCommonUI::EUPnPCopy ) - { - //Connection lost, some files may not be copied - DisplayErrorTextL( R_UPNPCOMMONUI_CONN_LOST_COPY_ERROR_TEXT ); - } - else if( KErrSessionClosed == aError && - iAction != CUPnPCommonUI::EUPnPCopy ) - { - //connection failed - DisplayErrorTextL( R_UPNPCOMMONUI_ERROR_CON_TEXT ); - } - delete iBrowseSelection; - iBrowseSelection = NULL; - break; - } - case KErrNotSupported: - { - //Selected device does not support this operation - DisplayErrorTextL( R_UPNPCOMMONUI_NOT_SUPPORTED_ERROR_TEXT ); - break; - } - default: - { - if( iAction != EUPnPNone ) - { - if( iAction == EUPnPCopy ) - { - if( KErrNone == aError ) - { - if( aCopyIndex == 1) //copying single item OK - { - DisplayInfoTextL( - R_UPNPCOMMONUI_INFO_COPY_ONE_TEXT ); - } - else if( aCopyIndex > 1 ) //copying multi items OK - { - DisplayInfoTextL( - R_UPNPCOMMONUI_INFO_COPY_MANY_TEXT, - aCopyIndex ); - } - else - { - // - } - } - else - { - if( KErrNotFound == aError ) - { - if( aCopyIndex ) //copying a container - { - //"Container does not contain any items." - DisplayErrorTextL( - R_UPNPCOMMONUI_NO_ITEMS_TO_PLAY_TEXT ); - } - else - { - //copy failed - DisplayErrorTextL( - R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT ); - } - } - else //if copying, unkown error - { - //copy failed - DisplayErrorTextL( - R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT ); - } - } - } - else if( iAction == EUPnPShow ) - { - if( KErrNone != aError ) - { - //Playback failed on the remote device for - //unknown error. Try again - DisplayErrorTextL( - R_UPNPCOMMONUI_RENDERING_FAILED_UNKNOWN_ERROR_TEXT ); - } - } - else - { - if( KErrNone != aError ) - { - //Selected device refused the operation - DisplayErrorTextL( - R_UPNPCOMMONUI_GENERAL_FAILURE_ERROR_TEXT ); - } - } - }//if( iAction != EUPnPNone ) - - break; - }//default: - - } // switch( aError ) - - iAction = EUPnPNone; - } - -// -------------------------------------------------------------------------- -// CUPnPCommonUI::GetCopyLocationL -// -------------------------------------------------------------------------- -// -void CUPnPCommonUI::GetCopyLocationL( TDes& aLocation ) const - { - // Get instance of Server Settings object - CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL(); - CleanupStack::PushL( settings ); - - // Get the location setting from ServerSettings - settings->Get( UpnpMediaServerSettings::EUploadDirectory, aLocation ); - - CleanupStack::PopAndDestroy( settings ); - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpexternaldevicedialog.cpp --- a/upnpframework/upnpcommonui/src/upnpexternaldevicedialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,813 +0,0 @@ -/* -* Copyright (c) 2005 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: Source file for UPnP External device dialog -* UI Implementation -* -*/ - - -// INCLUDE FILES -// System -#include // CAknNavigationDecorator -#include // TResourceReader -#include -#include -#include -#include -#include -#include -#include - -// upnpframework / avcontroller api -#include "upnpavdevice.h" -#include "upnpavcontroller.h" -#include "upnpavbrowsingsession.h" -#include "upnpavdevicelist.h" - -// upnpframework / internal api's -#include "upnpcommonutils.h" - -// common ui internal -#include "upnpadvfinddialog.h" -#include "upnpcommonui.hrh" -#include "upnpexternaldevicedialog.h" -#include -#include //for icons -#include "upnpcommonui.h" -#include "upnpnavipanecontainer.h" - -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -// CONSTANTS -_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" ); -const TInt KLength = 100; -_LIT(KUPNP_HLP_MAIN_EXTERNAL,"UPNP_HLP_MAIN_EXTERNAL"); - - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::CUPnPExternalDeviceDialog -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPExternalDeviceDialog::CUPnPExternalDeviceDialog( - MUPnPAVController& aAVControl, - CUPnPCommonUI& aCommonUI): - iAVControl(aAVControl), - iCommonUI(aCommonUI) - { - iPreDeviceObserver = iAVControl.DeviceObserver(); - iAVControl.RemoveDeviceObserver(); - iAVControl.SetDeviceObserver( *this ); - } - -// Destructor -CUPnPExternalDeviceDialog::~CUPnPExternalDeviceDialog() - { - __LOG( "CUPnPExternalDeviceDialog::~CUPnPExternalDeviceDialog" ); - - delete iDeviceArray; - iAVControl.RemoveDeviceObserver(); - - if( iPreDeviceObserver ) - { - iAVControl.SetDeviceObserver( *iPreDeviceObserver ); - } - - if ( iNaviDecorator && iNaviPaneContainer ) - { - iNaviPaneContainer->Pop( iNaviDecorator ); - } - delete iNaviDecorator; - iNaviDecorator = NULL; - - __LOG( "CUPnPExternalDeviceDialog::~CUPnPExternalDeviceDialog End." ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::ConstructL( TInt aMenuResource ) - { - __LOG( "CUPnPExternalDeviceDialog::ConstructL" ); - - iDeviceArray = CUpnpAVDeviceList::NewL(); - - CAknDialog::ConstructL( aMenuResource ); - __LOG( "CUPnPExternalDeviceDialog::ConstructL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPExternalDeviceDialog* CUPnPExternalDeviceDialog::NewL( - TInt aMenuResource, - MUPnPAVController& aAVControl, - CUPnPCommonUI& aCommonUI) - { - __LOG( "CUPnPExternalDeviceDialog::NewL" ); - - CUPnPExternalDeviceDialog* self = - new ( ELeave ) CUPnPExternalDeviceDialog( aAVControl, - aCommonUI ); - CleanupStack::PushL( self ); - self->ConstructL( aMenuResource ); - CleanupStack::Pop(); - __LOG( "CUPnPExternalDeviceDialog::NewL End" ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::PreLayoutDynInitL(); -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::PreLayoutDynInitL() - { - __LOG( "CUPnPExternalDeviceDialog::PreLayoutDynInitL" ); - - // Create dialog title text - CEikStatusPane* statusPane = - ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); - iTitlePane = ( CAknTitlePane* )statusPane->ControlL( - TUid::Uid( EEikStatusPaneUidTitle ) ); - iTitlePane->SetTextL( *StringLoader::LoadLC( - R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE ) ); - CleanupStack::PopAndDestroy(); - - iListBox = static_cast - ( Control( EUPnPExternDevicesListBoxId ) ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - - - CAknIconArray* icons = new ( ELeave ) CAknIconArray( 3 ); - CleanupStack::PushL(icons); - - // Mif icons - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) ); - - // Folder icon - - TFileName mbmFileName( KAknCommonUIMbmFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - mbmFileName.Insert( 0, drive ); - - AppendIconToArrayL( icons, skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_server_icon, - EMbmUpnpcommonuiQgn_server_icon_mask ); - - - iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); - - CleanupStack::Pop( icons ); - - // Enable horizontal scrolling - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - - DisplayMediaServersL(); - - if ( !iDeviceArray->Count() ) - { - // show "Waiting devices" text - iListBox->View()->SetListEmptyTextL( - *StringLoader::LoadLC( R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE ) ); - CleanupStack::PopAndDestroy(); - } - else - { - CEikButtonGroupContainer* cba = &ButtonGroupContainer(); - cba->SetCommandSetL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN ); - cba->DrawDeferred(); - } - __LOG( "CUPnPExternalDeviceDialog::PreLayoutDynInitL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::PostLayoutDynInitL(); -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::PostLayoutDynInitL() - { - iNaviPaneActive = ETrue; - UpDateAnimationWindowL(iNaviPaneActive);//DateAnimationWindow(); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::OkToExitL(TInt aButtonId) -// see upnpexternaldevicedialog.h -// -------------------------------------------------------------------------- -// -TBool CUPnPExternalDeviceDialog::OkToExitL( TInt aButtonId ) - { - __LOG( "CUPnPExternalDeviceDialog::OkToExitL" ); - - TBool returnValue = EFalse; - iCommonUI.HandleCommonErrorL( aButtonId, NULL ); - // Translate the button presses into commands for the appui & current - // view to handle - switch ( aButtonId ) - { - case EAknSoftkeyOptions: - { - DisplayMenuL(); - break; - } - case EAknSoftkeyOpen: //fall through - case EAknSoftkeyOk: - { - CTextListBoxModel *model = iListBox->Model(); - - if (model->NumberOfItems()) //browse only if list have items - { - iNaviPaneActive = EFalse; - UpDateAnimationWindowL(iNaviPaneActive); - - TInt ret = ExecuteBrowseL(); - if (ret == EAknCmdExit || - ret == EEikCmdExit || - ret == KErrDisconnected || - ret == KErrSessionClosed - ) - { - TryExitL( ret ); - } - else - { - DisplayMediaServersL(); - iNaviPaneActive = ETrue; - UpDateAnimationWindowL(iNaviPaneActive); - } - } - break; - } - case EAknSoftkeyBack: // fall through - case EUPnPBackCmd: // fall through - case EAknSoftkeyCancel: // fall through - case EAknSoftkeyExit: // fall through - case EAknCmdExit: // fall through - case EEikCmdExit: // fall through - case KErrNotReady: // fall through - case KErrDisconnected: - { - if( iTitlePane ) - { - iTitlePane->SetTextToDefaultL(); - } - returnValue = ETrue; //back to previous dialog - break; - } - case KErrSessionClosed: - { - DisplayMediaServersL(); - iNaviPaneActive = ETrue; - UpDateAnimationWindowL(iNaviPaneActive); - - break; - } - default: - { - // ignore - } - } - - __LOG( "CUPnPExternalDeviceDialog::OkToExitL End." ); - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDevice::DynInitMenuPaneL(TInt aResourceId, -// CEikMenuPane *aMenuPane) -// called by framework before menu panel is shown -// -------------------------------------------------------------------------- -void CUPnPExternalDeviceDialog::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane *aMenuPane ) - { - __LOG( "CUPnPExternalDeviceDialog::DynInitMenuPaneL" ); - - if( aResourceId == R_UPNPCOMMONUI_EXTERNAL_DEVICE_OPTION_MENU ) - { - // Hide menu items if empty list - CTextListBoxModel *model = iListBox->Model(); - if ( !model->NumberOfItems() ) - { - aMenuPane->SetItemDimmed( EUPnPOpen, ETrue ); - aMenuPane->SetItemDimmed( EUPnPFind, ETrue ); - } - - // Hide "Find" if the currently focused device does not support it - TInt selected_item = iListBox->CurrentItemIndex(); - if( selected_item >= 0 && - !( *iDeviceArray )[ selected_item ]->SearchCapability() ) - { - aMenuPane->SetItemDimmed( EUPnPFind, ETrue ); - } - - // Hide "Help" if the help file is not available - if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - aMenuPane->SetItemDimmed( EUPnPHelp, ETrue ); - } - } - __LOG( "CUPnPExternalDeviceDialog::DynInitMenuPaneL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::ProcessCommandL(TInt aCommand) -// called by framework when menu item is selected -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::ProcessCommandL( TInt aCommand ) - { - __LOG( "CUPnPExternalDeviceDialog::ProcessCommandL" ); - - TInt error = KErrNone; - HideMenu(); - switch ( aCommand ) - { - case EAknCmdExit: - case EEikCmdExit: - { - TryExitL( aCommand ); - break; - } - case EUPnPOpen: - { - iNaviPaneActive = EFalse; - UpDateAnimationWindowL(iNaviPaneActive); - - error = ExecuteBrowseL(); - if ( error == EAknCmdExit || - error == EEikCmdExit || - error == KErrDisconnected || - error == KErrSessionClosed ) - { - TryExitL( error ); - } - else - { - DisplayMediaServersL(); - iNaviPaneActive = ETrue; - UpDateAnimationWindowL(iNaviPaneActive); - } - break; - } - case EUPnPFind: - { - iNaviPaneActive = EFalse; - UpDateAnimationWindowL(iNaviPaneActive); - - error = ExecuteFindL(); - if ( error == EAknCmdExit || - error == EEikCmdExit || - error == KErrDisconnected || - error == KErrNotReady || - error == KErrSessionClosed ) - { - TryExitL( error ); - } - else - { - iNaviPaneActive = ETrue; - UpDateAnimationWindowL(iNaviPaneActive); - } - break; - } - case EUPnPHelp: - { - iNaviPaneActive = EFalse; - UpDateAnimationWindowL(iNaviPaneActive); - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() ); - iNaviPaneActive = ETrue; - UpDateAnimationWindowL(iNaviPaneActive); - break; - } - default: - break; - } - __LOG( "CUPnPExternalDeviceDialog::ProcessCommandL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::UPnPDeviceDiscovered -// Returns discovered device from UPnP AV control point. -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::UPnPDeviceDiscovered( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered" ); - TInt error = KErrNone; - TRAP( error, UPnPDeviceDiscoveredL( aDevice ) ); - - __LOG1( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered %d", error); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::UPnPDeviceDiscoveredL -// Returns discovered device from UPnP AV control point. -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::UPnPDeviceDiscoveredL( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered" ); - - // Display only Media servers - if( aDevice.DeviceType() == CUpnpAVDevice::EMediaServer ) - { - CUpnpAVDevice* tempDevice = CUpnpAVDevice::NewL( aDevice ) ; - - CleanupStack::PushL( tempDevice ); - iDeviceArray->AppendDeviceL( *tempDevice ); - CleanupStack::Pop( tempDevice ); - - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - ( ( CUpnpAVDevice* )tempDevice )->FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - CTextListBoxModel* model = iListBox->Model(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - TBuf<256> item; - - HBufC *tmpbuf = UpnpString::ToUnicodeL( friendlyname.Left( KLength ) ); - CleanupStack::PushL( tmpbuf ); - - item.Format( _L( "%d\t%S\t\t" ),0, tmpbuf ); - CleanupStack::PopAndDestroy( tmpbuf ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - - listBoxItems->AppendL( item ); - iListBox->HandleItemAdditionL(); // Update listbox - - iListBox->ActivateL(); - iListBox->DrawDeferred(); - - //update menu pane - CEikButtonGroupContainer* cba = &ButtonGroupContainer(); - - cba->SetCommandSetL( R_UPNPCOMMONUI_SOFTKEYS_OPTIONS_BACK__OPEN ); - cba->DrawDeferred(); - } - __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDiscovered End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::UPnPDeviceDisappeared -// Returns disappeared device from UPnP AV control point. -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::UPnPDeviceDisappeared( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDisappeared" ); - - TRAP_IGNORE( UPnPDeviceDisappearedL( aDevice ) ); - - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::UPnPDeviceDisappearedL -// Returns disappeared device from UPnP AV control point. -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::UPnPDeviceDisappearedL( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDissapearedL" ); - - CTextListBoxModel* model = iListBox->Model(); - TInt currentItem = iListBox->CurrentItemIndex(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - TInt i = 0; - TPtrC8 ptr(aDevice.Uuid()); - while( i < iDeviceArray->Count() && - ptr.Compare( ( *iDeviceArray)[ i ]->Uuid() ) ) - { - i++; - } - if ( i < iDeviceArray->Count() ) - { - iDeviceArray->RemoveAndDestroy( i ); - listBoxItems->Delete( i,1 ); - AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( - iListBox, currentItem, ETrue ); - iListBox->DrawDeferred(); - } - - if ( !iDeviceArray->Count() ) - { - // show "Waiting devices" text - iListBox->View()->SetListEmptyTextL( - *StringLoader::LoadLC( R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE ) ); - CleanupStack::PopAndDestroy(); // R_EXTERNAL_WAITING_NOTE - - CEikButtonGroupContainer* cba = &ButtonGroupContainer(); - cba->SetCommandSetL( R_UPNPCOMMONUI_SOFTKEYS_EMPTY_BACK ); - cba->DrawDeferred(); - } - - __LOG( "CUPnPExternalDeviceDialog::UPnPDeviceDissapearedL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::AppendIconToArrayL -// Load a possibly skinned icon (with mask) and append it to an -// icon array. -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ) - { - __LOG( "CUPnPExternalDeviceDialog::AppendIconToArrayL" ); - - __ASSERTD( aArray != NULL, __FILE__, __LINE__ ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC( aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId ); - - CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); - icon->SetBitmapsOwnedExternally( EFalse ); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop( 2 ); // mask, bitmap - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL( icon ); - aArray->AppendL( icon ); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(); - __LOG( "CUPnPExternalDeviceDialog::AppendIconToArrayL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPBrowseDialog::DisplayMediaServersL -// Add visible Media Servers to Listbox of dialog -// -------------------------------------------------------------------------- -void CUPnPExternalDeviceDialog::DisplayMediaServersL() - { - __LOG( "CUPnPExternalDeviceDialog::DisplayMediaServersL" ); - - CTextListBoxModel* model = iListBox->Model(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - - //clear list - delete iDeviceArray; iDeviceArray = NULL; - listBoxItems->Reset(); - - TBuf<256> item; - - iDeviceArray=iAVControl.GetMediaServersL(); - - - if ( iDeviceArray->Count() ) - { - for ( TInt i=0; i < iDeviceArray->Count(); i++ ) - { - // Get device frienly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - ( *iDeviceArray )[ i ]->FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - HBufC* tmpbuf = UpnpString::ToUnicodeL( - friendlyname.Left( KLength ) ); - CleanupStack::PushL( tmpbuf ); - item.Format( _L( "%d\t%S\t\t" ),0, tmpbuf ); - CleanupStack::PopAndDestroy( tmpbuf ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - listBoxItems->AppendL( item ); - } - - iListBox->HandleItemAdditionL(); // Update listbox - iListBox->SetCurrentItemIndexAndDraw( 0 ); // select new item - } - __LOG( "CUPnPExternalDeviceDialog::DisplayMediaServersL End" ); - } - - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::ExecuteBrowseL -// see upnpexternaldevicedialog.h -// -------------------------------------------------------------------------- -TInt CUPnPExternalDeviceDialog::ExecuteBrowseL() - { - __LOG( "CUPnPExternalDeviceDialog::ExecuteBrowseL" ); - - TInt selected_item = iListBox->CurrentItemIndex(); - - const CUpnpAVDevice* selectedDevice = ( *iDeviceArray )[ selected_item ]; - - TInt ret = iCommonUI.ExecuteBrowseDialogL( - iAVControl, *selectedDevice ); - - iTitlePane->SetTextL( *StringLoader::LoadLC( - R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE ) ); - CleanupStack::PopAndDestroy(); - - - __LOG( "CUPnPExternalDeviceDialog::ExecuteBrowseL End" ); - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::ExecuteFindL -// see upnpexternaldevicedialog.h -// -------------------------------------------------------------------------- -TInt CUPnPExternalDeviceDialog::ExecuteFindL() - { - __LOG( "CUPnPExternalDeviceDialog::ExecuteFindL" ); - - TInt ret = KErrNone; - TInt selected_item = iListBox->CurrentItemIndex(); - CUpnpAVDevice* selectedDevice = - ( *iDeviceArray )[ selected_item ]; - - if( selectedDevice ) - { - //create a browsessesion only for advFind dialog - - MUPnPAVBrowsingSession* browsingSession = NULL; - browsingSession = &( iAVControl.StartBrowsingSessionL( - *selectedDevice ) ); - - ret = iCommonUI.ExecuteAdvFindDialogL( iAVControl, - *browsingSession ); - browsingSession->RemoveObserver(); - iAVControl.StopBrowsingSession( *browsingSession ); - } - - if( KErrDisconnected != ret ) //if not WLAN lost - { - DisplayMediaServersL(); - } - - __LOG( "CUPnPExternalDeviceDialog::ExecuteFindL End" ); - return ret; - } - - - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::WLANConnectionLost -// see upnpexternaldevicedialog.h -// -------------------------------------------------------------------------- -void CUPnPExternalDeviceDialog::WLANConnectionLost() - { - __LOG( "CUPnPExternalDeviceDialog::WLANConnectionLost" ); - //if no dialog created in CUPnPExternalDeviceDialog, destory itself - //Otherwise destory other dialogs like in normal by KErrAbort - if( !iCommonUI.PresenceOfDialog() ) - { - TRAP_IGNORE( TryExitL( KErrDisconnected ) ); - } - - } - - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::GetHelpContext -// see upnpexternaldevicedialog.h -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::GetHelpContext( - TCoeHelpContext& aContext ) const - { - __LOG( "CUPnPExternalDeviceDialog::GetHelpContext" ); - -// aContext.iMajor = TUid::Uid( KMediaGalleryUID3 ); - aContext.iContext = KUPNP_HLP_MAIN_EXTERNAL; - - __LOG( "CUPnPExternalDeviceDialog::GetHelpContext End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::UpDateAnimationWindowL -// see upnpexternaldevicedialog.h -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::UpDateAnimationWindowL(TBool aAnimationState) - { - __LOG( "CUPnPExternalDeviceDialog::UpDateAnimationWindowL" ); - if ( iNaviDecorator ) - { - iNaviPaneContainer->Pop( iNaviDecorator ); - } - - // destroy iNaviDecorator - delete iNaviDecorator; - iNaviDecorator = NULL; - - if ( ( !Layout_Meta_Data::IsLandscapeOrientation() ) - && ( aAnimationState ) ) - { - iStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); - - TBool naviFaded = iStatusPane->IsFaded(); - - if (!naviFaded) - { - iNaviPaneContainer = ( CAknNavigationControlContainer* ) - iStatusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); - - TPoint screenPosition = iNaviPaneContainer-> - PositionRelativeToScreen(); - /** - * adjust the screen position so that the "Searching..." could be - * exactly in that "blue" NaviPane - */ - screenPosition.iY = screenPosition.iY+1; - iNaviContainer = CUPnPNaviPaneContainer::NewL( - iNaviPaneContainer->Rect(), - screenPosition, - iNaviPaneContainer ); - - iNaviDecorator = CAknNavigationDecorator::NewL( - iNaviPaneContainer, iNaviContainer ); - iNaviDecorator->SetContainerWindowL( *iNaviPaneContainer ); - iNaviDecorator->MakeScrollButtonVisible(EFalse); - iNaviDecorator->SetComponentsToInheritVisibility( ETrue ); - iNaviPaneContainer->PushL( *iNaviDecorator ); - } - } - iListBox->ActivateL(); - - __LOG( "CUPnPExternalDeviceDialog::UpDateAnimationWindowL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPExternalDeviceDialog::HandleResourceChange -// -------------------------------------------------------------------------- -// -void CUPnPExternalDeviceDialog::HandleResourceChange(TInt aType) - { - __LOG("[UPnPCommonUI]\t CUPnPExternalDeviceDialog::HandleResourceChange"); - CAknDialog::HandleResourceChange(aType); - - // Update Titlepane only if there is no other dialogs open - if( !iCommonUI.PresenceOfDialog() ) - { - __LOG("[UPnPCommonUI]\t CUPnPExternalDeviceDialog::HandleResourceChange\ -updating iTitlePane"); - - TRAPD( err, - iTitlePane->SetTextL( *StringLoader::LoadLC( - R_UPNPCOMMONUI_EXTERNAL_MEDIA_TITLE ) ); - CleanupStack::PopAndDestroy(); - ); - - if( err != KErrNone ) - { - __LOG("[UPnPCommonUI]\t CUPnPExternalDeviceDialog::HandleResourceChange\ -iTitlePane->SetTextL failed"); - } - } - - if (iNaviPaneActive) - { - TRAP_IGNORE( UpDateAnimationWindowL(iNaviPaneActive) ); - } - } -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpimageplayer.cpp --- a/upnpframework/upnpcommonui/src/upnpimageplayer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,305 +0,0 @@ -/* -* Copyright (c) 2006 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: Plays remote images on a renderer -* -*/ - - -// INCLUDE FILES -// System -#include - -// upnp stack api -#include -#include - -// upnpframework / avcontroller api -#include "upnpavcontroller.h" -#include "upnpavrenderingsession.h" -#include "upnpavdevice.h" - -// upnpframework / avcontroller helper api -#include "upnpitemutility.h" // ResourceFromItemL - -// upnpframework / internal api's -#include "upnpcdsreselementutility.h" - -// commonui internal -#include "upnpimageplayer.h" -#include "upnpdeviceobserver.h" -#include - -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::CUpnpAVDevice -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpImagePlayer::CUpnpImagePlayer( MUPnPAVController& aAVControl, - MUPnPDeviceObserver& aDialog, - CUPnPCommonUI& aCommonUI ): - iAVControl(aAVControl), - iDialog(aDialog), - iCommonUI(aCommonUI) - { - __LOG( "CUpnpImagePlayer::CUpnpImagePlayer" ); - iImageState = EImageIdle; - iFirstStart = ETrue; - iAction = CUPnPCommonUI::EUPnPNone; - __LOG( "CUpnpImagePlayer::CUpnpImagePlayer end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::ConstructL() - { - - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUpnpImagePlayer* CUpnpImagePlayer::NewL( - MUPnPAVController& aAVControl, - MUPnPDeviceObserver& aDialog, - CUPnPCommonUI& aCommonUI ) - { - __LOG( "CUpnpImagePlayer::NewL" ); - CUpnpImagePlayer* self = new( ELeave )CUpnpImagePlayer( aAVControl, - aDialog, - aCommonUI ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - __LOG( "CUpnpImagePlayer::NewL end" ); - return self; - } - -// Destructor -CUpnpImagePlayer::~CUpnpImagePlayer() - { - __LOG( "CUpnpImagePlayer::~CUpnpImagePlayer" ); - - Stop(); - delete iUri; - __LOG( "CUpnpImagePlayer::~CUpnpImagePlayer end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::SetTargetDeviceL -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::SetTargetDeviceL( const CUpnpAVDevice& aTargetDevice ) - { - __LOG( "CUpnpImagePlayer::SetTargetDeviceL" ); - iTargetDevice = &aTargetDevice; - iImageState = EImageIdle; - - if( iRendSession ) - { - iRendSession->RemoveObserver(); - iAVControl.StopRenderingSession( *iRendSession ); - iRendSession = NULL; - } - iRendSession = &iAVControl.StartRenderingSessionL( *iTargetDevice ); - iRendSession->SetObserver( *this ); - - __LOG( "CUpnpImagePlayer::SetTargetDeviceL end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::PlayL -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::PlayL( const CUpnpObject& aItem ) - { - __LOG( "CUpnpImagePlayer::PlayL" ); - - iAction = CUPnPCommonUI::EUPnPShow; - iItem = static_cast( &aItem ); - delete iUri; iUri = NULL; - - iUri = UPnPItemUtility::ResourceFromItemL( *iItem ).Value().AllocL(); - - if( iImageState == EImageIdle ) - { - if( iFirstStart ) - { - iRendSession->SetURIL( *iUri, *iItem ); //not possible to leave - iImageState = EImageInitialising; - delete iUri; iUri = NULL; - } - else //stopping previously played item - { - iRendSession->StopL(); - iImageState = EImageNext; - } - } - else - { - iImageState = EImageNext; - } - - __LOG( "CUpnpImagePlayer::PlayL end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::Stop -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::Stop() - { - if( iRendSession ) - { - iImageState = EImageIdle; - iFirstStart = ETrue; - TRAP_IGNORE( iRendSession->StopL() ); - iRendSession->RemoveObserver(); - iAVControl.StopRenderingSession( *iRendSession ); - iRendSession = NULL; - } - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::InteractOperationComplete -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::InteractOperationComplete( - TInt aError, - TUPnPAVInteractOperation aOperation - ) - { - __LOG2( "CUpnpImagePlayer::InteractOperationComplete: %d, %d", - aError, aOperation ); - TRAP_IGNORE( InteractOperationCompleteL( aError, aOperation ) ); - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::InteractOperationCompleteL -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::InteractOperationCompleteL( - TInt aError, - TUPnPAVInteractOperation aOperation - ) - { - iCommonUI.HandleCommonErrorL( aError, NULL ); - - switch( aOperation ) - { - case EUPnPAVPlay: - { - if( iFirstStart ) - { - iFirstStart = EFalse; - } - - if( iImageState == EImageNext ) //if still there is a pending item - { //stop current showing item - iRendSession->StopL(); - } - else - { - iImageState = EImageIdle; - } - } - break; - case EUPnPAVStop: - { - if( iUri && iImageState == EImageNext ) - { - iAction = CUPnPCommonUI::EUPnPShow; - iRendSession->SetURIL( *iUri, *iItem ); - iImageState = EImageInitialising; - delete iUri; iUri = NULL; - } - } - break; - } - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::SetURIResult -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::SetURIResult( TInt aError ) - { - __LOG1( "CUpnpImagePlayer::SetURIResult: %d", aError ); - - TRAP_IGNORE( SetURIResultL( aError ) ); - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::SetURIResultL -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::SetURIResultL( TInt aError ) - { - iCommonUI.GetUpnpAction( iAction ); - iCommonUI.HandleCommonErrorL( aError, NULL ); - if( iImageState == EImageNext ) //if there is another pending item - { - if( iUri ) - { - iRendSession->SetURIL( *iUri, *iItem ); //not possible to leave - iImageState = EImageInitialising; - delete iUri; iUri = NULL; - } - else - { - iImageState = EImageIdle; - iCommonUI.GetUpnpAction( iAction ); - iCommonUI.HandleCommonErrorL( KErrNotFound, NULL ); - } - } - else //if no pending item - { - if( KErrNone == aError ) - { - iRendSession->PlayL(); //not possible to leave - iImageState = EImageShowing; - } - else - { - iImageState = EImageIdle; - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpAVDevice::PlayL -// -------------------------------------------------------------------------- -// -void CUpnpImagePlayer::MediaRendererDisappeared( - TUPnPDeviceDisconnectedReason aReason ) - { - if( aReason == EDisconnected ) - { - iDialog.DeviceDisappeared( KErrSessionClosed ); - } - - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnplocalplayer.cpp --- a/upnpframework/upnpcommonui/src/upnplocalplayer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,679 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Plays remote images and videos locally on the device -* -*/ - - -// INCLUDE FILES -// System -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// upnp specific MACRO definition -#include "upnpconstantdefs.h" -// upnp stack api -#include -#include -#include - -// upnp framework / avcontroller api -#include "upnpavcontroller.h" // MUPnPAVController -#include "upnpfiledownloadsession.h" // MUPnPFileDownloadSession -#include "upnpavbrowsingsession.h" - -// upnp framework / avcontroller helper api -#include "upnpdlnautility.h" -#include "upnpitemutility.h" -#include "upnpfileutility.h" - -// upnp framework / internal api's -#include "upnpcommonutils.h" -#include "upnpsettingsengine.h" // get selected download location - -// USER INCLUDE FILES -#include "upnpcommonui.h" -#include "upnplocalplayer.h" -#include "upnpdeviceobserver.h" - -// DEBUG -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -// CONSTANT DEFINITIONS -_LIT8( KProtocolInfo, "protocolInfo" ); -_LIT8( KHttpDes, "http://" ); -_LIT8( KHttpGetDes, "http-get" ); -_LIT8( KHttpEqual, "=" ); - -const TInt KDownloadPosition = 0; - -// Video mimetypes that can be played on device - - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::CUPnPLocalPlayer -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPLocalPlayer::CUPnPLocalPlayer( MUPnPAVController& aAVController, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ): - iCommonUI(aCommonUI) - { - __LOG( "CUPnPLocalPlayer::CUPnPLocalPlayer" ); - iAVController = &aAVController; - iExitReason = KErrNone; - iBrowseSession = &aBrowseSession; - __LOG( "CUPnPLocalPlayer::CUPnPLocalPlayer-END" ); - } - - - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPLocalPlayer::ConstructL() - { - __LOG( "CUPnPLocalPlayer::ConstructL" ); - iDocumentHandler = CDocumentHandler::NewL(); - iDocumentHandler->SetExitObserver( this ); - User::LeaveIfError( iFs.Connect() ); - iDownloadSession = &iAVController->StartDownloadSessionL( - iBrowseSession->Device() ); - __LOG( "CUPnPLocalPlayer::ConstructL-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPLocalPlayer* CUPnPLocalPlayer::NewL( - MUPnPAVController& aAVController, - MUPnPAVBrowsingSession& aBrowseSession, - CUPnPCommonUI& aCommonUI ) - { - CUPnPLocalPlayer* self = new( ELeave )CUPnPLocalPlayer( aAVController, - aBrowseSession, - aCommonUI ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - __LOG( "CUPnPLocalPlayer::NewL-END" ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::~CUPnPLocalPlayer -// Destructor. -// -------------------------------------------------------------------------- -// -CUPnPLocalPlayer::~CUPnPLocalPlayer() - { - __LOG( "CUPnPLocalPlayer::~CUPnPLocalPlayer" ); - - // If download session is running, stop it - if( iAVController && - iDownloadSession ) - { - iAVController->StopDownloadSession( *iDownloadSession ); - } - - delete iDocumentHandler; - - delete iWaitNoteDialog; - - delete iItem; - - if( iFilePath ) - { - iFs.Delete( *iFilePath ); - delete iFilePath; - } - iFs.Close(); - - __LOG( "CUPnPLocalPlayer::~CUPnPLocalPlayer-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::PlayL -// Play a selected item. -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPLocalPlayer::PlayL( const CUpnpObject& aItem ) - { - __LOG( "CUPnPLocalPlayer::PlayL" ); - - // recreate iItem - delete iItem; iItem = NULL; - iItem = CUpnpItem::NewL(); - iItem->CopyL( aItem ); - - if ( !IsLocallySupportedL( *iItem ) ) - { - User::Leave( KErrNotSupported ); - } - - //in order not to get two callbacks when MS is lost, - // in CUPnPLocalPlayer and CUPnPBrowseDialog - iBrowseSessionObserver = iBrowseSession->Observer(); - iBrowseSession->RemoveObserver(); - iFs.Close(); - - User::LeaveIfError( iFs.Connect() ); - User::LeaveIfError( iFs.ShareProtected() ); - delete iFilePath; iFilePath = NULL; - iExitReason = KErrNone; - iDownloadSession->SetObserver( *this ); - - /** - * All the temporiarily downloaded files should go to the - * hidden folder \data\download\media\temp - * fix for ETLU-7LKCJB - */ - //create a file path which should contain the absolute file path - //e.g c:\data\download\media\temp\image.jpg - - iFilePath = HBufC::NewL( KMaxFileName ); - HBufC* copyLocation = HBufC::NewLC( KMaxFileName ); - CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL(); - CleanupStack::PushL( settingsEngine ); - TBool copyLocationIsPhoneMemory = 0; // not used in this case - TPtr copyLocationPtr( copyLocation->Des() ); - settingsEngine->GetCopyLocationL( copyLocationPtr, - copyLocationIsPhoneMemory ); - - CleanupStack::PopAndDestroy( settingsEngine ); - - iFilePath->Des().Append( *copyLocation ); - CleanupStack::PopAndDestroy( copyLocation ); - - _LIT( KTempFolder, "temp\\"); - iFilePath->Des().Append( KTempFolder() ); - - //check the existence of the target folder - if( !BaflUtils::FolderExists( iFs, *iFilePath ) ) - { - User::LeaveIfError( iFs.MkDirAll( *iFilePath ) ); - } - - User::LeaveIfError( iFs.SetAtt( *iFilePath, - KEntryAttHidden, - KEntryAttNormal ) ); - - //Get the title of the given item - HBufC* title16 = UpnpString::ToUnicodeL( aItem.Title() ); - CleanupStack::PushL( title16 ); - HBufC* title16checked = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( *title16 ); - CleanupStack::PopAndDestroy( title16 ); - - iFilePath->Des().Append( *title16checked ); - delete title16checked; title16checked = NULL; - //Get the extension of the given item - - const CUpnpItem* item = (CUpnpItem*)(&aItem); - const CUpnpElement* tmpEl = &( UPnPItemUtility::ResourceFromItemL( - *item ) ); - - if( !UPnPFileUtility::FitsInMemory( *tmpEl) ) - { - User::Leave( KErrDiskFull ); - } - - const CUpnpAttribute* tmpAttInfo = UPnPItemUtility::FindAttributeByName( - *tmpEl, KAttributeProtocolInfo ); - - User::LeaveIfNull( const_cast(tmpAttInfo ) ); - - CUpnpDlnaProtocolInfo* tmpProtocolInfo = CUpnpDlnaProtocolInfo::NewL( - tmpAttInfo->Value() ); - - CleanupStack::PushL( tmpProtocolInfo ); - - HBufC* fileExt = NULL; - - fileExt = UPnPCommonUtils::FileExtensionByMimeTypeL( - tmpProtocolInfo->ThirdField() ); - - User::LeaveIfNull( fileExt ); - - iFilePath->Des().Append( *fileExt ); - - delete fileExt; fileExt = NULL; - - CleanupStack::PopAndDestroy( tmpProtocolInfo ); - - TInt err = KErrNone; - - RFile rfile; - err = rfile.Create(iFs, *iFilePath, EFileWrite ); - - CleanupClosePushL( rfile ); - if( KErrAlreadyExists == err ) - { - __LOG( "Already exists -> Delete old and create new" ); - User::LeaveIfError( iFs.Delete( *iFilePath ) ); - User::LeaveIfError( rfile.Create(iFs, *iFilePath, EFileWrite ) ); - } - - iDownloadSession->StartDownloadL( *tmpEl, - ( CUpnpItem& )aItem, - rfile, - KDownloadPosition ); - CleanupStack::PopAndDestroy(&rfile); - - iWaitingNote = EFalse; - if( !iWaitingNote ) //if ReserveLocalMSServicesCompleted is not called - { //immediately - iWaitingNote = ETrue; - StartWaitingNoteL(); - } - - __LOG1( "CUPnPLocalPlayer::PlayL-END %d", iExitReason ); - if( iExitReason != KErrNone ) - { - User::Leave( iExitReason ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::TransferStarted. -// -------------------------------------------------------------------------- -// -void CUPnPLocalPlayer::TransferStarted( TInt aKey, TInt aStatus ) - { - __LOG( "CUPnPLocalPlayer::TransferStarted" ); - if( aStatus != KErrNone) - { - iExitReason = aStatus; - } - else if( aKey != KDownloadPosition ) - { - iExitReason = KErrGeneral; - } - - if( iExitReason != KErrNone ) - { - FinishNote(); - } - __LOG( "CUPnPLocalPlayer::TransferStarted-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::TransferCompleted. -// -------------------------------------------------------------------------- -// -void CUPnPLocalPlayer::TransferCompleted( TInt aKey, - TInt aStatus, - const TDesC& aFilePath ) - { - __LOG( "CUPnPLocalPlayer::TransferCompleted" ); - - if( aKey != KDownloadPosition ) - { - iExitReason = KErrGeneral; - FinishNote(); - } - else - { - TRAP_IGNORE( CopyCompleteL( aStatus, aFilePath ) ); - } - - __LOG( "CUPnPLocalPlayer::TransferCompleted-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::CopyCompleteL -// Returns from UPnP AV control point when a copy operation has been finished -// -------------------------------------------------------------------------- -void CUPnPLocalPlayer::CopyCompleteL( TInt aError, - const TDesC& /*aFilePath*/ ) - { - __LOG1( "CopyCompleteL %d", aError ); - - FinishNote(); - // If copying was successful, play the copied item - if( KErrNone == aError ) - { - // iFilePath Contains UTF8 content,we need change - // to TDesC8 first ,Using Copy don't lost any data,because the - //low byte is NULL - TBuf8 filename; - filename.Copy( *iFilePath ); - - HBufC* temp = iFilePath; - iFilePath = NULL; - - // try transform UTF8 to UniCode - HBufC* unicodename = CnvUtfConverter::ConvertToUnicodeFromUtf8L( - filename ); - CleanupStack::PushL( unicodename ); - - // Rename the file - iFilePath = UPnPCommonUtils::RenameFileL( *unicodename ) ; - if( iFilePath ) - { - delete temp; temp = NULL; - } - else - { - iFilePath = temp; - } - CleanupStack::PopAndDestroy( unicodename ); - unicodename = NULL; - - if( iFilePath ) - { - - // fix for TSW: ESLX-7L3DMX - // OpenFileEmbeddedL( aSharableFile,aDataType, aParamList) - // leaves with KErrInUse which results into immediate close - // of image viewer. - - RFile sharableFile; - TRAPD( err, iDocumentHandler->OpenTempFileL( - *iFilePath, sharableFile ) ); - - if ( err == KErrNone ) - { - CleanupClosePushL( sharableFile ); - - // Create a param list to remove - // the "Use image as" sub menu item - CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); - paramList->Reset(); - -// Append a param into the list to restrict the viewer application from -// showing the "use image as" sub menu item. Currently there is no -// AiwGenericParam for this. A CR has been created for AIW to add this -// constant to "AiwGenericParam.hrh". -// Example: This is how the "Save" menu item is allowed. -// paramList->AppendL( EGenericParamAllowSave ); - - TDataType dataType = TDataType(); - - __LOG( "Open document now... " ); - - TRAP( err, err = iDocumentHandler->OpenFileEmbeddedL( - sharableFile, dataType, *paramList ) ); - - __LOG1( "err, err = iDocumentHandler->OpenFileEmbeddedL %d", - err ); - - // Cleanup - CleanupStack::PopAndDestroy( paramList ); - CleanupStack::PopAndDestroy( &sharableFile ); - } - - if( KErrNone != err) - { - iFs.Delete( *iFilePath ); - iExitReason = err; - } - } - else - { - iExitReason = KErrNoMemory; - } - } - else - { - iExitReason = aError; - } - - - iCommonUI.HandleCommonErrorL( iExitReason, 0 ); - - __LOG( "CUPnPLocalPlayer::CopyCompleteL end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::MediaServerDisappeared -// Returns from UPnP AV control point when a media server disppears -// -------------------------------------------------------------------------- -void CUPnPLocalPlayer::MediaServerDisappeared( - TUPnPDeviceDisconnectedReason aReason ) - { - __LOG( "CUPnPLocalPlayer::MediaServerDisappeared" ); - TInt error = KErrNone; - if( aReason == EDisconnected ) - { - error = KErrSessionClosed; - } - else if( aReason == EWLANLost) - { - error = KErrDisconnected; - } - else - { - __PANICD( __FILE__, __LINE__); - } - iExitReason = error; - FinishNote(); - __LOG1("CUPnPLocalPlayer::MediaServerDisappeared %d END",error ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::HandleServerAppExit -// Returns from application server after quitting a application -// here is either image player or video player or music player -// -------------------------------------------------------------------------- -void CUPnPLocalPlayer::HandleServerAppExit( TInt aReason ) - { - __LOG1( "CUPnPLocalPlayer::HandleServerAppExit %d" , aReason ); - - if( iFilePath ) - { - iFs.Delete( *iFilePath ); - } - - __LOG( "CUPnPLocalPlayer::HandleServerAppExit" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::DialogDismissedL -// Returns from dialog server after cancelling a dialog -// here is the wait note -// -------------------------------------------------------------------------- -void CUPnPLocalPlayer::DialogDismissedL( TInt aButtonId ) - { - __LOG1( "CUPnPLocalPlayer::DialogDismissedL %d", aButtonId ); - if( aButtonId == EEikBidCancel ) - { - iDownloadSession->CancelAllTransfers(); - iDownloadSession->RemoveObserver(); - if( iBrowseSessionObserver ) - { - iBrowseSession->SetObserver( *iBrowseSessionObserver ); - } - iBrowseSessionObserver = NULL; - iExitReason = KErrCancel; - __LOG( "CUPnPLocalPlayer::DialogDismissedL Cancel " ); - - } - __LOG( "CUPnPLocalPlayer::DialogDismissedL" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::FinishNote -// Finish the current waiting note and ready to quit the local playback -// -------------------------------------------------------------------------- -void CUPnPLocalPlayer::FinishNote() - { - __LOG( "CUPnPLocalPlayer::FinishNote" ); - iDownloadSession->CancelAllTransfers(); - iDownloadSession->RemoveObserver(); - if( iBrowseSessionObserver ) - { - iBrowseSession->SetObserver( *iBrowseSessionObserver ); - } - iBrowseSessionObserver = NULL; - if( iWaitNoteDialog ) - { - TRAP_IGNORE( iWaitNoteDialog->ProcessFinishedL() ); - delete iWaitNoteDialog; - iWaitNoteDialog = NULL; - } - __LOG( "CUPnPLocalPlayer::FinishNote-END" ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::StartWaitingNoteL -// Start the current waiting note -// -------------------------------------------------------------------------- -void CUPnPLocalPlayer::StartWaitingNoteL() - { - iWaitNoteDialog = new ( ELeave )CAknWaitDialog( - ( REINTERPRET_CAST ( CEikDialog**, &iWaitNoteDialog ) ), - ETrue); - iWaitNoteDialog->SetCallback( this ); - iWaitNoteDialog->ExecuteLD( - R_UPNPCOMMONUI_VIDEO_PLAYBACK_WAIT_NOTE_DIALOG ); - } - -// -------------------------------------------------------------------------- -// CUPnPLocalPlayer::IsLocallySupportedL -// Checks if the item can be played locally. -// -------------------------------------------------------------------------- -TBool CUPnPLocalPlayer::IsLocallySupportedL( CUpnpObject& aItem ) - { - TBool retval = EFalse; // return value - - // Get all res elements into array - RUPnPElementsArray elms; - CleanupClosePushL( elms ); - UPnPItemUtility::GetResElements( aItem, elms ); - TInt count = elms.Count(); - - CUpnpDlnaProtocolInfo* pInfo = NULL; - - // Determine which resources are usable: - // 1. Filter out other than HTTP GET resources (internal uri's, RTP) - // 2. Filter out such resources for which DLNA profile is not supported. - // 3. Filter out such resources for which mime type is not supported. - for( TInt i = count-1 ; i >= 0; i-- ) - { - // Make sure that it is a HTTP GET resource. Otherwise remove it and - // continue with the next one. - if( elms[ i ]->Value().Left( - KHttpDes.iTypeLength ).Compare( KHttpDes() ) != 0 ) - { - CUpnpElement* destroyable = elms[i]; - aItem.RemoveElementL( destroyable ); - delete destroyable; - - continue; - } - - // Obtain protocolInfo of the res element. - const CUpnpAttribute* attr = NULL; - TRAPD( nosuchattribute, - attr = &UPnPItemUtility::FindAttributeByNameL( - *elms[ i ], - KProtocolInfo() ) ); - - if ( nosuchattribute ) - { - // No mandatory protocolinfo attribute. Remove this and continue. - CUpnpElement* destroyable = elms[i]; - aItem.RemoveElementL( destroyable ); - delete destroyable; - - continue; - } - - // parse protocol info - pInfo = CUpnpDlnaProtocolInfo::NewL( attr->Value() ); - CleanupStack::PushL( pInfo ); - - // Check that DLNA profile is among the supported ones. - if ( pInfo->PnParameter() != KNullDesC8() - && !UPnPDlnaUtility::IsSupportedDlnaProfile( - pInfo->PnParameter() ) ) - { - // DLNA profile not supported. Remove this and continue. - CUpnpElement* destroyable = elms[i]; - aItem.RemoveElementL( destroyable ); - delete destroyable; - CleanupStack::PopAndDestroy( pInfo ); - pInfo = NULL; - - continue; - } - - // check that mime type is among the supported ones - TPtrC8 mime = pInfo->ThirdField(); - if ( !UPnPDlnaUtility::IsSupportedMimeType( mime ) ) - { - // mime type not supported. - TPtrC8 httpget = pInfo->FirstField(); - TPtrC8 httpdlnatem = pInfo->FourthField(); - HBufC8* tem = NULL; - tem = httpdlnatem.Right( httpdlnatem.Length() - httpdlnatem.Find( - KHttpEqual ) - 1 ).AllocLC(); - tem->Des().Trim(); - TPtrC8 httpdlna = *tem; - CleanupStack::PopAndDestroy( tem ); - if ( httpget.Compare( KHttpGetDes ) != 0 || - !UPnPDlnaUtility::IsSupportedDlnaProfile - ( httpdlna ) ) - { - // mime type not supported and DLNA profile not supported. - // Remove this and continue - CUpnpElement* destroyable = elms[i]; - aItem.RemoveElementL( destroyable ); - delete destroyable; - CleanupStack::PopAndDestroy( pInfo ); - pInfo = NULL; - - continue; - } - } - - CleanupStack::PopAndDestroy( pInfo ); - pInfo = NULL; - } - - // All res elements have been processed and removed if they are not - // supported. Clean up and return ETrue if there are res elements - // left in the item and EFalse if there are no res elements left. - CleanupStack::PopAndDestroy( &elms ); - - UPnPItemUtility::GetResElements( aItem, elms ); - retval = elms.Count(); - elms.Close(); - - return retval; - } - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpnavipanecontainer.cpp --- a/upnpframework/upnpcommonui/src/upnpnavipanecontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,640 +0,0 @@ -/* -* Copyright (c) 2005 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: Source file for UPnP navi pane container -* -*/ - - - -// INCLUDE FILES -// system -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// internal -#include "upnpnavipanecontainer.h" -#include -#include -#include "upnpperiodic.h" - -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" ); - -// CONSTANTS -const TInt KPeriodicTimerDelay = 1000000; // microseconds -const TInt KPeriodicTimerInterval = 200000; // microseconds -_LIT( KUPnPCommonUiRscFile, "\\resource\\upnpcommonui.rsc" ); - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::CUPnPNaviPaneContainer -// -------------------------------------------------------------------------- -// -CUPnPNaviPaneContainer::CUPnPNaviPaneContainer() - { - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::NewL -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPNaviPaneContainer* CUPnPNaviPaneContainer::NewL( - const TRect& aRect, - TPoint aPosition, - CAknNavigationControlContainer* aParent ) - { - CUPnPNaviPaneContainer* self = new ( ELeave ) CUPnPNaviPaneContainer(); - CleanupStack::PushL( self ); - self->ConstructL( aRect, aPosition, aParent ); - CleanupStack::Pop(); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::ConstructL -// -------------------------------------------------------------------------- -// -void CUPnPNaviPaneContainer::ConstructL( - const TRect& aRect, - TPoint aPosition, - CAknNavigationControlContainer* aParent ) - { - iCoeEnv = CEikonEnv::Static(); - RFs& fileSession = iCoeEnv->FsSession(); - - // Load common ui resource file - TFileName rscFileName( KUPnPCommonUiRscFile ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - rscFileName.Insert( 0, drive ); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - // Check if the resource file exists or not - if ( !BaflUtils::FileExists( fileSession, rscFileName ) ) - { - User::Leave( KErrNotFound ); - } - iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ); - - - // Create label - iFirstDrawDelayWaited = EFalse; - - iPosition.iX = aPosition.iX; - iPosition.iY = aPosition.iY; - - TRect backgroundRect = aRect; - backgroundRect.iTl.iX = -iPosition.iX; - - iSkinContext = CAknsBasicBackgroundControlContext::NewL( - KAknsIIDQsnBgNavipaneSolid , backgroundRect, EFalse ); - - SetPosition(iPosition); - - SetRect(aRect); - CreateWindowL( aParent ); - - iIcon1 = LoadIconL( EFrame1, this ); - iIcon2 = LoadIconL( EFrame2, this ); - iIcon3 = LoadIconL( EFrame3, this ); - iIcon4 = LoadIconL( EFrame4, this ); - iIcon5 = LoadIconL( EFrame5, this ); - iIcon6 = LoadIconL( EFrame6, this ); - iIcon7 = LoadIconL( EFrame7, this ); - iIcon8 = LoadIconL( EFrame8, this ); - iIcon9 = LoadIconL( EFrame9, this ); - - AknIconUtils::SetSize( iIcon1->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon2->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon3->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon4->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon5->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon6->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon7->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon8->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - AknIconUtils::SetSize( iIcon9->Bitmap(), - TSize(aRect.Height(), - aRect.Height() ) ); //width = height, on purpose - - iNavipaneIcon = iIcon1; //set first image in animation - - iPeriodic = CUPnPPeriodic::NewL( CActive::EPriorityUserInput ); - iPeriodic->Start( KPeriodicTimerDelay, - KPeriodicTimerInterval, - TCallBack(UpdateAnimationL, this ) ); - - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::~CUPnPNaviPaneContainer -// -------------------------------------------------------------------------- -// -CUPnPNaviPaneContainer::~CUPnPNaviPaneContainer() - { - if ( iResFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResFileOffset ); - iResFileOffset = 0; - } - - if ( iPeriodic ) - { - iPeriodic->Cancel(); - delete iPeriodic; - } - DeleteIcon( EFrame1 ); - DeleteIcon( EFrame2 ); - DeleteIcon( EFrame3 ); - DeleteIcon( EFrame4 ); - DeleteIcon( EFrame5 ); - DeleteIcon( EFrame6 ); - DeleteIcon( EFrame7 ); - DeleteIcon( EFrame8 ); - DeleteIcon( EFrame9 ); - delete iSkinContext; - /* - delete iLabel; - */ - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::CountComponentControls -// -------------------------------------------------------------------------- -// -TInt CUPnPNaviPaneContainer::CountComponentControls() const - { - return 0; - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::ComponentControl -// -------------------------------------------------------------------------- -// -CCoeControl* CUPnPNaviPaneContainer::ComponentControl( TInt /*aIndex*/ ) const - { - return NULL; - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::Draw -// -------------------------------------------------------------------------- -// -void CUPnPNaviPaneContainer::Draw( const TRect& aRect ) const - { - // Do not draw custom navi pane in landscape orientation - if (Layout_Meta_Data::IsLandscapeOrientation() == EFalse) - { - if (iFirstDrawDelayWaited) - { - CWindowGc& gc = SystemGc(); - gc.Clear(); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - if (iSkinContext) - {//Draw the skin background - AknsDrawUtils::Background( - skin, iSkinContext, this, gc, aRect); - } - else - {// clear the area - gc.SetBrushColor( iEikonEnv->ControlColor( - EColorWindowBackground, *this ) ); - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - gc.Clear( aRect ); - } - - - const CFont* normalFont = iCoeEnv->AnnotationFont(); - TInt baseline = ((aRect.Height() / 2) + - (normalFont->AscentInPixels() / 2)); - - TRgb color(0,0,0); - - TInt err = AknsUtils::GetCachedColor( skin, color, - KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG2 ); - - - gc.UseFont(normalFont); - if( KErrNone == err ) - { - gc.SetPenColor( color ); - } - else - { - gc.SetPenColor( KRgbBlack ); - } - gc.SetBrushStyle( CGraphicsContext::ENullBrush ); - - HBufC* naviPaneText = NULL; - TRAP( err, naviPaneText = StringLoader::LoadL( - R_UPNPCOMMONUI_SERVER_SEARCH_MAIN ) ); - - TSize animationFrameSize = - iNavipaneIcon->Bitmap()->SizeInPixels(); - - const TInt textWidth = (aRect.Width() - - animationFrameSize.iWidth); - - TBuf< 128 > textBuffer; - - if( KErrNone == err ) - { - if (AknBidiTextUtils::ConvertToVisualAndClip( *naviPaneText, - textBuffer, - *normalFont, - textWidth, - textWidth)) - { - gc.DrawText(textBuffer, aRect, baseline, - CGraphicsContext::ELeft); - } - else //text not clipped, default case - { - gc.DrawText(textBuffer, aRect, baseline, - CGraphicsContext::ELeft); - } - delete naviPaneText; - } - TPoint upperLeftCorner((aRect.Width() - - animationFrameSize.iWidth), 0); - - gc.BitBltMasked(upperLeftCorner, iNavipaneIcon->Bitmap(), Rect(), - iNavipaneIcon->Mask(), EFalse); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::LoadIconL -// -------------------------------------------------------------------------- -// - - -CGulIcon* CUPnPNaviPaneContainer::LoadIconL( TAnimationFrames aAnimationState, - TAny* aDlg) - { - static_cast( aDlg )-> - DeleteIcon( aAnimationState ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - TInt id = 0; - TInt maskId = 0; - TAknsItemID skinId = KAknsIIDNone; - - switch ( aAnimationState ) - { - - case EFrame1: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_1; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_1_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame2: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_2; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_2_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame3: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_3; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_3_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame4: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_4; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_4_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame5: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_5; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_5_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame6: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_6; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_6_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame7: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_7; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_7_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame8: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_8; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_8_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - case EFrame9: - { - id = EMbmUpnpcommonuiQgn_indi_upnp_search_9; - maskId = EMbmUpnpcommonuiQgn_indi_upnp_search_9_mask; - skinId = KAknsIIDQsnBgNavipaneSolid; - break; - } - default: - { - break; - } - } - - TFileName mbmFileName( KAknCommonUIMbmFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - mbmFileName.Insert( 0, drive ); - - AknsUtils::CreateIconL( skin, - skinId, - bitmap, - mask, - mbmFileName, - id, - maskId ); - - CleanupStack::PushL(mask); - CleanupStack::PushL(bitmap); - - - // Get the color of the search text - TRgb color(0,0,0); - TBool useWhite = EFalse; - TInt err = AknsUtils::GetCachedColor( skin, color, - KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG2 ); - - - - // If text color is closer to white, use white animation - if( KErrNone == err && - color.Difference(KRgbBlack) > color.Difference(KRgbWhite)) - { - useWhite = ETrue; - } - - - - err = KErrNone; - if( useWhite ) - { - TInt imgSize = static_cast( - aDlg )->Rect().Height(); - AknIconUtils::SetSize( bitmap,TSize(imgSize,imgSize) ); - TSize size = bitmap->SizeInPixels(); - - CleanupStack::PopAndDestroy(bitmap); - bitmap = new(ELeave) CFbsBitmap(); - CleanupStack::PushL(bitmap); - err = bitmap->Create(size, EColor16M); - } - - - CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); - icon->SetBitmapsOwnedExternally( EFalse ); - - CleanupStack::Pop( bitmap ); // bitmap, mask - CleanupStack::Pop( mask ); // bitmap, mask - bitmap = NULL; - mask = NULL; - - return icon; - } - -void CUPnPNaviPaneContainer::DeleteIcon( TAnimationFrames aAnimationState ) - { - switch ( aAnimationState ) - { - case EFrame1: - { - delete iIcon1; - iIcon1 = NULL; - break; - } - case EFrame2: - { - delete iIcon2; - iIcon2 = NULL; - break; - } - case EFrame3: - { - delete iIcon3; - iIcon3 = NULL; - break; - } - case EFrame4: - { - delete iIcon4; - iIcon4 = NULL; - break; - } - case EFrame5: - { - delete iIcon5; - iIcon5 = NULL; - break; - } - case EFrame6: - { - delete iIcon6; - iIcon6 = NULL; - break; - } - case EFrame7: - { - delete iIcon7; - iIcon7 = NULL; - break; - } - case EFrame8: - { - delete iIcon8; - iIcon8 = NULL; - break; - } - case EFrame9: - { - if (iIcon9) - { - delete iIcon9; - iIcon9 = NULL; - } - break; - } - default: - break; - } - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::UpdateAnimation -// -------------------------------------------------------------------------- -// - -TBool CUPnPNaviPaneContainer::UpdateAnimationL( TAny* aDlg ) - { - CUPnPNaviPaneContainer* dlg = - static_cast( aDlg ); - - if ( !dlg->iFirstDrawDelayWaited ) - { - dlg->iFirstDrawDelayWaited = ETrue; - } - - switch ( dlg->iAnimationIndex++ % 9 ) - { - case 0: - { - dlg->iNavipaneIcon = dlg->iIcon1; - break; - } - case 1: - { - dlg->iNavipaneIcon = dlg->iIcon2; - break; - } - case 2: - { - dlg->iNavipaneIcon = dlg->iIcon3; - break; - } - case 3: - { - dlg->iNavipaneIcon = dlg->iIcon4; - break; - } - case 4: - { - dlg->iNavipaneIcon = dlg->iIcon5; - break; - } - case 5: - { - dlg->iNavipaneIcon = dlg->iIcon6; - break; - } - case 6: - { - dlg->iNavipaneIcon = dlg->iIcon7; - break; - } - case 7: - { - dlg->iNavipaneIcon = dlg->iIcon8; - break; - } - case 8: - { - dlg->iNavipaneIcon = dlg->iIcon9; - break; - } - default: - { - // error - break; - } - } - - if (dlg->iAnimationIndex >= 9) - { - dlg->iAnimationIndex = 0; - } - - dlg->DrawAnimation(); - - return ETrue; - } - -// -------------------------------------------------------------------------- -// CUPnPNaviPaneContainer::DrawAnimation -// -------------------------------------------------------------------------- -// - -void CUPnPNaviPaneContainer::DrawAnimation() - { - TPoint imagePosition; - imagePosition.iX = iPosition.iX; - imagePosition.iY = iPosition.iY; - CWindowGc& gc = SystemGc(); - RDrawableWindow* drawWindow = DrawableWindow(); - gc.Activate( *drawWindow ); - Draw( Rect() ); - gc.Deactivate(); - } - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpselectiondialog.cpp --- a/upnpframework/upnpcommonui/src/upnpselectiondialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,641 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Source file for UPnP Browse UI Implementation -* -*/ - - -// INCLUDE FILES -// System -#include -#include -#include -#include -#include -#include - -// upnp stack api -#include - -// upnpframework / avcontroller api -#include "upnpavdevice.h" -#include "upnpavcontroller.h" -#include "upnpavcontrollerfactory.h" -#include "upnpavdevicelist.h" -#include "upnpavdevice.h" -#include "upnpavcontroller.h" - -// upnpframework / internal api's -#include "upnpcommonutils.h" - -// common ui internal -#include -#include //for icons -#include "upnpselectiondialog.h" -#include "upnpcommonui.h" - -// debug stuff -_LIT( KComponentLogfile, "commonui.txt"); -#include "upnplog.h" - -// CONSTANTS -_LIT( KAknCommonUIMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" ); -const TInt KLength = 100; - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -CUPnPSelectionDialog* CUPnPSelectionDialog::NewL( - MUPnPAVController& aAVControl ) - { - __LOG( "CUPnPSelectionDialog::NewL" ); - - CUPnPSelectionDialog* self = - new ( ELeave ) CUPnPSelectionDialog( aAVControl ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::ConstructL() - { - __LOG( "CUPnPSelectionDialog::ConstructL" ); - - iDeviceArray = CUpnpAVDeviceList::NewL(); - // Register as an observer to device operations - - iTypeOfDevicesToSearch = EUPnPSearchAllDevices; - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::CUPnPSelectionDialog -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -CUPnPSelectionDialog::CUPnPSelectionDialog( MUPnPAVController& aAVControl ): - iAVControl( aAVControl ) - { - __LOG( "CUPnPSelectionDialog::CUPnPSelectionDialog" ); - - iDeviceObserver = iAVControl.DeviceObserver(); - iAVControl.RemoveDeviceObserver(); - iAVControl.SetDeviceObserver( *this ); - iPopup = NULL; - iExitReason = KErrNone; - } - -// Destructor -CUPnPSelectionDialog::~CUPnPSelectionDialog() - { - __LOG( "CUPnPSelectionDialog::~CUPnPSelectionDialog" ); - - delete iListBox; - - // Unregister as an observer to device operations - iAVControl.RemoveDeviceObserver(); - if( iDeviceObserver ) - { - iAVControl.SetDeviceObserver( *iDeviceObserver ); - } - - delete iDeviceArray; - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::PreLayoutDynInitL(); -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::PreLayoutDynInitL( const TDesC& aTitle ) - { - __LOG( "CUPnPSelectionDialog::PreLayoutDynInitL" ); - - // Browse dialog title text - iPopup->SetTitleL( aTitle ); - - CAknIconArray* icons = new ( ELeave ) CAknIconArray(2); - CleanupStack::PushL( icons ); - - // Mif icons - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) ); - - TFileName mbmFileName( KAknCommonUIMbmFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - mbmFileName.Insert( 0, drive ); - - // Media server icon - AppendIconToArrayL( icons, skin, - mbmFileName, - KAknsIIDDefault, - EMbmUpnpcommonuiQgn_server_icon, - EMbmUpnpcommonuiQgn_server_icon_mask ); - iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); - CleanupStack::Pop( icons ); - - // Enable horizontal scrolling - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - LoadListItemsL(); - } - - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::LoadListItemsL -// Sends the browse request to UPnP AV Controller. When result set arrives, -// UPnP AV Controller will call the "BrowseResultsL" call back method, -// which is implemented below. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::LoadListItemsL() - { - __LOG( "CUPnPSelectionDialog::LoadListItemsL" ); - - CTextListBoxModel* model = iListBox->Model(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - - //contents inside the array will be owned by iDeviceArray - CUpnpAVDeviceList* tempDeviceArray = NULL; - // Get the devices from the UPnP Stack according to the search criteria - if( iTypeOfDevicesToSearch == EUPnPSearchAllDevices ) - { - CUpnpAVDeviceList* tempDeviceArray2 = NULL; - tempDeviceArray2 = iAVControl.GetMediaServersL(); - if( tempDeviceArray2->Count() > 0 ) - { - CleanupStack::PushL( tempDeviceArray2 ); - CleanupStack::PushL( tempDeviceArray ); - for( TInt i = 0; i < tempDeviceArray2->Count(); i++ ) - { - tempDeviceArray->AppendDeviceL( - *( *tempDeviceArray2 )[i] ); - } - - CleanupStack::Pop( tempDeviceArray ); - CleanupStack::Pop( tempDeviceArray2 ); - tempDeviceArray2->Reset(); - - } - - tempDeviceArray2 = iAVControl.GetMediaRenderersL(); - - if(tempDeviceArray2->Count() > 0 ) - { - CleanupStack::PushL( tempDeviceArray2 ); - CleanupStack::PushL( tempDeviceArray ); - for( TInt i = 0; i < tempDeviceArray2->Count(); i++ ) - { - tempDeviceArray->AppendDeviceL( - *( *tempDeviceArray2 )[i] ); - } - - CleanupStack::Pop( tempDeviceArray ); - CleanupStack::Pop( tempDeviceArray2); - tempDeviceArray2->Reset(); - } - - delete tempDeviceArray2; - - } - else if( iTypeOfDevicesToSearch == EUPnPSearchAllServerDevices || - iTypeOfDevicesToSearch == EUPnPSearchServerDevicesWithCopyCapability || - iTypeOfDevicesToSearch == EUPnPSearchServerDevicesWithSearchCapability ) - { - tempDeviceArray = iAVControl.GetMediaServersL(); - } - else - { - tempDeviceArray = iAVControl.GetMediaRenderersL(); - } - - CleanupStack::PushL( tempDeviceArray ); - if ( tempDeviceArray->Count() ) - { - for ( TInt i=0; i < tempDeviceArray->Count(); i++ ) - { - // Check if the device match with the search criteria - if( MatchWithSearchCriteria( - const_cast( ( *tempDeviceArray)[i] ) ) ) - { - iDeviceArray->AppendDeviceL( *( *tempDeviceArray )[i] ); - } - else - { - CUpnpAVDevice* tempDevice = ( *tempDeviceArray )[i]; - delete tempDevice; - tempDevice = NULL; - } - } - - - for ( TInt i=0; i < iDeviceArray->Count(); i++ ) - { - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - ( *iDeviceArray )[i]->FriendlyName().Left( KLength ) ); - CleanupStack::PushL( tmpfriendlyname); - - HBufC* device = UpnpString::ToUnicodeL( *tmpfriendlyname ); - CleanupStack::PushL( device); - - TBuf item; - item.Format( _L( "%d\t%S\t\t" ),0, device ); - - CleanupStack::PopAndDestroy( device ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - listBoxItems->AppendL( item ); - } - - // Updates CBA. - UpdateCommandSetL(); - - iListBox->HandleItemAdditionL(); // Update listbox - iListBox->SetCurrentItemIndexAndDraw( 0 ); // select new item - - } - else - { - HBufC* waitText = StringLoader::LoadLC( - R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE ); - iListBox->View()->SetListEmptyTextL( *waitText ); - CleanupStack::PopAndDestroy( waitText ); - } - - CleanupStack::Pop( tempDeviceArray ); - tempDeviceArray->Reset(); - delete tempDeviceArray; - - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::UPnPDeviceDiscovered -// Returns discovered device from UPnP AV control point. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::UPnPDeviceDiscovered( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPSelectionDialog::UPnPDeviceDiscovered" ); - - TRAPD( error, UPnPDeviceDiscoveredL( aDevice ) ); - if( error ) - { - __LOG1( "UPnPDeviceDiscoveredL, leave %d .", error ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::UPnPDeviceDiscoveredL -// Returns discovered device from UPnP AV control point. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::UPnPDeviceDiscoveredL( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPSelectionDialog::UPnPDeviceDiscovered" ); - - - if ( MatchWithSearchCriteria( const_cast( &aDevice ) ) ) - { - CUpnpAVDevice* tempDevice = CUpnpAVDevice::NewL( aDevice ); - CleanupStack::PushL( tempDevice ); - //ownership transferred - iDeviceArray->AppendDeviceL( *tempDevice ); - CleanupStack::Pop( tempDevice ); - - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - ( ( CUpnpAVDevice* )tempDevice )->FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - CTextListBoxModel* model = iListBox->Model(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - TBuf item; - HBufC* tmpStr = - UpnpString::ToUnicodeL( friendlyname.Left( KLength ) ); - CleanupStack::PushL( tmpStr ); - item.Format( _L( "%d\t%S\t\t" ),0, tmpStr ); - CleanupStack::PopAndDestroy( tmpStr ); - CleanupStack::PopAndDestroy( tmpfriendlyname ); - listBoxItems->AppendL( item ); - iListBox->HandleItemAdditionL(); // Update listbox - - // Updates CBA. - UpdateCommandSetL(); - - iListBox->ActivateL(); - iListBox->DrawDeferred(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::UPnPDeviceDisappeared -// Returns disappeared device from UPnP AV control point. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::UPnPDeviceDisappeared( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPSelectionDialog::UPnPDeviceDisappeared" ); - - TRAPD( error, UPnPDeviceDisappearedL( aDevice ) ); - if ( error ) - { - __LOG1( "UPnPDeviceDisappearedL, leave %d", error ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::UPnPDeviceDisappearedL -// Returns disappeared device from UPnP AV control point. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::UPnPDeviceDisappearedL( - const CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPSelectionDialog::UPnPDeviceDisappearedL" ); - - CTextListBoxModel* model = iListBox->Model(); - TInt currentItem = iListBox->CurrentItemIndex(); - MDesCArray* textArray = model->ItemTextArray(); - CDesCArray* listBoxItems = static_cast( textArray ); - TInt i( 0 ); - TPtrC8 ptr( aDevice.Uuid() ); - - while( i < iDeviceArray->Count() && - ptr.Compare( ( *iDeviceArray )[i]->Uuid() ) ) - { - i++; - } - if ( i < iDeviceArray->Count() ) - { - iDeviceArray->RemoveAndDestroy( i ); - listBoxItems->Delete( i, 1 ); - AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( - iListBox, currentItem, ETrue ); - iListBox->DrawDeferred(); - } - - if ( !iDeviceArray->Count() ) - { - // show "Waiting devices" text - HBufC* waitText = StringLoader::LoadLC( - R_UPNPCOMMONUI_EXTERNAL_WAITING_NOTE ); - iListBox->View()->SetListEmptyTextL( *waitText ); - CleanupStack::PopAndDestroy( waitText ); - - // Updates CBA. - UpdateCommandSetL(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::WLANConnectionLost -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::WLANConnectionLost() - { - __LOG( "CUPnPSelectionDialog::WLANConnectionLost" ); - DismissItself( KErrDisconnected ); - }; - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::AppendIconToArrayL -// Load a possibly skinned icon (with mask) and append it to an -// icon array. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ) - { - __LOG( "CUPnPSelectionDialog::AppendIconToArrayL" ); - __ASSERTD( aArray != NULL, __FILE__, __LINE__ ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC( aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId ); - - CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); - icon->SetBitmapsOwnedExternally( EFalse ); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop( 2 ); // mask, bitmap - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL( icon ); - aArray->AppendL( icon ); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(); - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::CreatePopupL -// Creates a selection popup. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::CreatePopupL( - const TDesC& aTitle, - TUPnPDeviceTypesToSearch aDeviceType ) - { - __LOG( "CUPnPSelectionDialog::CreatePopupL" ); - - // Store the type of devices that are searched - iTypeOfDevicesToSearch = aDeviceType; - - // Create and configure the list box - iListBox = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox; - iPopup = CAknPopupList::NewL( iListBox, - R_UPNPCOMMONUI_SOFTKEYS_EMPTY_CANCEL, - AknPopupLayouts::EDynMenuWindow ); - iListBox->ConstructL( iPopup, EAknListBoxSelectionList ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, - CEikScrollBarFrame::EAuto ); - PreLayoutDynInitL( aTitle ); - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::StartPopupL -// Parses the friendly names from the list of UPnPAVDevices and -// executes the selection dialog. Returns ID of the selected item. -// -------------------------------------------------------------------------- -TInt CUPnPSelectionDialog::StartPopupL( CUpnpAVDevice& aDevice ) - { - __LOG( "CUPnPSelectionDialog::StartPopupL" ); - - TInt ret = KErrNone; - - // Start animation - RDebug::Print( _L( "CUPnPSelectionDialog::\ -StartPopupL header animation" ) ); - iPopup->Heading()-> SetHeaderAnimationL( - R_UPNPCOMMONUI_ANIMATION_FOR_SELECTION_DIALOG ); - - TInt popupOk = iPopup->ExecuteLD(); - iPopup = NULL; - if ( popupOk ) - { - if ( iListBox->CurrentItemIndex() >= 0 ) - { - CUpnpAVDevice* device = - ( *iDeviceArray )[iListBox->CurrentItemIndex()]; - aDevice.CopyFromL( *device ); - ret = KErrNone; - } - } - else - { - if( KErrNone == iExitReason ) - { - ret = KErrCancel; - } - else - { - ret = iExitReason; - } - - } - return ret; - } - - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::DismissItself -// Dismiss the selection dialog via an error code. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::DismissItself( TInt aError ) - { - iExitReason = aError; - if( iPopup ) - { - iPopup->CancelPopup(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::MatchWithSearchCriteria -// Checks if a given device matches with the search criteria. -// -------------------------------------------------------------------------- -TBool CUPnPSelectionDialog::MatchWithSearchCriteria( CUpnpAVDevice *aDevice ) - { - TBool returnValue = EFalse; - if( aDevice ) - { - // If all device types are accepted - if( iTypeOfDevicesToSearch == EUPnPSearchAllDevices ) - { - returnValue = ETrue; - } - // If all media server devices are accepted - else if( iTypeOfDevicesToSearch == EUPnPSearchAllServerDevices && - aDevice->DeviceType() == CUpnpAVDevice::EMediaServer ) - { - returnValue = ETrue; - } - // If all rendering devices are accepted - else if( iTypeOfDevicesToSearch == EUPnPSearchAllRenderingDevices && - aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer ) - { - returnValue = ETrue; - } - // If media server devices with copy capability are accepted - else if( iTypeOfDevicesToSearch == - EUPnPSearchServerDevicesWithCopyCapability && - aDevice->DeviceType() == CUpnpAVDevice::EMediaServer && - aDevice->CopyCapability() ) - { - returnValue = ETrue; - } - // If media server devices with search capability are accepted - else if( iTypeOfDevicesToSearch == - EUPnPSearchServerDevicesWithSearchCapability && - aDevice->DeviceType() == CUpnpAVDevice::EMediaServer && - aDevice->SearchCapability() ) - { - returnValue = ETrue; - } - // If rendering devices with image capability are accepted - else if( iTypeOfDevicesToSearch == - EUPnPSearchRenderingDevicesWithImageCapability && - aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer && - aDevice->ImageCapability() ) - { - returnValue = ETrue; - } - // If rendering devices with video capability are accepted - else if( iTypeOfDevicesToSearch == - EUPnPSearchRenderingDevicesWithVideoCapability && - aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer && - aDevice->VideoCapability() ) - { - returnValue = ETrue; - } - // If rendering devices with audio capability are accepted - else if( iTypeOfDevicesToSearch == - EUPnPSearchRenderingDevicesWithAudioCapability && - aDevice->DeviceType() == CUpnpAVDevice::EMediaRenderer && - aDevice->AudioCapability() ) - { - returnValue = ETrue; - } - else - { - returnValue = EFalse; - } - } - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPSelectionDialog::UpdateCommandSetL -// Updates command set of the dialog by the search type of the devices. -// -------------------------------------------------------------------------- -void CUPnPSelectionDialog::UpdateCommandSetL() - { - // Default values, used when no items in the list. - TInt resId = R_UPNPCOMMONUI_SOFTKEYS_EMPTY_CANCEL; - if ( iDeviceArray->Count() ) - { - // Updates the commands set by iTypeOfDevicesToSearch variable. - switch( iTypeOfDevicesToSearch ) - { - case EUPnPSearchServerDevicesWithCopyCapability: - // When copying or moving we should use "Ok" lsk - // instead of "Select". - resId = R_AVKON_SOFTKEYS_OK_CANCEL; - break; - default: - resId = R_AVKON_SOFTKEYS_SELECT_CANCEL; - break; - } - } - - CEikButtonGroupContainer* bgc = iPopup->ButtonGroupContainer(); - bgc->SetCommandSetL( resId ); - bgc->DrawDeferred(); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpcommonui/src/upnpvideoplayerdialog.cpp --- a/upnpframework/upnpcommonui/src/upnpvideoplayerdialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1663 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Source file for UPnP Video player -* -*/ - - -// INCLUDE FILES -// System -#include -#include -#include -#include -#include -#include -#include -#include -#include // CAknWaitDialog -#include -#include -#include //for CRemConInterfaceSelector -#include //for CRemConCoreApiTarget - -// upnp stack api -#include -#include -#include - -// upnpframework / avcontroller api -#include "upnpavrenderingsession.h" -#include "upnpavdevice.h" - -// upnpframework / avcontroller helper api -#include "upnpitemutility.h" // ResourceFromItemL - -// upnpframework / internal api's -#include "upnpcommonutils.h" -#include "upnpcdsreselementutility.h" - -// commonui internal -#include -#include -#include "upnpcommonui.h" -#include "upnpcommonui.hrh" -#include "upnpvideoplayerdialog.h" -#include "upnpperiodic.h" - -_LIT( KComponentLogfile, "commonui.txt" ); -#include "upnplog.h" - -// CONSTANTS -const TInt KMPOneSecond(1000000); -const TInt KOneHourInSeconds(3600); -const TInt KMaxVolume(100); -const TInt KMiniumVolume(0); -const TInt KGetPosInfoPlaybackInterval( 10 ); -const TInt KGetPosInfoBeforePlaybackInterval( 1 ); -const TInt KLength = 100; -const TInt KDotLength = 3; -const TInt KVolumeStep = 1; -const TInt KVolumeInterval = 10; - -_LIT( KAknMultiViewsMbmFileName, "\\resource\\apps\\upnpcommonui.mbm" ); -_LIT( KDot, "..." ); - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::NewL -// Alternate two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPVideoPlayerDlg* CUPnPVideoPlayerDlg::NewL( - MUPnPAVRenderingSession& aRenderingSession, - const CUpnpObject& aObject, - CUPnPCommonUI& aCommonUI ) - { - __LOG( "CUPnPVideoPlayerDlg::NewL" ); - - CUPnPVideoPlayerDlg* self = NULL; - self = new ( ELeave ) CUPnPVideoPlayerDlg( aRenderingSession, - aObject, - aCommonUI ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - __LOG( "CUPnPVideoPlayerDlg::NewL End" ); - return self; - } - - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::ConstructL( ) - { - __LOG( "CUPnPVideoPlayerDlg::ConstructL" ); - - iAdjustingVolume = EFalse; - - // Resolve the target device capabilities - ResolveTargetDeviceCapabilitiesL(); - - iMinSecFormatString = - iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_MIN_SEC ); - - iHourMinSecFormatString = - iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_LONG ); - - iNaviPane = static_cast( - CEikStatusPaneBase::Current()-> - ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); - - iNaviPane->Pop(); - - iOriginalTitleText = HBufC16::NewL( KMaxFileName ); - - iTimer = CUPnPPeriodic::NewL( CActive::EPriorityStandard ); - - iCurrentVolume = KMiniumVolume; //0 - - //create a vertical volume controller - iVolumePopup = CAknVolumePopup::NewL( NULL, ETrue ); - - //iVolumePopup->SetObserver( this ); - - //set value to the volume popup - iVolumePopup->SetRange( KMiniumVolume , KMaxVolume ); - iVolumePopup->SetStepSize( KVolumeStep ); - iVolumePopup->SetDefaultValue( KMiniumVolume ); - - // Remote control server command repeat timer. - iVolumeTimer = CUPnPPeriodic::NewL( EPriorityNormal ); - - // Open a connection to receive Volume Key events. - iInterfaceSelector = CRemConInterfaceSelector::NewL(); - - // owned by CRemConInterfaceSelector instance - iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector,*this ); - TRAPD( err, iInterfaceSelector->OpenTargetL() ); - if( err != KErrNone ) - { - __LOG1("Leave occured in OpenTargetL %d", err); - } - - __LOG( "CUPnPVideoPlayerDlg::ConstructL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg( - MUPnPAVRenderingSession& aRenderingSession, - const CUpnpObject& aObject, - CUPnPCommonUI& aCommonUI ): - iRendSession(aRenderingSession), - iCommonUI(aCommonUI) - - - { - __LOG( "CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg" ); - iTargetDevice = &( iRendSession.Device() ); - iItem = &aObject; - iAction = CUPnPCommonUI::EUPnPNone; - - __LOG( "CUPnPVideoPlayerDlg::CUPnPVideoPlayerDlg End" ); - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPVideoPlayerDlg::~CUPnPVideoPlayerDlg() - { - __LOG( "CUPnPVideoPlayerDlg::~CUPnPVideoPlayerDlg" ); - - if( iVolumeTimer ) - { - iVolumeTimer->Cancel(); - delete iVolumeTimer; - } - - if( iVolumePopup ) - { - iVolumePopup->CloseVolumePopup(); - } - - delete iVolumePopup; - delete iInterfaceSelector; - if( iVideoPlaybackWaitNote ) - { - TRAP_IGNORE( iVideoPlaybackWaitNote->ProcessFinishedL() ); - delete iVideoPlaybackWaitNote; - iVideoPlaybackWaitNote = NULL; - } - - if( iTimer ) - { - iTimer->Cancel(); - } - - delete iTimer; - - - delete iMinSecFormatString; - delete iHourMinSecFormatString; - delete iTimerNavi; - - delete iNaviDecorator; - - delete iOriginalTitleText; - TRAP_IGNORE( iRendSession.StopL() ); - iRendSession.RemoveObserver(); - - __LOG( "CUPnPVideoPlayerDlg::~CUPnPVideoPlayerDlg End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::PreLayoutDynInitL(); -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::PreLayoutDynInitL() - { - __LOG( "CUPnPVideoPlayerDlg::PreLayoutDynInitL" ); - - - // Browse dialog title text - TUid titlePaneUid; - titlePaneUid.iUid = EEikStatusPaneUidTitle; - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - CEikStatusPaneBase::TPaneCapabilities titlesubPane = - statusPane->PaneCapabilities( titlePaneUid ); - - - if( titlesubPane.IsPresent() && - titlesubPane.IsAppOwned() ) - { - CAknTitlePane* titlePane = - (CAknTitlePane*) statusPane->ControlL( titlePaneUid ); - // Take backup of title text - iOriginalTitleText->Des().Copy( *titlePane->Text() ); - - HBufC *tmpbuf = UpnpString::ToUnicodeL( iItem->Title() ); - CleanupStack::PushL( tmpbuf ); - titlePane->SetTextL( *tmpbuf ); - CleanupStack::PopAndDestroy(); - } - - - // Start to observe the rendering session - iRendSession.RemoveObserver(); - iRendSession.SetObserver( *this ); - - PreparePlayBackL(); - - StartWaitNoteL(); - -/* -// Temporally commented out. Will be uncommented when UpnpAvController -// provides cancel functionaly fot SetUri action (Upnp Fw 2.5) - if( iExitCode == EEikBidCancel ) - { - // Cancel the SetUri - //iRendSession.Cancel(); - // Send Stop - TRAP_IGNORE( iRendSession.StopL() ); - ClearTitleL(); - iExitCode = KErrCancel; - } -*/ - User::LeaveIfError( iExitCode ); - - if ( !Layout_Meta_Data::IsLandscapeOrientation() ) - { - iEikonEnv->AppUiFactory()->StatusPane()->SwitchLayoutL( - R_AVKON_STATUS_PANE_LAYOUT_USUAL ); - } - // Volume level to 0 - iCurrentVolume = KMiniumVolume; - - // try to get volume level from renderer - TRAPD( err, iRendSession.GetVolumeL() ); - if( !err ) - { - iAdjustingVolume = ETrue; - } - - __LOG( "CUPnPVideoPlayerDlg::PreLayoutDynInitL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::OkToExitL(TInt aButtonId) -// called by framework when the softkey is pressed -// may leave without trap(System error) -// -------------------------------------------------------------------------- -// -TBool CUPnPVideoPlayerDlg::OkToExitL( TInt aButtonId ) - { - __LOG( "CUPnPVideoPlayerDlg::OkToExitL" ); - - TBool retval = EFalse; - TInt error = KErrNone; - - switch ( aButtonId ) - { - case KErrSessionClosed: //either MS or MR disappears - case KErrDisconnected: //fall through - { - // Connection failed so we have to close player - TRAP_IGNORE( ClearTitleL() ); - return ETrue; - } - case EUPnPPauseCmd: - { - iAction = CUPnPCommonUI::EUPnPShow; - TRAP( error, iRendSession.PauseL() ); - if ( KErrNone != error ) - { - - __LOG1( "CUPnPVideoPlayerDialog::OkToExitL:Pause %d", - error ); - } - break; - } - case EUPnPReplayCmd: - { - iAction = CUPnPCommonUI::EUPnPShow; - - PreparePlayBackL(); - iExitCode = KErrNone; - StartWaitNoteL(); -/* -// Temporally commented out. Will be uncommented when UpnpAvController -// provides cancel functionaly fot SetUri action (Upnp Fw 2.5) - - if( iExitCode == EEikBidCancel || - iExitCode == KErrCancel ) - { - // Cancel the SetUri - //iRendSession.Cancel(); - // Send Stop - TRAP_IGNORE( iRendSession.StopL() ); - } -*/ - if( iExitCode == KErrSessionClosed || - iExitCode == KErrDisconnected ) - { - TryExitL( iExitCode ); - } - break; - } - case EUPnPContinueCmd: - { - iAction = CUPnPCommonUI::EUPnPShow; - TRAP( error, iRendSession.PlayL() ); - if ( KErrNone != error ) - { - __LOG1( "CUPnPVideoPlayerDialog::\ - OkToExitL: Continue %d", error ); - } - break; - } - case EUPnPBackCmd: //quit the video player dialog - { - TRAP_IGNORE( ClearTitleL() ); //avoid system error - return ETrue; - } - case EUPnPStopCmd: - { - iAction = CUPnPCommonUI::EUPnPShow; - TRAP( error, iRendSession.StopL() ); - if ( KErrNone != error ) - { - - __LOG1( "CUPnPVideoPlayerDialog::\ - OkToExitL: Stop %d", error ); - } - break; - } - case EAknSoftkeyOk: - { - break; - } - case EAknSoftkeyCancel: - case EAknSoftkeyExit: - case EAknCmdExit: // fall through - case EEikCmdExit: - { - TRAP_IGNORE( ClearTitleL() ); - return ETrue; //back to previous dialog - } - default: - { - // ignore - break; - } - } - - __LOG( "CUPnPVideoPlayerDlg::OkToExitL End" ); - return retval; - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::UpdateSoftkeysL -// -------------------------------------------------------------------------- -void CUPnPVideoPlayerDlg::UpdateSoftkeysL( TInt aState ) - { - __LOG( "CUPnPVideoPlayerDlg::UpdateSoftkeysL" ); - - - if ( aState == EUPnPVideoPlay && - iPauseCapability ) - { - ButtonGroupContainer().SetCommandSetL( - R_UPNPCOMMONUI_SOFTKEYS_PAUSE_STOP ); - ButtonGroupContainer().DrawDeferred(); - } - else if ( aState == EUPnPVideoPlay && - !iPauseCapability ) - { - ButtonGroupContainer().SetCommandSetL( - R_UPNPCOMMONUI_SOFTKEYS_EMPTY_STOP ); - ButtonGroupContainer().DrawDeferred(); - } - else if ( aState == EUPnPVideoPause ) - { - ButtonGroupContainer().SetCommandSetL( - R_UPNPCOMMONUI_SOFTKEYS_CONTINUE_STOP ); - ButtonGroupContainer().DrawDeferred(); - } - else if ( aState == EUPnPVideoStop ) - { - ButtonGroupContainer().SetCommandSetL( - R_UPNPCOMMONUI_SOFTKEYS_REPLAY_BACK ); - ButtonGroupContainer().DrawDeferred(); - } - __LOG( "CUPnPVideoPlayerDlg::UpdateSoftkeysL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::OfferKeyEventL -// -------------------------------------------------------------------------- -// -TKeyResponse CUPnPVideoPlayerDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - __LOG( "CUPnPVideoPlayerDlg::OfferKeyEventL" ); - - TKeyResponse response = EKeyWasConsumed; - TInt error = KErrNone; - if ( aType == EEventKeyUp ) - { - if ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) - { - // Adjust volume if the target rendering device supports the - // feature, and we are not waiting for a response for a previous - // set volume action. - - iVolumeUp = EFalse; - ChangeVolume( this ); - } - else if ( aKeyEvent.iScanCode == EStdKeyRightArrow ) - { - // Adjust volume if the target rendering device supports the - // feature, and we are not waiting for a response for a previous - // set volume action. - iVolumeUp = ETrue; - ChangeVolume( this ); - } - - if( KErrNotReady == error || - KErrDisconnected == error ) - { - TryExitL( error ); - } - } - else if( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) - { - CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - } - __LOG( "CUPnPVideoPlayerDlg::OfferKeyEventL End" ); - return response; - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::ShowVolumeIndicatorL -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::ShowVolumeIndicatorL() - { - __LOG( "CUPnPVideoPlayerDlg::ShowVolumeIndicatorL" ); - - if ( iCurrentVolume >= KMiniumVolume && iCurrentVolume <= KMaxVolume ) - { - __LOG( " - display volume popup indicator" ); - if ( iVolumePopup ) - { - iVolumePopup->SetValue( iCurrentVolume ); - iVolumePopup->ShowVolumePopupL(); // will close after 1s - } - } - else - { - HideVolumeIdicator( this ); - } - __LOG( "CUPnPVideoPlayerDlg::ShowVolumeIndicatorL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::HideVolumeIdicator -// -------------------------------------------------------------------------- -// -TInt CUPnPVideoPlayerDlg::HideVolumeIdicator( TAny* aPtr ) - { - __LOG( "CUPnPVideoPlayerDlg::HideVolumeIdicator" ); - - CUPnPVideoPlayerDlg* self = - static_cast( aPtr ); - - if ( self->iVolumePopup ) - { - self->iVolumePopup->CloseVolumePopup(); - } - - __LOG( "CUPnPVideoPlayerDlg::HideVolumeIdicator End" ); - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::TimerIndicatorL -// -------------------------------------------------------------------------- -// -TInt CUPnPVideoPlayerDlg::TimerIndicatorL( TAny* aPtr ) - { - __LOG( "CUPnPVideoPlayerDlg::TimerIndicatorL" ); - CUPnPVideoPlayerDlg* self = - static_cast(aPtr); - - if( self->iTotalLengthInSeconds > 0) - { - if( self->iPlaybackPosInSeconds >= self->iTotalLengthInSeconds ) - { - self->iTimer->Cancel(); - self->iRendererPlaying = EFalse; - self->iPlaybackPosInSeconds = 0; - self->iTotalLengthInSeconds = 0; - return KErrNone; - } - } - - // Increase the count of timer expirations - self->iTimerRefresh++; - - // Increase the elapsed time by one (this timer elapses once a second). - if ( self->iRendererPlaying && !self->iPause ) - { - self->iPlaybackPosInSeconds++; - } - - self->UpdateNaviPaneL(); - - // Refresh the position after every KGetPosInfoPlaybackInterval - // secs from the beginning of play if necessary - // (total length not set set at that moment) - if( self->iTimerRefresh >= self->iGetPositionInfoInterval ) - { - self->iTimerRefresh = 0; - TRAPD( err, self->iRendSession.GetPositionInfoL() ); - if ( err ) - { - __LOG1( "TimerIndicatorL GetPositionInfoL err: %d", err ); - } - } - - __LOG( "CUPnPVideoPlayerDlg::TimerIndicatorL End" ); - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::ClearTitleL -// Sets title back to default. -// -------------------------------------------------------------------------- -void CUPnPVideoPlayerDlg::ClearTitleL() - { - __LOG( "CUPnPVideoPlayerDlg::ClearTitleL" ); - - TUid titlePaneUid; - titlePaneUid.iUid = EEikStatusPaneUidTitle; - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - CEikStatusPaneBase::TPaneCapabilities titlesubPane = - statusPane->PaneCapabilities( titlePaneUid ); - - CAknTitlePane* titlePane = - ( CAknTitlePane* ) statusPane->ControlL( titlePaneUid ); - // Set original text - titlePane->SetTextL( *iOriginalTitleText ); - iNaviPane->Pop(); - __LOG( "CUPnPVideoPlayerDlg::ClearTitleL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerView::UpdateNaviPaneL() -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::UpdateNaviPaneL() - { - __LOG( "CUPnPVideoPlayerDlg::UpdateNaviPaneL" ); - - TTime posTime = TTime( ( iPlaybackPosInSeconds )*KMPOneSecond ); - TTime durTime = TTime( iTotalLengthInSeconds*KMPOneSecond ); - - TBuf<16> pos; - TBuf<16> dur; - - if ( iTotalLengthInSeconds > 0 && - iTotalLengthInSeconds < KOneHourInSeconds ) - { - // Format time to user readable format. (min:sec) - posTime.FormatL( pos, *iMinSecFormatString ); - durTime.FormatL( dur, *iMinSecFormatString ); - } - else - { - // Format time to user readable format. (hour:min:sec) - posTime.FormatL( pos, *iHourMinSecFormatString ); - durTime.FormatL( dur, *iHourMinSecFormatString ); - } - if ( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) ) - { - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( pos ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dur ); - } - // if duration greated than 0, show postion in 00:00/00:00 format - if ( iTotalLengthInSeconds > 0 ) - { - CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat(2); - CleanupStack::PushL( strings ); - strings->AppendL( pos ); //First string (position) - strings->AppendL( dur ); //Second string (duration) - delete iTimerNavi; iTimerNavi = NULL; - iTimerNavi = StringLoader::LoadL( R_UPNPCOMMONUI_VIDEO_NAVI_TIME, - *strings, - iEikonEnv ); - - SetNaviLabelL( *iTimerNavi ); - - CleanupStack::PopAndDestroy( strings ); // strings & stringholder - } - else // show position in 00:00:00 format - { - SetNaviLabelL( pos ); - } - - __LOG( "CUPnPVideoPlayerDlg::UpdateNaviPaneL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerView::SetNaviLabelL -// Set navigation label from descriptor. -// (other items were commented in a header). -// -------------------------------------------------------------------------- -void CUPnPVideoPlayerDlg::SetNaviLabelL( const TDesC& aText ) - { - __LOG( "CUPnPVideoPlayerDlg::SetNaviLabelL" ); - - TUid naviPaneUid; - naviPaneUid.iUid = EEikStatusPaneUidNavi; - - // check if we can access the navi pane - if ( CheckStatusPaneCapabilities( naviPaneUid ) ) - { - CAknNavigationControlContainer* naviPane = - static_cast - ( iEikonEnv->AppUiFactory()->StatusPane()->ControlL( - naviPaneUid ) ); - - if ( iNaviDecorator && - ( iNaviDecorator->ControlType() == - CAknNavigationDecorator::ENaviLabel ) ) - { - // Set the navi text - CAknNaviLabel* naviLabel = static_cast - ( iNaviDecorator->DecoratedControl() ); - naviLabel->SetTextL( aText ); - } - else - { - // create the navigation pane label - iNaviDecorator = naviPane->CreateNavigationLabelL( aText ); - } - naviPane->PushL( *iNaviDecorator ); - } - - __LOG( "CUPnPVideoPlayerDlg::SetNaviLabelL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities -// Check the status pane capabilities. -// (other items were commented in a header). -// -------------------------------------------------------------------------- -// -TBool CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities( - const TPaneId& aPaneId ) - { - __LOG( "CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities" ); - - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - - CEikStatusPaneBase::TPaneCapabilities subPane = - statusPane->PaneCapabilities( aPaneId ); - __LOG( "CUPnPVideoPlayerDlg::CheckStatusPaneCapabilities End" ); - // check if we can access the status pane - return ( subPane.IsPresent() && - subPane.IsAppOwned() ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::CreateCustomControlL() const -// Draws the display -// -------------------------------------------------------------------------- -// -SEikControlInfo CUPnPVideoPlayerDlg::CreateCustomControlL( TInt aControlType ) - { - __LOG( "CUPnPVideoPlayerDlg::CreateCustomControlL" ); - - SEikControlInfo controlInfo; - controlInfo.iControl = NULL; - controlInfo.iTrailerTextId = 0; - controlInfo.iFlags = 0; - switch ( aControlType ) - { - case ECustomCtrlDlgCtCustomControl: - { - iContainer = new (ELeave) CCustomCtrlDlgCustomControl(); - controlInfo.iControl = iContainer; - ( (CCustomCtrlDlgCustomControl*)controlInfo.iControl )-> - SetRenderingSession( iRendSession ); - break; - } - default: - { - break; - } - } - __LOG( "CUPnPVideoPlayerDlg::CreateCustomControlL End" ); - return controlInfo; - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::VolumeResult() -// Video volume callback -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::VolumeResult( TInt aError, TInt aVolumeLevel, - TBool /*aActionResponse*/ ) - { - __LOG2( "CUPnPVideoPlayerDlg::VolumeResult err=%d vol=%d", - aError, aVolumeLevel ); - - iAdjustingVolume = EFalse; - - if( aError == KErrNone ) - { - iCurrentVolume = aVolumeLevel; - } - else - { - // ignore error - } - TRAP_IGNORE( ShowVolumeIndicatorL() ); - __LOG( "CUPnPVideoPlayerDlg::VolumeResult End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::InteractOperationComplete() const -// Video operation callback -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::InteractOperationComplete( - TInt aError, - TUPnPAVInteractOperation aOperation ) - { - - __LOG1( "CUPnPVideoPlayerDlg::InteractOperationComplete %d", aError ); - TInt error = KErrNone; - TRAP( error, InteractOperationCompleteL( aError, aOperation ) ) - __LOG( "CUPnPVideoPlayerDlg::InteractOperationComplete" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::InteractOperationCompleteL() const -// leave function to handle callback -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::InteractOperationCompleteL( - TInt aError, - TUPnPAVInteractOperation aOperation ) - { - - __LOG1( "CUPnPVideoPlayerDlg::InteractOperationCompleteL %d", aError ); - // Show error note if there was an error - - if ( aError != KErrNone ) - { - FinishWaitNoteL(); - //stop timer - HideVolumeIdicator( this ); - iTimer->Cancel(); - iRendererPlaying = EFalse; - UpdateSoftkeysL( EUPnPVideoStop ); - iAction = CUPnPCommonUI::EUPnPShow; - HandleErrorL( aError ); - return; - } - - if( iExitCode == EEikBidCancel ) //if video playing is cancelled - { - iRendSession.StopL(); - iExitCode = KErrNone; - } - switch(aOperation) - { - case EUPnPAVPlay: - { - FinishWaitNoteL(); - ContinueAfterPauseL(); - break; - } - case EUPnPAVPlayUser: // fall through - { - //display timer - StartDisplayTimer(); - // Query the position info (track duration, position, etc.) - TRAP_IGNORE( iRendSession.GetPositionInfoL() ); - ContinueAfterPauseL(); - break; - } - case EUPnPAVPause: // fall through - case EUPnPAVPauseUser: - { - iPause = ETrue; - iRendererPlaying = EFalse; - iTimer->Cancel(); - UpdateSoftkeysL( EUPnPVideoPause ); - break; - } - case EUPnPAVStop: // fall through - case EUPnPAVStopUser: - { - HideVolumeIdicator( this ); - iTimer->Cancel(); - iRendererPlaying = EFalse; - iPlaybackPosInSeconds = 0; - iTotalLengthInSeconds = 0; - UpdateSoftkeysL( EUPnPVideoStop ); - } - break; - default: - { - // unknown operation - __PANICD( __FILE__, __LINE__ ); - break; - } - } - __LOG( "CUPnPVideoPlayerDlg::InteractOperationCompleteL" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::InteractOperationComplete() const -// Video operation callback -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::MuteResult( TInt aError, TBool aMute, - TBool /*aActionResponse*/ ) - { - __LOG( "CUPnPVideoPlayerDlg::MuteResult" ); - __LOG3( "MuteResult - aError %d aMute %d iVolume %d ", - aError, aMute, iCurrentVolume ); - - if( KErrNone == aError ) - { - if( aMute ) - { - iCurrentVolume = KMiniumVolume; - } - if ( iVolumePopup) - { - iVolumePopup->SetValue( iCurrentVolume ); - // will close after 1s - TRAP_IGNORE( iVolumePopup->ShowVolumePopupL() ); - } - } - else - { - HideVolumeIdicator( this ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::PositionInfoResult -// UPnP AV Controller calls this method as a response to Position -// Info action. The current position and the total length of the -// track that is currently playing is returned. The results are in -// (hh:mm:ss) format. -// -------------------------------------------------------------------------- -void CUPnPVideoPlayerDlg::PositionInfoResult( TInt aError, - const TDesC8& aTrackPosition, - const TDesC8& aTrackLength ) - { - - __LOG1( "CUPnPVideoPlayerDlg::PositionInfoResult %d", aError ); - if( KErrNone == aError ) - { - if( aTrackPosition.Length() ) - { - TLex8 lex( aTrackPosition ); - TInt tmpint; - TChar ch; - if ( lex.Val( tmpint ) == KErrNone ) - { - iPlaybackPosInSeconds = tmpint * 3600; - } - ch = lex.Get(); - if ( lex.Val( tmpint ) == KErrNone ) - { - iPlaybackPosInSeconds = iPlaybackPosInSeconds + tmpint * 60; - } - ch = lex.Get(); - if ( lex.Val( tmpint ) == KErrNone ) - { - iPlaybackPosInSeconds = iPlaybackPosInSeconds + tmpint; - } - } - if( aTrackLength.Length() ) - { - iTotalLengthInSeconds = 0; - TLex8 lex1( aTrackLength ); - TInt tmpint; - TChar ch; - if ( lex1.Val( tmpint ) == KErrNone ) - { - iTotalLengthInSeconds = tmpint * 3600; - } - ch = lex1.Get(); - if ( lex1.Val( tmpint ) == KErrNone ) - { - iTotalLengthInSeconds = iTotalLengthInSeconds + tmpint * 60; - } - ch = lex1.Get(); - if ( lex1.Val( tmpint ) == KErrNone ) - { - iTotalLengthInSeconds = iTotalLengthInSeconds + tmpint; - - } - } - }// if( KErrNone == aError ) - - if ( iPlaybackPosInSeconds > 0 ) - { - // after knowing remote renderer has started to play at the first - // time, set GetPositonInfo frequency and update the elapsed time. - if ( iGetPositionInfoInterval != KGetPosInfoBeforePlaybackInterval ) - { - iGetPositionInfoInterval = KGetPosInfoPlaybackInterval; - UpdateNaviPaneL(); - } - if ( iPause ) - { - iRendererPlaying = EFalse; - } - else - { - iRendererPlaying = ETrue; - } - } - __LOG( "CUPnPVideoPlayerDlg::PositionInfoResult End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::SetURIResult -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::SetURIResult( TInt aError ) - { - - TRAP_IGNORE( SetURIResultL( aError ) ); - __LOG( "CUPnPVideoPlayerDlg::SetURIResult End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::ContinueAfterPauseL -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::ContinueAfterPauseL() - { - iPause = EFalse; - UpdateSoftkeysL( EUPnPVideoPlay ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::SetURIResultL -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::SetURIResultL( TInt aError ) - { - __LOG1( "CUPnPVideoPlayerDlg::SetURIResult %d", aError ); - - - if( iExitCode == EEikBidCancel ) - { - __LOG( "CUPnPVideoPlayerDlg::SetURIResult Cancelled" ); - return; - } - - if( KErrNone != aError ) - { - FinishWaitNoteL(); - UpdateSoftkeysL( EUPnPVideoStop ); - iAction = CUPnPCommonUI::EUPnPShow; - HandleErrorL( aError ); - } - else - { - iGetPositionInfoInterval = KGetPosInfoBeforePlaybackInterval; - iRendSession.PlayL(); - } - __LOG( "CUPnPVideoPlayerDlg::SetURIResult End" ); - } - -//for media server or WLAN disappeared case -void CUPnPVideoPlayerDlg::DismissItselfL( TInt aError ) - { - HandleErrorL( aError ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::MediaRendererDisappeared -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::MediaRendererDisappeared( - TUPnPDeviceDisconnectedReason aReason ) - { - __LOG( "[UPnPCommonUI]\t CUPnPVideoPlayerDlg: \ -Source Device Dissapeared" ); - // only for renderer disappearing - if( aReason == EDisconnected ) - { - TRAP_IGNORE( HandleErrorL( KErrSessionClosed ) ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayerDlg::HandleResourceChange -// Called by framework when resource change event detected -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::HandleResourceChange(TInt aType) - { - __LOG( "CUPnPVideoPlayerDlg::HandleResourceChange" ); - - CAknDialog::HandleResourceChange( aType ); - - if ( aType == KAknsMessageSkinChange ) - { - iContainer->DrawDeferred(); - } - else if ( aType == KEikDynamicLayoutVariantSwitch ) - { - if (!Layout_Meta_Data::IsLandscapeOrientation()) - { - TRAP_IGNORE( iEikonEnv->AppUiFactory()->StatusPane()-> - SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ) ); - } - SizeChanged(); - iContainer->DrawDeferred(); - } - else - { - // pass - } - __LOG( "CUPnPVideoPlayerDlg::HandleResourceChange End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayerDlg::SizeChanged -// Called by framework after the dialog size has been changed -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::SizeChanged() - { - __LOG( "CUPnPVideoPlayerDlg::SizeChanged" ); - - if ( iContainer ) - { - TRect clientRect = Rect(); - - iContainer->SetRect( clientRect ); - iContainer->DrawDeferred(); - } - CAknDialog::SizeChanged(); - __LOG( "CUPnPVideoPlayerDlg::SizeChanged End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL -// Resolves the target UPnP device capabilites. -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL() - { - __LOG( "CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL" ); - if( iTargetDevice ) - { - iPauseCapability = iTargetDevice->PauseCapability(); - iVolumeCapability = iTargetDevice->VolumeCapability(); - __LOG1( "iPauseCapability:: %d", iPauseCapability ); - __LOG1( "iVolumeCapability:: %d", iVolumeCapability ); - - } - - __LOG( "CUPnPVideoPlayerDlg::ResolveTargetDeviceCapabilitiesL End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::HandleErrorL -// Resolves the target UPnP device capabilites. -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::HandleErrorL( TInt aError ) - { - iCommonUI.GetUpnpAction( iAction ); - if( KErrSessionClosed == aError || - KErrDisconnected == aError ) - { - iExitCode = aError; - TRAP_IGNORE( iRendSession.StopL() ); - if( iVideoPlaybackWaitNote ) - { - TRAP_IGNORE( iVideoPlaybackWaitNote->ProcessFinishedL() ); - delete iVideoPlaybackWaitNote; - iVideoPlaybackWaitNote = NULL; - } - - // When wait note is display or playback is ongoing, if received - // KErrDisconnected or KErrSessionClosed, then to exit the - // VideoPlayerDlg. - TryExitL( iExitCode ); - } - else //common error codes - { - iCommonUI.HandleCommonErrorL( aError, NULL ); - iAction = CUPnPCommonUI::EUPnPNone; - } - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::StartWaitNoteL -// -------------------------------------------------------------------------- -// -TInt CUPnPVideoPlayerDlg::StartWaitNoteL() - { - - __LOG( "CUPnPVideoPlayerDlg::StartWaitNoteL" ); - - TInt ret = KErrNone; - //start preparing playback - if( !iVideoPlaybackWaitNote ) - { - iVideoPlaybackWaitNote = new(ELeave)CAknWaitDialog( - ( REINTERPRET_CAST( CEikDialog**, - &iVideoPlaybackWaitNote ) ), ETrue ); - - // Register to get the responses from the dialog - iVideoPlaybackWaitNote->SetCallback( this ); - - ret = iVideoPlaybackWaitNote->ExecuteLD( - R_UPNPCOMMONUI_VIDEO_PLAYBACK_WAIT_NOTE_DIALOG ); - } - - __LOG1( "CUPnPVideoPlayerDlg::StartWaitNoteL %d", ret ); - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::FinishWaitNoteL -// Finish the video playback wait note -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::FinishWaitNoteL() - { - if( iVideoPlaybackWaitNote ) - { - iVideoPlaybackWaitNote->ProcessFinishedL(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::DialogDismissedL -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::DialogDismissedL( TInt aButtonId ) - { - if( aButtonId == EEikBidCancel ) - { - iExitCode = EEikBidCancel; - - __LOG( "CUPnPVideoPlayerDlg::DialogDismissedL -Cancelled" ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::PreparePlayBackL -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::PreparePlayBackL() - { - __LOG( "CUPnPVideoPlayerDlg::PreparePlayBackL" ); - if( !iTargetDevice ) - { - __LOG( "CUPnPVideoPlayerDlg::PreLayoutDynInitL: \ - TargetDeviceL FAILED!" ); - User::Leave( KErrNotReady ); - } - const CUpnpItem* item = static_cast( iItem ); - HBufC8* uri - = UPnPItemUtility::ResourceFromItemL( *item ).Value().AllocLC(); - // Set the URI - iRendSession.SetURIL( *uri, *item ); - CleanupStack::PopAndDestroy ( uri ); - - __LOG( "CUPnPVideoPlayerDlg::PreparePlayBackL - End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::StartDisplayTimer -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::StartDisplayTimer() - { - //display time on the navipane: 00:00/00:00(total length) - if ( !iTimer->IsActive() ) - { - iTimer->Start( - 0, - KMPOneSecond, - TCallBack( CUPnPVideoPlayerDlg::TimerIndicatorL, - this ) ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::DoChangeVolumeL -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::DoChangeVolumeL() - { - __LOG( "CUPnPVideoPlayerDlg::DoChangeVolumeL" ); - - __LOG1( " iCurrentVolume = %d ", iCurrentVolume ); - - if( iAdjustingVolume || !iVolumeCapability ) - { - return; - } - - if( iVolumeUp ) - { - iNewVolume = iCurrentVolume + KVolumeInterval; - if( iNewVolume > KMaxVolume ) - { - iNewVolume = KMaxVolume; - } - } - else - { - iNewVolume = iCurrentVolume - KVolumeInterval; - if( iNewVolume < KMiniumVolume ) - { - iNewVolume = KMiniumVolume; - } - } - - iRendSession.SetVolumeL( iNewVolume ); - - iAdjustingVolume = ETrue; - - __LOG( "CUPnPVideoPlayerDlg::DoChangeVolumeL - End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::ChangeVolume -// -------------------------------------------------------------------------- -// -TInt CUPnPVideoPlayerDlg::ChangeVolume( TAny* aPtr ) - { - CUPnPVideoPlayerDlg* self = - static_cast( aPtr ); - - TRAPD( err, self->DoChangeVolumeL() ); - - __LOG1( "CUPnPVideoPlayerDlg::DoChangeVolumeL %d", err ); - - if( KErrNone == err ) - { - self->iCurrentVolume = self->iNewVolume; - } - else if( err == KErrSessionClosed || err == KErrDisconnected ) - { - //either MS or MR disappears - TRAP_IGNORE( self->TryExitL( err ) ); - } - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUPnPVideoPlayerDlg::MrccatoCommand -// -------------------------------------------------------------------------- -// -void CUPnPVideoPlayerDlg::MrccatoCommand( - TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct ) - { - __LOG( "CUPnPVideoPlayerDlg::MrccatoCommand" ); - __LOG2( "CUPnPVideoPlayerDlg::MrccatoCommand (0x%X,%d)", - aOperationId, aButtonAct ); - - switch ( aOperationId ) - { - case ERemConCoreApiVolumeUp: - { - switch ( aButtonAct ) - { - case ERemConCoreApiButtonPress: - { - iVolumeUp = ETrue; - iVolumeKeyPressHold = ETrue; - iVolumeTimer->Cancel(); - iVolumeTimer->Start( KMPOneSecond, - KMPOneSecond, - TCallBack( ChangeVolume, this ) ); - break; - } - case ERemConCoreApiButtonRelease: - { - iVolumeKeyPressHold = EFalse; - iVolumeTimer->Cancel(); - break; - } - case ERemConCoreApiButtonClick: - { - iVolumeKeyPressHold = EFalse; - iVolumeUp = ETrue; - TRAP_IGNORE( DoChangeVolumeL() ); - break; - } - default: - break; - } - break; - } - case ERemConCoreApiVolumeDown: - { - switch ( aButtonAct ) - { - case ERemConCoreApiButtonPress: - { - iVolumeKeyPressHold = ETrue; - iVolumeUp = EFalse; - iVolumeTimer->Cancel(); - iVolumeTimer->Start( KMPOneSecond, - KMPOneSecond, - TCallBack( ChangeVolume, this ) ); - break; - } - case ERemConCoreApiButtonRelease: - { - iVolumeKeyPressHold = EFalse; - iVolumeTimer->Cancel(); - break; - } - case ERemConCoreApiButtonClick: - { - iVolumeKeyPressHold = EFalse; - iVolumeUp = EFalse; - TRAP_IGNORE( DoChangeVolumeL() ); - break; - } - default: - break; - } - break; - } - - // Only volume keys handled - case ERemConCoreApiStop: - case ERemConCoreApiRewind: - case ERemConCoreApiFastForward: - case ERemConCoreApiPausePlayFunction: - case ERemConCoreApiPause: - default: - break; - } - __LOG( "CUPnPVideoPlayerDlg::MrccatoCommand - End" ); - } - -// =========================================================================== -// CCustomCtrlDlgCustomControl Implementation -// =========================================================================== - -// -------------------------------------------------------------------------- -// CCustomCtrlDlgCustomControl::CCustomCtrlDlgCustomControl -// -------------------------------------------------------------------------- -// -CCustomCtrlDlgCustomControl::~CCustomCtrlDlgCustomControl() - { - __LOG( "CCustomCtrlDlgCustomControl::~CCustomCtrlDlgCustomControl" ); - delete iImage; - iImage = NULL; - __LOG( "CCustomCtrlDlgCustomControl::~CCustomCtrlDlgCustomControl End" ); - } - -// -------------------------------------------------------------------------- -// CCustomCtrlDlgCustomControl::Draw() const -// Draws the display -// -------------------------------------------------------------------------- -// -void CCustomCtrlDlgCustomControl::Draw( const TRect& /*aRect*/ ) const - { - __LOG( "CCustomCtrlDlgCustomControl::Draw" ); - - TRect rect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); - CWindowGc& gc=SystemGc(); - gc.Clear( rect ); - gc.SetClippingRect( rect ); - gc.DrawRect( rect ); - __LOG( "CCustomCtrlDlgCustomControl::Draw End" ); - } - -// -------------------------------------------------------------------------- -// CCustomCtrlDlgCustomControl::SizeChanged() const -// Set window size -// -------------------------------------------------------------------------- -// -void CCustomCtrlDlgCustomControl::SizeChanged() - { - __LOG( "CCustomCtrlDlgCustomControl::SizeChanged" ); - - TRect rect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); - rect.iTl = TPoint( 0,0 ); - iPosition = TPoint( rect.iTl ); - - iImage->SetPosition( iPosition ); - iImage->SetSize( rect.Size() ); - - __LOG( "CCustomCtrlDlgCustomControl::SizeChanged End" ); - } - -// -------------------------------------------------------------------------- -// CCustomCtrlDlgCustomControl::ConstructFromResourceL() -// Set window size -// -------------------------------------------------------------------------- -// -void CCustomCtrlDlgCustomControl::ConstructFromResourceL( - TResourceReader& /*aReader*/) - { - __LOG( "CCustomCtrlDlgCustomControl::ConstructFromResourceL" ); - - iImage = new(ELeave) CImage( *iRendSession ); - iImage->SetContainerWindowL( *this ); - - TRect rect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); - rect.iTl = TPoint( 0,0 ); - - SetRect( rect ); - ActivateL(); - __LOG( "CCustomCtrlDlgCustomControl::ConstructFromResourceL End" ); - } - -// -------------------------------------------------------------------------- -// CCustomCtrlDlgCustomControl::CountComponentControls() const -// Return number of components -// -------------------------------------------------------------------------- -// -TInt CCustomCtrlDlgCustomControl::CountComponentControls() const - { - return 1; - } - -// -------------------------------------------------------------------------- -// CCustomCtrlDlgCustomControl::ComponentControl() const -// return control pointer -// -------------------------------------------------------------------------- -// -CCoeControl* CCustomCtrlDlgCustomControl::ComponentControl( - TInt aIndex ) const - { - if ( aIndex==0 ) - { - return iImage; - } - return NULL; - } - -// -------------------------------------------------------------------------- -// CCustomCtrlDlgCustomControl::SetRenderingSession() -// -------------------------------------------------------------------------- -// -void CCustomCtrlDlgCustomControl::SetRenderingSession( - MUPnPAVRenderingSession& aRendSession ) - { - __LOG( "CCustomCtrlDlgCustomControl::SetRenderingSession" ); - iRendSession = &aRendSession; - __LOG( "CCustomCtrlDlgCustomControl::SetRenderingSession End" ); - } - -// =========================================================================== -// CImage Implementation -// =========================================================================== - -// -------------------------------------------------------------------------- -// CImage::CImage() -// -------------------------------------------------------------------------- -// -CImage::CImage( MUPnPAVRenderingSession& aRendSession): - iRendSession(aRendSession) - { - __LOG( "CImage::CImage" ); - - iBitmap = NULL; - iMask = NULL; - - TFileName mbmFileName( KAknMultiViewsMbmFileName ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - mbmFileName.Insert( 0, drive ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TRAP_IGNORE( AknsUtils::CreateIconL( - skin, - KAknsIIDDefault, - iBitmap, - iMask, - mbmFileName, - EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer, - EMbmUpnpcommonuiQgn_graf_upnp_ext_renderer_mask ) ); - __LOG( "CImage::CImage End" ); - } - -// -------------------------------------------------------------------------- -// CImage::~CImage() -// -------------------------------------------------------------------------- -// -CImage::~CImage() - { - __LOG( "CImage::~CImage"); - delete iBitmap; - iBitmap = NULL; - delete iMask; - iMask = NULL; - __LOG( "CImage::~CImage End"); - } - -// -------------------------------------------------------------------------- -// CImage::Draw() -// Draw display -// -------------------------------------------------------------------------- -// -void CImage::Draw(const TRect& /*aRect*/) const - { - __LOG( "CImage::Draw" ); - - //change image size - TSize imageSize; - AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EMainPane, imageSize ); - AknIconUtils::SetSize( iBitmap,imageSize ); - - TRAPD( error,DrawL( imageSize ) ); - if ( error ) - { - __LOG1( "CImage::DrawL %d", error ); - } - - __LOG( "CImage::Draw End" ); - } - -// -------------------------------------------------------------------------- -// CImage::DrawL() -// Draw display -// -------------------------------------------------------------------------- -// -void CImage::DrawL( const TRect& aRect ) const - { - __LOG( "CImage::DrawL" ); - - CWindowGc& gc = SystemGc(); - gc.Clear(); - gc.DrawBitmap( aRect, iBitmap ); - - const CUpnpAVDevice* device = &( iRendSession.Device() ); - - const CFont* normalFont = iEikonEnv->NormalFont(); - TInt baseline = ( aRect.Height() / 12 + - ( normalFont->AscentInPixels() / 5 ) ); - gc.UseFont( normalFont ); - gc.SetPenColor( KRgbBlack ); - gc.SetBrushStyle( CGraphicsContext::ENullBrush ); - - // Get device friendly name and replace illegal characters. - HBufC8* tmpfriendlyname = - UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( - ( ( CUpnpAVDevice* )device )->FriendlyName() ); - - CleanupStack::PushL( tmpfriendlyname ); - TPtrC8 friendlyname = *tmpfriendlyname; - - HBufC* tmpbuf = UpnpString::ToUnicodeL( friendlyname.Left( KLength ) ); - - //Get max number of characters fits in the screen - TInt num = normalFont->TextCount( *tmpbuf, aRect.Width() ); - //if the name has the length more than the screen can have - if( tmpbuf->Length() > num ) - { - HBufC* tmpbuf2 = HBufC::NewL( num ); - - tmpbuf2->Des().Copy( tmpbuf->Des().Left( num - KDotLength ) ); - tmpbuf2->Des().Append( KDot ); - gc.DrawText( *tmpbuf2, aRect, baseline, CGraphicsContext::ELeft ); - delete tmpbuf2; - } - else - { - gc.DrawText( *tmpbuf, aRect, baseline, CGraphicsContext::ECenter ); - } - - delete tmpbuf; - CleanupStack::PopAndDestroy( tmpfriendlyname ); - - __LOG( "CImage::DrawL End" ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpextensionpluginif/bwins/upnpextensionpluginifu.def --- a/upnpframework/upnpextensionpluginif/bwins/upnpextensionpluginifu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ??1CUPnPPluginLoader@@UAE@XZ @ 1 NONAME ; CUPnPPluginLoader::~CUPnPPluginLoader(void) - ?CreatePluginsL@CUPnPPluginLoader@@QAEABV?$RPointerArray@VCUPnPPluginInterface@@@@XZ @ 2 NONAME ; class RPointerArray const & CUPnPPluginLoader::CreatePluginsL(void) - ?DeletePlugin@CUPnPPluginLoader@@QAEXH@Z @ 3 NONAME ; void CUPnPPluginLoader::DeletePlugin(int) - ?NewL@CUPnPPluginLoader@@SAPAV1@AAVMUPnPPluginLoaderObserver@@@Z @ 4 NONAME ; class CUPnPPluginLoader * CUPnPPluginLoader::NewL(class MUPnPPluginLoaderObserver &) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpextensionpluginif/eabi/upnpextensionpluginifu.def --- a/upnpframework/upnpextensionpluginif/eabi/upnpextensionpluginifu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - _ZN17CUPnPPluginLoader12DeletePluginEi @ 1 NONAME - _ZN17CUPnPPluginLoader14CreatePluginsLEv @ 2 NONAME - _ZN17CUPnPPluginLoader4NewLER25MUPnPPluginLoaderObserver @ 3 NONAME - _ZN17CUPnPPluginLoaderD0Ev @ 4 NONAME - _ZN17CUPnPPluginLoaderD1Ev @ 5 NONAME - _ZN17CUPnPPluginLoaderD2Ev @ 6 NONAME - _ZThn4_N17CUPnPPluginLoaderD0Ev @ 7 NONAME ; ## - _ZThn4_N17CUPnPPluginLoaderD1Ev @ 8 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpextensionpluginif/group/bld.inf --- a/upnpframework/upnpextensionpluginif/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2005-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 information file for project UPnP Extension plugin if -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../inc/upnppluginloader.h |../../../inc/upnppluginloader.h -../inc/upnppluginloaderobserver.h |../../../inc/upnppluginloaderobserver.h - -PRJ_MMPFILES -upnpextensionpluginif.mmp - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpextensionpluginif/group/upnpextensionpluginif.mmp --- a/upnpframework/upnpextensionpluginif/group/upnpextensionpluginif.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2005-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 project UPnP Extension plugin if -* -*/ - - -#include "../../../group/upnpplatformvar.hrh" -#include "../../inc/upnpframeworkfeatures_mmp.hrh" - -TARGET upnpextensionpluginif.dll -TARGETTYPE dll -UID 0x1000008D 0x20009C9E - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -// SIS installation + IAD support -VERSION 10.1 -paged - -SOURCEPATH ../src -SOURCE upnppluginloader.cpp - -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../inc -USERINCLUDE ../../inc - -LIBRARY euser.lib -LIBRARY ecom.lib - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpextensionpluginif/inc/upnppluginloader.h --- a/upnpframework/upnpextensionpluginif/inc/upnppluginloader.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2006-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: pluginloader which loads home network ECom plugins -* -*/ - - -#ifndef C_UPNPPLUGINLOADER_H -#define C_UPNPPLUGINLOADER_H - -// INCLUDE FILES -// System -#include -#include -#include - -// upnpframework / home media extension api -#include - -class MUPnPPluginLoaderObserver; - -/** - * Loads all the ECom plugins which implement the CUPnPPluginInterface - * interface - * - * @since S60 3.2 - */ -NONSHARABLE_CLASS( CUPnPPluginLoader ) : public MUPnPPluginObserver, - public CBase - { - -public: // 1st phase constructor - - /** - * Returns a pointer to an instance of the CUPnPPluginLoader class - * - * @since S60 3.2 - * @param aLoaderObserver reference to the MUPnPPluginLoaderObserver - * @return Pointer to an instance of the CUPnPPluginLoader class - */ - IMPORT_C static CUPnPPluginLoader* NewL( MUPnPPluginLoaderObserver& - aLoaderObserver ); - -protected: // 2nd phase constructor - - /** - * Default constructor - * - * @since S60 3.2 - * @param aLoaderObserver reference to the MUPnPPluginLoaderObserver - */ - CUPnPPluginLoader( MUPnPPluginLoaderObserver& aLoaderObserver ); - -public: // Destructor - - /** - * Destructor - * - * @since S60 3.2 - */ - IMPORT_C virtual ~CUPnPPluginLoader(); - -public: - - /** - * This method creates all ECOM plugins which implement 0x200075DB - * interface (CUPnPPluginInterface). - * - * @since S60 3.2 - * @return Reference to the plugin array. CUPnPMainDialog uses this - * reference to draw the UI. - */ - IMPORT_C const RPointerArray& CreatePluginsL(); - - /** - * Deletes plugin from iPluginArray which index corresponds the - * parameter. - * - * @since S60 3.2 - * @param aPluginIndex index of plugin to be deleted - */ - IMPORT_C void DeletePlugin( TInt aPluginIndex ); - -protected: // From MUPnPPluginObserver - - /** - * Plugins call this method when they update. - * - * @since S60 3.2 - * @param aEvent event from plugin - */ - void ExtensionEvent( const TExtensionEvent& aEvent ); - -private: - - /** - * Pointer array which contains all the plugins - */ - RPointerArray iPluginArray; - - /** - * Pointer to CUPnPPluginLoaderObserver - * Not own. - */ - MUPnPPluginLoaderObserver* iLoaderObserver; - - }; - - -#endif // C_UPNPPLUGINLOADER_H - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpextensionpluginif/inc/upnppluginloaderobserver.h --- a/upnpframework/upnpextensionpluginif/inc/upnppluginloaderobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2006-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: pluginloader observer -* -*/ - - -#ifndef C_UPNPPLUGINLOADEROBSERVER_H -#define C_UPNPPLUGINLOADEROBSERVER_H - - -/** - * Implemented by CUPnPMainDialog - * - * @since S60 3.2 - */ -class MUPnPPluginLoaderObserver - { -public: - - /** - * Called by UPnPPluginLoader when plugin(s) has been updated - * - * @since S60 3.2 - */ - virtual void PluginsUpdated()=0; - - }; - -#endif // C_UPNPPLUGINLOADEROBSERVER_H - -// end of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpextensionpluginif/src/upnppluginloader.cpp --- a/upnpframework/upnpextensionpluginif/src/upnppluginloader.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Implements CUPnPPluginLoader class -* -*/ - - -#include -#include - -// upnpframework / home media extension api -#include - -// component internal -#include "upnppluginloaderobserver.h" -#include "upnppluginloader.h" - -// log facility -_LIT( KComponentLogfile, "upnpextensionpluginif.txt"); -#include "upnplog.h" - -#ifdef __UPNP_CONSOLE_MT__ -static const TUid KTestPluginId = { 0x20009C9D }; -#endif // __UPNP_CONSOLE_MT__ - -//--------------------------------------------------------------------------- -// CUPnPPluginLoader::NewL -// Construction method. -//--------------------------------------------------------------------------- -EXPORT_C CUPnPPluginLoader* CUPnPPluginLoader::NewL( - MUPnPPluginLoaderObserver& aLoaderObserver) - { - __LOG("CUPnPPluginLoader::NewL"); - - CUPnPPluginLoader* self = - new( ELeave ) CUPnPPluginLoader(aLoaderObserver); - return self; - } - -//--------------------------------------------------------------------------- -// CUPnPPluginLoader::CUPnPPluginLoader -// Default constructor. Sets the iLoaderObserver -//--------------------------------------------------------------------------- -CUPnPPluginLoader::CUPnPPluginLoader(MUPnPPluginLoaderObserver& - aLoaderObserver) - { - __LOG( "CUPnPPluginLoader::CUPnPPluginLoader" ); - - iLoaderObserver = &aLoaderObserver; - } - -//--------------------------------------------------------------------------- -// CUPnPPluginLoader::~CUPnPPluginLoader -// Destroys all the plugins -//--------------------------------------------------------------------------- -EXPORT_C CUPnPPluginLoader::~CUPnPPluginLoader() - { - __LOG( "CUPnPPluginLoader::~CUPnPPluginLoader" ); - - for (TInt i=0;i& - CUPnPPluginLoader::CreatePluginsL() - { - __LOG( "CUPnPPluginLoader::CreatePluginsL" ); - - CImplementationInformation* implInfo = NULL; - RImplInfoPtrArray implArray; - - REComSession::ListImplementationsL(interfaceUid,implArray); - for(TInt i=0;iVendorId() == VID_DEFAULT -#ifdef __UPNP_CONSOLE_MT__ - // In case of module testing load only our test plugin - && implInfo-> ImplementationUid().iUid == KTestPluginId.iUid -#endif // __UPNP_CONSOLE_MT__ - ) - { - CUPnPPluginInterface* interface = NULL; - interface = CUPnPPluginInterface::NewL - ( implInfo->ImplementationUid(), *this ); - - CleanupStack::PushL( interface ); - // interface ownership is transfered and - // iPluginArray will handle the destroying of interface. - iPluginArray.AppendL( interface ); - CleanupStack::Pop( interface ); - } - else - { - __LOG( "CUPnPPluginLoader::CreatePluginsL - \ -Invalid plugin vendor id" ); - } - } - implArray.ResetAndDestroy(); - implArray.Close(); - return iPluginArray; - } - -//--------------------------------------------------------------------------- -// CUPnPPluginLoader::DeletePlugin -// Deletes plugin from iPluginArray -//--------------------------------------------------------------------------- -EXPORT_C void CUPnPPluginLoader::DeletePlugin( TInt aPluginIndex ) - { - __LOG( "CUPnPPluginLoader::DeletePlugin" ); - __ASSERTD( aPluginIndex >= 0, __FILE__, __LINE__ ); - __ASSERTD( aPluginIndex < iPluginArray.Count(), __FILE__, __LINE__ ); - - if ( aPluginIndex < iPluginArray.Count() ) - { - delete iPluginArray[aPluginIndex]; - iPluginArray.Remove(aPluginIndex); - } - } - -//--------------------------------------------------------------------------- -// CUPnPPluginLoader::ExtensionEvent -// From base class MUPnPPluginObserver -// Handles the events which come from plugins -//--------------------------------------------------------------------------- -void CUPnPPluginLoader::ExtensionEvent(const TExtensionEvent& aEvent) - { - __LOG( "CUPnPPluginLoader::ExtensionEvent" ); - - switch ( aEvent ) - { - case EExtensionEnabled: - { - // the extension is enabled by default - no need to call - // explicitly - // NOT IMPLEMENTED - break; - } - case EExtensionDisabled: - { - // when called, disables the item in the list, cannot execute - // NOT IMPLEMENTED - break; - } - case EExtensionIconChanged: - { - // will call GetI1con again, and redraw - iLoaderObserver->PluginsUpdated(); - break; - } - case EExtensionTitleChanged: - { - // will call GetTitle again, and redraw - iLoaderObserver->PluginsUpdated(); - break; - } - case EExtensionSecondaryTextChanged: - { - // will call GetSubTitle again, and redraw - iLoaderObserver->PluginsUpdated(); - break; - } - case EExtensionClosed: - { - // extension which was ExecuteL'd, has been closed. - // NOT IMPLEMENTED - break; - } - default: - { - break; - } - } - } - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpthumbnail/bwins/upnpthumbnailcreator.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpthumbnail/bwins/upnpthumbnailcreator.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ?MdeObjectId@CUpnpThumbnailCreator@@QBEHXZ @ 1 NONAME ; int CUpnpThumbnailCreator::MdeObjectId(void) const + ?NewL@CUpnpThumbnailCreator@@SAPAV1@AAVMUpnpThumbnailCreatorObserver@@ABVTDesC16@@W4TThumbnailDlnaSize@@@Z @ 2 NONAME ; class CUpnpThumbnailCreator * CUpnpThumbnailCreator::NewL(class MUpnpThumbnailCreatorObserver &, class TDesC16 const &, enum TThumbnailDlnaSize) + ?NewLC@CUpnpThumbnailCreator@@SAPAV1@AAVMUpnpThumbnailCreatorObserver@@ABVTDesC16@@W4TThumbnailDlnaSize@@@Z @ 3 NONAME ; class CUpnpThumbnailCreator * CUpnpThumbnailCreator::NewLC(class MUpnpThumbnailCreatorObserver &, class TDesC16 const &, enum TThumbnailDlnaSize) + ?Thumbnail@CUpnpThumbnailCreator@@QBEAAVCFbsBitmap@@XZ @ 4 NONAME ; class CFbsBitmap & CUpnpThumbnailCreator::Thumbnail(void) const + ?ThumbnailFilePath@CUpnpThumbnailCreator@@QBEABVTDesC16@@XZ @ 5 NONAME ; class TDesC16 const & CUpnpThumbnailCreator::ThumbnailFilePath(void) const + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpthumbnail/eabi/upnpthumbnailcreator.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpthumbnail/eabi/upnpthumbnailcreator.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _ZN21CUpnpThumbnailCreator4NewLER29MUpnpThumbnailCreatorObserverRK7TDesC1618TThumbnailDlnaSize @ 1 NONAME + _ZN21CUpnpThumbnailCreator5NewLCER29MUpnpThumbnailCreatorObserverRK7TDesC1618TThumbnailDlnaSize @ 2 NONAME + _ZNK21CUpnpThumbnailCreator11MdeObjectIdEv @ 3 NONAME + _ZNK21CUpnpThumbnailCreator17ThumbnailFilePathEv @ 4 NONAME + _ZNK21CUpnpThumbnailCreator9ThumbnailEv @ 5 NONAME + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpthumbnail/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpthumbnail/group/bld.inf Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,27 @@ +/* +* 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: +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/upnpthumbnailcreator.h |../../../inc/upnpthumbnailcreator.h +../inc/upnpthumbnailcreatorobserver.h |../../../inc/upnpthumbnailcreatorobserver.h + + +PRJ_MMPFILES +thumbnailcreator.mmp diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpthumbnail/group/thumbnailcreator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpthumbnail/group/thumbnailcreator.mmp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + + +TARGET upnpthumbnailcreator.dll +TARGETTYPE dll +UID 0x1000008d 0x20029F11 + + +CAPABILITY CAP_GENERAL_DLL +USERINCLUDE ../inc +USERINCLUDE ../../../inc +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE upnpthumbnailcreator.cpp + +nostrictdef + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY mdeclient.lib +LIBRARY thumbnailmanager.lib +LIBRARY imageconversion.lib + +#ifdef ENABLE_ABIV2_MODE +DEBUGGABLE_UDEBONLY +#endif + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpthumbnail/inc/upnpthumbnailcreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpthumbnail/inc/upnpthumbnailcreator.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,207 @@ +/* +* 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: +* +*/ + +// This file defines the API for ThumbnailCreator.dll + +#ifndef __UPNPTHUMBNAILCREATOR_H__ +#define __UPNPTHUMBNAILCREATOR_H__ + +// Include Files + +#include // CBase +#include // TBuf +#include +#include +#include +#include +#include +#include +#include +#include "upnpthumbnailcreatorobserver.h" + +class CMdeSession; +class CMdEObjectQuery; +class CFbsBitmap; +class CImageEncoder; +// Constants + +enum TThumbnailDlnaSize + { + ESmall = 0, + EMedium, + ELarge, + EThumbnail, + ESmallIcon, + ELargeIcon + }; + +// Class Definitions + +NONSHARABLE_CLASS( CUpnpThumbnailCreator) : private CActive, + private MMdESessionObserver, + private MMdEQueryObserver, + private MThumbnailManagerObserver + { +public: + // states for this engine + enum TThumbnailCreatorStates + { + EIdle = 0, + EInitializeMde, + EQueryingImage, + EFetchingThumbnail, + EConvertingThumbnail + }; + // new functions + + /** + * static NewL + * + * @param MUpnpThumbnailCreatorObserver, thumbnail creator observer + * @param aFilePath, file path of the source file + * @return instance to CUpnpThumbnailCreator + */ + IMPORT_C static CUpnpThumbnailCreator* NewL( + MUpnpThumbnailCreatorObserver& aMThumbnailCreatorObserver, + const TDesC& aFilePath, + TThumbnailDlnaSize aSize); + + /** + * static NewLC + * + * @param MUpnpThumbnailCreatorObserver, thumbnail creator observer + * @param aFilePath, file path of the source file + * @return instance to CUpnpThumbnailCreator + */ + IMPORT_C static CUpnpThumbnailCreator* NewLC( + MUpnpThumbnailCreatorObserver& aMThumbnailCreatorObserver, + const TDesC& aFilePath, + TThumbnailDlnaSize aSize); + + + /** + * On completion of the ThumbnailCreatorReady callback with status KErrNone, + * this method MdeObjectId returns the MdE object Id for the image. + * @return ObjectId for the object in MdE + */ + IMPORT_C TInt MdeObjectId() const; + + /** + * On completion of the ThumbnailCreatorReady callback with status KErrNone, + * this method ThumbnailFilePath returns the thumbnail file path. + * @return filepath of the thumbnail + */ + IMPORT_C const TDesC& ThumbnailFilePath() const; + + /** + * On completion of the ThumbnailCreatorReady callback with status KErrNone, + * this method Thumbnail returns the thumbnail + * @return reference to thumbnail created + */ + IMPORT_C CFbsBitmap& Thumbnail() const; + +public: + + /** + * Destructor + */ + ~CUpnpThumbnailCreator(); + +private: + /******************************************************************** + * MMdESessionObserver virtual methods + ********************************************************************/ + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + + /******************************************************************** + * MMdEQueryObserver virtual methods + ********************************************************************/ + void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount); + void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); + + /******************************************************************** + * MThumbnailManagerObserver virtual methods + ********************************************************************/ + // Callbacks from MThumbnailManagerObserver for getting thumbnails + void ThumbnailPreviewReady(MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); + + void ThumbnailReady(TInt aError, MThumbnailData& aThumbnail, + TThumbnailRequestId aId ); + + +private: + // CActive + void DoCancel(); + void RunL(); + TInt RunError (TInt aError); + +private: + // new functions + + // CI: erkki missing doxygen comments @param ... + + /** CUpnpthumbnailCreator Constructor*/ + CUpnpThumbnailCreator( + MUpnpThumbnailCreatorObserver& aMUpnpThumbnailCreatorObserver, + TThumbnailDlnaSize aSize); + + /** Two Phase constructor -ConstructL method*/ + void ConstructL(const TDesC& aFilePath); + + TSize ConvertDlnaSizeToImageSize(); + + /** Query to Metadata engine*/ + void QueryMdeL(); + + /** GetThumbnail from Thumbnailmanager*/ + void GetThumbnail(); + + /** Pepare the filepath for thumbnail storage*/ + void PrepareThumbnailFilePathL(); + + /** Notifies observer*/ + void ThumbnailReady( TInt aErr ); + + /** Uses ICL encoder to Encode and Save the thumbnail*/ + void EncodeAndSaveThumbnailL(); + + /** Completes active object*/ + void CompleteRequest(TInt aError); + + + +private: + // data + CMdESession* iMdESession; //owned + CMdEQuery* iMdEQuery; //owned + CFbsBitmap* iThumbnail; //owned + HBufC* iImageFilePath; //owned + HBufC* iThumbnailFilePath; //owned + TInt iObjectid; + CThumbnailManager* iThmbManager; //owned + MUpnpThumbnailCreatorObserver& iMUpnpThumbnailCreatorObserver; + RFs iFsSession; //owned + CImageEncoder* iImageEncoder; //owned, encoder from ICL API + TThumbnailCreatorStates iState; + TThumbnailDlnaSize iThumbnailDlnaSize; + }; + +#endif // __UPNPTHUMBNAILCREATOR_H__ + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpthumbnail/inc/upnpthumbnailcreatorobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpthumbnail/inc/upnpthumbnailcreatorobserver.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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: +* +*/ + + +#ifndef __UPNPTHUMBNAILCREATOROBSERVER_H__ +#define __UPNPTHUMBNAILCREATOROBSERVER_H__ + +// Include Files + + +class MUpnpThumbnailCreatorObserver + { +public: + virtual void ThumbnailCreatorReady( TInt aError) = 0; + }; + + +#endif // __UPNPTHUMBNAILCREATOROBSERVER_H__ + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnpthumbnail/src/upnpthumbnailcreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnpthumbnail/src/upnpthumbnailcreator.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,513 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// Include Files + +#include +#include +#include +#include +#include +#include +#include +#include +#include "upnpthumbnailcreator.h" // CUpnpThumbnailCreator +#include "upnpthumbnailcreatorObserver.h" +#include "upnpfileutilitytypes.h" + +_LIT( KComponentLogfile, "upnpthumbnailcreator.txt"); +_LIT(KSystemFilePath, "c:\\system\\temp\\"); +#include "upnplog.h" + +const TInt KSmallWidth = 640; +const TInt KSmallHeight = 480; +const TInt KMediumWidth = 1024; +const TInt KMediumHeight = 768; +const TInt KLargeWidth = 4096; +const TInt KLargeHeight = 4096; +const TInt KThumbnailWidth = 160; +const TInt KThumbnailHeight = 160; +const TInt KSmallIconWidth = 48; +const TInt KSmallIconHeight = 48; +const TInt KLargeIconWidth = 160; +const TInt KLargeIconHeight = 160; +// Member Functions + + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::NewLC +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +EXPORT_C CUpnpThumbnailCreator* CUpnpThumbnailCreator::NewLC( + MUpnpThumbnailCreatorObserver& aMUpnpThumbnailCreatorObserver, + const TDesC& aFilePath, + TThumbnailDlnaSize aSize) + { + CUpnpThumbnailCreator* self = new (ELeave) CUpnpThumbnailCreator( + aMUpnpThumbnailCreatorObserver, aSize); + CleanupStack::PushL(self); + self->ConstructL(aFilePath); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::NewL +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +EXPORT_C CUpnpThumbnailCreator* CUpnpThumbnailCreator::NewL( + MUpnpThumbnailCreatorObserver& aMUpnpThumbnailCreatorObserver, + const TDesC& aFilePath, + TThumbnailDlnaSize aSize) + { + __LOG1( "CUpnpThumbnailCreator:NewL() aFilePath: &s", &aFilePath); + CUpnpThumbnailCreator* self = CUpnpThumbnailCreator::NewLC( + aMUpnpThumbnailCreatorObserver,aFilePath, aSize); + CleanupStack::Pop(self); + return self; + } + + + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::MdeObjectId +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +EXPORT_C TInt CUpnpThumbnailCreator::MdeObjectId() const + { + return iObjectid; + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::ThumbnailFilePath +// See upnpthumbnailcreator.h // CI: RM return TDesC & +//--------------------------------------------------------------------------- +EXPORT_C const TDesC& CUpnpThumbnailCreator::ThumbnailFilePath() const + { + __ASSERT( iThumbnailFilePath, __FILE__, __LINE__ ); + return *iThumbnailFilePath; + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::Thumbnail +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +EXPORT_C CFbsBitmap& CUpnpThumbnailCreator::Thumbnail() const + { + __ASSERT( iThumbnail, __FILE__, __LINE__ ); + return *iThumbnail; + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::~CUpnpThumbnailCreator +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +CUpnpThumbnailCreator::~CUpnpThumbnailCreator() + { + __LOG( "CUpnpThumbnailCreator:~CUpnpThumbnailCreator()"); + if (IsActive()) + { + Cancel(); + } + + delete iImageFilePath; + delete iMdEQuery; + delete iMdESession; + delete iThumbnail; + delete iThmbManager; + delete iImageEncoder; + + if(iThumbnailFilePath != NULL) + { + iFsSession.Delete(iThumbnailFilePath->Des()); + delete iThumbnailFilePath; + } + iFsSession.Close(); + + } + + +/******************************************************************** + * MMdESessionObserver virtual methods + ********************************************************************/ + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::HandleSessionOpened +// See mdesession.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::HandleSessionOpened(CMdESession& /*aSession*/, + TInt aError) + { + __LOG1( "CUpnpThumbnailCreator:HandleSessionOpened() %d", aError); + CompleteRequest(aError); + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::HandleSessionError +// See mdesession.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::HandleSessionError(CMdESession& /*aSession*/, + TInt aError) + { + __LOG1( "CUpnpThumbnailCreator:HandleSessionError() %d", aError); + CompleteRequest(aError); + } +/******************************************************************** + * MMdEQueryObserver virtual methods + ********************************************************************/ + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::HandleQueryNewResults +// See mdequery.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::HandleQueryNewResults(CMdEQuery& aQuery, + TInt aFirstNewItemIndex, + TInt aNewItemCount) + { + CMdEObjectQuery& query = (CMdEObjectQuery &) aQuery; + if (aNewItemCount > 0) + { + TInt i( aFirstNewItemIndex); + for ( ; i < (aFirstNewItemIndex+aNewItemCount); i++) + { + CMdEObject* object = (CMdEObject*)query.TakeOwnershipOfResult(i); + if(object->Uri().CompareF(iImageFilePath->Des()) == 0) + { + iObjectid = object->Id(); + CompleteRequest(KErrNone); + break; + } + delete object; + } + if(i == (aFirstNewItemIndex + aNewItemCount)) + { + CompleteRequest(KErrNotFound); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::HandleQueryCompleted +// See mdequery.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::HandleQueryCompleted(CMdEQuery& /*aQuery*/, + TInt aError) + { + __LOG1( "CUpnpThumbnailCreator:HandleQueryCompleted() %d",aError); + if(aError != KErrNone) + { + CompleteRequest(aError); + } + } + +/******************************************************************** + * MThumbnailManagerObserver virtual methods + ********************************************************************/ + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::ThumbnailPreviewReady +// See thumbnailmanagerobserver.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::ThumbnailPreviewReady(MThumbnailData& /*aThumbnail*/, + TThumbnailRequestId /*aId*/ ) + { + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::ThumbnailReady +// See thumbnailmanagerobserver.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::ThumbnailReady(TInt aError, + MThumbnailData& aThumbnail, + TThumbnailRequestId /*aId*/ ) + { + // This function must not leave. + __LOG1( "CUpnpThumbnailCreator:ThumbnailReady() %d",aError); + delete iThumbnail; iThumbnail = NULL; + if ( aError == KErrNone ) + { + // Claim ownership of the bitmap instance for later use + iThumbnail = aThumbnail.DetachBitmap(); + } + + CompleteRequest(aError); + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::NotifyCompletion +// See upnpbitmapconverterobserver.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::ThumbnailReady(TInt aError) + { + if(iThumbnailFilePath) + { + TInt ret = iFsSession.SetAtt(iThumbnailFilePath->Des(),KEntryAttHidden,KEntryAttArchive); + __LOG1( "CUpnpThumbnailCreator:NotifyCompletion - thumbnail attribute hidden result %d",ret); + } + iMUpnpThumbnailCreatorObserver.ThumbnailCreatorReady(aError); + } + + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::CUpnpThumbnailCreator +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +CUpnpThumbnailCreator::CUpnpThumbnailCreator( + MUpnpThumbnailCreatorObserver& aMUpnpThumbnailCreatorObserver, + TThumbnailDlnaSize aSize) + :CActive( CActive::EPriorityStandard ), + iMUpnpThumbnailCreatorObserver(aMUpnpThumbnailCreatorObserver), + iThumbnailDlnaSize (aSize) + + { + CActiveScheduler::Add( this ); + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::ConstructL +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::ConstructL(const TDesC& aFilePath) + { + // second phase constructor, anything that may leave must be constructed here + __LOG( "CUpnpThumbnailCreator:ConstructL() "); + iState = EIdle; + User::LeaveIfError(iFsSession.Connect()); + iImageFilePath = aFilePath.AllocL(); + + ConvertDlnaSizeToImageSize(); + + iThmbManager = CThumbnailManager::NewL( *this ); + + // Set flags: Keep aspect ratio and allow smaller image than requested + iThmbManager->SetFlagsL(static_cast( + CThumbnailManager::EDefaultFlags | CThumbnailManager::EAllowAnySize )); + + // Preferred size is 160x120 (or less) + iThmbManager->SetThumbnailSizeL( ConvertDlnaSizeToImageSize() ); + + iState = EInitializeMde; + iMdESession = CMdESession::NewL(*this); + + iStatus = KRequestPending; + SetActive(); + } + +TSize CUpnpThumbnailCreator::ConvertDlnaSizeToImageSize() + { + TSize thumbnailSize; + + switch (iThumbnailDlnaSize) + { + case ESmall: + { + thumbnailSize = TSize (KSmallWidth, KSmallHeight); + break; + } + case EMedium: + { + thumbnailSize = TSize (KMediumWidth, KMediumHeight); + break; + } + case ELarge: + { + thumbnailSize = TSize (KLargeWidth, KLargeHeight); + break; + } + case EThumbnail: + { + thumbnailSize = TSize (KThumbnailWidth, KThumbnailHeight); + break; + } + case ESmallIcon: + { + thumbnailSize = TSize (KSmallIconWidth, KSmallIconHeight); + break; + } + case ELargeIcon: + { + thumbnailSize = TSize (KLargeIconWidth, KLargeIconHeight); + break; + } + default: + { + __LOG( "CUpnpThumbnailCreator::ConvertDlnaSizeToImageSize - Not Expected!" ); + __PANIC( __FILE__, __LINE__ ); + break; + } + } + + return thumbnailSize; + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::QueryMdeL +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::QueryMdeL() + { + __LOG( "CUpnpThumbnailCreator:QueryMdeL() "); + User::LeaveIfNull(iMdESession); //CI: LeaveIfNull() leaves with KErrNoMemory is this the idea? or can this even happen?? + + CMdENamespaceDef& namespacedef = iMdESession->GetDefaultNamespaceDefL(); + CMdEObjectDef& objectdef = namespacedef.GetObjectDefL( + MdeConstants::Image::KImageObject); + iMdEQuery = iMdESession->NewObjectQueryL(namespacedef, objectdef, this); + + iMdEQuery->SetResultMode(EQueryResultModeItem); + + iMdEQuery->FindL(); + + iStatus = KRequestPending; + SetActive(); + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::ParseImageMediaObjectL +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- + +void CUpnpThumbnailCreator::GetThumbnail() + { + __LOG( "CUpnpThumbnailCreator:GetThumbnail() "); + // object id is available for the image, + // thumbnail manager can give us the thumbnail. + iThmbManager->GetThumbnailL(iObjectid); + + iStatus = KRequestPending; + SetActive(); + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::PrepareThumbnailFilePathL +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::PrepareThumbnailFilePathL() + { + __LOG( "CUpnpThumbnailCreator:PrepareThumbnailFilePathL() "); + TFileName path(KSystemFilePath); + //User::LeaveIfError(iFsSession.SessionPath(path)); + TInt ret = iFsSession.MkDir(path); + //handle when creation of the path fails. + if(ret == KErrNone || ret == KErrAlreadyExists ) + { + TParse p; + p.Set(iImageFilePath->Des(),NULL,NULL); + TFileName filenameandext(p.NameAndExt()); + path.Append(filenameandext); + iThumbnailFilePath = path.AllocL(); + } + else + { + User::Leave(ret); + } + } + +// -------------------------------------------------------------------------- +// CUpnpThumbnailCreator::SaveThumbnailL +// See upnpthumbnailcreator.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::EncodeAndSaveThumbnailL() + { + __LOG( "CUpnpThumbnailCreator:SaveThumbnailL() "); + PrepareThumbnailFilePathL(); + + iImageEncoder = CImageEncoder::FileNewL(iFsSession,*iThumbnailFilePath, + CImageEncoder::EOptionNone, KImageTypeJPGUid,KNullUid ); + + iImageEncoder->Convert( &iStatus, *iThumbnail ); + SetActive(); + } + +void CUpnpThumbnailCreator::CompleteRequest(TInt aError) + { + TRequestStatus* stat = &iStatus; + User::RequestComplete( stat, aError ); + } + + +// -------------------------------------------------------------------------- +// CUpnpBitmapConverter::RunL +// See upnpbitmapconverter.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::RunL() + { + __LOG1( "CUpnpThumbnailCreator:RunL() iStatus=%d", iStatus.Int()); + + if (iStatus.Int() < 0) + { + ThumbnailReady(iStatus.Int()); + } + else + { + switch (iState) + { + case EIdle: + { + break; + } + case EInitializeMde: + { + iState = EQueryingImage; + QueryMdeL(); + break; + } + case EQueryingImage: + { + iState = EFetchingThumbnail; + GetThumbnail(); + break; + } + case EFetchingThumbnail: + { + iState = EConvertingThumbnail; + EncodeAndSaveThumbnailL(); + break; + } + case EConvertingThumbnail: + { + ThumbnailReady(iStatus.Int()); + break; + } + } + } + } + +TInt CUpnpThumbnailCreator::RunError( TInt aError ) + { + iState = EIdle; + ThumbnailReady(aError); + return KErrNone; + } + + +// -------------------------------------------------------------------------- +// CUpnpBitmapConverter::DoCancel +// See upnpbitmapconverter.h +//--------------------------------------------------------------------------- +void CUpnpThumbnailCreator::DoCancel() + { + __LOG( "CUpnpThumbnailCreator:DoCancel()"); + if (iState == EConvertingThumbnail) + { + iImageEncoder->Cancel(); + } + else + { + TRequestStatus* stat = &iStatus; + User::RequestComplete( stat, KErrCancel ); + } + } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnputilities/BWINS/upnpconnmonu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnputilities/BWINS/upnpconnmonu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?NewL@CUPnPConnectionMonitor@@SAPAV1@H@Z @ 1 NONAME ; class CUPnPConnectionMonitor * CUPnPConnectionMonitor::NewL(int) + ?NotifyIap@CUPnPConnectionMonitor@@QAEXH@Z @ 2 NONAME ; void CUPnPConnectionMonitor::NotifyIap(int) + ?NotifyIapCancel@CUPnPConnectionMonitor@@QAEXXZ @ 3 NONAME ; void CUPnPConnectionMonitor::NotifyIapCancel(void) + ?SetObserver@CUPnPConnectionMonitor@@QAEXAAVMUPnPConnectionMonitorObserver@@@Z @ 4 NONAME ; void CUPnPConnectionMonitor::SetObserver(class MUPnPConnectionMonitorObserver &) + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnputilities/EABI/upnpconnmonu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnputilities/EABI/upnpconnmonu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,8 @@ +EXPORTS + _ZN22CUPnPConnectionMonitor11SetObserverER30MUPnPConnectionMonitorObserver @ 1 NONAME + _ZN22CUPnPConnectionMonitor15NotifyIapCancelEv @ 2 NONAME + _ZN22CUPnPConnectionMonitor4NewLEi @ 3 NONAME + _ZN22CUPnPConnectionMonitor9NotifyIapEi @ 4 NONAME + _ZTI22CUPnPConnectionMonitor @ 5 NONAME + _ZTV22CUPnPConnectionMonitor @ 6 NONAME + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnputilities/group/upnpconnmon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnputilities/group/upnpconnmon.mmp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006-2007 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: UPnP utilities project definition file +* +*/ + + +#include "../../../group/upnpplatformvar.hrh" +#include "../../../inc/upnpframeworkfeatures_mmp.hrh" + + +// Build target +TARGET upnpconnmon.dll +TARGETTYPE DLL +UID 0x1000008D 0x20029F5E + +// Platform security +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +// SIS installation + IAD support +VERSION 10.1 +paged + +// Include paths +USERINCLUDE ../../inc +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +// Sources +SOURCEPATH ../src +SOURCE upnpconnectionmonitor.cpp + +// Core platform +LIBRARY euser.lib +LIBRARY connmon.lib + +// debug logging facilities +DEBUGLIBRARY flogger.lib + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnputilities/inc/upnppathutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnputilities/inc/upnppathutility.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,268 @@ +/* +* Copyright (c) 2002-2007 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: Utility class to get path related info for the media files +*/ + + + + + + +#ifndef UPNPPATHUTILITY_H +#define UPNPPATHUTILITY_H + +// INCLUDE FILES +#include // CBase +#include // TDriveNumber + +// FORWARD DECLARATIONS +class CUPnPSettingsEngine; +class CUpnpObject; +class CUpnpItem; +class CUpnpElement; +class CUpnpAttribute; +class CUpnpDlnaProtocolInfo; + +// CLASS DECLARATION +/** + * Path utility class to get path related info for the media files + * @lib upnputilities.lib + */ +NONSHARABLE_CLASS ( CUPnPPathUtility ) : public CBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CUPnPPathUtility* NewL(); + + /** + * Two-phased constructor. + */ + IMPORT_C static CUPnPPathUtility* NewLC(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CUPnPPathUtility(); + + +public: // new functions + + /** + * Gets the drive for the copy operation + * @param aDrive, reference to copy path drive + */ + IMPORT_C void GetCopyPathDriveL( TDriveNumber& aDrive ) const; + + /** + * Gets the path of the upnp item's file to be copied + * @param aItem, a upnp item + * @param aResource, resource of the upnp item + * @param aAppendTitleAndExt, If ETrue title and extensions gets + * appended to the path otherwise not. + * @return HBufC*, copy path. Ownership is transferred to the caller + * Leaves in case of an error. + */ + IMPORT_C HBufC* GetCopyPathL(const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt ) const; + + /** + * Gets the path of the upnp item's file to be copied + * @param aItem, a upnp item + * @param aResource, resource of the upnp item + * @param aAppendTitleAndExt, If ETrue title and extensions gets + * appended to the path otherwise not. + * @param aDriveNumber, drive number to be used for the path calculation + * @return HBufC*, copy path. Ownership is transferred to the caller + * Leaves in case of an error. + */ + IMPORT_C HBufC* GetCopyPathL(const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt, + TDriveNumber aDriveNumber ) const; + + /** + * Gets and creates (if necessary) the path of the upnp item's + * file to be copied. + * @param aItem, a upnp item + * @param aResource, resource of the upnp item + * @param aAppendTitleAndExt, If ETrue title and extensions gets + * appended to the path otherwise not. + * @return HBufC*, copy path. Ownership is transferred to the caller + * Leaves in case of an error. + */ + IMPORT_C HBufC* CreateCopyPathL(const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt ) const; + + /** + * Gets and creates (if necessary) the path of the upnp item's + * file to be copied. + * @param aItem, a upnp item + * @param aResource, resource of the upnp item + * @param aAppendTitleAndExt, If ETrue title and extensions gets + * appended to the path otherwise not. + * @param aDriveNumber, drive number to be used for the path calculation + * @return HBufC*, copy path. Ownership is transferred to the caller + * Leaves in case of an error. + */ + IMPORT_C HBufC* CreateCopyPathL(const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt, + TDriveNumber aDriveNumber ) const; + + /** + * Removes empty folders from the copy path + * @param aCopyPath, the copy path to be analysed + */ + IMPORT_C static void RemoveEmptyFoldersFromCopyPathL( + const TDesC& aCopyPath ); + +private: + + /** + * C++ default constructor. + */ + CUPnPPathUtility(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Gets and creates (if necessary) the path of the upnp item's + * file to be copied. + * @param aItem, a upnp item + * @param aResource, resource of the upnp item + * @param aAppendTitleAndExt, If ETrue title and extensions gets + * appended to the path otherwise not. + * @param aCreatePath, If ETrue path gets created otherwise not. + * @param aDriveNumber, drive number to be used for the path calculation + * @return HBufC*, copy path. Ownership is transferred to the caller + * Leaves in case of an error. + */ + HBufC* GetCreateCopyPathL(const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt, + TBool aCreatePath, + TDriveNumber aDriveNumber ) const; + /** + * Appends title and extension to the path. + * @param aPath, path of the upnp item + * @param aProtocolInfo, protocol info. attribute of the resource elem. + * @param aItem, a upnp item + */ + void AppendTitleAndExtL( TDes& aPath, + CUpnpDlnaProtocolInfo& aProtocolInfo, + const CUpnpItem& aItem ) const; + /** + * Appends year, month and day to the path. + * @param aPath, path of the upnp item + * @param aItem, a upnp item + */ + void AppendYearMonthDayL( + TDes& aPath, const CUpnpItem& aItem ) const; + + /** + * Appends artist and album to the path. + * @param aPath, path of the upnp item + * @param aItem, a upnp item + */ + void AppendArtistAlbumL( + TDes& aPath, const CUpnpItem& aItem ) const; + + /** + * Appends data to the path's buffer. + * Leaves if data exceeds the maxlength of the buffer + * + * @param aPath, path of the upnp item + * @param aData, data which needs to be appended + */ + void AppendDataL( TDes& aPath, const TDesC& aData ) const; + + /** + * Checks whether the data can be appended to buffer or not. + * Leaves if data exceeds the maxlength of the buffer + * + * @param aPath, path of the upnp item + * @param aData, data which needs to be appended + */ + void CheckBufferSpaceL( const TDes& aPath, + const TDesC& aData ) const; + + /** + * Checks whether the data of the specified length + * can be appended to buffer or not. + * Leaves if data exceeds the maxlength of the buffer + * + * @param aPath, path of the upnp item + * @param aLength, length of the data which needs to be appended + */ + void CheckBufferSpaceL( const TDes& aPath, + const TInt& aLength ) const; + + /** + * Finds an element within an object. + * + * @param aObject the object where to look for elements + * @param aName element name + * @return a pointer to the element, or NULL if not found + */ + const CUpnpElement* FindElementByName( + const CUpnpObject& aObject, const TDesC8& aName ) const; + + /** + * Finds an attribute within an upnp element + * + * @param aElement the element where to look for attributes + * @param aName attribute name + * @return a pointer to the attribute found + */ + const CUpnpAttribute* FindAttributeByName( + const CUpnpElement& aElement, const TDesC8& aName ) const; + + /** + * Converts given upnp date string into TTime. + * + * @param aUpnpDate value from item's dc:date element + * @param aTime out variable to receive corresponding TTime + * @return KErrNone if conversion was succesful, otherwise < 0 + * for error values see TTime::Parse() + */ + void UPnPDateAsTTimeL( const TDesC8& aUpnpDate, + TTime& aTime ) const; + + /** + * Removes empty folders from the full path + * @param aBasePath, base path (e.g. till Images\ or Sounds\ ) + * @param aFullPath, complete path (without filename and extension) + */ + static void RemoveEmptyFoldersL( const TDesC& aBasePath, + const TDesC& aFullPath ); + +private: // data + + // Settings Engine + CUPnPSettingsEngine* iSettingsEngine; + + }; + +#endif // UPNPPATHUTILITY_H + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpframework/upnputilities/src/upnppathutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpframework/upnputilities/src/upnppathutility.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,614 @@ +/* +* Copyright (c) 2002-2007 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: Utility class to get path related info for the media files +*/ + +// INCLUDE FILES +#include +#include "upnpsettingsengine.h" +#include "upnpconstantdefs.h" +#include +#include +#include +#include + +#include "upnppathutility.h" +#include "Upnpcommonutils.h" + +// CONSTANTS +_LIT( KYearMonthDayFormat, "%04d\\%02d\\%02d\\"); +_LIT( KTitleExtFormat, "%S%S"); +_LIT( KArtistFormat, "%S\\"); +_LIT( KAlbumFormat, "%S\\"); +_LIT( KSlash, "\\"); +_LIT( KSlashData, "\\Data\\"); +_LIT( KUnknown, "Unknown"); + +_LIT( KSeparator, ":" ); +_LIT( KNullTime, "000000" ); + +const TInt KDateStringLength = 10; +const TInt KDateTimeStringLength = 19; +const TInt KMaxDateStringLength = 30; + +// ============================ MEMBER FUNCTIONS ============================ + +// --------------------------------------------------------------------------- +// CUPnPPathUtility::CUPnPPathUtility +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CUPnPPathUtility::CUPnPPathUtility() + { + } + +// --------------------------------------------------------------------------- +// CUPnPPathUtility::NewL +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CUPnPPathUtility* CUPnPPathUtility::NewL() + { + CUPnPPathUtility* self = CUPnPPathUtility::NewLC(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CUPnPPathUtility::NewLC +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CUPnPPathUtility* CUPnPPathUtility::NewLC() + { + CUPnPPathUtility* self = new( ELeave ) CUPnPPathUtility; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CUPnPPathUtility::ConstructL +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CUPnPPathUtility::ConstructL() + { + iSettingsEngine = CUPnPSettingsEngine::NewL(); + } + +// --------------------------------------------------------------------------- +// CUPnPPathUtility::~CUPnPPathUtility() +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CUPnPPathUtility::~CUPnPPathUtility() + { + delete iSettingsEngine; + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::GetCopyPathDriveL +// Gets the drive for the copy operation +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +EXPORT_C void CUPnPPathUtility::GetCopyPathDriveL( + TDriveNumber& aDrive ) const + { + iSettingsEngine->GetCopyLocationDriveL( aDrive ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::GetCopyPathL +// Returns the path of the upnp item to be copied +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +EXPORT_C HBufC* CUPnPPathUtility::GetCopyPathL( + const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt ) const + { + TDriveNumber drive; + iSettingsEngine->GetCopyLocationDriveL( drive ); + return GetCreateCopyPathL( aItem, + aResource, + aAppendTitleAndExt, + EFalse, + drive ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::GetCopyPathL +// Returns the path of the upnp item to be copied +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +EXPORT_C HBufC* CUPnPPathUtility::GetCopyPathL( + const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt, + TDriveNumber aDriveNumber ) const + { + + return GetCreateCopyPathL( aItem, + aResource, + aAppendTitleAndExt, + EFalse, + aDriveNumber ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::CreateCopyPathL +// Returns the path of the upnp item to be copied +// Creates the path if necessary and appends the filename and extension if +// required +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +EXPORT_C HBufC* CUPnPPathUtility::CreateCopyPathL( + const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt ) const + { + TDriveNumber drive; + iSettingsEngine->GetCopyLocationDriveL( drive ); + return GetCreateCopyPathL( aItem, + aResource, + aAppendTitleAndExt, + ETrue, + drive ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::CreateCopyPathL +// Returns the path of the upnp item to be copied +// Creates the path if necessary and appends the filename and extension if +// required +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +EXPORT_C HBufC* CUPnPPathUtility::CreateCopyPathL( + const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt, + TDriveNumber aDriveNumber ) const + { + return GetCreateCopyPathL( aItem, + aResource, + aAppendTitleAndExt, + ETrue, + aDriveNumber ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::RemoveEmptyFoldersFromCopyPathL +// Removes empty folders from the copy path +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +EXPORT_C void CUPnPPathUtility::RemoveEmptyFoldersFromCopyPathL( + const TDesC& aCopyPath ) + { + TPtrC basePath; + const TDesC& soundsPath = PathInfo::SoundsPath(); + const TDesC& videosPath = PathInfo::VideosPath(); + const TDesC& imagesPath = PathInfo::ImagesPath(); + const TDesC& othersPath = PathInfo::OthersPath(); + + TInt baseLength = 0; + TInt found = KErrNotFound; + if ( KErrNotFound != ( found = aCopyPath.Find( + soundsPath ) ) ) + { + baseLength = soundsPath.Length(); + } + else if ( KErrNotFound != ( found = aCopyPath.Find( + videosPath ) ) ) + { + baseLength = videosPath.Length(); + } + else if ( KErrNotFound != ( found = aCopyPath.Find( + imagesPath ) ) ) + { + baseLength = imagesPath.Length(); + } + else if ( KErrNotFound != ( found = aCopyPath.Find( + othersPath ) ) ) + { + baseLength = othersPath.Length(); + } + + if ( KErrNotFound != found ) + { + TPtrC basePath = aCopyPath.Left( found + baseLength ); + TParse parsePath; + User::LeaveIfError( parsePath.Set( aCopyPath, NULL, NULL ) ); + //Remove filename and extension before passing the copy path + RemoveEmptyFoldersL( basePath, parsePath.DriveAndPath() ); + } + + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::GetCreateCopyPathL +// Returns the path of the upnp item to be copied +// Creates the path if necessary and appends the filename and extension if +// required +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +HBufC* CUPnPPathUtility::GetCreateCopyPathL( + const CUpnpItem& aItem, + const CUpnpElement& aResource, + TBool aAppendTitleAndExt, + TBool aCreatePath, + TDriveNumber aDriveNumber ) const + { + + HBufC* path = HBufC::NewLC( KMaxPath ); + TPtr refPath = path->Des(); + + TDriveUnit driveUnit = TDriveUnit( aDriveNumber ); + AppendDataL( refPath, driveUnit.Name() ); + if ( EDriveC == driveUnit ) + { + //C:\\Data\\(Images/Videos/Sounds).... + AppendDataL( refPath, KSlashData ); + } + else + { + //\\(Images/Videos/Sounds).... + AppendDataL( refPath, KSlash ); + } + + // Get the protocolinfo-attribute + const CUpnpAttribute* pInfo = FindAttributeByName( + aResource, KAttributeProtocolInfo ); + if ( NULL == pInfo ) + { + User::Leave( KErrArgument ); + } + + CUpnpDlnaProtocolInfo* dlnaInfo = + CUpnpDlnaProtocolInfo::NewL( pInfo->Value() ); + CleanupStack::PushL( dlnaInfo ); + TUPnPItemType fileType = UPnPCommonUtils::FileTypeByMimeTypeL( + dlnaInfo->ThirdField() ); + + switch( fileType ) + { + case ETypeAudio: + { + AppendDataL( refPath, PathInfo::SoundsPath() ); + AppendArtistAlbumL( refPath, aItem ); + break; + } + case ETypeVideo: + { + AppendDataL( refPath, PathInfo::VideosPath() ); + AppendYearMonthDayL( refPath, aItem ); + break; + } + case ETypeImage: + { + AppendDataL( refPath, PathInfo::ImagesPath() ); + AppendYearMonthDayL( refPath, aItem ); + break; + } + case ETypePlaylist: + case ETypeOther: + default: + { + AppendDataL( refPath, PathInfo::OthersPath() ); + } + } + if( aCreatePath ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + BaflUtils::EnsurePathExistsL( fs, refPath ); + CleanupStack::PopAndDestroy(&fs); + } + if( aAppendTitleAndExt ) + { + AppendTitleAndExtL( refPath, *dlnaInfo, aItem ); + } + + CleanupStack::PopAndDestroy( dlnaInfo ); + CleanupStack::Pop( path ); + + return path; + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::AppendTitleAndExtL +// Appends title and extension to the path. +// -------------------------------------------------------------------------- +// +void CUPnPPathUtility::AppendTitleAndExtL( + TDes& aPath, CUpnpDlnaProtocolInfo& aProtocolInfo, + const CUpnpItem& aItem ) const + { + HBufC* fileExt = UPnPCommonUtils::FileExtensionByMimeTypeL( + aProtocolInfo.ThirdField() ); + + User::LeaveIfNull( fileExt ); + CleanupStack::PushL( fileExt ); + + HBufC* title16 = UpnpString::ToUnicodeL( aItem.Title() ); + CleanupStack::PushL( title16 ); + HBufC* title16checked = + UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( *title16 ); + CleanupStack::PopAndDestroy( title16 ); + + CheckBufferSpaceL( aPath, + title16checked->Length()+fileExt->Length() ); + + aPath.AppendFormat( KTitleExtFormat(), title16checked, fileExt ); + + delete title16checked; title16checked = NULL; + CleanupStack::PopAndDestroy( fileExt ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::AppendYearMonthDayL +// Appends year, month and day to the path. +// -------------------------------------------------------------------------- +// +void CUPnPPathUtility::AppendYearMonthDayL( + TDes& aPath, const CUpnpItem& aItem ) const + { + // Get the date-element + const CUpnpElement* dateElem = FindElementByName( + aItem, KElementDate ); + + TTime date; date.HomeTime(); + TInt offsetMonthDay = 1; + // Use date element time instead of current time, + // if element exist + if ( dateElem != NULL ) + { + UPnPDateAsTTimeL( dateElem->Value(), date ); + offsetMonthDay = 0; + } + TDateTime ymd = date.DateTime(); + CheckBufferSpaceL( aPath, 11 ); //4(year)+2(month)+2(day)+3(\) + + aPath.AppendFormat( KYearMonthDayFormat(), + ymd.Year(), + ymd.Month() + offsetMonthDay, + ymd.Day() + offsetMonthDay ); + + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::AppendArtistAlbumL +// Appends artist and album to the path. +// -------------------------------------------------------------------------- +// +void CUPnPPathUtility::AppendArtistAlbumL( + TDes& aPath, const CUpnpItem& aItem ) const + { + + // Get the artist-element + const CUpnpElement* artistElem = FindElementByName( + aItem, KElementArtist ); + if ( NULL != artistElem ) + { + HBufC* artist = UpnpString::ToUnicodeL( artistElem->Value() ); + CleanupStack::PushL( artist ); + + HBufC* artistchecked = + UPnPCommonUtils::ReplaceIllegalDirNameCharactersL( *artist ); + CleanupStack::PopAndDestroy( artist ); + + CheckBufferSpaceL( aPath, artistchecked->Length()+1 );// 1 for '\' + aPath.AppendFormat( KArtistFormat(), artistchecked ); + + delete artistchecked; + } + else + { + CheckBufferSpaceL( aPath, KUnknown().Length()+1 ); // 1 for '\' + aPath.AppendFormat( KArtistFormat(), &KUnknown() ); + } + + // Get the album-element + const CUpnpElement* albumElem = FindElementByName( + aItem, KElementAlbum ); + if ( NULL != albumElem ) + { + HBufC* album = UpnpString::ToUnicodeL( albumElem->Value() ); + CleanupStack::PushL( album ); + + HBufC* albumchecked = + UPnPCommonUtils::ReplaceIllegalDirNameCharactersL( *album ); + CleanupStack::PopAndDestroy( album ); + + CheckBufferSpaceL( aPath, albumchecked->Length()+1 );// 1 for '\' + aPath.AppendFormat( KAlbumFormat(), albumchecked ); + + delete albumchecked; + } + else + { + CheckBufferSpaceL( aPath, KUnknown().Length()+1 ); // 1 for '\' + aPath.AppendFormat( KAlbumFormat(), &KUnknown() ); + } + + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::AppendDataL +// Appends data to the path's buffer. +// -------------------------------------------------------------------------- +// +void CUPnPPathUtility::AppendDataL( + TDes& aPath, const TDesC& aData ) const + { + CheckBufferSpaceL( aPath, aData ); + aPath.Append( aData ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::CheckBufferSpaceL +// Checks whether the data can be appended to buffer or not. +// -------------------------------------------------------------------------- +// +void CUPnPPathUtility::CheckBufferSpaceL( + const TDes& aPath, const TDesC& aData ) const + { + CheckBufferSpaceL( aPath, aData.Length() ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::CheckBufferSpaceL +// Checks whether the data of the specified length +// can be appended to buffer or not. +// -------------------------------------------------------------------------- +// +void CUPnPPathUtility::CheckBufferSpaceL( + const TDes& aPath, const TInt& aLength ) const + { + if ( (aPath.Length() + aLength) > aPath.MaxLength() ) + { + User::Leave( KErrOverflow ); + } + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::FindElementByName +// Finds an element within an object. +//--------------------------------------------------------------------------- +const CUpnpElement* CUPnPPathUtility::FindElementByName( + const CUpnpObject& aObject, const TDesC8& aName ) const + { + CUpnpElement* element = NULL; + const RUPnPElementsArray& array = + const_cast(aObject).GetElements(); + for( TInt i = 0; i < array.Count(); i++ ) + { + if( array[ i ]->Name() == aName ) + { + element = array[ i ]; + i = array.Count(); + } + } + return element; + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::FindAttributeByName +// Finds an attribute within an element. +//--------------------------------------------------------------------------- +const CUpnpAttribute* CUPnPPathUtility::FindAttributeByName( + const CUpnpElement& aElement, const TDesC8& aName ) const + { + CUpnpAttribute* attribute = NULL; + const RUPnPAttributesArray& array = + const_cast(aElement).GetAttributes(); + + for( TInt i = 0; i < array.Count(); i++ ) + { + + TBufC8<255> buf(array[ i ]->Name()); + if( array[ i ]->Name() == aName ) + { + attribute = array[ i ]; + i = array.Count(); + } + } + return attribute; + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::UPnPDateAsTTimeL +// Converts upnp date to TTime object. +//--------------------------------------------------------------------------- +void CUPnPPathUtility::UPnPDateAsTTimeL( const TDesC8& aUpnpDate, + TTime& aTime ) const + { + // This method is capable of handling the most common dc:date formats: + // CCYY-MM-DD and CCYY-MM-DDThh:mm:ss + // Rest of the dc:date formats are handled as well, but they might not + // be converted precisely + + TBuf formatDateString; + HBufC* dateString = HBufC::NewL( aUpnpDate.Length() ); + dateString->Des().Copy( aUpnpDate ); + + if( aUpnpDate.Length() >= KDateStringLength ) + { + // CCYY-MM-DD --> CCYYMMDD + formatDateString.Copy( dateString->Des().Left( 4 ) ); // Year + formatDateString.Append( dateString->Des().Mid( 5,2 ) ); // Month + formatDateString.Append( dateString->Des().Mid( 8,2 ) ); // Day + + if( aUpnpDate.Length() >= KDateTimeStringLength ) + { + // hh:mm:ss --> hhmmss + formatDateString.Append( KSeparator ); + // Hours + formatDateString.Append( dateString->Des().Mid( 11, 2 ) ); + // Minutes + formatDateString.Append( dateString->Des().Mid( 14, 2 ) ); + // Seconds + formatDateString.Append( dateString->Des().Mid( 17, 2 ) ); + } + else + { + // hh:mm:ss --> 000000 + formatDateString.Append( KSeparator ); + formatDateString.Append( KNullTime ); + } + } + delete dateString; + + User::LeaveIfError( aTime.Set( formatDateString ) ); + } + +// -------------------------------------------------------------------------- +// CUPnPPathUtility::RemoveEmptyFoldersL +// Removes empty folders from the path +// (other items were commented in a header). +// -------------------------------------------------------------------------- +// +void CUPnPPathUtility::RemoveEmptyFoldersL( + const TDesC& aBasePath, const TDesC& aFullPath ) + { + + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL(fs); + + TParse parsePath; + User::LeaveIfError( parsePath.Set( aFullPath, NULL, NULL ) ); + while( 0 != aBasePath.Compare( parsePath.DriveAndPath() ) ) + { + if ( KErrNone != fs.RmDir( parsePath.DriveAndPath() ) || + KErrNone != parsePath.PopDir() ) + { + break; + } + } + CleanupStack::PopAndDestroy(&fs); + + } + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/bwins/cdssyncu.def --- a/upnpharvester/cdssync/cdssynclib/bwins/cdssyncu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - ?ChunkCount@CCdsSync@@QAEHXZ @ 1 NONAME ; int CCdsSync::ChunkCount(void) - ?InitL@CCdsSync@@QAEXAAV?$RPointerArray@VHBufC8@@@@ABHAAVMCdsSyncObserver@@H@Z @ 2 NONAME ; void CCdsSync::InitL(class RPointerArray &, int const &, class MCdsSyncObserver &, int) - ?NewL@CCdsSync@@SAPAV1@XZ @ 3 NONAME ; class CCdsSync * CCdsSync::NewL(void) - ?NewLC@CCdsSync@@SAPAV1@XZ @ 4 NONAME ; class CCdsSync * CCdsSync::NewLC(void) - ?NotifySourceDataAddedL@CCdsSync@@QAEXH@Z @ 5 NONAME ; void CCdsSync::NotifySourceDataAddedL(int) - ?ProcessedItemCount@CCdsSync@@QAEHXZ @ 6 NONAME ; int CCdsSync::ProcessedItemCount(void) - ?ResetL@CCdsSync@@QAEXXZ @ 7 NONAME ; void CCdsSync::ResetL(void) - ?SetSearchIndex@CCdsSync@@QAEXH@Z @ 8 NONAME ; void CCdsSync::SetSearchIndex(int) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/eabi/cdssyncu.def --- a/upnpharvester/cdssync/cdssynclib/eabi/cdssyncu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -EXPORTS - _ZN8CCdsSync10ChunkCountEv @ 1 NONAME - _ZN8CCdsSync14SetSearchIndexEi @ 2 NONAME - _ZN8CCdsSync18ProcessedItemCountEv @ 3 NONAME - _ZN8CCdsSync22NotifySourceDataAddedLEi @ 4 NONAME - _ZN8CCdsSync4NewLEv @ 5 NONAME - _ZN8CCdsSync5InitLER13RPointerArrayI6HBufC8ERKiR16MCdsSyncObserveri @ 6 NONAME - _ZN8CCdsSync5NewLCEv @ 7 NONAME - _ZN8CCdsSync6ResetLEv @ 8 NONAME - _ZTI12CCdsSyncImpl @ 9 NONAME ; ## - _ZTI13CCdsSyncSqlAo @ 10 NONAME ; ## - _ZTI8CCdsSync @ 11 NONAME ; ## - _ZTV12CCdsSyncImpl @ 12 NONAME ; ## - _ZTV13CCdsSyncSqlAo @ 13 NONAME ; ## - _ZTV8CCdsSync @ 14 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/group/cdssync.mmp --- a/upnpharvester/cdssync/cdssynclib/group/cdssync.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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 Cds Sync -* -*/ - - - - - - -#include - -TARGET cdssync.dll -TARGETTYPE dll -UID 0x1000008d 0x015D2C17 - -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../src - -SOURCE cdssync.cpp -SOURCE cdssyncimplsql.cpp -SOURCE cdssyncsqlao.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY flogger.lib -LIBRARY hash.lib -LIBRARY xmlframework.lib -LIBRARY bafl.lib -LIBRARY efsrv.lib -LIBRARY cmcommon.lib -LIBRARY cmsqlwrapper.lib diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/inc/cdssync.h --- a/upnpharvester/cdssync/cdssynclib/inc/cdssync.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +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: Interface class of cdssync. -* -*/ - - - - - - -#ifndef __CDSSYNC_H__ -#define __CDSSYNC_H__ - -#include -#include - -class CCdsSyncImpl; - -/** - * Callback class of CdsSync - * - * @lib cdssync.lib - * - * @since S60 5.1 - */ -class MCdsSyncObserver - { -public: - - /** - * Indicates the number of processed items. - * - * @since S60 5.1 - * @param aItemCount, number of processed items - */ - virtual void ProgressL( TInt aItemCount ) = 0; - - /** - * Indicates that new chunk is completely processed. - * - * @since S60 5.1 - */ - virtual void ChunkCompleteL() = 0; - - /** - * Whole synchronization is complete without errors - * - * @since S60 5.1 - */ - virtual void SyncCompleteL() = 0; - - /** - * Error happened during synchronization. - * - * @since S60 5.1 - * @param aError, error code - */ - virtual void SyncErrorL( TInt aError ) = 0; - }; - -/** - * CDS Sync class definition - * - * @since S60 5.1 - */ -class CCdsSync : public CBase - { - -public: - - /** - * Two-phase constructor - */ - IMPORT_C static CCdsSync* NewLC(); - - /** - * Two-phase constructor - */ - IMPORT_C static CCdsSync* NewL(); - - /** - * Destructor - */ - virtual ~CCdsSync(); - - -public: - - /** - * Initialises the instance with source array and correct device id - * - * @since S60 5.1 - * @param aSourceDataArray, array where search responses are added - * @param aDeviceId, database id of the device which is harvested - * @param aObserver, callback to observer - * @param aAddGranularity, granularity how much items are - * added to db at once - */ - IMPORT_C void InitL( RPointerArray& aSourceDataArray, - const TInt& aDeviceId, - MCdsSyncObserver& aObserver, - TInt aAddGranularity); - - - /** - * Client indicates that new search response has been added to - * source data array. - * - * @since S60 5.1 - * @param aSourceDataComplete, boolean indicating whether the device - * has been fully searched. - */ - IMPORT_C void NotifySourceDataAddedL( - TBool aSourceDataComplete = EFalse ); - - /** - * Reset the cdssync instance to default state. - * - * @since S60 5.1 - */ - IMPORT_C void ResetL(); - - /** - * Returns the source data chunk count including the current chunk - * in process. - * - * @since S60 5.1 - * @return TInt, count of chunks to be processed - */ - IMPORT_C TInt ChunkCount(); - - - /** - * Returns successfully processed item count. - * - * @since S60 5.1 - * @return TInt count of items that has been processed successfully. - */ - IMPORT_C TInt ProcessedItemCount(); - - /** - * Sets search index to cds sync - * - * @since S60 5.1 - * @param aSearchIndex, search index - */ - IMPORT_C void SetSearchIndex( const TInt aSearchIndex ); - -private: - - // Default constructor - CCdsSync(); - - // Second-phase constructor - void ConstructL(); - -private: - - /** - * Actual implementation instance - */ - CCdsSyncImpl* iSyncImpl; // Owned - - }; - -#endif \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/inc/cdssyncimplsql.h --- a/upnpharvester/cdssync/cdssynclib/inc/cdssyncimplsql.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,596 +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: Cds Sync Implementation Header -* -*/ - - - - - - - -#ifndef __CDSSYNCIMPL_H__ -#define __CDSSYNCIMPL_H__ - -#include -#include -#include -#include "cdssync.h" -#include -#include - -// Forward declarations -class CCdsSyncSqlAo; -class MCmSqlMain; -class CCmSqlPropertyItem; -class CCmSqlGenericItem; -class CCmSqlBaseItem; - -typedef RPointerArray CCmSqlPropertyItemArray; - -using namespace Xml; - -/** - * CItemResource class definition - * - * @lib cdssync.lib - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CItemResource ) : public CBase -{ -public: - - /** - * Two-phased constructor. - */ - static CItemResource* NewLC(); - - /** - * Two-phased constructor. - */ - static CItemResource* NewL(); - - /** - * Destructor - */ - virtual ~CItemResource(); - -private: - /** - * Performs the first phase of two phase construction. - */ - CItemResource(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -public: - /** - * Track duration - */ - HBufC8* iDuration; // owned - /** - * Track bitrate - */ - HBufC8* iBitrate; // owned - /** - * File size - */ - HBufC8* iSize; // owned - /** - * Item resolution - */ - HBufC8* iResolution; // owned - /** - * Item uri - */ - HBufC8* iUri; // owned - /** - * Item protocol - */ - HBufC8* iProtocol; // owned -}; - - -/** - * CCdsSyncImpl class definition - * - * @lib cdssync.lib - * - * @since S60 5.1 - */ -class CCdsSyncImpl : public CActive, - public MContentHandler - { - -private: - - // Syncronization status - enum TCdsSyncStatus - { - ECdsSyncIdle, - ECdsSyncInitializing, - ECdsSyncReadyToParse, - ECdsSyncParsing, - ECdsSyncFinalizing - }; - -public: - - /** - * Two-phased constructor. - */ - static CCdsSyncImpl* NewLC(); - - /** - * Two-phased constructor. - */ - static CCdsSyncImpl* NewL(); - - /** - * Destructor - */ - ~CCdsSyncImpl(); - -public: // new functions - - /** - * Initializes data - * - * @Since S60 5.1 - * @param aSourceDataArray, source data - * @param aDeviceId, device id where data is retrieved - * @param aObserver, process observer - * @param aAddGranularity, data granularity - */ - void InitL( RPointerArray& aSourceDataArray, - const TInt& aDeviceId, - MCdsSyncObserver& aObserver, - TInt aAddGranularity); - - /** - * Notifies when data is added - * - * @Since S60 5.1 - * @param aSourceDataComplete, indicates if all source data is added - */ - void NotifySourceDataAddedL( - TBool aSourceDataComplete = EFalse ); - - /** - * Cancels operation and cleans data - * - * @Since S60 5.1 - */ - void ResetL(); - - /** - * Called when operation is completed - * - * @Since S60 5.1 - * @param aErrCode, error code - */ - void OperationsCompleteL( TInt aErrCode ); - - /** - * Notifies observer about progress - * - * @Since S60 5.1 - * @param aItemCount, processed items - */ - void ProgressL( TInt aItemCount ); - - /** - * Returns the chunk count to be processed including current chunk - * - * @Since S60 5.1 - * @return TInt, chunk count - */ - TInt ChunkCount(); - - /** - * Returns successfully processed item count. - * - * @since S60 5.1 - * @return TInt, count of items that has been processed successfully. - */ - TInt ProcessedItemCount(); - - /** - * Sets search index to cds sync - * - * @since S60 5.1 - * @param aSearchIndex, search index - */ - void SetSearchIndex( const TInt aSearchIndex ); - - /** - * Chunk complete callback - * - * @since S60 5.1 - */ - void ChunkCompleteL(); - -// From base class MContentHandler - - /** - * From MContentHandler - * See base class definition - */ - void OnStartDocumentL( const RDocumentParameters& aDocParam, - TInt aErrorCode ); - /** - * From MContentHandler - * See base class definition - */ - void OnEndDocumentL( TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - void OnStartElementL( const RTagInfo& aElement, - const RAttributeArray& aAttributes, - TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - void OnContentL( const TDesC8& aBytes, TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - void OnStartPrefixMappingL( const RString& aPrefix, - const RString& aUri, - TInt aErrorCode); - - /** - * From MContentHandler - * See base class definition - */ - void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - void OnSkippedEntityL( const RString& aName, TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - void OnProcessingInstructionL( const TDesC8& aTarget, - const TDesC8& aData, - TInt aErrorCode); - - /** - * From MContentHandler - * See base class definition - */ - void OnError( TInt aErrorCode ); - - /** - * From MContentHandler - * See base class definition - */ - TAny* GetExtendedInterface( const TInt32 aUid ); - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCdsSyncImpl(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Parses profile id - * - * @since S60 5.1 - * @param aItem, item data - * @param aRes, item resource - */ - void ParseProfileIdL( CCmSqlGenericItem& aItem, - const CItemResource& aRes ) const; - - /** - * Starts background parsing - * - * @since S60 5.1 - */ - TInt DoBackgroundParseL(); - - /** - * Background parsing callback - * - * @since S60 5.1 - * @param aCdsSync, observer - */ - static TInt BackgroundParseL( TAny *aCdsSync ); - - /** - * Finds attributes - * - * @since S60 5.1 - * @param aName, local name - * @param aPref, prefix - * @param aAttributes, attribute array - */ - TInt FindAttribute( const TDesC8& aName, - const TDesC8& aPref, - const RAttributeArray& aAttributes ) const; - - /** - * Parses resolution information - * - * @since S60 5.1 - * @param aDes, buffer to be parsed - * @param aWidth, image widht - * @param aHeight, image height - */ - void ParseResolution( const TDesC8& aDes, - TUint& aWidth, - TUint& aHeight ) const; - - /** - * Parses value from descriptor - * - * @since S60 5.1 - * @param aDes, buffer to be parsed - * @return TUInt, parsed value - */ - TUint ParseUint( const TDesC8& aDes ) const; - - /** - * Parses value from descriptor - * - * @since S60 5.1 - * @param aDes, buffer to be parsed - * @return TInt64, parsed value - */ - TInt64 ParseInt64( const TDesC8& aDes ) const; - - /** - * Parses track duration - * - * @since S60 5.1 - * @param aDes, buffer to be parsed - * @return TReal, duration - */ - TReal ParseDuration( const TDesC8& aDes ) const; - - /** - * Parses time - * - * @since S60 5.1 - * @param aDes, buffer to be parsed - * @return TTime, parsed time - */ - TTime ParseTime( const TDesC8& aDes ) const; - - /** - * Calculates hash value - * - * @since S60 5.1 - * @return HBufC, hash value - */ - HBufC8* CalculateHashL() const; - - /** - * Append escpace characters to hash value - * - * @since S60 5.1 - * @param aHash, hash value - * @return HBufC, hash value with escape charachters - */ - HBufC* EscapeHashLC( const TDesC8& aHash ) const; - - /** - * Gets property ID - * - * @since S60 5.1 - * @param aMetadataIndex, index for metadata type table - * @param aValue, property name - * @return TInt64, property id - */ - TInt64 GetPropertyIdL( TInt aMetadataIndex, const TDesC8& aValue ) const; - - /** - * Clears item data - * - * @since S60 5.1 - */ - void CleanItemData(); - - /** - * Removes unchanged items - * - * @since S60 5.1 - */ - void RemoveUnchangedItems(); - - /** - * Parses uri - * - * @since S60 5.1 - */ - void ParseUri(); - -private: - - /** - * Cds Sync observer - */ - MCdsSyncObserver* iObserver; // not owned - /** - * Parser - */ - CParser* iParser; // owned - /** - * Metadata database - */ - MCmSqlMain* iMetadataDb; // owned - /** - * Active object for low priority processing - */ - CIdle* iBackground; // owned - /** - * Cds Sync active object - */ - CCdsSyncSqlAo* iSqlAo; // owned - /** - * Data chuck - */ - HBufC8* iCurrentDocument; // owned - /** - * Sync status - */ - TCdsSyncStatus iState; - /** - * Data buffer - */ - HBufC8* iCurrentContent; // owned - /** - * Item id - */ - HBufC8* iItemId; // owned - /** - * Artist name - */ - HBufC8* iArtist; // owned - /** - * Album name - */ - HBufC8* iAlbum; // owned - /** - * Title - */ - HBufC8* iTitle; // owned - /** - * Album class - */ - HBufC8* iClass; // owned - /** - * Music genre - */ - HBufC8* iGenre; // owned - /** - * Album data - */ - HBufC8* iDate; // owned - /** - * Description field - */ - HBufC8* iDescription; // owned - /** - * Album art - */ - HBufC8* iAlbumArtUri; // owned - /** - * Item resource array - */ - RPointerArray iResources; // items owned - /** - * Flag for indicating that source data is ready - */ - TBool iSourceDataComplete; - /** - * Datachunk index - */ - TInt iChunkIndex; - /** - * Amount of unchanged items - */ - TInt iUnchangedItemCount; - /** - * Hash order - */ - TLinearOrder iHashOrder; - /** - * Name order - */ - TLinearOrder iNameOrder; - /** - * Source data array - */ - RPointerArray* iSourceDataArray; // not owned - /** - * Name array - */ - RPointerArray iNames; // items owned - /** - * Array of items to add - */ - RPointerArray iItemsToAdd; // items owned - /** - * Array of items in the database - */ - RPointerArray iItemsInDb; // items owned - /** - * File server session - */ - RFs iFs; - /** - * Search index - */ - TInt iSearchIndex; - /** - * Count of processed items - */ - TInt iProcessedItems; -#ifdef _DEBUG - /** - * Hash time - */ - TInt64 iHashTime; -#endif // _DEBUG - }; -#endif // __CDSSYNCIMPL_H__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/inc/cdssyncsqlao.h --- a/upnpharvester/cdssync/cdssynclib/inc/cdssyncsqlao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +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: Cds Sync Active Object header -* -*/ - - - - - - -#ifndef CDSSYNCSQLAO_H -#define CDSSYNCSQLAO_H - -// FORWARD DECLARATIONS -class MCmSqlMain; -class CCdsSyncImpl; -class CCmSqlBaseItem; -class CCmSqlGenericItem; - -/** - * CCdsSyncSqlAo class - * - * @lib cdssync.lib - * - * @since S60 v3.1 - */ -class CCdsSyncSqlAo : public CActive - { -public: - // active object states - enum TCdsSyncSqlAoState - { - ECdsSyncSqlAoIdle = 0, - ECdsSyncSqlAoAdding, - ECdsSyncSqlAoDeleting, - ECdsSyncSqlAoInitializing - }; - - /** - * Two-phased constructor. - * - * @param aSqlDb, Database handler instance - * @param aSync, CdsSync implementation instance - * @param aItemsToAdd, array of items to be added - * @param aItemsToAdd, array of items to be deleted - * @param aAddGranularity, count of items added at a time - */ - static CCdsSyncSqlAo* NewL( MCmSqlMain& aSqlDb, - CCdsSyncImpl& aSync, - RPointerArray& aItemsToAdd, - RPointerArray& aItemsToDelete, - TInt aAddGranularity ); - - /** - * Two-phased constructor. - * - * @param aSqlDb, Database handler instance - * @param aSync, CdsSync implementation instance - * @param aItemsToAdd, array of items to be added - * @param aItemsToAdd, array of items to be deleted - * @param aAddGranularity, count of items added at a time - */ - static CCdsSyncSqlAo* NewLC( - MCmSqlMain& aSqlDb, - CCdsSyncImpl& aSync, - RPointerArray& aItemsToAdd, - RPointerArray& aItemsToDelete, - TInt aAddGranularity ); - - /** - * Destructor. - */ - virtual ~CCdsSyncSqlAo(); - - /** - * NotifyItemsAddedL - * - * @since S60 v3.1 - * @param aSourceDataComplete, indicates if all source data is added - */ - void NotifyItemsAddedL( TBool aSourceDataComplete = EFalse ); - - /** - * Activate - * - * @since S60 v3.1 - */ - void Activate(); - - protected: - -// From base class CActive - - /** - * From CActive - * See base class definition - */ - void RunL(); - - /** - * From CActive - * See base class definition - */ - void DoCancel(); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @param aSqlDb, Database handler instance - * @param aSync, CdsSync implementation instance - * @param aItemsToAdd, array of items to be added - * @param aItemsToAdd, array of items to be deleted - * @param aAddGranularity, count of items added at a time - */ - CCdsSyncSqlAo( MCmSqlMain& aSqlDb, - CCdsSyncImpl& aSync, - RPointerArray& aItemsToAdd, - RPointerArray& aItemsToDelete, - TInt aAddGranularity ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - /** - * Checks metadata amouts and removes overhead items - * - * @since S60 v5.1 - */ - void IfOverLimitDeleteMediaItems(); - -public: - - /** - * Active object state - */ - TCdsSyncSqlAoState iState; - -private: - - /** - * Database handler - */ - MCmSqlMain& iSqlDb; - - /** - * Cds sync implementation reference - */ - CCdsSyncImpl& iSync; - - /** - * Array of items to be added - */ - RPointerArray& iItemsToAdd; - - /** - * Array of items to be deleted - */ - RPointerArray& iItemsToDelete; - - /** - * Amount of files to be added at a time - */ - TInt iAddGranularity; - /** - * Flag for indicating that source data is ready - */ - TBool iSourceDataComplete; - - /** - * Count of items to be added - */ - TInt iItemsInAddition; - -#ifdef _DEBUG - /** - * Time stamps for logging - */ - TTime iOperationTime; -#endif // _DEBUG - -}; - -#endif // CDSSYNCSQLAO_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/src/cdssync.cpp --- a/upnpharvester/cdssync/cdssynclib/src/cdssync.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +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: Interface class implementation of CdsSync -* -*/ - - - - - - -#include "cdssync.h" -#include "cdssyncimplsql.h" - - -// -------------------------------------------------------------------------- -// CCdsSync::CCdsSync -// -------------------------------------------------------------------------- -// -CCdsSync::CCdsSync() - { - - } - -// -------------------------------------------------------------------------- -// CCdsSync::ConstructL -// -------------------------------------------------------------------------- -// -void CCdsSync::ConstructL() - { - iSyncImpl = CCdsSyncImpl::NewL(); - } - - -// -------------------------------------------------------------------------- -// CCdsSync::NewL -// -------------------------------------------------------------------------- -// -EXPORT_C CCdsSync* CCdsSync::NewL() - { - CCdsSync* self = CCdsSync::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CCdsSync::NewLC -// -------------------------------------------------------------------------- -// -EXPORT_C CCdsSync* CCdsSync::NewLC() - { - CCdsSync* self = new( ELeave ) CCdsSync; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CCdsSync::~CCdsSync -// -------------------------------------------------------------------------- -// -CCdsSync::~CCdsSync() - { - delete iSyncImpl; - } - -// -------------------------------------------------------------------------- -// CCdsSync::InitL -// -------------------------------------------------------------------------- -// -EXPORT_C void CCdsSync::InitL( RPointerArray& aSourceDataArray, - const TInt& aDeviceId, - MCdsSyncObserver& aObserver, - TInt aAddGranularity ) - { - iSyncImpl->InitL( aSourceDataArray, - aDeviceId, - aObserver, - aAddGranularity ); - } - - -// -------------------------------------------------------------------------- -// CCdsSync::NotifySourceDataAddedL -// -------------------------------------------------------------------------- -// -EXPORT_C void CCdsSync::NotifySourceDataAddedL( TBool aSourceDataComplete ) - { - iSyncImpl->NotifySourceDataAddedL( aSourceDataComplete ); - } - -// -------------------------------------------------------------------------- -// CCdsSync::ResetL -// -------------------------------------------------------------------------- -// -EXPORT_C void CCdsSync::ResetL() - { - iSyncImpl->ResetL(); - } - -// -------------------------------------------------------------------------- -// CCdsSync::ChunkCount -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CCdsSync::ChunkCount() - { - return iSyncImpl->ChunkCount(); - } - -// -------------------------------------------------------------------------- -// CCdsSync::ProcessedItemCount -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CCdsSync::ProcessedItemCount() - { - return iSyncImpl->ProcessedItemCount(); - } - -// -------------------------------------------------------------------------- -// CCdsSync::SetSearchIndex -// -------------------------------------------------------------------------- -// -EXPORT_C void CCdsSync::SetSearchIndex( const TInt aSearchIndex ) - { - iSyncImpl->SetSearchIndex( aSearchIndex ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/src/cdssyncimplsql.cpp --- a/upnpharvester/cdssync/cdssynclib/src/cdssyncimplsql.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1605 +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: Cds Sync Implementation -* -*/ - - - - - - -#include -#include -#include "cmsqlmainfactory.h" -#include "mcmsqlmain.h" -#include "cmsqlbaseitem.h" -#include "cmsqlgenericitem.h" -#include "cmsqlaudioitem.h" -#include "cmsqlimageitem.h" -#include "cmsqlvideoitem.h" -#include "cmsqlpropertyitem.h" -#include "cmsqlresolutionpropertyitem.h" - -#include "cdssyncimplsql.h" -#include "cdssyncsqlao.h" -#include "msdebug.h" - -// Constants -_LIT8( KXmlMimeType, "text/xml" ); -_LIT8( KSymbian, "Symbian"); -_LIT8( KSemicolon, ";"); - -_LIT8( KXmlCdsDefaultNamespace, - "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"); -_LIT8( KXmlCdsDcNamespace,"http://purl.org/dc/elements/1.1/"); -_LIT8( KXmlCdsUpnpNamespace,"urn:schemas-upnp-org:metadata-1-0/upnp/"); - -_LIT8( KAlbum, "album"); -_LIT8( KArtist, "artist"); -_LIT8( KClass, "class"); -_LIT8( KDescription,"description"); -_LIT8( KDate, "date"); -_LIT8( KGenre, "genre"); -_LIT8( KId, "id"); -_LIT8( KItem, "item"); -_LIT8( KRes, "res"); -_LIT8( KTitle, "title"); -_LIT8( KAlbumArtUri, "albumArtURI"); - -_LIT8( KBitrate, "bitrate"); -_LIT8( KDuration, "duration"); -_LIT8( KProtocolInfo, "protocolInfo"); -_LIT8( KResolution, "resolution"); -_LIT8( KSize, "size"); - -_LIT8( KAudioItem, "audioItem"); -_LIT8( KImageItem, "imageItem"); -_LIT8( KVideoItem, "videoItem"); -_LIT8( KAudioBroadCastItem, "audioItem.audioBroadcast"); -_LIT8( KVideoBroadCastItem, "videoItem.videoBroadcast"); -_LIT8( KDlnaPn, "DLNA.ORG_PN=" ); - -const TInt KAlbumIndex = 0; -const TInt KArtistIndex = 1; -const TInt KClassIndex = 2; -const TInt KGenreIndex = 3; -const TInt KResolutionIndex = 4; -const TInt KUpnpProfileIndex = 5; - -const TCmMetadataField KMetadataTypes[] = - { - ECmAlbum, ECmArtist, ECmUpnpClass, ECmGenre, ECmResolution, ECmProfileId - }; - -const TInt KMetadataTypeCount = 6; - -const TInt KParseChunkSize = 100 * KKilo; // 100 kB - -const TInt KCdsSyncMaxBufLength = 512; - -const TInt KCdsSyncPriority = CActive::EPriorityIdle; - -// -------------------------------------------------------------------------- -// CItemResource::NewLC() -// -------------------------------------------------------------------------- -CItemResource* CItemResource::NewLC() - { - CItemResource* self=new (ELeave) CItemResource(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - - -// -------------------------------------------------------------------------- -// CItemResource::~CItemResource() -// -------------------------------------------------------------------------- -CItemResource::~CItemResource() // destruct - virtual, so no export - { - delete iDuration; - delete iBitrate; - delete iSize; - delete iResolution; - delete iProtocol; - delete iUri; - } - -// -------------------------------------------------------------------------- -// CItemResource::CItemResource() -// -------------------------------------------------------------------------- -CItemResource::CItemResource() - { - } - -// -------------------------------------------------------------------------- -// CItemResource::ConstructL() -// -------------------------------------------------------------------------- -void CItemResource::ConstructL() - { - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::NewL() -// -------------------------------------------------------------------------- -CCdsSyncImpl* CCdsSyncImpl::NewL() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::NewL")); - CCdsSyncImpl* self = NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::NewLC() -// -------------------------------------------------------------------------- -CCdsSyncImpl* CCdsSyncImpl::NewLC() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::NewLC")); - - CCdsSyncImpl* self = new (ELeave) CCdsSyncImpl(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::~CCdsSyncImpl() -// -------------------------------------------------------------------------- -CCdsSyncImpl::~CCdsSyncImpl() - { - - LOG(_L("[Cds Sync]\t CCdsSyncImpl::~CCdsSyncImpl")); - - if ( IsActive() ) - { - Cancel(); - } - - // iCurrentContent is owned and needs to be deleted here before it is set - // to NULL at CleanItemData-method. - if ( iCurrentContent ) - { - delete iCurrentContent; - } - CleanItemData(); - - iState = ECdsSyncIdle; - if ( iBackground ) - { - delete iBackground; - } - - if ( iParser ) - { - delete iParser; - } - - if ( iCurrentDocument ) - { - delete iCurrentDocument; - } - - iItemsInDb.ResetAndDestroy(); - iItemsToAdd.ResetAndDestroy(); - for ( TInt i = 0; i < iNames.Count(); i++ ) - { - iNames[ i ]->ResetAndDestroy(); - } - iNames.ResetAndDestroy(); - iFs.Close(); - - if ( iSqlAo ) - { - delete iSqlAo; - } - - if ( iMetadataDb ) - { - iMetadataDb->Close(); - } - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::CCdsSyncImpl() -// -------------------------------------------------------------------------- -CCdsSyncImpl::CCdsSyncImpl() : - CActive( EPriorityStandard ), - iHashOrder( CCmSqlBaseItem::CompareByHash ), - iNameOrder( CCmSqlPropertyItem::CompareItemsByName ) - { - CActiveScheduler::Add( this ); - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ConstructL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::ConstructL() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::ConstructL")); - - CMatchData *matchData = CMatchData::NewL(); - CleanupStack::PushL( matchData ); - matchData->SetMimeTypeL( KXmlMimeType ); - User::LeaveIfError( iFs.Connect() ); - matchData->SetVariantL( KSymbian ); - - iParser = CParser::NewL( *matchData, *this ); - CleanupStack::PopAndDestroy( matchData ); - - iBackground = CIdle::NewL( KCdsSyncPriority ); - iMetadataDb = CCmSqlMainFactory::NewCmSqlMainL( iFs ); - - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ResetL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::ResetL() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::ResetL")); - LOG(_L("[Cds Sync]\t cleaning objects..")); - iBackground->Cancel(); - if( iSqlAo && iSqlAo->IsActive() && iMetadataDb ) - { - iMetadataDb->CancelAsyncOperation(); - } - - delete iSqlAo; - iSqlAo = NULL; - - iItemsInDb.ResetAndDestroy(); - iItemsToAdd.ResetAndDestroy(); - for ( TInt i = 0; i < iNames.Count(); i++ ) - { - iNames[ i ]->ResetAndDestroy(); - } - iNames.ResetAndDestroy(); - CleanItemData(); - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::InitL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::InitL( RPointerArray& aSourceDataArray, - const TInt& aDeviceId, - MCdsSyncObserver& aObserver, - TInt aAddGranularity ) - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::InitL")); - iSearchIndex = 0; - ResetL(); - - LOG(_L("[Cds Sync]\t initializing variables..")); - iObserver = &aObserver; - iSourceDataArray = &aSourceDataArray; - iSourceDataComplete = EFalse; - iState = ECdsSyncInitializing; - iUnchangedItemCount = 0; - - LOG(_L("[Cds Sync]\t creating ao..")); - iSqlAo = CCdsSyncSqlAo::NewL( - *iMetadataDb, *this, iItemsToAdd, - iItemsInDb, aAddGranularity ); - - LOG(_L("[Cds Sync]\t Requesting existing metadata..")); - iMetadataDb->SetMsId( aDeviceId ); - iMetadataDb->GetItemsL( iItemsInDb, iSqlAo->iStatus ); - - iSqlAo->iState = CCdsSyncSqlAo::ECdsSyncSqlAoInitializing; - iSqlAo->Activate(); - - LOG(_L("[Cds Sync]\t done.")); - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::RunL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::RunL() - { - TRACE( Print( _L("[Cds Sync]\t CCdsSyncImpl::RunL,\ - iStatus %d iState %d"), iStatus.Int(), (TInt)iState ) ); - - switch ( iState ) - { - case ECdsSyncInitializing: - { - TInt namesCount = iNames.Count(); - TRACE( Print( - _L("[Cds Sync]\t iNames array size is %d out of %d"), - namesCount, - KMetadataTypeCount ) ); - - if ( namesCount == KMetadataTypeCount ) - { - // all arrays ready, sort them - iItemsInDb.Sort( iHashOrder ); - for ( TInt i = 0; i < KMetadataTypeCount; i++ ) - { - iNames[ i ]->Sort( iNameOrder ); - } - iState = ECdsSyncReadyToParse; - iSqlAo->iState = CCdsSyncSqlAo::ECdsSyncSqlAoIdle; - NotifySourceDataAddedL(); - } - else - { - RPointerArray* nameArray = - new (ELeave) RPointerArray(); - - iMetadataDb->GetPropertyValuesL( - *nameArray, - iSqlAo->iStatus, - KMetadataTypes[namesCount] - ); - iSqlAo->Activate(); - iNames.AppendL( nameArray ); - } - break; - } - default: - { - TRACE( Print( _L("[Cds Sync]\t RunL iState is \ - not ECdsSyncInitializing" ) )); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::DoCancel() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::DoCancel() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::DoCancel")); - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::NotifySourceDataAddedL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::NotifySourceDataAddedL( - TBool aSourceDataComplete ) - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::NotifySourceDataAdded")); - - if ( aSourceDataComplete ) - { - iSourceDataComplete = ETrue; - } - - if ( iState == ECdsSyncReadyToParse ) - { - if ( iSourceDataArray->Count() ) - { - iCurrentDocument = ( *iSourceDataArray )[ 0 ]; - iSourceDataArray->Remove( 0 ); - iChunkIndex = 0; - iParser->ParseBeginL(); - iBackground->Start( - TCallBack( CCdsSyncImpl::BackgroundParseL, this) ); - iState = ECdsSyncParsing; - } - else if ( iSourceDataComplete ) - { - TRACE( Print( _L - ("[Cds Sync]\t parsing complete, %d items to add"), - iItemsToAdd.Count() )); - TRACE( Print( _L("[Cds Sync]\t and %d items to remove"), - iItemsInDb.Count() )); - - iState = ECdsSyncIdle; - - RemoveUnchangedItems( ); - - iSqlAo->NotifyItemsAddedL( ETrue ); - } - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ProgressL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::ProgressL( TInt aItemCount ) - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::ProgressL")); - iObserver->ProgressL( aItemCount ); - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ChunkCount() -// -------------------------------------------------------------------------- -TInt CCdsSyncImpl::ChunkCount() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::ChunkCount")); - TInt chunkCount = iSourceDataArray->Count(); - if ( iCurrentDocument ) - { - chunkCount++; - } - return chunkCount; - } - -// -------------------------------------------------------------------------- -// Increment successfully processed number -// -------------------------------------------------------------------------- -// -TInt CCdsSyncImpl::ProcessedItemCount() - { - return iProcessedItems; - } - -// -------------------------------------------------------------------------- -// Increment chuch number ( search index ) -// -------------------------------------------------------------------------- -// -void CCdsSyncImpl::SetSearchIndex( const TInt aSearchIndex ) - { - iSearchIndex = aSearchIndex; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ChunkCompleteL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::ChunkCompleteL() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::ChunkCompleteL")); - iObserver->ChunkCompleteL(); - iProcessedItems = 0; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OperationsCompleteL() -// -------------------------------------------------------------------------- -#ifdef _DEBUG -void CCdsSyncImpl::OperationsCompleteL( TInt aErrCode ) -#else // _DEBUG -void CCdsSyncImpl::OperationsCompleteL( TInt /*aErrCode*/ ) -#endif // _DEBUG - { - TRACE( Print( _L - ("[Cds Sync]\t CCdsSyncImpl::OperationsCompleteL (err %d)"), - aErrCode )); - - if ( iState == ECdsSyncInitializing ) - { - RunL(); - } - else - { - iObserver->SyncCompleteL(); - iProcessedItems = 0; - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::BackgroundParseL() -// -------------------------------------------------------------------------- -TInt CCdsSyncImpl::BackgroundParseL( TAny* aCdsSync ) - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::BackgroundParseL")); - - return ((CCdsSyncImpl*)aCdsSync)->DoBackgroundParseL(); - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::DoBackgroundParseL() -// -------------------------------------------------------------------------- -TInt CCdsSyncImpl::DoBackgroundParseL() - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::DoBackgroundParseL")); - if ( iCurrentDocument ) - { - - #ifdef _DEBUG - iHashTime = 0; - TTime timeBefore; - timeBefore.HomeTime(); - #endif - - TBool parseMore = - ( iCurrentDocument->Length() - iChunkIndex ) > KParseChunkSize; - TPtrC8 parseChunk = - parseMore ? - iCurrentDocument->Mid( iChunkIndex, KParseChunkSize ) : - iCurrentDocument->Mid( iChunkIndex ); - - iUnchangedItemCount = 0; - - // in case of leave that is caused by out of memory - TRAPD( error, iParser->ParseL( parseChunk ) ); - if ( error != KErrNone ) - { - TRACE( Print( _L("[Cds Sync]\t Parse error = %d"), error )); - } - - #ifdef _DEBUG - TTime timeAfter; - timeAfter.HomeTime(); - TRACE( Print( _L - ("[Cds Sync]\t parsing of %d bytes of XML took %ld microsec"), - parseChunk.Size(), - timeAfter.MicroSecondsFrom( timeBefore ).Int64() ) ); - TRACE( Print( _L - ("[Cds Sync]\t of which hash comparison took %ld microsec"), - iHashTime)); - #endif - - if ( parseMore ) - { - iChunkIndex += KParseChunkSize; - } - else - { - // in case of leave that is caused by out of memory - TRAPD( err, iParser->ParseEndL() ); - if ( err != KErrNone ) - { - TRACE( Print( _L("[Cds Sync]\t \ - ParseEndL error = %d"), err )); - } - iState = ECdsSyncReadyToParse; - delete iCurrentDocument; iCurrentDocument = NULL; - // check if there's more to parse and trap the leave - TRAPD( errOne, NotifySourceDataAddedL() ); - if ( errOne != KErrNone ) - { - TRACE( Print( _L("[Cds Sync]\t NotifySourceDataAdded \ - error = %d"), errOne )); - } - ChunkCompleteL(); - } - iSqlAo->NotifyItemsAddedL(); - - return parseMore; - - } - LOG(_L("[Cds Sync]\t CCdsSyncImpl::BackgroundParseL END")); - return EFalse; - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::FindAttribute() -// -------------------------------------------------------------------------- -TInt CCdsSyncImpl::FindAttribute( const TDesC8& aName, - const TDesC8& aPref, - const RAttributeArray& aAttributes ) const - { - TInt returnvalue = KErrNotFound; - for ( TInt i = 0; i < aAttributes.Count(); i++ ) - { - if ( ( aAttributes[i].Attribute().LocalName(). - DesC().Compare( aName ) == 0) && - ( aAttributes[i].Attribute().Prefix(). - DesC().Compare( aPref ) == 0) ) - { - returnvalue = i; - // break out from the loop - i = aAttributes.Count(); - } - } - return returnvalue; - } - - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ParseResolution() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::ParseResolution( const TDesC8& aDes, - TUint& aWidth, - TUint& aHeight ) const - { - TLex8 lex( aDes ); - if ( lex.Val( aWidth ) != KErrNone ) - { - aWidth = 0; - } - if ( lex.Get() != 'x' || lex.Val( aHeight ) != KErrNone ) - { - aHeight = 0; - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ParseUint() -// -------------------------------------------------------------------------- -TUint CCdsSyncImpl::ParseUint( const TDesC8& aDes ) const - { - TUint res = 0; - TLex8 lex( aDes ); - if ( lex.Val( res ) != KErrNone ) - { - res = 0; - } - return res; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ParseInt64() -// -------------------------------------------------------------------------- -TInt64 CCdsSyncImpl::ParseInt64( const TDesC8& aDes ) const - { - TInt64 res = 0; - TLex8 lex( aDes ); - if ( lex.Val( res ) != KErrNone ) - { - res = 0; - } - return res; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ParseTime() -// -------------------------------------------------------------------------- -TTime CCdsSyncImpl::ParseTime( const TDesC8& aDes ) const - { - TUint year = 0; - TUint month = 1; - TUint day = 1; - TLex8 lex; - - TInt dashpos = aDes.Find( _L8("-") ); - TInt dashpos2 = aDes.Mid( dashpos + 1 ).Find( _L8("-") ) + dashpos + 1; - - lex = aDes.Left(4); - if ( lex.Val( year ) != KErrNone ) - { - year = 0; - } - if ( dashpos2-dashpos > 1 ) - { - lex = aDes.Mid( dashpos + 1,dashpos2 - dashpos - 1 ); - if ( lex.Val(month) != KErrNone ) - { - month = 1; - } - - } - if (aDes.Length() - dashpos2 > 1) - { - lex = aDes.Mid(dashpos2 + 1); - if ( lex.Val(day) != KErrNone ) - { - day = 1; - } - } - TDateTime time; - if ( time.Set(year, TMonth(month-1), day-1, 0,0,0,0) != KErrNone ) - { - return TTime( TDateTime(0, TMonth(0), 0, 0,0,0,0) ); - } - else - { - return TTime( time ); - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ParseDuration() -// -------------------------------------------------------------------------- -TReal CCdsSyncImpl::ParseDuration( const TDesC8& aDes ) const - { - TInt multiplier = 1; - TInt plusminuspos = aDes.Find( _L8("-") ); - if ( plusminuspos == KErrNotFound ) - { - plusminuspos = aDes.Find( _L8("+") ); - } - else - { - multiplier = -1; - } - - TInt hourminutepos = aDes.Find( _L8(":") ); - TInt minutesecondpos = aDes.Mid( hourminutepos + 1 ). - Find( _L8(":") ) + hourminutepos + 1; - TInt dotpos = aDes.Find( _L8(".") ); - TInt slashpos = aDes.Find( _L8("/") ); - - TInt hours = 0; TInt minutes = 0; - TReal seconds = 0; TReal f0 = 0; TReal f1=1; - TLex8 lex; - - if ( hourminutepos - plusminuspos > 1 ) - { - lex = aDes.Mid( plusminuspos + 1, hourminutepos - plusminuspos - 1 ); - if ( lex.Val( hours ) != KErrNone ) - { - hours = 0; - } - } - if ( minutesecondpos - hourminutepos > 1 ) - { - lex = aDes.Mid( hourminutepos + 1, - minutesecondpos - hourminutepos - 1 ); - if ( lex.Val(minutes) != KErrNone ) - { - minutes = 0; - } - } - if ( (dotpos == KErrNotFound || slashpos == KErrNotFound) - && minutesecondpos != KErrNotFound ) - { - lex = aDes.Mid( minutesecondpos + 1 ); - if ( lex.Val(seconds) != KErrNone ) - { - seconds = 0; - } - } - else if (slashpos - dotpos > 1 && dotpos - minutesecondpos > 1 - && aDes.Length() - slashpos > 1) - { - lex = aDes.Mid( minutesecondpos + 1, dotpos - minutesecondpos - 1 ); - if ( lex.Val( seconds ) != KErrNone ) - { - seconds = 0; - } - lex = aDes.Mid( dotpos + 1, slashpos - dotpos - 1 ); - if ( lex.Val(f0) != KErrNone ) - { - f0 = 0; - } - lex = aDes.Mid( slashpos + 1 ); - if ( lex.Val(f1) != KErrNone ) - { - f1 = 1; - } - } - - return multiplier*(hours * 3600 + minutes * 60 + seconds + f0/f1); - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::CalculateHashL() -// -------------------------------------------------------------------------- -HBufC8* CCdsSyncImpl::CalculateHashL() const - { - CSHA1* sha1 = CSHA1::NewL(); - CleanupStack::PushL( sha1 ); - sha1->Reset(); - - if ( iArtist ) - { - sha1->Update( *iArtist ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( iAlbum ) - { - sha1->Update( *iAlbum ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( iTitle ) - { - sha1->Update( *iTitle ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( iClass ) - { - sha1->Update( *iClass ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( iGenre ) - { - sha1->Update( *iGenre ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( iDate ) - { - sha1->Update( *iDate ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if( iAlbumArtUri ) - { - sha1->Update( *iAlbumArtUri ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - for ( TInt i = 0; i < iResources.Count(); i++ ) - { - CItemResource* res = iResources[i]; - - if ( res->iBitrate ) - { - sha1->Update( *res->iBitrate ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( res->iSize ) - { - sha1->Update( *res->iSize ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - - if ( res->iResolution ) - { - sha1->Update( *res->iResolution ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - - if ( res->iDuration ) - { - sha1->Update( *res->iDuration ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( res->iProtocol ) - { - sha1->Update( *res->iProtocol ); - } - else - { - sha1->Update( KNullDesC8() ); - } - - if ( res->iUri ) - { - sha1->Update( *res->iUri ); - } - else - { - sha1->Update( KNullDesC8() ); - } - } - - // get the final hash value. - TPtrC8 hash = sha1->Final(); - - // create an object that can be returned and copy hash value there. - HBufC8* retval = hash.AllocL(); - - // delete SHA1 object. - CleanupStack::PopAndDestroy( sha1 ); - sha1 = NULL; - - // return - return retval; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::EscapeHashLC() -// -------------------------------------------------------------------------- -HBufC* CCdsSyncImpl::EscapeHashLC( const TDesC8& aHash ) const - { - HBufC* escapedHash = HBufC::NewLC( 40 ); - TPtr ptr = escapedHash->Des(); - for ( TInt i=0; i < 20; i++ ) - { - if ( aHash[i] == 0 ) - { - ptr.Append( _L("\\0") ); - } - else if ( aHash[i] == '\\' ) - { - ptr.Append( _L("\\\\") ); - } - else - { - ptr.Append( aHash[i] ); - } - } - return escapedHash; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::GetPropertyIdL() -// -------------------------------------------------------------------------- -TInt64 CCdsSyncImpl::GetPropertyIdL( TInt aMetadataIndex, - const TDesC8& aValue ) const - { - TInt64 id = 0; - - TCmMetadataField metadataType = KMetadataTypes[ aMetadataIndex ]; - - CCmSqlPropertyItem* property = NULL; - if ( metadataType == ECmResolution ) - { - property = CCmSqlResolutionPropertyItem::NewLC(); - } - else - { - property = CCmSqlPropertyItem::NewLC(); - } - - - property->SetNameL( aValue ); - CCmSqlPropertyItemArray* properties = iNames[ aMetadataIndex ]; - TInt index = properties->FindInOrder( property, iNameOrder ); - - - if ( index == KErrNotFound ) - { - if ( metadataType == ECmResolution ) - { - TUint width = 0; - TUint height = 0; - ParseResolution( aValue, width, height ); - - CCmSqlResolutionPropertyItem* resolutionProperty = - static_cast ( property ); - resolutionProperty->SetWidth( width ); - resolutionProperty->SetHeight( height ); - resolutionProperty->SetPixelCount( width * height ); - } - - property->SetStatus( EFalse ); - - iMetadataDb->SyncAddPropertyItemL( - *property, metadataType ); - properties->InsertInOrder( property, iNameOrder ); - id = property->Id(); - CleanupStack::Pop( property ); - } - else - { - id = (*properties)[ index ]->Id(); - CleanupStack::PopAndDestroy( property ); - } - - return id; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::CleanItemData() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::CleanItemData() - { - iCurrentContent = NULL; - - delete iItemId; - iItemId = NULL; - - delete iArtist; - iArtist = NULL; - - delete iAlbum; - iAlbum = NULL; - - delete iTitle; - iTitle = NULL; - - delete iClass; - iClass = NULL; - - delete iGenre; - iGenre = NULL; - - delete iDate; - iDate = NULL; - - delete iDescription; - iDescription = NULL; - - delete iAlbumArtUri; - iAlbumArtUri = NULL; - - iResources.ResetAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnStartDocumentL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnStartDocumentL( const RDocumentParameters&/*aDocParam*/, - TInt aErrorCode ) - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::OnStartDocumentL")); - - if ( aErrorCode ) - { - iObserver->SyncErrorL( aErrorCode ); - } - - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnEndDocumentL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnEndDocumentL( TInt aErrorCode ) - { - LOG(_L("[Cds Sync]\t CCdsSyncImpl::OnEndDocumentL")); - - if (aErrorCode) - { - iObserver->SyncErrorL( aErrorCode ); - } - - - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnStartElementL( -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnStartElementL( const RTagInfo& aElement, - const RAttributeArray& aAttributes, - TInt aErrorCode ) - { - - if ( aErrorCode ) - { - iObserver->SyncErrorL( aErrorCode ); - } - - delete iCurrentContent; - iCurrentContent = NULL; - - const TDesC8& name = aElement.LocalName().DesC(); - const TDesC8& uri = aElement.Uri().DesC(); - - if ( !uri.Compare( KXmlCdsDefaultNamespace ) ) - { - if ( !name.Compare( KItem ) ) // - { - TInt id = FindAttribute( KId, _L8(""), aAttributes ); - if ( id != KErrNotFound) - { - CleanItemData(); - iItemId = aAttributes[ id ].Value().DesC().AllocL(); - } - } - else if ( !name.Compare( KRes ) ) // - { - - CItemResource* res = CItemResource::NewLC(); - - for (TInt i = 0; i < aAttributes.Count(); i++) - { - - const TDesC8& attrName = - aAttributes[i].Attribute().LocalName().DesC(); - HBufC8* attrValue = aAttributes[i].Value().DesC().AllocL(); - - if ( !attrName.Compare( KBitrate ) ) - { - res->iBitrate = attrValue; - } - else if ( !attrName.Compare( KSize ) ) - { - res->iSize = attrValue; - } - else if ( !attrName.Compare( KDuration ) ) - { - res->iDuration = attrValue; - } - else if ( !attrName.Compare( KResolution ) ) - { - res->iResolution = attrValue; - } - else if ( !attrName.Compare( KProtocolInfo ) ) - { - res->iProtocol = attrValue; - } - } - iResources.AppendL( res ); - CleanupStack::Pop( res ); - } - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnEndElementL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnEndElementL( const RTagInfo& aElement, - TInt aErrorCode ) - { - if ( aErrorCode ) - { - iObserver->SyncErrorL( aErrorCode ); - } - - const TDesC8& name = aElement.LocalName().DesC(); - const TDesC8& uri = aElement.Uri().DesC(); - - if ( !uri.Compare( KXmlCdsDefaultNamespace ) ) - // element from DIDL-Lite namespace - { - if ( !name.Compare( KRes ) && iCurrentContent ) // - { - // remove "http://" and IP from URI - TInt httpPos = iCurrentContent->Find( _L8("http://") ); - if ( httpPos != KErrNotFound ) - { - TInt ipLength = - iCurrentContent->Mid( httpPos + 7 ).Find(_L8("/")); - if ( ipLength != KErrNotFound ) - { - iCurrentContent->Des().Delete(0, httpPos + 7 + ipLength); - } - } - iResources[ iResources.Count() - 1 ]->iUri = iCurrentContent; - } - - else if ( !name.Compare( KItem )) // - { - // calc hash and construct item here - HBufC8* hash = CalculateHashL(); - CleanupStack::PushL( hash ); - HBufC* escapedHash = EscapeHashLC( *hash ); - CleanupStack::Pop( escapedHash ); - - CleanupStack::PopAndDestroy( hash ); - hash = NULL; - CleanupStack::PushL( escapedHash ); - - CCmSqlBaseItem* baseItem = CCmSqlBaseItem::NewLC(); - baseItem->SetHashL( *escapedHash ); - TInt index = iItemsInDb.FindInOrder( baseItem, iHashOrder ); - CleanupStack::PopAndDestroy( baseItem ); - - if ( index == KErrNotFound ) // new or modified item - { - CCmSqlGenericItem* item = NULL; - - // find relevant resources - CItemResource* httpRes = NULL; - CItemResource* internalRes = NULL; - for ( TInt i=0; i < iResources.Count(); i++ ) - { - HBufC8* protocol = iResources[ i ]->iProtocol; - if ( protocol ) - { - if ( !httpRes && - protocol->Find(_L8("http-get:")) - != KErrNotFound ) - { - httpRes = iResources[ i ]; - } - else if ( !internalRes && - protocol->Find(_L8("internal:")) - != KErrNotFound ) - { - internalRes = iResources[ i ]; - } - } - } - - if( iClass && iClass->Find( KAudioBroadCastItem ) != - KErrNotFound ) - { - // create audio item and set audio specific properties - CCmSqlAudioItem* audioItem = CCmSqlAudioItem::NewLC(); - audioItem->SetMediaType( ECmAudioBroadCast ); - if ( iGenre ) - { - audioItem->SetGenreId( - GetPropertyIdL( KGenreIndex, *iGenre ) ); - } - item = audioItem; - CleanupStack::Pop( audioItem ); - } - - else if( iClass && iClass->Find( KVideoBroadCastItem ) != - KErrNotFound ) - { - // create video item and set image specific properties - CCmSqlVideoItem* videoItem = CCmSqlVideoItem::NewLC(); - videoItem->SetMediaType( ECmVideoBroadCast ); - if ( iGenre ) - { - videoItem->SetGenreId( - GetPropertyIdL( KGenreIndex, *iGenre ) ); - } - item = videoItem; - CleanupStack::Pop( videoItem ); - } - - else if ( iClass && - iClass->Find( KAudioItem ) != KErrNotFound ) - { - // create audio item and set audio specific properties - CCmSqlAudioItem* audioItem = CCmSqlAudioItem::NewLC(); - audioItem->SetMediaType( ECmAudio ); - if ( iAlbum ) - { - audioItem->SetAlbumId( - GetPropertyIdL( KAlbumIndex, *iAlbum ) ); - } - if ( iArtist ) - { - audioItem->SetArtistId( - GetPropertyIdL( KArtistIndex, *iArtist ) ); - } - if ( iGenre ) - { - audioItem->SetGenreId( - GetPropertyIdL( KGenreIndex, *iGenre ) ); - } - if( iAlbumArtUri ) - { - audioItem->SetAlbumArtUriL( *iAlbumArtUri ); - } - if ( httpRes && httpRes->iDuration ) - { - audioItem->SetDuration( - (TInt) ParseDuration( *httpRes->iDuration ) ); - } - if ( httpRes && httpRes->iBitrate ) - { - audioItem->SetBitrate( - ParseUint( *httpRes->iBitrate ) ); - } - item = audioItem; - CleanupStack::Pop( audioItem ); - } - - else if ( iClass && - iClass->Find( KImageItem ) != KErrNotFound ) - { - // create image item and set image specific properties - CCmSqlImageItem* imageItem = CCmSqlImageItem::NewLC(); - imageItem->SetMediaType( ECmImage ); - - if ( iDescription ) - { - imageItem->SetDescriptionL( *iDescription ); - } - if ( internalRes && internalRes->iResolution ) - { - imageItem->SetResolutionId( - GetPropertyIdL( KResolutionIndex, - *internalRes->iResolution )); - } - item = imageItem; - CleanupStack::Pop( imageItem ); - } - else if ( iClass && - iClass->Find( KVideoItem ) != KErrNotFound ) - { - // create video item and set image specific properties - CCmSqlVideoItem* videoItem = CCmSqlVideoItem::NewLC(); - videoItem->SetMediaType( ECmVideo ); - if ( iGenre ) - { - videoItem->SetGenreId( - GetPropertyIdL( KGenreIndex, *iGenre ) ); - } - item = videoItem; - CleanupStack::Pop( videoItem ); - } - - if ( item ) - { - CleanupStack::PushL( item ); - // Parsing dlna profile id from protocol info - ParseProfileIdL( *item, *httpRes ); - ParseProfileIdL( *item, *internalRes ); - // set general properties - item->SetHashL( *escapedHash ); - item->SetCdsIdL( *iItemId ); - if ( iClass ) - { - item->SetUpnpclassId( - GetPropertyIdL( KClassIndex, *iClass ) ); - } - if ( iTitle ) - { - item->SetTitleL( *iTitle ); - } - if ( iDate ) - { - item->SetDate( ParseTime( *iDate ) ); - } - if ( httpRes && httpRes->iUri ) - { - item->SetUriL( *httpRes->iUri ); - } - if ( httpRes && httpRes->iSize ) - { - item->SetSize( ParseUint( *httpRes->iSize ) ); - } - else if ( internalRes && internalRes->iSize ) - { - item->SetSize( ParseUint( *internalRes->iSize ) ); - } - TTime currentTime; - currentTime.HomeTime(); - item->SetHarvestDate( currentTime ); - item->SetSearchId( iSearchIndex ); - iItemsToAdd.AppendL( item ); // transfer ownership - ProgressL(1); - iProcessedItems++; - CleanupStack::Pop( item ); - } - else - { - LOG(_L("[Cds Sync]\t item == NULL ")); - } - } - else // unchanged item - { - CCmSqlBaseItem* itemToRemove = iItemsInDb[ index ]; - iItemsInDb.Remove( index ); - ProgressL(1); - iProcessedItems++; - delete itemToRemove; - } - CleanItemData(); - CleanupStack::PopAndDestroy( escapedHash ); - } - } - - else if ( !uri.Compare( KXmlCdsDcNamespace ) ) - // element from dc namespace - { - if ( !name.Compare( KTitle ) ) // - { - iTitle = iCurrentContent; - } - else if ( !name.Compare( KDate ) ) // - { - iDate = iCurrentContent; - } - else if ( !name.Compare( KDescription ) ) // - { - iDescription = iCurrentContent; - } - } - - else if ( !uri.Compare( KXmlCdsUpnpNamespace ) ) - // element from UPnP namespace - { - if ( !name.Compare( KAlbum ) ) // - { - iAlbum = iCurrentContent; - } - else if ( !name.Compare( KArtist ) ) // - { - iArtist = iCurrentContent; - } - else if ( !name.Compare( KClass ) ) // - { - iClass = iCurrentContent; - } - else if ( !name.Compare( KGenre ) ) // - { - iGenre = iCurrentContent; - } - else if ( !name.Compare( KAlbumArtUri ) ) // - { - // Parse uri removes ip and port for iCurrentContent - ParseUri(); - iAlbumArtUri = iCurrentContent; - } - } - else - { - delete iCurrentContent; - } - - iCurrentContent = NULL; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnContentL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnContentL( const TDesC8& aBytes, TInt aErrorCode ) - { - if ( aErrorCode ) - { - iObserver->SyncErrorL( aErrorCode ); - } - if ( iCurrentContent ) - { - if( iCurrentContent->Length() + aBytes.Length() < - KCdsSyncMaxBufLength ) - { - iCurrentContent->Des().Append( aBytes ); - } - else - { - iCurrentContent = iCurrentContent->ReAllocL( - iCurrentContent->Length() + aBytes.Length() ); - iCurrentContent->Des().Append( aBytes ); - } - } - else - { - iCurrentContent = HBufC8::NewL( KCdsSyncMaxBufLength ); - iCurrentContent->Des().Append( aBytes ); - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnStartPrefixMappingL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnStartPrefixMappingL( const RString& /* aPrefix */, - const RString& /* aUri */, - TInt aErrorCode ) - { - if (aErrorCode) - { - iObserver->SyncErrorL( aErrorCode ); - } - - - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnEndPrefixMappingL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnEndPrefixMappingL( const RString& /* aPrefix */, - TInt aErrorCode ) - { - if (aErrorCode) - { - iObserver->SyncErrorL( aErrorCode ); - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnIgnorableWhiteSpaceL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnIgnorableWhiteSpaceL( const TDesC8& /* aBytes */, - TInt aErrorCode ) - { - if (aErrorCode) - { - iObserver->SyncErrorL( aErrorCode ); - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnSkippedEntityL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnSkippedEntityL( const RString& /* aName */, - TInt aErrorCode ) - { - if (aErrorCode) - { - iObserver->SyncErrorL( aErrorCode ); - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::OnProcessingInstructionL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnProcessingInstructionL( const TDesC8& /* aTarget */, - const TDesC8& /* aData */, - TInt aErrorCode ) - { - if (aErrorCode) - { - iObserver->SyncErrorL( aErrorCode ); - } - } - -// -------------------------------------------------------------------------- -// void CCdsSyncImpl::OnError() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::OnError( TInt aErrorCode ) - { - if (aErrorCode && iState != ECdsSyncIdle) - { - TRAP_IGNORE( iObserver->SyncErrorL( aErrorCode ) ); - } - - - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::GetExtendedInterface() -// -------------------------------------------------------------------------- -TAny* CCdsSyncImpl::GetExtendedInterface( const TInt32 /* aUid */ ) - { - return NULL; - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ParseProfileIdL() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::ParseProfileIdL( - CCmSqlGenericItem& aItem, - const CItemResource& aRes ) const - { - if( &aRes && &aItem ) - { - TInt index( aRes.iProtocol->Find( KDlnaPn() ) ); - if( KErrNotFound != index ) - { - TInt index2( aRes.iProtocol->Find( KSemicolon() ) ); - if( KErrNotFound != index2 ) - { - HBufC8* temp = - aRes.iProtocol->Mid( - index + KDlnaPn().Length(), - index2 - ( index + KDlnaPn().Length() ) ).AllocLC(); - aItem.SetUpnpProfileId( - GetPropertyIdL( KUpnpProfileIndex, *temp ) ); - CleanupStack::PopAndDestroy( temp ); - } - } - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::RemoveUnchangedItems() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::RemoveUnchangedItems() - { - for( TInt i = iItemsInDb.Count() - 1; i >= 0; i-- ) - { - if( iItemsInDb[i]->SearchId() < iSearchIndex ) - { - CCmSqlBaseItem* itemToRemove = iItemsInDb[ i ]; - iItemsInDb.Remove( i ); - delete itemToRemove; - } - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncImpl::ParseUri() -// -------------------------------------------------------------------------- -void CCdsSyncImpl::ParseUri() - { - // Removes ip and port from iCurrentContent - TInt httpPos = iCurrentContent->Find( _L8("http://") ); - if ( httpPos != KErrNotFound ) - { - TInt ipLength = - iCurrentContent->Mid( httpPos + 7 ).Find(_L8("/")); - if ( ipLength != KErrNotFound ) - { - iCurrentContent->Des().Delete(0, httpPos + 7 + ipLength); - } - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/cdssynclib/src/cdssyncsqlao.cpp --- a/upnpharvester/cdssync/cdssynclib/src/cdssyncsqlao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,288 +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: Cds Sync Active Object -* -*/ - - - - - - -#include "mcmsqlmain.h" -#include "cmsqlbaseitem.h" -#include "cmsqlgenericitem.h" -#include "cdssyncsqlao.h" -#include "cdssyncimplsql.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KCdsSyncMaxImageItemCount = 15000; -const TInt KCdsSyncMaxVideoItemCount = 5000; -const TInt KCdsSyncMaxItemCount = 40000; - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::NewL -// -------------------------------------------------------------------------- -// -CCdsSyncSqlAo* CCdsSyncSqlAo::NewL( - MCmSqlMain& aSqlDb, - CCdsSyncImpl& aSync, - RPointerArray& aItemsToAdd, - RPointerArray& aItemsToDelete, - TInt aAddGranularity ) - { - CCdsSyncSqlAo* self = CCdsSyncSqlAo::NewLC( - aSqlDb, - aSync, - aItemsToAdd, - aItemsToDelete, - aAddGranularity ); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::NewLC -// -------------------------------------------------------------------------- -// -CCdsSyncSqlAo* CCdsSyncSqlAo::NewLC( - MCmSqlMain& aSqlDb, - CCdsSyncImpl& aSync, - RPointerArray& aItemsToAdd, - RPointerArray& aItemsToDelete, - TInt aAddGranularity ) - { - LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::NewLC")); - CCdsSyncSqlAo* self = new (ELeave) CCdsSyncSqlAo( - aSqlDb, aSync, aItemsToAdd, aItemsToDelete, aAddGranularity - ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::~CCdsSyncSqlAo -// -------------------------------------------------------------------------- -CCdsSyncSqlAo::~CCdsSyncSqlAo() - { - LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::~CCdsSyncSqlAo")); - - if ( IsActive() ) - { - Cancel(); - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::CCdsSyncSqlAo -// -------------------------------------------------------------------------- -CCdsSyncSqlAo::CCdsSyncSqlAo( MCmSqlMain& aSqlDb, - CCdsSyncImpl& aSync, - RPointerArray& aItemsToAdd, - RPointerArray& aItemsToDelete, - TInt aAddGranularity ) : - CActive( CActive::EPriorityIdle ), - iState( ECdsSyncSqlAoIdle ), - iSqlDb( aSqlDb ), - iSync( aSync ), - iItemsToAdd( aItemsToAdd ), - iItemsToDelete( aItemsToDelete ), - iAddGranularity( aAddGranularity ), - iSourceDataComplete( EFalse ) - { - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::ConstructL -// -------------------------------------------------------------------------- -void CCdsSyncSqlAo::ConstructL() - { - LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::ConstructL")); - CActiveScheduler::Add( this ); - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::NotifyItemsAddedL -// -------------------------------------------------------------------------- -void CCdsSyncSqlAo::NotifyItemsAddedL( TBool aSourceDataComplete ) - { - LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::NotifyItemsAddedL")); - - // Source data is complete - if ( aSourceDataComplete ) - { - iSourceDataComplete = ETrue; - } - - TRACE( Print( _L("[Cds Sync]\t addarray has %d items, srccomplete %d"), - iItemsToAdd.Count(), iSourceDataComplete )); - - if ( iState == ECdsSyncSqlAoIdle ) - { - if ( iItemsToAdd.Count() >= iAddGranularity || - ( iSourceDataComplete && iItemsToAdd.Count() ) ) - - { - // add more items - iStatus = KRequestPending; - iItemsInAddition = iItemsToAdd.Count(); - - #ifdef _DEBUG - iOperationTime.HomeTime(); - #endif - - TRACE( Print( _L("[Cds Sync]\t starting to add %d items"), - iItemsInAddition )); - iSqlDb.AsyncBatchAdd( iItemsToAdd, iStatus ); - SetActive(); - iState = ECdsSyncSqlAoAdding; - } - else if ( iSourceDataComplete ) - { - // all done, start deleting - #ifdef _DEBUG - iOperationTime.HomeTime(); - #endif - iSqlDb.AsyncBatchDelete( iItemsToDelete, iStatus ); - SetActive(); - iState = ECdsSyncSqlAoDeleting; - } - } - } - -// --------------------------------------------------------------------------- -// CCdsSyncSqlAo::Activate() -// --------------------------------------------------------------------------- -void CCdsSyncSqlAo::Activate() - { - SetActive(); - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::IfOverLimitDeleteMediaItems() -// -------------------------------------------------------------------------- -void CCdsSyncSqlAo::IfOverLimitDeleteMediaItems() - { - LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::IfOverLimitDeleteMediaItems START")); - TInt64 musicCount( KErrNone ); - TInt64 videoCount( KErrNone ); - TInt64 imageCount( KErrNone ); - TRAP_IGNORE( iSqlDb.GetMediaCountL( musicCount, ECmAudio ) ); - TRAP_IGNORE( iSqlDb.GetMediaCountL( videoCount, ECmVideo ) ); - TRAP_IGNORE( iSqlDb.GetMediaCountL( imageCount, ECmImage ) ); - TRACE( Print( _L("[Cds Sync]\t Amout of music items %ld"), musicCount )); - TRACE( Print( _L("[Cds Sync]\t Amout of image items %ld"), imageCount )); - TRACE( Print( _L("[Cds Sync]\t Amout of video items %ld"), videoCount )); - if( KCdsSyncMaxImageItemCount < imageCount ) - { - TRAP_IGNORE( iSqlDb.DeleteOldestMediaItemsL( ECmImage, - imageCount - KCdsSyncMaxImageItemCount ) ); - TRACE( Print( _L("[Cds Sync]\t deleted %ld image items"), - ( imageCount - KCdsSyncMaxImageItemCount ))); - TRAP_IGNORE( iSqlDb.GetMediaCountL( imageCount, ECmImage ) ); - } - if( KCdsSyncMaxVideoItemCount < videoCount ) - { - TRAP_IGNORE( iSqlDb.DeleteOldestMediaItemsL( ECmVideo, - videoCount - KCdsSyncMaxVideoItemCount ) ); - TRACE( Print( _L("[Cds Sync]\t deleted %ld video items"), - ( videoCount - KCdsSyncMaxVideoItemCount ))); - TRAP_IGNORE( iSqlDb.GetMediaCountL( videoCount, ECmVideo ) ); - } - if( KCdsSyncMaxItemCount < ( imageCount + videoCount + musicCount ) ) - { - TRAP_IGNORE( iSqlDb.DeleteOldestMediaItemsL( ECmAudio, - ( imageCount + videoCount + musicCount ) - - KCdsSyncMaxItemCount ) ); - TRACE( Print( _L("[Cds Sync]\t deleted %ld music items"), - ( ( imageCount + videoCount + musicCount ) - - KCdsSyncMaxItemCount ))); - } - LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::IfOverLimitDeleteMediaItems END")); - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::RunL() -// -------------------------------------------------------------------------- -void CCdsSyncSqlAo::RunL() - { - TRACE( Print( _L("[Cds Sync]\t CCdsSyncSqlAo::RunL, iStatus %d"), - iStatus.Int() )); - if ( iState == ECdsSyncSqlAoAdding ) - { - iState = ECdsSyncSqlAoIdle; - - #ifdef _DEBUG - - TTime timeAfter; - timeAfter.HomeTime(); - TRACE( Print( - _L("[Cds Sync]\t added %d, took %ld microsec, err %d"), - iItemsToAdd.Count(), - timeAfter.MicroSecondsFrom( iOperationTime ).Int64(), - iStatus.Int() )); - TRACE( Print( _L("[Cds Sync]\t array has %d items"), - iItemsToAdd.Count() )); - - #endif - - TInt itemCount( iItemsToAdd.Count() ); - - for ( TInt i = 0; i < itemCount; i++ ) - { - delete iItemsToAdd[ 0 ]; - iItemsToAdd.Remove( 0 ); - } - - // check if there's more to add - NotifyItemsAddedL(); - - } - else if ( iState == ECdsSyncSqlAoInitializing ) - { - iSync.OperationsCompleteL( KErrNone ); - } - else // ECdsSyncSqlAoDeleting - { - #ifdef _DEBUG - - TTime timeAfter; - timeAfter.HomeTime(); - TRACE( Print( - _L("[Cds Sync]\t removed %d, took %ld microsec, err %d"), - iItemsToDelete.Count(), - timeAfter.MicroSecondsFrom( iOperationTime ).Int64(), - iStatus.Int() )); - #endif - - iItemsToDelete.ResetAndDestroy(); - LOG(_L("[Cds Sync]\t Checking if too much media...")); - IfOverLimitDeleteMediaItems(); - LOG(_L("[Cds Sync]\t Checked!")); - LOG(_L("[Cds Sync]\t Deleting unused propertys")); - iSqlDb.DeleteUnusedPropertys( ); - iState = ECdsSyncSqlAoIdle; - iSync.OperationsCompleteL( KErrNone ); - } - } - -// -------------------------------------------------------------------------- -// CCdsSyncSqlAo::DoCancel() -// -------------------------------------------------------------------------- -void CCdsSyncSqlAo::DoCancel() - { - LOG(_L("[Cds Sync]\t CCdsSyncSqlAo::DoCancel")); - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/cdssync/common/bld.inf --- a/upnpharvester/cdssync/common/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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 information file for project cdssync -* -*/ - - - - - - - -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS -../cdssynclib/inc/cdssyncimplsql.h |../../../inc/cdssyncimplsql.h -../cdssynclib/inc/cdssync.h |../../../inc/cdssync.h - -PRJ_MMPFILES - -../cdssynclib/group/cdssync.mmp - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/bwins/cmcommonu.def --- a/upnpharvester/common/cmlibrary/bwins/cmcommonu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ -EXPORTS - ?NewL@CCmSqlResolutionPropertyItem@@SAPAV1@XZ @ 1 NONAME ; class CCmSqlResolutionPropertyItem * CCmSqlResolutionPropertyItem::NewL(void) - ?NewLC@CCmSqlImageItem@@SAPAV1@XZ @ 2 NONAME ; class CCmSqlImageItem * CCmSqlImageItem::NewLC(void) - ?StoreRule@CCmStoreRule@@QAEXHPAW4TCmMediaType@@@Z @ 3 NONAME ; void CCmStoreRule::StoreRule(int, enum TCmMediaType *) - ?ListId@CCmFillRule@@QBEIXZ @ 4 NONAME ; unsigned int CCmFillRule::ListId(void) const - ?SetListId@CCmFillListItem@@QAEXI@Z @ 5 NONAME ; void CCmFillListItem::SetListId(unsigned int) - ?Status@CCmBaseListItem@@QBE?AW4TCmListItemStatus@@XZ @ 6 NONAME ; enum TCmListItemStatus CCmBaseListItem::Status(void) const - ?InternalizeL@CCmDriveInfo@@QAEXAAVRReadStream@@@Z @ 7 NONAME ; void CCmDriveInfo::InternalizeL(class RReadStream &) - ?SetListRealSizeInBytes@CCmFillRule@@QAEXK@Z @ 8 NONAME ; void CCmFillRule::SetListRealSizeInBytes(unsigned long) - ?AddPropertyItemL@CCmSqlPropertyContainer@@QAEXPAVCCmSqlPropertyItem@@@Z @ 9 NONAME ; void CCmSqlPropertyContainer::AddPropertyItemL(class CCmSqlPropertyItem *) - ?Priority@CCmFillListItem@@QBEEXZ @ 10 NONAME ; unsigned char CCmFillListItem::Priority(void) const - ?PrimaryText@CCmBaseListItem@@QBEAAVTDesC16@@XZ @ 11 NONAME ; class TDesC16 & CCmBaseListItem::PrimaryText(void) const - ?Height@CCmSqlResolutionPropertyItem@@QBEHXZ @ 12 NONAME ; int CCmSqlResolutionPropertyItem::Height(void) const - ?ExcAlbums@CCmFillRule@@QBEAAVCDesC16Array@@XZ @ 13 NONAME ; class CDesC16Array & CCmFillRule::ExcAlbums(void) const - ?DeleteRule@CCmFillRule@@QAEXW4TCmMetadataField@@@Z @ 14 NONAME ; void CCmFillRule::DeleteRule(enum TCmMetadataField) - ??1CCmMediaServerFull@@UAE@XZ @ 15 NONAME ; CCmMediaServerFull::~CCmMediaServerFull(void) - ?Amount@CCmFillRule@@QBEKXZ @ 16 NONAME ; unsigned long CCmFillRule::Amount(void) const - ?MediaServerName@CCmMediaServerFull@@QBE?AVTPtrC8@@XZ @ 17 NONAME ; class TPtrC8 CCmMediaServerFull::MediaServerName(void) const - ?SetId@CCmSqlPropertyItem@@QAEX_J@Z @ 18 NONAME ; void CCmSqlPropertyItem::SetId(long long) - ?SetArtistId@CCmSqlAudioItem@@QAEX_J@Z @ 19 NONAME ; void CCmSqlAudioItem::SetArtistId(long long) - ?Bitrate@CCmSqlAudioItem@@QBEHXZ @ 20 NONAME ; int CCmSqlAudioItem::Bitrate(void) const - ?MediaServerCount@CCmStoreRule@@QBEHXZ @ 21 NONAME ; int CCmStoreRule::MediaServerCount(void) const - ?CompareItemsByName@CCmSqlPropertyItem@@SAHABV1@0@Z @ 22 NONAME ; int CCmSqlPropertyItem::CompareItemsByName(class CCmSqlPropertyItem const &, class CCmSqlPropertyItem const &) - ?NewL@CCmSqlBaseItem@@SAPAV1@XZ @ 23 NONAME ; class CCmSqlBaseItem * CCmSqlBaseItem::NewL(void) - ?DefCount@CCmStoreRule@@QBEHXZ @ 24 NONAME ; int CCmStoreRule::DefCount(void) const - ?UsedDriveQuota@CCmDriveInfo@@QBE_JXZ @ 25 NONAME ; long long CCmDriveInfo::UsedDriveQuota(void) const - ?SetType@CCmSqlPropertyContainer@@QAEXW4TCmMetadataField@@@Z @ 26 NONAME ; void CCmSqlPropertyContainer::SetType(enum TCmMetadataField) - ?AddMediaServerL@CCmFillRule@@QAEHABVTDesC8@@@Z @ 27 NONAME ; int CCmFillRule::AddMediaServerL(class TDesC8 const &) - ?Status@CCmStoreRule@@QBE?AW4TCmListItemStatus@@XZ @ 28 NONAME ; enum TCmListItemStatus CCmStoreRule::Status(void) const - ?NewLC@CCmFillListItem@@SAPAV1@IIIW4TCmFillRuleStatus@@@Z @ 29 NONAME ; class CCmFillListItem * CCmFillListItem::NewLC(unsigned int, unsigned int, unsigned int, enum TCmFillRuleStatus) - ?SetListRealCount@CCmFillRule@@QAEXK@Z @ 30 NONAME ; void CCmFillRule::SetListRealCount(unsigned long) - ?CompareItemsByName@CCmSqlResolutionPropertyItem@@SAHABV1@0@Z @ 31 NONAME ; int CCmSqlResolutionPropertyItem::CompareItemsByName(class CCmSqlResolutionPropertyItem const &, class CCmSqlResolutionPropertyItem const &) - ?SetTemplateId@CCmFillRule@@QAEXE@Z @ 32 NONAME ; void CCmFillRule::SetTemplateId(unsigned char) - ?NewLC@CCmMediaServer@@SAPAV1@XZ @ 33 NONAME ; class CCmMediaServer * CCmMediaServer::NewLC(void) - ?SetSelected@CCmFillRule@@QAEXW4TCmFillRuleStatus@@@Z @ 34 NONAME ; void CCmFillRule::SetSelected(enum TCmFillRuleStatus) - ?HarvestDate@CCmSqlGenericItem@@QBE?AVTTime@@XZ @ 35 NONAME ; class TTime CCmSqlGenericItem::HarvestDate(void) const - ?TrackNumber@CCmSqlAudioItem@@QBEHXZ @ 36 NONAME ; int CCmSqlAudioItem::TrackNumber(void) const - ?SetPriority@CCmFillListItem@@QAEXE@Z @ 37 NONAME ; void CCmFillListItem::SetPriority(unsigned char) - ?GetResource@CCmSqlGenericItem@@QAEXAAVTDesC8@@AAH11AA_JH@Z @ 38 NONAME ; void CCmSqlGenericItem::GetResource(class TDesC8 &, int &, int &, int &, long long &, int) - ?AlbumArtUri@CCmSqlAudioItem@@QBEAAVTDesC8@@XZ @ 39 NONAME ; class TDesC8 & CCmSqlAudioItem::AlbumArtUri(void) const - ?ExternalizeL@CCmFillListItem@@QBEXAAVRWriteStream@@@Z @ 40 NONAME ; void CCmFillListItem::ExternalizeL(class RWriteStream &) const - ?NewLC@CCmSqlPropertyContainer@@SAPAV1@XZ @ 41 NONAME ; class CCmSqlPropertyContainer * CCmSqlPropertyContainer::NewLC(void) - ?Name@CCmSqlPropertyItem@@QBEAAVTDesC8@@XZ @ 42 NONAME ; class TDesC8 & CCmSqlPropertyItem::Name(void) const - ?Date@CCmSqlGenericItem@@QBE?AVTTime@@XZ @ 43 NONAME ; class TTime CCmSqlGenericItem::Date(void) const - ?NewLC@CCmStoreListItem@@SAPAV1@XZ @ 44 NONAME ; class CCmStoreListItem * CCmStoreListItem::NewLC(void) - ?ExcPlayLists@CCmFillRule@@QBEAAVCDesC16Array@@XZ @ 45 NONAME ; class CDesC16Array & CCmFillRule::ExcPlayLists(void) const - ?SetMethod@CCmFillRule@@QAEXW4TCmFillMethod@@@Z @ 46 NONAME ; void CCmFillRule::SetMethod(enum TCmFillMethod) - ??1CCmSqlPropertyItem@@UAE@XZ @ 47 NONAME ; CCmSqlPropertyItem::~CCmSqlPropertyItem(void) - ??1CCmFillRule@@UAE@XZ @ 48 NONAME ; CCmFillRule::~CCmFillRule(void) - ?NewLC@CCmSqlVideoItem@@SAPAV1@XZ @ 49 NONAME ; class CCmSqlVideoItem * CCmSqlVideoItem::NewLC(void) - ?ExternalizeL@CCmStoreRuleContainer@@QBEXAAVRWriteStream@@@Z @ 50 NONAME ; void CCmStoreRuleContainer::ExternalizeL(class RWriteStream &) const - ?SetItemCount@CCmSearchResponseHash@@QAEXH@Z @ 51 NONAME ; void CCmSearchResponseHash::SetItemCount(int) - ?DeleteFillRule@CCmFillRuleContainer@@QAEXH@Z @ 52 NONAME ; void CCmFillRuleContainer::DeleteFillRule(int) - ?ExternalizeL@CCmStoreListItem@@QBEXAAVRWriteStream@@@Z @ 53 NONAME ; void CCmStoreListItem::ExternalizeL(class RWriteStream &) const - ?TemplateId@CCmFillRule@@QBEEXZ @ 54 NONAME ; unsigned char CCmFillRule::TemplateId(void) const - ?Size@CCmSqlGenericItem@@QBEHXZ @ 55 NONAME ; int CCmSqlGenericItem::Size(void) const - ?VisibleDate@CCmMediaServerFull@@QBE?AVTTime@@XZ @ 56 NONAME ; class TTime CCmMediaServerFull::VisibleDate(void) const - ?SetVisibleDate@CCmMediaServerFull@@QAEXVTTime@@@Z @ 57 NONAME ; void CCmMediaServerFull::SetVisibleDate(class TTime) - ?NewLC@CCmFillRule@@SAPAV1@XZ @ 58 NONAME ; class CCmFillRule * CCmFillRule::NewLC(void) - ?Title@CCmSqlGenericItem@@QBEAAVTDesC8@@XZ @ 59 NONAME ; class TDesC8 & CCmSqlGenericItem::Title(void) const - ?StartIndex@CCmSearchResponseHash@@QBEHXZ @ 60 NONAME ; int CCmSearchResponseHash::StartIndex(void) const - ?DriveNumber@CCmDriveInfo@@QBEHXZ @ 61 NONAME ; int CCmDriveInfo::DriveNumber(void) const - ?Name@CCmFillRule@@QBEAAVTDesC8@@XZ @ 62 NONAME ; class TDesC8 & CCmFillRule::Name(void) const - ?FillUsage@CCmMediaServerFull@@QAEHXZ @ 63 NONAME ; int CCmMediaServerFull::FillUsage(void) - ?SetAmount@CCmFillRule@@QAEXK@Z @ 64 NONAME ; void CCmFillRule::SetAmount(unsigned long) - ??1CCmSqlBaseItem@@UAE@XZ @ 65 NONAME ; CCmSqlBaseItem::~CCmSqlBaseItem(void) - ?SetResolutionId@CCmSqlImageItem@@QAEX_J@Z @ 66 NONAME ; void CCmSqlImageItem::SetResolutionId(long long) - ?SetDriveQuota@CCmDriveInfo@@QAEX_J@Z @ 67 NONAME ; void CCmDriveInfo::SetDriveQuota(long long) - ?DeleteMediaServer@CCmFillRule@@QAEXABVTDesC8@@@Z @ 68 NONAME ; void CCmFillRule::DeleteMediaServer(class TDesC8 const &) - ?RemoveExcPlayList@CCmFillRule@@QAEXABVTDesC16@@@Z @ 69 NONAME ; void CCmFillRule::RemoveExcPlayList(class TDesC16 const &) - ?SystemUpdateID@CCmMediaServer@@QBEHXZ @ 70 NONAME ; int CCmMediaServer::SystemUpdateID(void) const - ??1CCmStoreRuleContainer@@UAE@XZ @ 71 NONAME ; CCmStoreRuleContainer::~CCmStoreRuleContainer(void) - ?ExternalizeL@CCmDriveInfo@@QBEXAAVRWriteStream@@@Z @ 72 NONAME ; void CCmDriveInfo::ExternalizeL(class RWriteStream &) const - ?NewL@CCmSqlPropertyContainer@@SAPAV1@XZ @ 73 NONAME ; class CCmSqlPropertyContainer * CCmSqlPropertyContainer::NewL(void) - ?UpnpProfileId@CCmSqlGenericItem@@QBE_JXZ @ 74 NONAME ; long long CCmSqlGenericItem::UpnpProfileId(void) const - ?SetHeight@CCmSqlResolutionPropertyItem@@QAEXH@Z @ 75 NONAME ; void CCmSqlResolutionPropertyItem::SetHeight(int) - ?SetStatus@CCmFillRule@@QAEXW4TCmListItemStatus@@@Z @ 76 NONAME ; void CCmFillRule::SetStatus(enum TCmListItemStatus) - ?DeleteMediaServer@CCmFillRule@@QAEXH@Z @ 77 NONAME ; void CCmFillRule::DeleteMediaServer(int) - ?Description@CCmSqlImageItem@@QBEAAVTDesC8@@XZ @ 78 NONAME ; class TDesC8 & CCmSqlImageItem::Description(void) const - ?SetDevId@CCmStoreListItem@@QAEXEW4TCmListItemStatus@@@Z @ 79 NONAME ; void CCmStoreListItem::SetDevId(unsigned char, enum TCmListItemStatus) - ?SetDate@CCmBaseListItem@@QAEXVTTime@@@Z @ 80 NONAME ; void CCmBaseListItem::SetDate(class TTime) - ?ExcPlayLists@CCmStoreRule@@QAEAAVCDesC16Array@@XZ @ 81 NONAME ; class CDesC16Array & CCmStoreRule::ExcPlayLists(void) - ?NewL@CCmSqlVideoItem@@SAPAV1@XZ @ 82 NONAME ; class CCmSqlVideoItem * CCmSqlVideoItem::NewL(void) - ?SetRefId@CCmBaseListItem@@QAEX_K@Z @ 83 NONAME ; void CCmBaseListItem::SetRefId(unsigned long long) - ?Status@CCmDriveInfo@@QBEHXZ @ 84 NONAME ; int CCmDriveInfo::Status(void) const - ?Hash@CCmSqlBaseItem@@QBEAAVTDesC16@@XZ @ 85 NONAME ; class TDesC16 & CCmSqlBaseItem::Hash(void) const - ?SetMediaType@CCmBaseListItem@@QAEXW4TCmMediaType@@@Z @ 86 NONAME ; void CCmBaseListItem::SetMediaType(enum TCmMediaType) - ?SetDevId@CCmFillListItem@@QAEXE@Z @ 87 NONAME ; void CCmFillListItem::SetDevId(unsigned char) - ?NewLC@CCmSqlResolutionPropertyItem@@SAPAV1@XZ @ 88 NONAME ; class CCmSqlResolutionPropertyItem * CCmSqlResolutionPropertyItem::NewLC(void) - ?Size@CCmBaseListItem@@QBEKXZ @ 89 NONAME ; unsigned long CCmBaseListItem::Size(void) const - ?SetSize@CCmBaseListItem@@QAEXK@Z @ 90 NONAME ; void CCmBaseListItem::SetSize(unsigned long) - ?NewLC@CCmStoreRule@@SAPAV1@XZ @ 91 NONAME ; class CCmStoreRule * CCmStoreRule::NewLC(void) - ?InternalizeL@CCmSqlResolutionPropertyItem@@QAEXAAVRReadStream@@@Z @ 92 NONAME ; void CCmSqlResolutionPropertyItem::InternalizeL(class RReadStream &) - ?NewLC@CCmBaseListItem@@SAPAV1@XZ @ 93 NONAME ; class CCmBaseListItem * CCmBaseListItem::NewLC(void) - ?MediaServerCount@CCmFillRule@@QBEHXZ @ 94 NONAME ; int CCmFillRule::MediaServerCount(void) const - ?IsDuplicate@CCmSqlPropertyContainer@@QAEHAAVCCmSqlPropertyItem@@@Z @ 95 NONAME ; int CCmSqlPropertyContainer::IsDuplicate(class CCmSqlPropertyItem &) - ?InternalizeL@CCmBaseListItem@@QAEXAAVRReadStream@@@Z @ 96 NONAME ; void CCmBaseListItem::InternalizeL(class RReadStream &) - ?MediaServerL@CCmStoreRule@@QAEABVTDesC8@@H@Z @ 97 NONAME ; class TDesC8 const & CCmStoreRule::MediaServerL(int) - ?IsActive@CCmMediaServerFull@@QBEEXZ @ 98 NONAME ; unsigned char CCmMediaServerFull::IsActive(void) const - ?AddFillRuleL@CCmFillRuleContainer@@QAEHPAVCCmFillRule@@@Z @ 99 NONAME ; int CCmFillRuleContainer::AddFillRuleL(class CCmFillRule *) - ?NewLC@CCmSqlBaseItem@@SAPAV1@XZ @ 100 NONAME ; class CCmSqlBaseItem * CCmSqlBaseItem::NewLC(void) - ?SetPathL@CCmBaseListItem@@QAEXABVTDesC16@@@Z @ 101 NONAME ; void CCmBaseListItem::SetPathL(class TDesC16 const &) - ?CompareByHash@CCmSqlBaseItem@@SAHABV1@0@Z @ 102 NONAME ; int CCmSqlBaseItem::CompareByHash(class CCmSqlBaseItem const &, class CCmSqlBaseItem const &) - ?Method@CCmFillRule@@QBE?AW4TCmFillMethod@@XZ @ 103 NONAME ; enum TCmFillMethod CCmFillRule::Method(void) const - ?DbId@CCmMediaServer@@QBE_JXZ @ 104 NONAME ; long long CCmMediaServer::DbId(void) const - ?SetGenreId@CCmSqlAudioItem@@QAEX_J@Z @ 105 NONAME ; void CCmSqlAudioItem::SetGenreId(long long) - ?DeletePropertyContainer@CCmSqlPropertyCollector@@QAEXH@Z @ 106 NONAME ; void CCmSqlPropertyCollector::DeletePropertyContainer(int) - ?DevIds@CCmStoreListItem@@QBE?AV?$RArray@H@@XZ @ 107 NONAME ; class RArray CCmStoreListItem::DevIds(void) const - ?UpdateFileStatusL@CCmStoreListItem@@QAEXEW4TCmListItemStatus@@@Z @ 108 NONAME ; void CCmStoreListItem::UpdateFileStatusL(unsigned char, enum TCmListItemStatus) - ?DeleteMediaServer@CCmStoreRule@@QAEXABVTDesC8@@@Z @ 109 NONAME ; void CCmStoreRule::DeleteMediaServer(class TDesC8 const &) - ?SetNameL@CCmSqlPropertyItem@@QAEXABVTDesC8@@@Z @ 110 NONAME ; void CCmSqlPropertyItem::SetNameL(class TDesC8 const &) - ?SetUpnpclassId@CCmSqlGenericItem@@QAEX_J@Z @ 111 NONAME ; void CCmSqlGenericItem::SetUpnpclassId(long long) - ?SetAlbumArtUriL@CCmSqlAudioItem@@QAEXABVTDesC8@@@Z @ 112 NONAME ; void CCmSqlAudioItem::SetAlbumArtUriL(class TDesC8 const &) - ?NewL@CCmFillRule@@SAPAV1@XZ @ 113 NONAME ; class CCmFillRule * CCmFillRule::NewL(void) - ?SetUriL@CCmFillListItem@@QAEXABVTDesC8@@@Z @ 114 NONAME ; void CCmFillListItem::SetUriL(class TDesC8 const &) - ?NewL@CCmSearchResponseHash@@SAPAV1@HHABVTDesC8@@@Z @ 115 NONAME ; class CCmSearchResponseHash * CCmSearchResponseHash::NewL(int, int, class TDesC8 const &) - ?SetDriveNameL@CCmDriveInfo@@QAEXABVTDesC16@@@Z @ 116 NONAME ; void CCmDriveInfo::SetDriveNameL(class TDesC16 const &) - ?LimitType@CCmFillRule@@QBE?AW4TCmLimitType@@XZ @ 117 NONAME ; enum TCmLimitType CCmFillRule::LimitType(void) const - ?SetLimitType@CCmFillRule@@QAEXW4TCmLimitType@@@Z @ 118 NONAME ; void CCmFillRule::SetLimitType(enum TCmLimitType) - ?RuleCount@CCmFillRule@@QBEHXZ @ 119 NONAME ; int CCmFillRule::RuleCount(void) const - ?ListId@CCmFillListItem@@QBEIXZ @ 120 NONAME ; unsigned int CCmFillListItem::ListId(void) const - ?Width@CCmSqlResolutionPropertyItem@@QBEHXZ @ 121 NONAME ; int CCmSqlResolutionPropertyItem::Width(void) const - ?AddRuleParamL@CCmFillRule@@QAEHHH@Z @ 122 NONAME ; int CCmFillRule::AddRuleParamL(int, int) - ?Type@CCmSqlPropertyContainer@@QAE?AW4TCmMetadataField@@XZ @ 123 NONAME ; enum TCmMetadataField CCmSqlPropertyContainer::Type(void) - ?AddExcAlbumL@CCmFillRule@@QAEXABVTDesC16@@@Z @ 124 NONAME ; void CCmFillRule::AddExcAlbumL(class TDesC16 const &) - ??1CCmSqlPropertyContainer@@UAE@XZ @ 125 NONAME ; CCmSqlPropertyContainer::~CCmSqlPropertyContainer(void) - ?AddStoreRuleL@CCmStoreRuleContainer@@QAEHPAVCCmStoreRule@@@Z @ 126 NONAME ; int CCmStoreRuleContainer::AddStoreRuleL(class CCmStoreRule *) - ?MediaType@CCmSqlGenericItem@@QBE?AW4TCmMediaType@@XZ @ 127 NONAME ; enum TCmMediaType CCmSqlGenericItem::MediaType(void) const - ?SetCdsIdL@CCmSqlBaseItem@@QAEXABVTDesC8@@@Z @ 128 NONAME ; void CCmSqlBaseItem::SetCdsIdL(class TDesC8 const &) - ?NewL@CCmDriveInfo@@SAPAV1@XZ @ 129 NONAME ; class CCmDriveInfo * CCmDriveInfo::NewL(void) - ?DeleteStoreRule@CCmStoreRuleContainer@@QAEXH@Z @ 130 NONAME ; void CCmStoreRuleContainer::DeleteStoreRule(int) - ?Uri@CCmFillListItem@@QBEAAVTDesC8@@XZ @ 131 NONAME ; class TDesC8 & CCmFillListItem::Uri(void) const - ?NewLC@CCmSqlGenericItem@@SAPAV1@XZ @ 132 NONAME ; class CCmSqlGenericItem * CCmSqlGenericItem::NewLC(void) - ?PropertyContainerCount@CCmSqlPropertyCollector@@QBEHXZ @ 133 NONAME ; int CCmSqlPropertyCollector::PropertyContainerCount(void) const - ?ItemId@CCmFillListItem@@QBEAAVTDesC8@@XZ @ 134 NONAME ; class TDesC8 & CCmFillListItem::ItemId(void) const - ?NewLC@CCmFillRuleContainer@@SAPAV1@XZ @ 135 NONAME ; class CCmFillRuleContainer * CCmFillRuleContainer::NewLC(void) - ?DeleteRule@CCmFillRule@@QAEXW4TCmMetadataField@@W4TCmOperatorType@@@Z @ 136 NONAME ; void CCmFillRule::DeleteRule(enum TCmMetadataField, enum TCmOperatorType) - ?InternalizeL@CCmStoreRuleContainer@@QAEXAAVRReadStream@@@Z @ 137 NONAME ; void CCmStoreRuleContainer::InternalizeL(class RReadStream &) - ?SetNameL@CCmFillRule@@QAEHABVTDesC8@@@Z @ 138 NONAME ; int CCmFillRule::SetNameL(class TDesC8 const &) - ?Selected@CCmFillRule@@QBE?AW4TCmFillRuleStatus@@XZ @ 139 NONAME ; enum TCmFillRuleStatus CCmFillRule::Selected(void) const - ?MediaType@CCmFillRule@@QBE?AW4TCmMediaType@@XZ @ 140 NONAME ; enum TCmMediaType CCmFillRule::MediaType(void) const - ?Id@CCmSqlPropertyItem@@QBE_JXZ @ 141 NONAME ; long long CCmSqlPropertyItem::Id(void) const - ?SortPropertyItem@CCmSqlPropertyContainer@@QAEXXZ @ 142 NONAME ; void CCmSqlPropertyContainer::SortPropertyItem(void) - ?StoreRuleCount@CCmStoreRuleContainer@@QBEHXZ @ 143 NONAME ; int CCmStoreRuleContainer::StoreRuleCount(void) const - ?DevId@CCmFillListItem@@QBEEXZ @ 144 NONAME ; unsigned char CCmFillListItem::DevId(void) const - ?SetSearchId@CCmSqlBaseItem@@QAEX_J@Z @ 145 NONAME ; void CCmSqlBaseItem::SetSearchId(long long) - ?NewL@CCmSqlPropertyCollector@@SAPAV1@XZ @ 146 NONAME ; class CCmSqlPropertyCollector * CCmSqlPropertyCollector::NewL(void) - ?ExcAlbums@CCmStoreRule@@QAEAAVCDesC16Array@@XZ @ 147 NONAME ; class CDesC16Array & CCmStoreRule::ExcAlbums(void) - ?Hash@CCmSearchResponseHash@@QBEABVTDesC8@@XZ @ 148 NONAME ; class TDesC8 const & CCmSearchResponseHash::Hash(void) const - ?SetUsedDriveQuota@CCmDriveInfo@@QAEX_J@Z @ 149 NONAME ; void CCmDriveInfo::SetUsedDriveQuota(long long) - ?RemoveExcAlbum@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 150 NONAME ; void CCmStoreRule::RemoveExcAlbum(class TDesC16 const &) - ?SetSelected@CCmFillListItem@@QAEXW4TCmFillRuleStatus@@@Z @ 151 NONAME ; void CCmFillListItem::SetSelected(enum TCmFillRuleStatus) - ?SetDriveNumber@CCmDriveInfo@@QAEXH@Z @ 152 NONAME ; void CCmDriveInfo::SetDriveNumber(int) - ?SetMediaType@CCmFillRule@@QAEXW4TCmMediaType@@@Z @ 153 NONAME ; void CCmFillRule::SetMediaType(enum TCmMediaType) - ?DriveQuota@CCmDriveInfo@@QBE_JXZ @ 154 NONAME ; long long CCmDriveInfo::DriveQuota(void) const - ?SetDate@CCmSqlGenericItem@@QAEXABVTTime@@@Z @ 155 NONAME ; void CCmSqlGenericItem::SetDate(class TTime const &) - ?Selected@CCmStoreRule@@QBE?AW4TCmFillRuleStatus@@XZ @ 156 NONAME ; enum TCmFillRuleStatus CCmStoreRule::Selected(void) const - ?AlbumId@CCmSqlAudioItem@@QBE_JXZ @ 157 NONAME ; long long CCmSqlAudioItem::AlbumId(void) const - ?UpnpclassId@CCmSqlGenericItem@@QBE_JXZ @ 158 NONAME ; long long CCmSqlGenericItem::UpnpclassId(void) const - ?Selected@CCmFillListItem@@QBE?AW4TCmFillRuleStatus@@XZ @ 159 NONAME ; enum TCmFillRuleStatus CCmFillListItem::Selected(void) const - ?NewLC@CCmSqlPropertyItem@@SAPAV1@XZ @ 160 NONAME ; class CCmSqlPropertyItem * CCmSqlPropertyItem::NewLC(void) - ?Date@CCmBaseListItem@@QBE?AVTTime@@XZ @ 161 NONAME ; class TTime CCmBaseListItem::Date(void) const - ??1CCmBaseListItem@@UAE@XZ @ 162 NONAME ; CCmBaseListItem::~CCmBaseListItem(void) - ?SetId@CCmSqlBaseItem@@QAEX_J@Z @ 163 NONAME ; void CCmSqlBaseItem::SetId(long long) - ??1CCmSqlAudioItem@@UAE@XZ @ 164 NONAME ; CCmSqlAudioItem::~CCmSqlAudioItem(void) - ?LoadResourceFileL@CmCommonUtils@@SAHABVTDesC16@@AAVCEikonEnv@@@Z @ 165 NONAME ; int CmCommonUtils::LoadResourceFileL(class TDesC16 const &, class CEikonEnv &) - ?SetUDNL@CCmMediaServer@@QAEXABVTDesC8@@@Z @ 166 NONAME ; void CCmMediaServer::SetUDNL(class TDesC8 const &) - ?FillRule@CCmFillRuleContainer@@QBEPAVCCmFillRule@@H@Z @ 167 NONAME ; class CCmFillRule * CCmFillRuleContainer::FillRule(int) const - ?AddExcPlayListL@CCmFillRule@@QAEXABVTDesC16@@@Z @ 168 NONAME ; void CCmFillRule::AddExcPlayListL(class TDesC16 const &) - ?ItemCount@CCmSearchResponseHash@@QBEHXZ @ 169 NONAME ; int CCmSearchResponseHash::ItemCount(void) const - ?SetItemIdL@CCmFillListItem@@QAEXABVTDesC8@@@Z @ 170 NONAME ; void CCmFillListItem::SetItemIdL(class TDesC8 const &) - ?NewL@CCmSqlPropertyItem@@SAPAV1@XZ @ 171 NONAME ; class CCmSqlPropertyItem * CCmSqlPropertyItem::NewL(void) - ?StoreUsage@CCmMediaServerFull@@QAEHXZ @ 172 NONAME ; int CCmMediaServerFull::StoreUsage(void) - ?NewLC@CCmSqlPropertyCollector@@SAPAV1@XZ @ 173 NONAME ; class CCmSqlPropertyCollector * CCmSqlPropertyCollector::NewLC(void) - ?ExternalizeL@CCmSqlPropertyContainer@@QBEXAAVRWriteStream@@@Z @ 174 NONAME ; void CCmSqlPropertyContainer::ExternalizeL(class RWriteStream &) const - ?NewLC@CCmMediaServerFull@@SAPAV1@XZ @ 175 NONAME ; class CCmMediaServerFull * CCmMediaServerFull::NewLC(void) - ??1CCmSqlPropertyCollector@@UAE@XZ @ 176 NONAME ; CCmSqlPropertyCollector::~CCmSqlPropertyCollector(void) - ?DriveId@CCmDriveInfo@@QBEIXZ @ 177 NONAME ; unsigned int CCmDriveInfo::DriveId(void) const - ?SetWidth@CCmSqlResolutionPropertyItem@@QAEXH@Z @ 178 NONAME ; void CCmSqlResolutionPropertyItem::SetWidth(int) - ?NewL@CCmFillListItem@@SAPAV1@XZ @ 179 NONAME ; class CCmFillListItem * CCmFillListItem::NewL(void) - ?InternalizeL@CCmFillListItem@@QAEXAAVRReadStream@@@Z @ 180 NONAME ; void CCmFillListItem::InternalizeL(class RReadStream &) - ?MediaServerL@CCmFillRule@@QAEXHAAH@Z @ 181 NONAME ; void CCmFillRule::MediaServerL(int, int &) - ?SetStatus@CCmDriveInfo@@QAEXH@Z @ 182 NONAME ; void CCmDriveInfo::SetStatus(int) - ?RuleParamL@CCmFillRule@@QAEXHHPAVTPtrC8@@@Z @ 183 NONAME ; void CCmFillRule::RuleParamL(int, int, class TPtrC8 *) - ?UpnpClass@CCmFillListItem@@QBEAAVTDesC16@@XZ @ 184 NONAME ; class TDesC16 & CCmFillListItem::UpnpClass(void) const - ?MediaServerL@CCmFillRule@@QAEABVTDesC8@@H@Z @ 185 NONAME ; class TDesC8 const & CCmFillRule::MediaServerL(int) - ?SetHashL@CCmSqlBaseItem@@QAEXABVTDesC16@@@Z @ 186 NONAME ; void CCmSqlBaseItem::SetHashL(class TDesC16 const &) - ?Id@CCmSqlBaseItem@@QBE_JXZ @ 187 NONAME ; long long CCmSqlBaseItem::Id(void) const - ?SearchId@CCmSqlBaseItem@@QBE_JXZ @ 188 NONAME ; long long CCmSqlBaseItem::SearchId(void) const - ??1CCmFillRuleContainer@@UAE@XZ @ 189 NONAME ; CCmFillRuleContainer::~CCmFillRuleContainer(void) - ?ExternalizeL@CCmSqlResolutionPropertyItem@@QBEXAAVRWriteStream@@@Z @ 190 NONAME ; void CCmSqlResolutionPropertyItem::ExternalizeL(class RWriteStream &) const - ?SetMediaServerNameL@CCmMediaServerFull@@QAEXABVTDesC8@@@Z @ 191 NONAME ; void CCmMediaServerFull::SetMediaServerNameL(class TDesC8 const &) - ?SetPriority@CCmFillRule@@QAEXE@Z @ 192 NONAME ; void CCmFillRule::SetPriority(unsigned char) - ?DbId@CCmBaseListItem@@QBE_KXZ @ 193 NONAME ; unsigned long long CCmBaseListItem::DbId(void) const - ?NewL@CCmSearchResponseHash@@SAPAV1@XZ @ 194 NONAME ; class CCmSearchResponseHash * CCmSearchResponseHash::NewL(void) - ?InternalizeL@CCmFillRuleContainer@@QAEXAAVRReadStream@@@Z @ 195 NONAME ; void CCmFillRuleContainer::InternalizeL(class RReadStream &) - ?InternalizeL@CCmSqlPropertyItem@@QAEXAAVRReadStream@@@Z @ 196 NONAME ; void CCmSqlPropertyItem::InternalizeL(class RReadStream &) - ?SetFillUsage@CCmMediaServerFull@@QAEXH@Z @ 197 NONAME ; void CCmMediaServerFull::SetFillUsage(int) - ?SetPixelCount@CCmSqlResolutionPropertyItem@@QAEXH@Z @ 198 NONAME ; void CCmSqlResolutionPropertyItem::SetPixelCount(int) - ?Duration@CCmSqlAudioItem@@QBEHXZ @ 199 NONAME ; int CCmSqlAudioItem::Duration(void) const - ?SetUpnpClassL@CCmFillListItem@@QAEXABVTDesC16@@@Z @ 200 NONAME ; void CCmFillListItem::SetUpnpClassL(class TDesC16 const &) - ?SetSelected@CCmStoreRule@@QAEXW4TCmFillRuleStatus@@@Z @ 201 NONAME ; void CCmStoreRule::SetSelected(enum TCmFillRuleStatus) - ?SetHashL@CCmSearchResponseHash@@QAEXABVTDesC8@@@Z @ 202 NONAME ; void CCmSearchResponseHash::SetHashL(class TDesC8 const &) - ?SetUriL@CCmSqlGenericItem@@QAEXABVTDesC8@@@Z @ 203 NONAME ; void CCmSqlGenericItem::SetUriL(class TDesC8 const &) - ?AddPropertyContainerL@CCmSqlPropertyCollector@@QAEHPAVCCmSqlPropertyContainer@@@Z @ 204 NONAME ; int CCmSqlPropertyCollector::AddPropertyContainerL(class CCmSqlPropertyContainer *) - ?ResourceCount@CCmSqlGenericItem@@QBEHXZ @ 205 NONAME ; int CCmSqlGenericItem::ResourceCount(void) const - ?SetDriveId@CCmFillListItem@@QAEXI@Z @ 206 NONAME ; void CCmFillListItem::SetDriveId(unsigned int) - ?AddRuleParamL@CCmFillRule@@QAEHHABVTDesC8@@@Z @ 207 NONAME ; int CCmFillRule::AddRuleParamL(int, class TDesC8 const &) - ?DriveSize@CCmDriveInfo@@QBE_JXZ @ 208 NONAME ; long long CCmDriveInfo::DriveSize(void) const - ?SetDriveNumber@CCmFillListItem@@QAEXH@Z @ 209 NONAME ; void CCmFillListItem::SetDriveNumber(int) - ?Uri@CCmSqlGenericItem@@QBEAAVTDesC8@@XZ @ 210 NONAME ; class TDesC8 & CCmSqlGenericItem::Uri(void) const - ?Status@CCmSqlPropertyItem@@QBEHXZ @ 211 NONAME ; int CCmSqlPropertyItem::Status(void) const - ?DriveNumber@CCmFillListItem@@QBEHXZ @ 212 NONAME ; int CCmFillListItem::DriveNumber(void) const - ?PropertyItem@CCmSqlPropertyContainer@@QAEPAVCCmSqlPropertyItem@@H@Z @ 213 NONAME ; class CCmSqlPropertyItem * CCmSqlPropertyContainer::PropertyItem(int) - ?PropertyItemCount@CCmSqlPropertyContainer@@QBEHXZ @ 214 NONAME ; int CCmSqlPropertyContainer::PropertyItemCount(void) const - ?SetTrackNumber@CCmSqlAudioItem@@QAEXH@Z @ 215 NONAME ; void CCmSqlAudioItem::SetTrackNumber(int) - ?CopyCapability@CCmMediaServerFull@@QBEHXZ @ 216 NONAME ; int CCmMediaServerFull::CopyCapability(void) const - ?CompareByCdsId@CCmSqlBaseItem@@SAHABV1@0@Z @ 217 NONAME ; int CCmSqlBaseItem::CompareByCdsId(class CCmSqlBaseItem const &, class CCmSqlBaseItem const &) - ?SecondaryText@CCmBaseListItem@@QBEAAVTDesC16@@XZ @ 218 NONAME ; class TDesC16 & CCmBaseListItem::SecondaryText(void) const - ?InternalizeL@CCmSqlPropertyCollector@@QAEXAAVRReadStream@@@Z @ 219 NONAME ; void CCmSqlPropertyCollector::InternalizeL(class RReadStream &) - ?NewLC@CCmDriveInfo@@SAPAV1@XZ @ 220 NONAME ; class CCmDriveInfo * CCmDriveInfo::NewLC(void) - ?SetStoreUsage@CCmMediaServerFull@@QAEXH@Z @ 221 NONAME ; void CCmMediaServerFull::SetStoreUsage(int) - ?AddExcAlbumL@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 222 NONAME ; void CCmStoreRule::AddExcAlbumL(class TDesC16 const &) - ??0CCmSqlPropertyItem@@QAE@ABV0@@Z @ 223 NONAME ; CCmSqlPropertyItem::CCmSqlPropertyItem(class CCmSqlPropertyItem const &) - ?SetSecondaryTextL@CCmBaseListItem@@QAEXABVTDesC16@@@Z @ 224 NONAME ; void CCmBaseListItem::SetSecondaryTextL(class TDesC16 const &) - ?SetUpnpProfileId@CCmSqlGenericItem@@QAEX_J@Z @ 225 NONAME ; void CCmSqlGenericItem::SetUpnpProfileId(long long) - ?NewL@CCmStoreRuleContainer@@SAPAV1@XZ @ 226 NONAME ; class CCmStoreRuleContainer * CCmStoreRuleContainer::NewL(void) - ?RemoveExcPlayList@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 227 NONAME ; void CCmStoreRule::RemoveExcPlayList(class TDesC16 const &) - ?NewResourceL@CCmSqlGenericItem@@QAEXABVTDesC8@@HHH_J@Z @ 228 NONAME ; void CCmSqlGenericItem::NewResourceL(class TDesC8 const &, int, int, int, long long) - ?AddRuleL@CCmFillRule@@QAEHW4TCmMetadataField@@W4TCmOperatorType@@@Z @ 229 NONAME ; int CCmFillRule::AddRuleL(enum TCmMetadataField, enum TCmOperatorType) - ?ListRealSizeInBytes@CCmFillRule@@QBEKXZ @ 230 NONAME ; unsigned long CCmFillRule::ListRealSizeInBytes(void) const - ?SetDriveType@CCmDriveInfo@@QAEXI@Z @ 231 NONAME ; void CCmDriveInfo::SetDriveType(unsigned int) - ?AddExcPlayListL@CCmStoreRule@@QAEXABVTDesC16@@@Z @ 232 NONAME ; void CCmStoreRule::AddExcPlayListL(class TDesC16 const &) - ?ExternalizeL@CCmMediaServerFull@@QBEXAAVRWriteStream@@@Z @ 233 NONAME ; void CCmMediaServerFull::ExternalizeL(class RWriteStream &) const - ?NewL@CCmStoreListItem@@SAPAV1@XZ @ 234 NONAME ; class CCmStoreListItem * CCmStoreListItem::NewL(void) - ?SetDbId@CCmBaseListItem@@QAEX_K@Z @ 235 NONAME ; void CCmBaseListItem::SetDbId(unsigned long long) - ?InternalizeL@CCmStoreListItem@@QAEXAAVRReadStream@@@Z @ 236 NONAME ; void CCmStoreListItem::InternalizeL(class RReadStream &) - ?SetDuration@CCmSqlAudioItem@@QAEXH@Z @ 237 NONAME ; void CCmSqlAudioItem::SetDuration(int) - ?ExternalizeL@CCmBaseListItem@@QBEXAAVRWriteStream@@@Z @ 238 NONAME ; void CCmBaseListItem::ExternalizeL(class RWriteStream &) const - ?SetPrimaryTextL@CCmBaseListItem@@QAEXABVTDesC16@@@Z @ 239 NONAME ; void CCmBaseListItem::SetPrimaryTextL(class TDesC16 const &) - ?SetDriveSize@CCmDriveInfo@@QAEX_J@Z @ 240 NONAME ; void CCmDriveInfo::SetDriveSize(long long) - ?SetIsActive@CCmMediaServerFull@@QAEXE@Z @ 241 NONAME ; void CCmMediaServerFull::SetIsActive(unsigned char) - ?ListId@CCmStoreRule@@QBEIXZ @ 242 NONAME ; unsigned int CCmStoreRule::ListId(void) const - ?SetStartIndex@CCmSearchResponseHash@@QAEXH@Z @ 243 NONAME ; void CCmSearchResponseHash::SetStartIndex(int) - ?ListId@CCmStoreListItem@@QBEIXZ @ 244 NONAME ; unsigned int CCmStoreListItem::ListId(void) const - ?SetHarvestDate@CCmSqlGenericItem@@QAEXABVTTime@@@Z @ 245 NONAME ; void CCmSqlGenericItem::SetHarvestDate(class TTime const &) - ?SetMediaType@CCmSqlGenericItem@@QAEXW4TCmMediaType@@@Z @ 246 NONAME ; void CCmSqlGenericItem::SetMediaType(enum TCmMediaType) - ?SetAlbumId@CCmSqlAudioItem@@QAEX_J@Z @ 247 NONAME ; void CCmSqlAudioItem::SetAlbumId(long long) - ?NewL@CCmFillRuleContainer@@SAPAV1@XZ @ 248 NONAME ; class CCmFillRuleContainer * CCmFillRuleContainer::NewL(void) - ?InternalizeL@CCmMediaServerFull@@QAEXAAVRReadStream@@@Z @ 249 NONAME ; void CCmMediaServerFull::InternalizeL(class RReadStream &) - ?ExternalizeL@CCmSqlPropertyItem@@QBEXAAVRWriteStream@@@Z @ 250 NONAME ; void CCmSqlPropertyItem::ExternalizeL(class RWriteStream &) const - ?SetDescriptionL@CCmSqlImageItem@@QAEXABVTDesC8@@@Z @ 251 NONAME ; void CCmSqlImageItem::SetDescriptionL(class TDesC8 const &) - ?AddMediaServerL@CCmFillRule@@QAEHH@Z @ 252 NONAME ; int CCmFillRule::AddMediaServerL(int) - ?NewL@CCmMediaServer@@SAPAV1@XZ @ 253 NONAME ; class CCmMediaServer * CCmMediaServer::NewL(void) - ?SetTitleL@CCmSqlGenericItem@@QAEXABVTDesC8@@@Z @ 254 NONAME ; void CCmSqlGenericItem::SetTitleL(class TDesC8 const &) - ?ArtistId@CCmSqlAudioItem@@QBE_JXZ @ 255 NONAME ; long long CCmSqlAudioItem::ArtistId(void) const - ?SetCopyCapability@CCmMediaServerFull@@QAEXH@Z @ 256 NONAME ; void CCmMediaServerFull::SetCopyCapability(int) - ?SetDbId@CCmMediaServer@@QAEX_J@Z @ 257 NONAME ; void CCmMediaServer::SetDbId(long long) - ?ExternalizeL@CCmSqlPropertyCollector@@QBEXAAVRWriteStream@@@Z @ 258 NONAME ; void CCmSqlPropertyCollector::ExternalizeL(class RWriteStream &) const - ?DeletePropertyItem@CCmSqlPropertyContainer@@QAEXH@Z @ 259 NONAME ; void CCmSqlPropertyContainer::DeletePropertyItem(int) - ?ResolutionId@CCmSqlImageItem@@QBE_JXZ @ 260 NONAME ; long long CCmSqlImageItem::ResolutionId(void) const - ?Priority@CCmFillRule@@QBEEXZ @ 261 NONAME ; unsigned char CCmFillRule::Priority(void) const - ?SetGenreId@CCmSqlVideoItem@@QAEX_J@Z @ 262 NONAME ; void CCmSqlVideoItem::SetGenreId(long long) - ?ParamCountL@CCmFillRule@@QBEHH@Z @ 263 NONAME ; int CCmFillRule::ParamCountL(int) const - ?NewL@CCmSqlImageItem@@SAPAV1@XZ @ 264 NONAME ; class CCmSqlImageItem * CCmSqlImageItem::NewL(void) - ?NewL@CCmSqlAudioItem@@SAPAV1@XZ @ 265 NONAME ; class CCmSqlAudioItem * CCmSqlAudioItem::NewL(void) - ?SetStatus@CCmStoreRule@@QAEXW4TCmListItemStatus@@@Z @ 266 NONAME ; void CCmStoreRule::SetStatus(enum TCmListItemStatus) - ?PropertyContainer@CCmSqlPropertyCollector@@QAEPAVCCmSqlPropertyContainer@@H@Z @ 267 NONAME ; class CCmSqlPropertyContainer * CCmSqlPropertyCollector::PropertyContainer(int) - ??1CCmStoreRule@@UAE@XZ @ 268 NONAME ; CCmStoreRule::~CCmStoreRule(void) - ??1CCmStoreListItem@@UAE@XZ @ 269 NONAME ; CCmStoreListItem::~CCmStoreListItem(void) - ?SetBitrate@CCmSqlAudioItem@@QAEXH@Z @ 270 NONAME ; void CCmSqlAudioItem::SetBitrate(int) - ?StatusValues@CCmStoreListItem@@QBE?AV?$RArray@W4TCmListItemStatus@@@@XZ @ 271 NONAME ; class RArray CCmStoreListItem::StatusValues(void) const - ?NewLC@CCmStoreRuleContainer@@SAPAV1@XZ @ 272 NONAME ; class CCmStoreRuleContainer * CCmStoreRuleContainer::NewLC(void) - ?NewL@CCmMediaServerFull@@SAPAV1@XZ @ 273 NONAME ; class CCmMediaServerFull * CCmMediaServerFull::NewL(void) - ?NewLC@CCmFillListItem@@SAPAV1@XZ @ 274 NONAME ; class CCmFillListItem * CCmFillListItem::NewLC(void) - ?GenreId@CCmSqlAudioItem@@QBE_JXZ @ 275 NONAME ; long long CCmSqlAudioItem::GenreId(void) const - ?DriveType@CCmDriveInfo@@QBEIXZ @ 276 NONAME ; unsigned int CCmDriveInfo::DriveType(void) const - ??1CCmFillListItem@@UAE@XZ @ 277 NONAME ; CCmFillListItem::~CCmFillListItem(void) - ?MediaServer@CCmMediaServer@@QBEABVTDesC8@@XZ @ 278 NONAME ; class TDesC8 const & CCmMediaServer::MediaServer(void) const - ??1CCmSqlResolutionPropertyItem@@UAE@XZ @ 279 NONAME ; CCmSqlResolutionPropertyItem::~CCmSqlResolutionPropertyItem(void) - ?AddStoreRuleL@CCmStoreRule@@QAEHW4TCmMediaType@@@Z @ 280 NONAME ; int CCmStoreRule::AddStoreRuleL(enum TCmMediaType) - ?DriveName@CCmDriveInfo@@QBEAAVTDesC16@@XZ @ 281 NONAME ; class TDesC16 & CCmDriveInfo::DriveName(void) const - ?NewL@CCmBaseListItem@@SAPAV1@XZ @ 282 NONAME ; class CCmBaseListItem * CCmBaseListItem::NewL(void) - ?Name@CCmStoreRule@@QBEAAVTDesC8@@XZ @ 283 NONAME ; class TDesC8 & CCmStoreRule::Name(void) const - ?NewL@CCmStoreRule@@SAPAV1@XZ @ 284 NONAME ; class CCmStoreRule * CCmStoreRule::NewL(void) - ??1CCmSqlGenericItem@@UAE@XZ @ 285 NONAME ; CCmSqlGenericItem::~CCmSqlGenericItem(void) - ?RefId@CCmBaseListItem@@QBE_KXZ @ 286 NONAME ; unsigned long long CCmBaseListItem::RefId(void) const - ?SetNameL@CCmStoreRule@@QAEXABVTDesC8@@@Z @ 287 NONAME ; void CCmStoreRule::SetNameL(class TDesC8 const &) - ?AddMediaServerL@CCmStoreRule@@QAEHABVTDesC8@@@Z @ 288 NONAME ; int CCmStoreRule::AddMediaServerL(class TDesC8 const &) - ?NewL@CCmSqlGenericItem@@SAPAV1@XZ @ 289 NONAME ; class CCmSqlGenericItem * CCmSqlGenericItem::NewL(void) - ?NewLC@CCmSqlAudioItem@@SAPAV1@XZ @ 290 NONAME ; class CCmSqlAudioItem * CCmSqlAudioItem::NewLC(void) - ?SetStatus@CCmBaseListItem@@QAEXW4TCmListItemStatus@@@Z @ 291 NONAME ; void CCmBaseListItem::SetStatus(enum TCmListItemStatus) - ?Status@CCmFillRule@@QBE?AW4TCmListItemStatus@@XZ @ 292 NONAME ; enum TCmListItemStatus CCmFillRule::Status(void) const - ??1CCmSqlImageItem@@UAE@XZ @ 293 NONAME ; CCmSqlImageItem::~CCmSqlImageItem(void) - ?RuleParamL@CCmFillRule@@QAEXHHAAH@Z @ 294 NONAME ; void CCmFillRule::RuleParamL(int, int, int &) - ?SetListId@CCmStoreListItem@@QAEXI@Z @ 295 NONAME ; void CCmStoreListItem::SetListId(unsigned int) - ?MediaType@CCmBaseListItem@@QBE?AW4TCmMediaType@@XZ @ 296 NONAME ; enum TCmMediaType CCmBaseListItem::MediaType(void) const - ?InternalizeL@CCmSqlPropertyContainer@@QAEXAAVRReadStream@@@Z @ 297 NONAME ; void CCmSqlPropertyContainer::InternalizeL(class RReadStream &) - ?DriveId@CCmFillListItem@@QBEIXZ @ 298 NONAME ; unsigned int CCmFillListItem::DriveId(void) const - ?SetWlanScanL@CmCommonUtils@@SAXH@Z @ 299 NONAME ; void CmCommonUtils::SetWlanScanL(int) - ?PixelCount@CCmSqlResolutionPropertyItem@@QBEHXZ @ 300 NONAME ; int CCmSqlResolutionPropertyItem::PixelCount(void) const - ?ListRealCount@CCmFillRule@@QBEKXZ @ 301 NONAME ; unsigned long CCmFillRule::ListRealCount(void) const - ?SetListId@CCmFillRule@@QAEXI@Z @ 302 NONAME ; void CCmFillRule::SetListId(unsigned int) - ?GenreId@CCmSqlVideoItem@@QBE_JXZ @ 303 NONAME ; long long CCmSqlVideoItem::GenreId(void) const - ?FillRuleCount@CCmFillRuleContainer@@QBEHXZ @ 304 NONAME ; int CCmFillRuleContainer::FillRuleCount(void) const - ??1CCmDriveInfo@@UAE@XZ @ 305 NONAME ; CCmDriveInfo::~CCmDriveInfo(void) - ?SetDriveId@CCmDriveInfo@@QAEXI@Z @ 306 NONAME ; void CCmDriveInfo::SetDriveId(unsigned int) - ?RuleL@CCmFillRule@@QAEXHPAW4TCmMetadataField@@PAW4TCmOperatorType@@PAH@Z @ 307 NONAME ; void CCmFillRule::RuleL(int, enum TCmMetadataField *, enum TCmOperatorType *, int *) - ??1CCmSqlVideoItem@@UAE@XZ @ 308 NONAME ; CCmSqlVideoItem::~CCmSqlVideoItem(void) - ?SetStatus@CCmSqlPropertyItem@@QAEXH@Z @ 309 NONAME ; void CCmSqlPropertyItem::SetStatus(int) - ?SetSize@CCmSqlGenericItem@@QAEXH@Z @ 310 NONAME ; void CCmSqlGenericItem::SetSize(int) - ?SetSystemUpdateID@CCmMediaServer@@QAEXH@Z @ 311 NONAME ; void CCmMediaServer::SetSystemUpdateID(int) - ?RemoveExcAlbum@CCmFillRule@@QAEXABVTDesC16@@@Z @ 312 NONAME ; void CCmFillRule::RemoveExcAlbum(class TDesC16 const &) - ?StoreRule@CCmStoreRuleContainer@@QAEPAVCCmStoreRule@@H@Z @ 313 NONAME ; class CCmStoreRule * CCmStoreRuleContainer::StoreRule(int) - ?Path@CCmBaseListItem@@QBEAAVTDesC16@@XZ @ 314 NONAME ; class TDesC16 & CCmBaseListItem::Path(void) const - ?CdsId@CCmSqlBaseItem@@QBEAAVTDesC8@@XZ @ 315 NONAME ; class TDesC8 & CCmSqlBaseItem::CdsId(void) const - ?ExternalizeL@CCmFillRuleContainer@@QBEXAAVRWriteStream@@@Z @ 316 NONAME ; void CCmFillRuleContainer::ExternalizeL(class RWriteStream &) const - ?SetListId@CCmStoreRule@@QAEXI@Z @ 317 NONAME ; void CCmStoreRule::SetListId(unsigned int) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/eabi/cmcommonu.def --- a/upnpharvester/common/cmlibrary/eabi/cmcommonu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,396 +0,0 @@ -EXPORTS - _ZN11CCmFillRule10DeleteRuleE16TCmMetadataField @ 1 NONAME - _ZN11CCmFillRule10DeleteRuleE16TCmMetadataField15TCmOperatorType @ 2 NONAME - _ZN11CCmFillRule10RuleParamLEiiP6TPtrC8 @ 3 NONAME - _ZN11CCmFillRule10RuleParamLEiiRi @ 4 NONAME - _ZN11CCmFillRule11SetPriorityEh @ 5 NONAME - _ZN11CCmFillRule11SetSelectedE17TCmFillRuleStatus @ 6 NONAME - _ZN11CCmFillRule12AddExcAlbumLERK7TDesC16 @ 7 NONAME - _ZN11CCmFillRule12MediaServerLEi @ 8 NONAME - _ZN11CCmFillRule12MediaServerLEiRi @ 9 NONAME - _ZN11CCmFillRule12SetLimitTypeE12TCmLimitType @ 10 NONAME - _ZN11CCmFillRule12SetMediaTypeE12TCmMediaType @ 11 NONAME - _ZN11CCmFillRule13AddRuleParamLEiRK6TDesC8 @ 12 NONAME - _ZN11CCmFillRule13AddRuleParamLEii @ 13 NONAME - _ZN11CCmFillRule13SetTemplateIdEh @ 14 NONAME - _ZN11CCmFillRule14RemoveExcAlbumERK7TDesC16 @ 15 NONAME - _ZN11CCmFillRule15AddExcPlayListLERK7TDesC16 @ 16 NONAME - _ZN11CCmFillRule15AddMediaServerLERK6TDesC8 @ 17 NONAME - _ZN11CCmFillRule15AddMediaServerLEi @ 18 NONAME - _ZN11CCmFillRule16SetListRealCountEm @ 19 NONAME - _ZN11CCmFillRule17DeleteMediaServerERK6TDesC8 @ 20 NONAME - _ZN11CCmFillRule17DeleteMediaServerEi @ 21 NONAME - _ZN11CCmFillRule17RemoveExcPlayListERK7TDesC16 @ 22 NONAME - _ZN11CCmFillRule22SetListRealSizeInBytesEm @ 23 NONAME - _ZN11CCmFillRule4NewLEv @ 24 NONAME - _ZN11CCmFillRule5NewLCEv @ 25 NONAME - _ZN11CCmFillRule5RuleLEiP16TCmMetadataFieldP15TCmOperatorTypePi @ 26 NONAME - _ZN11CCmFillRule8AddRuleLE16TCmMetadataField15TCmOperatorType @ 27 NONAME - _ZN11CCmFillRule8SetNameLERK6TDesC8 @ 28 NONAME - _ZN11CCmFillRule9SetAmountEm @ 29 NONAME - _ZN11CCmFillRule9SetListIdEj @ 30 NONAME - _ZN11CCmFillRule9SetMethodE13TCmFillMethod @ 31 NONAME - _ZN11CCmFillRule9SetStatusE17TCmListItemStatus @ 32 NONAME - _ZN11CCmFillRuleD0Ev @ 33 NONAME - _ZN11CCmFillRuleD1Ev @ 34 NONAME - _ZN11CCmFillRuleD2Ev @ 35 NONAME - _ZN12CCmDriveInfo10SetDriveIdEj @ 36 NONAME - _ZN12CCmDriveInfo12InternalizeLER11RReadStream @ 37 NONAME - _ZN12CCmDriveInfo12SetDriveSizeEx @ 38 NONAME - _ZN12CCmDriveInfo12SetDriveTypeEj @ 39 NONAME - _ZN12CCmDriveInfo13SetDriveNameLERK7TDesC16 @ 40 NONAME - _ZN12CCmDriveInfo13SetDriveQuotaEx @ 41 NONAME - _ZN12CCmDriveInfo14SetDriveNumberEi @ 42 NONAME - _ZN12CCmDriveInfo17SetUsedDriveQuotaEx @ 43 NONAME - _ZN12CCmDriveInfo4NewLEv @ 44 NONAME - _ZN12CCmDriveInfo5NewLCEv @ 45 NONAME - _ZN12CCmDriveInfo9SetStatusEi @ 46 NONAME - _ZN12CCmDriveInfoD0Ev @ 47 NONAME - _ZN12CCmDriveInfoD1Ev @ 48 NONAME - _ZN12CCmDriveInfoD2Ev @ 49 NONAME - _ZN12CCmStoreRule11SetSelectedE17TCmFillRuleStatus @ 50 NONAME - _ZN12CCmStoreRule12AddExcAlbumLERK7TDesC16 @ 51 NONAME - _ZN12CCmStoreRule12ExcPlayListsEv @ 52 NONAME - _ZN12CCmStoreRule12MediaServerLEi @ 53 NONAME - _ZN12CCmStoreRule13AddStoreRuleLE12TCmMediaType @ 54 NONAME - _ZN12CCmStoreRule14RemoveExcAlbumERK7TDesC16 @ 55 NONAME - _ZN12CCmStoreRule15AddExcPlayListLERK7TDesC16 @ 56 NONAME - _ZN12CCmStoreRule15AddMediaServerLERK6TDesC8 @ 57 NONAME - _ZN12CCmStoreRule17DeleteMediaServerERK6TDesC8 @ 58 NONAME - _ZN12CCmStoreRule17RemoveExcPlayListERK7TDesC16 @ 59 NONAME - _ZN12CCmStoreRule4NewLEv @ 60 NONAME - _ZN12CCmStoreRule5NewLCEv @ 61 NONAME - _ZN12CCmStoreRule8SetNameLERK6TDesC8 @ 62 NONAME - _ZN12CCmStoreRule9ExcAlbumsEv @ 63 NONAME - _ZN12CCmStoreRule9SetListIdEj @ 64 NONAME - _ZN12CCmStoreRule9SetStatusE17TCmListItemStatus @ 65 NONAME - _ZN12CCmStoreRule9StoreRuleEiP12TCmMediaType @ 66 NONAME - _ZN12CCmStoreRuleD0Ev @ 67 NONAME - _ZN12CCmStoreRuleD1Ev @ 68 NONAME - _ZN12CCmStoreRuleD2Ev @ 69 NONAME - _ZN13CmCommonUtils12SetWlanScanLEi @ 70 NONAME - _ZN13CmCommonUtils17LoadResourceFileLERK7TDesC16R9CEikonEnv @ 71 NONAME - _ZN14CCmMediaServer17SetSystemUpdateIDEi @ 72 NONAME - _ZN14CCmMediaServer4NewLEv @ 73 NONAME - _ZN14CCmMediaServer5NewLCEv @ 74 NONAME - _ZN14CCmMediaServer7SetDbIdEx @ 75 NONAME - _ZN14CCmMediaServer7SetUDNLERK6TDesC8 @ 76 NONAME - _ZN14CCmSqlBaseItem11SetSearchIdEx @ 77 NONAME - _ZN14CCmSqlBaseItem13CompareByHashERKS_S1_ @ 78 NONAME - _ZN14CCmSqlBaseItem14CompareByCdsIdERKS_S1_ @ 79 NONAME - _ZN14CCmSqlBaseItem4NewLEv @ 80 NONAME - _ZN14CCmSqlBaseItem5NewLCEv @ 81 NONAME - _ZN14CCmSqlBaseItem5SetIdEx @ 82 NONAME - _ZN14CCmSqlBaseItem8SetHashLERK7TDesC16 @ 83 NONAME - _ZN14CCmSqlBaseItem9SetCdsIdLERK6TDesC8 @ 84 NONAME - _ZN14CCmSqlBaseItemD0Ev @ 85 NONAME - _ZN14CCmSqlBaseItemD1Ev @ 86 NONAME - _ZN14CCmSqlBaseItemD2Ev @ 87 NONAME - _ZN15CCmBaseListItem12InternalizeLER11RReadStream @ 88 NONAME - _ZN15CCmBaseListItem12SetMediaTypeE12TCmMediaType @ 89 NONAME - _ZN15CCmBaseListItem15SetPrimaryTextLERK7TDesC16 @ 90 NONAME - _ZN15CCmBaseListItem17SetSecondaryTextLERK7TDesC16 @ 91 NONAME - _ZN15CCmBaseListItem4NewLEv @ 92 NONAME - _ZN15CCmBaseListItem5NewLCEv @ 93 NONAME - _ZN15CCmBaseListItem7SetDateE5TTime @ 94 NONAME - _ZN15CCmBaseListItem7SetDbIdEy @ 95 NONAME - _ZN15CCmBaseListItem7SetSizeEm @ 96 NONAME - _ZN15CCmBaseListItem8SetPathLERK7TDesC16 @ 97 NONAME - _ZN15CCmBaseListItem8SetRefIdEy @ 98 NONAME - _ZN15CCmBaseListItem9SetStatusE17TCmListItemStatus @ 99 NONAME - _ZN15CCmBaseListItemD0Ev @ 100 NONAME - _ZN15CCmBaseListItemD1Ev @ 101 NONAME - _ZN15CCmBaseListItemD2Ev @ 102 NONAME - _ZN15CCmFillListItem10SetDriveIdEj @ 103 NONAME - _ZN15CCmFillListItem10SetItemIdLERK6TDesC8 @ 104 NONAME - _ZN15CCmFillListItem11SetPriorityEh @ 105 NONAME - _ZN15CCmFillListItem11SetSelectedE17TCmFillRuleStatus @ 106 NONAME - _ZN15CCmFillListItem12InternalizeLER11RReadStream @ 107 NONAME - _ZN15CCmFillListItem13SetUpnpClassLERK7TDesC16 @ 108 NONAME - _ZN15CCmFillListItem14SetDriveNumberEi @ 109 NONAME - _ZN15CCmFillListItem4NewLEv @ 110 NONAME - _ZN15CCmFillListItem5NewLCEjjj17TCmFillRuleStatus @ 111 NONAME - _ZN15CCmFillListItem5NewLCEv @ 112 NONAME - _ZN15CCmFillListItem7SetUriLERK6TDesC8 @ 113 NONAME - _ZN15CCmFillListItem8SetDevIdEh @ 114 NONAME - _ZN15CCmFillListItem9SetListIdEj @ 115 NONAME - _ZN15CCmFillListItemD0Ev @ 116 NONAME - _ZN15CCmFillListItemD1Ev @ 117 NONAME - _ZN15CCmFillListItemD2Ev @ 118 NONAME - _ZN15CCmSqlAudioItem10SetAlbumIdEx @ 119 NONAME - _ZN15CCmSqlAudioItem10SetBitrateEi @ 120 NONAME - _ZN15CCmSqlAudioItem10SetGenreIdEx @ 121 NONAME - _ZN15CCmSqlAudioItem11SetArtistIdEx @ 122 NONAME - _ZN15CCmSqlAudioItem11SetDurationEi @ 123 NONAME - _ZN15CCmSqlAudioItem14SetTrackNumberEi @ 124 NONAME - _ZN15CCmSqlAudioItem15SetAlbumArtUriLERK6TDesC8 @ 125 NONAME - _ZN15CCmSqlAudioItem4NewLEv @ 126 NONAME - _ZN15CCmSqlAudioItem5NewLCEv @ 127 NONAME - _ZN15CCmSqlAudioItemD0Ev @ 128 NONAME - _ZN15CCmSqlAudioItemD1Ev @ 129 NONAME - _ZN15CCmSqlAudioItemD2Ev @ 130 NONAME - _ZN15CCmSqlImageItem15SetDescriptionLERK6TDesC8 @ 131 NONAME - _ZN15CCmSqlImageItem15SetResolutionIdEx @ 132 NONAME - _ZN15CCmSqlImageItem4NewLEv @ 133 NONAME - _ZN15CCmSqlImageItem5NewLCEv @ 134 NONAME - _ZN15CCmSqlImageItemD0Ev @ 135 NONAME - _ZN15CCmSqlImageItemD1Ev @ 136 NONAME - _ZN15CCmSqlImageItemD2Ev @ 137 NONAME - _ZN15CCmSqlVideoItem10SetGenreIdEx @ 138 NONAME - _ZN15CCmSqlVideoItem4NewLEv @ 139 NONAME - _ZN15CCmSqlVideoItem5NewLCEv @ 140 NONAME - _ZN15CCmSqlVideoItemD0Ev @ 141 NONAME - _ZN15CCmSqlVideoItemD1Ev @ 142 NONAME - _ZN15CCmSqlVideoItemD2Ev @ 143 NONAME - _ZN16CCmStoreListItem12InternalizeLER11RReadStream @ 144 NONAME - _ZN16CCmStoreListItem17UpdateFileStatusLEh17TCmListItemStatus @ 145 NONAME - _ZN16CCmStoreListItem4NewLEv @ 146 NONAME - _ZN16CCmStoreListItem5NewLCEv @ 147 NONAME - _ZN16CCmStoreListItem8SetDevIdEh17TCmListItemStatus @ 148 NONAME - _ZN16CCmStoreListItem9SetListIdEj @ 149 NONAME - _ZN16CCmStoreListItemD0Ev @ 150 NONAME - _ZN16CCmStoreListItemD1Ev @ 151 NONAME - _ZN16CCmStoreListItemD2Ev @ 152 NONAME - _ZN17CCmSqlGenericItem11GetResourceER6TDesC8RiS2_S2_Rxi @ 153 NONAME - _ZN17CCmSqlGenericItem12NewResourceLERK6TDesC8iiix @ 154 NONAME - _ZN17CCmSqlGenericItem12SetMediaTypeE12TCmMediaType @ 155 NONAME - _ZN17CCmSqlGenericItem14SetHarvestDateERK5TTime @ 156 NONAME - _ZN17CCmSqlGenericItem14SetUpnpclassIdEx @ 157 NONAME - _ZN17CCmSqlGenericItem16SetUpnpProfileIdEx @ 158 NONAME - _ZN17CCmSqlGenericItem4NewLEv @ 159 NONAME - _ZN17CCmSqlGenericItem5NewLCEv @ 160 NONAME - _ZN17CCmSqlGenericItem7SetDateERK5TTime @ 161 NONAME - _ZN17CCmSqlGenericItem7SetSizeEi @ 162 NONAME - _ZN17CCmSqlGenericItem7SetUriLERK6TDesC8 @ 163 NONAME - _ZN17CCmSqlGenericItem9SetTitleLERK6TDesC8 @ 164 NONAME - _ZN17CCmSqlGenericItemD0Ev @ 165 NONAME - _ZN17CCmSqlGenericItemD1Ev @ 166 NONAME - _ZN17CCmSqlGenericItemD2Ev @ 167 NONAME - _ZN18CCmMediaServerFull10StoreUsageEv @ 168 NONAME - _ZN18CCmMediaServerFull11SetIsActiveEh @ 169 NONAME - _ZN18CCmMediaServerFull12InternalizeLER11RReadStream @ 170 NONAME - _ZN18CCmMediaServerFull12SetFillUsageEi @ 171 NONAME - _ZN18CCmMediaServerFull13SetStoreUsageEi @ 172 NONAME - _ZN18CCmMediaServerFull14SetVisibleDateE5TTime @ 173 NONAME - _ZN18CCmMediaServerFull17SetCopyCapabilityEi @ 174 NONAME - _ZN18CCmMediaServerFull19SetMediaServerNameLERK6TDesC8 @ 175 NONAME - _ZN18CCmMediaServerFull4NewLEv @ 176 NONAME - _ZN18CCmMediaServerFull5NewLCEv @ 177 NONAME - _ZN18CCmMediaServerFull9FillUsageEv @ 178 NONAME - _ZN18CCmMediaServerFullD0Ev @ 179 NONAME - _ZN18CCmMediaServerFullD1Ev @ 180 NONAME - _ZN18CCmMediaServerFullD2Ev @ 181 NONAME - _ZN18CCmSqlPropertyItem12InternalizeLER11RReadStream @ 182 NONAME - _ZN18CCmSqlPropertyItem18CompareItemsByNameERKS_S1_ @ 183 NONAME - _ZN18CCmSqlPropertyItem4NewLEv @ 184 NONAME - _ZN18CCmSqlPropertyItem5NewLCEv @ 185 NONAME - _ZN18CCmSqlPropertyItem5SetIdEx @ 186 NONAME - _ZN18CCmSqlPropertyItem8SetNameLERK6TDesC8 @ 187 NONAME - _ZN18CCmSqlPropertyItem9SetStatusEi @ 188 NONAME - _ZN18CCmSqlPropertyItemC1ERKS_ @ 189 NONAME - _ZN18CCmSqlPropertyItemC2ERKS_ @ 190 NONAME - _ZN18CCmSqlPropertyItemD0Ev @ 191 NONAME - _ZN18CCmSqlPropertyItemD1Ev @ 192 NONAME - _ZN18CCmSqlPropertyItemD2Ev @ 193 NONAME - _ZN20CCmFillRuleContainer12AddFillRuleLEP11CCmFillRule @ 194 NONAME - _ZN20CCmFillRuleContainer12InternalizeLER11RReadStream @ 195 NONAME - _ZN20CCmFillRuleContainer14DeleteFillRuleEi @ 196 NONAME - _ZN20CCmFillRuleContainer4NewLEv @ 197 NONAME - _ZN20CCmFillRuleContainer5NewLCEv @ 198 NONAME - _ZN20CCmFillRuleContainerD0Ev @ 199 NONAME - _ZN20CCmFillRuleContainerD1Ev @ 200 NONAME - _ZN20CCmFillRuleContainerD2Ev @ 201 NONAME - _ZN21CCmSearchResponseHash12SetItemCountEi @ 202 NONAME - _ZN21CCmSearchResponseHash13SetStartIndexEi @ 203 NONAME - _ZN21CCmSearchResponseHash4NewLEiiRK6TDesC8 @ 204 NONAME - _ZN21CCmSearchResponseHash4NewLEv @ 205 NONAME - _ZN21CCmSearchResponseHash8SetHashLERK6TDesC8 @ 206 NONAME - _ZN21CCmStoreRuleContainer12InternalizeLER11RReadStream @ 207 NONAME - _ZN21CCmStoreRuleContainer13AddStoreRuleLEP12CCmStoreRule @ 208 NONAME - _ZN21CCmStoreRuleContainer15DeleteStoreRuleEi @ 209 NONAME - _ZN21CCmStoreRuleContainer4NewLEv @ 210 NONAME - _ZN21CCmStoreRuleContainer5NewLCEv @ 211 NONAME - _ZN21CCmStoreRuleContainer9StoreRuleEi @ 212 NONAME - _ZN21CCmStoreRuleContainerD0Ev @ 213 NONAME - _ZN21CCmStoreRuleContainerD1Ev @ 214 NONAME - _ZN21CCmStoreRuleContainerD2Ev @ 215 NONAME - _ZN23CCmSqlPropertyCollector12InternalizeLER11RReadStream @ 216 NONAME - _ZN23CCmSqlPropertyCollector17PropertyContainerEi @ 217 NONAME - _ZN23CCmSqlPropertyCollector21AddPropertyContainerLEP23CCmSqlPropertyContainer @ 218 NONAME - _ZN23CCmSqlPropertyCollector23DeletePropertyContainerEi @ 219 NONAME - _ZN23CCmSqlPropertyCollector4NewLEv @ 220 NONAME - _ZN23CCmSqlPropertyCollector5NewLCEv @ 221 NONAME - _ZN23CCmSqlPropertyCollectorD0Ev @ 222 NONAME - _ZN23CCmSqlPropertyCollectorD1Ev @ 223 NONAME - _ZN23CCmSqlPropertyCollectorD2Ev @ 224 NONAME - _ZN23CCmSqlPropertyContainer11IsDuplicateER18CCmSqlPropertyItem @ 225 NONAME - _ZN23CCmSqlPropertyContainer12InternalizeLER11RReadStream @ 226 NONAME - _ZN23CCmSqlPropertyContainer12PropertyItemEi @ 227 NONAME - _ZN23CCmSqlPropertyContainer16AddPropertyItemLEP18CCmSqlPropertyItem @ 228 NONAME - _ZN23CCmSqlPropertyContainer16SortPropertyItemEv @ 229 NONAME - _ZN23CCmSqlPropertyContainer18DeletePropertyItemEi @ 230 NONAME - _ZN23CCmSqlPropertyContainer4NewLEv @ 231 NONAME - _ZN23CCmSqlPropertyContainer4TypeEv @ 232 NONAME - _ZN23CCmSqlPropertyContainer5NewLCEv @ 233 NONAME - _ZN23CCmSqlPropertyContainer7SetTypeE16TCmMetadataField @ 234 NONAME - _ZN23CCmSqlPropertyContainerD0Ev @ 235 NONAME - _ZN23CCmSqlPropertyContainerD1Ev @ 236 NONAME - _ZN23CCmSqlPropertyContainerD2Ev @ 237 NONAME - _ZN28CCmSqlResolutionPropertyItem12InternalizeLER11RReadStream @ 238 NONAME - _ZN28CCmSqlResolutionPropertyItem13SetPixelCountEi @ 239 NONAME - _ZN28CCmSqlResolutionPropertyItem18CompareItemsByNameERKS_S1_ @ 240 NONAME - _ZN28CCmSqlResolutionPropertyItem4NewLEv @ 241 NONAME - _ZN28CCmSqlResolutionPropertyItem5NewLCEv @ 242 NONAME - _ZN28CCmSqlResolutionPropertyItem8SetWidthEi @ 243 NONAME - _ZN28CCmSqlResolutionPropertyItem9SetHeightEi @ 244 NONAME - _ZN28CCmSqlResolutionPropertyItemD0Ev @ 245 NONAME - _ZN28CCmSqlResolutionPropertyItemD1Ev @ 246 NONAME - _ZN28CCmSqlResolutionPropertyItemD2Ev @ 247 NONAME - _ZNK11CCmFillRule10TemplateIdEv @ 248 NONAME - _ZNK11CCmFillRule11ParamCountLEi @ 249 NONAME - _ZNK11CCmFillRule12ExcPlayListsEv @ 250 NONAME - _ZNK11CCmFillRule13ListRealCountEv @ 251 NONAME - _ZNK11CCmFillRule16MediaServerCountEv @ 252 NONAME - _ZNK11CCmFillRule19ListRealSizeInBytesEv @ 253 NONAME - _ZNK11CCmFillRule4NameEv @ 254 NONAME - _ZNK11CCmFillRule6AmountEv @ 255 NONAME - _ZNK11CCmFillRule6ListIdEv @ 256 NONAME - _ZNK11CCmFillRule6MethodEv @ 257 NONAME - _ZNK11CCmFillRule6StatusEv @ 258 NONAME - _ZNK11CCmFillRule8PriorityEv @ 259 NONAME - _ZNK11CCmFillRule8SelectedEv @ 260 NONAME - _ZNK11CCmFillRule9ExcAlbumsEv @ 261 NONAME - _ZNK11CCmFillRule9LimitTypeEv @ 262 NONAME - _ZNK11CCmFillRule9MediaTypeEv @ 263 NONAME - _ZNK11CCmFillRule9RuleCountEv @ 264 NONAME - _ZNK12CCmDriveInfo10DriveQuotaEv @ 265 NONAME - _ZNK12CCmDriveInfo11DriveNumberEv @ 266 NONAME - _ZNK12CCmDriveInfo12ExternalizeLER12RWriteStream @ 267 NONAME - _ZNK12CCmDriveInfo14UsedDriveQuotaEv @ 268 NONAME - _ZNK12CCmDriveInfo6StatusEv @ 269 NONAME - _ZNK12CCmDriveInfo7DriveIdEv @ 270 NONAME - _ZNK12CCmDriveInfo9DriveNameEv @ 271 NONAME - _ZNK12CCmDriveInfo9DriveSizeEv @ 272 NONAME - _ZNK12CCmDriveInfo9DriveTypeEv @ 273 NONAME - _ZNK12CCmStoreRule16MediaServerCountEv @ 274 NONAME - _ZNK12CCmStoreRule4NameEv @ 275 NONAME - _ZNK12CCmStoreRule6ListIdEv @ 276 NONAME - _ZNK12CCmStoreRule6StatusEv @ 277 NONAME - _ZNK12CCmStoreRule8DefCountEv @ 278 NONAME - _ZNK12CCmStoreRule8SelectedEv @ 279 NONAME - _ZNK14CCmMediaServer11MediaServerEv @ 280 NONAME - _ZNK14CCmMediaServer14SystemUpdateIDEv @ 281 NONAME - _ZNK14CCmMediaServer4DbIdEv @ 282 NONAME - _ZNK14CCmSqlBaseItem2IdEv @ 283 NONAME - _ZNK14CCmSqlBaseItem4HashEv @ 284 NONAME - _ZNK14CCmSqlBaseItem5CdsIdEv @ 285 NONAME - _ZNK14CCmSqlBaseItem8SearchIdEv @ 286 NONAME - _ZNK15CCmBaseListItem11PrimaryTextEv @ 287 NONAME - _ZNK15CCmBaseListItem12ExternalizeLER12RWriteStream @ 288 NONAME - _ZNK15CCmBaseListItem13SecondaryTextEv @ 289 NONAME - _ZNK15CCmBaseListItem4DateEv @ 290 NONAME - _ZNK15CCmBaseListItem4DbIdEv @ 291 NONAME - _ZNK15CCmBaseListItem4PathEv @ 292 NONAME - _ZNK15CCmBaseListItem4SizeEv @ 293 NONAME - _ZNK15CCmBaseListItem5RefIdEv @ 294 NONAME - _ZNK15CCmBaseListItem6StatusEv @ 295 NONAME - _ZNK15CCmBaseListItem9MediaTypeEv @ 296 NONAME - _ZNK15CCmFillListItem11DriveNumberEv @ 297 NONAME - _ZNK15CCmFillListItem12ExternalizeLER12RWriteStream @ 298 NONAME - _ZNK15CCmFillListItem3UriEv @ 299 NONAME - _ZNK15CCmFillListItem5DevIdEv @ 300 NONAME - _ZNK15CCmFillListItem6ItemIdEv @ 301 NONAME - _ZNK15CCmFillListItem6ListIdEv @ 302 NONAME - _ZNK15CCmFillListItem7DriveIdEv @ 303 NONAME - _ZNK15CCmFillListItem8PriorityEv @ 304 NONAME - _ZNK15CCmFillListItem8SelectedEv @ 305 NONAME - _ZNK15CCmFillListItem9UpnpClassEv @ 306 NONAME - _ZNK15CCmSqlAudioItem11AlbumArtUriEv @ 307 NONAME - _ZNK15CCmSqlAudioItem11TrackNumberEv @ 308 NONAME - _ZNK15CCmSqlAudioItem7AlbumIdEv @ 309 NONAME - _ZNK15CCmSqlAudioItem7BitrateEv @ 310 NONAME - _ZNK15CCmSqlAudioItem7GenreIdEv @ 311 NONAME - _ZNK15CCmSqlAudioItem8ArtistIdEv @ 312 NONAME - _ZNK15CCmSqlAudioItem8DurationEv @ 313 NONAME - _ZNK15CCmSqlImageItem11DescriptionEv @ 314 NONAME - _ZNK15CCmSqlImageItem12ResolutionIdEv @ 315 NONAME - _ZNK15CCmSqlVideoItem7GenreIdEv @ 316 NONAME - _ZNK16CCmStoreListItem12ExternalizeLER12RWriteStream @ 317 NONAME - _ZNK16CCmStoreListItem12StatusValuesEv @ 318 NONAME - _ZNK16CCmStoreListItem6DevIdsEv @ 319 NONAME - _ZNK16CCmStoreListItem6ListIdEv @ 320 NONAME - _ZNK17CCmSqlGenericItem11HarvestDateEv @ 321 NONAME - _ZNK17CCmSqlGenericItem11UpnpclassIdEv @ 322 NONAME - _ZNK17CCmSqlGenericItem13ResourceCountEv @ 323 NONAME - _ZNK17CCmSqlGenericItem13UpnpProfileIdEv @ 324 NONAME - _ZNK17CCmSqlGenericItem3UriEv @ 325 NONAME - _ZNK17CCmSqlGenericItem4DateEv @ 326 NONAME - _ZNK17CCmSqlGenericItem4SizeEv @ 327 NONAME - _ZNK17CCmSqlGenericItem5TitleEv @ 328 NONAME - _ZNK17CCmSqlGenericItem9MediaTypeEv @ 329 NONAME - _ZNK18CCmMediaServerFull11VisibleDateEv @ 330 NONAME - _ZNK18CCmMediaServerFull12ExternalizeLER12RWriteStream @ 331 NONAME - _ZNK18CCmMediaServerFull14CopyCapabilityEv @ 332 NONAME - _ZNK18CCmMediaServerFull15MediaServerNameEv @ 333 NONAME - _ZNK18CCmMediaServerFull8IsActiveEv @ 334 NONAME - _ZNK18CCmSqlPropertyItem12ExternalizeLER12RWriteStream @ 335 NONAME - _ZNK18CCmSqlPropertyItem2IdEv @ 336 NONAME - _ZNK18CCmSqlPropertyItem4NameEv @ 337 NONAME - _ZNK18CCmSqlPropertyItem6StatusEv @ 338 NONAME - _ZNK20CCmFillRuleContainer12ExternalizeLER12RWriteStream @ 339 NONAME - _ZNK20CCmFillRuleContainer13FillRuleCountEv @ 340 NONAME - _ZNK20CCmFillRuleContainer8FillRuleEi @ 341 NONAME - _ZNK21CCmSearchResponseHash10StartIndexEv @ 342 NONAME - _ZNK21CCmSearchResponseHash4HashEv @ 343 NONAME - _ZNK21CCmSearchResponseHash9ItemCountEv @ 344 NONAME - _ZNK21CCmStoreRuleContainer12ExternalizeLER12RWriteStream @ 345 NONAME - _ZNK21CCmStoreRuleContainer14StoreRuleCountEv @ 346 NONAME - _ZNK23CCmSqlPropertyCollector12ExternalizeLER12RWriteStream @ 347 NONAME - _ZNK23CCmSqlPropertyCollector22PropertyContainerCountEv @ 348 NONAME - _ZNK23CCmSqlPropertyContainer12ExternalizeLER12RWriteStream @ 349 NONAME - _ZNK23CCmSqlPropertyContainer17PropertyItemCountEv @ 350 NONAME - _ZNK28CCmSqlResolutionPropertyItem10PixelCountEv @ 351 NONAME - _ZNK28CCmSqlResolutionPropertyItem12ExternalizeLER12RWriteStream @ 352 NONAME - _ZNK28CCmSqlResolutionPropertyItem5WidthEv @ 353 NONAME - _ZNK28CCmSqlResolutionPropertyItem6HeightEv @ 354 NONAME - _ZTI11CCmFillRule @ 355 NONAME ; ## - _ZTI12CCmDriveInfo @ 356 NONAME ; ## - _ZTI12CCmStoreRule @ 357 NONAME ; ## - _ZTI14CCmMediaServer @ 358 NONAME ; ## - _ZTI14CCmSqlBaseItem @ 359 NONAME ; ## - _ZTI15CCmBaseListItem @ 360 NONAME ; ## - _ZTI15CCmFillListItem @ 361 NONAME ; ## - _ZTI15CCmSqlAudioItem @ 362 NONAME ; ## - _ZTI15CCmSqlImageItem @ 363 NONAME ; ## - _ZTI15CCmSqlVideoItem @ 364 NONAME ; ## - _ZTI16CCmStoreListItem @ 365 NONAME ; ## - _ZTI17CCmSqlGenericItem @ 366 NONAME ; ## - _ZTI18CCmMediaServerFull @ 367 NONAME ; ## - _ZTI18CCmSqlPropertyItem @ 368 NONAME ; ## - _ZTI20CCmFillRuleContainer @ 369 NONAME ; ## - _ZTI21CCmSearchResponseHash @ 370 NONAME ; ## - _ZTI21CCmStoreRuleContainer @ 371 NONAME ; ## - _ZTI23CCmSqlPropertyCollector @ 372 NONAME ; ## - _ZTI23CCmSqlPropertyContainer @ 373 NONAME ; ## - _ZTI28CCmSqlResolutionPropertyItem @ 374 NONAME ; ## - _ZTV11CCmFillRule @ 375 NONAME ; ## - _ZTV12CCmDriveInfo @ 376 NONAME ; ## - _ZTV12CCmStoreRule @ 377 NONAME ; ## - _ZTV14CCmMediaServer @ 378 NONAME ; ## - _ZTV14CCmSqlBaseItem @ 379 NONAME ; ## - _ZTV15CCmBaseListItem @ 380 NONAME ; ## - _ZTV15CCmFillListItem @ 381 NONAME ; ## - _ZTV15CCmSqlAudioItem @ 382 NONAME ; ## - _ZTV15CCmSqlImageItem @ 383 NONAME ; ## - _ZTV15CCmSqlVideoItem @ 384 NONAME ; ## - _ZTV16CCmStoreListItem @ 385 NONAME ; ## - _ZTV17CCmSqlGenericItem @ 386 NONAME ; ## - _ZTV18CCmMediaServerFull @ 387 NONAME ; ## - _ZTV18CCmSqlPropertyItem @ 388 NONAME ; ## - _ZTV20CCmFillRuleContainer @ 389 NONAME ; ## - _ZTV21CCmSearchResponseHash @ 390 NONAME ; ## - _ZTV21CCmStoreRuleContainer @ 391 NONAME ; ## - _ZTV23CCmSqlPropertyCollector @ 392 NONAME ; ## - _ZTV23CCmSqlPropertyContainer @ 393 NONAME ; ## - _ZTV28CCmSqlResolutionPropertyItem @ 394 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/group/bld.inf --- a/upnpharvester/common/cmlibrary/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +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 information file for CM Library -* -*/ - - - - - - - -// Supported platforms -PRJ_PLATFORMS -DEFAULT - - -// MMP files -PRJ_MMPFILES -cmlibrary.mmp - -// Files to be exported -PRJ_EXPORTS -../inc/cmfillrulecontainer.h |../../../../inc/cmfillrulecontainer.h -../inc/cmfillrule.h |../../../../inc/cmfillrule.h -../inc/cmstorerulecontainer.h |../../../../inc/cmstorerulecontainer.h -../inc/cmstorerule.h |../../../../inc/cmstorerule.h -../inc/cmmediaserverfull.h |../../../../inc/cmmediaserverfull.h -../inc/cmmediaserver.h |../../../../inc/cmmediaserver.h -../inc/cmcommontypes.h |../../../../inc/cmcommontypes.h -../inc/cmcommon.h |../../../../inc/cmcommon.h -../inc/cmbaselistitem.h |../../../../inc/cmbaselistitem.h -../inc/cmfilllistitem.h |../../../../inc/cmfilllistitem.h -../inc/cmstorelistitem.h |../../../../inc/cmstorelistitem.h -../inc/cmsqlgenericitem.h |../../../../inc/cmsqlgenericitem.h -../inc/cmsqlimageitem.h |../../../../inc/cmsqlimageitem.h -../inc/cmsqlvideoitem.h |../../../../inc/cmsqlvideoitem.h -../inc/cmsqlaudioitem.h |../../../../inc/cmsqlaudioitem.h -../inc/cmsqlpropertyitem.h |../../../../inc/cmsqlpropertyitem.h -../inc/cmsqlpropertycollector.h |../../../../inc/cmsqlpropertycollector.h -../inc/cmsqlresolutionpropertyitem.h |../../../../inc/cmsqlresolutionpropertyitem.h -../inc/cmsqlitemresource.h |../../../../inc/cmsqlitemresource.h -../inc/cmsqlbaseitem.h |../../../../inc/cmsqlbaseitem.h -../inc/cmsqlpropertycontainer.h |../../../../inc/cmsqlpropertycontainer.h -../inc/cmdriveinfo.h |../../../../inc/cmdriveinfo.h -../inc/cmserviceobserver.h |../../../../inc/cmserviceobserver.h -../inc/cmsearchresponsehash.h |../../../../inc/cmsearchresponsehash.h -../inc/cmcommonutils.h |../../../../inc/cmcommonutils.h diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/group/cmlibrary.mmp --- a/upnpharvester/common/cmlibrary/group/cmlibrary.mmp Mon Nov 01 13:44:24 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: Project definition file for project CM Library -* -*/ - - - - - - -#include - -TARGET cmcommon.dll -TARGETTYPE dll -UID 0x1000008d 0x10281FAA - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH /sys/bin - -USERINCLUDE ../inc -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src - -SOURCE cmfillrulecontainer.cpp -SOURCE cmfillrule.cpp -SOURCE cmrule.cpp -SOURCE cmparam.cpp -SOURCE cmmediaserver.cpp -SOURCE cmmediaserverfull.cpp -SOURCE cmstorerule.cpp -SOURCE cmstorerulecontainer.cpp - -SOURCE cmbaselistitem.cpp -SOURCE cmfilllistitem.cpp -SOURCE cmstorelistitem.cpp -SOURCE cmsqlpropertyitem.cpp -SOURCE cmsqlpropertycontainer.cpp -SOURCE cmsqlpropertycollector.cpp -SOURCE cmsqlbaseitem.cpp -SOURCE cmsqlgenericitem.cpp -SOURCE cmsqlaudioitem.cpp -SOURCE cmsqlvideoitem.cpp -SOURCE cmsqlimageitem.cpp -SOURCE cmsqlitemresource.cpp -SOURCE cmsqlresolutionpropertyitem.cpp -SOURCE cmdriveinfo.cpp -SOURCE cmsearchresponsehash.cpp -SOURCE cmcommonutils.cpp - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY bafl.lib -LIBRARY avkon.lib -LIBRARY cone.lib -LIBRARY PlatformEnv.lib -LIBRARY commdb.lib -LIBRARY ecom.lib - -DEBUGLIBRARY flogger.lib - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmbaselistitem.h --- a/upnpharvester/common/cmlibrary/inc/cmbaselistitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill and store file list items -* -*/ - - - - - - -#ifndef __CMBASELISTITEM_H -#define __CMBASELISTITEM_H - -// INCLUDES -#include -#include "cmcommon.h" -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmBaseListItem class - * Capsulating fill and store file list items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmBaseListItem : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmBaseListItem class. - * @return pointer to CCmBaseListItem class - */ - IMPORT_C static CCmBaseListItem* NewL(); - - /** - * Creates new CCmBaseListItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmBaseListItem class - */ - IMPORT_C static CCmBaseListItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmBaseListItem(); - -public: - - // Sets - IMPORT_C void SetPrimaryTextL( const TDesC& aText ); - - IMPORT_C void SetSecondaryTextL( const TDesC& aText ); - - IMPORT_C void SetPathL( const TDesC& aText ); - - IMPORT_C void SetSize( const TUint32 aSize ); - - IMPORT_C void SetDate( const TTime aDate ); - - IMPORT_C void SetStatus( const TCmListItemStatus aStatus ); - - IMPORT_C void SetDbId( const TUint64 aId ); - - IMPORT_C void SetRefId( const TUint64 aId ); - - IMPORT_C void SetMediaType( const TCmMediaType aMediaType ); - - // Gets - IMPORT_C TDesC& PrimaryText() const; - - IMPORT_C TDesC& SecondaryText() const; - - IMPORT_C TDesC& Path() const; - - IMPORT_C TUint32 Size() const; - - IMPORT_C TTime Date() const; - - IMPORT_C TCmListItemStatus Status() const; - - IMPORT_C TUint64 DbId() const; - - IMPORT_C TUint64 RefId() const; - - IMPORT_C TCmMediaType MediaType() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - -protected: - - /** - * Constructor. - */ - CCmBaseListItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -protected: // data - - HBufC* iPrimaryText; // owned - HBufC* iSecondaryText; // owned - HBufC* iPath; // owned - TUint32 iSize; - TTime iDate; - TCmListItemStatus iStatus; - TUint64 iId; - TUint64 iRefId; - TCmMediaType iMediaType; - - }; - -#endif // __CMBASELISTITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmcommon.h --- a/upnpharvester/common/cmlibrary/inc/cmcommon.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* -* Copyright (c) 2005 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: Common Client/Server header for Content Manager -* -*/ - - - - - - -#ifndef CMCOMMON_H -#define CMCOMMON_H - -_LIT(KCmServerExe,"cmserver.exe"); /// TCmProgressInfoPckg; - -#endif -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmcommontypes.h --- a/upnpharvester/common/cmlibrary/inc/cmcommontypes.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Common header for Common component -* -*/ - - - - - - -#ifndef CMCOMMONTYPES_H -#define CMCOMMONTYPES_H - - - -/// Fill rule method types - -enum TFillRuleMethodTypes - { - ECMRandom = 0, - ECMLatest, - ECMOldest - }; - -enum TCmLimitType - { - EUnlimited = 0, - EPieces, - EMbits - }; - -enum TCmMediaType - { - ECmAll = -1, - ECmVideo = 0, - ECmImage, - ECmAudio, - ECmAudioBroadCast, - ECmVideoBroadCast, - ECmOtherVideo, - ECmOtherImage - }; - -enum TCmFillMethod - { - ECmRandom = 0, - ECmLatest, - ECmOldest, - ECmRandomTrack, - ECmRandomAlbum - }; - -enum TCmFillRuleStatus - { - ECmUnSelected = 0, - ECmSelected, - ECmDeleted - }; - -enum TCmMetadataField - { - ECmArtist = 0, - ECmAlbum, - ECmGenre, - ECmDuration, - ECmDate, - ECmTitle, - ECmUpnpClass, - ECmContentURI, - ECmFileSize, - ECmBitrate, - ECmResolution, - ECmFreeText, - ECmProfileId, - ECmNone - }; - -enum TCmOperatorType - { - ECmEquals, - ECmGreater, - ECmSmaller, - ECmConsistOf, - ECmBeginsWith, - ECmEndsWith - }; - -enum TCmRuleType - { - ECmFmFillRule = 1, - ECmFmStoreRule - }; -#endif // CMCOMMONTYPES_H - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmcommonutils.h --- a/upnpharvester/common/cmlibrary/inc/cmcommonutils.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +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: Utilities class description -* -*/ - - - - - - -#ifndef CMCOMMONUTILS_H -#define CMCOMMONUTILS_H - -#include - -class CEikonEnv; -/** - * CmCommonUtils class. - * - * Class provides common methods - * - * @since S60 3.2 - * @lib cmlibrary.lib - */ -class CmCommonUtils : CBase - { - public: - - /** - * Loads resource file - * - * @since S60 3.2 - * @param aFilePath - * @return TInt, resource file offset - */ - IMPORT_C static TInt LoadResourceFileL( const TDesC& aFilePath, - CEikonEnv& eikonEnv ); - - /** - * Sets wlan scan interval - * @since S60 3.2 - * - * @param aInterval, scan interval - */ - IMPORT_C static void SetWlanScanL( const TInt aInterval ); - - }; - -#endif // CMCOMMONUTILS_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmdriveinfo.h --- a/upnpharvester/common/cmlibrary/inc/cmdriveinfo.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,254 +0,0 @@ -/* -* Copyright (c) 2007 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: Definition of drive info class -* -*/ - - - - - - -#ifndef C_CCMDRIVEINFO_H -#define C_CCMDRIVEINFO_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * Drive info class - * - * Provides info about MCs drives - * - * @lib cmcommon.lib - * @since S60 3.1 - */ - class CCmDriveInfo : public CBase - { - - public: - - /** - * Creates new CCmDriveInfo class. - * @param None - * @return pointer to CCmDriveInfo class - */ - IMPORT_C static CCmDriveInfo* NewL(); - - /** - * Creates new CCmDriveInfo class. - * @param None - * @return pointer to CCmDriveInfo class - */ - IMPORT_C static CCmDriveInfo* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmDriveInfo(); - - public: - /** - * Sets drive number - * @since S60 3.1 - * @param aDriveNumber, drive number - */ - IMPORT_C void SetDriveNumber( const TInt aDriveNumber ); - - /** - * Gets drive number - * @since S60 3.1 - * @return TInt, drive number - */ - IMPORT_C TInt DriveNumber() const; - - /** - * Sets drive type - * @since S60 3.1 - * @param aDriveType, drive type - */ - IMPORT_C void SetDriveType( const TUint aDriveType ); - - /** - * Gets drive type - * @since S60 3.1 - * @return TUint, drive type - */ - IMPORT_C TUint DriveType() const; - - /** - * Sets drive name - * @since S60 3.1 - * @param aDriveNumber, drive name - */ - IMPORT_C void SetDriveNameL( const TDesC& aDriveName ); - - /** - * Gets drive name - * @since S60 3.1 - * @return TDesC*, drive name - */ - IMPORT_C TDesC& DriveName() const; - - /** - * Sets drive size - * @since S60 3.1 - * @param aDriveSize, drive size - */ - IMPORT_C void SetDriveSize( const TInt64 aDriveSize ); - - /** - * Gets drive size - * @since S60 3.1 - * @return TInt64, drive size - */ - IMPORT_C TInt64 DriveSize() const; - - /** - * Sets drive quota - * @since S60 3.1 - * @param aDriveQuota, drive quota - */ - IMPORT_C void SetDriveQuota( const TInt64 aDriveQuota ); - - /** - * Gets drive quota - * @since S60 3.1 - * @return drive quota - */ - IMPORT_C TInt64 DriveQuota() const; - - /** - * Sets used drive quota - * @since S60 3.1 - * @param aUsedDriveQuota, used drive quota - */ - IMPORT_C void SetUsedDriveQuota( const TInt64 aUsedDriveQuota ); - - /** - * Gets used drive quota - * @since S60 3.1 - * @return used drive quota - */ - IMPORT_C TInt64 UsedDriveQuota() const; - - /** - * Sets drive id - * @since S60 3.1 - * @param aDriveId, drive id - */ - IMPORT_C void SetDriveId( const TUint aDriveId ); - - /** - * Gets drive Id - * @since S60 3.1 - * @return TInt, drive id - */ - IMPORT_C TUint DriveId() const; - - /** - * Sets drive status - * @since S60 3.1 - * @param aActive, ETrue if drive selected - * @return None - */ - IMPORT_C void SetStatus( const TBool aActive ); - - /** - * Gets drive status - * @since S60 3.1 - * @return ETrue if drive selected - */ - IMPORT_C TBool Status() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - - private: - - /** - * CCmDriveInfo. - */ - CCmDriveInfo(); - - /** - * ConstructL. - */ - void ConstructL(); - - private: - - /** - * drive number - */ - TInt iDriveNumber; - - /** - * drive type - */ - TUint iDriveType; - - /** - * drive name - * owned - */ - HBufC* iDriveName; - - /** - * used drive space - */ - TInt64 iSize; - - /** - * drive capasity - */ - TInt64 iQuota; - - /** - * used drive capasity - */ - TInt64 iUsedQuota; - - /** - * drive id - */ - TUint iUniqueId; - - /** - * drive active - */ - TBool iActive; - - }; - -#endif // C_CCMDRIVEINFO_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmfilllistitem.h --- a/upnpharvester/common/cmlibrary/inc/cmfilllistitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Fill file list items -* -*/ - - - - - - -#ifndef __CMFILLLISTITEM_H -#define __CMFILLLISTITEM_H - -// INCLUDES -#include -#include "cmbaselistitem.h" -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmFillListItem class - * Capsulating Fill file list items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmFillListItem : public CCmBaseListItem - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmFillListItem class. - * @return pointer to CCmFillListItem class - */ - IMPORT_C static CCmFillListItem* NewL(); - - /** - * Creates new CCmFillListItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmFillListItem class - */ - IMPORT_C static CCmFillListItem* NewLC(); - - /** - * Creates new CCmFillListItem class and - * leaves the instance in the cleanup stack. - * @param aPriority, item's priority - * @param aListId, item's list id - * @param aStatus, items's status - * @param aSelected, is item on selected list - * @return pointer to CCmFillListItem class - */ - IMPORT_C static CCmFillListItem* NewLC( const TUint aPriority, - const TUint aListId, const TUint aStatus, - const TCmFillRuleStatus aSelected ); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmFillListItem(); - -public: - - // Sets - IMPORT_C void SetUpnpClassL( const TDesC& aUpnpClass ); - - IMPORT_C void SetUriL( const TDesC8& aUri); - - IMPORT_C void SetItemIdL( const TDesC8& aItemId ); - - IMPORT_C void SetListId( const TUint aId ); - - IMPORT_C void SetDevId( const TUint8 aDevId ); - - IMPORT_C void SetPriority( const TUint8 aPriority ); - - IMPORT_C void SetSelected( TCmFillRuleStatus aSelected ); - - IMPORT_C void SetDriveId( const TUint aDriveId ); - - IMPORT_C void SetDriveNumber( const TInt aDriveNumber ); - - // Gets - IMPORT_C TDesC& UpnpClass() const; - - IMPORT_C TDesC8& Uri() const; - - IMPORT_C TDesC8& ItemId() const; - - IMPORT_C TUint ListId() const; - - IMPORT_C TUint8 DevId() const; - - IMPORT_C TUint8 Priority() const; - - IMPORT_C TCmFillRuleStatus Selected() const; - - IMPORT_C TUint DriveId() const; - - IMPORT_C TInt DriveNumber() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - -public: - - /** - * Constructor. - */ - CCmFillListItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - /** - * Second-phase constructor. - */ - void ConstructL( const TUint aPriority, const TUint aListId, - const TUint aStatus, const TCmFillRuleStatus aSelected ); - - -private: // data - - HBufC* iUpnpClass; // owned - HBufC8* iUri; // owned - HBufC8* iItemId; // owned - TUint iListId; - TUint8 iDevId; - TUint8 iPriority; - TCmListItemStatus iStatus; - TCmFillRuleStatus iSelected; - TUint iDriveId; - TInt iDriveNumber; - - }; - -#endif // __CMFILLLISTITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmfillrule.h --- a/upnpharvester/common/cmlibrary/inc/cmfillrule.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,532 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill rule -* -*/ - - - - - - -#ifndef __CMFILLRULE_H -#define __CMFILLRULE_H - -// INCLUDES -#include -#include // CDesCArray typedef -#include "cmcommontypes.h" -#include "cmcommon.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; -class CCmRule; -class CCmMediaServer; - -/** - * CCmFillRule class - * Capsulating fill rules - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmFillRule : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCMFillRule class. - * @param None - * @return pointer to CFillRule class - */ - IMPORT_C static CCmFillRule* NewL(); - - /** - * Creates new CCMFillRule class and - * leaves the instance in the cleanup stack. - * @param None - * @return pointer to CCMFillRule class - */ - IMPORT_C static CCmFillRule* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmFillRule(); - -public: - - /** - * AddRuleL. - * @since Series 60 3.1 - * @param aDataField ( metadatafield of the rule ) - * @param aOperator ( comparison type ) - * @returns index of the rule - */ - IMPORT_C TInt AddRuleL( TCmMetadataField aDataField, - TCmOperatorType aOperator ); - - /** - * Rule. - * @since Series 60 3.1 - * @param aIndex rule index - * @param aDataField metadatafield of the rule - * @param aOperator rule operator - * @param aParamCount param count on return - * @returns index of the rule - */ - IMPORT_C void RuleL( TInt aIndex, TCmMetadataField* aDataField, - TCmOperatorType* aOperator, TInt* aParamCount ); - - /** - * Deletes rule. - * @since Series 60 3.1 - * @param aDataField metadatafield of the rule - * @returns None - */ - IMPORT_C void DeleteRule( TCmMetadataField aDataField ); - - /** - * Deletes rule. - * @since Series 60 3.1 - * @param aDataField metadatafield of the rule - * @param aOper, comparison method - * @returns None - */ - IMPORT_C void DeleteRule( TCmMetadataField aDataField, - TCmOperatorType aOper ); - - /** - * AddRuleParamL. - * @since Series 60 3.1 - * @param aIndex index of the rule - * @param aParam parameter - * @returns index of the rule - */ - IMPORT_C TInt AddRuleParamL( TInt aIndex, const TDesC8& aParam ); - - /** - * AddRuleParamL ( indexed param ). - * @since Series 60 3.1 - * @param aIndex index of the rule - * @param aParam parameter - * @returns index of the rule - */ - IMPORT_C TInt AddRuleParamL( TInt aIndex, TInt aParam ); - - /** - * RuleParam. - * @since Series 60 3.1 - * @param aRuleIndex index to rule - * @param aParamIndex index to param - * @param aParam, where param is loaded - * @returns None - */ - IMPORT_C void RuleParamL( TInt aRuleIndex, TInt aParamIndex, - TPtrC8* aParam ); - - /** - * RuleParam. - * @since Series 60 3.1 - * @param aRuleIndex index to rule - * @param aParamIndex index to param - * @param aParam, where param is loaded - * @returns None - */ - IMPORT_C void RuleParamL( TInt aRuleIndex, TInt aParamIndex, - TInt& aParam ); - - /** - * AddMediaServerL. - * @since Series 60 3.1 - * @param aUDN - * @returns index of the media server - */ - IMPORT_C TInt AddMediaServerL( const TDesC8& aUDN ); - - /** - * AddMediaServerL. - * @since Series 60 3.1 - * @param aDbId - * @returns index of the media server - */ - IMPORT_C TInt AddMediaServerL( TInt aDbId ); - - /** - * DeleteMediaServer. - * @since Series 60 3.1 - * @param aUDN - * @returns None - */ - IMPORT_C void DeleteMediaServer( const TDesC8& aUDN ); - - /** - * DeleteMediaServer. - * @since Series 60 3.1 - * @param aDbId - * @returns None - */ - IMPORT_C void DeleteMediaServer( TInt aDbId ); - - /** - * AddExcAlbum. - * @since Series 60 3.1 - * @param aAlbum - * @returns None - */ - IMPORT_C void AddExcAlbumL( const TDesC& aAlbum ); - - /** - * AddExcPlayList. - * @since Series 60 3.1 - * @param aPlayList - * @returns None - */ - IMPORT_C void AddExcPlayListL( const TDesC& aPlayList ); - - /** - * RemoveExcAlbumL. - * @since Series 60 3.1 - * @param aAlbum - * @returns None - */ - IMPORT_C void RemoveExcAlbum( const TDesC& aAlbum ); - - /** - * RemoveExcPlayListL. - * @since Series 60 3.1 - * @param aPlayList - * @returns None - */ - IMPORT_C void RemoveExcPlayList( const TDesC& aPlayList ); - - /** - * ExcAlbumsL. - * @since Series 60 3.1 - * @returns array of albums - */ - IMPORT_C CDesCArray& ExcAlbums() const; - - /** - * ExcPlayListsL. - * @since Series 60 3.1 - * @returns array of play lists - */ - IMPORT_C CDesCArray& ExcPlayLists() const; - - /** - * MediaServer. - * @since Series 60 3.1 - * @param aIndex index of the rule - * @returns server uuid - */ - IMPORT_C const TDesC8& MediaServerL( TInt aIndex ); - - /** - * MediaServer. - * @since Series 60 3.1 - * @param aIndex index of the rule - * @param aServer ref. to server - * @returns None - */ - IMPORT_C void MediaServerL( TInt aIndex, TInt& aServer ); - - /** - * SetNameL. - * @since Series 60 3.1 - * @param aName - * @returns KErrNone - */ - IMPORT_C TInt SetNameL( const TDesC8& aName ); - - /** - * Name. - * @since Series 60 3.1 - * @returns name of the fill rule - */ - IMPORT_C TDesC8& Name() const; - - /** - * SetListId. - * @since Series 60 3.1 - * @param aId - * @returns None - */ - IMPORT_C void SetListId( const TUint aId ); - - /** - * ListId. - * @since Series 60 3.1 - * @returns id of the fill list - */ - IMPORT_C TUint ListId() const; - - /** - * SetAmount. - * @since Series 60 3.1 - * @param aAmount - * @returns None - */ - IMPORT_C void SetAmount( TUint32 aAmount ); - - /** - * Amount. - * @since Series 60 3.1 - * @returns amount - */ - IMPORT_C TUint32 Amount() const; - - /** - * SetLimitType. - * @since Series 60 3.1 - * @param aLimitType - * @returns None - */ - IMPORT_C void SetLimitType( TCmLimitType aLimitType ); - - /** - * LimitType. - * @since Series 60 3.1 - * @returns limit type - */ - IMPORT_C TCmLimitType LimitType() const; - - /** - * SetMediaType. - * @since Series 60 3.1 - * @param aMediaType - * @returns None - */ - IMPORT_C void SetMediaType( TCmMediaType aMediaType ); - - /** - * MediaType. - * @since Series 60 3.1 - * @returns media type ( video, image, music or what ) - */ - IMPORT_C TCmMediaType MediaType() const; - - /** - * SetMethod. - * @since Series 60 3.1 - * @param aMethod - * @returns None - */ - IMPORT_C void SetMethod( TCmFillMethod aMethod ); - - /** - * Method. - * @since Series 60 3.1 - * @returns method - */ - IMPORT_C TCmFillMethod Method() const; - - /** - * SetSelected. - * @since Series 60 3.1 - * @param aSelected - * @returns None - */ - IMPORT_C void SetSelected( TCmFillRuleStatus aSelected ); - - /** - * Selected. - * @since Series 60 3.1 - * @returns status - */ - IMPORT_C TCmFillRuleStatus Selected() const; - - /** - * SetStatus. - * @since Series 60 3.1 - * @param aStatus - * @returns None - */ - IMPORT_C void SetStatus( TCmListItemStatus aStatus ); - - /** - * Selected. - * @since Series 60 3.1 - * @returns status - */ - IMPORT_C TCmListItemStatus Status() const; - - /** - * SetPriority. - * @since Series 60 3.1 - * @param aPriority - * @returns None - */ - IMPORT_C void SetPriority( TUint8 aPriority ); - - /** - * Priority. - * @since Series 60 3.1 - * @returns Priority - */ - IMPORT_C TUint8 Priority() const; - - /** - * SetTemplateId. - * @since Series 60 3.1 - * @param aTemplateId - * @returns None - */ - IMPORT_C void SetTemplateId( TUint8 aTemplateId ); - - /** - * TemplateId. - * @since Series 60 3.1 - * @returns TemplateId - */ - IMPORT_C TUint8 TemplateId() const; - - /** - * SetListRealSizeInBytes. - * @since Series 60 3.1 - * @param aRealSize - * @returns None - */ - IMPORT_C void SetListRealSizeInBytes( TUint32 aRealSize ); - - /** - * ListRealSizeInBytes. - * @since Series 60 3.1 - * @returns List's real size - */ - IMPORT_C TUint32 ListRealSizeInBytes() const; - - /** - * SetListRealCount. - * @since Series 60 3.1 - * @param aRealCount - * @returns None - */ - IMPORT_C void SetListRealCount( TUint32 aRealCount ); - - /** - * ListRealCount. - * @since Series 60 3.1 - * @returns List's real count - */ - IMPORT_C TUint32 ListRealCount() const; - - /** - * RuleCount. - * @since Series 60 3.1 - * @returns count - */ - IMPORT_C TInt RuleCount() const; - - /** - * MediaServerCount. - * @since Series 60 3.1 - * @returns count - */ - IMPORT_C TInt MediaServerCount() const; - - /** - * ParamCount. - * @since Series 60 3.1 - * @param aIndex index of the rule - * @returns count - */ - IMPORT_C TInt ParamCountL( TInt aIndex ) const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - void InternalizeL( RReadStream& aStream ); - -private: - - /** - * Constructor. - */ - CCmFillRule(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - /** Rule name */ - HBufC8* iName; // owned - - /** Amount */ - TUint32 iAmount; - - /** List's real size in MBs */ - TUint32 iRealSize; - - /** List's real item count */ - TUint32 iRealCount; - - /** Limit type */ - TCmLimitType iLimitType; - - /** Media type */ - TCmMediaType iMediaType; - - /** Method */ - TCmFillMethod iMethod; - - /** State of the fill rule ( Selected or not ) */ - TCmFillRuleStatus iSelected; - - /** Array rules included to fill rule */ - RPointerArray iRuleArray; // items owned - - /** Array rules included to fill rule */ - RPointerArray iMediaServerArray; // items owned - - /** Priority of the fill rule */ - TUint8 iPriority; - - /** Id of the tempate that was used when creating rule */ - TUint8 iTemplateId; - - /** Id of the fill list */ - TUint iId; - - /** Excluded albums */ - CDesCArray* iExcAlbums; // owned. - - /** Excluded playlists */ - CDesCArray* iExcPlayLists; // owned. - - /** How to handle list items after fill */ - TCmListItemStatus iStatus; - }; - -#endif // __CMFILLRULE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmfillrulecontainer.h --- a/upnpharvester/common/cmlibrary/inc/cmfillrulecontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill rules -* -*/ - - - - - - -#ifndef __CMFILLRULECONTAINER_H -#define __CMFILLRULECONTAINER_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; -class CCmFillRule; - -/** - * CCmFillRuleContainer class - * Capsulating fill rules - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmFillRuleContainer : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmFillRuleContainer class. - * @param None - * @return pointer to CCmFillRuleContainer class - */ - IMPORT_C static CCmFillRuleContainer* NewL(); - - /** - * Creates new CCmFillRuleContainer class and - * leaves the instance in the cleanup stack. - * @param None - * @return pointer to CCmFillRuleContainer class - */ - IMPORT_C static CCmFillRuleContainer* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmFillRuleContainer(); - -public: - - /** - * AddFillRuleL. - * @since Series 60 3.1 - * @param aRule - * @returns index of the rule - */ - IMPORT_C TInt AddFillRuleL( CCmFillRule* aRule ); - - /** - * DeleteFillRule. - * @since Series 60 3.1 - * @param aIndex - * @returns None - */ - IMPORT_C void DeleteFillRule( TInt aIndex ); - - /** - * FillRule. - * @since Series 60 3.1 - * @param aIndex rule index - * @returns fill rule - */ - IMPORT_C CCmFillRule* FillRule( TInt aIndex ) const; - - /** - * FillRuleCount. - * @since Series 60 3.1 - * @param None - * @returns count - */ - IMPORT_C TInt FillRuleCount() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - -private: - - /** - * Constructor. - */ - CCmFillRuleContainer(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - /** Array rules included to fill rule */ - RPointerArray iFillRuleArray; // items owned - - - }; - -#endif // __CMFILLRULECONTAINER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmmediaserver.h --- a/upnpharvester/common/cmlibrary/inc/cmmediaserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Media server -* -*/ - - - - - - -#ifndef __CMMEDIASERVER_H -#define __CMMEDIASERVER_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmMediaServer class - * Capsulating media servers - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmMediaServer : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmMediaServer class. - * @param aUDN - * @return pointer to CCmMediaServer class - */ - IMPORT_C static CCmMediaServer* NewL(); - - /** - * Creates new CCmMediaServer class and - * leaves the instance in the cleanup stack. - * @param aUDN - * @return pointer to CCmMediaServer class - */ - IMPORT_C static CCmMediaServer* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmMediaServer(); - -public: - - /** - * MediaServer - * @since Series 60 3.1 - * @param None - * @return media servers udn - */ - IMPORT_C const TDesC8& MediaServer() const; - - /** - * SetUDNL - * @since Series 60 3.1 - * @param aUDN, UDN of the media server - * @return None - */ - IMPORT_C void SetUDNL( const TDesC8& aUDN ); - - /** - * Media server's db id - * @since Series 60 3.1 - * @param None - * @return Server's db id - */ - IMPORT_C TInt64 DbId() const; - - /** - * SetDbId - * @since Series 60 3.1 - * @param aDbId - * @return None - */ - IMPORT_C void SetDbId( const TInt64 aDbId ); - - /** - * SystemUpdateID - * @since Series 60 3.1 - * @param None - * @return systemupdateID - */ - IMPORT_C TInt SystemUpdateID() const; - - /** - * SetSystemUpdateID - * @since Series 60 3.1 - * @param aSystemUpdateID - * @return None - */ - IMPORT_C void SetSystemUpdateID( const TInt aSystemUpdateID ); - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - void InternalizeL( RReadStream& aStream ); - -protected: - - /** - * Constructor. - */ - CCmMediaServer(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -protected: // data - - /** UDN */ - HBufC8* iUDN; // owned - - /** Database id */ - TInt64 iDbId; - - /** SystemUpdateID */ - TInt iSystemUpdateID; - - }; - -#endif // __CMMEDIASERVER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmmediaserverfull.h --- a/upnpharvester/common/cmlibrary/inc/cmmediaserverfull.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Media server -* -*/ - - - - - - -#ifndef __CMMEDIASERVERFULL_H -#define __CMMEDIASERVERFULL_H - -#include -#include "cmmediaserver.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmMediaServerFull class - * Capsulating media servers - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmMediaServerFull : public CCmMediaServer - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmMediaServerFull class. - * @param None - * @return pointer to CCmMediaServerFull class - */ - IMPORT_C static CCmMediaServerFull* NewL(); - - /** - * Creates new CCmMediaServerFull class and - * leaves the instance in the cleanup stack. - * @param None - * @return pointer to CCmMediaServerFull class - */ - IMPORT_C static CCmMediaServerFull* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmMediaServerFull(); - -public: - - /** - * SetUDNL - * @since Series 60 3.1 - * @return name - */ - IMPORT_C TPtrC8 MediaServerName() const; - - /** - * SetMediaServerNameL - * @since Series 60 3.1 - * @param aName - * @return None - */ - IMPORT_C void SetMediaServerNameL( const TDesC8& aName ); - - /** - * VisibleDate - * @since Series 60 3.1 - * @param None - * @return visible date - */ - IMPORT_C TTime VisibleDate() const; - - /** - * SetVisibleDate - * @since Series 60 3.1 - * @param Time - * @return None - */ - IMPORT_C void SetVisibleDate( TTime aTime ); - - /** - * IsActive - * @since Series 60 3.1 - * @param None - * @return Is active flag - */ - IMPORT_C TUint8 IsActive() const; - - /** - * SetIsActive - * @since Series 60 3.1 - * @param aIsActive - * @return None - */ - IMPORT_C void SetIsActive( TUint8 aIsActive ); - - /** - * Gets copy capability information - * @since Series 60 3.1 - * @return TBool, ETrue if copy capable, EFalse otherwise - */ - IMPORT_C TBool CopyCapability() const; - - /** - * Sets copy capability information - * @since Series 60 3.1 - * @param aCopyCapable - * @return None - */ - IMPORT_C void SetCopyCapability( TBool aCopyCapability ); - - /** - * Sets server store usage status - * @since Series60 3.2 - * @param aUsed, status value - */ - IMPORT_C void SetStoreUsage( - TBool aUsed ); - - /** - * Gets server store usage status - * @since Series60 3.2 - * @return TBool, usage status value - */ - IMPORT_C TBool StoreUsage(); - - /** - * Sets server fill usage status - * @since Series60 3.2 - * @param aUsed, status value - */ - IMPORT_C void SetFillUsage( - TBool aUsed ); - - /** - * Gets server fill usage status - * @since Series60 3.2 - * @return TBool, usage status value - */ - IMPORT_C TBool FillUsage(); - - /** - * Externalizes media server information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes media server information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - - -private: - - -private: // data - - /** Name */ - HBufC8* iName; // owned - - /** Visible date */ - TTime iVisibleDate; - - /** Is active flag */ - TUint8 iIsActive; - - /** Copy capability flag **/ - TBool iCopyCapability; - - /** Fill usage **/ - TBool iFillServer; - - /** Store usage **/ - TBool iStoreServer; - - }; - -#endif // __CMMEDIASERVERFULL_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmparam.h --- a/upnpharvester/common/cmlibrary/inc/cmparam.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Rule parameters -* -*/ - - - - - - -#ifndef __CMPARAM_H -#define __CMPARAM_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmParam class - * Capsulating rule params - * @lib cmcommon.lib - * @since S60 v3.0 - */ -NONSHARABLE_CLASS( CCmParam ): public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmParam class. - * @return pointer to CCmParam class - */ - static CCmParam* NewL(); - - /** - * Creates new CCmParam class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmParam class - */ - static CCmParam* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmParam(); - -public: - - /** - * Param - * @since Series 60 3.1 - * @param aParam, on return parameter value - * @return None - */ - void Param( TPtrC8* aParam ); - - /** - * Param - * @since Series 60 3.1 - * @param aParam, on return parameter value - * @return None - */ - void Param( TInt& aParam ); - - /** - * SetComparisonDataL - * @since Series 60 3.1 - * @param aComparisonData, datafield value - * @return None - */ - void SetComparisonDataL( const TDesC8& aComparisonData ); - - /** - * SetComparisonData (indexed) - * @since Series 60 3.1 - * @param aComparisonData, datafield value - * @return None - */ - void SetComparisonData( TInt aComparisonData ); - - /** - * ComparisonData - * @since Series 60 3.1 - * @param None - * @return returns datafield - */ - const TDesC8& ComparisonData() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - void InternalizeL( RReadStream& aStream ); - -private: - - /** - * Constructor. - */ - CCmParam(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - /** datafield */ - HBufC8* iDataField; // owned - - /** indexed data field */ - TInt iDataFieldIndexed; - - }; - -#endif // __CMPARAM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmrule.h --- a/upnpharvester/common/cmlibrary/inc/cmrule.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Rules -* -*/ - - - - - - -#ifndef __CMRULE_H -#define __CMRULE_H - -// INCLUDES -#include -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; -class CCmParam; - -/** - * CCmRule class - * Capsulating rules - * @lib cmcommon.lib - * @since S60 v3.0 - */ -NONSHARABLE_CLASS( CCmRule ) : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmRule class. - * @param aDataField - * @param aOperator - * @return pointer to CCmRule class - */ - static CCmRule* NewL(); - - /** - * Creates new CCmRule class and - * leaves the instance in the cleanup stack. - * @param aDataField - * @param aOperator - * @return pointer to CCmRule class - */ - static CCmRule* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmRule(); - -public: - - /** - * AddRuleParamL - * @since Series 60 3.1 - * @param aParam - * @return index of the param - */ - TInt AddRuleParamL( const TDesC8& aParam ); - - /** - * AddRuleParamL ( indexed param ) - * @since Series 60 3.1 - * @param aParam - * @return index of the param - */ - TInt AddRuleParamL( TInt aParam ); - - /** - * Rule - * @since Series 60 3.1 - * @param aDataField, metadatafield on return - * @param aOperator, operator on return - * @param aParamCount, param count on return - * @return None - */ - void Rule( TCmMetadataField* aDataField, TCmOperatorType* aOperator, - TInt* aParamCount ); - - /** - * RuleParam - * @since Series 60 3.1 - * @param aParamIndex, parameter index - * @param aParam, param - * @return None - */ - void RuleParamL( TInt aParamIndex, TPtrC8* aParam ); - - /** - * RuleParam - * @since Series 60 3.1 - * @param aParamIndex, parameter index - * @param aParam, param - * @return None - */ - void RuleParamL( TInt aParamIndex, TInt& aParam ); - - /** - * SetMetadataField - * @since Series 60 3.1 - * @param aDataField, sets comparison field - * @return None - */ - void SetMetadataField( TCmMetadataField aDataField ); - - /** - * SetOperator - * @since Series 60 3.1 - * @param aOperator, sets operator of the rule - * @return None - */ - void SetOperator( TCmOperatorType aOperator ); - - /** - * RuleParamsCount - * @since Series 60 3.1 - * @return Count of rule params - */ - TInt RuleParamsCount() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - void InternalizeL( RReadStream& aStream ); - -private: - - /** - * Constructor. - */ - CCmRule(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - /** Metadata field */ - TCmMetadataField iMetadataField; - - /** Operator */ - TCmOperatorType iOperator; - - /** Array rules included to fill rule*/ - RPointerArray iRuleParamsArray; // items owned - - }; - -#endif // __CMRULE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsearchresponsehash.h --- a/upnpharvester/common/cmlibrary/inc/cmsearchresponsehash.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* -* Copyright (c) 2007 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: Capsulating Search response hash -* -*/ - - - - - - -#ifndef __CMSEARCHRESPONSEHASH_H -#define __CMSEARCHRESPONSEHASH_H - -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmSearchResponseHash class - * Capsulating search responce hash - * @lib cmcommon.lib - * @since S60 v3.2 - */ -class CCmSearchResponseHash : public CBase - { -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSearchResponseHash class. - * @param aStartIndex, starting search index - * @param aItemCount, count of search items - * @param aHash, calculated hash code - * @return pointer to CCmSearchResponseHash class - */ - IMPORT_C static CCmSearchResponseHash* NewL( TInt aStartIndex, - TInt aItemCount, - const TDesC8& aHash ); - - /** - * Creates new CCmSearchResponseHash class. - * @param None - * @return pointer to CCmSearchResponseHash class - */ - IMPORT_C static CCmSearchResponseHash* NewL(); - - /** - * Destructor - */ - virtual ~CCmSearchResponseHash(); - -public: - - /** - * Returns hash code - * @param None - * @return Hash code - */ - IMPORT_C const TDesC8& Hash() const; - - /** - * Returns hash code - * @param None - * @return Hash code - */ - IMPORT_C void SetHashL( const TDesC8& aHash ); - - /** - * Returns starting index of search - * @param None - * @return starting index - */ - IMPORT_C TInt StartIndex() const; - - /** - * Sets starting index - * @param aStartIndex, starting searh index - * @return None - */ - IMPORT_C void SetStartIndex( TInt aStartIndex ); - - /** - * Returns item count - * @param None - * @return Item count - */ - IMPORT_C TInt ItemCount() const; - - /** - * Sets item count - * @param aItemCount, count of items - * @return None - */ - IMPORT_C void SetItemCount( TInt aItemCount ); - - /** - * Externalizes search has information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes search hash information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - void InternalizeL( RReadStream& aStream ); - -private: - - /** - * Constructor - */ - CCmSearchResponseHash(); - - /** - * Constructor - */ - void ConstructL( TInt aStartIndex, - TInt aItemCount, - const TDesC8& aHash ); - -private: - - /** Start search index **/ - TInt iStartIndex; - - /** Item count **/ - TInt iItemCount; - - /** Hash code **/ - HBufC8* iHash; // owned - - }; - -#endif // __CMSEARCHRESPONCSEHASH_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmserviceobserver.h --- a/upnpharvester/common/cmlibrary/inc/cmserviceobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2006 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: Callback interface to Fill manager -* -*/ - - - - - - - -#ifndef M_CMSERVICEOBSERVER_H -#define M_CMSERVICEOBSERVER_H - -/** - * Cm service observer - * @lib cmlibrary.lib - * @since S60 v3.1 - */ - -// INCLUDES -#include "cmcommon.h" - - -// CLASS DECLARATION - -class MCmServiceObserver - { - public: - virtual void ServiceExecuted( TCmService aService, - TInt aErrCode ) = 0; - virtual void ExecuteServiceL( TCmService aService ) = 0; - }; - - -#endif // M_CMFMTRANSFEROBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlaudioitem.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlaudioitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#ifndef __CMSQLAUDIOITEM_H -#define __CMSQLAUDIOITEM_H - -// INCLUDES -#include -#include "cmsqlgenericitem.h" - -// FORWARD DECLARATIONS - -/** - * CCmSqlAudioItem class - * Capsulating sql items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmSqlAudioItem : public CCmSqlGenericItem - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlAudioItem class. - * @param None - * @return pointer to CCmSqlAudioItem class - */ - IMPORT_C static CCmSqlAudioItem* NewL(); - - /** - * Creates new CCmSqlAudioItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlAudioItem class - */ - IMPORT_C static CCmSqlAudioItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlAudioItem(); - -public: - - /** - * Sets artist id - * @since Series 60 3.1 - * @param aArtistId, artist Id - * @return None - */ - IMPORT_C void SetArtistId( const TInt64 aArtistId ); - - /** - * Sets album id - * @since Series 60 3.1 - * @param aAlbumId, Album Id - * @return None - */ - IMPORT_C void SetAlbumId( const TInt64 aAlbumId ); - - /** - * Sets genre id - * @since Series 60 3.1 - * @param aGenreId, Genre Id - * @return None - */ - IMPORT_C void SetGenreId( const TInt64 aGenreId ); - - /** - * Sets duration - * @since Series 60 3.1 - * @param aDuration, duration - * @return None - */ - IMPORT_C void SetDuration( const TInt aDuration ); - - /** - * Sets bitrate - * @since Series 60 3.1 - * @param aBitrate, Bitrate - * @return None - */ - IMPORT_C void SetBitrate( const TInt aBitrate ); - - /** - * Sets track number - * @since Series 60 3.1 - * @param aTrackNumber, Track number - * @return None - */ - IMPORT_C void SetTrackNumber( const TInt aTrackNumber ); - - /** - * Sets albumarturi number - * @since Series 60 3.1 - * @param aAlbumArtUri, album art uri - * @return None - */ - IMPORT_C void SetAlbumArtUriL( const TDesC8& aAlbumArtUri ); - - /** - * Gets artist id - * @since Series 60 3.1 - * @param None - * @return artist id - */ - IMPORT_C TInt64 ArtistId() const; - - /** - * Gets album id - * @since Series 60 3.1 - * @param None - * @return album id - */ - IMPORT_C TInt64 AlbumId() const; - - /** - * Gets genre id - * @since Series 60 3.1 - * @param None - * @return genre id - */ - IMPORT_C TInt64 GenreId() const; - - /** - * Gets duration of the item ( in seconds ) - * @since Series 60 3.1 - * @param None - * @return duration - */ - IMPORT_C TInt Duration() const; - - /** - * Gets bitrate of the item ( bits/sec ) - * @since Series 60 3.1 - * @param None - * @return bitrate - */ - IMPORT_C TInt Bitrate() const; - - /** - * Gets track number - * @since Series 60 3.1 - * @param None - * @return track number - */ - IMPORT_C TInt TrackNumber() const; - - /** - * Gets album art uri of the item - * @since Series 60 3.1 - * @return Album art uri - */ - IMPORT_C TDesC8& AlbumArtUri() const; - -protected: - - /** - * Constructor. - */ - CCmSqlAudioItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - // Artist id - TInt64 iArtistId; - - // Album id - TInt64 iAlbumId; - - // Genre id - TInt64 iGenreId; - - // Duration in seconds - TInt iDuration; - - // Bitrate in bits/sec - TInt iBitrate; - - // Track number - TInt iTrackNumber; - - // Album art uri - HBufC8* iAlbumArtUri; // owned - - }; - -#endif // __CMSQLAUDIOITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlbaseitem.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlbaseitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#ifndef __CMSQLBASEITEM_H -#define __CMSQLBASEITEM_H - -// INCLUDES -#include -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class CSHA1; - -/** - * CCmSqlBaseItem class - * Capsulating sql items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmSqlBaseItem : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlBaseItem class. - * @param None - * @return pointer to CCmSqlBaseItem class - */ - IMPORT_C static CCmSqlBaseItem* NewL(); - - /** - * Creates new CCmSqlBaseItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlBaseItem class - */ - IMPORT_C static CCmSqlBaseItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlBaseItem(); - -public: - - /** - * Sets database id - * @since Series 60 3.1 - * @param aId, database id - * @return None - */ - IMPORT_C void SetId( const TInt64 aId ); - - /** - * Sets cds id ( received from media server ) - * @since Series 60 3.1 - * @param aCdsId, cds id - * @return None - */ - IMPORT_C void SetCdsIdL( const TDesC8& aCdsId ); - - /** - * Sets hash value - * @since Series 60 3.1 - * @param aHash, hash value - * @return None - */ - IMPORT_C void SetHashL( const TDesC& aHash ); - - /** - * Sets search id of item - * @since S60 3.1 - * @param aSearchId, search id - * @return None - */ - IMPORT_C void SetSearchId( const TInt64 aSearchId ); - - /** - * Gets database id - * @since Series 60 3.1 - * @param None - * @return Database id - */ - IMPORT_C TInt64 Id() const; - - /** - * Gets cds id ( received from media server ) - * @since Series 60 3.1 - * @param None - * @return CdsId - */ - IMPORT_C TDesC8& CdsId() const; - - /** - * Gets hash value - * @since Series 60 3.1 - * @param None - * @return Hash value - */ - IMPORT_C TDesC& Hash() const; - - /** - * Gets search id of item - * @since Series 60 3.1 - * @param None - * @return Search id - */ - IMPORT_C TInt64 SearchId() const; - - /** - * Compares items - * @since Series 60 3.1 - * @param aFirst, first item - * @param aSecond, second item - * @return Comparison result - */ - IMPORT_C static TInt CompareByHash( const CCmSqlBaseItem& aFirst, - const CCmSqlBaseItem& aSecond ); - - /** - * Compares items - * @since Series 60 3.1 - * @param aFirst, first item - * @param aSecond, second item - * @return Comparison result - */ - IMPORT_C static TInt CompareByCdsId( const CCmSqlBaseItem& aFirst, - const CCmSqlBaseItem& aSecond ); - -protected: - - /** - * Constructor. - */ - CCmSqlBaseItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -protected: // data - - // Database id - TInt64 iId; - - // Item id received from media server - HBufC8* iCdsId; // owned - - // Calculated hash code - HBufC* iHash; // owned - - // Search id - TInt64 iSearchId; - - }; - -#endif // __CMSQLBASEITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlgenericitem.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlgenericitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,270 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#ifndef __CMSQLGENERICITEM_H -#define __CMSQLGENERICITEM_H - -// INCLUDES -#include -#include "cmsqlbaseitem.h" - -// FORWARD DECLARATIONS -class CCmSqlItemResource; - -/** - * CCmSqlGenericItem class - * Capsulating sql items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmSqlGenericItem : public CCmSqlBaseItem - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlGenericItem class. - * @param Nonw - * @return pointer to CCmSqlGenericItem class - */ - IMPORT_C static CCmSqlGenericItem* NewL(); - - /** - * Creates new CCmSqlGenericItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlGenericItem class - */ - IMPORT_C static CCmSqlGenericItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlGenericItem(); - -public: - - /** - * Sets size of the item - * @since Series 60 3.1 - * @param aSize, size in bytes - * @return None - */ - IMPORT_C void SetSize( const TInt aSize ); - - /** - * Sets title of the item - * @since Series 60 3.1 - * @param aTitle, Metadata title - * @return None - */ - IMPORT_C void SetTitleL( const TDesC8& aTitle ); - - /** - * Sets date - * @since Series 60 3.1 - * @param aDate, date - * @return None - */ - IMPORT_C void SetDate( const TTime& aDate ); - - /** - * Sets harvesting time - * @since Series 60 3.1 - * @param aHarvestDate, harvesting time - * @return None - */ - IMPORT_C void SetHarvestDate( const TTime& aHarvestDate ); - - /** - * Sets upnp class id - * @since Series 60 3.1 - * @param aUpnpclassId, id values of the upnp class - * @return None - */ - IMPORT_C void SetUpnpclassId( const TInt64 aUpnpclassId ); - - /** - * Sets upnp profile id - * @since Series 60 3.1 - * @param aUpnpProfileId, id values of the upnp profile - * @return None - */ - IMPORT_C void SetUpnpProfileId( const TInt64 aUpnpProfileId ); - - /** - * Sets Item uri - * @since Series 60 3.1 - * @param aUri, Item uri - * @return None - */ - IMPORT_C void SetUriL( const TDesC8& aUri ); - - /** - * Sets media type of the item - * @since Series 60 3.1 - * @param aMType, media type - * @return None - */ - IMPORT_C void SetMediaType( const TCmMediaType aMType ); - - /** - * Creates new resource for the item - * @since Series 60 3.1 - * @param aUri, uri of the resource - * @param aSize, size of the resource - * @param aDuration, duration of the resource - * @param aBitrate, bitrate of the resource - * @param aResolutionId, id to right resolution - * @return None - */ - IMPORT_C void NewResourceL( const TDesC8& aUri, - const TInt aSize, const TInt aDuration, const TInt aBitrate, - const TInt64 aResolutionId ); - - /** - * Gets size of the item - * @since Series 60 3.1 - * @return Size - */ - IMPORT_C TInt Size() const; - - /** - * Gets Title of the item - * @since Series 60 3.1 - * @return Title - */ - IMPORT_C TDesC8& Title() const; - - /** - * Gets date - * @since Series 60 3.1 - * @return Date - */ - IMPORT_C TTime Date() const; - - /** - * Gets harvest date - * @since Series 60 3.1 - * @return Harvesting date - */ - IMPORT_C TTime HarvestDate() const; - - /** - * Gets upnp class id - * @since Series 60 3.1 - * @return Upnp class id - */ - IMPORT_C TInt64 UpnpclassId() const; - - /** - * Gets upnp profile id - * @since Series 60 3.1 - * @param None - * @return Upnp profile id - */ - IMPORT_C TInt64 UpnpProfileId( ) const; - - /** - * Gets item uri - * @since Series 60 3.1 - * @return Item uri - */ - IMPORT_C TDesC8& Uri() const; - - /** - * Gets media type - * @since Series 60 3.1 - * @return Media type - */ - IMPORT_C TCmMediaType MediaType() const; - - /** - * Gets count of resources - * @since Series 60 3.1 - * @return Resource count - */ - IMPORT_C TInt ResourceCount() const; - - /** - * Gets resource data - * @since Series 60 3.1 - * @param aUri, uri of the resource - * @param aSize, size of the resource - * @param aDuration, duration of the resource - * @param aBitrate, bitrate of the resource - * @param aResolutionId, resolution id of the resource - * @param aIndex, index of the resource - * @return None - */ - IMPORT_C void GetResource( TDesC8& aUri, TInt& aSize, - TInt& aDuration, TInt& aBitrate, TInt64& aResolutionId, TInt aIndex ); - -protected: - - /** - * Constructor. - */ - CCmSqlGenericItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -protected: // data - - // Size of the item in bytes - TInt iSize; - - // Title - HBufC8* iTitle; // owned - - // Date - TTime iDate; - - // Date - TTime iHarvestDate; - - // Upnp class id - TInt64 iUpnpclassId; - - // Upnp profile id - TInt64 iUpnpProfileId; - - // Search id - TInt64 iSearchId; - - // Uri - HBufC8* iUri; // owned - - // Media type - TCmMediaType iMType; - - // Resource array - RPointerArray iResources; // items owned - - }; - -#endif // __CMSQLGENERICITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlimageitem.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlimageitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#ifndef __CMSQLIMAGEITEM_H -#define __CMSQLIMAGEITEM_H - -// INCLUDES -#include -#include "cmsqlgenericitem.h" - -// FORWARD DECLARATIONS - -/** - * CCmSqlImageItem class - * Capsulating sql item - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmSqlImageItem : public CCmSqlGenericItem - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlImageItem class. - * @param None - * @return pointer to CCmSqlImageItem class - */ - IMPORT_C static CCmSqlImageItem* NewL(); - - /** - * Creates new CCmSqlImageItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlImageItem class - */ - IMPORT_C static CCmSqlImageItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlImageItem(); - -public: - - /** - * Sets resolution id - * @since Series 60 3.1 - * @param aResolutionId, resolution id - * @return None - */ - IMPORT_C void SetResolutionId( const TInt64 aResolutionId ); - - /** - * Sets description field - * @since Series 60 3.1 - * @param aDescription, description text - * @return None - */ - IMPORT_C void SetDescriptionL( const TDesC8& aDescription ); - - /** - * Gets resolution id - * @since Series 60 3.1 - * @return Resolution id - */ - IMPORT_C TInt64 ResolutionId() const; - - /** - * Gets description text - * @since Series 60 3.1 - * @return Description text - */ - IMPORT_C TDesC8& Description() const; - -protected: - - /** - * Constructor. - */ - CCmSqlImageItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - // Resolution id - TInt64 iResolutionId; - - // Description data - HBufC8* iDescription; // owned - - }; - -#endif // __CMSQLIMAGEITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlitemresource.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlitemresource.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#ifndef __CMSQLITEMRESOURCE_H -#define __CMSQLITEMRESOURCE_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS - -/** - * CCmSqlItemResource class - * Capsulating sql items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -NONSHARABLE_CLASS( CCmSqlItemResource ) : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlItemResource class. - * @param None - * @return pointer to CCmSqlItemResource class - */ - static CCmSqlItemResource* NewL(); - - /** - * Creates new CCmSqlItemResource class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlItemResource class - */ - static CCmSqlItemResource* NewLC(); - - /** - * Creates new CCmSqlItemResource class and - * leaves the instance in the cleanup stack. - * @param aUri - * @param aSize - * @param aDuration - * @param aBitrate - * @param aResolutionId - * @return pointer to CCmSqlItemResource class - */ - static CCmSqlItemResource* NewLC( const TDesC8& aUri, - const TInt aSize, const TInt aDuration, const TInt aBitrate, - const TInt64 aResolutionId ); - - /** - * Destructor. - */ - virtual ~CCmSqlItemResource(); - -public: - - /** - * Sets uri of the resource - * @since Series 60 3.1 - * @param aUri, resource uri - * @return None - */ - void SetUriL( const TDesC8& aUri ); - - /** - * Sets size of resource - * @since Series 60 3.1 - * @param aSize, size of the resource - * @return None - */ - void SetSize( const TInt aSize ); - - /** - * Sets duration of resource - * @since Series 60 3.1 - * @param aDuration, duration of the resource - * @return None - */ - void SetDuration( const TInt aDuration ); - - /** - * Sets bitrate of resource - * @since Series 60 3.1 - * @param aBitrate, bitrate of the resource - * @return None - */ - void SetBitrate( const TInt aBitrate ); - - /** - * Sets resolution id of resource - * @since Series 60 3.1 - * @param aResolutionId, id of resolution - * @return None - */ - void SetResolutionId( const TInt64 aResolutionId ); - - /** - * Gets Uri - * @since Series 60 3.1 - * @param None - * @return iUri - */ - TDesC8& Uri() const; - - /** - * Gets size - * @since Series 60 3.1 - * @param None - * @return iSize - */ - TInt Size() const; - - /** - * Gets duration - * @since Series 60 3.1 - * @param None - * @return iDuration - */ - TInt Duration() const; - - /** - * Gets bitrate - * @since Series 60 3.1 - * @param None - * @return iBitrate - */ - TInt Bitrate() const; - - /** - * Gets resolution id - * @since Series 60 3.1 - * @param None - * @return iResolutionId - */ - TInt ResolutionId() const; - -protected: - - /** - * Constructor. - */ - CCmSqlItemResource(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - /** - * Second-phase constructor. - */ - void ConstructL( const TDesC8& aUri, - const TInt aSize, const TInt aDuration, const TInt aBitrate, - const TInt64 aResolutionId ); - -protected: // data - - // Name - HBufC8* iUri; // owned - - // Size of the resource - TInt iSize; - - // Duration of the resource - TInt iDuration; - - // Bitrate of the resource - TInt iBitrate; - - // Id to resolution - TInt64 iResolutionId; - - }; - -#endif // __CMSQLITEMRESOURCE_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlpropertycollector.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlpropertycollector.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating property container objects -* -*/ - - - - - - -#ifndef __CMSQLPROPERTYCOLLECTOR_H -#define __CMSQLPROPERTYCOLLECTOR_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; -class CCmSqlPropertyContainer; - -/** - * CCmSqlPropertyCollector class - * Capsulating property item objects - * @lib cmcommon.lib - * @since S60 v3.1 - */ -class CCmSqlPropertyCollector : public CBase - { - - public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlPropertyCollector class. - * @param None - * @return pointer to CCmSqlPropertyCollector class - */ - IMPORT_C static CCmSqlPropertyCollector* NewL(); - - /** - * Creates new CCmSqlPropertyCollector class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlPropertyCollector class - */ - IMPORT_C static CCmSqlPropertyCollector* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlPropertyCollector(); - - public: - - /** - * - * @since Series 60 3.1 - * @param CCmSqlPropertyContainer* - * @return TInt - */ - IMPORT_C TInt AddPropertyContainerL( - CCmSqlPropertyContainer* aContainer ); - - /** - * - * @since Series 60 3.1 - * @param aIndex - */ - IMPORT_C void DeletePropertyContainer( TInt aIndex ); - - /** - * - * @since Series 60 3.1 - * @param aIndex - * @return CCmSqlPropertyContainer* - */ - IMPORT_C CCmSqlPropertyContainer* PropertyContainer( TInt aIndex ); - - /** - * - * @since Series 60 3.1 - * @return TInt - */ - IMPORT_C TInt PropertyContainerCount() const; - - public: - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - - protected: - - /** - * Constructor. - */ - CCmSqlPropertyCollector(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - - private: // data - - /** - * array of metadata containers - */ - RPointerArray iPropertyContainers; - }; - - -#endif // __CMSQLPROPERTYCOLLECTOR_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlpropertycontainer.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlpropertycontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +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: Capsulating property item objects -* -*/ - - - - - - -#ifndef __CMSQLPROPERTYCONTAINER_H -#define __CMSQLPROPERTYCONTAINER_H - -// INCLUDES -#include -#include "cmcommontypes.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; -class CCmSqlPropertyItem; - -/** - * CCmSqlPropertyContainer class - * Capsulating property item objects - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmSqlPropertyContainer : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlPropertyContainer class. - * @param None - * @return pointer to CCmSqlPropertyContainer class - */ - IMPORT_C static CCmSqlPropertyContainer* NewL(); - - /** - * Creates new CCmSqlPropertyContainer class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlPropertyContainer class - */ - IMPORT_C static CCmSqlPropertyContainer* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlPropertyContainer(); - -public: - - /** - * - * @since Series 60 3.1 - * @param CCmSqlPropertyItem* - */ - IMPORT_C void AddPropertyItemL( CCmSqlPropertyItem* aItem ); - - /** - * - * @since Series 60 3.1 - * @param aIndex - */ - IMPORT_C void DeletePropertyItem( TInt aIndex ); - - /** - * - * @since Series 60 3.1 - * @param aIndex - * @return CCmSqlPropertyItem* - */ - IMPORT_C CCmSqlPropertyItem* PropertyItem( TInt aIndex ); - - /** - * - * @since Series 60 3.1 - * @return TInt - */ - IMPORT_C TInt PropertyItemCount() const; - - /** - * - * @since Series 60 3.1 - * @return TInt - */ - IMPORT_C void SetType( TCmMetadataField aType ); - - /** - * - * @since Series 60 3.1 - * @return TCmMetadataField - */ - IMPORT_C TCmMetadataField Type( ); - - /** - * - * @since Series 60 3.1 - * @param aItem, item to be checked - * @return ETrue if duplicate - */ - IMPORT_C TBool IsDuplicate( CCmSqlPropertyItem& aItem ); - -public: - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - - - /** - * Sort item by alphabet - * @since S60 5.1 - * - * @param None - * @return none - */ - IMPORT_C void SortPropertyItem( ); - -protected: - - /** - * Constructor. - */ - CCmSqlPropertyContainer(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - /** - * The function which determines the order of two class T type objects - * - * @since S60 5.1 - * @param aItemOne, first item - * @param aItemTwo, second item - * @return TInt, match value - */ - static TInt CompareItem( const CCmSqlPropertyItem& aItemOne, - const CCmSqlPropertyItem& aItemTwo ); - -private: // data - - RPointerArray iPropertyItems; // items owned - TCmMetadataField iType; - }; - - -#endif // __CMSQLPROPERTYCONTAINER_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlpropertyitem.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlpropertyitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating property items -* -*/ - - - - - - -#ifndef __CMSQLPROPERTYITEM_H -#define __CMSQLPROPERTYITEM_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmSqlPropertyItem class - * Capsulating property items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmSqlPropertyItem : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlPropertyItem class. - * @param None - * @return pointer to CCmSqlPropertyItem class - */ - IMPORT_C static CCmSqlPropertyItem* NewL(); - - /** - * Creates new CCmSqlPropertyItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlPropertyItem class - */ - IMPORT_C static CCmSqlPropertyItem* NewLC(); - - IMPORT_C CCmSqlPropertyItem( const CCmSqlPropertyItem& aItem ); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlPropertyItem(); - -public: - - /** - * Sets database id - * @since Series 60 3.1 - * @param aId, database id - * @return None - */ - IMPORT_C void SetId( const TInt64 aId ); - - /** - * Sets value of the property in textual format - * @since Series 60 3.1 - * @param aName, text field - * @return None - */ - IMPORT_C void SetNameL( const TDesC8& aName ); - - /** - * Sets status of the item - * @since Series 60 3.1 - * @param aStatus, ETrue if item already in db - * @return None - */ - IMPORT_C void SetStatus( const TBool aStatus ); - - /** - * Gets database id - * @since Series 60 3.1 - * @param None - * @return Database id - */ - IMPORT_C TInt64 Id() const; - - /** - * Gets property text value - * @since Series 60 3.1 - * @param None - * @return Property value - */ - IMPORT_C TDesC8& Name() const; - - /** - * Gets status of the item - * @since Series 60 3.1 - * @param None - * @return Status ( ETrue if item already in db ) - */ - IMPORT_C TBool Status() const; - - /** - * Compares items - * @since Series 60 3.1 - * @param aFirst, first item - * @param aSecond, second item - * @return Comparison result - */ - IMPORT_C static TInt CompareItemsByName( const CCmSqlPropertyItem& aFirst, - const CCmSqlPropertyItem& aSecond ); - -public: - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - -protected: - - /** - * Constructor. - */ - CCmSqlPropertyItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - // Database id - TInt64 iId; - - // Property value - HBufC8* iName; // owned - - // Status value - TBool iStatus; - - - }; - - -#endif // __CMSQLPROPERTYITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlresolutionpropertyitem.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlresolutionpropertyitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating resolution property items -* -*/ - - - - - - -#ifndef __CMSQLRESOLUTIONPROPERTYITEM_H -#define __CMSQLRESOLUTIONPROPERTYITEM_H - -// INCLUDES -#include "cmsqlpropertyitem.h" - -// FORWARD DECLARATIONS - -/** - * CCmSqlResolutionPropertyItem class - * Capsulating resolution property items - * @lib cmcommon.lib - * @since S60 v3.1 - */ -class CCmSqlResolutionPropertyItem : public CCmSqlPropertyItem - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlResolutionPropertyItem class. - * @param None - * @return pointer to CCmSqlResolutionPropertyItem class - */ - IMPORT_C static CCmSqlResolutionPropertyItem* NewL(); - - /** - * Creates new CCmSqlResolutionPropertyItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlResolutionPropertyItem class - */ - IMPORT_C static CCmSqlResolutionPropertyItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlResolutionPropertyItem(); - -public: - - /** - * Sets width of the image - * @since Series 60 3.1 - * @param aWidth, width of the image - * @return None - */ - IMPORT_C void SetWidth( const TInt aWidth ); - - /** - * Sets height of the image - * @since Series 60 3.1 - * @param aHeight, height of the image - * @return None - */ - IMPORT_C void SetHeight( const TInt aHeight ); - - /** - * Sets pixel count of the item - * @since Series 60 3.1 - * @param aSize, size of video or image item ( in bytes ) - * @return None - */ - IMPORT_C void SetPixelCount( const TInt aPixelCount ); - - /** - * Gets width of the image - * @since Series 60 3.1 - * @param None - * @return Duration - */ - IMPORT_C TInt Width() const; - - /** - * Gets height of the image - * @since Series 60 3.1 - * @param None - * @return Bitrate - */ - IMPORT_C TInt Height() const; - - /** - * Gets pixel count of the image - * @since Series 60 3.1 - * @param None - * @return Bitrate - */ - IMPORT_C TInt PixelCount() const; - - /** - * Compares items - * @since Series 60 3.1 - * @param aFirst, first item - * @param aSecond, second item - * @return Comparison result - */ - IMPORT_C static TInt CompareItemsByName( - const CCmSqlResolutionPropertyItem& aFirst, - const CCmSqlResolutionPropertyItem& aSecond ); - -public: - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - -protected: - - /** - * Constructor. - */ - CCmSqlResolutionPropertyItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - // Width of image - TInt iWidth; - - // Height of image - TInt iHeight; - - // Pixel count of image - TInt iPixelCount; - - }; - - -#endif // __CMSQLRESOLUTIONPROPERTYITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmsqlvideoitem.h --- a/upnpharvester/common/cmlibrary/inc/cmsqlvideoitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#ifndef __CMSQLVIDEOITEM_H -#define __CMSQLVIDEOITEM_H - -// INCLUDES -#include -#include "cmsqlgenericitem.h" - -// FORWARD DECLARATIONS - -/** - * CCmSqlVideoItem class - * Capsulating sql items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmSqlVideoItem : public CCmSqlGenericItem - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmSqlVideoItem class. - * @param None - * @return pointer to CCmSqlVideoItem class - */ - IMPORT_C static CCmSqlVideoItem* NewL(); - - /** - * Creates new CCmSqlVideoItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmSqlVideoItem class - */ - IMPORT_C static CCmSqlVideoItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmSqlVideoItem(); - -public: - - /** - * Sets genre id - * @since Series 60 3.1 - * @param aGenreId, genre - * @return None - */ - IMPORT_C void SetGenreId( const TInt64 aGenreId ); - - /** - * Gets genre id - * @since Series 60 3.1 - * @param None - * @return genre id - */ - IMPORT_C TInt64 GenreId() const; - -protected: - - /** - * Constructor. - */ - CCmSqlVideoItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - // Genre id - TInt64 iGenreId; - - }; - -#endif // __CMSQLVIDEOITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmstorelistitem.h --- a/upnpharvester/common/cmlibrary/inc/cmstorelistitem.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Store file list items -* -*/ - - - - - - -#ifndef __CMSTORELISTITEM_H -#define __CMSTORELISTITEM_H - -// INCLUDES -#include -#include "cmbaselistitem.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; - -/** - * CCmStoreListItem class - * Capsulating Store file list items - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmStoreListItem : public CCmBaseListItem - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmStoreListItem class. - * @return pointer to CCmStoreListItem class - */ - IMPORT_C static CCmStoreListItem* NewL(); - - /** - * Creates new CCmStoreListItem class and - * leaves the instance in the cleanup stack. - * @return pointer to CCmStoreListItem class - */ - IMPORT_C static CCmStoreListItem* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmStoreListItem(); - -public: - - // Sets - IMPORT_C void SetListId( const TUint aListId ); - - IMPORT_C void SetDevId( const TUint8 aId, TCmListItemStatus aStatus ); - - // Gets - IMPORT_C TUint ListId() const; - - IMPORT_C RArray DevIds() const; - - IMPORT_C RArray StatusValues() const; - - IMPORT_C void UpdateFileStatusL( const TUint8 aId, - TCmListItemStatus aStatus ); - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - -protected: - - /** - * Constructor. - */ - CCmStoreListItem(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - TUint iListId; - RArrayiDeviceIds; - RArrayiStatusValues; - }; - -#endif // __CMSTORELISTITEM_H \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmstorerule.h --- a/upnpharvester/common/cmlibrary/inc/cmstorerule.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,307 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill rule -* -*/ - - - - - - -#ifndef __CMSTORERULE_H -#define __CMSTORERULE_H - -// INCLUDES -#include -#include -#include "cmcommontypes.h" -#include "cmcommon.h" - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; -class CCmMediaServer; - -class TCmStoreRuleMediaServers - { -public: // public member variables - CCmMediaServer* iMediaServer; // Media server object - TCmMediaType iMediaType; // Media type - }; - -/** - * CCmStoreRule class - * Capsulating store rules - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmStoreRule : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmStoreRule class. - * @param None - * @return pointer to CCmStoreRule class - */ - IMPORT_C static CCmStoreRule* NewL(); - - /** - * Creates new CCmStoreRule class and - * leaves the instance in the cleanup stack. - * @param None - * @return pointer to CCmStoreRule class - */ - IMPORT_C static CCmStoreRule* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmStoreRule(); - -public: - - /** - * AddStoreRuleL. - * @since Series 60 3.1 - * @param aMediaType - * @returns index of the rule - */ - IMPORT_C TInt AddStoreRuleL( TCmMediaType aMediaType ); - - /** - * StoreRule. - * @since Series 60 3.1 - * @param aIndex rule index - * @param aMediaType - * @returns index of the rule - */ - IMPORT_C void StoreRule( TInt aIndex, TCmMediaType* aMediaType ); - - /** - * AddMediaServerL. - * @since Series 60 3.1 - * @param aUDN - * @returns index of the media server - */ - IMPORT_C TInt AddMediaServerL( const TDesC8& aUDN ); - - /** - * DeleteMediaServer. - * @since Series 60 3.1 - * @param aUDN - * @returns None - */ - IMPORT_C void DeleteMediaServer( const TDesC8& aUDN ); - - /** - * AddExcAlbumL. - * @since Series 60 3.1 - * @param aAlbum - * @returns None - */ - IMPORT_C void AddExcAlbumL( const TDesC& aAlbum ); - - /** - * AddExcPlayListL. - * @since Series 60 3.1 - * @param aPlayList - * @returns None - */ - IMPORT_C void AddExcPlayListL( const TDesC& aPlayList ); - - /** - * RemoveExcAlbum. - * @since Series 60 3.1 - * @param aAlbum - * @returns None - */ - IMPORT_C void RemoveExcAlbum( const TDesC& aAlbum ); - - /** - * RemoveExcPlayList. - * @since Series 60 3.1 - * @param aPlayList - * @returns None - */ - IMPORT_C void RemoveExcPlayList( const TDesC& aPlayList ); - - /** - * ExcAlbums. - * @since Series 60 3.1 - * @param None - * @returns array of albums - */ - IMPORT_C CDesCArray& ExcAlbums(); - - /** - * ExcPlayLists. - * @since Series 60 3.1 - * @param None - * @returns array of play lists - */ - IMPORT_C CDesCArray& ExcPlayLists(); - - /** - * MediaServer. - * @since Series 60 3.1 - * @param aIndex index of the rule - * @returns server uuid - */ - IMPORT_C const TDesC8& MediaServerL( TInt aIndex ); - - /** - * SetNameL. - * @since Series 60 3.1 - * @param aName - * @returns None - */ - IMPORT_C void SetNameL( const TDesC8& aName ); - - /** - * Name. - * @since Series 60 3.1 - * @param None - * @returns name of the fill rule - */ - IMPORT_C TDesC8& Name() const; - - /** - * SetListId. - * @since Series 60 3.1 - * @param aId - * @returns None - */ - IMPORT_C void SetListId( const TUint aId ); - - /** - * ListId. - * @since Series 60 3.1 - * @param None - * @returns id of the store list - */ - IMPORT_C TUint ListId() const; - - /** - * SetSelected. - * @since Series 60 3.1 - * @param aSelected - * @returns None - */ - IMPORT_C void SetSelected( TCmFillRuleStatus aSelected ); - - /** - * Selected. - * @since Series 60 3.1 - * @param None - * @returns status - */ - IMPORT_C TCmFillRuleStatus Selected() const; - - /** - * SetStatus. - * @since Series 60 3.1 - * @param aStatus - * @returns None - */ - IMPORT_C void SetStatus( TCmListItemStatus aStatus ); - - /** - * Status. - * @since Series 60 3.1 - * @param None - * @returns status - */ - IMPORT_C TCmListItemStatus Status() const; - - /** - * DefCount. - * @since Series 60 3.1 - * @param None - * @returns count - */ - IMPORT_C TInt DefCount() const; - - /** - * MediaServerCount. - * @since Series 60 3.1 - * @param None - * @returns count - */ - IMPORT_C TInt MediaServerCount() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - void InternalizeL( RReadStream& aStream ); - -private: - - /** - * Constructor. - */ - CCmStoreRule(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - /** Rule name */ - HBufC8* iName; // owned - - /** Selected or not */ - TCmFillRuleStatus iSelected; - - /** Rule defs */ - RArray iRuleDefs; - - /** Array rules included to fill rule*/ - RPointerArray iMediaServers; // items owned - - /** Id of the fill list */ - TUint iId; - - /** Excluded albums */ - CDesCArray* iExcAlbums; // owned - - /** Excluded playlists */ - CDesCArray* iExcPlayLists; // owned - - /** How to handle list items after store */ - TCmListItemStatus iStatus; - - }; - -#endif // __CMSTORERULE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/inc/cmstorerulecontainer.h --- a/upnpharvester/common/cmlibrary/inc/cmstorerulecontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating store rules -* -*/ - - - - - - -#ifndef __CMSTORERULECONTAINER_H -#define __CMSTORERULECONTAINER_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RWriteStream; -class RReadStream; -class CCmStoreRule; - -/** - * CCmStoreRuleContainer class - * Capsulating store rules - * @lib cmcommon.lib - * @since S60 v3.0 - */ -class CCmStoreRuleContainer : public CBase - { - -public: - - /* Constructors and destructor. */ - - /** - * Creates new CCmStoreRuleContainer class. - * @param None - * @return pointer to CCmStoreRuleContainer class - */ - IMPORT_C static CCmStoreRuleContainer* NewL(); - - /** - * Creates new CCmStoreRuleContainer class and - * leaves the instance in the cleanup stack. - * @param None - * @return pointer to CCmStoreRuleContainer class - */ - IMPORT_C static CCmStoreRuleContainer* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmStoreRuleContainer(); - -public: - - /** - * AddStoreRuleL. - * @since Series 60 3.1 - * @param aRule - * @returns index of the rule - */ - IMPORT_C TInt AddStoreRuleL( CCmStoreRule* aRule ); - - /** - * DeleteStoreRule. - * @since Series 60 3.1 - * @param Index - * @returns None - */ - IMPORT_C void DeleteStoreRule( TInt aIndex ); - - /** - * StoreRule. - * @since Series 60 3.1 - * @param aIndex rule index - * @returns store rule - */ - IMPORT_C CCmStoreRule* StoreRule( TInt aIndex ); - - /** - * StoreRuleCount. - * @since Series 60 3.1 - * @param None - * @returns count - */ - IMPORT_C TInt StoreRuleCount() const; - - /** - * Externalizes container information to stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RWriteStream - * @return none - */ - IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; - - /** - * Internalizes container information from stream. - * Leaves in case of errors. - * @since Series 60 3.1 - * @param reference to RReadStream - * @return none - */ - IMPORT_C void InternalizeL( RReadStream& aStream ); - -private: - - /** - * Constructor. - */ - CCmStoreRuleContainer(); - - /** - * Second-phase constructor. - */ - void ConstructL(); - - -private: // data - - // Array rules included to fill rule. - RPointerArray iStoreRuleArray; // Items owned - - }; - -#endif // __CMSTORERULECONTAINER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmbaselistitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmbaselistitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill and store file lists -* -*/ - - - - - - -#include -#include -#include "cmbaselistitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmBaseListItem* CCmBaseListItem::NewL() - { - CCmBaseListItem* self = CCmBaseListItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmBaseListItem* CCmBaseListItem::NewLC() - { - CCmBaseListItem* self = new ( ELeave ) CCmBaseListItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmBaseListItem::~CCmBaseListItem() - { - delete iPrimaryText; - delete iSecondaryText; - delete iPath; - } - - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetPrimaryTextL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetPrimaryTextL( const TDesC& aText ) - { - if( &aText ) - { - delete iPrimaryText; - iPrimaryText = NULL; - iPrimaryText = aText.AllocL(); - } - else - { - delete iPrimaryText; - iPrimaryText = NULL; - iPrimaryText = KNullDesC().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetSecondaryTextL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetSecondaryTextL( const TDesC& aText ) - { - if( &aText ) - { - delete iSecondaryText; - iSecondaryText = NULL; - iSecondaryText = aText.AllocL(); - } - else - { - delete iSecondaryText; - iSecondaryText = NULL; - iSecondaryText = KNullDesC().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetPathL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetPathL( const TDesC& aText ) - { - if( &aText ) - { - delete iPath; - iPath = NULL; - iPath = aText.AllocL(); - } - else - { - delete iPath; - iPath = NULL; - iPath = KNullDesC().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetSize -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetSize( const TUint32 aSize ) - { - iSize = aSize; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetDate -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetDate( const TTime aDate ) - { - iDate = aDate; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetStatus -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetStatus( const TCmListItemStatus aStatus ) - { - iStatus = aStatus; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetDbId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetDbId( const TUint64 aId ) - { - iId = aId; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetRefId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetRefId( const TUint64 aId ) - { - iRefId = aId; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SetMediaType -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::SetMediaType( const TCmMediaType aMediaType ) - { - iMediaType = aMediaType; - } - - -// --------------------------------------------------------------------------- -// CCmBaseListItem::PrimaryText -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC& CCmBaseListItem::PrimaryText() const - { - return *iPrimaryText; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::SecondaryText -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC& CCmBaseListItem::SecondaryText() const - { - return *iSecondaryText; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::Path -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC& CCmBaseListItem::Path() const - { - return *iPath; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::Size -// --------------------------------------------------------------------------- -// -EXPORT_C TUint32 CCmBaseListItem::Size() const - { - return iSize; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::Date -// --------------------------------------------------------------------------- -// -EXPORT_C TTime CCmBaseListItem::Date() const - { - return iDate; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::Status -// --------------------------------------------------------------------------- -// -EXPORT_C TCmListItemStatus CCmBaseListItem::Status() const - { - return iStatus; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::DbId -// --------------------------------------------------------------------------- -// -EXPORT_C TUint64 CCmBaseListItem::DbId() const - { - return iId; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::RefId -// --------------------------------------------------------------------------- -// -EXPORT_C TUint64 CCmBaseListItem::RefId() const - { - return iRefId; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::MediaType -// --------------------------------------------------------------------------- -// -EXPORT_C TCmMediaType CCmBaseListItem::MediaType() const - { - return iMediaType; - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iPrimaryText->Length() ); - if ( iPrimaryText ) - { - aStream << *iPrimaryText; - } - else - { - aStream << KNullDesC(); - } - aStream.WriteInt32L( iSecondaryText->Length() ); - if ( iSecondaryText ) - { - aStream << *iSecondaryText; - } - else - { - aStream << KNullDesC(); - } - - aStream.WriteInt32L( iPath->Length() ); - if ( iPath ) - { - aStream << *iPath; - } - else - { - aStream << KNullDesC(); - } - - aStream.WriteInt32L( iSize ); - aStream.WriteUint32L( iDate.Int64() ); - aStream.WriteInt32L( iStatus ); - aStream.WriteUint32L( iId ); - aStream.WriteUint32L( iRefId ); - aStream.WriteInt32L( iMediaType ); - } - -// --------------------------------------------------------------------------- -// CCmBaseListItem::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmBaseListItem::InternalizeL( RReadStream& aStream ) - { - // Content - delete iPrimaryText; - iPrimaryText = NULL; - - TInt bufLength = aStream.ReadInt32L(); - iPrimaryText = HBufC::NewL( aStream, bufLength ); - - delete iSecondaryText; - iSecondaryText = NULL; - - bufLength = aStream.ReadInt32L(); - iSecondaryText = HBufC::NewL( aStream, bufLength ); - - delete iPath; - iPath = NULL; - - bufLength = aStream.ReadInt32L(); - iPath = HBufC::NewL( aStream, bufLength ); - iSize = aStream.ReadInt32L(); - iDate = aStream.ReadUint32L(); - iStatus = (TCmListItemStatus)aStream.ReadInt32L(); - iId = aStream.ReadUint32L(); - iRefId = aStream.ReadUint32L(); - iMediaType = static_cast( aStream.ReadInt32L() ); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmBaseListItem::CCmBaseListItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmBaseListItem::ConstructL() - { - iPrimaryText = KNullDesC().AllocL(); - iSecondaryText = KNullDesC().AllocL(); - iPath = KNullDesC().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmcommonutils.cpp --- a/upnpharvester/common/cmlibrary/src/cmcommonutils.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +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: Implementation of common utility class -* -*/ - - - - - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cmcommonutils.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CmCommonUtils::LoadResourceFileL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CmCommonUtils::LoadResourceFileL( const TDesC& aFilePath, - CEikonEnv& eikonEnv ) - { - LOG(_L("[CmCommonUtils]\t CmCommonUtils::LoadResourceFileL")); - - TInt resFileOffset( 0 ); - - RFs& fileSession = eikonEnv.FsSession(); - - // Load resource file - TFileName rscFileName( aFilePath ); - TInt err = CompleteWithAppPath( rscFileName ); - if ( err != KErrNone ) - { - User::LeaveIfError( err); - } - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - // Check if the resource file exists or not - if ( !BaflUtils::FileExists( fileSession, rscFileName ) ) - { - User::Leave( KErrNotFound ); - } - - TRAP( err, resFileOffset = eikonEnv.AddResourceFileL( rscFileName ) ); - if ( err != KErrNone ) - { - // try memory card drive - rscFileName.Copy( PathInfo::MemoryCardRootPath() ); - rscFileName.Delete( 2, 2 ); // remove '//' - rscFileName.Append( aFilePath ); - resFileOffset = eikonEnv.AddResourceFileL( rscFileName ); - } - - return resFileOffset; - } - -// --------------------------------------------------------------------------- -// CmCommonUtils::SetWlanScanL -// --------------------------------------------------------------------------- -// -EXPORT_C void CmCommonUtils::SetWlanScanL( const TInt aInterval ) - { - LOG(_L("[CmCommonUtils]\t CmCommonUtils::SetWlanScanL")); - -#ifndef __WINS__ - - // open commsdb - CCommsDatabase* commsDb = CCommsDatabase::NewL(); - CleanupStack::PushL( commsDb ); - - // open wlan table - CCommsDbTableView* view = commsDb->OpenViewMatchingUintLC - ( - TPtrC( WLAN_DEVICE_SETTINGS ), - TPtrC( WLAN_DEVICE_SETTINGS_TYPE ), KWlanUserSettings - ); - - User::LeaveIfError( view->GotoFirstRecord() ); - User::LeaveIfError( view->UpdateRecord() ); - - // set scan interval - view->WriteUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), aInterval ); - - view->WriteBoolL( TPtrC( WLAN_ALLOW_RADIO_MEASUREMENTS ), ETrue ); - view->WriteBoolL( TPtrC( WLAN_POWER_MODE ), EFalse ); - User::LeaveIfError( view->PutRecordChanges() ); - - CleanupStack::PopAndDestroy( view ); - CleanupStack::PopAndDestroy( commsDb ); - - CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL(); - CleanupStack::PushL( wlanMgmtClient ); - // notify about changes - wlanMgmtClient->NotifyChangedSettings(); - CleanupStack::PopAndDestroy( wlanMgmtClient ); -#endif - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmdriveinfo.cpp --- a/upnpharvester/common/cmlibrary/src/cmdriveinfo.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,263 +0,0 @@ -/* -* Copyright (c) 2007 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: Implementation of drive info class -* -*/ - - - - - -#include -#include -#include "cmdriveinfo.h" - -// ================= MEMBER FUNCTIONS ======================= -// -------------------------------------------------------------------------- -// CCmDriveInfo::NewL -// -------------------------------------------------------------------------- -EXPORT_C CCmDriveInfo* CCmDriveInfo::NewL() - { - CCmDriveInfo* self = CCmDriveInfo::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::NewLC -// -------------------------------------------------------------------------- -EXPORT_C CCmDriveInfo* CCmDriveInfo::NewLC() - { - CCmDriveInfo* self = new ( ELeave ) CCmDriveInfo(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmDriveInfo::~CCmDriveInfo() - { - delete iDriveName; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetDriveNumber -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetDriveNumber( const TInt aDriveNumber ) - { - iDriveNumber = aDriveNumber; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::DriveNumber -// -------------------------------------------------------------------------- -EXPORT_C TInt CCmDriveInfo::DriveNumber() const - { - return iDriveNumber; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetDriveType -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetDriveType( const TUint aDriveType ) - { - iDriveType = aDriveType; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::DriveType -// -------------------------------------------------------------------------- -EXPORT_C TUint CCmDriveInfo::DriveType() const - { - return iDriveType; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetDriveName -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetDriveNameL( const TDesC& aDriveName ) - { - delete iDriveName; - iDriveName = NULL; - - if( &aDriveName ) - { - iDriveName = aDriveName.AllocL(); - } - else - { - iDriveName = KNullDesC().AllocL(); - } - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::DriveName -// -------------------------------------------------------------------------- -EXPORT_C TDesC& CCmDriveInfo::DriveName() const - { - return *iDriveName; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetDriveSize -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetDriveSize( const TInt64 aDriveSize ) - { - iSize = aDriveSize; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::DriveSize -// -------------------------------------------------------------------------- -EXPORT_C TInt64 CCmDriveInfo::DriveSize() const - { - return iSize; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetDriveSize -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetDriveQuota( const TInt64 aDriveQuota ) - { - iQuota = aDriveQuota; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::DriveSize -// -------------------------------------------------------------------------- -EXPORT_C TInt64 CCmDriveInfo::DriveQuota() const - { - return iQuota; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetUsedDriveSize -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetUsedDriveQuota( const TInt64 aUsedDriveQuota ) - { - iUsedQuota = aUsedDriveQuota; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::UsedDriveQuota -// -------------------------------------------------------------------------- -EXPORT_C TInt64 CCmDriveInfo::UsedDriveQuota() const - { - return iUsedQuota; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetDriveId -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetDriveId( const TUint aDriveId ) - { - iUniqueId = aDriveId; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::DriveId -// -------------------------------------------------------------------------- -EXPORT_C TUint CCmDriveInfo::DriveId() const - { - return iUniqueId; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::SetStatus -// -------------------------------------------------------------------------- -EXPORT_C void CCmDriveInfo::SetStatus( const TBool aActive ) - { - iActive = aActive; - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::Status -// -------------------------------------------------------------------- -EXPORT_C TBool CCmDriveInfo::Status() const - { - return iActive; - } -// --------------------------------------------------------------------------- -// CCmDriveInfo::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDriveInfo::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iDriveNumber ); - aStream.WriteInt32L( iDriveType ); - if ( iDriveName ) - { - aStream.WriteInt32L( iDriveName->Length() ); - aStream << *iDriveName; - } - else - { - aStream.WriteInt32L( 0 ); - aStream << KNullDesC(); - } - - aStream.WriteUint32L( I64HIGH( iSize ) ); - aStream.WriteUint32L( I64LOW( iSize ) ); - - aStream.WriteUint32L( I64HIGH( iQuota ) ); - aStream.WriteUint32L( I64LOW( iQuota ) ); - - aStream.WriteUint32L( I64HIGH( iUsedQuota ) ); - aStream.WriteUint32L( I64LOW( iUsedQuota ) ); - - aStream.WriteInt32L( iUniqueId ); - aStream.WriteInt32L( (TInt)iActive ); - } - -// --------------------------------------------------------------------------- -// CCmDriveInfo::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDriveInfo::InternalizeL( RReadStream& aStream ) - { - iDriveNumber = aStream.ReadInt32L(); - iDriveType = aStream.ReadInt32L(); - - delete iDriveName; - iDriveName = NULL; - - TInt bufLength = aStream.ReadInt32L(); - iDriveName = HBufC::NewL( aStream, bufLength ); - - iSize = MAKE_TINT64( aStream.ReadUint32L(), aStream.ReadUint32L() ); - iQuota = MAKE_TINT64( aStream.ReadUint32L(), aStream.ReadUint32L() ); - iUsedQuota = MAKE_TINT64( aStream.ReadUint32L(), aStream.ReadUint32L() ); - iUniqueId = aStream.ReadInt32L(); - iActive = (TBool)aStream.ReadInt32L(); - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::CCmDriveInfo -// -------------------------------------------------------------------------- -CCmDriveInfo::CCmDriveInfo() - { - } - -// -------------------------------------------------------------------------- -// CCmDriveInfo::ConstructL -// -------------------------------------------------------------------------- -void CCmDriveInfo::ConstructL() - { - iDriveName = KNullDesC().AllocL(); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmfilllistitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmfilllistitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,397 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill file list item -* -*/ - - - - - - -#include -#include -#include "cmfilllistitem.h" -#include "msdebug.h" - - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillListItem* CCmFillListItem::NewL() - { - CCmFillListItem* self = CCmFillListItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillListItem* CCmFillListItem::NewLC() - { - CCmFillListItem* self = new ( ELeave ) CCmFillListItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC with parameters -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillListItem* CCmFillListItem::NewLC( const TUint aPriority, - const TUint aListId, const TUint aStatus, - const TCmFillRuleStatus aSelected ) - { - CCmFillListItem* self = new ( ELeave ) CCmFillListItem(); - CleanupStack::PushL( self ); - self->ConstructL( aPriority, aListId, aStatus, aSelected ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillListItem::~CCmFillListItem() - { - delete iUpnpClass; - delete iUri; - delete iItemId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetUpnpClassL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetUpnpClassL( const TDesC& aUpnpClass ) - { - if( &aUpnpClass ) - { - delete iUpnpClass; - iUpnpClass = NULL; - iUpnpClass = aUpnpClass.AllocL(); - } - else - { - delete iUpnpClass; - iUpnpClass = NULL; - iUpnpClass = KNullDesC().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetUriL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetUriL( const TDesC8& aUri ) - { - if( &aUri ) - { - delete iUri; - iUri = NULL; - iUri = aUri.AllocL(); - } - else - { - delete iUri; - iUri = NULL; - iUri = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetItemIdL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetItemIdL( const TDesC8& aItemId ) - { - if( &aItemId ) - { - delete iItemId; - iItemId = NULL; - iItemId = aItemId.AllocL(); - } - else - { - delete iItemId; - iItemId = NULL; - iItemId = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetListId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetListId( const TUint aId ) - { - iListId = aId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetDevId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetDevId( const TUint8 aDevId ) - { - iDevId = aDevId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetPriority -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetPriority( const TUint8 aPriority ) - { - iPriority = aPriority; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetSelected -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetSelected( - TCmFillRuleStatus aSelected ) - { - iSelected = aSelected; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetDriveId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetDriveId( const TUint aDriveId ) - { - iDriveId = aDriveId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::SetDriveNumber -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::SetDriveNumber( const TInt aDriveNumber ) - { - iDriveNumber = aDriveNumber; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::UpnpClass -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC& CCmFillListItem::UpnpClass() const - { - return *iUpnpClass; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::Uri -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmFillListItem::Uri() const - { - return *iUri; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::ItemId -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmFillListItem::ItemId() const - { - return *iItemId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::ListId -// --------------------------------------------------------------------------- -// -EXPORT_C TUint CCmFillListItem::ListId() const - { - return iListId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::DevId -// --------------------------------------------------------------------------- -// -EXPORT_C TUint8 CCmFillListItem::DevId() const - { - return iDevId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::Priority -// --------------------------------------------------------------------------- -// -EXPORT_C TUint8 CCmFillListItem::Priority() const - { - return iPriority; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::Selected -// --------------------------------------------------------------------------- -// -EXPORT_C TCmFillRuleStatus CCmFillListItem::Selected() const - { - return iSelected; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::DriveId -// --------------------------------------------------------------------------- -// -EXPORT_C TUint CCmFillListItem::DriveId() const - { - return iDriveId; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::DriveNumber -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillListItem::DriveNumber() const - { - return iDriveNumber; - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iUpnpClass->Length() ); - if ( iUpnpClass ) - { - aStream << *iUpnpClass; - } - else - { - aStream << KNullDesC(); - } - aStream.WriteInt32L( iUri->Length() ); - if ( iUri ) - { - aStream << *iUri; - } - else - { - aStream << KNullDesC(); - } - aStream.WriteInt32L( iItemId->Length() ); - if ( iItemId ) - { - aStream << *iItemId; - } - else - { - aStream << KNullDesC(); - } - - aStream.WriteUint16L( iListId ); - aStream.WriteUint8L( iDevId ); - aStream.WriteUint8L( iPriority ); - aStream.WriteInt32L( iSelected ); - aStream.WriteUint32L( iDriveId ); - aStream.WriteInt32L( iDriveNumber ); - CCmBaseListItem::ExternalizeL(aStream); - } - -// --------------------------------------------------------------------------- -// CCmFillListItem::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillListItem::InternalizeL( RReadStream& aStream ) - { - // Content - if ( iUpnpClass ) - { - delete iUpnpClass; - iUpnpClass = NULL; - } - TInt bufLength = aStream.ReadInt32L(); - iUpnpClass = HBufC::NewL( aStream, bufLength ); - if ( iUri ) - { - delete iUri; - iUri = NULL; - } - bufLength = aStream.ReadInt32L(); - iUri = HBufC8::NewL( aStream, bufLength ); - if ( iItemId ) - { - delete iItemId; - iItemId = NULL; - } - bufLength = aStream.ReadInt32L(); - iItemId = HBufC8::NewL( aStream, bufLength ); - iListId = aStream.ReadUint16L(); - iDevId = aStream.ReadUint8L(); - iPriority = aStream.ReadUint8L(); - iSelected = (TCmFillRuleStatus)aStream.ReadInt32L(); - iDriveId = aStream.ReadUint32L(); - iDriveNumber = aStream.ReadInt32L(); - CCmBaseListItem::InternalizeL(aStream); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmFillListItem::CCmFillListItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmFillListItem::ConstructL() - { - // construct base class - CCmBaseListItem::ConstructL(); - - // then construct the rest - iUpnpClass = KNullDesC().AllocL(); - iUri = KNullDesC8().AllocL(); - iItemId = KNullDesC8().AllocL(); - } - -// --------------------------------------------------------------------------- -// ConstructL with parameters -// --------------------------------------------------------------------------- -// -void CCmFillListItem::ConstructL( const TUint aPriority, const TUint aListId, - const TUint aStatus, const TCmFillRuleStatus aSelected ) - { - // construct base class - CCmBaseListItem::ConstructL(); - - SetPriority( aPriority ); - SetListId( aListId ); - SetStatus( (TCmListItemStatus)aStatus ); - SetSelected( aSelected ); - iUpnpClass = KNullDesC().AllocL(); - iUri = KNullDesC8().AllocL(); - iItemId = KNullDesC8().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmfillrule.cpp --- a/upnpharvester/common/cmlibrary/src/cmfillrule.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,782 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill rule -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmmediaserver.h" -#include "cmfillrule.h" -#include "cmrule.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KArrayGranularity = 16; -const TInt KArrayGranularityContainer = 8; - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillRule* CCmFillRule::NewL() - { - CCmFillRule* self = CCmFillRule::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillRule* CCmFillRule::NewLC() - { - CCmFillRule* self = new ( ELeave ) CCmFillRule(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillRule::~CCmFillRule() - { - delete iName; - - iRuleArray.ResetAndDestroy(); - iRuleArray.Close(); - iMediaServerArray.ResetAndDestroy(); - iMediaServerArray.Close(); - - iExcPlayLists->Reset(); - iExcAlbums->Reset(); - - delete iExcPlayLists; - delete iExcAlbums; - } - -// --------------------------------------------------------------------------- -// Add new rule into FillRule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::AddRuleL( TCmMetadataField aDataField, - TCmOperatorType aOperator ) - { - CCmRule* rule = CCmRule::NewLC(); - rule->SetMetadataField(aDataField); - rule->SetOperator(aOperator); - iRuleArray.AppendL( rule ); // transfer ownership - CleanupStack::Pop( rule ); - TInt index = iRuleArray.Count() - 1; - return index; - } - -// --------------------------------------------------------------------------- -// Get rule -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::RuleL( TInt aIndex, TCmMetadataField* aDataField, - TCmOperatorType* aOperator, TInt* aParamCount ) - { - // check parameter - if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) - { - User::Leave( KErrArgument ); - } - - iRuleArray[aIndex]->Rule( aDataField, aOperator, aParamCount ); - } - -// --------------------------------------------------------------------------- -// Delete rule -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::DeleteRule( TCmMetadataField aDataField, - TCmOperatorType aOper ) - { - TCmMetadataField dataField; TCmOperatorType oper; - TInt count; - for( TInt i = 0; i < iRuleArray.Count(); i++ ) - { - iRuleArray[i]->Rule( &dataField, &oper, &count ); - if( dataField == aDataField && oper == aOper ) - { - delete iRuleArray[i]; - iRuleArray.Remove(i); - iRuleArray.Compress(); - } - } - } - -// --------------------------------------------------------------------------- -// Delete rule -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::DeleteRule( TCmMetadataField aDataField ) - { - TCmMetadataField dataField; TCmOperatorType oper; - TInt count; - for( TInt i = 0; i < iRuleArray.Count(); i++ ) - { - iRuleArray[i]->Rule( &dataField, &oper, &count ); - if( dataField == aDataField ) - { - delete iRuleArray[i]; - iRuleArray.Remove(i); - iRuleArray.Compress(); - } - } - } -// --------------------------------------------------------------------------- -// Add new rule param into FillRule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::AddRuleParamL( TInt aIndex, const TDesC8& aParam ) - { - // check parameter - if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) - { - User::Leave( KErrArgument ); - } - - return iRuleArray[aIndex]->AddRuleParamL( aParam ); - } - -// --------------------------------------------------------------------------- -// Add new rule param into FillRule ( Indexed param ) -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::AddRuleParamL( TInt aIndex, TInt aParam ) - { - // check parameter - if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) - { - User::Leave( KErrArgument ); - } - - return iRuleArray[aIndex]->AddRuleParamL( aParam ); - } - -// --------------------------------------------------------------------------- -// Get rule param -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::RuleParamL( TInt aRuleIndex, TInt aParamIndex, - TPtrC8* aParam ) - { - // check parameter - if ( aRuleIndex < 0 || aRuleIndex >= iRuleArray.Count() ) - { - User::Leave( KErrArgument ); - } - - iRuleArray[aRuleIndex]->RuleParamL( aParamIndex, aParam ); - } - -// --------------------------------------------------------------------------- -// Get rule param -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::RuleParamL( TInt aRuleIndex, TInt aParamIndex, - TInt& aParam ) - { - // check parameter - if ( aRuleIndex < 0 || aRuleIndex >= iRuleArray.Count() ) - { - User::Leave( KErrArgument ); - } - - iRuleArray[aRuleIndex]->RuleParamL( aParamIndex, aParam ); - } - -// --------------------------------------------------------------------------- -// Add new media server into FillRule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::AddMediaServerL( const TDesC8& aUDN ) - { - CCmMediaServer* server = CCmMediaServer::NewLC(); - server->SetUDNL( aUDN ); - iMediaServerArray.AppendL( server ); - TInt index = iMediaServerArray.Count() - 1; - CleanupStack::Pop(server); - return index; - } - -// --------------------------------------------------------------------------- -// Add new media server into FillRule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::AddMediaServerL( TInt aDbId ) - { - CCmMediaServer* server = CCmMediaServer::NewLC(); - server->SetDbId( aDbId ); - iMediaServerArray.AppendL( server ); - TInt index = iMediaServerArray.Count() - 1; - CleanupStack::Pop(server); - return index; - } - -// --------------------------------------------------------------------------- -// Delete media server from the fill rule -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::DeleteMediaServer( const TDesC8& aUDN ) - { - TBool deleted( EFalse ); - for( TInt i = 0; i < iMediaServerArray.Count() && !deleted; i++ ) - { - if( KErrNone == iMediaServerArray[i]->MediaServer().Compare(aUDN) ) - { - delete iMediaServerArray[i]; - iMediaServerArray.Remove(i); - iMediaServerArray.Compress(); - deleted = ETrue; - } - } - } - -// --------------------------------------------------------------------------- -// Delete media server from the fill rule -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::DeleteMediaServer( TInt aDbId ) - { - TBool deleted( EFalse ); - for( TInt i = 0; i < iMediaServerArray.Count() && !deleted; i++ ) - { - if( iMediaServerArray[i]->DbId() == aDbId ) - { - delete iMediaServerArray[i]; - iMediaServerArray.Remove(i); - iMediaServerArray.Compress(); - deleted = ETrue; - } - } - } - -// --------------------------------------------------------------------------- -// Adds one album into excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::AddExcAlbumL( const TDesC& aAlbum ) - { - iExcAlbums->AppendL( aAlbum ); - } - -// --------------------------------------------------------------------------- -// Adds one playlist into excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::AddExcPlayListL( const TDesC& aPlayList ) - { - iExcPlayLists->AppendL( aPlayList ); - } - -// --------------------------------------------------------------------------- -// Removes defined album from the excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::RemoveExcAlbum( const TDesC& aAlbum ) - { - TInt pos( KErrNone ); - TInt err( iExcAlbums->Find( aAlbum, pos ) ); - if( err == KErrNone ) - { - iExcAlbums->Delete( pos ); - } - } - -// --------------------------------------------------------------------------- -// Removes defined playlist from the excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::RemoveExcPlayList( const TDesC& aPlayList ) - { - TInt pos( KErrNone ); - TInt err( iExcPlayLists->Find( aPlayList, pos ) ); - if( err == KErrNone ) - { - iExcPlayLists->Delete( pos ); - } - } - -// --------------------------------------------------------------------------- -// Returns excluded albums -// --------------------------------------------------------------------------- -// -EXPORT_C CDesCArray& CCmFillRule::ExcAlbums() const - { - return *iExcAlbums; - } - -// --------------------------------------------------------------------------- -// Returns excluded playlists -// --------------------------------------------------------------------------- -// -EXPORT_C CDesCArray& CCmFillRule::ExcPlayLists() const - { - return *iExcPlayLists; - } - -// --------------------------------------------------------------------------- -// Get media server -// --------------------------------------------------------------------------- -// -EXPORT_C const TDesC8& CCmFillRule::MediaServerL( TInt aIndex ) - { - // check parameter - if ( aIndex < 0 || aIndex >= iMediaServerArray.Count() ) - { - User::Leave( KErrArgument ); - } - - return iMediaServerArray[aIndex]->MediaServer(); - } - -// --------------------------------------------------------------------------- -// Get media server -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::MediaServerL( TInt aIndex, TInt& aServer ) - { - // check parameter - if ( aIndex < 0 || aIndex >= iMediaServerArray.Count() ) - { - User::Leave( KErrArgument ); - } - - aServer = iMediaServerArray[aIndex]->DbId(); - } - -// --------------------------------------------------------------------------- -// Returns count of rules -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::RuleCount() const - { - return iRuleArray.Count(); - } - -// --------------------------------------------------------------------------- -// Returns count of media servers -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::MediaServerCount() const - { - return iMediaServerArray.Count(); - } - -// --------------------------------------------------------------------------- -// returns count of params ( in specific rule ) -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::ParamCountL( TInt aIndex ) const - { - // check parameter - if ( aIndex < 0 || aIndex >= iRuleArray.Count() ) - { - User::Leave( KErrArgument ); - } - - return iRuleArray[aIndex]->RuleParamsCount(); - } - -// --------------------------------------------------------------------------- -// Sets FillRule name -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRule::SetNameL( const TDesC8& aName ) - { - delete iName; - iName = NULL; - iName = aName.AllocL(); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// Get Name -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmFillRule::Name() const - { - return *iName; - } - -// --------------------------------------------------------------------------- -// Sets list id, when storing data into db this values isn't used as a -// db list id -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetListId( const TUint aId ) - { - iId = aId; - } - -// --------------------------------------------------------------------------- -// Get list id -// --------------------------------------------------------------------------- -// -EXPORT_C TUint CCmFillRule::ListId() const - { - return iId; - } - -// --------------------------------------------------------------------------- -// Sets amount -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetAmount( TUint32 aAmount ) - { - iAmount = aAmount; - } - -// --------------------------------------------------------------------------- -// Returns amount -// --------------------------------------------------------------------------- -// -EXPORT_C TUint32 CCmFillRule::Amount() const - { - return iAmount; - } - -// --------------------------------------------------------------------------- -// Sets limit type ( MB or pcs. ) -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetLimitType( TCmLimitType aLimitType ) - { - iLimitType = aLimitType; - } - -// --------------------------------------------------------------------------- -// Returns limit type -// --------------------------------------------------------------------------- -// -EXPORT_C TCmLimitType CCmFillRule::LimitType() const - { - return iLimitType; - } - -// --------------------------------------------------------------------------- -// Sets media type -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetMediaType( TCmMediaType aMediaType ) - { - iMediaType = aMediaType; - } - -// --------------------------------------------------------------------------- -// Returns media type -// --------------------------------------------------------------------------- -// -EXPORT_C TCmMediaType CCmFillRule::MediaType() const - { - return iMediaType; - } - -// --------------------------------------------------------------------------- -// Sets method ( random, newest, oldest etc. ) -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetMethod( TCmFillMethod aMethod ) - { - iMethod = aMethod; - } - -// --------------------------------------------------------------------------- -// Returns method -// --------------------------------------------------------------------------- -// -EXPORT_C TCmFillMethod CCmFillRule::Method() const - { - return iMethod; - } - -// --------------------------------------------------------------------------- -// Sets selected state -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetSelected( TCmFillRuleStatus aSelected ) - { - iSelected = aSelected; - } - -// --------------------------------------------------------------------------- -// Returns method -// --------------------------------------------------------------------------- -// -EXPORT_C TCmFillRuleStatus CCmFillRule::Selected() const - { - return iSelected; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetStatus( TCmListItemStatus aStatus ) - { - iStatus = aStatus; - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -EXPORT_C TCmListItemStatus CCmFillRule::Status() const - { - return iStatus; - } - -// --------------------------------------------------------------------------- -// Set priority -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetPriority( TUint8 aPriority ) - { - iPriority = aPriority; - } - -// --------------------------------------------------------------------------- -// Returns priority -// --------------------------------------------------------------------------- -// -EXPORT_C TUint8 CCmFillRule::Priority() const - { - return iPriority; - } - -// --------------------------------------------------------------------------- -// Set template id -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetTemplateId( TUint8 aTemplateId ) - { - iTemplateId = aTemplateId; - } - -// --------------------------------------------------------------------------- -// Returns template id -// --------------------------------------------------------------------------- -// -EXPORT_C TUint8 CCmFillRule::TemplateId() const - { - return iTemplateId; - } - -// --------------------------------------------------------------------------- -// Set list's real size in Bytes -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetListRealSizeInBytes( TUint32 aRealSize ) - { - iRealSize = aRealSize; - } - -// --------------------------------------------------------------------------- -// Returns list's real size in Bytes -// --------------------------------------------------------------------------- -// -EXPORT_C TUint32 CCmFillRule::ListRealSizeInBytes() const - { - return iRealSize; - } - -// --------------------------------------------------------------------------- -// Set list's real size in pieces -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRule::SetListRealCount( TUint32 aRealCount ) - { - iRealCount = aRealCount; - } - -// --------------------------------------------------------------------------- -// Returns ist's real size in pieces -// --------------------------------------------------------------------------- -// -EXPORT_C TUint32 CCmFillRule::ListRealCount() const - { - return iRealCount; - } - -// --------------------------------------------------------------------------- -// CCmFillRule::ExternalizeL -// --------------------------------------------------------------------------- -// -void CCmFillRule::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iName->Length() ); - if ( iName ) - { - aStream << *iName; - } - else - { - aStream << KNullDesC8(); - } - aStream.WriteInt32L( iAmount ); - aStream.WriteInt32L( iRealSize ); - aStream.WriteInt32L( iRealCount ); - aStream.WriteInt16L( (TInt)iLimitType ); - aStream.WriteInt16L( (TInt)iMethod ); - aStream.WriteInt16L( (TInt)iMediaType ); - aStream.WriteInt16L((TInt)iSelected ); - aStream.WriteInt16L((TInt)iStatus ); - aStream.WriteInt8L(iPriority); - aStream.WriteInt8L( iTemplateId ); - aStream.WriteInt32L( iId ); - - aStream.WriteInt16L( iRuleArray.Count() ); - for ( TInt index(0); index < iRuleArray.Count(); index++ ) - { - iRuleArray[index]->ExternalizeL( aStream ); - } - - aStream.WriteInt16L( iMediaServerArray.Count() ); - for ( TInt index(0); index < iMediaServerArray.Count(); index++ ) - { - iMediaServerArray[index]->ExternalizeL( aStream ); - } - - aStream.WriteInt16L( iExcAlbums->Count() ); - for ( TInt index(0); index < iExcAlbums->Count(); index++ ) - { - aStream.WriteInt32L( iExcAlbums[index].Length() ); - aStream << iExcAlbums->MdcaPoint(index); - } - - aStream.WriteInt16L( iExcPlayLists->Count() ); - for ( TInt index(0); index < iExcPlayLists->Count(); index++ ) - { - aStream.WriteInt32L( iExcPlayLists[index].Length() ); - aStream << iExcPlayLists->MdcaPoint(index); - } - } - -// --------------------------------------------------------------------------- -// CCmFillRule::InternalizeL -// --------------------------------------------------------------------------- -// -void CCmFillRule::InternalizeL( RReadStream& aStream ) - { - // Content - delete iName; - iName = NULL; - - TInt bufLength = aStream.ReadInt32L(); - iName = HBufC8::NewL( aStream, bufLength ); - - // cleanup - iRuleArray.ResetAndDestroy(); - - iAmount = aStream.ReadInt32L(); - iRealSize = aStream.ReadInt32L(); - iRealCount = aStream.ReadInt32L(); - iLimitType = (TCmLimitType)aStream.ReadInt16L(); - iMethod = (TCmFillMethod)aStream.ReadInt16L(); - iMediaType = (TCmMediaType)aStream.ReadInt16L(); - iSelected = (TCmFillRuleStatus)aStream.ReadInt16L(); - iStatus = (TCmListItemStatus)aStream.ReadInt16L(); - iPriority = (TUint8)aStream.ReadInt8L(); - iTemplateId = (TUint8)aStream.ReadInt8L(); - iId = (TUint)aStream.ReadInt32L(); - - // rule count - TInt ruleCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for (TInt index = 0; index < ruleCount; index++ ) - { - CCmRule* newRule = CCmRule::NewLC(); - newRule->InternalizeL( aStream ); - iRuleArray.AppendL( newRule ); - CleanupStack::Pop( newRule ); - newRule = NULL; - } - - // cleanup - iMediaServerArray.ResetAndDestroy(); - - // media Server count - TInt mediaServerCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for (TInt index = 0; index < mediaServerCount; index++ ) - { - CCmMediaServer* newServer = CCmMediaServer::NewLC(); - newServer->InternalizeL( aStream ); - iMediaServerArray.AppendL( newServer ); - CleanupStack::Pop( newServer ); - newServer = NULL; - } - - TInt excAlbumsCount( aStream.ReadInt16L() ); - bufLength = KErrNone; - HBufC* temp = NULL; - for ( TInt index(0); index < excAlbumsCount ; index++ ) - { - bufLength = aStream.ReadInt32L(); - temp = HBufC::NewLC( aStream, bufLength ); - iExcAlbums->AppendL( *temp ); - CleanupStack::PopAndDestroy( temp ); - temp = NULL; - } - - TInt excPlayListCount( aStream.ReadInt16L() ); - bufLength = KErrNone; - for ( TInt index(0); index < excPlayListCount ; index++ ) - { - bufLength = aStream.ReadInt32L(); - temp = HBufC::NewLC( aStream, bufLength ); - iExcPlayLists->AppendL( *temp ); - CleanupStack::PopAndDestroy( temp ); - temp = NULL; - } - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmFillRule::CCmFillRule() : - iRuleArray( KArrayGranularity ), - iMediaServerArray( KArrayGranularity ) - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmFillRule::ConstructL() - { - iExcAlbums = new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer ); - iExcPlayLists = - new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer ); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmfillrulecontainer.cpp --- a/upnpharvester/common/cmlibrary/src/cmfillrulecontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill rules -* -*/ - - - - - - -#include -#include -#include "cmfillrulecontainer.h" -#include "cmfillrule.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KFillRuleArrayGranularity = 16; - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillRuleContainer* CCmFillRuleContainer::NewL() - { - TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewL() start"))); - CCmFillRuleContainer* self = CCmFillRuleContainer::NewLC(); - CleanupStack::Pop( self ); - TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewL() end"))); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillRuleContainer* CCmFillRuleContainer::NewLC() - { - TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewLC() start"))); - CCmFillRuleContainer* self = new ( ELeave ) CCmFillRuleContainer(); - CleanupStack::PushL( self ); - self->ConstructL(); - TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::NewLC() end"))); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillRuleContainer::~CCmFillRuleContainer() - { - TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::~CCmFillRuleContainer()\ - start"))); - iFillRuleArray.ResetAndDestroy(); - iFillRuleArray.Close(); - TRACE(Print(_L("[COMMON]\t CCmFillRuleContainer::~CCmFillRuleContainer()\ - end"))); - } - -// --------------------------------------------------------------------------- -// Add new rule into FillRule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRuleContainer::AddFillRuleL( CCmFillRule* aRule ) - { - iFillRuleArray.AppendL( aRule ); - TInt index = iFillRuleArray.Count() - 1; - return index; - } - -// --------------------------------------------------------------------------- -// Deletes fill rule with the given index -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRuleContainer::DeleteFillRule( TInt aIndex ) - { - if( iFillRuleArray.Count() > aIndex ) - { - delete iFillRuleArray[aIndex]; - iFillRuleArray.Remove(aIndex); - iFillRuleArray.Compress(); - } - } - -// --------------------------------------------------------------------------- -// Get rule -// --------------------------------------------------------------------------- -// -EXPORT_C CCmFillRule* CCmFillRuleContainer::FillRule( TInt aIndex ) const - { - return iFillRuleArray[aIndex]; - } - -// --------------------------------------------------------------------------- -// Returns count of rules -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmFillRuleContainer::FillRuleCount() const - { - return iFillRuleArray.Count(); - } - -// --------------------------------------------------------------------------- -// CCmFillRuleContainer::ExternalizeL -// Writes the content to stream. -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRuleContainer::ExternalizeL( - RWriteStream& aStream ) const - { - // Let's write the count of fill rules to stream first - aStream.WriteInt16L( iFillRuleArray.Count() ); - for ( TInt index = 0; index < iFillRuleArray.Count(); index++ ) - { - CCmFillRule* rule = iFillRuleArray[index]; - // Then the object itself - rule->ExternalizeL( aStream ); - } - } - -// --------------------------------------------------------------------------- -// CCmFillRuleContainer::InternalizeL -// Fills container information from stream -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmFillRuleContainer::InternalizeL( RReadStream& aStream ) - { - // Then internalize the objects - if ( iFillRuleArray.Count() > KErrNone ) - { - iFillRuleArray.ResetAndDestroy(); - } - // First the count of fill rules - TInt ruleCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for ( TInt index = 0; index < ruleCount; index++ ) - { - CCmFillRule* newItem = CCmFillRule::NewL(); - CleanupStack::PushL( newItem ); - newItem->InternalizeL( aStream ); - AddFillRuleL( newItem ); - CleanupStack::Pop( newItem ); - newItem = NULL; - } - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmFillRuleContainer::CCmFillRuleContainer() : - iFillRuleArray( KFillRuleArrayGranularity ) - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmFillRuleContainer::ConstructL() - { - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmmediaserver.cpp --- a/upnpharvester/common/cmlibrary/src/cmmediaserver.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Media servers -* -*/ - - - - - - -// INCLUDES -#include -#include - -#include "cmmediaserver.h" -#include "msdebug.h" - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMediaServer* CCmMediaServer::NewL() - { - CCmMediaServer* self = CCmMediaServer::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMediaServer* CCmMediaServer::NewLC() - { - CCmMediaServer* self = new ( ELeave ) CCmMediaServer(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmMediaServer::~CCmMediaServer() - { - delete iUDN; - } - -// --------------------------------------------------------------------------- -// Retrieve mediaserver info -// --------------------------------------------------------------------------- -// -EXPORT_C const TDesC8& CCmMediaServer::MediaServer() const - { - return *iUDN; - } - -// --------------------------------------------------------------------------- -// Sets UDN of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServer::SetUDNL( const TDesC8& aUDN ) - { - delete iUDN; - iUDN = NULL; - - if( &aUDN ) - { - iUDN = aUDN.AllocL(); - } - else - { - iUDN = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// Sets database id of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmMediaServer::DbId() const - { - return iDbId; - } - -// --------------------------------------------------------------------------- -// Returns SystemUpdateID -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmMediaServer::SystemUpdateID() const - { - return iSystemUpdateID; - } - -// --------------------------------------------------------------------------- -// Sets SystemUpdateID -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServer::SetSystemUpdateID( - const TInt aSystemUpdateID ) - { - iSystemUpdateID = aSystemUpdateID; - } - -// --------------------------------------------------------------------------- -// Gets database id of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServer::SetDbId( const TInt64 aDbId ) - { - iDbId = aDbId; - } - -// --------------------------------------------------------------------------- -// CCmMediaServer::ExternalizeL -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -void CCmMediaServer::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iUDN->Length() ); - - if ( iUDN ) - { - aStream << *iUDN; - } - else - { - aStream << KNullDesC8(); - } - aStream.WriteUint32L( iDbId ); - aStream.WriteInt32L( iSystemUpdateID ); - } - -// --------------------------------------------------------------------------- -// CCmMediaServer::InternalizeL -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -void CCmMediaServer::InternalizeL( RReadStream& aStream ) - { - if ( iUDN ) - { - delete iUDN; - iUDN = NULL; - } - TInt bufLength = aStream.ReadInt32L(); - iUDN = HBufC8::NewL( aStream, bufLength ); - iDbId = aStream.ReadUint32L(); - iSystemUpdateID = aStream.ReadInt32L(); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmMediaServer::CCmMediaServer() - { - iSystemUpdateID = KErrNotFound; - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmMediaServer::ConstructL() - { - iUDN = KNullDesC8().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmmediaserverfull.cpp --- a/upnpharvester/common/cmlibrary/src/cmmediaserverfull.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Media servers -* -*/ - - - - - - -// INCLUDES -#include -#include - -#include "cmmediaserverfull.h" -#include "msdebug.h" - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMediaServerFull* CCmMediaServerFull::NewL() - { - CCmMediaServerFull* self = CCmMediaServerFull::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMediaServerFull* CCmMediaServerFull::NewLC() - { - CCmMediaServerFull* self = new ( ELeave ) CCmMediaServerFull(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmMediaServerFull::~CCmMediaServerFull() - { - delete iName; - iVisibleDate = NULL; - } - -// --------------------------------------------------------------------------- -// Returns name of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C TPtrC8 CCmMediaServerFull::MediaServerName() const - { - return *iName; - } - -// --------------------------------------------------------------------------- -// Sets media server name -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::SetMediaServerNameL( const TDesC8& aName ) - { - delete iName; - iName = NULL; - iName = aName.AllocL(); - } - -// --------------------------------------------------------------------------- -// Returns visible date of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C TTime CCmMediaServerFull::VisibleDate() const - { - return iVisibleDate; - } - -// --------------------------------------------------------------------------- -// Sets visible date of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::SetVisibleDate( TTime aTime ) - { - iVisibleDate = aTime; - } - -// --------------------------------------------------------------------------- -// Gets is active status of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C TUint8 CCmMediaServerFull::IsActive() const - { - return iIsActive; - } - -// --------------------------------------------------------------------------- -// Sets is active status of the media server -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::SetIsActive( TUint8 aIsActive ) - { - iIsActive = aIsActive; - } - -// --------------------------------------------------------------------------- -// Sets copy capability info -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCmMediaServerFull::CopyCapability() const - { - return iCopyCapability; - } - -// --------------------------------------------------------------------------- -// Gets copy capability info -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::SetCopyCapability( TBool aCopyCapability ) - { - iCopyCapability = aCopyCapability; - } - - -// --------------------------------------------------------------------------- -// Sets server status ( used for store ) -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::SetStoreUsage( TBool aUsed ) - { - iStoreServer = aUsed; - } - -// --------------------------------------------------------------------------- -// Gets server status ( store usage ) -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCmMediaServerFull::StoreUsage() - { - return iStoreServer; - } - -// --------------------------------------------------------------------------- -// Sets server status ( used for fill ) -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::SetFillUsage( TBool aUsed ) - { - iFillServer = aUsed; - } - -// --------------------------------------------------------------------------- -// Gets server status ( fill usage ) -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCmMediaServerFull::FillUsage() - { - return iFillServer; - } - -// --------------------------------------------------------------------------- -// CCmFillRule::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::ExternalizeL( RWriteStream& aStream ) const - { - CCmMediaServer::ExternalizeL(aStream); - aStream.WriteInt32L( iName->Length() ); - if ( iName ) - { - aStream << *iName; - } - else - { - aStream << KNullDesC8(); - } - aStream << iVisibleDate.Int64(); - aStream.WriteInt8L( iIsActive ); - aStream.WriteInt8L( iCopyCapability ); - aStream.WriteInt8L( iFillServer ); - aStream.WriteInt8L( iStoreServer ); - } - -// --------------------------------------------------------------------------- -// CCmFillRule::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmMediaServerFull::InternalizeL( RReadStream& aStream ) - { - CCmMediaServer::InternalizeL(aStream); - if ( iName ) - { - delete iName; - iName = NULL; - } - TInt bufLength = aStream.ReadInt32L(); - iName = HBufC8::NewL( aStream, bufLength ); - TInt64 tempTime; - aStream >> tempTime; - iVisibleDate = tempTime; - iIsActive = aStream.ReadInt8L(); - iCopyCapability = aStream.ReadInt8L(); - iFillServer = aStream.ReadInt8L(); - iStoreServer = aStream.ReadInt8L(); - } - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmparam.cpp --- a/upnpharvester/common/cmlibrary/src/cmparam.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Rule parameters -* -*/ - - - - - - -// INCLUDES -#include -#include - -#include "cmparam.h" -#include "msdebug.h" - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CCmParam* CCmParam::NewL() - { - CCmParam* self = CCmParam::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -CCmParam* CCmParam::NewLC() - { - CCmParam* self = new ( ELeave ) CCmParam(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmParam::~CCmParam() - { - delete iDataField; - } - -// --------------------------------------------------------------------------- -// Retrieve param info -// --------------------------------------------------------------------------- -// -void CCmParam::Param( TPtrC8* aParam ) - { - aParam->Set( *iDataField ); - } - -// --------------------------------------------------------------------------- -// Retrieve param info -// --------------------------------------------------------------------------- -// -void CCmParam::Param( TInt& aParam ) - { - aParam = iDataFieldIndexed; - } - -// --------------------------------------------------------------------------- -// Sets datafield value -// --------------------------------------------------------------------------- -// -void CCmParam::SetComparisonDataL( const TDesC8& aComparisonData ) - { - delete iDataField; - iDataField = NULL; - iDataField = aComparisonData.AllocL(); - } - -// --------------------------------------------------------------------------- -// Sets datafield value ( indexed ) -// --------------------------------------------------------------------------- -// -void CCmParam::SetComparisonData( TInt aComparisonData ) - { - iDataFieldIndexed = aComparisonData; - } - -// --------------------------------------------------------------------------- -// Returns datafield -// --------------------------------------------------------------------------- -// -const TDesC8& CCmParam::ComparisonData() const - { - return *iDataField; - } - -// --------------------------------------------------------------------------- -// CCmParam::ExternalizeL -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -void CCmParam::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iDataField->Length() ); - - if ( iDataField ) - { - aStream << *iDataField; - } - else - { - aStream << KNullDesC8(); - } - - aStream.WriteInt32L( iDataFieldIndexed ); - } - -// --------------------------------------------------------------------------- -// CCmParam::InternalizeL -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -void CCmParam::InternalizeL( RReadStream& aStream ) - { - // Content - delete iDataField; - iDataField = NULL; - - TInt bufLength = aStream.ReadInt32L(); - iDataField = HBufC8::NewL( aStream, bufLength ); - iDataFieldIndexed = aStream.ReadInt32L(); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmParam::CCmParam() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmParam::ConstructL() - { - iDataField = KNullDesC8().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmrule.cpp --- a/upnpharvester/common/cmlibrary/src/cmrule.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Rule parameters -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmparam.h" -#include "cmrule.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KRuleParamArrayGranularity = 16; - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CCmRule* CCmRule::NewL() - { - CCmRule* self = CCmRule::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -CCmRule* CCmRule::NewLC() - { - CCmRule* self = new ( ELeave ) CCmRule( ); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmRule::~CCmRule() - { - iRuleParamsArray.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// Adds rule param -// --------------------------------------------------------------------------- -// -TInt CCmRule::AddRuleParamL( const TDesC8& aParam ) - { - CCmParam* param = CCmParam::NewLC(); - param->SetComparisonDataL( aParam ); - iRuleParamsArray.AppendL( param ); // transfer ownership - CleanupStack::Pop( param ); - TInt index = iRuleParamsArray.Count() - 1; - return index; - } - -// --------------------------------------------------------------------------- -// Adds rule param ( indexed param ) -// --------------------------------------------------------------------------- -// -TInt CCmRule::AddRuleParamL( TInt aParam ) - { - CCmParam* param = CCmParam::NewLC(); - param->SetComparisonData( aParam ); - iRuleParamsArray.AppendL( param ); // transfer ownership - CleanupStack::Pop( param ); - TInt index = iRuleParamsArray.Count() - 1; - return index; - } - -// --------------------------------------------------------------------------- -// Loads rule -// --------------------------------------------------------------------------- -// -void CCmRule::Rule( TCmMetadataField* aDataField, TCmOperatorType* aOperator, - TInt* aParamCount ) - { - *aDataField = iMetadataField; - *aOperator = iOperator; - *aParamCount = iRuleParamsArray.Count(); - } - -// --------------------------------------------------------------------------- -// Loads rule param -// --------------------------------------------------------------------------- -// -void CCmRule::RuleParamL( TInt aParamIndex, TPtrC8* aParam ) - { - // check parameter - if ( aParamIndex < 0 || aParamIndex >= iRuleParamsArray.Count() ) - { - User::Leave( KErrArgument ); - } - - iRuleParamsArray[aParamIndex]->Param( aParam ); - } - -// --------------------------------------------------------------------------- -// Loads rule param -// --------------------------------------------------------------------------- -// -void CCmRule::RuleParamL( TInt aParamIndex, TInt& aParam ) - { - // check parameter - if ( aParamIndex < 0 || aParamIndex >= iRuleParamsArray.Count() ) - { - User::Leave( KErrArgument ); - } - - iRuleParamsArray[aParamIndex]->Param( aParam ); - } - -// --------------------------------------------------------------------------- -// Sets metadata field -// --------------------------------------------------------------------------- -// -void CCmRule::SetMetadataField( TCmMetadataField aDataField ) - { - iMetadataField = aDataField; - } - -// --------------------------------------------------------------------------- -// Sets operator of the rule -// --------------------------------------------------------------------------- -// -void CCmRule::SetOperator( TCmOperatorType aOperator ) - { - iOperator = aOperator; - } - -// --------------------------------------------------------------------------- -// Return count of the parameter -// --------------------------------------------------------------------------- -// -TInt CCmRule::RuleParamsCount() const - { - return iRuleParamsArray.Count(); - } - -// --------------------------------------------------------------------------- -// CCmRule::ExternalizeL -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -void CCmRule::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt16L( (TInt)iMetadataField ); - - aStream.WriteInt16L( (TInt)iOperator ); - aStream.WriteInt16L( iRuleParamsArray.Count() ); - - for ( TInt index(0); index < iRuleParamsArray.Count(); index++ ) - { - iRuleParamsArray[index]->ExternalizeL( aStream ); - } - - } - -// --------------------------------------------------------------------------- -// CCmRule::InternalizeL -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -void CCmRule::InternalizeL( RReadStream& aStream ) - { - // Content - iMetadataField = (TCmMetadataField)aStream.ReadInt16L(); - - iOperator = (TCmOperatorType)aStream.ReadInt16L(); - - // cleanup - iRuleParamsArray.ResetAndDestroy(); - - // rule param count - TInt ruleParamCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for (TInt index = 0; index < ruleParamCount; index++ ) - { - CCmParam* newRuleParam = CCmParam::NewLC(); - newRuleParam->InternalizeL( aStream ); - iRuleParamsArray.AppendL( newRuleParam ); - CleanupStack::Pop( newRuleParam ); - newRuleParam = NULL; - } - - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmRule::CCmRule() : iRuleParamsArray( KRuleParamArrayGranularity ) - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmRule::ConstructL() - { - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsearchresponsehash.cpp --- a/upnpharvester/common/cmlibrary/src/cmsearchresponsehash.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating Media servers -* -*/ - - - - - - -// INCLUDES -#include -#include - -#include "cmsearchresponsehash.h" -#include "msdebug.h" - - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSearchResponseHash* CCmSearchResponseHash::NewL( TInt aStartIndex, - TInt aItemCount, - const TDesC8& aHash ) - { - CCmSearchResponseHash* self = new ( ELeave ) CCmSearchResponseHash( ); - CleanupStack::PushL( self ); - self->ConstructL( aStartIndex, aItemCount, aHash ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSearchResponseHash* CCmSearchResponseHash::NewL() - { - CCmSearchResponseHash* self = new ( ELeave ) CCmSearchResponseHash(); - return self; - } - - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -CCmSearchResponseHash::CCmSearchResponseHash() - { - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmSearchResponseHash::~CCmSearchResponseHash() - { - delete iHash; - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSearchResponseHash::ConstructL( TInt aStartIndex, - TInt aItemCount, - const TDesC8& aHash ) - { - SetStartIndex( aStartIndex ); - SetItemCount( aItemCount ); - SetHashL( aHash ); - } - -// --------------------------------------------------------------------------- -// SetHashL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSearchResponseHash::SetHashL( const TDesC8& aHash ) - { - delete iHash; - iHash = NULL; - iHash = aHash.AllocL(); - } - -// --------------------------------------------------------------------------- -// Hash -// --------------------------------------------------------------------------- -// -EXPORT_C const TDesC8& CCmSearchResponseHash::Hash() const - { - if ( iHash ) - { - return *iHash; - } - else - { - return KNullDesC8(); - } - } - -// --------------------------------------------------------------------------- -// SetStartIndex -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSearchResponseHash::SetStartIndex( TInt aStartIndex ) - { - iStartIndex = aStartIndex; - } - -// --------------------------------------------------------------------------- -// StartIndex -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSearchResponseHash::StartIndex() const - { - return iStartIndex; - } - -// --------------------------------------------------------------------------- -// SetItemCount -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSearchResponseHash::SetItemCount( TInt aItemCount ) - { - iItemCount = aItemCount; - } - -// --------------------------------------------------------------------------- -// ItemCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSearchResponseHash::ItemCount() const - { - return iItemCount; - } - - -// ----------------------------------------------------------------------------- -// ExternalizeL -// ----------------------------------------------------------------------------- -// -void CCmSearchResponseHash::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( Hash().Length() ); - aStream << Hash(); - aStream.WriteInt32L( StartIndex() ); - aStream.WriteInt32L( ItemCount() ); - } - - -// ----------------------------------------------------------------------------- -// InternalizeL -// ----------------------------------------------------------------------------- -// -void CCmSearchResponseHash::InternalizeL( RReadStream& aStream ) - { - delete iHash; iHash = NULL; - TInt bufLength = aStream.ReadInt32L(); - iHash = HBufC8::NewL( aStream, bufLength ); - - iStartIndex = aStream.ReadInt32L(); - iItemCount = aStream.ReadInt32L(); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlaudioitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlaudioitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#include -#include "cmsqlaudioitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlAudioItem* CCmSqlAudioItem::NewL() - { - CCmSqlAudioItem* self = CCmSqlAudioItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlAudioItem* CCmSqlAudioItem::NewLC() - { - CCmSqlAudioItem* self = new ( ELeave ) CCmSqlAudioItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlAudioItem::~CCmSqlAudioItem() - { - delete iAlbumArtUri; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::SetArtistId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlAudioItem::SetArtistId( const TInt64 aArtistId ) - { - iArtistId = aArtistId; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::SetAlbumId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlAudioItem::SetAlbumId( const TInt64 aAlbumId ) - { - iAlbumId = aAlbumId; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::SetGenreId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlAudioItem::SetGenreId( const TInt64 aGenreId ) - { - iGenreId = aGenreId; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::SetDuration -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlAudioItem::SetDuration( const TInt aDuration ) - { - iDuration = aDuration; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::SetBitrate -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlAudioItem::SetBitrate( const TInt aBitrate ) - { - iBitrate = aBitrate; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::SetTrackNumber -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlAudioItem::SetTrackNumber( const TInt aTrackNumber ) - { - iTrackNumber = aTrackNumber; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::SetAlbumArtUriL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlAudioItem::SetAlbumArtUriL( const TDesC8& aAlbumArtUri ) - { - delete iAlbumArtUri; - iAlbumArtUri = NULL; - - if( &aAlbumArtUri ) - { - iAlbumArtUri = aAlbumArtUri.AllocL(); - } - else - { - iAlbumArtUri = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::ArtistId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlAudioItem::ArtistId() const - { - return iArtistId; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::AlbumId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlAudioItem::AlbumId() const - { - return iAlbumId; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::GenreId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlAudioItem::GenreId() const - { - return iGenreId; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::Duration -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlAudioItem::Duration() const - { - return iDuration; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::Bitrate -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlAudioItem::Bitrate() const - { - return iBitrate; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::TrackNumber -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlAudioItem::TrackNumber() const - { - return iTrackNumber; - } - -// --------------------------------------------------------------------------- -// CCmSqlAudioItem::AlbumArtUri -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmSqlAudioItem::AlbumArtUri() const - { - return *iAlbumArtUri; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlAudioItem::CCmSqlAudioItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlAudioItem::ConstructL() - { - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlbaseitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlbaseitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#include -#include "cmsqlbaseitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlBaseItem* CCmSqlBaseItem::NewL() - { - CCmSqlBaseItem* self = CCmSqlBaseItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlBaseItem* CCmSqlBaseItem::NewLC() - { - CCmSqlBaseItem* self = new ( ELeave ) CCmSqlBaseItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlBaseItem::~CCmSqlBaseItem() - { - delete iCdsId; - delete iHash; - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::SetId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlBaseItem::SetId( const TInt64 aId ) - { - iId = aId; - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::SetCdsIdL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlBaseItem::SetCdsIdL( const TDesC8& aCdsId ) - { - delete iCdsId; - iCdsId = NULL; - - if( &aCdsId ) - { - iCdsId = aCdsId.AllocL(); - } - else - { - iCdsId = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::SetHashL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlBaseItem::SetHashL( const TDesC& aHash ) - { - delete iHash; - iHash = NULL; - - if( &aHash ) - { - iHash = aHash.AllocL(); - } - else - { - iHash = KNullDesC().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::SetSearchId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlBaseItem::SetSearchId( - const TInt64 aSearchId ) - { - iSearchId = aSearchId; - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::Id -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlBaseItem::Id() const - { - return iId; - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::CdsId -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmSqlBaseItem::CdsId() const - { - return *iCdsId; - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::Hash -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC& CCmSqlBaseItem::Hash() const - { - return *iHash; - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::SearchId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlBaseItem::SearchId() const - { - return iSearchId; - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::CompareByHash -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlBaseItem::CompareByHash( - const CCmSqlBaseItem& aFirst, const CCmSqlBaseItem& aSecond ) - { - return aFirst.Hash().Compare( aSecond.Hash() ); - } - -// --------------------------------------------------------------------------- -// CCmSqlBaseItem::CompareByCdsId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlBaseItem::CompareByCdsId( - const CCmSqlBaseItem& aFirst, const CCmSqlBaseItem& aSecond ) - { - return aFirst.CdsId().Compare( aSecond.CdsId() ); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlBaseItem::CCmSqlBaseItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlBaseItem::ConstructL() - { - iCdsId = KNullDesC8().AllocL(); - iHash = KNullDesC().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlgenericitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlgenericitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill and store file lists -* -*/ - - - - - - -#include -#include "cmsqlitemresource.h" -#include "cmsqlgenericitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlGenericItem* CCmSqlGenericItem::NewL() - { - CCmSqlGenericItem* self = CCmSqlGenericItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlGenericItem* CCmSqlGenericItem::NewLC() - { - CCmSqlGenericItem* self = new ( ELeave ) CCmSqlGenericItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlGenericItem::~CCmSqlGenericItem() - { - delete iTitle; - delete iUri; - - iResources.ResetAndDestroy(); - iResources.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetSize -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetSize( const TInt aSize ) - { - iSize = aSize; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetTitleL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetTitleL( const TDesC8& aTitle ) - { - delete iTitle; - iTitle = NULL; - - if( &aTitle ) - { - iTitle = aTitle.AllocL(); - } - else - { - iTitle = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetDate -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetDate( const TTime& aDate ) - { - iDate = aDate; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetHarvestDate -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetHarvestDate( const TTime& aHarvestDate ) - { - iHarvestDate = aHarvestDate; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetUpnpclassId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetUpnpclassId( const TInt64 aUpnpclassId ) - { - iUpnpclassId = aUpnpclassId; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetUpnpProfileId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetUpnpProfileId( - const TInt64 aUpnpProfileId ) - { - iUpnpProfileId = aUpnpProfileId; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetUriL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetUriL( const TDesC8& aUri ) - { - delete iUri; - iUri = NULL; - - if( &aUri ) - { - iUri = aUri.AllocL(); - } - else - { - iUri = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::SetMediaType -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::SetMediaType( const TCmMediaType aMType ) - { - iMType = aMType; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::NewResourceL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::NewResourceL( const TDesC8& aUri, - const TInt aSize, const TInt aDuration, const TInt aBitrate, - const TInt64 aResolutionId ) - { - CCmSqlItemResource* item = CCmSqlItemResource::NewLC( - aUri, aSize, aDuration, aBitrate, aResolutionId ); - iResources.AppendL( item ); - CleanupStack::Pop( item ); - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::Size -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlGenericItem::Size() const - { - return iSize; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::Title -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmSqlGenericItem::Title() const - { - return *iTitle; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::Date -// --------------------------------------------------------------------------- -// -EXPORT_C TTime CCmSqlGenericItem::Date() const - { - return iDate; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::HarvestDate -// --------------------------------------------------------------------------- -// -EXPORT_C TTime CCmSqlGenericItem::HarvestDate() const - { - return iHarvestDate; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::UpnpclassId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlGenericItem::UpnpclassId() const - { - return iUpnpclassId; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::UpnpProfileId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlGenericItem::UpnpProfileId() const - { - return iUpnpProfileId; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::Uri -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmSqlGenericItem::Uri() const - { - return *iUri; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::MediaType -// --------------------------------------------------------------------------- -// -EXPORT_C TCmMediaType CCmSqlGenericItem::MediaType() const - { - return iMType; - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::ResourceCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlGenericItem::ResourceCount() const - { - return iResources.Count(); - } - -// --------------------------------------------------------------------------- -// CCmSqlGenericItem::GetResource -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlGenericItem::GetResource( TDesC8& aUri, TInt& aSize, - TInt& aDuration, TInt& aBitrate, TInt64& aResolutionId, TInt aIndex ) - { - if( aIndex < iResources.Count() ) - { - aUri = iResources[aIndex]->Uri(); - aSize = iResources[aIndex]->Size(); - aDuration = iResources[aIndex]->Duration(); - aBitrate = iResources[aIndex]->Bitrate(); - aResolutionId = iResources[aIndex]->ResolutionId(); - } - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlGenericItem::CCmSqlGenericItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlGenericItem::ConstructL() - { - iUri = KNullDesC8().AllocL(); - iTitle = KNullDesC8().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlimageitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlimageitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#include -#include "cmsqlimageitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlImageItem* CCmSqlImageItem::NewL() - { - CCmSqlImageItem* self = CCmSqlImageItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlImageItem* CCmSqlImageItem::NewLC() - { - CCmSqlImageItem* self = new ( ELeave ) CCmSqlImageItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlImageItem::~CCmSqlImageItem() - { - delete iDescription; - } - -// --------------------------------------------------------------------------- -// CCmSqlImageItem::SetResolutionId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlImageItem::SetResolutionId( const TInt64 aResolutionId ) - { - iResolutionId = aResolutionId; - } - -// --------------------------------------------------------------------------- -// CCmSqlImageItem::SetDescription -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlImageItem::SetDescriptionL( const TDesC8& aDescription ) - { - delete iDescription; - iDescription = NULL; - - if( &aDescription ) - { - iDescription = aDescription.AllocL(); - } - else - { - iDescription = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlImageItem::ResolutionId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlImageItem::ResolutionId() const - { - return iResolutionId; - } - -// --------------------------------------------------------------------------- -// CCmSqlImageItem::Description -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmSqlImageItem::Description() const - { - return *iDescription; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlImageItem::CCmSqlImageItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlImageItem::ConstructL() - { - iDescription = KNullDesC8().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlitemresource.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlitemresource.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql items -* -*/ - - - - - - -#include -#include "cmsqlitemresource.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CCmSqlItemResource* CCmSqlItemResource::NewL() - { - CCmSqlItemResource* self = CCmSqlItemResource::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -CCmSqlItemResource* CCmSqlItemResource::NewLC() - { - CCmSqlItemResource* self = new ( ELeave ) CCmSqlItemResource(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC( const TDesC8& aUri, -// const TInt aSize, const TInt aDuration, const TInt aBitrate, -// const TInt64 aResolutionId ) -// --------------------------------------------------------------------------- -// -CCmSqlItemResource* CCmSqlItemResource::NewLC( const TDesC8& aUri, - const TInt aSize, const TInt aDuration, const TInt aBitrate, - const TInt64 aResolutionId ) - { - CCmSqlItemResource* self = new ( ELeave ) CCmSqlItemResource(); - CleanupStack::PushL( self ); - self->ConstructL( aUri, aSize, aDuration, aBitrate, aResolutionId ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmSqlItemResource::~CCmSqlItemResource() - { - delete iUri; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::SetUriL -// --------------------------------------------------------------------------- -// -void CCmSqlItemResource::SetUriL( const TDesC8& aUri ) - { - delete iUri; - iUri = NULL; - - if( &aUri ) - { - iUri = aUri.AllocL(); - } - else - { - iUri = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::SetSize -// --------------------------------------------------------------------------- -// -void CCmSqlItemResource::SetSize( const TInt aSize ) - { - iSize = aSize; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::SetDuration -// --------------------------------------------------------------------------- -// -void CCmSqlItemResource::SetDuration( const TInt aDuration ) - { - iDuration = aDuration; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::SetBitrate -// --------------------------------------------------------------------------- -// -void CCmSqlItemResource::SetBitrate( const TInt aBitrate ) - { - iBitrate = aBitrate; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::SetResolutionId -// --------------------------------------------------------------------------- -// -void CCmSqlItemResource::SetResolutionId( - const TInt64 aResolutionId ) - { - iResolutionId = aResolutionId; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::Uri -// --------------------------------------------------------------------------- -// -TDesC8& CCmSqlItemResource::Uri() const - { - return *iUri; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::Size -// --------------------------------------------------------------------------- -// -TInt CCmSqlItemResource::Size() const - { - return iSize; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::Duration -// --------------------------------------------------------------------------- -// -TInt CCmSqlItemResource::Duration() const - { - return iDuration; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::Bitrate -// --------------------------------------------------------------------------- -// -TInt CCmSqlItemResource::Bitrate() const - { - return iBitrate; - } - -// --------------------------------------------------------------------------- -// CCmSqlItemResource::ResolutionId -// --------------------------------------------------------------------------- -// -TInt CCmSqlItemResource::ResolutionId() const - { - return iResolutionId; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlItemResource::CCmSqlItemResource() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlItemResource::ConstructL() - { - iUri = KNullDesC8().AllocL(); - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlItemResource::ConstructL( const TDesC8& aUri, - const TInt aSize, const TInt aDuration, const TInt aBitrate, - const TInt64 aResolutionId ) - { - if ( &aUri ) - { - iUri = aUri.AllocL(); - } - else - { - iUri = KNullDesC8().AllocL(); - } - iSize = aSize; - iDuration = aDuration; - iBitrate = aBitrate; - iResolutionId = aResolutionId; - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlpropertycollector.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlpropertycollector.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating property container objects -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmsqlpropertycontainer.h" -#include "cmsqlpropertycollector.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KArrayGranularity = 16; - -// ======== LOCAL FUNCTIONS ======== -// -------------------------------------------------------------------------- -// NewL -// -------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyCollector* CCmSqlPropertyCollector::NewL() - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::NewL")); - - CCmSqlPropertyCollector* self = CCmSqlPropertyCollector::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// NewLC -// -------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyCollector* CCmSqlPropertyCollector::NewLC() - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::NewLC")); - - CCmSqlPropertyCollector* self = new ( ELeave ) CCmSqlPropertyCollector(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyCollector::~CCmSqlPropertyCollector() - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::\ - ~CCmSqlPropertyCollector")); - - iPropertyContainers.ResetAndDestroy(); - iPropertyContainers.Close(); - } - -// -------------------------------------------------------------------------- -// CCmSqlPropertyCollector::AddPropertyContainerL -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlPropertyCollector::AddPropertyContainerL( - CCmSqlPropertyContainer* aContainer ) - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::AddPropertyContainerL")); - - iPropertyContainers.AppendL( aContainer ); - TInt index = iPropertyContainers.Count() - 1; - return index; - } - -// -------------------------------------------------------------------------- -// CCmSqlPropertyCollector::DeletePropertyContainer -// -------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyCollector::DeletePropertyContainer( TInt aIndex ) - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::\ - DeletePropertyContainer")); - - if( iPropertyContainers.Count() > aIndex ) - { - delete iPropertyContainers[aIndex]; - iPropertyContainers.Remove(aIndex); - iPropertyContainers.Compress(); - } - } - -// -------------------------------------------------------------------------- -// CCCmSqlPropertyCollector::PropertyContainer -// -------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyContainer* - CCmSqlPropertyCollector::PropertyContainer( TInt aIndex ) - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::PropertyContainer")); - - return iPropertyContainers[aIndex]; - } - -// -------------------------------------------------------------------------- -// CCmSqlPropertyCollector::PropertyContainerCount -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlPropertyCollector::PropertyContainerCount() const - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::PropertyContainerCount")); - - return iPropertyContainers.Count(); - } - -// -------------------------------------------------------------------------- -// CCmSqlPropertyCollector::ExternalizeL -// -------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyCollector::ExternalizeL( - RWriteStream& aStream ) const - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::ExternalizeL")); - - // Let's write the count of fill rules to stream first - aStream.WriteInt16L( iPropertyContainers.Count() ); - for ( TInt index = 0; index < iPropertyContainers.Count(); index++ ) - { - CCmSqlPropertyContainer* container = iPropertyContainers[index]; - // Then the object itself - container->ExternalizeL( aStream ); - } - } - -// -------------------------------------------------------------------------- -// CCmSqlPropertyCollector::InternalizeL -// -------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyCollector::InternalizeL( RReadStream& aStream ) - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::InternalizeL")); - - // Then internalize the objects - if ( iPropertyContainers.Count() > KErrNone ) - { - iPropertyContainers.ResetAndDestroy(); - } - // First the count of fill rules - TInt itemCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for (TInt index = 0; index < itemCount; index++ ) - { - CCmSqlPropertyContainer* newContainer = - CCmSqlPropertyContainer::NewL(); - CleanupStack::PushL( newContainer ); - newContainer->InternalizeL( aStream ); - AddPropertyContainerL( newContainer ); - CleanupStack::Pop( newContainer ); - newContainer = NULL; - } - } - -// -------------------------------------------------------------------------- -// Default constructor -// -------------------------------------------------------------------------- -// -CCmSqlPropertyCollector::CCmSqlPropertyCollector() : - iPropertyContainers( KArrayGranularity ) - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::\ - CCmSqlPropertyCollector")); - } - -// -------------------------------------------------------------------------- -// ConstructL -// -------------------------------------------------------------------------- -// -void CCmSqlPropertyCollector::ConstructL() - { - LOG(_L("[CmLibrary]\t CCmSqlPropertyCollector::ConstructL")); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlpropertycontainer.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlpropertycontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,242 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating propety item objects -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmsqlpropertyitem.h" -#include "cmsqlpropertycontainer.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KArrayGranularity = 16; - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyContainer* CCmSqlPropertyContainer::NewL() - { - CCmSqlPropertyContainer* self = CCmSqlPropertyContainer::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyContainer* CCmSqlPropertyContainer::NewLC() - { - CCmSqlPropertyContainer* self = new ( ELeave ) CCmSqlPropertyContainer(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyContainer::~CCmSqlPropertyContainer() - { - iPropertyItems.ResetAndDestroy(); - iPropertyItems.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::AddPropertyItemL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyContainer::AddPropertyItemL( - CCmSqlPropertyItem* aItem ) - { - iPropertyItems.AppendL( aItem ); - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::DeletePropertyItem -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyContainer::DeletePropertyItem( TInt aIndex ) - { - if( iPropertyItems.Count() > aIndex ) - { - delete iPropertyItems[aIndex]; - iPropertyItems.Remove(aIndex); - iPropertyItems.Compress(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::PropertyItem -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyItem* CCmSqlPropertyContainer::PropertyItem( - TInt aIndex ) - { - return iPropertyItems[aIndex]; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::PropertyItemCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlPropertyContainer::PropertyItemCount() const - { - return iPropertyItems.Count(); - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::SetType -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyContainer::SetType( TCmMetadataField aType ) - { - iType = aType; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::Type -// --------------------------------------------------------------------------- -// -EXPORT_C TCmMetadataField CCmSqlPropertyContainer::Type( ) - { - return iType; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::IsDuplicate -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCmSqlPropertyContainer::IsDuplicate( - CCmSqlPropertyItem& aItem ) - { - TBool ret( EFalse ); - TInt64 id( aItem.Id() ); - TInt count( iPropertyItems.Count() ); - for( TInt i = 0; i < count; i++ ) - { - if( id == iPropertyItems[i]->Id() ) - { - ret = ETrue; - // Duplicate found => end loop - i = count; - } - } - return ret; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyContainer::ExternalizeL( - RWriteStream& aStream ) const - { - // Let's write the count of fill rules to stream first - aStream.WriteInt16L( iPropertyItems.Count() ); - aStream.WriteUint8L( iType ); - for ( TInt index = 0; index < iPropertyItems.Count(); index++ ) - { - CCmSqlPropertyItem* item = iPropertyItems[index]; - // Then the object itself - item->ExternalizeL( aStream ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyContainer::InternalizeL( RReadStream& aStream ) - { - // Then internalize the objects - if ( iPropertyItems.Count() > KErrNone ) - { - iPropertyItems.ResetAndDestroy(); - } - // First the count of fill rules - TInt itemCount = aStream.ReadInt16L(); - iType = (TCmMetadataField)aStream.ReadInt8L(); - // Then internalize them from the stream one by one - for (TInt index = 0; index < itemCount; index++ ) - { - CCmSqlPropertyItem* newItem = CCmSqlPropertyItem::NewL(); - CleanupStack::PushL( newItem ); - newItem->InternalizeL( aStream ); - AddPropertyItemL( newItem ); - CleanupStack::Pop( newItem ); - newItem = NULL; - } - } - - -// --------------------------------------------------------------------------- -// CCmSqlPropertyContainer::SortPropertyItem -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyContainer::SortPropertyItem( ) - { - if( ( ECmArtist == iType ) || ( ECmAlbum == iType ) - || ( ECmGenre == iType ) || ( ECmTitle == iType ) ) - { - if( iPropertyItems.Count() > 0 ) - { - iPropertyItems.Sort( TLinearOrder - ( CCmSqlPropertyContainer::CompareItem ) ); - } - } - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlPropertyContainer::CCmSqlPropertyContainer() : - iPropertyItems( KArrayGranularity ) - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlPropertyContainer::ConstructL() - { - } - - -// ----------------------------------------------------------------------------- -// CCmSqlPropertyContainer::CompareItem -// ----------------------------------------------------------------------------- -// -TInt CCmSqlPropertyContainer::CompareItem( - const CCmSqlPropertyItem& aItemOne,const CCmSqlPropertyItem& aItemTwo ) - { - TInt ret = 0; - ret = ( aItemOne.Name() ).CompareC( aItemTwo.Name() ); - return ret; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlpropertyitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlpropertyitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating propety items -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmsqlpropertyitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyItem* CCmSqlPropertyItem::NewL() - { - CCmSqlPropertyItem* self = CCmSqlPropertyItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyItem* CCmSqlPropertyItem::NewLC() - { - CCmSqlPropertyItem* self = new ( ELeave ) CCmSqlPropertyItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyItem::~CCmSqlPropertyItem() - { - delete iName; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::SetId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyItem::SetId( const TInt64 aId ) - { - iId = aId; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::SetNameL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyItem::SetNameL( const TDesC8& aName ) - { - delete iName; - iName = NULL; - if( &aName ) - { - iName = aName.AllocL(); - } - else - { - iName = KNullDesC8().AllocL(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::SetStatus -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyItem::SetStatus( const TBool aStatus ) - { - iStatus = aStatus; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::Id -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlPropertyItem::Id() const - { - return iId; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::Name -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmSqlPropertyItem::Name() const - { - return *iName; - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::Status -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CCmSqlPropertyItem::Status() const - { - return iStatus; - } - -// --------------------------------------------------------------------------- -// CompareItemsByName -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlPropertyItem::CompareItemsByName( - const CCmSqlPropertyItem& aFirst, const CCmSqlPropertyItem& aSecond ) - { - return aFirst.Name().Compare( aSecond.Name() ); - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyItem::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iName->Length() ); - if ( iName ) - { - aStream << *iName; - } - else - { - aStream << KNullDesC8(); - } - aStream.WriteUint32L( iId ); - aStream.WriteInt32L( iStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlPropertyItem::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlPropertyItem::InternalizeL( RReadStream& aStream ) - { - // Content - if ( iName ) - { - delete iName; - iName = NULL; - } - TInt bufLength = aStream.ReadInt32L(); - iName = HBufC8::NewL( aStream, bufLength ); - - iId = aStream.ReadUint32L(); - iStatus = (TBool)aStream.ReadInt32L(); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlPropertyItem::CCmSqlPropertyItem() - { - } - -// --------------------------------------------------------------------------- -// Copy constructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlPropertyItem::CCmSqlPropertyItem( - const CCmSqlPropertyItem& aItem ) : - iId( aItem.iId ), iStatus( aItem.iStatus ) - { - iName = aItem.Name().Alloc(); - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlPropertyItem::ConstructL() - { - iName = KNullDesC8().AllocL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlresolutionpropertyitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlresolutionpropertyitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating resolution propety items -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmsqlresolutionpropertyitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlResolutionPropertyItem* CCmSqlResolutionPropertyItem::NewL() - { - CCmSqlResolutionPropertyItem* self = - CCmSqlResolutionPropertyItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlResolutionPropertyItem* CCmSqlResolutionPropertyItem::NewLC() - { - CCmSqlResolutionPropertyItem* self = - new ( ELeave ) CCmSqlResolutionPropertyItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlResolutionPropertyItem::~CCmSqlResolutionPropertyItem() - { - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::SetWidth -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlResolutionPropertyItem::SetWidth( const TInt aWidth ) - { - iWidth = aWidth; - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::SetHeight -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlResolutionPropertyItem::SetHeight( const TInt aHeight ) - { - iHeight = aHeight; - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::SetPixelCount -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlResolutionPropertyItem::SetPixelCount( - const TInt aPixelCount ) - { - iPixelCount = aPixelCount; - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::Width -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlResolutionPropertyItem::Width() const - { - return iWidth; - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::Height -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlResolutionPropertyItem::Height() const - { - return iHeight; - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::PixelCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlResolutionPropertyItem::PixelCount() const - { - return iPixelCount; - } - -// --------------------------------------------------------------------------- -// CompareItemsByName -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmSqlResolutionPropertyItem::CompareItemsByName( - const CCmSqlResolutionPropertyItem& aFirst, - const CCmSqlResolutionPropertyItem& aSecond ) - { - return aFirst.Name().Compare( aSecond.Name() ); - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlResolutionPropertyItem::ExternalizeL( - RWriteStream& aStream ) const - { - aStream.WriteInt32L( iWidth ); - aStream.WriteInt32L( iHeight ); - aStream.WriteInt32L( iPixelCount ); - CCmSqlPropertyItem::ExternalizeL( aStream ); - } - -// --------------------------------------------------------------------------- -// CCmSqlResolutionPropertyItem::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlResolutionPropertyItem::InternalizeL( - RReadStream& aStream ) - { - iWidth = aStream.ReadInt32L(); - iHeight = aStream.ReadInt32L(); - iPixelCount = aStream.ReadInt32L(); - CCmSqlPropertyItem::InternalizeL( aStream ); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlResolutionPropertyItem::CCmSqlResolutionPropertyItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlResolutionPropertyItem::ConstructL() - { - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmsqlvideoitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmsqlvideoitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating sql itemss -* -*/ - - - - - - -#include -#include "cmsqlvideoitem.h" -#include "msdebug.h" - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlVideoItem* CCmSqlVideoItem::NewL() - { - CCmSqlVideoItem* self = CCmSqlVideoItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlVideoItem* CCmSqlVideoItem::NewLC() - { - CCmSqlVideoItem* self = new ( ELeave ) CCmSqlVideoItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmSqlVideoItem::~CCmSqlVideoItem() - { - } - -// --------------------------------------------------------------------------- -// CCmSqlVideoItem::SetGenreId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmSqlVideoItem::SetGenreId( const TInt64 aGenreId ) - { - iGenreId = aGenreId; - } - -// --------------------------------------------------------------------------- -// CCmSqlVideoItem::GenreId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmSqlVideoItem::GenreId() const - { - return iGenreId; - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlVideoItem::CCmSqlVideoItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlVideoItem::ConstructL() - { - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmstorelistitem.cpp --- a/upnpharvester/common/cmlibrary/src/cmstorelistitem.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating store file list item -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmstorelistitem.h" -#include "msdebug.h" - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreListItem* CCmStoreListItem::NewL() - { - CCmStoreListItem* self = CCmStoreListItem::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreListItem* CCmStoreListItem::NewLC() - { - CCmStoreListItem* self = new ( ELeave ) CCmStoreListItem(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreListItem::~CCmStoreListItem() - { - iDeviceIds.Reset(); - iDeviceIds.Close(); - iStatusValues.Reset(); - iStatusValues.Close(); - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::SetListId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreListItem::SetListId( const TUint aListId ) - { - iListId = aListId; - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::SetDevId -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreListItem::SetDevId( const TUint8 aId, - TCmListItemStatus aStatus ) - { - iDeviceIds.Append( aId ); - iStatusValues.AppendL( aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::ListId -// --------------------------------------------------------------------------- -// -EXPORT_C TUint CCmStoreListItem::ListId() const - { - return iListId; - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::DevIds -// --------------------------------------------------------------------------- -// -EXPORT_C RArray CCmStoreListItem::DevIds() const - { - return iDeviceIds; - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::StatusValues -// --------------------------------------------------------------------------- -// -EXPORT_C RArray CCmStoreListItem::StatusValues() const - { - return iStatusValues; - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::UpdateFileStatusL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreListItem::UpdateFileStatusL( const TUint8 aId, - TCmListItemStatus aStatus ) - { - // Find index of the device - TInt index( iDeviceIds.FindL( aId ) ); - if( KErrNotFound != index ) - { - // Use index when updating status value - iStatusValues[index] = aStatus; - } - - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::ExternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreListItem::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteUint16L( iListId ); - aStream.WriteUint16L( iDeviceIds.Count() ); - for( TInt i = 0; i < iDeviceIds.Count(); i++ ) - { - aStream.WriteInt16L( iDeviceIds[i] ); - } - aStream.WriteInt16L( iStatusValues.Count() ); - for( TInt i = 0; i < iStatusValues.Count(); i++ ) - { - aStream.WriteInt16L( iStatusValues[i] ); - } - CCmBaseListItem::ExternalizeL(aStream); - } - -// --------------------------------------------------------------------------- -// CCmStoreListItem::InternalizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreListItem::InternalizeL( RReadStream& aStream ) - { - iListId = aStream.ReadUint16L(); - TUint count( aStream.ReadUint16L() ); - iDeviceIds.Reset(); - for( TInt i = 0; i < count; i++ ) - { - iDeviceIds.Append( aStream.ReadInt16L() ); - } - count = aStream.ReadUint16L(); - iStatusValues.Reset(); - for( TInt i = 0; i < count; i++ ) - { - iStatusValues.AppendL( (TCmListItemStatus) aStream.ReadInt16L() ); - } - CCmBaseListItem::InternalizeL(aStream); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmStoreListItem::CCmStoreListItem() - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmStoreListItem::ConstructL() - { - // construct base class - CCmBaseListItem::ConstructL(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmstorerule.cpp --- a/upnpharvester/common/cmlibrary/src/cmstorerule.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,465 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating store rule -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmmediaserver.h" -#include "cmstorerule.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KArrayGranularity = 16; -const TInt KArrayGranularityContainer = 8; - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRule* CCmStoreRule::NewL() - { - CCmStoreRule* self = CCmStoreRule::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRule* CCmStoreRule::NewLC() - { - CCmStoreRule* self = new ( ELeave ) CCmStoreRule(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRule::~CCmStoreRule() - { - delete iName; - - iRuleDefs.Reset(); - iRuleDefs.Close(); - - iMediaServers.ResetAndDestroy(); - iMediaServers.Close(); - - iExcPlayLists->Reset(); - iExcAlbums->Reset(); - - delete iExcPlayLists; - delete iExcAlbums; - } - -// --------------------------------------------------------------------------- -// Add new rule into StoreRule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmStoreRule::AddStoreRuleL( TCmMediaType aMediaType ) - { - iRuleDefs.AppendL( aMediaType ); - TInt index = iRuleDefs.Count() - 1; - return index; - } - -// --------------------------------------------------------------------------- -// Get rule -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::StoreRule( TInt aIndex, TCmMediaType* aMediaType ) - { - *aMediaType = (TCmMediaType)iRuleDefs[aIndex]; - } - -// --------------------------------------------------------------------------- -// Add new media server into FillRule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmStoreRule::AddMediaServerL( const TDesC8& aUDN ) - { - CCmMediaServer* server = CCmMediaServer::NewLC(); - server->SetUDNL( aUDN ); - iMediaServers.AppendL( server ); - CleanupStack::Pop( server ); - TInt index = iMediaServers.Count() - 1; - return index; - } - -// --------------------------------------------------------------------------- -// Delete media server from the store rule -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::DeleteMediaServer( const TDesC8& aUDN ) - { - TBool deleted( EFalse ); - for( TInt i = 0; i < iMediaServers.Count() && !deleted; i++ ) - { - if( KErrNone == iMediaServers[i]->MediaServer().Compare(aUDN) ) - { - delete iMediaServers[i]; - iMediaServers.Remove(i); - iMediaServers.Compress(); - deleted = ETrue; - } - } - } - -// --------------------------------------------------------------------------- -// Adds one album into excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::AddExcAlbumL( const TDesC& aAlbum ) - { - TRACE(Print(_L("[COMMON]\t AddExcAlbumL( %S )"), &aAlbum )); - HBufC* temp = aAlbum.AllocL(); - CleanupStack::PushL( temp ); - iExcAlbums->AppendL( *temp ); - CleanupStack::Pop( temp ); - } - -// --------------------------------------------------------------------------- -// Adds one playlist into excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::AddExcPlayListL( const TDesC& aPlayList ) - { - HBufC* temp = aPlayList.AllocL(); - CleanupStack::PushL( temp ); - iExcPlayLists->AppendL( *temp ); - CleanupStack::Pop( temp ); - } - -// --------------------------------------------------------------------------- -// Removes one album from the excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::RemoveExcAlbum( const TDesC& aAlbum ) - { - TInt pos( KErrNone ); - TInt err( iExcAlbums->Find( aAlbum, pos, ECmpNormal ) ); - if( err == KErrNone ) - { - iExcAlbums->Delete( pos ); - iExcAlbums->Compress(); - } - } - -// --------------------------------------------------------------------------- -// Removes one playlist from the excluded list -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::RemoveExcPlayList( const TDesC& aPlayList ) - { - TInt pos( KErrNone ); - TInt err( iExcPlayLists->Find( aPlayList, pos, ECmpNormal ) ); - if( err == KErrNone ) - { - iExcPlayLists->Delete( pos ); - iExcPlayLists->Compress(); - } - } - -// --------------------------------------------------------------------------- -// Returns excluded albums -// --------------------------------------------------------------------------- -// -EXPORT_C CDesCArray& CCmStoreRule::ExcAlbums() - { - return *iExcAlbums; - } - -// --------------------------------------------------------------------------- -// Returns excluded playlists -// --------------------------------------------------------------------------- -// -EXPORT_C CDesCArray& CCmStoreRule::ExcPlayLists() - { - return *iExcPlayLists; - } - -// --------------------------------------------------------------------------- -// Get media server -// --------------------------------------------------------------------------- -// -EXPORT_C const TDesC8& CCmStoreRule::MediaServerL( TInt aIndex ) - { - // check parameter - if ( aIndex < 0 || aIndex >= iMediaServers.Count() ) - { - User::Leave( KErrArgument ); - } - - return iMediaServers[aIndex]->MediaServer(); - } - -// --------------------------------------------------------------------------- -// Returns count of rules -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmStoreRule::DefCount() const - { - return iRuleDefs.Count(); - } - -// --------------------------------------------------------------------------- -// Returns count of media servers -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmStoreRule::MediaServerCount() const - { - return iMediaServers.Count(); - } - -// --------------------------------------------------------------------------- -// Sets FillRule name -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::SetNameL( const TDesC8& aName ) - { - delete iName; - iName = NULL; - iName = aName.AllocL(); - } - -// --------------------------------------------------------------------------- -// Get Name -// --------------------------------------------------------------------------- -// -EXPORT_C TDesC8& CCmStoreRule::Name() const - { - return *iName; - } - -// --------------------------------------------------------------------------- -// Sets list id, when storing data into db this values isn't used as a -// db list id -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::SetListId( const TUint aId ) - { - iId = aId; - } - -// --------------------------------------------------------------------------- -// Get list id -// --------------------------------------------------------------------------- -// -EXPORT_C TUint CCmStoreRule::ListId() const - { - return iId; - } - -// --------------------------------------------------------------------------- -// Sets selected state -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::SetSelected( TCmFillRuleStatus aSelected ) - { - iSelected = aSelected; - } - -// --------------------------------------------------------------------------- -// Returns method -// --------------------------------------------------------------------------- -// -EXPORT_C TCmFillRuleStatus CCmStoreRule::Selected() const - { - return iSelected; - } - -// --------------------------------------------------------------------------- -// Sets rule's status ( e.g ECmToBeRemoved ) -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRule::SetStatus( TCmListItemStatus aStatus ) - { - iStatus = aStatus; - } - -// --------------------------------------------------------------------------- -// Returns status -// --------------------------------------------------------------------------- -// -EXPORT_C TCmListItemStatus CCmStoreRule::Status() const - { - return iStatus; - } - -// --------------------------------------------------------------------------- -// CCmStoreRule::ExternalizeL -// --------------------------------------------------------------------------- -// -void CCmStoreRule::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iName->Length() ); - if ( iName ) - { - aStream << *iName; - } - else - { - aStream << KNullDesC8(); - } - - aStream.WriteInt16L((TInt)iSelected ); - aStream.WriteInt16L((TInt)iStatus ); - - aStream.WriteInt16L( iRuleDefs.Count() ); - for ( TInt index(0); index < iRuleDefs.Count(); index++ ) - { - aStream.WriteInt16L((TInt)iRuleDefs[index] ); - } - - aStream.WriteInt16L( iMediaServers.Count() ); - for ( TInt index(0); index < iMediaServers.Count(); index++ ) - { - iMediaServers[index]->ExternalizeL( aStream ); - } - TRACE(Print(_L("[COMMON]\t iExcAlbums->Count() = %d"), - iExcAlbums->Count() )); - aStream.WriteInt16L( iExcAlbums->Count() ); - for ( TInt index(0); index < iExcAlbums->Count(); index++ ) - { - TRACE(Print(_L("[COMMON]\t iExcAlbums[index].Length() = %d"), - iExcAlbums->MdcaPoint(index).Length() )); - aStream.WriteInt32L( iExcAlbums->MdcaPoint(index).Length() ); - aStream << iExcAlbums->MdcaPoint(index); - } - TRACE(Print(_L("[COMMON]\t iExcPlayLists->Count() = %d"), - iExcPlayLists->Count() )); - aStream.WriteInt16L( iExcPlayLists->Count() ); - for ( TInt index(0); index < iExcPlayLists->Count(); index++ ) - { - TRACE(Print(_L("[COMMON]\t iExcPlayLists[index].Length() = %d"), - iExcPlayLists->MdcaPoint(index).Length() )); - aStream.WriteInt32L( iExcPlayLists->MdcaPoint(index).Length() ); - aStream << iExcPlayLists->MdcaPoint(index); - } - } - -// --------------------------------------------------------------------------- -// CCmFillRule::InternalizeL -// --------------------------------------------------------------------------- -// -void CCmStoreRule::InternalizeL( RReadStream& aStream ) - { - // Content - if ( iName ) - { - delete iName; - iName = NULL; - } - TInt bufLength = aStream.ReadInt32L(); - iName = HBufC8::NewL( aStream, bufLength ); - - // cleanup - iRuleDefs.Reset(); - - iSelected = (TCmFillRuleStatus)aStream.ReadInt16L(); - iStatus = (TCmListItemStatus)aStream.ReadInt16L(); - - // rule count - TInt ruleCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for (TInt index = 0; index < ruleCount; index++ ) - { - iRuleDefs.AppendL((TCmMediaType)aStream.ReadInt16L()); - } - - // cleanup - iMediaServers.ResetAndDestroy(); - - // media Server count - TInt mediaServerCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for (TInt index = 0; index < mediaServerCount; index++ ) - { - CCmMediaServer* server = CCmMediaServer::NewLC(); - server->InternalizeL( aStream ); - iMediaServers.AppendL( server ); - CleanupStack::Pop( server ); - server = NULL; - } - iExcAlbums->Reset(); - TInt excAlbumsCount( aStream.ReadInt16L() ); - bufLength = KErrNone; - HBufC* temp; - TRACE(Print(_L("[COMMON]\t excAlbumsCount = %d"), excAlbumsCount )); - for ( TInt index(0); index < excAlbumsCount ; index++ ) - { - bufLength = aStream.ReadInt32L(); - TRACE(Print(_L("[COMMON]\t bufLength = %d"), bufLength )); - temp = HBufC::NewL( aStream, bufLength ); - CleanupStack::PushL( temp ); - iExcAlbums->AppendL( *temp ); - CleanupStack::Pop( temp ); - temp = NULL; - } - iExcPlayLists->Reset(); - TInt excPlayListCount( aStream.ReadInt16L() ); - bufLength = KErrNone; - TRACE(Print(_L("[COMMON]\t excPlayListCount = %d"), excPlayListCount )); - for ( TInt index(0); index < excPlayListCount ; index++ ) - { - bufLength = aStream.ReadInt32L(); - TRACE(Print(_L("[COMMON]\t bufLength = %d"), bufLength )); - temp = HBufC::NewL( aStream, bufLength ); - CleanupStack::PushL( temp ); - iExcPlayLists->AppendL( *temp ); - CleanupStack::Pop( temp ); - temp = NULL; - } - } - -// --------------------------------------------------------------------------- -// Default constructor -// C++ default constructor can NOT contain any code, that might leave. -// --------------------------------------------------------------------------- -// -CCmStoreRule::CCmStoreRule() : - iRuleDefs( KArrayGranularity ), - iMediaServers( KArrayGranularity ) - { - - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmStoreRule::ConstructL() - { - iExcAlbums = new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer ); - iExcPlayLists = - new ( ELeave ) CDesCArrayFlat( KArrayGranularityContainer ); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmlibrary/src/cmstorerulecontainer.cpp --- a/upnpharvester/common/cmlibrary/src/cmstorerulecontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Capsulating fill rules -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "cmstorerulecontainer.h" -#include "cmstorerule.h" -#include "msdebug.h" - -// CONSTANTS -const TInt KStoreRuleArrayGranularity = 16; - -// ======== LOCAL FUNCTIONS ======== -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRuleContainer* CCmStoreRuleContainer::NewL() - { - TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewL() start"))); - CCmStoreRuleContainer* self = CCmStoreRuleContainer::NewLC(); - CleanupStack::Pop( self ); - TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewL() end"))); - return self; - } - -// --------------------------------------------------------------------------- -// NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRuleContainer* CCmStoreRuleContainer::NewLC() - { - TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewLC() start"))); - CCmStoreRuleContainer* self = new ( ELeave ) CCmStoreRuleContainer(); - CleanupStack::PushL( self ); - self->ConstructL(); - TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::NewLC() end"))); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRuleContainer::~CCmStoreRuleContainer() - { - TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::\ - ~CCmStoreRuleContainer() start"))); - iStoreRuleArray.ResetAndDestroy(); - iStoreRuleArray.Close(); - TRACE(Print(_L("[COMMON]\t CCmStoreRuleContainer::\ - ~CCmStoreRuleContainer() end"))); - } - -// --------------------------------------------------------------------------- -// Add new rule into store rule -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmStoreRuleContainer::AddStoreRuleL( CCmStoreRule* aRule ) - { - iStoreRuleArray.AppendL( aRule ); - TInt index = iStoreRuleArray.Count() - 1; - return index; - } - -// --------------------------------------------------------------------------- -// Deletes store rule with the given index -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRuleContainer::DeleteStoreRule( TInt aIndex ) - { - if( iStoreRuleArray.Count() > aIndex ) - { - delete iStoreRuleArray[aIndex]; - iStoreRuleArray.Remove(aIndex); - iStoreRuleArray.Compress(); - } - } - -// --------------------------------------------------------------------------- -// Get rule -// --------------------------------------------------------------------------- -// -EXPORT_C CCmStoreRule* CCmStoreRuleContainer::StoreRule( TInt aIndex ) - { - return iStoreRuleArray[aIndex]; - } - -// --------------------------------------------------------------------------- -// Returns count of rules -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmStoreRuleContainer::StoreRuleCount() const - { - return iStoreRuleArray.Count(); - } - -// --------------------------------------------------------------------------- -// CCmFillRuleContainer::ExternalizeL -// Writes the content to stream. -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRuleContainer::ExternalizeL( - RWriteStream& aStream ) const - { - // Let's write the count of fill rules to stream first - aStream.WriteInt16L( iStoreRuleArray.Count() ); - for ( TInt index = 0; index < iStoreRuleArray.Count(); index++ ) - { - CCmStoreRule* rule = iStoreRuleArray[index]; - // Then the object itself - rule->ExternalizeL( aStream ); - } - } - -// --------------------------------------------------------------------------- -// CUPnPContainer::InternalizeL -// Fills container information from stream -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmStoreRuleContainer::InternalizeL( RReadStream& aStream ) - { - // Then internalize the objects - if ( iStoreRuleArray.Count() > KErrNone ) - { - iStoreRuleArray.ResetAndDestroy(); - } - // First the count of fill rules - TInt ruleCount = aStream.ReadInt16L(); - - // Then internalize them from the stream one by one - for (TInt index = 0; index < ruleCount; index++ ) - { - CCmStoreRule* newItem = CCmStoreRule::NewL(); - CleanupStack::PushL( newItem ); - newItem->InternalizeL( aStream ); - AddStoreRuleL( newItem ); - CleanupStack::Pop( newItem ); - newItem = NULL; - } - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmStoreRuleContainer::CCmStoreRuleContainer() : - iStoreRuleArray( KStoreRuleArrayGranularity ) - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmStoreRuleContainer::ConstructL() - { - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/bwins/cmsettingsengineu.def --- a/upnpharvester/common/cmsettings/bwins/cmsettingsengineu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - ?NewCmSettingsEngineL@CCmSettingsFactory@@SAPAVMCmSettings@@XZ @ 1 NONAME ; class MCmSettings * CCmSettingsFactory::NewCmSettingsEngineL(void) - ?NewCmSettingsEngineLC@CCmSettingsFactory@@SAPAVMCmSettings@@XZ @ 2 NONAME ; class MCmSettings * CCmSettingsFactory::NewCmSettingsEngineLC(void) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/data/10281FAB.txt Binary file upnpharvester/common/cmsettings/data/10281FAB.txt has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/data/keys_mediaservant.xls Binary file upnpharvester/common/cmsettings/data/keys_mediaservant.xls has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/eabi/cmsettingsengineu.def --- a/upnpharvester/common/cmsettings/eabi/cmsettingsengineu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - _ZN18CCmSettingsFactory20NewCmSettingsEngineLEv @ 1 NONAME - _ZN18CCmSettingsFactory21NewCmSettingsEngineLCEv @ 2 NONAME - _ZTI17CCmSettingsEngine @ 3 NONAME ; ## - _ZTV17CCmSettingsEngine @ 4 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/group/bld.inf --- a/upnpharvester/common/cmsettings/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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 information file for CM Settings Engine -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../inc/cmsettingsfactory.h |../../../../inc/cmsettingsfactory.h -../inc/cmsettings.h |../../../../inc/cmsettings.h - -// Central repository default keys -../data/10281FAB.txt /epoc32/release/winscw/udeb/z/private/10202be9/10281FAB.txt -../data/10281FAB.txt /epoc32/release/winscw/urel/z/private/10202be9/10281FAB.txt -../data/10281FAB.txt /epoc32/release/armv5/udeb/z/private/10202be9/10281FAB.txt -../data/10281FAB.txt /epoc32/release/armv5/urel/z/private/10202be9/10281FAB.txt - -PRJ_MMPFILES -cmsettingsengine.mmp - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/group/cmsettingsengine.mmp --- a/upnpharvester/common/cmsettings/group/cmsettingsengine.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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 project CM Settings Engine -* -*/ - - - - - - -#include -#include - -TARGET cmsettingsengine.dll -TARGETTYPE DLL -UID 0x1000008D 0x10281FAB - -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../src -SOURCE cmsettingsfactory.cpp -SOURCE cmsettingsengine.cpp - - -USERINCLUDE ../inc -USERINCLUDE ../../../../inc -USERINCLUDE ../../../../group - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY centralrepository.lib -LIBRARY upnpserviceframework.lib -LIBRARY cmcommon.lib -LIBRARY PlatformEnv.lib -LIBRARY upnpsettingsengine.lib - -DEBUGLIBRARY flogger.lib - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/inc/cmsettings.h --- a/upnpharvester/common/cmsettings/inc/cmsettings.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CM Settings class -* -*/ - - - - - - - -#ifndef M_CCMSETTINGS_H -#define M_CCMSETTINGS_H - -// INCLUDES -#include -#include "cmcommon.h" - -// FORWARD DECLARATIONS -class CRepository; -class CCmDriveInfo; -class RFs; - -/** - * Defines the cmsettings interface - * - * This class defines the cmsettings interface. Provides methods to - * execute fill specific services - * - * @lib cmsettings.lib - * @since S60 v3.2 - */ -class MCmSettings - { - -public: // New functions - - /** - * Gets the status for the Content Manager service - * - * @since S60 3.1 - * @param aService indicates service - * @param aState state enum is returned here - * @return status of the operation - */ - virtual TInt GetServiceState( const TCmService aService, - TCmServiceState& aState ) const = 0; - - /** - * Sets Content Manager service state - * - * @since S60 3.1 - * @param aState TCmServerState to indicate state - * @return status of the operation - */ - virtual TInt SetServiceState( const TCmService aService, - const TCmServiceState aState ) = 0; - - /** - * Gets defined MMC information. - * - * @since S60 3.1 - * @param aName MMC card's name (max length KMaxFileName) - * @param aId MMC car's unique id - * @return status of the operation - */ -// virtual TInt GetMmcInformation( TDes& aName, TUint& aId ) const = 0; - - - /** - * Sets defined MMC information. - * - * @since S60 3.1 - * @param aName MMC card's name (max length KMaxFileName) - * @param aId MMC car's unique id - * @return status of the operation - */ -// virtual TInt SetMmcInformation( const TDesC& aName, const TUint aId ) = 0; - - - /** - * Gets defined IAP information. - * - * @since S60 3.1 - * @param aIap access point info is stored here - * @return status of the operation - */ - virtual TInt GetIapL( TInt& aIap ) const = 0; - - /** - * Gets next runtime information for the specified service. - * - * @since S60 3.1 - * @param aService content manager service - * @param aRuntime the next date and time service is run. - * @return status of the operation - */ - virtual TInt GetNextRuntime( const TCmService aService, - TTime& aRuntime ) const = 0; - - - /** - * Sets next runtime information for the specified service. - * - * @since S60 3.1 - * @param aService content manager service - * @param aNextTime the next date and time service is run. - * @return status of the operation - */ - virtual TInt SetNextRuntime( const TCmService aService, - const TTime aRuntime ) = 0; - - - /** - * Gets device discovery delay - * - * @since S60 3.1 - * @param aDelay device discovery delay - * @return status of the operation - */ - virtual TInt GetDiscoveryDelay( TInt& aDelay ) const = 0; - - - /** - * Sets device discovery delay - * - * @since S60 3.1 - * @param aDelay device discovery delay - * @return status of the operation - */ - virtual TInt SetDiscoveryDelay( const TInt aDelay ) = 0; - - - /** - * Gets automatic sync settings - * - * @since S60 3.1 - * @param aAutoSync automatic sync settings - * @return status of the operation - */ - virtual TInt GetAutoSync( TBool& aAutoSync ) const = 0; - - - /** - * Sets automatic sync settings - * - * @since S60 3.1 - * @param aAutoSync automatic sync settings - * @return status of the operation - */ - virtual TInt SetAutoSync( const TBool aAutoSync ) = 0; - - /** - * Gets memory manager status - * - * @since S60 3.1 - * @param aMmStatus memory manager status - * @return status of the operation - */ - virtual TInt GetMemoryManagerStatus( TBool& aMmStatus ) const = 0; - - /** - * Sets memory manager status - * - * @since S60 3.1 - * @param aMmStatus memory manager status - * @return status of the operation - */ - virtual TInt SetMemoryManagerStatus( const TBool aMmStatus ) = 0; - - /** - * Gets search item count - * - * @since S60 3.1 - * @param aItemCount result item count - * @return status of the operation - */ - virtual TInt GetSearchCount( TInt& aItemCount ) const = 0; - - /** - * Gets add item count - * - * @since S60 3.1 - * @param aItemCount result item count - * @return status of the operation - */ - virtual TInt GetAddCount( TInt& aItemCount ) const = 0; - - /** - * ??? - * - * @since S60 3.1 - * @param aAppWizardState ?? - * @return TInt ??? - */ - virtual TInt GetAppWizardInformation( TInt& aAppWizardState ) const = 0; - - /** - * ??? - * - * @since S60 3.1 - * @return TInt ??? - */ - virtual TInt SetAppWizardInformation() = 0; - - /** - * ??? - * - * @since S60 3.1 - * @param aFs ?? - * @param aDrives ?? - */ - virtual void DriveListL( RFs& aFs, - RPointerArray& aDrives ) const = 0; - - /** - * Deletes the object - * - * @since S60 3.1 - */ - virtual void Close() = 0; - - }; - - -#endif // M_CCMSETTINGS_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/inc/cmsettingsengine.h --- a/upnpharvester/common/cmsettings/inc/cmsettingsengine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,241 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CM Settings Engine main class -* -*/ - - - - - - - -#ifndef C_CCMSETTINGSENGINE_H -#define C_CCMSETTINGSENGINE_H - -// INCLUDES -#include -#include "cmcommon.h" -#include "cmsettings.h" - -// FORWARD DECLARATIONS -class CRepository; -class CCmDriveInfo; -class RFs; - -/** - * Settings engine class for the cenrep keys - * - * Provides interface to get persistent settings information - * for different ContentManager modules. - * - * @lib cmsettingsengine - * @since S60 3.1 - */ -class CCmSettingsEngine : public CBase, - public MCmSettings - { - -public: // Constructors and destructor - - // 2-phase constructor - static CCmSettingsEngine* NewL(); - - // 2-phase constructor - static CCmSettingsEngine* NewLC(); - - // Destructor - virtual ~CCmSettingsEngine(); - -public: // New functions - - /** - * Gets the status for the Content Manager service - * - * @since S60 3.1 - * @param aService indicates service - * @param aState state enum is returned here - * @return status of the operation - */ - TInt GetServiceState( const TCmService aService, - TCmServiceState& aState ) const; - - /** - * Sets Content Manager service state - * - * @since S60 3.1 - * @param aState TCmServerState to indicate state - * @return status of the operation - */ - TInt SetServiceState( const TCmService aService, - const TCmServiceState aState ); - - /** - * Gets defined IAP information. - * - * @since S60 3.1 - * @param aIap access point info is stored here - * @return status of the operation - */ - TInt GetIapL( TInt& aIap ) const; - - /** - * Gets next runtime information for the specified service. - * - * @since S60 3.1 - * @param aService content manager service - * @param aRuntime the next date and time service is run. - * @return status of the operation - */ - TInt GetNextRuntime( const TCmService aService, - TTime& aRuntime ) const; - - - /** - * Sets next runtime information for the specified service. - * - * @since S60 3.1 - * @param aService content manager service - * @param aNextTime the next date and time service is run. - * @return status of the operation - */ - TInt SetNextRuntime( const TCmService aService, - const TTime aRuntime ); - - - /** - * Gets device discovery delay - * - * @since S60 3.1 - * @param aDelay device discovery delay - * @return status of the operation - */ - TInt GetDiscoveryDelay( TInt& aDelay ) const; - - - /** - * Sets device discovery delay - * - * @since S60 3.1 - * @param aDelay device discovery delay - * @return status of the operation - */ - TInt SetDiscoveryDelay( const TInt aDelay ); - - - /** - * Gets automatic sync settings - * - * @since S60 3.1 - * @param aAutoSync automatic sync settings - * @return status of the operation - */ - TInt GetAutoSync( TBool& aAutoSync ) const; - - - /** - * Sets automatic sync settings - * - * @since S60 3.1 - * @param aAutoSync automatic sync settings - * @return status of the operation - */ - TInt SetAutoSync( const TBool aAutoSync ); - - /** - * Gets memory manager status - * - * @since S60 3.1 - * @param aMmStatus memory manager status - * @return status of the operation - */ - TInt GetMemoryManagerStatus( TBool& aMmStatus ) const; - - /** - * Sets memory manager status - * - * @since S60 3.1 - * @param aMmStatus memory manager status - * @return status of the operation - */ - TInt SetMemoryManagerStatus( const TBool aMmStatus ); - - /** - * Gets search item count - * - * @since S60 3.1 - * @param aItemCount result item count - * @return status of the operation - */ - TInt GetSearchCount( TInt& aItemCount ) const; - - /** - * Gets add item count - * - * @since S60 3.1 - * @param aItemCount result item count - * @return status of the operation - */ - TInt GetAddCount( TInt& aItemCount ) const; - - /** - * ??? - * - * @since S60 3.1 - * @param aAppWizardState ?? - * @return TInt ??? - */ - TInt GetAppWizardInformation( TInt& aAppWizardState ) const; - - /** - * ??? - * - * @since S60 3.1 - * @return TInt ??? - */ - TInt SetAppWizardInformation(); - - /** - * ??? - * - * @since S60 3.1 - * @param aFs ?? - * @param aDrives ?? - */ - void DriveListL( RFs& aFs, - RPointerArray& aDrives ) const; - - /** - * Deletes the object - * - * @since S60 3.1 - */ - void Close(); - -private: - CCmSettingsEngine(); - - void ConstructL(); - -private: // data - - /** - * Central Repository access - */ - CRepository* iRepository; // owned - - }; - - -#endif // C_CCMSETTINGSENGINE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/inc/cmsettingsfactory.h --- a/upnpharvester/common/cmsettings/inc/cmsettingsfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +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: Abstract factory for CMSettings -* -*/ - - - - - - - -#ifndef C_CMSETTINGSFACTORY_H -#define C_CMSETTINGSFACTORY_H - -#include -#include - -/* Forward declarations. */ -class MCmSettings; - -/** - * Abstract factory for CMSettings - * - * @lib cmsettings.lib - * @since S60 v3.1 - */ -class CCmSettingsFactory : public CBase - { - -public: - - /** - * Creates a new instance of CSSettings - * @return pointer to CCmSettingsEngine class - */ - IMPORT_C static MCmSettings* NewCmSettingsEngineL(); - - /** - * Creates a new instance of CSSettings. Instance is left in - * cleanup stack. - * @return pointer to CCmSettingsEngine class - */ - IMPORT_C static MCmSettings* NewCmSettingsEngineLC(); - - }; - -#endif // C_CMSETTINGSFACTORY_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/inc/contentmanagercrkeys.h --- a/upnpharvester/common/cmsettings/inc/contentmanagercrkeys.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2005 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: -* Definitions of internal keys related to Content Manager -* settings in CenRep -* -*/ - - - - - -#ifndef CONTENTMANAGERCRKEYS_H -#define CONTENTMANAGERCRKEYS_H - -#include - - -/** - * Content Manager UID - * - */ -const TUid KCRUidCmContentManager = {0x10281FAB}; - -/** - * KCmContentManagerState - * Defines persistent state information of the Content Manager - * - */ -const TUint32 KCmContentManagerState = 0x00000101; - -/** - * KCmHarvesterState - * Defines persistent state information of the metadata harvester - * - */ -const TUint32 KCmHarvesterState = 0x00000102; - -/** - * KCmFillState - * Defines whether fill service state. - * - */ -const TUint32 KCmFillState = 0x00000103; - -/** - * KCmStoreState - * Defines whether store service state. - * - */ -const TUint32 KCmStoreState = 0x00000104; - -/** - * KCmMemoryManagerState - * Defines whether memory manager state. - */ -const TUint32 KCmMemoryManagerState = 0x00000105; - -/** - * KCmNextHarvestTime - * Defines the date/time when next harvesting starts - */ -const TUint32 KCmNextHarvestTime = 0x00000106; - -/** - * KCmHarvestValue - * Defines the harvesting period. - */ -const TUint32 KCmHarvestPeriod = 0x00000107; - -/** - * KCmNextFillTime - * Defines the date/time when next content fill starts - */ -const TUint32 KCmNextFillTime = 0x00000108; - -/** - * KCmFillPeriod - * Defines the content fill period. - */ -const TUint32 KCmFillPeriod = 0x00000109; - -/** - * KCmNextStoreTime - * Defines the date/time when next content store starts - */ -const TUint32 KCmNextStoreTime = 0x0000010A; - -/** - * KCmStorePeriod - * Defines the content store period. - */ -const TUint32 KCmStorePeriod = 0x0000010B; - -/** - * KCmDiscoveryDelay - * Maximum time for device discovery - */ -const TUint32 KCmDiscoveryDelay = 0x0000010C; - -/** - * KCmAutoSync - * Automatic synchronization state - */ -const TUint32 KCmAutoSync = 0x0000010D; - -/** - * KCmSearchCount - * Item count for search - */ -const TUint32 KCmSearchCount = 0x0000010E; - -/** - * KCmSearchCount - * Item count for database adding - */ -const TUint32 KCmAddCount = 0x0000010F; - -/** - * KCmAppWizardState - * MediaServant wizard state - */ -const TUint32 KCmAppWizardState = 0x00000110; - -#endif // CONTENTMANAGERCRKEYS_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/src/cmsettingsengine.cpp --- a/upnpharvester/common/cmsettings/src/cmsettingsengine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,535 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CM Settings Engine implementation -* -*/ - - - - - - -#include -#include -#include -#include -#include -#ifdef __SERIES60_31__ -#include -#else -#include "upnpsettingsengine.h" -#endif -#include "cmdriveinfo.h" -#include - -#include "msdebug.h" -#include "cmsettingsengine.h" -#include "contentmanagercrkeys.h" - - -// Constants - -const TInt KTimeLength = 64; - - -// ======== MEMBER FUNCTIONS ======== - - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSettingsEngine::CCmSettingsEngine() - { - } - - -// --------------------------------------------------------------------------- -// Two-phase constructor -// --------------------------------------------------------------------------- -// -void CCmSettingsEngine::ConstructL() - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::ConstructL")); - - iRepository = CRepository::NewL( KCRUidCmContentManager ); - } - - -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmSettingsEngine* CCmSettingsEngine::NewL() - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::NewL")); - - CCmSettingsEngine* self = CCmSettingsEngine::NewLC(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmSettingsEngine* CCmSettingsEngine::NewLC() - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::NewLC")); - - CCmSettingsEngine* self = new( ELeave ) CCmSettingsEngine; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmSettingsEngine::~CCmSettingsEngine() - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::~CCmSettingsEngine")); - - delete iRepository; - } - - -// --------------------------------------------------------------------------- -// Gets Content Manager service's state -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetServiceState( - const TCmService aService, - TCmServiceState& aState ) const - { - TInt error( KErrNone ); - TInt state( 0 ); - - switch ( aService ) - { - case ECmServiceContentManager: - { - error = iRepository->Get( KCmContentManagerState, state ) ; - break; - } - case ECmServiceHarvest: - { - error = iRepository->Get( KCmHarvesterState, state ) ; - break; - } - case ECmServiceFill: - { - error = iRepository->Get( KCmFillState, state ) ; - break; - } - case ECmServiceStore: - { - error = iRepository->Get( KCmStoreState, state ) ; - break; - } - case ECmServiceMemoryManager: - { - error = iRepository->Get( KCmMemoryManagerState, state ) ; - break; - } - default: - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetServiceState \ - service not found")); - error = KErrNotFound; - break; - } - } - - if ( !error ) - { - TRACE(Print(_L("[CmSettinsEngine]\t CCmSettingsEngine::\ - GetServiceState state = %d"), state )); - // converting the value back - aState = (TCmServiceState) state; - } - - return error; - } - -// --------------------------------------------------------------------------- -// Set Content Manager service state -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::SetServiceState( - const TCmService aService, - const TCmServiceState aState ) - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetServiceState")); - - TInt error( KErrNone ); - - switch ( aService ) - { - case ECmServiceContentManager: - { - error = iRepository->Set( KCmContentManagerState, (TInt)aState ) ; - break; - } - case ECmServiceHarvest: - { - error = iRepository->Set( KCmHarvesterState, (TInt)aState ) ; - break; - } - case ECmServiceFill: - { - error = iRepository->Set( KCmFillState, (TInt)aState ) ; - break; - } - case ECmServiceStore: - { - error = iRepository->Set( KCmStoreState, (TInt)aState ) ; - break; - } - case ECmServiceMemoryManager: - { - error = iRepository->Set( KCmMemoryManagerState, (TInt)aState ) ; - break; - } - default: - { - error = KErrNotFound; - break; - } - } - - return error; - } - -// --------------------------------------------------------------------------- -// Gets IAP information from Home Network's cenrep key -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetIapL( TInt& aIap ) const - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetIapL")); - -#ifdef __SERIES60_31__ - CUpnpNetworkAccess* access = CUpnpNetworkAccess::NewL( KCRUidUPnPStack ); - TInt error( access->Get( CUpnpNetworkAccess::KUPnPStackIapId, aIap ) ); - delete access; -#else - CUPnPSettingsEngine* settings = CUPnPSettingsEngine::NewLC(); - TInt error( settings->GetAccessPoint( aIap ) ); - CleanupStack::PopAndDestroy( settings ); -#endif - return error; - } - -// --------------------------------------------------------------------------- -// Gets next start time information for specified service -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetNextRuntime( const TCmService aService, - TTime& aRuntime ) const - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetNextRuntime")); - - TBuf time; - TPtrC timePtr( time ); - TInt error( KErrNone ); - - if ( aService == ECmServiceStore ) - { - error = iRepository->Get( KCmNextStoreTime, time ); - } - else // ECmServiceFill - { - error = iRepository->Get( KCmNextFillTime, time ); - } - - if ( !error ) - { - // convert string to TInt64 - TInt64 timeInt; - TLex lex( timePtr ); - lex.Val( timeInt ); - aRuntime = timeInt; - } - - return error; - } - - -// --------------------------------------------------------------------------- -// Sets next start time information for specified service -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::SetNextRuntime( const TCmService aService, - const TTime aNextTime ) - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetNextRuntime")); - - TInt error( KErrNone ); - TBuf nextRunTime; - nextRunTime.AppendNum( aNextTime.Int64() ); - - if (aService == ECmServiceStore) - { - error = iRepository->Set( KCmNextStoreTime, nextRunTime ); - } - else // ECmServiceFill - { - error = iRepository->Set( KCmNextFillTime, nextRunTime ) ; - } - - return error; - } - -// --------------------------------------------------------------------------- -// Gets discovery delay. -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetDiscoveryDelay( TInt& aDelay ) const - { - TInt error( KErrNone ); - - error = iRepository->Get( KCmDiscoveryDelay, aDelay ); - TRACE(Print(_L("[CmSettinsEngine]\t CCmSettingsEngine::\ - GetDiscoveryDelay delay = %d"), aDelay)); - - return error; - } - - -// --------------------------------------------------------------------------- -// Sets discovery delay -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::SetDiscoveryDelay( const TInt aDelay ) - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetDiscoveryDelay")); - - return iRepository->Set( KCmDiscoveryDelay, aDelay ); - } - -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetAutoSync( TBool& aAutoSync ) const - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetAutoSync")); - - TInt error( KErrNotFound ); - - TInt autoSyncInt; - error = iRepository->Get( KCmAutoSync, autoSyncInt ); - - aAutoSync = (TBool) autoSyncInt; - return error; - } - -// --------------------------------------------------------------------------- -// Sets synchronization state -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::SetAutoSync( const TBool aAutoSync ) - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetAutoSync")); - - return iRepository->Set( KCmAutoSync, (TInt)aAutoSync ) ; - } - -// --------------------------------------------------------------------------- -// Gets memory manager's status -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetMemoryManagerStatus( - TBool& aMmStatus ) const - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetMemoryManagerStatus")); - - TInt mmInt; - - TInt error = iRepository->Get( KCmMemoryManagerState, mmInt ); - - if ( !error ) - { - aMmStatus = (TBool) mmInt; - } - - return error; - } - -// --------------------------------------------------------------------------- -// Sets memory manager's status -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::SetMemoryManagerStatus( - const TBool aMmStatus ) - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::SetMemoryManagerStatus")); - - return iRepository->Set( KCmMemoryManagerState, (TInt)aMmStatus ) ; - } - -// --------------------------------------------------------------------------- -// Gets item count for search action -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetSearchCount( TInt& aItemCount ) const - { - TInt error( KErrNone ); - error = iRepository->Get( KCmSearchCount, aItemCount ); - TRACE(Print(_L("[CmSettinsEngine]\t CCmSettingsEngine::\ - GetSearchCount count = %d"), aItemCount)); - - return error; - } - -// --------------------------------------------------------------------------- -// Gets item count for database add operation -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetAddCount( TInt& aAddCount ) const - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::GetAddCount")); - - return iRepository->Get( KCmAddCount, aAddCount ); - } - - -// --------------------------------------------------------------------------- -// Gets app wizard execution status info. -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::GetAppWizardInformation( - TInt& aAppWizardState ) const - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::\ - GetAppWizardInformation")); - - return iRepository->Get( KCmAppWizardState, aAppWizardState ); - } - -// --------------------------------------------------------------------------- -// Sets app wizard execution status info. -// --------------------------------------------------------------------------- -// -TInt CCmSettingsEngine::SetAppWizardInformation() - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::\ - SetAppWizardInformation")); - - - // application wizard run -> set status 1 - return iRepository->Set( KCmAppWizardState, 1 ) ; - } - - -// --------------------------------------------------------------------------- -// Gets information about MCs drives -// --------------------------------------------------------------------------- -// -void CCmSettingsEngine::DriveListL( - RFs& aFs, - RPointerArray& aDrives ) const - { - LOG(_L("[CmSettinsEngine]\t CCmSettingsEngine::DriveListL")); - - - TDriveList list; - TDriveInfo info; - - aFs.DriveList( list ); - - TInt drive( KErrNotFound ); - TInt error = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, - drive ); - TRACE( Print(_L("[CmSettinsEngine]\t GetDefaultDrive error = %d, drive = %d"), - error, drive ) ); - - - for( TInt driveNumber = 0 ; driveNumber <= EDriveZ ; driveNumber++ ) - { - if( list[driveNumber] ) // is drive available - { - TUint drvStatus( 0 ); - aFs.Drive( info, driveNumber ); - - TRACE( Print(_L("[CmSettinsEngine]\t drivenumber = %d"), - driveNumber ) ); - User::LeaveIfError(DriveInfo::GetDriveStatus( aFs, - driveNumber, - drvStatus ) ); - - TRACE( Print(_L("[CmSettinsEngine]\t removable drive = %d"), - drvStatus & DriveInfo::EDriveRemovable ) ); - - TInt removableStatus = drvStatus & DriveInfo::EDriveRemovable; - // Check if drive is internal hard disc or memory card - if( - ((!error && driveNumber == drive ) && !removableStatus ) || - ( removableStatus && ( info.iType != EMediaNotPresent ) ) ) - { - - TRACE( Print(_L("[CmSettinsEngine]\t info.iType = %d"), - info.iType ) ); - TRACE( Print(_L("[CmSettinsEngine]\t info.iDriveAtt = %d"), - info.iDriveAtt ) ); - - HBufC* memoryCardName = NULL; - CCmDriveInfo* driveInfo = CCmDriveInfo::NewLC(); - TVolumeInfo volInfo; - aFs.Volume( volInfo, driveNumber ); - - TRACE( Print(_L("[CmSettinsEngine]\t volInfo.iName = %S"), - &volInfo.iName ) ); - - if ( volInfo.iName.Compare( KNullDesC() ) ) - { - memoryCardName = volInfo.iName.AllocLC(); - driveInfo->SetDriveNameL( *memoryCardName ); - } - else - { - driveInfo->SetDriveNameL( KNullDesC() ); - } - // collect drive information - driveInfo->SetDriveNumber( driveNumber ); - driveInfo->SetDriveType( removableStatus ); - driveInfo->SetDriveSize( volInfo.iSize ); - driveInfo->SetDriveId( volInfo.iUniqueID ); - - aDrives.AppendL( driveInfo ); - - if ( memoryCardName ) - { - CleanupStack::PopAndDestroy( memoryCardName ); - } - CleanupStack::Pop( driveInfo ); - } - } - } - } - -// --------------------------------------------------------------------------- -// Deletes the object -// --------------------------------------------------------------------------- -// -void CCmSettingsEngine::Close() - { - delete this; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsettings/src/cmsettingsfactory.cpp --- a/upnpharvester/common/cmsettings/src/cmsettingsfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: The factory for CMSettings -* -*/ - - - - - - -#include "cmsettingsfactory.h" -#include "cmsettingsengine.h" -#include "cmsettings.h" - - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// Constructor -// -------------------------------------------------------------------------- -// -EXPORT_C MCmSettings* CCmSettingsFactory::NewCmSettingsEngineL() - { - return CCmSettingsEngine::NewL(); - } - -// -------------------------------------------------------------------------- -// Constructor -// -------------------------------------------------------------------------- -// -EXPORT_C MCmSettings* CCmSettingsFactory::NewCmSettingsEngineLC() - { - return CCmSettingsEngine::NewLC(); - } - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/bwins/cmsqlwrapperu.def --- a/upnpharvester/common/cmsqlwrapper/bwins/cmsqlwrapperu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - ?NewCmSqlMainL@CCmSqlMainFactory@@SAPAVMCmSqlMain@@AAVRFs@@@Z @ 1 NONAME ; class MCmSqlMain * CCmSqlMainFactory::NewCmSqlMainL(class RFs &) - ?NewCmSqlMainLC@CCmSqlMainFactory@@SAPAVMCmSqlMain@@AAVRFs@@@Z @ 2 NONAME ; class MCmSqlMain * CCmSqlMainFactory::NewCmSqlMainLC(class RFs &) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/eabi/cmsqlwrapperu.def --- a/upnpharvester/common/cmsqlwrapper/eabi/cmsqlwrapperu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -EXPORTS - _ZN17CCmSqlMainFactory13NewCmSqlMainLER3RFs @ 1 NONAME - _ZN17CCmSqlMainFactory14NewCmSqlMainLCER3RFs @ 2 NONAME - _ZTI10CCmSqlMain @ 3 NONAME ; ## - _ZTI14CCmSqlDbClause @ 4 NONAME ; ## - _ZTI16CCmSqlConnection @ 5 NONAME ; ## - _ZTI19CCmSqlDbMaintenance @ 6 NONAME ; ## - _ZTV10CCmSqlMain @ 7 NONAME ; ## - _ZTV14CCmSqlDbClause @ 8 NONAME ; ## - _ZTV16CCmSqlConnection @ 9 NONAME ; ## - _ZTV19CCmSqlDbMaintenance @ 10 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/group/bld.inf --- a/upnpharvester/common/cmsqlwrapper/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 information file for SQL wrapper -* -*/ - - -// Supported platforms -PRJ_PLATFORMS -DEFAULT - - -PRJ_EXPORTS -../inc/cmsqlmainfactory.h |../../../../inc/cmsqlmainfactory.h -../inc/mcmsqlmain.h |../../../../inc/mcmsqlmain.h - -// MMP files -PRJ_MMPFILES -cmsqlwrapper.mmp diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/group/cmsqlwrapper.mmp --- a/upnpharvester/common/cmsqlwrapper/group/cmsqlwrapper.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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 project SQL wrapper -* -*/ - - - - - - -#include - -TARGET cmsqlwrapper.dll -TARGETTYPE dll -UID 0x1000008d 0x1028290D - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH /sys/bin - -USERINCLUDE ../inc -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src - -SOURCE cmsqlmain.cpp -SOURCE cmsqlmainfactory.cpp -SOURCE cmsqldbmaintenance.cpp -SOURCE cmsqlconnection.cpp -SOURCE cmsqldbclause.cpp - -LIBRARY bafl.lib -LIBRARY sqldb.lib -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY cmcommon.lib -LIBRARY charconv.lib -DEBUGLIBRARY flogger.lib - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/cmsqlclausedef.h --- a/upnpharvester/common/cmsqlwrapper/inc/cmsqlclausedef.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +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: SQL clause definitions -* -*/ - - - - - - -#ifndef __CMSQLCLAUSEDEF_H__ -#define __CMSQLCLAUSEDEF_H__ - -// --------------------------------------------------------------------------- -// Misc definitions -// --------------------------------------------------------------------------- -// - -_LIT8( KCmSqlEmpty, "" ); -_LIT8( KCmSqlSpace, " " ); -_LIT8( KCmSqlLeftBracket, " ( " ); -_LIT8( KCmSqlRightBracket, " ) " ); -_LIT8( KCmSqlComma, ", " ); -_LIT8( KCmSqlDot, "." ); -_LIT8( KCmSqlEqual, " = " ); -_LIT8( KCmSqlGreater, " >= " ); -_LIT8( KCmSqlSmaller, " <= " ); -_LIT8( KCmSqlLike, " LIKE " ); -_LIT8( KCmSqlSemicolon, ";" ); -_LIT8( KCmSqlVariable, "? " ); -_LIT8( KCmSqlAppendString, "%S " ); -_LIT8( KCmSqlConsistOf, " %%S% " ); -_LIT8( KCmSqlBeginsWith, " %S% " ); -_LIT8( KCmSqlEndsWith, " %%S " ); -_LIT8( KCmSqlAppendInteger, "%d " ); -_LIT8( KCmSqlAppendLong, "%ld " ); - -_LIT8( KCmSqlDummyTrueCriteria, "1 " ); -_LIT8( KCmSqlDummyFalseCriteria, "0 " ); - -_LIT8( KCmSqlSelect, "SELECT " ); -_LIT8( KCmSqlFrom, "FROM " ); -_LIT8( KCmSqlAs, "AS " ); -_LIT8( KCmSqlIn, "IN " ); -_LIT8( KCmSqlOr, "OR" ); -_LIT8( KCmSqlAnd, "AND " ); -_LIT8( KCmSqlAll, "* " ); -_LIT8( KCmSqlOrderByDate, "ORDER BY Date " ); -_LIT8( KCmSqlOrderByRandom, "ORDER BY Random() " ); -_LIT8( KCmSqlLimit, "LIMIT " ); -_LIT8( KCmSqlOffset, "OFFSET " ); -_LIT8( KCmSqlAsc, "ASC "); -_LIT8( KCmSqlDesc, "DESC " ); -_LIT8( KCmSqlSortValue, "sortvalue" ); // Used when sorting object - // query by property value - -_LIT8( KCmSqlCollateNoCase, " COLLATE NOCASE " ); // case insensitive sort - -_LIT8( KCmSqlBaseSelect, - "SELECT Title, Date, Size, Uri, DeviceId, ItemId, Id " - "FROM Items WHERE (" - ); - -_LIT8( KCmSqlMusicSelect, "SELECT Title, a.Value, Size, Uri, DeviceId, " - "ItemId, Id FROM Items LEFT JOIN Artists a " - "ON Items.ArtistId = a.ArtistId LEFT JOIN Albums b " - "ON Items.AlbumId = b.AlbumId " - "WHERE (" - ); - -_LIT8( KCmSqlSelectArtistById, "Items.ArtistId = " ); -_LIT8( KCmSqlSelectAlbumById, "Items.AlbumId = " ); -_LIT8( KCmSqlSelectGenreById, "Items.GenreId = " ); -_LIT8( KCmSqlSelectResolutionById, "Items.ResolutionId = " ); -_LIT8( KCmSqlSelectUpnpclassById, "Items.UpnpclassId = " ); -_LIT8( KCmSqlFilterUpnpProfileId, "Items.ProfileId != " ); - -_LIT8( KCmSqlSelectTitle, "Items.Id = " ); -_LIT8( KCmSqlSelectDuration, "Items.Duration " ); -_LIT8( KCmSqlSelectBitrate, "Items.Bitrate " ); -_LIT8( KCmSqlSelectSize, "Items.Size " ); -_LIT8( KCmSqlSelectDeviceId, "Items.DeviceId = "); -_LIT8( KCmSqlSelectDate, "Items.Date "); -_LIT8( KCmSqlArtist, "Artists " ); -_LIT8( KCmSqlAlbum, "Albums " ); -_LIT8( KCmSqlGenre, "Genres " ); -_LIT8( KCmSqlUpnpclass, "Upnpclasses " ); -_LIT8( KCmSqlResolutions, "Resolutions " ); -_LIT8( KCmSqlUpnpProfiles, "UpnpProfiles " ); - -_LIT8( KCmSqlArtistId, "ArtistId" ); -_LIT8( KCmSqlAlbumId, "AlbumId" ); -_LIT8( KCmSqlGenreId, "GenreId" ); -_LIT8( KCmSqlProfileId, "ProfileId" ); -_LIT8( KCmSqlUpnpclassId, "UpnpclassId" ); -_LIT8( KCmSqlResolutionId, "ResolutionId" ); - -_LIT8( KCmSqlSelectMediatype, " ( Mediatype = %d ) " ); -_LIT8( KCmSqlFreeTextSelectAudio, - "( Items.Title LIKE \'%%%S%%\' ) OR ( a.Value LIKE \'%%%S%%\' ) OR " - "( b.Value LIKE \'%%%S%%\' ) " ); - -_LIT8( KCmSqlFreeTextSelectImageOrVideo, "( Items.Title LIKE \'%%%S%%\' ) " ); - -_LIT8(KCmSqlBeginTransaction, "BEGIN;"); -_LIT8(KCmSqlCommit, "COMMIT;"); - -_LIT8( KCmSqlSelectMaxIndex, "SELECT count(*) FROM %S" ); - -_LIT8( KCmSqlSelectMaxPropertyIndex, "SELECT MAX( %S ) FROM %S" ); - -_LIT8( KCmSqlSelectMaxItemIndex, "SELECT MAX( Id ) FROM Items;" ); - -_LIT8( KCmSqlSelectItemId, "SELECT Id FROM Items WHERE " - "( LOWER(Title) = ? AND Size = ? AND DeviceId = ? )" - ); - -_LIT8( KCmSqlFilteredPropertySelect, "SELECT Items.Id, Items.Title, " - "Items.ArtistId, b.Value, Items.AlbumId, a.Value, Items.GenreId, " - "c.Value FROM Items LEFT JOIN Artists b " - "ON Items.ArtistId = b.ArtistId LEFT JOIN Albums a " - "ON Items.AlbumId = a.AlbumId LEFT JOIN Genres c " - "ON Items.GenreId = c.GenreId " - "WHERE Items.Mediatype = 2 " - ); - -_LIT8( KCmSqlFilteredPropertySelectVideo, "SELECT Id, Title " - "FROM Items WHERE Mediatype = 0 " - ); - -_LIT8( KCmSqlWhere, - "WHERE " - ); - -// --------------------------------------------------------------------------- -// INSERT STATEMENTS -// --------------------------------------------------------------------------- -// -// Inserting item -_LIT8( KCmSqlInsertItem, - "INSERT INTO Items( " - "ItemId, Hash, Uri, Title, AlbumArtUri, DeviceId, Duration, Bitrate, " - "Date, HarvestDate, Size, Mediatype, UpnpclassId, ArtistId, AlbumId, " - "GenreId, ResolutionId, ProfileId, SearchId )" - "VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );" - ); - -// Inserting resource -_LIT8( KCmSqlInsertResource, - "INSERT INTO Resources( " - "ResItemId, ResResolution, ResUri, Size, ResDuration, ResBitrate )" - "VALUES( ?, ?, ?, ?, ?, ? );" - ); - -// Inserting artist into artist table -_LIT8( KCmSqlInsertArtist, - "INSERT INTO Artists( " - "Value ) " - "VALUES( ? );" - ); - -// Inserting album into album table -_LIT8( KCmSqlInsertAlbum, - "INSERT INTO Albums( " - "Value ) " - "VALUES( ? );" - ); - -// Inserting genre into genre table -_LIT8( KCmSqlInsertGenre, - "INSERT INTO Genres( " - "Value ) " - "VALUES( ? );" - ); - -// Inserting upnp class into upnp class table -_LIT8( KCmSqlInsertUpnpclass, - "INSERT INTO Upnpclasses( " - "Value ) " - "VALUES( ? );" - ); - -// Inserting upnp class into upnp class table -_LIT8( KCmSqlInsertUpnpProfile, - "INSERT INTO UpnpProfiles( " - "Value ) " - "VALUES( ? );" - ); - -// Inserting resolution into resolution table -_LIT8( KCmSqlInsertResolution, - "INSERT INTO Resolutions( " - "Value, Width, Height, PixelCount ) " - "VALUES( ?, ?, ?, ? );" - ); - -// --------------------------------------------------------------------------- -// SELECT STATEMENTS -// --------------------------------------------------------------------------- -// -// Selecting items harvested from the defined server -_LIT8( KCmSqlSelectGenericItem, - "SELECT Id, ItemId, Hash, SearchId " - "FROM Items " - "WHERE DeviceId = ? " - "ORDER BY Hash;" - ); - -_LIT8( KCmSqlSelectPropertyValues, - "SELECT * FROM %S " - "ORDER BY Value;" - ); - -_LIT8( KCmSqlValidateTableExistence, - "SELECT count(*)" - " FROM Items;" - ); - -_LIT8( KCmSqlSelectTitleAndId, - "SELECT Id, Title " - "FROM Items " - "WHERE MediaType = %d " - "ORDER BY Title;" - ); - -_LIT8( KCmSqlSelectMediaCount, - "SELECT count(*) FROM Items WHERE Mediatype = ?;" - ); - -_LIT8( KCmSqlSelectLimitHarvestDate, - "SELECT HarvestDate FROM Items WHERE ( Mediatype = ? ) ORDER BY " - "HarvestDate ASC LIMIT ?;" - ); - -// --------------------------------------------------------------------------- -// DELETE STATEMENTS -// --------------------------------------------------------------------------- -// -_LIT8( KCmSqlDeleteItem, - "DELETE FROM Items " - "WHERE Id = ? ;" - ); - -_LIT8( KCmSqlDeleteResource, - "DELETE FROM Resources " - "WHERE ResItemId = ? ;" - ); - -_LIT8( KCmSqlDeleteMetadata, - "DELETE FROM Items WHERE DeviceId = ?;" - ); - -_LIT8( KCmSqlDeleteOldestMediaItems, - "DELETE FROM Items WHERE HarvestDate <= ? AND MediaType = ?;" - ); - -_LIT8( KCmSqlDeleteUnusedAlbums, - "DELETE FROM Albums WHERE AlbumId " - "NOT IN ( SELECT AlbumId FROM Items );" - ); - -_LIT8( KCmSqlDeleteUnusedArtists, - "DELETE FROM Artists WHERE ArtistId " - "NOT IN ( SELECT ArtistId FROM Items );" - ); - -_LIT8( KCmSqlDeleteUnusedGenres, - "DELETE FROM Genres WHERE GenreId " - "NOT IN ( SELECT GenreId FROM Items );" - ); - -_LIT8( KCmSqlDeleteUnusedUpnpclasses, - "DELETE FROM Upnpclasses WHERE UpnpclassId " - "NOT IN ( SELECT UpnpclassId FROM Items );" - ); - -_LIT8( KCmSqlDeleteUnusedUpnpProfileIds, - "DELETE FROM UpnpProfiles WHERE ProfileId " - "NOT IN ( SELECT ProfileId FROM Items );" - ); - -#endif // __CMSQLCLAUSEDEF_H__ - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/cmsqlconnection.h --- a/upnpharvester/common/cmsqlwrapper/inc/cmsqlconnection.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,575 +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: SQLite Connection class -* -*/ - - - - - - - -#ifndef C_CMSQLCONNECTION_H -#define C_CMSQLCONNECTION_H - -#include -#include -#include "cmcommontypes.h" - -/* Forward declarations. */ -class CCmSqlBaseItem; -class CCmSqlGenericItem; -class CCmSqlPropertyItem; -class CCmBaseListItem; -class CCmFillListItem; -class CCmFillRule; -class CCmSqlPropertyCollector; -class CCmSqlPropertyContainer; - -// Constants -const TUint KCmSqlBatchSize = 100; - -// CLASS DECLARATION - /** - * Class represents methods to communication with SQLite database API. - * - * @lib cmsqlwrapper.lib - * - * @since S60 5.1 - */ -class CCmSqlConnection : public CBase - { - -private: - - // Operation modes - enum TCmSqlOperationMode - { - ECmSqlFillItemGet = 1, - ECmSqlBaseItemGet, - ECmSqlPropertyValueGet, - ECmSqlGenericItemAdd, - ECmSqlPropertyItemAdd, - ECmSqlIdle, - ECmSqlDeletingMetadata, - ECmSqlFilteredPropertyGet - }; -public: - - /** - * Two-phased constructor. - */ - static CCmSqlConnection* NewL(); - - /** - * Two-phased constructor. - */ - static CCmSqlConnection* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmSqlConnection(); - - /** - * Open database (creates if doesn't exist) - * - * @since S60 5.1 - * @param aDb, Database filename and path - * @return error code - */ - TInt OpenDb( const TDesC& aDb ); - - /** - * Close opened database - * - * @since S60 5.1 - * @param None - * @return None - */ - void CloseDb(); - - /** - * Creates db file - * @since S60 5.1 - * @param aDb, Database filename and path - * @return error code - */ - TInt CreateDbFile( const TDesC& aDb ); - - /** - * Validates database existence and format - * - * @since S60 5.1 - * @param None - * @return ETrue if db valid - */ - TBool Validate(); - - /** - * Executes sql command - * - * @since S60 5.1 - * @param aCommand, command to be executed - * @return None - */ - void ExecuteL( const TDesC8& aCommand ); - - /** - * Cance asyncronous operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelAsyncOperation(); - - /** - * Setting media server id - * - * @since S60 5.1 - * @param aId, media server id to be used - * @return None - */ - void SetMsId( TUint aId ); - - /** - * Setting mmc quota - * - * @since S60 5.1 - * @param aQuota, quota to be used - * @return None - */ - void SetQuota( TInt64 aQuota ); - - /** - * Asyncronous batch add - * - * @since S60 5.1 - * @param aItems, items to be inserted into database - * @param aStatus, request status to be completed after insert is ready - * @return None - */ - void AsyncBatchAdd( RPointerArray& aItems, - TRequestStatus& aStatus ); - - /** - * Asyncronous property item batch add - * - * @since S60 5.1 - * @param aItems, items to be inserted into database - * @param aField, property type identifier - * @param aStatus, request status to be completed after insert is ready - * @return None - */ - void AsyncBatchAddPropertyItems( - RPointerArray& aItems, TCmMetadataField aField, - TRequestStatus& aStatus ); - - /** - * Syncronous property item add - * - * @since S60 5.1 - * @param aItem, item to be inserted into database - * @param aField, property type identifier - * @return None - */ - void SyncAddPropertyItemL( - CCmSqlPropertyItem& aItem, TCmMetadataField aField ); - - /** - * Asyncronous item batch delete - * - * @since S60 5.1 - * @param aItems, items to be deleted - * @param aStatus, request status to be completed - * @return None - */ - void AsyncBatchDelete( RPointerArray& aItems, - TRequestStatus& aStatus ); - - /** - * Asyncronous metadata delete - * - * @since S60 5.1 - * @param aMsIds, defines where metadata is harvested - * @param aStatus, request status to be completed - * @return None - */ - void AsyncMetadataDelete( RArray& aMsIds, - TRequestStatus& aStatus ); - - /** - * SELECT XXX oldest and delete those - * Delete defined amount of media items - * - * @since S60 5.1 - * @param aType, media type identifier - * @param aCount, amount to be deleted - * @return None - */ - void DeleteOldestMediaItemsL( TCmMediaType aType, TInt64 aCount ); - - /** - * Deletes unused propertys - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteUnusedPropertys( ); - - /** - * Asyncronous metadata column qyery - * - * @since S60 5.1 - * @param aItems, listed base items ( included only ItemId, dbId and - * Hash code ) - * @param aStatus, request status to be completed when result set ready - * @return None - */ - void GetItemsL( RPointerArray& aItems, - TRequestStatus& aStatus ); - - /** - * Asyncronous metadata qyery for fill list - * - * @since S60 5.1 - * @param aItems, listed fill list items - * @param aClause, sql clause to be executed - * @param aRule, used fill list - * @param aStatus, request status to be completed when result set ready - * @return None - */ - void GetFillItemsL( RPointerArray& aItems, - TDesC8& aClause, CCmFillRule& aRule, TRequestStatus& aStatus ); - - /** - * Asyncronous metadata column qyery - * - * @since S60 5.1 - * @param aItems, listed property values - * @param aClause, sql clause to be executed - * @param aStatus, request status to be completed when result set ready - * @return None - */ - void GetPropertyValuesL( RPointerArray& aItems, - TDesC8& aClause, TRequestStatus& aStatus ); - - /** - * Asyncronous metadata filtered property values query - * - * @since S60 5.1 - * @param aPropertys, result array reference - * @param aClause, sql clause to be executed - * @param aStatus, request status to be completed - * @return None - */ - void GetFilteredPropertyValuesL( - CCmSqlPropertyCollector& aPropertys, const TDesC8& aClause, - TRequestStatus& aStatus ); - - /** - * Returns amount of media items - * - * @since S60 5.1 - * @param aCount, media amount on return - * @param aType, media type - * @return None - */ - void GetMediaCountL( TInt64& aCount, TCmMediaType aType ); - - /** - * Returns ETrue if item exist in db - * - * @since S60 5.1 - * @param aItem, item - * @param aDevId, device id - * @return ETrue if exists - */ - TBool ExistsL( const CCmBaseListItem& aItem, const TInt aDevId ); - -private: - - /** - * Static callback method for db handling - * - * @since S60 5.1 - * @param aDbHandler, database handler - * @return None - */ - static TInt BatchAdd( TAny* aDbHandler ); - - /** - * Adds items into db in background - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt DoBatchAdd(); - - /** - * Static callback method for db handling - * - * @since S60 5.1 - * @param aDbHandler, database handler - * @return None - */ - static TInt BatchDelete( TAny* aDbHandler ); - - /** - * Deletes items from db - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt DoBatchDelete(); - - /** - * Static callback method for db handling - * - * @since S60 5.1 - * @param aDbHandler, database handler - * @return None - */ - static TInt BatchGetL( TAny* aDbHandler ); - - /** - * Gets items from db - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt DoBatchGetL(); - - /** - * Collect item data - * - * @since S60 5.1 - * @param None - * @return None - */ - void CollectItemDataL(); - - /** - * Adds generic item into db - * - * @since S60 5.1 - * @param None - * @return None - */ - void AddItemL(); - - /** - * Adds property item into db - * - * @since S60 5.1 - * @param None - * @return None - */ - void AddPropertyItemL(); - - /** - * Adds resource item into db - * - * @since S60 5.1 - * @param None - * @return None - */ - void AddResourceL(); - - /** - * Deletes items from the item table - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteItemL(); - - /** - * Deletes resource from the resources table - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteResourceL(); - - /** - * Deletes metadata from defined server - * - * @since S60 5.1 - * @param aMsId, mediaserver id - * @return None - */ - void DeleteMetadataFromDefServerL( const TInt aMsId ); - - /** - * Formats row count query clause, used in property - * indexing - * - * @since S60 5.1 - * @param aField, metadata field - * @return None - */ - void FormatRowCountQueryL( TCmMetadataField aField ); - - /** - * Returns row count, used in property indexing - * - * @since S60 5.1 - * @param None - * @return None - */ - TInt64 RowCountL(); - - /** - * Helper function for format maximun index query - * - * @since S60 5.1 - * @param aId, item id - * @param aTable, table name - * @return None - */ - void FormatCountQueryL( const TDesC8& aId, const TDesC8& aTable ); - - /** - * Helper function for getting filtered propertys - * - * @since S60 5.1 - * @param aContainer, propertycontainer - * @param aIndex1, column index - * @param aIndex2, column index - * @return None - */ - void GetFilteredPropertysL( CCmSqlPropertyContainer& aContainer, - const TInt aIndex1, const TInt aIndex2 ); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmSqlConnection(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - -private: - - /** - * iDatabase, interface to Sqlite database - */ - RSqlDatabase iDatabase; - - /** - * iStatement, interface to Sqlite database - */ - RSqlStatement iStatement; - - /** - * Pending request status - */ - TRequestStatus* iStatus; - - /** - * Media server id - */ - TUint iMsId; - - /** - * User mmc quota - */ - TInt64 iQuota; - - /** - * Generic item array pointer - */ - RPointerArray* iGenericItems; // not owned - - /** - * Base item array pointer - */ - RPointerArray* iBaseItems; // not owned - - /** - * Fill list item array pointer - */ - RPointerArray* iFillItems; // not owned - - /** - * Property item array pointer - */ - RPointerArray* iPropertyItems; // not owned - - /** - * Filtered property item array pointer - */ - CCmSqlPropertyCollector* iPropertyCollector; // not owned - - /** - * Mediaserver ids - */ - RArray* iMsIds; // not owned - - /** - * Asyncronous database handler - */ - CIdle* iAsyncDbHandler; // owned - - /** - * Operation mode - */ - TCmSqlOperationMode iMode; - - /** - * Index to item array - */ - TInt iIndex; - - /** - * Property table identifier - */ - TCmMetadataField iField; - - /** - * Fill list - */ - CCmFillRule* iList; // not owned - - /** - * Fill list size - */ - TInt64 iListSize; - - /** - * Maximun size of the fill list in Bytes - */ - TInt64 iListMaxSize; - - /** - * Used to get max count of items - */ - HBufC8* iCountQuery; // Owned - - }; - -#endif // C_CMSQLCONNECTION_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/cmsqldbclause.h --- a/upnpharvester/common/cmsqlwrapper/inc/cmsqldbclause.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,245 +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: SQL clause handling class -* -*/ - - - - - - - -#ifndef C_CMSQLDBCLAUSE_H -#define C_CMSQLDBCLAUSE_H - -#include - -/** - * CCmSqlDbClause class - * Part of SQL wrapper. SQL wrapper is part of - * Content manager component.CCmSqlDbClause formats needed sql clauses - * - * @lib cmsqlwrapper.lib - * - * @since S60 v3.1 - */ -class CCmSqlDbClause : public CBase - { - -public: - - /** - * Two-phased constructor. - */ - static CCmSqlDbClause* NewL(); - - /** - * Two-phased constructor. - */ - static CCmSqlDbClause* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmSqlDbClause(); - -public: - - /** - * Starts to generate sql query clause according to - * fill rule and fill method - * - * @since S60 5.1 - * @param aRule, fill rule - * @param aField, metadata field - * @param aMedia, media type - * @return None - */ - void FormatClauseL( CCmFillRule& aRule, - TCmMetadataField aField = ECmNone, TCmMediaType aMedia = ECmAll ); - - /** - * Starts to generate sql query clause according to - * property collector - * - * @since S60 5.1 - * @param aPropertys, propertys to be filtered - * @return None - */ - void FormatFilteringClauseL( CCmSqlPropertyCollector& aPropertys ); - - /** - * Returns sql clause - * - * @since S60 5.1 - * @param None - * @return iClause, reference - */ - TDesC8& ClauseL() const; - - /** - * Sets profile filters - * - * @since S60 5.1 - * @param aProfileIds, profile ids - * @return None - */ - void SetDlnaProfileFilters( const RArray& aProfileIds ); - -private: - - /** - * Formats fill rules media type into sql clause - * @param aRule, fill rule - * - * @since S60 5.1 - * @return None - */ - void FormatMediatypeL( CCmFillRule& aRule ); - - /** - * Formats fill rule params into sql clause - * - * @since S60 5.1 - * @param aRule, fill rule - * @return None - */ - void FormatParamsL( CCmFillRule& aRule ); - - /** - * Formats fill rule media servers into sql clause - * - * @since S60 5.1 - * @param aRule, fill rule - * @return None - */ - void FormatDevicesL( CCmFillRule& aRule ); - - /** - * Formats fill rule query result ordering into sql clause - * - * @since S60 5.1 - * @param aMethod, ordering method - * @return None - */ - void FormatOrderingL( TCmFillMethod aMethod ); - - /** - * Formats fill rule query amount into sql clause - * - * @since S60 5.1 - * @param aRule, fill rule - * @return None - */ - void FormatAmountL( CCmFillRule& aRule ); - - /** - * Formats fill rule metadata field into sql clause - * - * @since S60 5.1 - * @param aField, metadata field to be set in query - * @param aMediaType, media type of the fill list - * @return None - */ - void FormatMetadataColumnL( TCmMetadataField aField, - TCmMediaType aMediaType ); - - /** - * Formats fill rule operator into sql clause - * - * @since S60 5.1 - * @param aMetadataColum, metadata field to be set in query - * @param aOper, operator of query results - * @return None - */ - void FormatOperatorL( TCmMetadataField aMetadataColum, - TCmOperatorType aOper ); - - /** - * Formats property values query - * - * @since S60 5.1 - * @param aField, identified property - * @param aMedia, identified media type - * @return None - */ - void FormatProperyQueryL( TCmMetadataField aField, - TCmMediaType aMedia = ECmAll ); - - /** - * Formats profile filters into sql clause - * - * @since S60 5.1 - * @param None - * @return None - */ - void FormatProfileFiltersL(); - - /** - * Formats property filters into sql clause - * - * @since S60 5.1 - * @param aPropertys, property collector - * @return None - */ - void FormatPropertyFilterL( - CCmSqlPropertyCollector& aPropertys ); - - /** - * Adds property filters into sql clause - * - * @since S60 5.1 - * @param aContainer, property container - * @param aField, property field - * @param aClause, clause to be modified - * @return None - */ - void AddPropertyFilterL( - CCmSqlPropertyContainer& aContainer, const TDesC8& aField, - HBufC8*& aClause ); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmSqlDbClause(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * Formated clause - */ - HBufC8* iClause; // Owned - - /** - * Temporal free text clause - */ - HBufC8* iFreeText; // Owned - - /** - * Profile ids which need to be filtered out - */ - RArray iProfileFilters; - - }; - -#endif // C_CMSQLDBCLAUSE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/cmsqldbmaintenance.h --- a/upnpharvester/common/cmsqlwrapper/inc/cmsqldbmaintenance.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +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: SQL database maintenance class -* -*/ - - - - - - - -#ifndef C_CMSQLDBMAINTENANCE_H -#define C_CMSQLDBMAINTENANCE_H - -#include - -// Forward declarations -class CCmSqlConnection; - -/** - * CCmSqlDbMaintenance class - * Part of SQL wrapper. SQL wrapper is part of - * Content manager component.CCmSqlDbMaintenance creates needed - * database tables and initializes connenction to the database - * - * @lib cmsqlwrapper.lib - * - * @since S60 v3.1 - */ -class CCmSqlDbMaintenance : public CBase - { - -public: - - /** - * Two-phased constructor. - */ - static CCmSqlDbMaintenance* NewL(); - - /** - * Two-phased constructor. - */ - static CCmSqlDbMaintenance* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmSqlDbMaintenance(); - - /** - * Initializes database connection - * - * @since S60 5.1 - * @param aConnection, reference to connection class - * @return Error code - */ - TInt InitConnection( CCmSqlConnection& aConnection ); - - /** - * Closes database connection - * - * @since S60 5.1 - * @param aConnection, reference to connection class - * @return None - */ - void CloseConnection( CCmSqlConnection& aConnection ); - - /** - * Creates db file - * - * @since S60 5.1 - * @param aConnection, reference to connection class - * @return Error code - */ - TInt CreateDbFile( CCmSqlConnection& aConnection ); - - /** - * Creates database tables - * - * @since S60 5.1 - * @param aConnection, reference to connection class - * @return None - */ - void CreateDb( CCmSqlConnection& aConnection ); - - /** - * Creates database indexes - * - * @since S60 5.1 - * @param aConnection, reference to connection class - * @return None - */ - void CreateIndexes( CCmSqlConnection& aConnection ); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmSqlDbMaintenance(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: // data - - }; - -#endif // C_CMSQLDBMAINTENANCE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/cmsqlmain.h --- a/upnpharvester/common/cmsqlwrapper/inc/cmsqlmain.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,302 +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: Main class in the SQL wrapper component -* -*/ - - - - - - -#ifndef C_CMSQLMAIN_H -#define C_CMSQLMAIN_H - -#include -#include "mcmsqlmain.h" - -// Forward declarations -class RFs; - -/** - * CCmSqlMain class ( Interface to sql wrapper ) - * Part of SQL wrapper. SQL wrapper is part of - * Content manager component. - * - * @lib cmsqlwrapper.lib - * - * @since S60 5.1 - */ -class CCmSqlMain : public CBase, - public MCmSqlMain - { - -public: - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aFs, ref to file server session - * @return pointer to CCmSqlMain class - */ - static CCmSqlMain* NewL( RFs& aFs ); - - /** - * Two-phased constructor. - * - * @since S60 5.1 - * @param aFs, ref to file server session - * @return pointer to CCmSqlMain class - */ - static CCmSqlMain* NewLC( RFs& aFs ); - - /** - * Destructor. - */ - virtual ~CCmSqlMain(); - - /** - * Canceling operation - * - * @since S60 5.1 - * @param None - * @return None - */ - void CancelAsyncOperation(); - - /** - * Setting media server id - * - * @since S60 5.1 - * @param aId, id to be used - * @return None - */ - void SetMsId( TUint aId ); - - /** - * Setting mmc quota - * - * @since S60 5.1 - * @param aQuota, quota to be used in unlimited fill lists - * @return None - */ - void SetQuota( TInt64 aQuota ); - - /** - * Setting dlna profile filters - * - * @since S60 5.1 - * @param aProfileIds, unsupported profile ids - * @return None - */ - void SetDlnaProfileFilters( const RArray& aProfileIds ); - - /** - * Asyncronous batch add - * - * @since S60 5.1 - * @param aItems, items to be added - * @param aStatus, request status to be completed - * @return None - */ - void AsyncBatchAdd( RPointerArray& aItems, - TRequestStatus& aStatus ); - - /** - * Asyncronous batch property value add - * - * @since S60 5.1 - * @param aItems, property items to be added - * @param aField, property identifier - * @param aStatus, request status to be completed - * @return None - */ - void AsyncBatchAddPropertyItems( - RPointerArray& aItems, TCmMetadataField aField, - TRequestStatus& aStatus ); - - /** - * Syncronous property value add - * - * @since S60 5.1 - * @param aItem, property item to be added - * @param aField, property identifier - * @return None - */ - void SyncAddPropertyItemL( CCmSqlPropertyItem& aItem, - TCmMetadataField aField ); - - /** - * Asyncronous batch delete - * - * @since S60 5.1 - * @param aItems, items to be deleted - * @param aStatus, request status to be completed - * @return None - */ - void AsyncBatchDelete( RPointerArray& aItems, - TRequestStatus& aStatus ); - - /** - * Asyncronous metadata delete - * - * @since S60 5.1 - * @param aMsIds, defines where metadata is harvested - * @param aStatus, request status to be completed - * @return None - */ - void AsyncMetadataDelete( RArray& aMsIds, - TRequestStatus& aStatus ); - - /** - * SELECT XXX oldest and delete those - * Delete defined amount of media items - * - * @since S60 5.1 - * @param aType, media type identifier - * @param aCount, amount to be deleted - * @return None - */ - void DeleteOldestMediaItemsL( TCmMediaType aType, - TInt64 aCount ); - - /** - * Deletes unused propertys - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteUnusedPropertys( ); - - /** - * Asyncronous metadata query - * - * @since S60 5.1 - * @param aItems, result array reference - * @param aStatus, request status to be completed - * @return None - */ - void GetItemsL( RPointerArray& aItems, - TRequestStatus& aStatus ); - - /** - * Asyncronous fill list item query - * - * @since S60 5.1 - * @param aItems, result array reference - * @param aRule, fill list used as a query clause parameter - * @param aStatus, request status to be completed - * @return None - */ - void GetFillItemsL( RPointerArray& aItems, - CCmFillRule& aRule, TRequestStatus& aStatus ); - - /** - * Asyncronous metadata property values query - * - * @since S60 5.1 - * @param aItems, result array reference - * @param aStatus, request status to be completed - * @param aField, property identifier ( e.g. artist ) - * @param aMedia, media type identifier ( e.g. audio ) - * @return None - */ - void GetPropertyValuesL( - RPointerArray& aItems, TRequestStatus& aStatus, - TCmMetadataField aField, TCmMediaType aMedia = ECmAll ); - - /** - * Asyncronous metadata filtered property values query - * - * @since S60 5.1 - * @param aPropertys, result array reference - * @param aStatus, request status to be completed - * @return None - */ - void GetFilteredPropertyValuesL( - CCmSqlPropertyCollector& aPropertys, TRequestStatus& aStatus ); - - /** - * Returns amount of media items - * - * @since S60 5.1 - * @param aCount, media amount on return - * @param aType, media type - * @return None - */ - void GetMediaCountL( TInt64& aCount, TCmMediaType aType ); - - /** - * Returns ETrue if item exist in db - * - * @since S60 5.1 - * @param aItem, item - * @param aDevId, device id - * @return ETrue if exists - */ - TBool ExistsL( const CCmBaseListItem& aItem, const TInt aDevId ); - - /** - * Deletes the object - * - * @since S60 5.1 - * @param None - * @return None - */ - void Close(); - -private: - - /** - * Performs the first phase of two phase construction. - * - * @since S60 5.1 - * @param aFs, file server - * @return None - */ - CCmSqlMain( RFs& aFs ); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * Clause format class - */ - CCmSqlDbClause* iClause; // Owned - - /** - * Database maintenance class - */ - CCmSqlDbMaintenance* iMaintenance; // Owned - - /** - * Database connection class - */ - CCmSqlConnection* iConnection; // Owned - - /** - * Reference to file server session - */ - RFs& iFs; - - }; - -#endif // C_CMSQLMAIN_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/cmsqlmainfactory.h --- a/upnpharvester/common/cmsqlwrapper/inc/cmsqlmainfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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: Abstract factory for CMSettings -* -*/ - - - - - - - -#ifndef C_CMSQLMAINFACTORY_H -#define C_CMSQLMAINFACTORY_H - -#include -#include - -/* Forward declarations. */ -class MCmSqlMain; -class RFs; - -/** - * Abstract factory for CCmSqlMain - * - * @lib cmsettings.lib - * - * @since S60 5.1 - */ -class CCmSqlMainFactory : public CBase - { - -public: - - /** - * Creates a new instance of CCmSqlMain - * - * @since S60 5.1 - * @param aFs, file server - * @return pointer to CCmSqlMain class - */ - IMPORT_C static MCmSqlMain* NewCmSqlMainL( RFs& aFs ); - - /** - * Creates a new instance of CCmSqlMain. Instance is left in - * cleanup stack. - * - * @since S60 5.1 - * @param aFs, file server - * @return pointer to CCmSqlMain class - */ - IMPORT_C static MCmSqlMain* NewCmSqlMainLC( RFs& aFs ); - - }; - -#endif // C_CMSQLMAINFACTORY_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/cmsqlmaintenanceclauses.h --- a/upnpharvester/common/cmsqlwrapper/inc/cmsqlmaintenanceclauses.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +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: Includes SQL clauses for creating and dropping tables/indexes -* -*/ - - - - - - -#ifndef __CMSQLMAINTENANCECLAUSES_H__ -#define __CMSQLMAINTENANCECLAUSES_H__ - -/////////////////////////////////////////////////////////////////// -// DROP CLAUSES -/////////////////////////////////////////////////////////////////// -_LIT8( KCmSqlDropArtists, "DROP TABLE Artists;"); -_LIT8( KCmSqlDropGenres, "DROP TABLE Genres;" ); -_LIT8( KCmSqlDropAlbums, "DROP TABLE Albums;" ); -_LIT8( KCmSqlDropUpnpProfiles, "DROP TABLE UpnpProfiles;" ); -_LIT8( KCmSqlDropUpnpClasses, "DROP TABLE Upnpclasses;" ); -_LIT8( KCmSqlDropResolutions, "DROP TABLE Resolutions;" ); -_LIT8( KCmSqlDropResources, "DROP TABLE Resources;" ); -_LIT8( KCmSqlDropItems, "DROP TABLE Items;" ); - -/////////////////////////////////////////////////////////////////// -// CREATE CLAUSES FOR TABLES -/////////////////////////////////////////////////////////////////// -_LIT8( KCmSqlCreateArtists, - "CREATE TABLE Artists(" - "ArtistId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "Value TEXT NOT NULL UNIQUE);" - ); - -_LIT8( KCmSqlCreateGenres, - "CREATE TABLE Genres(" - "GenreId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "Value TEXT NOT NULL UNIQUE);" - ); - -_LIT8( KCmSqlCreateAlbums, - "CREATE TABLE Albums(" - "AlbumId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "Value TEXT NOT NULL UNIQUE);" - ); - -_LIT8( KCmSqlCreateResolutions, - "CREATE TABLE Resolutions(" - "ResolutionId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "Value TEXT NOT NULL UNIQUE," - "Width INTEGER," - "Height INTEGER," - "PixelCount INTEGER);" - ); - -_LIT8( KCmSqlCreateUpnpclasses, - "CREATE TABLE Upnpclasses(" - "UpnpclassId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "Value TEXT NOT NULL UNIQUE);" - ); - -_LIT8( KCmSqlCreateUpnpProfiles, - "CREATE TABLE UpnpProfiles(" - "ProfileId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "Value TEXT NOT NULL UNIQUE);" - ); - -_LIT8( KCmSqlCreateResources, - "CREATE TABLE Resources(" - "ResourceId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "ResItemId INTEGER NOT NULL REFERENCES Items( Id )," - "ResResolution INTEGER REFERENCES Resolutions( ResolutionId )," - "ResUri TEXT NOT NULL," - "Size INTEGER," - "ResDuration INTEGER," - "ResBitrate INTEGER);" - ); - -_LIT8( KCmSqlCreateItems, - "CREATE TABLE Items(" - "Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," - "ItemId TEXT NOT NULL," - "Hash TEXT NOT NULL," - "Uri TEXT NOT NULL," - "Title TEXT NOT NULL," - "AlbumArtUri TEXT," - "DeviceId INTEGER NOT NULL," - "Duration INTEGER," - "Bitrate INTEGER," - "Date DATETIME," - "HarvestDate DATETIME," - "Size INTEGER," - "Mediatype INTEGER," - "SearchId INTEGER," - "UpnpclassId INTEGER REFERENCES Upnpclasses( UpnpclassId )," - "ArtistId INTEGER REFERENCES Artists( ArtistId )," - "AlbumId INTEGER REFERENCES Albums( AlbumId )," - "GenreId INTEGER REFERENCES Genres( GenreId )," - "ProfileId INTEGER REFERENCES UpnpProfiles( ProfileId )," - "ResolutionId INTEGER REFERENCES Resolutions( ResolutionId ) );" - ); - -/////////////////////////////////////////////////////////////////// -// INDEXES -/////////////////////////////////////////////////////////////////// -_LIT8( KCmSqlCreateItemsIdIndex, - "CREATE INDEX ItemsId_Index ON Items(Id);" - ); - -_LIT8( KCmSqlCreateItemTitleIndex, - "CREATE INDEX Item_Title_Index ON Items(Title);" - ); - -_LIT8( KCmSqlCreateItemDateIndex, - "CREATE INDEX Item_Date_Index ON Items(Date);" - ); - -_LIT8( KCmSqlCreateItemHarvestDateIndex, - "CREATE INDEX Item_HarvestDate_Index ON Items(HarvestDate);" - ); - -_LIT8( KCmSqlCreateItemArtistIndex, - "CREATE INDEX Item_Artist_Index ON Items(ArtistId);" - ); - -_LIT8( KCmSqlCreateItemAlbumIndex, - "CREATE INDEX Item_Album_Index ON Items(AlbumId);" - ); - -_LIT8( KCmSqlCreateItemGenreIndex, - "CREATE INDEX Item_Genre_Index ON Items(GenreId);" - ); - -_LIT8( KCmSqlCreateItemUpnpclassIndex, - "CREATE INDEX Item_Upnpclass_Index ON Items(UpnpclassId);" - ); - -_LIT8( KCmSqlCreateItemUpnpProfileIndex, - "CREATE INDEX Item_UpnpProfile_Index ON Items(ProfileId);" - ); - -_LIT8( KCmSqlCreateItemResolutionIndex, - "CREATE INDEX Item_Resolution_Index ON Items(ResolutionId);" - ); - -_LIT8( KCmSqlCreateItemMediatypeIndex, - "CREATE INDEX Item_Mediatype_Index ON Items(Mediatype);" - ); - -_LIT8( KCmSqlCreateAlbumIdIndex, - "CREATE INDEX AlbumId_Index ON Albums(AlbumId);" - ); - -_LIT8( KCmSqlCreateArtistIdIndex, - "CREATE INDEX ArtistId_Index ON Artists(ArtistId);" - ); - -_LIT8( KCmSqlCreateGenreIdIndex, - "CREATE INDEX GenreId_Index ON Genres(GenreId);" - ); - -// Dropping indexes -_LIT8( KCmSqlDropItemsIdIndex, - "DROP INDEX ItemsId_Index;" - ); - -_LIT8( KCmSqlDropItemTitleIndex, - "DROP INDEX Item_Title_Index;" - ); - -_LIT8( KCmSqlDropItemDateIndex, - "DROP INDEX Item_Date_Index;" - ); - -_LIT8( KCmSqlDropItemHarvestDateIndex, - "DROP INDEX Item_HarvestDate_Index;" - ); - -_LIT8( KCmSqlDropItemArtistIndex, - "DROP INDEX Item_Artist_Index;" - ); - -_LIT8( KCmSqlDropItemAlbumIndex, - "DROP INDEX Item_Album_Index;" - ); - -_LIT8( KCmSqlDropItemGenreIndex, - "DROP INDEX Item_Genre_Index;" - ); - -_LIT8( KCmSqlDropItemUpnpclassIndex, - "DROP INDEX Item_Upnpclass_Index;" - ); - -_LIT8( KCmSqlDropItemUpnpProfileIndex, - "DROP INDEX Item_UpnpProfile_Index;" - ); - -_LIT8( KCmSqlDropItemResolutionIndex, - "DROP INDEX Item_Resolution_Index;" - ); - -_LIT8( KCmSqlDropItemMediatypeIndex, - "DROP INDEX Item_Mediatype_Index;" - ); - -_LIT8( KCmSqlDropAlbumIdIndex, - "DROP INDEX AlbumId_Index;" - ); - -_LIT8( KCmSqlDropArtistIdIndex, - "DROP INDEX ArtistId_Index;" - ); - -_LIT8( KCmSqlDropGenreIdIndex, - "DROP INDEX GenreId_Index;" - ); - -#endif // __CMSQLMAINTENANCECLAUSES_H__ - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/inc/mcmsqlmain.h --- a/upnpharvester/common/cmsqlwrapper/inc/mcmsqlmain.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +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: Main class in the SQL wrapper component -* -*/ - - - - - - -#ifndef M_MCMSQLMAIN_H -#define M_MCMSQLMAIN_H - -#include -#include -#include "cmcommon.h" -#include "cmcommontypes.h" - -/* Forward declarations. */ -class RFs; -class CCmSqlDbMaintenance; -class CCmSqlConnection; -class CCmSqlDbClause; -class CCmBaseListItem; -class CCmSqlBaseItem; -class CCmFillRule; -class CCmFillListItem; -class CCmSqlGenericItem; -class CCmSqlPropertyItem; -class CCmBaseListItem; -class CCmSqlPropertyCollector; - -/** - * MCmSqlMain class ( Interface to sql wrapper ) - * Part of SQL wrapper. SQL wrapper is part of - * Content manager component. - * - * @lib cmsqlwrapper.lib - * - * @since S60 5.1 - */ -class MCmSqlMain - { -public: - - /** - * Canceling operation - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void CancelAsyncOperation() = 0; - - /** - * Setting media server id - * - * @since S60 5.1 - * @param aId, id to be used - * @return None - */ - virtual void SetMsId( TUint aId ) = 0; - - /** - * Setting mmc quota - * - * @since S60 5.1 - * @param aQuota, quota to be used in unlimited fill lists - * @return None - */ - virtual void SetQuota( TInt64 aQuota ) = 0; - - /** - * Setting dlna profile filters - * - * @since S60 5.1 - * @param aProfileIds, unsupported profile ids - * @return None - */ - virtual void SetDlnaProfileFilters( const RArray& aProfileIds ) = 0; - - /** - * Asyncronous batch add - * - * @since S60 5.1 - * @param aItems, items to be added - * @param aStatus, request status to be completed - * @return None - */ - virtual void AsyncBatchAdd( RPointerArray& aItems, - TRequestStatus& aStatus ) = 0; - - /** - * Asyncronous batch property value add - * - * @since S60 5.1 - * @param aItems, property items to be added - * @param aField, property identifier - * @param aStatus, request status to be completed - * @return None - */ - virtual void AsyncBatchAddPropertyItems( - RPointerArray& aItems, TCmMetadataField aField, - TRequestStatus& aStatus ) = 0; - - /** - * Syncronous property value add - * - * @since S60 5.1 - * @param aItem, property item to be added - * @param aField, property identifier - * @return None - */ - virtual void SyncAddPropertyItemL( CCmSqlPropertyItem& aItem, - TCmMetadataField aField ) = 0; - - /** - * Asyncronous batch delete - * - * @since S60 5.1 - * @param aItems, items to be deleted - * @param aStatus, request status to be completed - * @return None - */ - virtual void AsyncBatchDelete( RPointerArray& aItems, - TRequestStatus& aStatus ) = 0; - - /** - * Asyncronous metadata delete - * - * @since S60 5.1 - * @param aMsIds, defines where metadata is harvested - * @param aStatus, request status to be completed - * @return None - */ - virtual void AsyncMetadataDelete( RArray& aMsIds, - TRequestStatus& aStatus ) = 0; - - /** - * SELECT XXX oldest and delete those - * Delete defined amount of media items - * - * @since S60 5.1 - * @param aType, media type identifier - * @param aCount, amount to be deleted - * @return None - */ - virtual void DeleteOldestMediaItemsL( TCmMediaType aType, - TInt64 aCount ) = 0; - - /** - * Deletes unused propertys - * - * @since S60 5.1 - * @param None - * @return None - */ - virtual void DeleteUnusedPropertys( ) = 0; - - /** - * Asyncronous metadata query - * - * @since S60 5.1 - * @param aItems, result array reference - * @param aStatus, request status to be completed - * @return None - */ - virtual void GetItemsL( RPointerArray& aItems, - TRequestStatus& aStatus ) = 0; - - /** - * Asyncronous fill list item query - * - * @since S60 5.1 - * @param aItems, result array reference - * @param aRule, fill list used as a query clause parameter - * @param aStatus, request status to be completed - * @return None - */ - virtual void GetFillItemsL( RPointerArray& aItems, - CCmFillRule& aRule, TRequestStatus& aStatus ) = 0; - - /** - * Asyncronous metadata property values query - * - * @since S60 5.1 - * @param aItems, result array reference - * @param aStatus, request status to be completed - * @param aField, property identifier ( e.g. artist ) - * @param aMedia, media type identifier ( e.g. audio ) - * @return None - */ - virtual void GetPropertyValuesL( - RPointerArray& aItems, TRequestStatus& aStatus, - TCmMetadataField aField, TCmMediaType aMedia = ECmAll ) = 0; - - /** - * Asyncronous metadata filtered property values query - * - * @since S60 5.1 - * @param aPropertys, result array reference - * @param aStatus, request status to be completed - * @return None - */ - virtual void GetFilteredPropertyValuesL( - CCmSqlPropertyCollector& aPropertys, TRequestStatus& aStatus ) = 0; - - /** - * Returns amount of media items - * - * @since S60 5.1 - * @param aCount, media amount on return - * @param aType, media type - * @return None - */ - virtual void GetMediaCountL( TInt64& aCount, TCmMediaType aType ) = 0; - - /** - * Returns ETrue if item exist in db - * - * @since S60 5.1 - * @param aItem, item - * @param aDevId, device id - * @return ETrue if exists - */ - virtual TBool ExistsL( const CCmBaseListItem& aItem, const TInt aDevId ) = 0; - - /** - * Deletes the object - * - * @since S60 5.1 - */ - virtual void Close() = 0; - - }; - -#endif // M_MCMSQLMAIN_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/src/cmsqlconnection.cpp --- a/upnpharvester/common/cmsqlwrapper/src/cmsqlconnection.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1331 +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: SQLite Connection class -* -*/ - - - - - - -#include -#include "cmsqlclausedef.h" -#include "cmsqlresolutionpropertyitem.h" -#include "cmsqlaudioitem.h" -#include "cmsqlvideoitem.h" -#include "cmsqlimageitem.h" -#include "cmfilllistitem.h" -#include "cmfillrule.h" -#include "cmsqlpropertycollector.h" -#include "cmsqlpropertycontainer.h" -#include "cmsqlconnection.h" -#include "msdebug.h" - -_LIT8( KCmSqlPragmaCacheSize, - "PRAGMA cache_size=1024;PRAGMA page_size=4096;" - ); - -#ifdef _DEBUG -_LIT( KCmSqlWrapper, "SqlWrapper"); -#endif // _DEBUG - - -// --------------------------------------------------------------------------- -// CCmSqlConnection::NewL -// --------------------------------------------------------------------------- -// -CCmSqlConnection* CCmSqlConnection::NewL() - { - TRACE(Print(_L("[SQL wrapper]\t CCmSqlConnection::NewL()"))); - CCmSqlConnection* self = CCmSqlConnection::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::NewLC -// --------------------------------------------------------------------------- -// -CCmSqlConnection* CCmSqlConnection::NewLC() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::NewLC")); - CCmSqlConnection* self = new ( ELeave ) CCmSqlConnection(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::~CCmSqlConnection -// --------------------------------------------------------------------------- -// -CCmSqlConnection::~CCmSqlConnection() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::~CCmSqlConnection")); - CloseDb(); - if( iAsyncDbHandler ) - { - iAsyncDbHandler->Cancel(); - delete iAsyncDbHandler; - } - - delete iCountQuery; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::OpenDb -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::OpenDb( const TDesC& aDb ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::OpenDb")); - - TInt err( iDatabase.Open( aDb, NULL ) ); - if( err == KErrNone ) - { - err = iDatabase.Exec( KCmSqlPragmaCacheSize ); - if ( err != KErrNone ) - { - TRACE(Print(_L("[SQL wrapper]\t KCmSqlPragmaCacheSize\ - error %d"), err)); - } - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::CloseDb -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::CloseDb() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CloseDb")); - - iDatabase.Close(); - } - - -// --------------------------------------------------------------------------- -// CCmSqlConnection::CreateDbFile -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::CreateDbFile( const TDesC& aDb ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CreateDbFile")); - - return iDatabase.Create( aDb ); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::Validate -// --------------------------------------------------------------------------- -// -TBool CCmSqlConnection::Validate() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::Validate")); - - TBool retval = EFalse; - - // In the test period it is useful that the database is re-created - // every run. because most of the test cases are automatic and require - // a known initial state. - TInt ret( KErrNone ); - TInt err = iStatement.Prepare( iDatabase, - KCmSqlValidateTableExistence ); - // Loop only one row in results - if( err ) - { - ret = KErrGeneral; - } - else - { - err = iStatement.Next(); - if ( err != KSqlAtRow ) - { - ret = KErrGeneral; - } - iStatement.Reset(); - iStatement.Close(); - } - - - if ( ret == KErrNone ) - { - retval = ETrue; - } - - return retval; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::ExecuteL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::ExecuteL( const TDesC8& aCommand ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::ExecuteL")); - - TInt err( iDatabase.Exec( aCommand ) ); - if ( KErrNone > err ) - { -#ifdef _DEBUG - TPtrC errorMsg( iDatabase.LastErrorMessage() ); - TRACE(Print(_L("[SQL wrapper]\t errorMsg: %S"), &errorMsg )); -#endif - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::CancelAsyncOperation -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::CancelAsyncOperation() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CancelAsyncOperation")); - - if( ECmSqlBaseItemGet == iMode || ECmSqlFillItemGet == iMode || - ECmSqlPropertyValueGet == iMode ) - { - iStatement.Reset(); - iStatement.Close(); - } - - iMode = ECmSqlIdle; - - if ( iAsyncDbHandler->IsActive() ) - { - User::RequestComplete( iStatus, KErrCancel ); - iAsyncDbHandler->Cancel(); - TRACE(Print(_L("[SQL wrapper]\t Canceled..."))); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::SetMsId -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::SetMsId( TUint aId ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::SetMsId")); - - iMsId = aId; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::SetQuota -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::SetQuota( TInt64 aQuota ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::SetQuota")); - - iQuota = aQuota; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::AsyncBatchAdd -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::AsyncBatchAdd( - RPointerArray& aItems, TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncBatchAdd")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iIndex = 0; - iGenericItems = &aItems; - iMode = ECmSqlGenericItemAdd; - iAsyncDbHandler->Start( TCallBack( BatchAdd, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// ACCmSqlConnection::syncBatchAddPropertyItems -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::AsyncBatchAddPropertyItems( - RPointerArray& aItems, TCmMetadataField aField, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncBatchAddPropertyItems")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iIndex = 0; - iField = aField; - iPropertyItems = &aItems; - iMode = ECmSqlPropertyItemAdd; - iAsyncDbHandler->Start( TCallBack( BatchAdd, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::SyncAddPropertyItemL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::SyncAddPropertyItemL( - CCmSqlPropertyItem& aItem, TCmMetadataField aField ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::SyncAddPropertyItemL")); - - iIndex = 0; - iField = aField; - RPointerArray temp; - CleanupClosePushL( temp ); - temp.AppendL( &aItem ); - iPropertyItems = &temp; - AddPropertyItemL(); - FormatRowCountQueryL( aField ); - // Autoincremented row index is used as a item id - aItem.SetId( RowCountL() ); - delete iCountQuery; - iCountQuery = NULL; - temp.Reset(); - CleanupStack::PopAndDestroy( &temp ); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::AsyncBatchDelete -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::AsyncBatchDelete( - RPointerArray& aItems, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncBatchDelete")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iBaseItems = &aItems; - iIndex = 0; - iAsyncDbHandler->Start( TCallBack( BatchDelete, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::AsyncMetadataDelete -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::AsyncMetadataDelete( RArray& aMsIds, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AsyncMetadataDelete")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iMsIds = &aMsIds; - iIndex = 0; - iMode = ECmSqlDeletingMetadata; - iAsyncDbHandler->Start( TCallBack( BatchDelete, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DeleteOldestMediaItemsL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::DeleteOldestMediaItemsL( TCmMediaType aType, - TInt64 aCount ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteOldestMediaItemsL")); - - TInt err = iStatement.Prepare( iDatabase, KCmSqlSelectLimitHarvestDate ); - TInt64 timestamp( KErrNone ); - User::LeaveIfError( err ); - iStatement.BindInt( 0, aType ); - iStatement.BindInt64( 1, aCount ); - - while( KSqlAtRow == iStatement.Next() ) - { - timestamp = iStatement.ColumnInt64( 0 ); - } - - iStatement.Reset(); - iStatement.Close(); - - if( timestamp ) - { - err = iStatement.Prepare( iDatabase, KCmSqlDeleteOldestMediaItems ); - User::LeaveIfError( err ); - iStatement.BindInt64( 0, timestamp ); - iStatement.BindInt( 1, aType ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DeleteUnusedPropertys() -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::DeleteUnusedPropertys( ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteUnusedPropertys")); - - iDatabase.Exec( KCmSqlDeleteUnusedAlbums ); - iDatabase.Exec( KCmSqlDeleteUnusedArtists ); - iDatabase.Exec( KCmSqlDeleteUnusedGenres ); - iDatabase.Exec( KCmSqlDeleteUnusedUpnpclasses ); - iDatabase.Exec( KCmSqlDeleteUnusedUpnpProfileIds ); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::GetItemsL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::GetItemsL( RPointerArray& aItems, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetItemsL")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iBaseItems = &aItems; - iMode = ECmSqlBaseItemGet; - iIndex = 0; - TInt err = iStatement.Prepare( iDatabase, - KCmSqlSelectGenericItem ); - User::LeaveIfError( err ); - iStatement.BindInt( 0, iMsId ); - iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::GetFillItemsL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::GetFillItemsL( RPointerArray& aItems, - TDesC8& aClause, CCmFillRule& aRule, TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetFillItemsL")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iList = &aRule; - iIndex = 0; - iListSize = 0; - iListMaxSize = 0; - iFillItems = &aItems; - iMode = ECmSqlFillItemGet; - if( EMbits == iList->LimitType() ) - { - // Converting list max size to bytes - iListMaxSize = ( iList->Amount() * 1000000 ); - } - // Unlimited lists are limited to mmc quota - else if( EUnlimited == iList->LimitType() ) - { - iListMaxSize = iQuota; - } - - TInt err = iStatement.Prepare( iDatabase, aClause ); - User::LeaveIfError( err ); - iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::GetPropertyValuesL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::GetPropertyValuesL( - RPointerArray& aItems, TDesC8& aClause, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetPropertyValuesL")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iPropertyItems = &aItems; - iIndex = 0; - iMode = ECmSqlPropertyValueGet; - TInt err = iStatement.Prepare( iDatabase, aClause ); - User::LeaveIfError( err ); - iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::GetFilteredPropertyValuesL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::GetFilteredPropertyValuesL( - CCmSqlPropertyCollector& aPropertys, const TDesC8& aClause, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetFilteredPropertyValuesL")); - - __ASSERT_DEBUG( iAsyncDbHandler,\ - User::Panic( KCmSqlWrapper, KErrCorrupt )); - iStatus = &aStatus; - - if( !iAsyncDbHandler->IsActive() ) - { - iPropertyCollector = &aPropertys; - iIndex = 0; - iMode = ECmSqlFilteredPropertyGet; - TInt err = iStatement.Prepare( iDatabase, aClause ); - User::LeaveIfError( err ); - iAsyncDbHandler->Start( TCallBack( BatchGetL, this ) ); - } - else - { - User::RequestComplete( iStatus, KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::GetMediaCountL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::GetMediaCountL( TInt64& aCount, - TCmMediaType aType ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::GetMediaCountL")); - - TInt err = iStatement.Prepare( iDatabase, KCmSqlSelectMediaCount ); - User::LeaveIfError( err ); - err = iStatement.BindInt( 0, aType ); - - if( !err ) - { - if( KSqlAtRow == iStatement.Next() ) - { - aCount = iStatement.ColumnInt( 0 ); - } - iStatement.Reset(); - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::ExistsL -// --------------------------------------------------------------------------- -// -TBool CCmSqlConnection::ExistsL( const CCmBaseListItem& aItem, - const TInt aDevId ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::ExistsL")); - - TBool exists( EFalse ); - - TInt err = iStatement.Prepare( iDatabase, KCmSqlSelectItemId ); - User::LeaveIfError( err ); - - // convert lowercase - TBuf temp; - temp.Copy(aItem.PrimaryText()); - temp.LowerCase(); - - iStatement.BindText( 0, temp ); - iStatement.BindInt( 1, aItem.Size() ); - iStatement.BindInt( 2, aDevId ); - - if( KSqlAtRow == iStatement.Next() ) - { - exists = ETrue; - } - - iStatement.Reset(); - iStatement.Close(); - return exists; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::BatchAdd -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::BatchAdd( TAny* aDbHandler ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::BatchAdd")); - - return ((CCmSqlConnection*)aDbHandler)->DoBatchAdd(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DoBatchAdd -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::DoBatchAdd() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DoBatchAdd")); - - TInt ret( EFalse ); - // Add items in chucks of X items ( x must be changeable ) - // return true if not all added - TInt err( iDatabase.Exec( KCmSqlBeginTransaction ) ); - TInt added( 0 ); - switch( iMode ) - { - case ECmSqlPropertyItemAdd: - { - if( iPropertyItems ) - { - LOG(_L("[SQL Wrapper]\t Adding property item batch")); - // Add batch size pcs. items at a time - for( TInt i = iIndex; i < iPropertyItems->Count() && - ( ( added + 1 ) % KCmSqlBatchSize != 0 ) ; i++ ) - { - if( ( *iPropertyItems )[i] ) - { - TRAP_IGNORE( AddPropertyItemL() ); - } - iIndex++; - ret = ETrue; - added++; - } - } - break; - } - case ECmSqlGenericItemAdd: - { - if( iGenericItems ) - { - LOG(_L("[SQL Wrapper]\t Adding generic item batch")); - // Add batch size pcs. items at a time - for( TInt i = iIndex; i < iGenericItems->Count() && - ( ( added + 1 ) % KCmSqlBatchSize != 0 ) ; i++ ) - { - if( (*iGenericItems)[i] ) - { - TRAP_IGNORE( AddItemL() ); - TRAP_IGNORE( AddResourceL() ); - } - iIndex++; - ret = ETrue; - added++; - } - } - break; - } - default: - { - break; - } - } - err = iDatabase.Exec( KCmSqlCommit ); - if( !ret ) - { - LOG(_L("[SQL Wrapper]\t Completing Async batch add...")); - User::RequestComplete( iStatus, KErrNone ); - } - return ret; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::BatchDelete -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::BatchDelete( TAny* aDbHandler ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::BatchDelete")); - - return ((CCmSqlConnection*)aDbHandler)->DoBatchDelete(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DoBatchDelete -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::DoBatchDelete() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DoBatchDelete")); - - TInt ret( EFalse ); - // Delete items in chucks of KCmSqlBatchSize items - // return true if not all deleted - if( iMode == ECmSqlDeletingMetadata ) - { - if( iIndex < iMsIds->Count() ) - { - TRAP_IGNORE( - DeleteMetadataFromDefServerL( (*iMsIds)[iIndex] ) ); - iIndex++; - ret = ETrue; - } - } - else - { - TInt err( iDatabase.Exec( KCmSqlBeginTransaction ) ); - TInt count( 0 ); - for( TInt i = iIndex; i < iBaseItems->Count() && - ((count + 1 ) % KCmSqlBatchSize != 0 ) ; i++ ) - { - TRAP_IGNORE( DeleteItemL() ); - TRAP_IGNORE( DeleteResourceL() ); - count++; - iIndex++; - ret = ETrue; - } - err = iDatabase.Exec( KCmSqlCommit ); - } - if( !ret ) - { - User::RequestComplete( iStatus, KErrNone ); - } - return ret; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::BatchGetL -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::BatchGetL( TAny* aDbHandler ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::BatchGetL")); - - return ((CCmSqlConnection*)aDbHandler)->DoBatchGetL(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DoBatchGetL -// --------------------------------------------------------------------------- -// -TInt CCmSqlConnection::DoBatchGetL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DoBatchGetL() start")); - TInt ret( EFalse ); - - // Get items in chucks of KCmSqlBatchSize - TInt stat( KSqlAtRow ); - for( TInt i = 0; i < KCmSqlBatchSize && - stat == KSqlAtRow ; i++ ) - { - stat = iStatement.Next(); - if( stat == KSqlAtRow ) - { - CollectItemDataL(); - ret = ETrue; - if( iMode == ECmSqlFillItemGet && - iListSize > iListMaxSize && - iListMaxSize ) - { - stat = KSqlAtEnd; - } - } - } - - // If no items found or quota is full - if( stat == KSqlAtEnd || !ret ) - { - ret = EFalse; - iStatement.Reset(); - iStatement.Close(); - iMode = ECmSqlIdle; - User::RequestComplete( iStatus, KErrNone ); - } - return ret; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::CollectItemDataL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::CollectItemDataL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CollectItemDataL")); - - switch( iMode ) - { - case ECmSqlFillItemGet: - { - CCmFillListItem* item = CCmFillListItem::NewLC( - iList->Priority(), iList->ListId(), iList->Status(), - iList->Selected() ); - item->SetMediaType( iList->MediaType() ); - item->SetPrimaryTextL( iStatement.ColumnTextL( 0 ) ); - item->SetSecondaryTextL( iStatement.ColumnTextL( 1 ) ); - TPtrC8 data; - item->SetSize(iStatement.ColumnInt( 2 ) ); - iListSize = iListSize + item->Size(); - data.Set( iStatement.ColumnBinaryL( 3 ) ); - item->SetUriL( data ); - item->SetDevId(iStatement.ColumnInt( 4 ) ); - data.Set( iStatement.ColumnBinaryL( 5 ) ); - item->SetItemIdL( data ); - item->SetDbId( iStatement.ColumnInt64( 6 ) ); - if( iListSize > iListMaxSize && iListMaxSize ) - { - CleanupStack::PopAndDestroy( item ); - } - else - { - iFillItems->AppendL( item ); - CleanupStack::Pop( item ); - } - break; - } - case ECmSqlBaseItemGet: - { - CCmSqlBaseItem* item = CCmSqlBaseItem::NewL(); - CleanupStack::PushL( item ); - item->SetId( iStatement.ColumnInt64( 0 ) ); - TPtrC8 data = iStatement.ColumnBinaryL( 1 ); - item->SetCdsIdL( data ); - item->SetHashL( iStatement.ColumnTextL( 2 ) ); - item->SetSearchId( iStatement.ColumnInt64( 3 ) ); - iBaseItems->AppendL( item ); - CleanupStack::Pop( item ); - break; - } - case ECmSqlPropertyValueGet: - { - CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewL(); - CleanupStack::PushL( item ); - item->SetId( iStatement.ColumnInt64( 0 ) ); - TPtrC data16 = iStatement.ColumnTextL( 1 ); - HBufC8* data8bitBuf = HBufC8::NewLC( - data16.Length()); - TPtr8 data8bitPtr = data8bitBuf->Des(); - TInt conversionError = - CnvUtfConverter::ConvertFromUnicodeToUtf8( data8bitPtr, - data16 ); - if( !conversionError ) - { - item->SetNameL( data8bitPtr ); - } - CleanupStack::PopAndDestroy( data8bitBuf ); - item->SetStatus( ETrue ); - iPropertyItems->AppendL( item ); - CleanupStack::Pop( item ); - break; - } - case ECmSqlFilteredPropertyGet: - { - TInt couunt = iPropertyCollector->PropertyContainerCount(); - for( TInt i = 0 ; i < couunt; i++ ) - { - CCmSqlPropertyContainer* temp = - iPropertyCollector->PropertyContainer( i ); - switch( temp->Type() ) - { - case ECmTitle: - { - GetFilteredPropertysL( *temp, 0, 1 ); - break; - } - case ECmArtist: - { - GetFilteredPropertysL( *temp, 2, 3 ); - break; - } - case ECmAlbum: - { - GetFilteredPropertysL( *temp, 4, 5 ); - break; - } - case ECmGenre: - { - GetFilteredPropertysL( *temp, 6, 7 ); - break; - } - default: - { - break; - } - } - } - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::AddItemL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::AddItemL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AddItemL")); - - TInt err = iStatement.Prepare( iDatabase, KCmSqlInsertItem ); - User::LeaveIfError( err ); - // Bind item prameters - if( &(*iGenericItems)[iIndex]->CdsId() ) - { - iStatement.BindBinary( 0, - (*iGenericItems)[iIndex]->CdsId() ); - } - if( &(*iGenericItems)[iIndex]->Hash() ) - { - iStatement.BindText( 1, - (*iGenericItems)[iIndex]->Hash() ); - } - if( &(*iGenericItems)[iIndex]->Uri() ) - { - iStatement.BindBinary( 2, - (*iGenericItems)[iIndex]->Uri() ); - } - if( &(*iGenericItems)[iIndex]->Title() ) - { - HBufC* data16bitBuf = HBufC::NewLC( - iGenericItems->operator[](iIndex)->Title().Length()); - TPtr data16bitPtr = data16bitBuf->Des(); - TInt conversionError = - CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, - (*iGenericItems)[iIndex]->Title() ); - if( !conversionError ) - { - iStatement.BindText( 3, data16bitPtr ); - } - CleanupStack::PopAndDestroy( data16bitBuf ); - } - iStatement.BindInt( 5, iMsId ); - - iStatement.BindInt64( 8, - (*iGenericItems)[iIndex]->Date().Int64() ); - iStatement.BindInt64( 9, - (*iGenericItems)[iIndex]->HarvestDate().Int64() ); - iStatement.BindInt( 10, - (*iGenericItems)[iIndex]->Size() ); - iStatement.BindInt( 11, - (*iGenericItems)[iIndex]->MediaType() ); - iStatement.BindInt64( 12, - (*iGenericItems)[iIndex]->UpnpclassId() ); - iStatement.BindInt64( 17, - (*iGenericItems)[iIndex]->UpnpProfileId() ); - iStatement.BindInt64( 18, - (*iGenericItems)[iIndex]->SearchId() ); - - switch( (*iGenericItems)[iIndex]->MediaType() ) - { - case ECmAudio: - { - CCmSqlAudioItem* item = static_cast( - (*iGenericItems)[iIndex] ); - iStatement.BindInt( 6, item->Duration() ); - iStatement.BindInt( 7, item->Bitrate() ); - iStatement.BindInt64( 13, item->ArtistId() ); - iStatement.BindInt64( 14, item->AlbumId() ); - iStatement.BindInt64( 15, item->GenreId() ); - if( &item->AlbumArtUri() ) - { - iStatement.BindBinary( 4, item->AlbumArtUri() ); - } - break; - } - case ECmVideo: - { - CCmSqlVideoItem* item = static_cast( - (*iGenericItems)[iIndex] ); - iStatement.BindInt64( 15, item->GenreId() ); - break; - } - case ECmImage: - { - CCmSqlImageItem* item = static_cast( - (*iGenericItems)[iIndex] ); - iStatement.BindInt64( 16, item->ResolutionId() ); - } - default: - { - break; - } - } - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::AddPropertyItemL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::AddPropertyItemL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AddPropertyItemL")); - - TInt err( KErrNone ); - switch( iField ) - { - case ECmArtist: - { - err = iStatement.Prepare( iDatabase, KCmSqlInsertArtist ); - break; - } - case ECmAlbum: - { - err = iStatement.Prepare( iDatabase, KCmSqlInsertAlbum ); - break; - } - case ECmGenre: - { - err = iStatement.Prepare( iDatabase, KCmSqlInsertGenre ); - break; - } - case ECmUpnpClass: - { - err = iStatement.Prepare( iDatabase, KCmSqlInsertUpnpclass ); - break; - } - case ECmProfileId: - { - err = iStatement.Prepare( iDatabase, KCmSqlInsertUpnpProfile ); - break; - } - case ECmResolution: - { - err = iStatement.Prepare( iDatabase, KCmSqlInsertResolution ); - break; - } - default: - { - break; - } - } - User::LeaveIfError( err ); - HBufC* data16bitBuf = HBufC::NewLC( - (*iPropertyItems)[iIndex]->Name().Length()); - TPtr data16bitPtr = data16bitBuf->Des(); - - TInt conversionError = - CnvUtfConverter::ConvertToUnicodeFromUtf8( data16bitPtr, - (*iPropertyItems)[iIndex]->Name() ); - - if( !conversionError ) - { - iStatement.BindText( 0, data16bitPtr ); - } - CleanupStack::PopAndDestroy( data16bitBuf ); - - if( ECmResolution == iField ) - { - CCmSqlResolutionPropertyItem* resolution = - static_cast - ( (*iPropertyItems)[iIndex] ); - iStatement.BindInt( 1, resolution->Width() ); - iStatement.BindInt( 2, resolution->Height() ); - iStatement.BindInt( 3, resolution->PixelCount() ); - resolution = NULL; - } - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::AddResourceL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::AddResourceL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::AddResourceL")); - - TPtrC8 uri; - TInt size( KErrNone ); - TInt duration( KErrNone ); - TInt bitrate( KErrNone ); - TInt64 resolutionId( KErrNone ); - TInt err( KErrNone ); - for( TInt i = 0; i < - (*iGenericItems)[iIndex]->ResourceCount(); - i++ ) - { - FormatRowCountQueryL( ECmTitle ); - // Resources references to it's item - TInt64 itemId( RowCountL() ); - err = iStatement.Prepare( iDatabase, KCmSqlInsertResource ); - User::LeaveIfError( err ); - (*iGenericItems)[iIndex]->GetResource( uri, size, - duration, bitrate, resolutionId, i ); - - // Bind item prameters - iStatement.BindInt64( 0, itemId ); - iStatement.BindInt64( 1, resolutionId ); - if( &uri ) - { - iStatement.BindBinary( 2, uri ); - } - iStatement.BindInt( 3, size ); - iStatement.BindInt( 4, duration ); - iStatement.BindInt( 5, bitrate ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DeleteItemL() -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::DeleteItemL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteItemL")); - - TInt err = iStatement.Prepare( iDatabase, KCmSqlDeleteItem ); - User::LeaveIfError( err ); - iStatement.BindInt64( 0, - (*iBaseItems)[iIndex]->Id() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DeleteResourceL() -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::DeleteResourceL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::DeleteResourceL")); - - TInt err = iStatement.Prepare( iDatabase, KCmSqlDeleteResource ); - User::LeaveIfError( err ); - iStatement.BindInt64( 0, - (*iBaseItems)[iIndex]->Id() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::DeleteMetadataFromDefServerL() -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::DeleteMetadataFromDefServerL( const TInt aMsId ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::\ - DeleteMetadataFromDefServerL")); - - TRACE(Print(_L("[SQL wrapper]\t CCmSqlConnection::\ - DeleteMetadataFromDefServerL aMsId = %d"), aMsId )); - TInt err = iStatement.Prepare( iDatabase, KCmSqlDeleteMetadata ); - User::LeaveIfError( err ); - iStatement.BindInt( 0, aMsId ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::FormatRowCountQueryL() -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::FormatRowCountQueryL( TCmMetadataField aField ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::FormatRowCountQueryL")); - - switch( aField ) - { - case ECmArtist: - { - FormatCountQueryL( KCmSqlArtistId(), KCmSqlArtist() ); - break; - } - case ECmAlbum: - { - FormatCountQueryL( KCmSqlAlbumId(), KCmSqlAlbum() ); - break; - } - case ECmGenre: - { - FormatCountQueryL( KCmSqlGenreId(), KCmSqlGenre() ); - break; - } - case ECmUpnpClass: - { - FormatCountQueryL( KCmSqlUpnpclassId(), KCmSqlUpnpclass() ); - break; - } - case ECmProfileId: - { - FormatCountQueryL( KCmSqlProfileId(), KCmSqlUpnpProfiles() ); - break; - } - case ECmResolution: - { - FormatCountQueryL( KCmSqlResolutionId(), KCmSqlResolutions() ); - break; - } - case ECmTitle: - { - delete iCountQuery; - iCountQuery = NULL; - iCountQuery = HBufC8::NewL( KCmSqlSelectMaxItemIndex().Length() ); - iCountQuery->Des().Append( KCmSqlSelectMaxItemIndex ); - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::RowCountL() -// --------------------------------------------------------------------------- -// -TInt64 CCmSqlConnection::RowCountL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::RowCountL")); - - TInt err = iStatement.Prepare( iDatabase, *iCountQuery ); - TInt64 count( KErrNone ); - User::LeaveIfError( err ); - err = iStatement.Next(); - if ( KSqlAtRow == err ) - { - count = iStatement.ColumnInt( 0 ); - } - iStatement.Reset(); - iStatement.Close(); - return count; - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::FormatCountQueryL() -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::FormatCountQueryL( const TDesC8& aId, - const TDesC8& aTable ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::FormatCountQueryL")); - - delete iCountQuery; - iCountQuery = NULL; - iCountQuery = HBufC8::NewL( KCmSqlSelectMaxIndex().Length() + - aId.Length() + aTable.Length() + KCmSqlSemicolon().Length() ); - HBufC8* temp = HBufC8::NewLC( KCmSqlSelectMaxIndex().Length() + - aTable.Length() + KCmSqlSemicolon().Length() ); - temp->Des().Append( KCmSqlSelectMaxPropertyIndex ); - iCountQuery->Des().Format( temp->Des(), &aId, &aTable ); - iCountQuery->Des().Append( KCmSqlSemicolon ); - CleanupStack::PopAndDestroy( temp ); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::GetFilteredPropertysL() -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::GetFilteredPropertysL( - CCmSqlPropertyContainer& aContainer, const TInt aIndex1, - const TInt aIndex2 ) - { - CCmSqlPropertyItem* item = CCmSqlPropertyItem::NewLC(); - item->SetId( iStatement.ColumnInt64( aIndex1 ) ); - item->SetStatus( ETrue ); - - TPtrC data16 = iStatement.ColumnTextL( aIndex2 ); - HBufC8* data8bitBuf = HBufC8::NewLC( - data16.Length() * 3 ); - TPtr8 data8bitPtr = data8bitBuf->Des(); - TInt conversionError = - CnvUtfConverter::ConvertFromUnicodeToUtf8( data8bitPtr, - data16 ); - if( !conversionError ) - { - item->SetNameL( data8bitPtr ); - } - CleanupStack::PopAndDestroy( data8bitBuf ); - - if( !aContainer.IsDuplicate( *item ) ) - { - aContainer.AddPropertyItemL( item ); - CleanupStack::Pop( item ); - } - else - { - CleanupStack::PopAndDestroy( item ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::CCmSqlConnection -// --------------------------------------------------------------------------- -// -CCmSqlConnection::CCmSqlConnection() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::CCmSqlConnection")); - } - -// --------------------------------------------------------------------------- -// CCmSqlConnection::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlConnection::ConstructL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlConnection::ConstructL")); - - iAsyncDbHandler = CIdle::NewL( CActive::EPriorityStandard ); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/src/cmsqldbclause.cpp --- a/upnpharvester/common/cmsqlwrapper/src/cmsqldbclause.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,944 +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: SQL database sql clause class -* -*/ - - - - - - -#include -#include "cmfillrule.h" -#include "cmsqlpropertycollector.h" -#include "cmsqlpropertycontainer.h" -#include "cmsqlpropertyitem.h" -#include "cmsqldbclause.h" -#include "cmsqlclausedef.h" -#include "msdebug.h" - -// CONSTANTS -// The size of buf that need to allot for store the rule amount -const TUint KCmRuleAmountSize = 5; - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::NewL -// --------------------------------------------------------------------------- -// -CCmSqlDbClause* CCmSqlDbClause::NewL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::NewL")); - CCmSqlDbClause* self = CCmSqlDbClause::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::NewLC -// --------------------------------------------------------------------------- -// -CCmSqlDbClause* CCmSqlDbClause::NewLC() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::NewLC")); - CCmSqlDbClause* self = new ( ELeave ) CCmSqlDbClause(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::~CCmSqlDbClause -// --------------------------------------------------------------------------- -// -CCmSqlDbClause::~CCmSqlDbClause() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::~CCmSqlDbClause")); - - delete iClause; - delete iFreeText; - iProfileFilters.Reset(); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatClauseL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatClauseL( CCmFillRule& aRule, - TCmMetadataField aField, TCmMediaType aMedia ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatClauseL")); - - delete iClause; - iClause = NULL; - if( aField == ECmNone && &aRule ) - { - if( ECmAudio != aRule.MediaType() ) - { - iClause = KCmSqlBaseSelect().AllocL(); - } - else - { - iClause = KCmSqlMusicSelect().AllocL(); - } - TRACE(Print(_L("[SQL wrapper]\t Formating media type..."))); - FormatMediatypeL( aRule ); - TRACE(Print(_L("[SQL wrapper]\t Formating params..."))); - FormatParamsL( aRule ); - TRACE(Print(_L("[SQL wrapper]\t Formating devices..."))); - FormatDevicesL( aRule ); - TRACE(Print(_L("[SQL wrapper]\t Formating profile filters..."))); - FormatProfileFiltersL(); - TRACE(Print(_L("[SQL wrapper]\t Formating ordering..."))); - FormatOrderingL( aRule.Method() ); - TRACE(Print(_L("[SQL wrapper]\t Formating amount..."))); - FormatAmountL( aRule ); - // Finish clause - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSemicolon().Length() ); - iClause->Des().Append( KCmSqlSemicolon() ); - } - else - { - FormatProperyQueryL( aField, aMedia ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatFilteringClauseL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatFilteringClauseL( - CCmSqlPropertyCollector& aPropertys ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatFilteringClauseL")); - - delete iClause; - iClause = NULL; - - TInt count = aPropertys.PropertyContainerCount(); - - if( count == 1 && aPropertys.PropertyContainer( 0 )->Type() == ECmTitle) - { - //video - iClause = KCmSqlFilteredPropertySelectVideo().AllocL(); - } - else - { - iClause = KCmSqlFilteredPropertySelect().AllocL(); - } - - FormatPropertyFilterL( aPropertys ); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::ClauseL -// --------------------------------------------------------------------------- -// -TDesC8& CCmSqlDbClause::ClauseL() const - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::ClauseL")); - -#ifdef _DEBUG - HBufC* data16bitBuf = HBufC::NewLC(iClause->Length()); - TPtr data16bitPtr = data16bitBuf->Des(); - - TInt conversionError = - CnvUtfConverter::ConvertToUnicodeFromUtf8(data16bitPtr, - *iClause ); - TPtrC temp; - for( TInt i = 0; i < (data16bitPtr.Length())/100 + 1 ; i++ ) - { - if( i == (data16bitPtr.Length())/100 ) - { - temp.Set( data16bitPtr.Mid(100*i ) ); - TRACE( Print(_L("SQL clause %S"), &temp ) ); - } - else - { - temp.Set( data16bitPtr.Mid(100*i, 100 ) ); - TRACE( Print(_L("SQL clause %S"), &temp ) ); - } - } - CleanupStack::PopAndDestroy( data16bitBuf ); -#endif - return *iClause; - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::SetDlnaProfileFilters -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::SetDlnaProfileFilters( - const RArray& aProfileIds ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::SetDlnaProfileFilters")); - - iProfileFilters.Reset(); - for( TInt i = 0; i < aProfileIds.Count() ; i++ ) - { - iProfileFilters.InsertInSignedKeyOrder( aProfileIds[i] ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatMediatypeL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatMediatypeL( CCmFillRule& aRule ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMediatypeL")); - - TBuf8<20>mediatype; - mediatype.Format( KCmSqlSelectMediatype, aRule.MediaType() ); - iClause = iClause->ReAllocL( iClause->Length() + mediatype.Length() ); - iClause->Des().Append( mediatype ); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatParamsL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatParamsL( CCmFillRule& aRule ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatParamsL")); - - TCmMetadataField metadataColum; - TPtrC8 dataField; - TInt dataFieldIndex; - TCmOperatorType oper; - TInt paramCount; - TBool operatorAdded( EFalse ); - for( TInt i = 0; i < aRule.RuleCount(); i++ ) - { - aRule.RuleL( i, &metadataColum, &oper, ¶mCount ); - if( paramCount ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlAnd().Length() + KCmSqlLeftBracket().Length() ); - iClause->Des().Append( KCmSqlAnd ); - iClause->Des().Append( KCmSqlLeftBracket() ); - for( TInt j = 0; j < paramCount; j++ ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLeftBracket().Length() ); - iClause->Des().Append( KCmSqlLeftBracket() ); - - FormatMetadataColumnL( metadataColum, aRule.MediaType() ); - // Data field may change to integer value ( index to table ) - aRule.RuleParamL( i, j, &dataField ); - aRule.RuleParamL( i, j, dataFieldIndex ); - - // If rule is free text rule, operator is already appended - // into Sql clause - operatorAdded = EFalse; - if( ECmFreeText != metadataColum && - ECmArtist != metadataColum && - ECmAlbum != metadataColum && - ECmResolution != metadataColum && - ECmGenre != metadataColum && - ECmUpnpClass != metadataColum && - ECmTitle != metadataColum ) - { - FormatOperatorL( metadataColum, oper ); - operatorAdded = ETrue; - } - - if( dataField.Size() && - ( iFreeText || ECmDate == metadataColum || - ECmFileSize == metadataColum || - ECmDuration == metadataColum ) ) - { - if( ECmDate != metadataColum && - ECmFileSize != metadataColum && - ECmDuration != metadataColum ) - { - TInt multiplier( 1 ); - if( aRule.MediaType() == ECmAudio && - metadataColum == ECmFreeText ) - { - // Three fields are used in audio free text search - multiplier = 3; - } - iFreeText = iFreeText->ReAllocL( iFreeText->Length() + - ( dataField.Length() * multiplier ) ); - HBufC8* temp = HBufC8::NewMaxL( iFreeText->Length() + - ( dataField.Length() * multiplier ) ); - // Format dataField into clause - if( multiplier == 1 ) - { - temp->Des().Format( *iFreeText, &dataField ); - } - else - { - temp->Des().Format( *iFreeText, &dataField, - &dataField, &dataField ); - } - if( iFreeText ) - { - delete iFreeText; - iFreeText = NULL; - } - iClause = iClause->ReAllocL( iClause->Length() + - temp->Length() ); - iClause->Des().Append( *temp ); - delete temp; - } - else - { - // Date is appended in TInt64 format - TLex8 lex( dataField ); - TInt64 num; - lex.Val( num ); - iClause = iClause->ReAllocL( iClause->Length() + - dataField.Length() ); - iClause->Des().AppendNum( num ); - } - } - else - { - if( operatorAdded ) - { - iClause = iClause->ReAllocL( iClause->Length() + - sizeof( dataFieldIndex ) ); - - HBufC8* temp = HBufC8::NewMaxLC( iClause->Length() ); - temp->Des().Format( *iClause, dataFieldIndex ); - delete iClause; - iClause = NULL; - iClause = temp->AllocL(); - CleanupStack::PopAndDestroy( temp ); - } - else - { - iClause = iClause->ReAllocL( iClause->Length() + - sizeof( dataFieldIndex ) ); - iClause->Des().AppendNum( dataFieldIndex ); - } - } - - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlRightBracket().Length() ); - iClause->Des().Append( KCmSqlRightBracket() ); - - if( j < paramCount - 1 ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlOr().Length() ); - iClause->Des().Append( KCmSqlOr() ); - } - } - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlRightBracket().Length() ); - iClause->Des().Append( KCmSqlRightBracket() ); - } - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatDevicesL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatDevicesL( CCmFillRule& aRule ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatDevicesL")); - - TPtrC8 mediaServer; - TInt msId(0); - if( aRule.MediaServerCount() ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlAnd().Length() ); - iClause->Des().Append( KCmSqlAnd() ); - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLeftBracket().Length() ); - iClause->Des().Append( KCmSqlLeftBracket() ); - } - for( TInt k = 0; k < aRule.MediaServerCount(); k++ ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLeftBracket().Length() ); - iClause->Des().Append( KCmSqlLeftBracket() ); - aRule.MediaServerL( k, msId ); - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectDeviceId().Length() + sizeof( msId ) ); - iClause->Des().Append( KCmSqlSelectDeviceId ); - iClause->Des().AppendNum( msId ); - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlRightBracket().Length() ); - iClause->Des().Append( KCmSqlRightBracket() ); - if( k < aRule.MediaServerCount() - 1 ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlOr().Length() ); - iClause->Des().Append( KCmSqlOr() ); - } - } - if( aRule.MediaServerCount() ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlRightBracket().Length() ); - iClause->Des().Append( KCmSqlRightBracket() ); - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatOrderingL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatOrderingL( TCmFillMethod aMethod ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatOrderingL")); - - switch( aMethod ) - { - case ECmRandom: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlOrderByRandom().Length() ); - iClause->Des().Append( KCmSqlOrderByRandom() ); - break; - } - case ECmLatest: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlOrderByDate().Length() + KCmSqlDesc().Length() ); - iClause->Des().Append( KCmSqlOrderByDate() ); - iClause->Des().Append( KCmSqlDesc() ); - break; - } - case ECmOldest: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlOrderByDate().Length() + KCmSqlAsc().Length() ); - iClause->Des().Append( KCmSqlOrderByDate() ); - iClause->Des().Append( KCmSqlAsc() ); - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatAmountL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatAmountL( CCmFillRule& aRule ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatAmountL")); - - if( aRule.LimitType() == EPieces ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLimit().Length() + KCmRuleAmountSize ); - iClause->Des().Append( KCmSqlLimit() ); - iClause->Des().AppendNum( aRule.Amount() ); - } - else if( aRule.LimitType() == EMbits ) - { - // If amount is wanted in MBytes, no possibility to - // LIMIT result set in this phase - } - else - { - // Unlimited rule - // Fill quota is used as a maximun amount - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatMetadataColumnL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatMetadataColumnL( TCmMetadataField aField, - TCmMediaType aMediaType ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMetadataColumnL")); - - if( iFreeText ) - { - delete iFreeText; iFreeText = NULL; - } - TRACE(Print(_L("[SQL wrapper]\t Formating data field = %d"), - (TInt) aField )); - - switch( aField ) - { - case ECmArtist: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectArtistById().Length() ); - iClause->Des().Append( KCmSqlSelectArtistById() ); - break; - } - case ECmAlbum: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectAlbumById().Length() ); - iClause->Des().Append( KCmSqlSelectAlbumById() ); - break; - } - case ECmGenre: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectGenreById().Length() ); - iClause->Des().Append( KCmSqlSelectGenreById() ); - break; - } - case ECmDuration: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectDuration().Length() ); - iClause->Des().Append( KCmSqlSelectDuration() ); - break; - } - case ECmTitle: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectTitle().Length() ); - iClause->Des().Append( KCmSqlSelectTitle() ); - break; - } - case ECmUpnpClass: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectUpnpclassById().Length() ); - iClause->Des().Append( KCmSqlSelectUpnpclassById ); - break; - } - case ECmContentURI: - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMetadataColumnL \ - aField = ECmContentURI")); - break; - } - case ECmFileSize: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectSize().Length() ); - iClause->Des().Append( KCmSqlSelectSize() ); - break; - } - case ECmBitrate: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectBitrate().Length() ); - iClause->Des().Append( KCmSqlSelectBitrate ); - break; - } - case ECmResolution: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectResolutionById().Length() ); - iClause->Des().Append( KCmSqlSelectResolutionById ); - break; - } - case ECmDate: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSelectDate().Length() ); - iClause->Des().Append( KCmSqlSelectDate ); - break; - } - case ECmFreeText: - { - switch( aMediaType ) - { - case ECmAudio: - { - // Title, Artist or album field contains specified field - iFreeText = KCmSqlFreeTextSelectAudio().AllocL(); - break; - } - case ECmImage: - case ECmVideo: - { - // Title contains specified field - iFreeText = KCmSqlFreeTextSelectImageOrVideo().AllocL(); - break; - } - default: - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::\ - FormatMetadataColumnL mediatype not found")); - break; - } - } - break; - } - default: - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatMetadataColumnL \ - field not found")); - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatOperatorL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatOperatorL( TCmMetadataField aMetadataColum, - TCmOperatorType aOper ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatOperatorL")); - - switch( aOper ) - { - case ECmEquals: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlEqual().Length() + KCmSqlAppendString().Length() ); - iClause->Des().Append( KCmSqlEqual() ); - iClause->Des().Append( KCmSqlAppendInteger() ); - break; - } - // Greater and smaller operator are always integer operators - case ECmGreater: - { - if( aMetadataColum != ECmDate && aMetadataColum != ECmFileSize && - aMetadataColum != ECmDuration ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlGreater().Length() + - KCmSqlAppendInteger().Length() ); - iClause->Des().Append( KCmSqlGreater() ); - iClause->Des().Append( KCmSqlAppendInteger() ); - } - else - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlGreater().Length() + KCmSqlAppendLong().Length() ); - iClause->Des().Append( KCmSqlGreater() ); - } - break; - } - case ECmSmaller: - { - if( aMetadataColum != ECmDate && aMetadataColum != ECmFileSize && - aMetadataColum != ECmDuration ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSmaller().Length() + - KCmSqlAppendInteger().Length() ); - iClause->Des().Append( KCmSqlSmaller() ); - iClause->Des().Append( KCmSqlAppendInteger() ); - } - else - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlSmaller().Length() + KCmSqlAppendLong().Length() ); - iClause->Des().Append( KCmSqlSmaller() ); - } - break; - } - case ECmConsistOf: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLike().Length() + KCmSqlConsistOf().Length() ); - iClause->Des().Append( KCmSqlLike() ); - iClause->Des().Append( KCmSqlConsistOf() ); - break; - } - case ECmBeginsWith: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLike().Length() + KCmSqlBeginsWith().Length() ); - iClause->Des().Append( KCmSqlLike() ); - iClause->Des().Append( KCmSqlBeginsWith() ); - break; - } - case ECmEndsWith: - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLike().Length() + KCmSqlEndsWith().Length() ); - iClause->Des().Append( KCmSqlLike() ); - iClause->Des().Append( KCmSqlEndsWith() ); - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatProperyQueryL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatProperyQueryL( TCmMetadataField aField, - TCmMediaType aMedia ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatProperyQueryL")); - - if( iClause ) - { - delete iClause; - iClause = NULL; - } - - switch( aField ) - { - case ECmArtist: - { - iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + - KCmSqlArtist().Length() ); - TPtr8 ptr( iClause->Des() ); - ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlArtist ); - break; - } - case ECmAlbum: - { - iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + - KCmSqlAlbum().Length() ); - TPtr8 ptr( iClause->Des() ); - ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlAlbum ); - break; - } - case ECmGenre: - { - iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + - KCmSqlGenre().Length() ); - TPtr8 ptr( iClause->Des() ); - ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlGenre ); - break; - } - case ECmUpnpClass: - { - iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + - KCmSqlUpnpclass().Length() ); - TPtr8 ptr( iClause->Des() ); - ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlUpnpclass ); - break; - } - case ECmTitle: - { - iClause = HBufC8::NewL( KCmSqlSelectTitleAndId().Length() + - sizeof( aMedia ) ); - TPtr8 ptr( iClause->Des() ); - ptr.Format( KCmSqlSelectTitleAndId, aMedia ); - break; - } - case ECmResolution: - { - iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + - KCmSqlResolutions().Length() ); - TPtr8 ptr( iClause->Des() ); - ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlResolutions ); - break; - } - case ECmProfileId: - { - iClause = HBufC8::NewL( KCmSqlSelectPropertyValues().Length() + - KCmSqlResolutions().Length() ); - TPtr8 ptr( iClause->Des() ); - ptr.Format( KCmSqlSelectPropertyValues, &KCmSqlUpnpProfiles ); - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatProfileFiltersL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatProfileFiltersL( ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatProfileFiltersL")); - - if( iProfileFilters.Count() ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlAnd().Length() ); - iClause->Des().Append( KCmSqlAnd() ); - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLeftBracket().Length() ); - iClause->Des().Append( KCmSqlLeftBracket() ); - } - for( TInt k = 0; k < iProfileFilters.Count(); k++ ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlLeftBracket().Length() ); - iClause->Des().Append( KCmSqlLeftBracket() ); - - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlFilterUpnpProfileId().Length() + - sizeof( iProfileFilters[k] ) ); - iClause->Des().Append( KCmSqlFilterUpnpProfileId ); - iClause->Des().AppendNum( iProfileFilters[k] ); - - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlRightBracket().Length() ); - iClause->Des().Append( KCmSqlRightBracket() ); - if( k < iProfileFilters.Count() - 1 ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlAnd().Length() ); - iClause->Des().Append( KCmSqlAnd() ); - } - } - if( iProfileFilters.Count() ) - { - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlRightBracket().Length() ); - iClause->Des().Append( KCmSqlRightBracket() ); - } - iClause = iClause->ReAllocL( iClause->Length() + - KCmSqlRightBracket().Length() ); - iClause->Des().Append( KCmSqlRightBracket() ); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::FormatPropertyFilterL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::FormatPropertyFilterL( - CCmSqlPropertyCollector& aPropertys ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::FormatPropertyFilterL")); - - CCmSqlPropertyContainer* container = NULL; - HBufC8* temp = NULL; - for( TInt i = 0; i < aPropertys.PropertyContainerCount(); i++ ) - { - container = aPropertys.PropertyContainer( i ); - switch( container->Type() ) - { - case ECmTitle: - { - AddPropertyFilterL( *container, - KCmSqlSelectTitle(), temp ); - break; - } - case ECmArtist: - { - AddPropertyFilterL( *container, - KCmSqlSelectArtistById(), temp ); - break; - } - case ECmAlbum: - { - AddPropertyFilterL( *container, - KCmSqlSelectAlbumById(), temp ); - break; - } - case ECmGenre: - { - AddPropertyFilterL( *container, - KCmSqlSelectGenreById(), temp ); - break; - } - default: - { - break; - } - } - container = NULL; - } - - if( temp ) - { - iClause = iClause->ReAllocL( iClause->Length() + temp->Length() ); - iClause->Des().Append( *temp ); - delete temp; - } - } - -// --------------------------------------------------------------------------- -// CCmSqlDbClause::AddPropertyFilterL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::AddPropertyFilterL( - CCmSqlPropertyContainer& aContainer, const TDesC8& aField, - HBufC8*& aClause ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::AddPropertyFilterL")); - - if( aClause && aContainer.PropertyItemCount() ) - { - aClause = aClause->ReAllocL( aClause->Length() + - KCmSqlAnd().Length() + ( 2 * KCmSqlSpace().Length() ) ); - aClause->Des().Append( KCmSqlSpace() ); - aClause->Des().Append( KCmSqlAnd() ); - aClause->Des().Append( KCmSqlSpace() ); - } - if( aContainer.PropertyItemCount() && !aClause ) - { - aClause = KCmSqlAnd().AllocL(); - } - if( aContainer.PropertyItemCount() && aClause ) - { - aClause = aClause->ReAllocL( aClause->Length() + - KCmSqlLeftBracket().Length() ); - aClause->Des().Append( KCmSqlLeftBracket ); - - for( TInt j = 0; j < aContainer.PropertyItemCount() ; j++ ) - { - aClause = aClause->ReAllocL( aClause->Length() + - KCmSqlSelectTitle().Length() + - sizeof( aContainer.PropertyItem( j )->Id() ) ); - aClause->Des().Append( aField ); - aClause->Des().AppendNum( - aContainer.PropertyItem( j )->Id() ); - if( j < aContainer.PropertyItemCount() - 1 ) - { - aClause = aClause->ReAllocL( aClause->Length() + - KCmSqlOr().Length() + ( 2 * KCmSqlSpace().Length() ) ); - aClause->Des().Append( KCmSqlSpace() ); - aClause->Des().Append( KCmSqlOr() ); - aClause->Des().Append( KCmSqlSpace() ); - } - } - - aClause = aClause->ReAllocL( aClause->Length() + - KCmSqlRightBracket().Length() ); - aClause->Des().Append( KCmSqlRightBracket ); - - for( TInt k = 0; k < aContainer.PropertyItemCount() ; k++ ) - { - aContainer.DeletePropertyItem( k ); - k--; - } - } - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmSqlDbClause::CCmSqlDbClause() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::CCmSqlDbClause")); - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlDbClause::ConstructL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbClause::ConstructL")); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/src/cmsqldbmaintenance.cpp --- a/upnpharvester/common/cmsqlwrapper/src/cmsqldbmaintenance.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +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: SQL database maintenance class -* -*/ - - - - - - -#include "cmsqldbmaintenance.h" -#include "cmsqlconnection.h" -#include "cmsqlmaintenanceclauses.h" -#include "msdebug.h" - -// Constants -_LIT(KCmSqlDatabase, "C:\\System\\Data\\MediaServant\\cmmetadatacache.sq"); - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::NewL -// --------------------------------------------------------------------------- -// -CCmSqlDbMaintenance* CCmSqlDbMaintenance::NewL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::NewL")); - - CCmSqlDbMaintenance* self = CCmSqlDbMaintenance::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::NewLC -// --------------------------------------------------------------------------- -// -CCmSqlDbMaintenance* CCmSqlDbMaintenance::NewLC() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::NewLC")); - - CCmSqlDbMaintenance* self = new ( ELeave ) CCmSqlDbMaintenance(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::~CCmSqlDbMaintenance -// --------------------------------------------------------------------------- -// -CCmSqlDbMaintenance::~CCmSqlDbMaintenance() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::~CCmSqlDbMaintenance")); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::InitConnection -// --------------------------------------------------------------------------- -// -TInt CCmSqlDbMaintenance::InitConnection( - CCmSqlConnection& aConnection ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::InitConnection")); - - return aConnection.OpenDb( KCmSqlDatabase ); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::CloseConnection -// --------------------------------------------------------------------------- -// -void CCmSqlDbMaintenance::CloseConnection( - CCmSqlConnection& aConnection ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CloseConnection")); - - aConnection.CloseDb(); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::CreateDbFile -// --------------------------------------------------------------------------- -// -TInt CCmSqlDbMaintenance::CreateDbFile( CCmSqlConnection& aConnection ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CreateDbFile")); - - return aConnection.CreateDbFile( KCmSqlDatabase ); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::CreateDb -// --------------------------------------------------------------------------- -// -void CCmSqlDbMaintenance::CreateDb( - CCmSqlConnection& aConnection ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CreateDb")); - LOG(_L("[SQL wrapper]\t Dropping tables...")); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropArtists )); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropGenres )); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropAlbums )); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropResolutions )); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropUpnpProfiles )); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropUpnpClasses )); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropResources )); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItems )); - - LOG(_L("[SQL wrapper]\t Creating tables...")); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateArtists ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateGenres ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateAlbums ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateResolutions ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateUpnpProfiles ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateUpnpclasses ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateResources ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItems ) ); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::CreateIndexes -// --------------------------------------------------------------------------- -// -void CCmSqlDbMaintenance::CreateIndexes( - CCmSqlConnection& aConnection ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CreateIndexes")); - - LOG(_L("[SQL wrapper]\t Dropping indexes...")); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemsIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemTitleIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemArtistIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemAlbumIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemGenreIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemUpnpclassIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemResolutionIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemDateIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemHarvestDateIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemUpnpProfileIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropItemMediatypeIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropAlbumIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropArtistIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlDropGenreIdIndex ) ); - - LOG(_L("[SQL wrapper]\t Creating indexes...")); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemsIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemTitleIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemArtistIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemAlbumIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemGenreIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemUpnpclassIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemResolutionIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemDateIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemHarvestDateIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemUpnpProfileIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateItemMediatypeIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateAlbumIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateArtistIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCmSqlCreateGenreIdIndex ) ); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::CCmSqlDbMaintenance -// --------------------------------------------------------------------------- -// -CCmSqlDbMaintenance::CCmSqlDbMaintenance() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::CCmSqlDbMaintenance")); - } - -// --------------------------------------------------------------------------- -// CCmSqlDbMaintenance::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlDbMaintenance::ConstructL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlDbMaintenance::ConstructL")); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/src/cmsqlmain.cpp --- a/upnpharvester/common/cmsqlwrapper/src/cmsqlmain.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,325 +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: Main class in the SQL Wrapper component -* -*/ - - - - - - -#include -#include "cmsqlconnection.h" -#include "cmsqldbmaintenance.h" -#include "cmsqldbclause.h" -#include "cmsqlmain.h" -#include "msdebug.h" - -// CONSTANTS -_LIT(KCmSqlDirC, "C:\\System\\Data\\MediaServant\\"); - -// --------------------------------------------------------------------------- -// CCmSqlMain::NewL -// --------------------------------------------------------------------------- -// -CCmSqlMain* CCmSqlMain::NewL( RFs& aFs ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::NewL")); - CCmSqlMain* self = CCmSqlMain::NewLC( aFs ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::NewLC -// --------------------------------------------------------------------------- -// -CCmSqlMain* CCmSqlMain::NewLC( RFs& aFs ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::NewLC")); - CCmSqlMain* self = new ( ELeave ) CCmSqlMain( aFs ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::~CCmSqlMain -// --------------------------------------------------------------------------- -// -CCmSqlMain::~CCmSqlMain() - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::~CCmSqlMain")); - delete iClause; - delete iMaintenance; - delete iConnection; - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::CancelAsyncOperation -// --------------------------------------------------------------------------- -// -void CCmSqlMain::CancelAsyncOperation() - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::CancelAsyncOperation")); - - iConnection->CancelAsyncOperation(); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::SetMsId -// --------------------------------------------------------------------------- -// -void CCmSqlMain::SetMsId( TUint aId ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::SetMsId")); - - iConnection->SetMsId( aId ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::SetQuota -// --------------------------------------------------------------------------- -// -void CCmSqlMain::SetQuota( TInt64 aQuota ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::SetQuota")); - - iConnection->SetQuota( aQuota ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::SetDlnaProfileFilters -// --------------------------------------------------------------------------- -// -void CCmSqlMain::SetDlnaProfileFilters( - const RArray& aProfileIds ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::SetDlnaProfileFilters")); - - iClause->SetDlnaProfileFilters( aProfileIds ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::AsyncBatchAdd -// --------------------------------------------------------------------------- -// -void CCmSqlMain::AsyncBatchAdd( - RPointerArray& aItems, TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncBatchAdd")); - - iConnection->AsyncBatchAdd( aItems, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::AsyncBatchAddPropertyItems -// --------------------------------------------------------------------------- -// -void CCmSqlMain::AsyncBatchAddPropertyItems( - RPointerArray& aItems, TCmMetadataField aField, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncBatchAddPropertyItems")); - - iConnection->AsyncBatchAddPropertyItems( aItems, aField, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::SyncAddPropertyItemL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::SyncAddPropertyItemL( - CCmSqlPropertyItem& aItem, TCmMetadataField aField ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::SyncAddPropertyItemL")); - - iConnection->SyncAddPropertyItemL( aItem, aField ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::AsyncBatchDelete -// --------------------------------------------------------------------------- -// -void CCmSqlMain::AsyncBatchDelete( - RPointerArray& aItems, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncBatchDelete")); - - iConnection->AsyncBatchDelete( aItems, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::AsyncMetadataDelete -// --------------------------------------------------------------------------- -// -void CCmSqlMain::AsyncMetadataDelete( - RArray& aMsIds, TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::AsyncMetadataDelete")); - - iConnection->AsyncMetadataDelete( aMsIds, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::DeleteOldestMediaItemsL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::DeleteOldestMediaItemsL( TCmMediaType aType, - TInt64 aCount ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::DeleteOldestMediaItemsL")); - - iConnection->DeleteOldestMediaItemsL( aType, aCount ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::DeleteUnusedPropertys -// --------------------------------------------------------------------------- -// -void CCmSqlMain::DeleteUnusedPropertys( ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::DeleteUnusedPropertys")); - - iConnection->DeleteUnusedPropertys( ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::GetItemsL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::GetItemsL( RPointerArray& aItems, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetItemsL")); - - iConnection->GetItemsL( aItems, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::GetFillItemsL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::GetFillItemsL( - RPointerArray& aItems, CCmFillRule& aRule, - TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetFillItemsL")); - - iClause->FormatClauseL( aRule ); - iConnection->GetFillItemsL( aItems, iClause->ClauseL(), aRule, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::GetPropertyValuesL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::GetPropertyValuesL( - RPointerArray& aItems, TRequestStatus& aStatus, - TCmMetadataField aField, TCmMediaType aMedia ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetPropertyValuesL")); - - CCmFillRule* rule = NULL; - iClause->FormatClauseL( *rule, aField, aMedia ); - iConnection->GetPropertyValuesL( aItems, iClause->ClauseL(), - aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::GetFilteredPropertyValuesL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::GetFilteredPropertyValuesL( - CCmSqlPropertyCollector& aPropertys, TRequestStatus& aStatus ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetFilteredPropertyValuesL")); - - iClause->FormatFilteringClauseL( aPropertys ); - iConnection->GetFilteredPropertyValuesL( aPropertys, iClause->ClauseL(), - aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::GetMediaCountL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::GetMediaCountL( TInt64& aCount, - TCmMediaType aType ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::GetMediaCountL")); - - iConnection->GetMediaCountL( aCount, aType ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::Exists -// --------------------------------------------------------------------------- -// -TBool CCmSqlMain::ExistsL( const CCmBaseListItem& aItem, - const TInt aDevId ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::ExistsL")); - - return iConnection->ExistsL( aItem, aDevId ); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::Close -// --------------------------------------------------------------------------- -// -void CCmSqlMain::Close() - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::Close")); - - delete this; - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::CCmSqlMain -// --------------------------------------------------------------------------- -// -CCmSqlMain::CCmSqlMain( RFs& aFs ): iFs( aFs ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::CCmSqlMain")); - } - -// --------------------------------------------------------------------------- -// CCmSqlMain::ConstructL -// --------------------------------------------------------------------------- -// -void CCmSqlMain::ConstructL() - { - LOG(_L("[SQL Wrapper]\t CCmSqlMain::ConstructL")); - - TRAP_IGNORE( BaflUtils::EnsurePathExistsL( iFs, KCmSqlDirC ) ); - iClause = CCmSqlDbClause::NewL(); - iMaintenance = CCmSqlDbMaintenance::NewL(); - iConnection = CCmSqlConnection::NewL(); - - if( iMaintenance->InitConnection(*iConnection) ) - { - iMaintenance->CreateDbFile( *iConnection ); - } - if( !iConnection->Validate() ) - { - iMaintenance->CreateDb( *iConnection ); - iMaintenance->CreateIndexes( *iConnection ); - } - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/cmsqlwrapper/src/cmsqlmainfactory.cpp --- a/upnpharvester/common/cmsqlwrapper/src/cmsqlmainfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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: The factory for CCmSqlMain -* -*/ - - - - - - -#include "cmsqlmainfactory.h" -#include "cmsqlmain.h" -#include "mcmsqlmain.h" -#include "msdebug.h" - -// -------------------------------------------------------------------------- -// CCmSqlMainFactory::NewCmSqlMainL -// -------------------------------------------------------------------------- -// -EXPORT_C MCmSqlMain* CCmSqlMainFactory::NewCmSqlMainL( RFs& aFs ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMainFactory::NewCmSqlMainL")); - - return CCmSqlMain::NewL( aFs ); - } - -// -------------------------------------------------------------------------- -// CCmSqlMainFactory::NewCmSqlMainL -// -------------------------------------------------------------------------- -// -EXPORT_C MCmSqlMain* CCmSqlMainFactory::NewCmSqlMainLC( RFs& aFs ) - { - LOG(_L("[SQL Wrapper]\t CCmSqlMainFactory::NewCmSqlMainLC")); - - return CCmSqlMain::NewLC( aFs ); - } - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/bwins/cmdatabasemanageru.def --- a/upnpharvester/common/dbmanager/bwins/cmdatabasemanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -EXPORTS - ?IncrementShrinkTimeL@CCmDmMain@@QAEHHH@Z @ 1 NONAME ; int CCmDmMain::IncrementShrinkTimeL(int, int) - ?QueryFillFileListL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmBaseListItem@@@@ABVTDesC8@@I@Z @ 2 NONAME ; int CCmDmMain::QueryFillFileListL(class RPointerArray &, class TDesC8 const &, unsigned int) - ?UpdateFillTransferStatus@CCmDmMain@@QAEXIPAVCCmFillListItem@@@Z @ 3 NONAME ; void CCmDmMain::UpdateFillTransferStatus(unsigned int, class CCmFillListItem *) - ?GetFillFileCount@CCmDmMain@@QAEHABVTDesC8@@IAAH@Z @ 4 NONAME ; int CCmDmMain::GetFillFileCount(class TDesC8 const &, unsigned int, int &) - ?NewLC@CCmDmMain@@SAPAV1@XZ @ 5 NONAME ; class CCmDmMain * CCmDmMain::NewLC(void) - ?SetMediaServersL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 6 NONAME ; int CCmDmMain::SetMediaServersL(class RPointerArray &) - ?UpdateTransferInfo@CCmDmMain@@QAEHW4TCmService@@HH@Z @ 7 NONAME ; int CCmDmMain::UpdateTransferInfo(enum TCmService, int, int) - ?QueryMediaServerL@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 8 NONAME ; int CCmDmMain::QueryMediaServerL(class CCmMediaServerFull *) - ?UpdateFillListDriveStatusesL@CCmDmMain@@QAEXPAVCCmDriveInfo@@0H@Z @ 9 NONAME ; void CCmDmMain::UpdateFillListDriveStatusesL(class CCmDriveInfo *, class CCmDriveInfo *, int) - ?SetDrivesL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 10 NONAME ; void CCmDmMain::SetDrivesL(class RPointerArray &) - ?UpdateDownloadHistory@CCmDmMain@@QAEHIAA_J0@Z @ 11 NONAME ; int CCmDmMain::UpdateDownloadHistory(unsigned int, long long &, long long &) - ?QueryFillRuleL@CCmDmMain@@QAEHPAVCCmFillRule@@@Z @ 12 NONAME ; int CCmDmMain::QueryFillRuleL(class CCmFillRule *) - ??1CCmDmMain@@UAE@XZ @ 13 NONAME ; CCmDmMain::~CCmDmMain(void) - ?SetFillListRealCountAndSizeL@CCmDmMain@@QAEX_J00@Z @ 14 NONAME ; void CCmDmMain::SetFillListRealCountAndSizeL(long long, long long, long long) - ?AddMediaServerL@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 15 NONAME ; int CCmDmMain::AddMediaServerL(class CCmMediaServerFull *) - ?KBytesToBeFilled@CCmDmMain@@QAE_JEI@Z @ 16 NONAME ; long long CCmDmMain::KBytesToBeFilled(unsigned char, unsigned int) - ?UpdateFillRuleSelected@CCmDmMain@@QAEHABVTDesC8@@H@Z @ 17 NONAME ; int CCmDmMain::UpdateFillRuleSelected(class TDesC8 const &, int) - ?SetProgressInfo@CCmDmMain@@QAEHHH@Z @ 18 NONAME ; int CCmDmMain::SetProgressInfo(int, int) - ?BytesFilled@CCmDmMain@@QAE_JI@Z @ 19 NONAME ; long long CCmDmMain::BytesFilled(unsigned int) - ?FillFileCount@CCmDmMain@@QAEHI@Z @ 20 NONAME ; int CCmDmMain::FillFileCount(unsigned int) - ?QuerySelectedFillRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@H@Z @ 21 NONAME ; void CCmDmMain::QuerySelectedFillRuleNamesL(class RPointerArray &, int) - ?QueryHashValuesL@CCmDmMain@@QAEHHAAV?$RPointerArray@VCCmSearchResponseHash@@@@@Z @ 22 NONAME ; int CCmDmMain::QueryHashValuesL(int, class RPointerArray &) - ?NewL@CCmDmMain@@SAPAV1@XZ @ 23 NONAME ; class CCmDmMain * CCmDmMain::NewL(void) - ?AddStoredL@CCmDmMain@@QAEHABVTDesC16@@ABVTDesC8@@VTTime@@@Z @ 24 NONAME ; int CCmDmMain::AddStoredL(class TDesC16 const &, class TDesC8 const &, class TTime) - ?DeleteAllStoreRules@CCmDmMain@@QAEHXZ @ 25 NONAME ; int CCmDmMain::DeleteAllStoreRules(void) - ?DeleteStoreFiles@CCmDmMain@@QAEHXZ @ 26 NONAME ; int CCmDmMain::DeleteStoreFiles(void) - ?GetSyncTime@CCmDmMain@@QAEHAAVTTime@@@Z @ 27 NONAME ; int CCmDmMain::GetSyncTime(class TTime &) - ?QueryAllStoreFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmStoreListItem@@@@@Z @ 28 NONAME ; int CCmDmMain::QueryAllStoreFilesL(class RPointerArray &) - ?QueryStoreRuleL@CCmDmMain@@QAEHPAVCCmStoreRule@@@Z @ 29 NONAME ; int CCmDmMain::QueryStoreRuleL(class CCmStoreRule *) - ?DeleteFillFiles@CCmDmMain@@QAEHXZ @ 30 NONAME ; int CCmDmMain::DeleteFillFiles(void) - ?QueryMediaServerId@CCmDmMain@@QAE_JABVTDesC8@@@Z @ 31 NONAME ; long long CCmDmMain::QueryMediaServerId(class TDesC8 const &) - ?GetStoreFileCountNoDuplicatesL@CCmDmMain@@QAEXAAHI@Z @ 32 NONAME ; void CCmDmMain::GetStoreFileCountNoDuplicatesL(int &, unsigned int) - ?QuerySelectedStoreRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@H@Z @ 33 NONAME ; void CCmDmMain::QuerySelectedStoreRuleNamesL(class RPointerArray &, int) - ?AddHashValue@CCmDmMain@@QAEH_JPAVCCmSearchResponseHash@@@Z @ 34 NONAME ; int CCmDmMain::AddHashValue(long long, class CCmSearchResponseHash *) - ?QueryStoredRowL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC16@@@@ABVTDesC8@@H@Z @ 35 NONAME ; void CCmDmMain::QueryStoredRowL(class RPointerArray &, class TDesC8 const &, int) - ?PrepareQueryCmdL@CCmDmMain@@QAEXW4TCMQueryCmdType@@@Z @ 36 NONAME ; void CCmDmMain::PrepareQueryCmdL(enum TCMQueryCmdType) - ?DeleteItemsByFillListId@CCmDmMain@@QAEHH@Z @ 37 NONAME ; int CCmDmMain::DeleteItemsByFillListId(int) - ?QueryStoreRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@@Z @ 38 NONAME ; void CCmDmMain::QueryStoreRuleNamesL(class RPointerArray &) - ?UpdateFillListItemPriority@CCmDmMain@@QAEHPAVCCmFillRuleContainer@@@Z @ 39 NONAME ; int CCmDmMain::UpdateFillListItemPriority(class CCmFillRuleContainer *) - ?GetLowPriorityFilledFilesL@CCmDmMain@@QAEHHAAV?$RPointerArray@VCCmFillListItem@@@@@Z @ 40 NONAME ; int CCmDmMain::GetLowPriorityFilledFilesL(int, class RPointerArray &) - ?DeleteAllFillRules@CCmDmMain@@QAEHXZ @ 41 NONAME ; int CCmDmMain::DeleteAllFillRules(void) - ?NewLC@CCmDmSqlDbMaintenance@@SAPAV1@XZ @ 42 NONAME ; class CCmDmSqlDbMaintenance * CCmDmSqlDbMaintenance::NewLC(void) - ?UpdateFillRuleGroupInfo@CCmDmMain@@QAEHXZ @ 43 NONAME ; int CCmDmMain::UpdateFillRuleGroupInfo(void) - ?QueryDeletedItemsListsL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmBaseListItem@@@@I@Z @ 44 NONAME ; void CCmDmMain::QueryDeletedItemsListsL(class RPointerArray &, unsigned int) - ?ListSize@CCmDmMain@@QAE_JW4TCmRuleType@@ABVTDesC8@@I@Z @ 45 NONAME ; long long CCmDmMain::ListSize(enum TCmRuleType, class TDesC8 const &, unsigned int) - ?GetTransferInfo@CCmDmMain@@QAEHW4TCmService@@AAH1@Z @ 46 NONAME ; int CCmDmMain::GetTransferInfo(enum TCmService, int &, int &) - ?QueryDrivesL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmDriveInfo@@@@@Z @ 47 NONAME ; void CCmDmMain::QueryDrivesL(class RPointerArray &) - ?SetStoreFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmStoreListItem@@@@@Z @ 48 NONAME ; int CCmDmMain::SetStoreFilesL(class RPointerArray &) - ?GetMediaServersL@CCmDmMain@@QAEXAAV?$RPointerArray@VCCmMediaServerFull@@@@@Z @ 49 NONAME ; void CCmDmMain::GetMediaServersL(class RPointerArray &) - ?QueryAllFillFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmFillListItem@@@@@Z @ 50 NONAME ; int CCmDmMain::QueryAllFillFilesL(class RPointerArray &) - ?QueryStoreFileListL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmBaseListItem@@@@ABVTDesC8@@I@Z @ 51 NONAME ; int CCmDmMain::QueryStoreFileListL(class RPointerArray &, class TDesC8 const &, unsigned int) - ?UpdateMediaServerInfo@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 52 NONAME ; int CCmDmMain::UpdateMediaServerInfo(class CCmMediaServerFull *) - ?DeleteMediaServer@CCmDmMain@@QAEHABVTDesC8@@@Z @ 53 NONAME ; int CCmDmMain::DeleteMediaServer(class TDesC8 const &) - ?UpdateUploadHistory@CCmDmMain@@QAEHIAA_J0@Z @ 54 NONAME ; int CCmDmMain::UpdateUploadHistory(unsigned int, long long &, long long &) - ?AddStoreFile@CCmDmMain@@QAEHAAVCCmStoreListItem@@@Z @ 55 NONAME ; int CCmDmMain::AddStoreFile(class CCmStoreListItem &) - ?GetAllStoreFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmStoreListItem@@@@I@Z @ 56 NONAME ; int CCmDmMain::GetAllStoreFilesL(class RPointerArray &, unsigned int) - ?SetFillListStateL@CCmDmMain@@QAEXIW4TCmFillRuleStatus@@@Z @ 57 NONAME ; void CCmDmMain::SetFillListStateL(unsigned int, enum TCmFillRuleStatus) - ?DeleteHashValuesL@CCmDmMain@@QAEXHH@Z @ 58 NONAME ; void CCmDmMain::DeleteHashValuesL(int, int) - ?DeleteDeletedMediaServersL@CCmDmMain@@QAEXXZ @ 59 NONAME ; void CCmDmMain::DeleteDeletedMediaServersL(void) - ?GetProgressInfo@CCmDmMain@@QAEHAAH0@Z @ 60 NONAME ; int CCmDmMain::GetProgressInfo(int &, int &) - ?StoreFileCount@CCmDmMain@@QAEHI@Z @ 61 NONAME ; int CCmDmMain::StoreFileCount(unsigned int) - ?GetFillListNameL@CCmDmMain@@QAEXAAPAVHBufC8@@_J@Z @ 62 NONAME ; void CCmDmMain::GetFillListNameL(class HBufC8 * &, long long) - ?QueryAllMediaServersL@CCmDmMain@@QAEHPAVCCmMediaServerFull@@@Z @ 63 NONAME ; int CCmDmMain::QueryAllMediaServersL(class CCmMediaServerFull *) - ?DeleteDeletedItemsL@CCmDmMain@@QAEXXZ @ 64 NONAME ; void CCmDmMain::DeleteDeletedItemsL(void) - ?QueryFillRuleNamesL@CCmDmMain@@QAEXAAV?$RPointerArray@VHBufC8@@@@@Z @ 65 NONAME ; void CCmDmMain::QueryFillRuleNamesL(class RPointerArray &) - ?UpdateStoreTransferStatus@CCmDmMain@@QAEXI_J0@Z @ 66 NONAME ; void CCmDmMain::UpdateStoreTransferStatus(unsigned int, long long, long long) - ?GetStoreFileCount@CCmDmMain@@QAEHABVTDesC8@@IAAH@Z @ 67 NONAME ; int CCmDmMain::GetStoreFileCount(class TDesC8 const &, unsigned int, int &) - ?DeleteFillRuleByName@CCmDmMain@@QAEHABVTDesC8@@@Z @ 68 NONAME ; int CCmDmMain::DeleteFillRuleByName(class TDesC8 const &) - ?SetSyncTime@CCmDmMain@@QAEHXZ @ 69 NONAME ; int CCmDmMain::SetSyncTime(void) - ?AddStoreRuleL@CCmDmMain@@QAEHPAVCCmStoreRule@@@Z @ 70 NONAME ; int CCmDmMain::AddStoreRuleL(class CCmStoreRule *) - ?GetAvgImageShrinkTime@CCmDmMain@@QAEHXZ @ 71 NONAME ; int CCmDmMain::GetAvgImageShrinkTime(void) - ?KBytesToBeStored@CCmDmMain@@QAE_JEI@Z @ 72 NONAME ; long long CCmDmMain::KBytesToBeStored(unsigned char, unsigned int) - ?NewL@CCmDmSqlDbMaintenance@@SAPAV1@XZ @ 73 NONAME ; class CCmDmSqlDbMaintenance * CCmDmSqlDbMaintenance::NewL(void) - ?QueryMediaServerUdn@CCmDmMain@@QAEHAAPAVHBufC8@@J@Z @ 74 NONAME ; int CCmDmMain::QueryMediaServerUdn(class HBufC8 * &, long) - ?RestoreFileStatusesL@CCmDmMain@@QAEXABV?$RPointerArray@VCCmFillListItem@@@@ABVTDesC8@@@Z @ 75 NONAME ; void CCmDmMain::RestoreFileStatusesL(class RPointerArray const &, class TDesC8 const &) - ?SetFillFiles@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmFillListItem@@@@@Z @ 76 NONAME ; int CCmDmMain::SetFillFiles(class RPointerArray &) - ?UpdateStatusValues@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmBaseListItem@@@@@Z @ 77 NONAME ; int CCmDmMain::UpdateStatusValues(class RPointerArray &) - ?GetAllFillFilesL@CCmDmMain@@QAEHAAV?$RPointerArray@VCCmFillListItem@@@@I@Z @ 78 NONAME ; int CCmDmMain::GetAllFillFilesL(class RPointerArray &, unsigned int) - ?StoreFileCountNoDuplicates@CCmDmMain@@QAEHXZ @ 79 NONAME ; int CCmDmMain::StoreFileCountNoDuplicates(void) - ?AddFillRuleL@CCmDmMain@@QAEHPAVCCmFillRule@@@Z @ 80 NONAME ; int CCmDmMain::AddFillRuleL(class CCmFillRule *) - ?QueryTransferHistory@CCmDmMain@@QAEXABVTDesC8@@AA_J111@Z @ 81 NONAME ; void CCmDmMain::QueryTransferHistory(class TDesC8 const &, long long &, long long &, long long &, long long &) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/eabi/cmdatabasemanageru.def --- a/upnpharvester/common/dbmanager/eabi/cmdatabasemanageru.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -EXPORTS - _ZN9CCmDmMain10AddStoredLERK7TDesC16RK6TDesC85TTime @ 1 NONAME - _ZN9CCmDmMain10SetDrivesLER13RPointerArrayI12CCmDriveInfoE @ 2 NONAME - _ZN9CCmDmMain11BytesFilledEj @ 3 NONAME - _ZN9CCmDmMain11GetSyncTimeER5TTime @ 4 NONAME - _ZN9CCmDmMain11SetSyncTimeEv @ 5 NONAME - _ZN9CCmDmMain12AddFillRuleLEP11CCmFillRule @ 6 NONAME - _ZN9CCmDmMain12AddHashValueExP21CCmSearchResponseHash @ 7 NONAME - _ZN9CCmDmMain12AddStoreFileER16CCmStoreListItem @ 8 NONAME - _ZN9CCmDmMain12QueryDrivesLER13RPointerArrayI12CCmDriveInfoE @ 9 NONAME - _ZN9CCmDmMain12SetFillFilesER13RPointerArrayI15CCmFillListItemE @ 10 NONAME - _ZN9CCmDmMain13AddStoreRuleLEP12CCmStoreRule @ 11 NONAME - _ZN9CCmDmMain13FillFileCountEj @ 12 NONAME - _ZN9CCmDmMain14QueryFillRuleLEP11CCmFillRule @ 13 NONAME - _ZN9CCmDmMain14SetStoreFilesLER13RPointerArrayI16CCmStoreListItemE @ 14 NONAME - _ZN9CCmDmMain14StoreFileCountEj @ 15 NONAME - _ZN9CCmDmMain15AddMediaServerLEP18CCmMediaServerFull @ 16 NONAME - _ZN9CCmDmMain15DeleteFillFilesEv @ 17 NONAME - _ZN9CCmDmMain15GetProgressInfoERiS0_ @ 18 NONAME - _ZN9CCmDmMain15GetTransferInfoE10TCmServiceRiS1_ @ 19 NONAME - _ZN9CCmDmMain15QueryStoreRuleLEP12CCmStoreRule @ 20 NONAME - _ZN9CCmDmMain15QueryStoredRowLER13RPointerArrayI7HBufC16ERK6TDesC8i @ 21 NONAME - _ZN9CCmDmMain15SetProgressInfoEii @ 22 NONAME - _ZN9CCmDmMain16DeleteStoreFilesEv @ 23 NONAME - _ZN9CCmDmMain16GetAllFillFilesLER13RPointerArrayI15CCmFillListItemEj @ 24 NONAME - _ZN9CCmDmMain16GetFillFileCountERK6TDesC8jRi @ 25 NONAME - _ZN9CCmDmMain16GetFillListNameLERP6HBufC8x @ 26 NONAME - _ZN9CCmDmMain16GetMediaServersLER13RPointerArrayI18CCmMediaServerFullE @ 27 NONAME - _ZN9CCmDmMain16KBytesToBeFilledEhj @ 28 NONAME - _ZN9CCmDmMain16KBytesToBeStoredEhj @ 29 NONAME - _ZN9CCmDmMain16PrepareQueryCmdLE15TCMQueryCmdType @ 30 NONAME - _ZN9CCmDmMain16QueryHashValuesLEiR13RPointerArrayI21CCmSearchResponseHashE @ 31 NONAME - _ZN9CCmDmMain16SetMediaServersLER13RPointerArrayI18CCmMediaServerFullE @ 32 NONAME - _ZN9CCmDmMain17DeleteHashValuesLEii @ 33 NONAME - _ZN9CCmDmMain17DeleteMediaServerERK6TDesC8 @ 34 NONAME - _ZN9CCmDmMain17GetAllStoreFilesLER13RPointerArrayI16CCmStoreListItemEj @ 35 NONAME - _ZN9CCmDmMain17GetStoreFileCountERK6TDesC8jRi @ 36 NONAME - _ZN9CCmDmMain17QueryMediaServerLEP18CCmMediaServerFull @ 37 NONAME - _ZN9CCmDmMain17SetFillListStateLEj17TCmFillRuleStatus @ 38 NONAME - _ZN9CCmDmMain18DeleteAllFillRulesEv @ 39 NONAME - _ZN9CCmDmMain18QueryAllFillFilesLER13RPointerArrayI15CCmFillListItemE @ 40 NONAME - _ZN9CCmDmMain18QueryFillFileListLER13RPointerArrayI15CCmBaseListItemERK6TDesC8j @ 41 NONAME - _ZN9CCmDmMain18QueryMediaServerIdERK6TDesC8 @ 42 NONAME - _ZN9CCmDmMain18UpdateStatusValuesER13RPointerArrayI15CCmBaseListItemE @ 43 NONAME - _ZN9CCmDmMain18UpdateTransferInfoE10TCmServiceii @ 44 NONAME - _ZN9CCmDmMain19DeleteAllStoreRulesEv @ 45 NONAME - _ZN9CCmDmMain19DeleteDeletedItemsLEv @ 46 NONAME - _ZN9CCmDmMain19QueryAllStoreFilesLER13RPointerArrayI16CCmStoreListItemE @ 47 NONAME - _ZN9CCmDmMain19QueryFillRuleNamesLER13RPointerArrayI6HBufC8E @ 48 NONAME - _ZN9CCmDmMain19QueryMediaServerUdnERP6HBufC8l @ 49 NONAME - _ZN9CCmDmMain19QueryStoreFileListLER13RPointerArrayI15CCmBaseListItemERK6TDesC8j @ 50 NONAME - _ZN9CCmDmMain19UpdateUploadHistoryEjRxS0_ @ 51 NONAME - _ZN9CCmDmMain20DeleteFillRuleByNameERK6TDesC8 @ 52 NONAME - _ZN9CCmDmMain20IncrementShrinkTimeLEii @ 53 NONAME - _ZN9CCmDmMain20QueryStoreRuleNamesLER13RPointerArrayI6HBufC8E @ 54 NONAME - _ZN9CCmDmMain20QueryTransferHistoryERK6TDesC8RxS3_S3_S3_ @ 55 NONAME - _ZN9CCmDmMain20RestoreFileStatusesLERK13RPointerArrayI15CCmFillListItemERK6TDesC8 @ 56 NONAME - _ZN9CCmDmMain21GetAvgImageShrinkTimeEv @ 57 NONAME - _ZN9CCmDmMain21QueryAllMediaServersLEP18CCmMediaServerFull @ 58 NONAME - _ZN9CCmDmMain21UpdateDownloadHistoryEjRxS0_ @ 59 NONAME - _ZN9CCmDmMain21UpdateMediaServerInfoEP18CCmMediaServerFull @ 60 NONAME - _ZN9CCmDmMain22UpdateFillRuleSelectedERK6TDesC8i @ 61 NONAME - _ZN9CCmDmMain23DeleteItemsByFillListIdEi @ 62 NONAME - _ZN9CCmDmMain23QueryDeletedItemsListsLER13RPointerArrayI15CCmBaseListItemEj @ 63 NONAME - _ZN9CCmDmMain23UpdateFillRuleGroupInfoEv @ 64 NONAME - _ZN9CCmDmMain24UpdateFillTransferStatusEjP15CCmFillListItem @ 65 NONAME - _ZN9CCmDmMain25UpdateStoreTransferStatusEjxx @ 66 NONAME - _ZN9CCmDmMain26DeleteDeletedMediaServersLEv @ 67 NONAME - _ZN9CCmDmMain26GetLowPriorityFilledFilesLEiR13RPointerArrayI15CCmFillListItemE @ 68 NONAME - _ZN9CCmDmMain26StoreFileCountNoDuplicatesEv @ 69 NONAME - _ZN9CCmDmMain26UpdateFillListItemPriorityEP20CCmFillRuleContainer @ 70 NONAME - _ZN9CCmDmMain27QuerySelectedFillRuleNamesLER13RPointerArrayI6HBufC8Ei @ 71 NONAME - _ZN9CCmDmMain28QuerySelectedStoreRuleNamesLER13RPointerArrayI6HBufC8Ei @ 72 NONAME - _ZN9CCmDmMain28SetFillListRealCountAndSizeLExxx @ 73 NONAME - _ZN9CCmDmMain28UpdateFillListDriveStatusesLEP12CCmDriveInfoS1_i @ 74 NONAME - _ZN9CCmDmMain30GetStoreFileCountNoDuplicatesLERij @ 75 NONAME - _ZN9CCmDmMain4NewLEv @ 76 NONAME - _ZN9CCmDmMain5NewLCEv @ 77 NONAME - _ZN9CCmDmMain8ListSizeE11TCmRuleTypeRK6TDesC8j @ 78 NONAME - _ZN9CCmDmMainD0Ev @ 79 NONAME - _ZN9CCmDmMainD1Ev @ 80 NONAME - _ZN9CCmDmMainD2Ev @ 81 NONAME - _ZTI21CCmDmSqlDbMaintenance @ 82 NONAME ; ## - _ZTI9CCmDmMain @ 83 NONAME ; ## - _ZTV21CCmDmSqlDbMaintenance @ 84 NONAME ; ## - _ZTV9CCmDmMain @ 85 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/group/bld.inf --- a/upnpharvester/common/dbmanager/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 information file for Database Manager -* -*/ - - -// Supported platforms -PRJ_PLATFORMS -DEFAULT - - -PRJ_EXPORTS -../inc/cmdmmain.h |../../../../inc/cmdmmain.h - -// MMP files -PRJ_MMPFILES -cmdatabasemanager.mmp diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/group/cmdatabasemanager.mmp --- a/upnpharvester/common/dbmanager/group/cmdatabasemanager.mmp Mon Nov 01 13:44:24 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 project Database Manager -* -*/ - - - - - - -#include - -TARGET cmdatabasemanager.dll -TARGETTYPE dll -UID 0x1000008d 0x10281FA9 - -CAPABILITY CAP_GENERAL_DLL - -TARGETPATH /sys/bin - -USERINCLUDE ../inc -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src - -SOURCE cmdmmain.cpp -SOURCE cmdmsqldbmaintenance.cpp -SOURCE cmdmsqliteconnection.cpp - -LIBRARY bafl.lib -LIBRARY sqldb.lib -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY cmcommon.lib -DEBUGLIBRARY flogger.lib - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/inc/cmdmmain.h --- a/upnpharvester/common/dbmanager/inc/cmdmmain.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,952 +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: Main class in the Database manager component -* -*/ - - - - - - -#ifndef C_CMDMMAIN_H -#define C_CMDMMAIN_H - -#include -#include -#include "cmcommon.h" -#include "cmcommontypes.h" - -// Operation types -enum TCMQueryCmdType - { - EFillRuleQuery = 1, - EMediaServerInfoQyery, - EMediaServerIdQuery, - EMediaServerUDNQuery, - EMediaServersAllQuery, - EHashValueQuery, - EFilledQuery, - EStoredQuery, - EFilledRowQuery, - EStoredRowQuery, - ESelectedFillRuleQuery, - EFillRuleNamesQuery, - EStoreRuleQuery, - EStoreRuleNamesQuery, - ESelectedStoreRuleQuery, - ETransferHistoryQuery, - EFillFilesQuery, - EStoreFilesQuery, - EAllFillFilesQuery, - EAllStoreFilesQuery, - EFilledLowPriorityQuery, - EAllFillFilesStatusQuery, - EAllStoreFilesStatusQuery, - EDeletedFillFilesQuery, - EDrivesQuery - }; - -/* Forward declarations. */ -class CCmDmSqlDbMaintenance; -class CCmDmSQLiteConnection; -class CCmFillRule; -class CCmFillRuleContainer; -class CCmMediaServerFull; -class CCmStoreRule; -class CCmBaseListItem; -class CCmFillListItem; -class CCmStoreListItem; -class CCmSearchResponseHash; -class CCmDriveInfo; - - -/** - * CCmDmMain class - * Part of Database manager. Database manager is part of - * Content manager component. - * - * @lib cmdatabasemanager.lib - * - * @since S60 5.1 - */ -class CCmDmMain : public CBase - { - -public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CCmDmMain* NewL(); - - /** - * Two-phased constructor. - */ - IMPORT_C static CCmDmMain* NewLC(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CCmDmMain(); - - /** - * Prepares query command - * - * @since S60 5.1 - * @param aType type of query - * @return None - */ - IMPORT_C void PrepareQueryCmdL( TCMQueryCmdType aType ); - - /** - * Query fill rule - * - * @since S60 5.1 - * @param aFillRule - * @return TInt, Error code - */ - IMPORT_C TInt QueryFillRuleL( CCmFillRule* aFillRule ); - - /** - * Query names of selected fill rules - * - * @since S60 5.1 - * @param aNames - * @param aSelected - * @return None - */ - IMPORT_C void QuerySelectedFillRuleNamesL( - RPointerArray& aNames, - TInt aSelected ); - - /** - * Query names of fill rules - * - * @since S60 5.1 - * @param aNames, on return fill rule names - * @return None - */ - IMPORT_C void QueryFillRuleNamesL( RPointerArray& aNames ); - - /** - * Query store rule - * - * @since S60 5.1 - * @param aStoreRule, store list - * @return TInt, Error code - */ - IMPORT_C TInt QueryStoreRuleL( CCmStoreRule* aStoreRule ); - - /** - * Query store rule names - * - * @since S60 5.1 - * @param aNames, list names - * @return None - */ - IMPORT_C void QueryStoreRuleNamesL( RPointerArray& aNames ); - - /** - * Query selected store rule names - * - * @since S60 5.1 - * @param aNames, list names - * @param aSelected, selection status - * @return None - */ - IMPORT_C void QuerySelectedStoreRuleNamesL( - RPointerArray& aNames, - TInt aSelected ); - - /** - * Query media server info - * - * @since S60 5.1 - * @param aMediaServer, mediaserver - * @return TInt, Error code - */ - IMPORT_C TInt QueryMediaServerL( CCmMediaServerFull* aMediaServer ); - - /** - * Query media server ids - * - * @since S60 5.1 - * @param aUDN, server UDN - * @return TInt64, Media server id - */ - IMPORT_C TInt64 QueryMediaServerId( const TDesC8& aUDN ); - - /** - * Query media server udn - * - * @since S60 5.1 - * @param aUDN, server UDN - * @param aId, server id - * @return TInt, Error code - */ - IMPORT_C TInt QueryMediaServerUdn( HBufC8*& aUdn, const TInt32 aId ); - - /** - * Query All Media servers - * - * @since S60 5.1 - * @param aMediaServer, mediaserver - * @return TInt, Error code - */ - IMPORT_C TInt QueryAllMediaServersL( CCmMediaServerFull* aMediaServer ); - - /** - * Get media servers - * - * @since S60 5.1 - * @param aMediaServers, mediaserver list - * @return None - */ - IMPORT_C void GetMediaServersL( - RPointerArray& aMediaServers ); - - /** - * Query filled - * - * @since S60 5.1 - * @param aDrive, drive id - * @param aFilled, fill list items - * @return TInt, Error code - */ - IMPORT_C TInt GetLowPriorityFilledFilesL( - TInt aDrive, - RPointerArray& aFilled ); - - /** - * Query fill file list - * - * @since S60 5.1 - * @param aItems, fill list items - * @param aName, fill list name - * @param aStatus, list status - * @return TInt, Error code - */ - IMPORT_C TInt QueryFillFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint aStatus ); - - /** - * Query fill file list - * - * @since S60 5.1 - * @param aItems, fill list items - * @param aStatus, list status - * @return TInt, Error code - */ - IMPORT_C TInt GetAllFillFilesL( - RPointerArray& aItems, - TUint aStatus ); - - /** - * Query store file list - * - * @since S60 5.1 - * @param aItems, list items - * @param aName, list name - * @param aStatus, list status - * @return TInt, Error code - */ - IMPORT_C TInt QueryStoreFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint aStatus ); - - /** - * Query store file list - * - * @since S60 5.1 - * @param aItems, list items - * @param aStatus, list status - * @return TInt, Error code - */ - IMPORT_C TInt GetAllStoreFilesL( - RPointerArray& aItems, - TUint aStatus ); - - /** - * Query all fill files - * @since S60 5.1 - * @param aItems - * @return TInt, Error code - */ - IMPORT_C TInt QueryAllFillFilesL( - RPointerArray& aItems ); - - /** - * Query all store files - * - * @since S60 5.1 - * @param aItems, list items - * @return TInt, Error code - */ - IMPORT_C TInt QueryAllStoreFilesL( - RPointerArray& aItems ); - - /** - * Query all stored ( use aFile as a query parameter ) - * - * @since S60 5.1 - * @param aFiles, stored files - * @param aUDN, server udn - * @param aAmount, amount of files - * @return None - */ - IMPORT_C void QueryStoredRowL( - RPointerArray& aFiles, - const TDesC8& aUDN, - TInt aAmount ); - - /** - * Query transfer history - * - * @since S60 5.1 - * @param aUdn, server udn - * @param aDownloadData, download data size - * @param aUploadData, upload data size - * @param aDownloadTime, download time - * @param aUploadTime, upload time - * @return None - */ - IMPORT_C void QueryTransferHistory( - const TDesC8& aUdn, - TInt64& aDownloadData, - TInt64& aUploadData, - TInt64& aDownloadTime, - TInt64& aUploadTime ); - - /** - * Query deleted items list - * - * @since S60 5.1 - * @param aUdn, server udn - * @param aArray, array of deleted items - * @param aStatus, status info - * @return None - */ - IMPORT_C void QueryDeletedItemsListsL( - RPointerArray& aArray, - TUint aStatus ); - - /** - * Query drives - * - * @since S60 5.1 - * @param aDrives, drive array - * @return None - */ - IMPORT_C void QueryDrivesL( RPointerArray& aDrives ); - - /** - * Avarage image shrinking time - * - * @since S60 5.1 - * @return TInt, Avarage image shrinking time in millisecond - */ - IMPORT_C TInt GetAvgImageShrinkTime(); - - /** - * Get list name using list id - * - * @since S60 5.1 - * @param aListName, name of the fill list - * @param aListId, id of the named list - * @return None - */ - IMPORT_C void GetFillListNameL( - HBufC8*& aListName, - const TInt64 aListId ); - - /** - * Set fill file list - * - * @since S60 5.1 - * @param aItems, fill list items - * @return TInt Error code - */ - IMPORT_C TInt SetFillFiles( RPointerArray& aItems ); - - /** - * Set store file list - * - * @since S60 5.1 - * @param aItems, store list items - * @return TInt, Error code - */ - IMPORT_C TInt SetStoreFilesL( RPointerArray& aItems ); - - /** - * Adds one item into store file list - * - * @since S60 5.1 - * @param aItem, store list item - * @return TInt, Error code - */ - IMPORT_C TInt AddStoreFile( CCmStoreListItem& aItem ); - - /** - * Add stored item - * - * @since S60 5.1 - * @param aFileName, file name - * @param aUDN, server udn - * @param aTimeStamp, timestamp - * @return TInt, Error code - */ - IMPORT_C TInt AddStoredL( - const TDesC& aFileName, - const TDesC8& aUDN, - TTime aTimeStamp ); - - /** - * Add fill rule - * - * @since S60 5.1 - * @param aFillRule, fill list - * @return TInt, Error code - */ - IMPORT_C TInt AddFillRuleL( CCmFillRule* aFillRule ); - - /** - * Add store rule - * - * @since S60 5.1 - * @param aStoreRule, store list - * @return TInt, Error code - */ - IMPORT_C TInt AddStoreRuleL( CCmStoreRule* aStoreRule ); - - /** - * Add Media server - * - * @since S60 5.1 - * @param aMediaServer, media server - * @return TInt, Error code - */ - IMPORT_C TInt AddMediaServerL( CCmMediaServerFull* aMediaServer ); - - /** - * Add hash value - * - * @since S60 5.1 - * @param aMediaServerId, media server id - * @param aHashValue, hash value - * @return TInt, Error code - */ - IMPORT_C TInt AddHashValue( TInt64 aMediaServerId, - CCmSearchResponseHash* aHashValue ); - - /** - * Query hash values - * - * @since S60 5.1 - * @param aMediaServerId, media server id - * @param aHashValues, hash value - * @return TInt, Error code - */ - IMPORT_C TInt QueryHashValuesL( TInt aMediaServer, - RPointerArray& aHashValues ); - - /** - * Sets is active status of the media server - * - * @since S60 5.1 - * @param aServers, mediaservers - * @return TInt, Error code - */ - IMPORT_C TInt SetMediaServersL( - RPointerArray& aServers ); - - /** - * Sets last syncs time - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - IMPORT_C TInt SetSyncTime(); - - /** - * Gets last syncs time - * - * @since S60 5.1 - * @param aTime last sync time - * @return TInt, Error code - */ - IMPORT_C TInt GetSyncTime( TTime& aTime ); - - /** - * Sets Progress info - * @since S60 5.1 - * - * @param aTransferred how many files transferred - * @param aTotalCount how many will be trasferred - * @return TInt, Error code - */ - IMPORT_C TInt SetProgressInfo( TInt aTransferred, TInt aTotalCount ); - - /** - * Gets Progress info - * - * @since S60 5.1 - * @param aTransferred how many files transferred - * @param aTotalCount how many will be trasferred - * @return TInt, Error code - */ - IMPORT_C TInt GetProgressInfo( - TInt& aTransferred, - TInt& aTotalCount ); - - /** - * Sets Drives info - * - * @since S60 5.1 - * @param aDrives, drives to be set into database - * @return None - */ - IMPORT_C void SetDrivesL( RPointerArray& aDrives ); - - /** - * Remove media server info from database - * - * @since S60 5.1 - * @param aUDN, server udn - * @return TInt, Error code - */ - IMPORT_C TInt DeleteMediaServer( const TDesC8& aUDN ); - - /** - * Remove fill rule from database - * - * @since S60 5.1 - * @param aName, fill list name - * @return TInt, Error code - */ - IMPORT_C TInt DeleteFillRuleByName( const TDesC8& aName ); - - /** - * Delete all fill rules - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - IMPORT_C TInt DeleteAllFillRules(); - - /** - * Delete all store rules - * - * @since S60 5.1 - * @param None - * @return Error code - */ - IMPORT_C TInt DeleteAllStoreRules(); - - /** - * Deletes all fill files - * - * @since S60 5.1 - * @param None - * @return Error code - */ - IMPORT_C TInt DeleteFillFiles(); - - /** - * Deletes all store files - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - IMPORT_C TInt DeleteStoreFiles(); - - /** - * Delete deleted items - * - * @since S60 5.1 - * @param None - * @return None - */ - IMPORT_C void DeleteDeletedItemsL(); - - /** - * Delete items by FillListId - * - * @since S60 5.1 - * @param FillListId, fill list id - * @return TInt, Error code - */ - IMPORT_C TInt DeleteItemsByFillListId( TInt aFillListId ); - - /** - * Delete deleted media servers - * - * @since S60 5.1 - * @param None - * @return None - */ - IMPORT_C void DeleteDeletedMediaServersL(); - - /** - * Deletes hash values - * - * @since S60 5.1 - * @param aMediaServerId, media server id - * @param aSearchIndex, search index - * @return None - */ - IMPORT_C void DeleteHashValuesL( const TInt aMediaserverId, - const TInt aSearchIndex ); - - /** - * Update media server info - * - * @since S60 5.1 - * @param aMediaServer, media server - * @return TInt, Error code - */ - IMPORT_C TInt UpdateMediaServerInfo( CCmMediaServerFull* aMediaServer ); - - /** - * Update status of the fill rule ( selected or not ) - * - * @since S60 5.1 - * @param aName, list name - * @param aSelected, selection status - * @return TInt, Error code - */ - IMPORT_C TInt UpdateFillRuleSelected( - const TDesC8& aName, - TInt aSelected ); - - /** - * Update Download history - * - * @since S60 5.1 - * @param aMediaServerId, server id - * @param aDownloadData, download data size - * @param aDownloadTime, download time - * @return TInt, Error code - */ - IMPORT_C TInt UpdateDownloadHistory( - TUint aMediaServerId, - TInt64& aDownloadData, - TInt64& aDownloadTime ); - - /** - * Update Upload history - * - * @since S60 5.1 - * @param aMediaServerId, server id - * @param aUploadData, upload data size - * @param aUploadTime, upload time - * @return TInt, Error code - */ - IMPORT_C TInt UpdateUploadHistory( - TUint aMediaServerId, - TInt64& aUploadData, - TInt64& aUploadTime ); - - /** - * Update status values - * - * @since S60 5.1 - * @param aStatusValues, status values of items - * @return TInt, Error code - */ - IMPORT_C TInt UpdateStatusValues( - RPointerArray& aStatusValues ); - - /** - * Update fill list drive statuses - * - * @since S60 5.1 - * @param aDrive, drive info - * @para aDriveSelected, if ETrue drive selected but slot changed - * @return None - */ - IMPORT_C void UpdateFillListDriveStatusesL( - CCmDriveInfo* aOrigDrive, - CCmDriveInfo* aNewDrive, - TBool aDriveSelected ); - - /** - * Update fill list item priorities - * - * @since S60 5.1 - * @param aContainer, fill list container - * @return TInt, Error code - */ - IMPORT_C TInt UpdateFillListItemPriority( - CCmFillRuleContainer* aContainer ); - - /** - * Update fill selection state into fill file table - * - * @since S60 5.1 - * @param aListName, fill list name - * @param aState, fill list status - * @return None - */ - IMPORT_C void SetFillListStateL( - const TUint aListName, - TCmFillRuleStatus aState ); - - /** - * - * Restoring file statuses - * @since S60 5.1 - * @param aItems, array of filled items - * @param aListName, list name - * @return None - */ - IMPORT_C void RestoreFileStatusesL( - const RPointerArray& aItems, - const TDesC8& aListName ); - - /** - * - * Increment image shrinking history info - * - * @since S60 5.1 - * @param aImageCount, image count - * @param aMilliSeconds, shrinking time - * @return TInt, Error code - */ - IMPORT_C TInt IncrementShrinkTimeL( - TInt aImageCount, - TInt aMilliSeconds ); - - /** - * Returns size of the named list - * - * @since S60 5.1 - * @param aType, List type - * @param aListName, list name - * @param aStatus, list status - * @return TInt64, Size in bytes - */ - IMPORT_C TInt64 ListSize( - TCmRuleType aType, - const TDesC8& aListName, - TUint aStatus ); - - /** - * Returns file count which are waiting to be stored - * - * @since S60 5.1 - * @param aStatus, file status - * @return TInt, File count - */ - IMPORT_C TInt StoreFileCount( TUint aStatus ); - - /** - * Returns file count which are waiting to be stored - * - * @since S60 5.1 - * @param None - * @return size of the list - */ - IMPORT_C TInt StoreFileCountNoDuplicates(); - - /** - * Returns file count which are waiting to be filled - * - * @since S60 5.1 - * @param aStatus, file status - * @return TInt, File count - */ - IMPORT_C TInt FillFileCount( TUint aStatus ); - - /** - * Returns data amount filled - * @since S60 5.1 - * @param aID id of fill rule - * @return sum of file sizes - */ - IMPORT_C TInt64 BytesFilled( - TUint aID ); - - /** - * Returns data amount to be filled - * @since S60 5.1 - * @param aMediaServerId, media server id - * @param aStatus, file status - * @return TInt64, sum of file sizes - */ - IMPORT_C TInt64 KBytesToBeFilled( - TUint8 aMediaServerId, - TUint aStatus ); - - /** - * Returns data amount to be stored - * - * @since S60 5.1 - * @param aMediaServerId, media server id - * @param aStatus, file status - * @return TInt64, sum of file sizes - */ - IMPORT_C TInt64 KBytesToBeStored( - TUint8 aMediaServerId, - TUint aStatus ); - - /** - * Updates list size and approx. transfer time - * - * @since S60 5.1 - * @param aService, contentmanager service - * @param aCount, item count - * @param aTime, transfer time in milliseconds - * @return TInt, error code - */ - IMPORT_C TInt UpdateTransferInfo( - TCmService aService, - TInt aCount, - TInt aTime ); - - /** - * Updates file status - * - * @since S60 v3.1 - * @param aStatus, file status - * @param aFid, file id - * @param aMsId, server id - * @return None - */ - IMPORT_C void UpdateStoreTransferStatus( - TUint aStatus, - TInt64 aFid, - TInt64 aMsId ); - - /** - * Updates file status - * - * @since S60 5.1 - * @param aStatus, file status - * @param aItem, fill list item - * @return None - */ - IMPORT_C void UpdateFillTransferStatus( - TUint aStatus, - CCmFillListItem* aItem ); - - /** - * Get list size and approx. transfer time - * - * @since S60 5.1 - * @param aService, content manager service - * @param aCount pieces, item count - * @param aTime, transfer time in milliseconds - * @return TInt, error code - */ - IMPORT_C TInt GetTransferInfo( - TCmService aService, - TInt& aCount, - TInt& aTime ); - - /** - * Files to be stored and included into specified list - * - * @since S60 5.1 - * @param aListName, store list name - * @param aStatus, list status - * @param aCount, item count - * @return TInt, error code - */ - IMPORT_C TInt GetStoreFileCount( - const TDesC8& aListName, - TUint aStatus, - TInt& aCount ); - - /** - * Files to be filled and included into specified list - * - * @since S60 5.1 - * @param aListName, fill list name - * @param aStatus, list status - * @param aCount, item count - * @return TInt, error code - */ - IMPORT_C TInt GetFillFileCount( - const TDesC8& aListName, - TUint aStatus, - TInt& aCount ); - - /** - * Files to be store - * - * @since S60 5.1 - * @param aCount, file count - * @param aStatus, file status - * @return None - */ - IMPORT_C void GetStoreFileCountNoDuplicatesL( - TInt& aCount, - TUint aStatus ); - - /** - * Sets fill list real information - * - * @since S60 5.1 - * @param aListId, list id - * @param aRealCount, item count - * @param aRealSize, list size - * @return None - */ - IMPORT_C void SetFillListRealCountAndSizeL( - TInt64 aListId, - TInt64 aRealCount, - TInt64 aRealSize ); - - /** - * update the fill rule realsize and realcount field - * - * @since S60 5.1 - * @return TInt, error code - */ - IMPORT_C TInt UpdateFillRuleGroupInfo(); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmDmMain(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * Pointer to SQLite connection class - */ - CCmDmSQLiteConnection* iConnection; // owned - - /** - * Pointer to database maintenance class - */ - CCmDmSqlDbMaintenance* iMaintenance; // owned - }; - -#endif // C_CMDMMAIN_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/inc/cmdmsqlclausedef.h --- a/upnpharvester/common/dbmanager/inc/cmdmsqlclausedef.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,931 +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: SQL clause definitions -* -*/ - - - - - - -#ifndef __CMDMSQLCLAUSEDEF_H__ -#define __CMDMSQLCLAUSEDEF_H__ - -// --------------------------------------------------------------------------- -// SELECT clauses -// --------------------------------------------------------------------------- -// -_LIT8( KSelectDeviceInfoByUDN, "SELECT " - "MediaServerID, UDN, Name, SystemUpdateID, VisibleDate, IsActive, FillUsage " - "FROM MediaServers " - "WHERE UDN = ?" - ); - -_LIT8( KSelectAllMediaServers, "SELECT " - "UDN, Name, SystemUpdateID, VisibleDate, IsActive, MediaServerID, " - "CopyCapability, FillUsage, StoreUsage " - "FROM MediaServers" - ); - -_LIT8( KSelectMediaServerIDByUDN, - "SELECT " - "MediaServerID " - "FROM MediaServers " - "WHERE UDN = ?" - ); - -_LIT8( KSelectHashValuesByMediaServer, "SELECT " - "StartIndex, ItemCount, Hash " - "FROM HashValues " - "WHERE MediaServerID = ?" - ); - -_LIT8( KSelectMediaServerUDNByID, - "SELECT " - "UDN " - "FROM MediaServers " - "WHERE MediaServerID = ?" - ); - -_LIT8( KSelectStoredByUDN, - "SELECT " - "StoredFile " - "FROM Stored " - "WHERE MediaServerID = ( " - "SELECT MediaServerID " - "FROM MediaServers " - "WHERE UDN = ? )" - ); - -_LIT8( KIsFileAlreadyStored, - "SELECT " - "MediaServerID " - "FROM MediaServers " - "WHERE MediaServerID = ( " - "SELECT " - "MediaServerID " - "FROM Stored " - "WHERE StoredFile = ? ) " - "AND " - "UDN = ?" - ); - -_LIT8( KSelectID, - "SELECT " - "IDValue " - "FROM IDs " - "WHERE IDType = ?" - ); - -_LIT8( KSelectRuleGroupID, - "SELECT " - "RuleGroupID " - "FROM FillRuleGroup " - "WHERE Name = ?" - ); - -_LIT8( KSelectStoreRuleID, - "SELECT " - "StoreRuleId " - "FROM StoreRules " - "WHERE Name = ?" - ); - -// Loading Fill Rule 1. -_LIT8( KSelectFillRule, - "SELECT " - "RuleGroupID, Name, Method, LimitType, Quantity, Selected, Priority, " - "TemplateId, MediaType, Status, RealCount, RealSize " - "FROM FillRuleGroup " - "WHERE Name = ? " - "ORDER BY Priority ASC" - ); - -// Loading Fill Rule 2. -_LIT8( KSelectRule, - "SELECT " - "RuleID, MetadataField, Operator " - "FROM Rules " - "JOIN FillRuleGroup frg ON Rules.RuleGroupID = frg.RuleGroupID " - "WHERE frg.Name = ?" - ); - -// Loading Fill Rule 3. -_LIT8( KSelectRuleParams, - "SELECT " - "ComparisonFieldData " - "FROM RuleParams " - "WHERE RuleID = ( SELECT " - "RuleID " - "FROM Rules " - "WHERE RuleGroupID = ( SELECT " - "RuleGroupID " - "FROM FillRuleGroup " - "WHERE Name = ? ))" - ); - -// Loading Fill Rule 3.1 -_LIT8( KSelectRuleParamsByRuleID, - "SELECT " - "ComparisonFieldData, ComparisonFieldIndex " - "FROM RuleParams " - "WHERE RuleID = ?" - ); - -// Loading Fill Rule 4. -_LIT8( KSelectMediaServerID, - "SELECT " - "MediaServerID " - "FROM RuleGroupServers " - "WHERE RuleGroupID = ( SELECT " - "RuleGroupID " - "FROM FillRuleGroup " - "WHERE Name = ? )" - ); - -// Loading Fill Rule 4.1 -_LIT8( KSelectMediaServerIDByRuleGroupID, - "SELECT " - "MediaServerID " - "FROM RuleGroupServers " - "WHERE RuleGroupID = ?" - ); - -// Loading Fill Rule 5. -_LIT8( KSelectRuleUDNs, - "SELECT " - "UDN " - "FROM MediaServers " - "WHERE MediaServerID = ( SELECT " - "MediaServerID " - "FROM RuleGroupServers " - "WHERE RuleGroupID = ( SELECT " - "RuleGroupID " - "FROM FillRuleGroup " - "WHERE Name = ? ))" - ); - -// Loading Fill Rule 5.1 -_LIT8( KSelectRuleUDNsByMediaServerID, - "SELECT " - "UDN " - "FROM MediaServers " - "WHERE MediaServerID = ?" - ); - -// Loading selected ( or not selected rules ) -_LIT8( KSelectSelectedFillRuleNames, - "SELECT " - "Name " - "FROM FillRuleGroup " - "WHERE Selected = ?" - ); - -// Loading all fill rule names -_LIT8( KSelectFillRuleNames, - "SELECT " - "Name " - "FROM FillRuleGroup" - ); - -_LIT8( KSelectFillRuleName, - "SELECT Name " - "FROM FillRuleGroup " - "WHERE RuleGroupID = ?" - ); - -// Loading Store Rule 1. -_LIT8( KSelectStoreRule, - "SELECT " - "StoreRuleID, Name, Selected, Status " - "FROM StoreRules " - "WHERE Name = ?" - ); - -// Loading Store Rule 2. -_LIT8( KSelectStoreRuleDefs, - "SELECT " - "StoreRuleParamId, MediaType " - "FROM StoreRuleParams " - "WHERE StoreRuleID = ( SELECT " - "StoreRuleID " - "FROM StoreRules " - "WHERE Name = ? )" - ); - -// Loading Store rule 3. -_LIT8( KSelectStoreRuleMediaServerID, - "SELECT " - "MediaServerID " - "FROM StoreRuleServers " - "WHERE StoreRuleID = ?" - ); - -// Loading all store rule names -_LIT8( KSelectStoreRuleNames, - "SELECT " - "Name " - "FROM StoreRules" - ); - -// Loading selected ( or not selected rules ) -_LIT8( KSelectSelectedStoreRuleNames, - "SELECT " - "Name " - "FROM StoreRules " - "WHERE Selected = ?" - ); - -_LIT8( KSelectFillFiles, - "SELECT " - "PrimaryText, SecondaryText, Path, Size, Status, Date, FileId, RefId " - "FROM FillFiles " - "WHERE ((Status & ? ) AND ( FillListId = " - "( SELECT RuleGroupId FROM FillRuleGroup WHERE Name = ? ) ) ) " - "ORDER BY PrimaryText" - ); - -_LIT8( KSelectDeletedFillFiles, - "SELECT " - "PrimaryText, SecondaryText, Path, Size, Status, Date, FileId " - "FROM FillFiles " - "WHERE ((Status & ? ) AND ( Selected = '2' ) )" - "ORDER BY PrimaryText" - ); - -_LIT8( KSelectAllFillFiles, - "SELECT " - "FileId, PrimaryText, SecondaryText, Path, Uri, ItemId, UpnpClass, " - "MediaType, Priority, Size, Status, Date, FillListId, MediaServerId, " - "RefId, Selected, DriveId, DriveNumber " - "FROM FillFiles " - "ORDER BY Priority ASC" - ); - -_LIT8( KGetAllFillFiles, - "SELECT " - "FileId, PrimaryText, SecondaryText, Path, Uri, ItemId, UpnpClass, " - "MediaType, Priority, Size, Status, Date, FillListId, MediaServerId, " - "RefId, Selected, DriveId, DriveNumber " - "FROM FillFiles " - "WHERE ( Status & ? ) " - "ORDER BY Priority ASC" - ); - -_LIT8( KSelectStoreFiles, - "SELECT " - "PrimaryText, SecondaryText, Path, Size, Date " - "FROM StoreFiles " - "WHERE (StoreListId = " - "( SELECT StoreRuleID FROM StoreRules WHERE Name = ? )) " - "ORDER BY PrimaryText" - ); - -_LIT8( KSelectAllStoreFiles, - "SELECT " - "FileId, PrimaryText, SecondaryText, Path, Size, sfd.Status, " - "StoreListId, sfd.MediaServerId " - "FROM StoreFiles JOIN StoreFileServers sfd ON FileId = sfd.Fid" - ); - -_LIT8( KGetAllStoreFiles, - "SELECT " - "PrimaryText, SecondaryText, Path, Size, sfd.Status, " - "StoreListId, sfd.MediaServerId " - "FROM StoreFiles JOIN StoreFileServers sfd ON FileId = sfd.Fid " - "WHERE ( sfd.Status & ? )" - ); - -_LIT8( KSelectLowestPriorityFilled, - "SELECT " - "Path, Size, FillListId, FileId " - "FROM FillFiles " - "WHERE ( Status & ? ) " - "AND ( Priority = " - "( SELECT MAX(Priority) FROM FillFiles " - "WHERE ( Status & ? AND RefId = '0' AND DriveNumber = ? ) ) )" - "ORDER BY Priority DESC" - ); - -_LIT8( KSelectTransferHistory, - "SELECT " - "DownloadData, UploadData, DownloadTime, UploadTime " - "FROM MediaServers " - "WHERE UDN = ?" - ); - -// Count all files from selected store lists ( multiple servers included ) -_LIT8( KStoreFileCount, - "SELECT count(*) " - "FROM StoreRules " - "JOIN StoreFiles files, StoreFileServers servers ON files.StoreListId = StoreRuleId " - "WHERE selected = '1' AND servers.FId = files.FileId AND servers.status & ?" - ); - -_LIT8( KStoreFileCountNoDuplicates, - "SELECT count(*) " - "FROM StoreRules " - "JOIN StoreFiles files ON files.StoreListId = StoreRuleId " - "WHERE selected = '1'" - ); - -_LIT8( KFillFileCount, - "SELECT count(*) " - "FROM FillFiles " - "WHERE status & ? AND RefId = '0' AND Selected = '1'" - ); - -_LIT8( KImageShrinkingInfo, - "SELECT Count, Time " - "FROM ImageShrinkingInfo" - ); - -_LIT8( KTranferValues, - "SELECT Count " - "FROM TransferInfo " - "WHERE Service = ?" - ); - -_LIT8( KStoreListFileCount, - "SELECT count(*) " - "FROM StoreFiles JOIN StoreRules sr ON StoreListId = sr.StoreRuleId " - "WHERE sr.Name = ?" - ); - -_LIT8( KFillListFileCount, - "SELECT count(*) " - "FROM FillFiles " - "WHERE (( Status & ?) AND (FillListId = " - "(SELECT RuleGroupID FROM FillRuleGroup WHERE Name = ?)) AND " - "( Selected = '1') )" - ); - -_LIT8( KGetSyncTime, - "SELECT * " - "FROM SyncTime" - ); - -_LIT8( KGetProgressInfo, - "SELECT Trasferred, TotalCount " - "FROM ProgressInfo" - ); - -_LIT8( KGetFillListStatus, - "SELECT Status " - "FROM FillRuleGroup " - "WHERE Name = ?" - ); - -_LIT8( KGetDrives, - "SELECT DriveNumber, DriveType, DriveName, Size, Quota, UsedQuota, " - "UniqueId, Active " - "FROM DrivesInfo " - "ORDER BY DriveType ASC" - ); - -// --------------------------------------------------------------------------- -// INSERT clauses -// --------------------------------------------------------------------------- -// -// FillRuleGroup table -_LIT8( KAddFillGroup, - "INSERT INTO FillRuleGroup(" - "RuleGroupID, Name, Method, LimitType, Quantity, " - "Selected, Priority, TemplateId, MediaType, Status, RealCount, " - "RealSize )" - "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" - ); - -// Rules table -_LIT8( KAddRule, - "INSERT INTO Rules(" - "RuleID, RuleGroupID, MetadataField, Operator )" - "VALUES(?, ?, ?, ?)" - ); - -_LIT8( KAddRuleParam, - "INSERT INTO RuleParams(" - "RuleParamID, RuleID, ComparisonFieldData, ComparisonFieldIndex )" - "VALUES(?, ?, ?, ?)" - ); - -_LIT8( KAddRuleGroupServer, - "INSERT INTO RuleGroupServers(" - "RuleGroupID, MediaServerID )" - "VALUES(?, ?)" - ); - -_LIT8( KAddMediaServer, - "INSERT INTO MediaServers(" - "MediaServerID, UDN, Name, SystemUpdateID, VisibleDate, " - "DownloadData, UploadData, DownloadTime, UploadTime, " - "IsActive, CopyCapability, FillUsage, StoreUsage )" - "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" - ); - -_LIT8( KAddHashValue, - "INSERT INTO HashValues(" - "MediaServerID, StartIndex, ItemCount, Hash )" - "VALUES(?, ?, ?, ?)" - ); - - -_LIT8( KAddStored, - "INSERT INTO Stored(" - "StoredID, StoredFile, MediaServerID, Date )" - "VALUES(?, ?, ?, ?)" - ); - -_LIT8( KAddIDs, - "INSERT INTO IDs(" - "IDValue, IDType )" - "VALUES(?, ?)" - ); - -_LIT8( KAddStoreRule, - "INSERT INTO StoreRules(" - "StoreRuleId, Name, Selected, Status )" - "VALUES(?, ?, ?, ?)" - ); - -_LIT8( KAddStoreRuleParams, - "INSERT INTO StoreRuleParams(" - "StoreRuleId, StoreRuleParamId, MediaType )" - "VALUES(?, ?, ?)" - ); - -_LIT8( KAddStoreRuleServers, - "INSERT INTO StoreRuleServers(" - "StoreRuleId, MediaServerID )" - "VALUES(?, ?)" - ); - -_LIT8( KAddFillFile, - "INSERT INTO FillFiles(" - "FileId, PrimaryText, SecondaryText, Path, Uri, ItemId, UpnpClass, " - "MediaType, Priority, Size, Status, Date, FillListId, MediaServerId, " - "RefId, Selected, DriveId, DriveNumber ) " - "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" - ); - -_LIT8( KAddStoreFile, - "INSERT INTO StoreFiles(" - "FileId, PrimaryText, SecondaryText, Path, Size, Date, StoreListId) " - "VALUES(?, ?, ?, ?, ?, ?, ?)" - ); - -_LIT8( KAddStoreFileServer, - "INSERT INTO StoreFileServers(" - "Fid, MediaServerId, Status ) " - "VALUES(?, ?, ?)" - ); - -_LIT8( KInitShrinkingTime, - "INSERT INTO ImageShrinkingInfo(" - "Count, Time ) " - "VALUES(0, 0)" - ); - -_LIT8( KInitTransferInfo, - "INSERT INTO TransferInfo(" - "Service, Count, Time ) " - "VALUES(?,0,0)" - ); - -_LIT8( KSetSyncTime, - "INSERT INTO SyncTime(" - "Time ) " - "VALUES( ? )" - ); - -_LIT8( KSetProgressInfo, - "INSERT INTO ProgressInfo( " - "Trasferred, TotalCount ) " - "VALUES( ?, ? )" - ); - -_LIT8( KSetDrivesInfo, - "INSERT INTO DrivesInfo(" - "DriveNumber, DriveType, DriveName, Size, Quota, UsedQuota, UniqueId, " - "Active ) " - "VALUES( ?, ?, ?, ?, ?, ?, ?, ? )" - ); - -// count queries - -_LIT8( KValidateTableExistence, - "SELECT count(*)" - " FROM IDs" - ); - -// Sum queries -_LIT8( KFillListSize, - "SELECT SUM(Size) " - "FROM FillFiles " - "WHERE (( Status & ?) AND (FillListId = " - "(SELECT RuleGroupID FROM FillRuleGroup WHERE Name = ?)))" - ); - -_LIT8( KStoreListSize, - "SELECT SUM(Size) " - "FROM StoreFiles " - "WHERE ( StoreListId = " - "( SELECT StoreRuleId FROM StoreRules WHERE Name = ? ))" - ); - -_LIT8( KDataAmountFilled, - "SELECT SUM(Size) " - "FROM FillFiles " - "WHERE (( Status & 2 ) AND ( FillListId = ? ))" - ); -_LIT8( KDataAmountToBeFilled, - "SELECT SUM(Size) " - "FROM FillFiles " - "WHERE (( Status & ?) AND (MediaServerId = ?) AND " - "( Selected = '1'))" - ); - -_LIT8( KDataAmountToBeStored, - "SELECT SUM(Size) " - "FROM StoreFiles JOIN StoreFileServers sfd ON FileId = sfd.Fid " - "WHERE ((sfd.MediaServerId = ?) AND (sfd.Status & ?))" - ); - -_LIT8( KTranferTime, - "SELECT Time " - "FROM TransferInfo " - "WHERE Service = ?" - ); - -_LIT8( KGetStoreFileCountNoDuplicates, - "SELECT COUNT( DISTINCT Fid ) " - "FROM StoreFileServers servers " - "JOIN StoreFiles files, StoreRules rules " - "ON (files.FileId = servers.Fid AND rules.StoreRuleId = files.StoreListId) " - "WHERE (servers.Status & ? AND rules.Selected = 1)" - ); - -// --------------------------------------------------------------------------- -// UPDATE / REPLACE clauses -// --------------------------------------------------------------------------- -// -_LIT8( KUpdateMediaServerInfo, - "UPDATE MediaServers" - " SET Name = ?, " - "SystemUpdateID = ?, " - "VisibleDate = ?" - " WHERE UDN = ?" - ); - -_LIT8( KUpdateFillRule, - "UPDATE FillRuleGroup" - " SET Quantity = ?" - " WHERE Name = ?" - ); - -_LIT8( KUpdateID, - "UPDATE IDs" - " SET IDValue = ?" - " WHERE IDType = ?" - ); - -// Updating Fill rules selected state -_LIT8( KUpdateFillRuleSelected, - "UPDATE FillRuleGroup" - " SET Selected = ?" - " WHERE Name = ?" - ); - -// Updating Fill rules selected state -_LIT8( KUpdateFillRuleRealInformation, - "UPDATE FillRuleGroup" - " SET RealCount = ?, RealSize = ?" - " WHERE RuleGroupID = ?" - ); - -// Updating download history -_LIT8( KUpdateDownloadHistory, - "UPDATE MediaServers " - "SET DownloadData = DownloadData + ?, DownloadTime = DownloadTime + ? " - "WHERE MediaServerId = ?" - ); - -// Updating upload history -_LIT8( KUpdateUploadHistory, - "UPDATE MediaServers " - "SET UploadData = UploadData + ?, UploadTime = UploadTime + ? " - "WHERE MediaServerId = ?" - ); - -_LIT8( KIncrementImageShrinkingInfo, - "UPDATE ImageShrinkingInfo " - "SET Count = Count + ?, Time = Time + ?" - ); - -_LIT8( KUpdateTransferInfo, - "UPDATE TransferInfo " - "SET Count = ?, Time = ? " - "WHERE Service = ?" - ); - -//updates active status, name, fillusage and storeusage -_LIT8( KUpdateMsIsActive, - "UPDATE MediaServers " - "SET IsActive = ?, SystemUpdateID = ?, Name = ?, FillUsage = ?, StoreUsage = ? " - "WHERE UDN = ?" - ); - -_LIT8( KInitIsActiveFlags, - "UPDATE MediaServers " - "SET IsActive = '0'" - ); - -_LIT8( KUpdateFileStatus, - "UPDATE FillFiles " - "SET Status = ? " - "WHERE ( ( FileId = ? ) OR ( RefId = ? ) )" - ); - -_LIT8( KUpdateFillItemPriorities, - "UPDATE FillFiles " - "SET Priority = ?, Selected = ? " - "WHERE FillListId = " - "( SELECT RuleGroupID FROM FillRuleGroup " - "WHERE Name = ? )" - ); - -//Updates Fill item's status if the status isn't equal to -//ECmFilled -_LIT8( KUpdateFillItemStatusByRuleName, - "UPDATE FillFiles " - "SET Status = ? " - "WHERE FillListId = " - "( SELECT RuleGroupID FROM FillRuleGroup " - "WHERE Name = ? )" - "AND ( Status > '2' OR Status < '2' )" - "AND ( Status != '64' )" - ); - -// Updates highest priority item as a target for -// the reference -_LIT8( KUpdateFillItemRef_Zero, - "UPDATE FillFiles " - "SET RefId = '0' WHERE ( Priority = " - "( SELECT MIN( Priority ) FROM FillFiles " - "WHERE Selected = '1' ) )" - ); - -_LIT8( KRestoreListItemStatuses, - "UPDATE FillFiles " - "SET Status = ? " - "WHERE (( FillListId = ? ) AND ( RefId = '0' ) )" - ); - -_LIT8( KRestoreFileStatus, - "UPDATE FillFiles " - "SET Status = ? " - "WHERE ( FileId = ? OR RefId = ? )" - ); - -_LIT8( KUpdateSelectionStatus, - "UPDATE FillFiles " - "SET Selected = ?, " - "FillListId = 255, " - "Priority = 255 " - "WHERE FillListId = ?" - ); - -_LIT8( KUpdateStoreTransferStatus, - "UPDATE StoreFileServers SET Status = ? WHERE " - "Fid = ? AND MediaServerId = ?;" - ); - -_LIT8( KUpdateFillTransferStatus, - "UPDATE FillFiles SET Status = ?, Path = ?, " - "DriveId = ?, DriveNumber = ? WHERE " - "MediaServerId =? AND ((FileId =? AND FillListId =?) OR (RefId =?));" - ); - -_LIT8( KUpdateFillDriveInfo, - "UPDATE FillFiles " - "SET DriveNumber = ?, " - "DriveId = ? " - "WHERE DriveId = ?" - ); - -_LIT8( KUpdateFillDriveAndStatusInfo, - "UPDATE FillFiles " - "SET Path = ?, " - "DriveNumber = ?, " - "DriveId = ?, " - "Status = ? " // Set all to EToBeFilled - "WHERE DriveId = ?" - ); - -// --------------------------------------------------------------------------- -// REMOVE clauses -// --------------------------------------------------------------------------- -// -_LIT8( KRemoveMediaServersByUDN, - "DELETE FROM MediaServers" - " WHERE UDN = ?" - ); - -_LIT8( KRemoveFillRuleByName, - "DELETE FROM FillRuleGroup" - " WHERE Name = ?" - ); - -_LIT8( KRemoveRuleByRuleGroupID, - "DELETE FROM Rules" - " WHERE RuleGroupID = (SELECT " - "RuleGroupID " - "FROM FillRuleGroup " - "WHERE Name = ? )" - ); - -_LIT8( KRemoveRuleParamsByRuleID, - "DELETE FROM RuleParams" - " WHERE RuleID = (SELECT " - "RuleID " - "FROM Rules " - "WHERE RuleGroupID = (SELECT " - "RuleGroupID " - "FROM FillRuleGroup " - "WHERE Name = ? ) )" - ); - -_LIT8( KRemoveRuleGroupServers, - "DELETE FROM RuleGroupServers " - "WHERE RuleGroupID = (SELECT " - "RuleGroupID " - "FROM FillRuleGroup " - "WHERE Name = ? )" - ); - -/** Delete all fill rules */ - -_LIT8( KRemoveFillRuleAll, - "DELETE FROM FillRuleGroup" - ); - -_LIT8( KRemoveRuleAll, - "DELETE FROM Rules" - ); - -_LIT8( KRemoveRuleParamAll, - "DELETE FROM RuleParams" - ); - -_LIT8( KRemoveRuleGroupServerAll, - "DELETE FROM RuleGroupServers" - ); - -/** Delete all store rules */ - -_LIT8( KRemoveStoreRuleServers, - "DELETE FROM StoreRuleServers" - ); - -_LIT8( KRemoveStoreRuleParams, - "DELETE FROM StoreRuleParams" - ); - -_LIT8( KRemoveStoreRules, - "DELETE FROM StoreRules" - ); - -_LIT8( KRemoveRuleGroupServer, - "DELETE FROM RuleGroupServers " - "WHERE RuleGroupID = ? AND MediaServerID = ?" - ); - -_LIT8( KRemoveStoreRuleServer, - "DELETE FROM StoreRuleServers " - "WHERE StoreRuleID = ? AND MediaServerID = ?" - ); - -/** Delete All Filled files */ -_LIT8( KRemoveFillFiles, - "DELETE FROM FillFiles" - ); - -/** Delete all fill rule's files */ -_LIT8( KRemoveFillList, - "DELETE FROM FillFiles " - "WHERE FillListId = ( SELECT RuleGroupID FROM FillRuleGroup " - "WHERE Name = ?)" - ); - -/** Delete all fillFiles by defined FillListId */ -_LIT8( KRemoveFillListItems, - "DELETE FROM FillFiles " - "WHERE FillListId = ?" - ); - -/** Delete Stored file */ -_LIT8( KRemoveStoreFile, - "DELETE FROM StoreFiles " - "WHERE PrimaryText = ?" - ); - -/** Delete All Stored files */ -_LIT8( KRemoveStoreFiles, - "DELETE FROM StoreFiles" - ); - -_LIT8( KRemoveStoreFileServers, - "DELETE FROM StoreFileServers" - ); - -/** Delete in active fill rule servers */ -_LIT8( KRemoveInActiveFillRuleServers, - "DELETE FROM RuleGroupServers " - "WHERE MediaServerID IN ( SELECT MediaServerID " - "FROM MediaServers WHERE MediaServers.FillUsage = '0' )" - ); - -/** Delete in active store rule servers */ -_LIT8( KRemoveInActiveStoreRuleServers, - "DELETE FROM StoreRuleServers " - "WHERE MediaServerID IN ( SELECT MediaServerID " - "FROM MediaServers WHERE StoreUsage = '0')" - ); - -/** Delete in active fill files */ -_LIT8( KRemoveInActiveFillFiles, - "DELETE FROM FillFiles " - "WHERE MediaServerId IN ( SELECT MediaServerID " - "FROM MediaServers WHERE FillUsage = '0' )" - ); - -/** Delete in active store file servers */ -_LIT8( KRemoveInActiveStoreFilesServers, - "DELETE FROM StoreFileServers " - "WHERE MediaServerId IN ( SELECT MediaServerID " - "FROM MediaServers WHERE StoreUsage = '0')" - ); - -/** Delete in active store files */ -_LIT8( KRemoveInActiveStoreFiles, - "DELETE FROM StoreFiles " - "WHERE FileId NOT IN ( SELECT Fid " - "FROM StoreFileServers )" - ); - -_LIT8( KRemoveProgressInfo, - "DELETE FROM ProgressInfo" - ); - -_LIT8( KRemoveDrivesInfo, - "DELETE FROM DrivesInfo" - ); - -_LIT8( KRemoveSyncTime, - "DELETE FROM SyncTime" - ); - -_LIT8( KRemoveDeletedFillFiles, - "DELETE FROM FillFiles " - "WHERE Selected = '2'" - ); - -_LIT8( KRemoveDeletedMediaServers, - "DELETE FROM MediaServers " - "WHERE FillUsage = '0' AND StoreUsage = '0'" - ); - -_LIT8( KRemoveHash, - "DELETE FROM HashValues " - "WHERE ( ( MediaServerID = ? ) AND ( StartIndex >= ? ) )" - ); - -_LIT8( KSetNullRealSizes, - "UPDATE FillRuleGroup SET RealCount = '0', RealSize = '0' " - "WHERE RuleGroupID NOT IN " - "( SELECT FillListId FROM FillFiles ) " - ); - -// --------------------------------------------------------------------------- -// TRANSACTION HANDLING -// --------------------------------------------------------------------------- -// -_LIT8(KCmDbBeginTransaction, "BEGIN"); -_LIT8(KCmDbSqlCommit, "COMMIT"); - -#endif // __CMDMSQLCLAUSEDEF_H__ - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/inc/cmdmsqldbmaintenance.h --- a/upnpharvester/common/dbmanager/inc/cmdmsqldbmaintenance.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +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: SQL database maintenance class -* -*/ - - - - - - - -#ifndef C_CMDMSQLDBMAINTENANCE_H -#define C_CMDMSQLDBMAINTENANCE_H - -#include - -/** Literals */ -_LIT( KCmDatabase, "c:\\System\\Data\\MediaServant\\cm_database.sq"); -_LIT( KCmDbDir, "c:\\System\\Data\\MediaServant\\"); - -/* Forward declarations. */ -class CCmDmSQLiteConnection; - -/** - * CCmDmSqlDbMaintenance class - * Part of Database manager. Database manager is part of - * Content manager component.CCMDMSqlDbMaintenance creates needed - * database tables and initializes connenction to the database - * - * @lib cmdatabasemanager.lib - * - * @since S60 5.1 - */ -class CCmDmSqlDbMaintenance : public CBase - { - -public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CCmDmSqlDbMaintenance* NewL(); - - /** - * Two-phased constructor. - */ - IMPORT_C static CCmDmSqlDbMaintenance* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmDmSqlDbMaintenance(); - - /** - * Initializes database connection - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - TInt InitConnection( CCmDmSQLiteConnection& aConnection ); - - /** - * Closes database connection - * - * @since S60 5.1 - * @param None - * @return None - */ - void CloseConnection( CCmDmSQLiteConnection& aConnection ); - - /** - * Creates db file - * - * @since S60 5.1 - * @param aConnection, reference to connection class - * @return TInt, Error code - */ - TInt CreateDbFile( CCmDmSQLiteConnection& aConnection ); - - /** - * Creates database tables - * - * @since S60 5.1 - * @param aConnection, sqlite connection - * @return None - */ - void CreateDb( CCmDmSQLiteConnection& aConnection ); - - /** - * Creates database indexes - * - * @since S60 5.1 - * @param aConnection, sqlite connection - * @return None - */ - void CreateIndexes( CCmDmSQLiteConnection& aConnection ); - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmDmSqlDbMaintenance(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - }; - -#endif // C_CMDMSQLDBMAINTENANCE_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/inc/cmdmsqliteconnection.h --- a/upnpharvester/common/dbmanager/inc/cmdmsqliteconnection.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1147 +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: SQLite Connection class -* -*/ - - - - - - - -#ifndef C_CMDMSQLITECONNECTION_H -#define C_CMDMSQLITECONNECTION_H - -#include - -#include "sqldb.h" // Symbian SQLite -#include "cmdmmain.h" // TCMQueryCmdType - -/* Forward declarations. */ -class CCmFillRule; -class CCmMediaServerFull; -class CCmStoreRule; -class CCmBaseListItem; -class CCmFillListItem; -class CCmStoreListItem; -class CCmDriveInfo; - - -// CLASS DECLARATION - /** - * Class represents methods to communication with SQLite database API. - * @lib cmdatabasemanager.lib - * @since S60 5.1 - */ -NONSHARABLE_CLASS( CCmDmSQLiteConnection ): public CBase - { - -public: - - // ID types - enum TTypeOfID - { - ERuleGroupID = 1, - ERuleID, - ERuleParamID, - EMediaServerID, - EStoredID, - EFilledID, - EStoreRuleID, - EStoreRuleParamID, - EFillFileListId, - EStoreFileListId - }; - - /** - * Two-phased constructor. - */ - static CCmDmSQLiteConnection* NewL(); - - /** - * Two-phased constructor. - */ - static CCmDmSQLiteConnection* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmDmSQLiteConnection(); - - /** - * Open database (creates if doesn't exist) - * - * @since S60 5.1 - * @param aDb, Database filename and path - * @return TInt, Error code - */ - TInt OpenDb( const TDesC& aDb ); - - /** - * Close opened database - * - * @since S60 5.1 - * @param None - * @return None - */ - void CloseDb(); - - /** - * Initializes Database ids - * - * @since S60 5.1 - * @param None - * @return None - */ - void InitIDs(); - - /** - * Initializes Database id - * - * @since S60 5.1 - * @param aType, ID type - * @return None - */ - void SetID( TTypeOfID aType ); - - /** - * Backups id to database - * - * @since S60 5.1 - * @param aType, ID type - * @param aID, ID value - * @return None - */ - void BackUpIdL( TTypeOfID aType, TUint64 aID ); - - /** - * Loads Database ids - * - * @since S60 5.1 - * @param None - * @return None - */ - void LoadIDs(); - - /** - * Loads Database id - * - * @since S60 5.1 - * @param aId, ID value - * @param aType, ID type - * @return None - */ - void LoadIDL( TUint64& aId, TTypeOfID aType ); - - /** - * Creates db file - * @since S60 5.1 - * @param aDb, Database filename and path - * @return TInt, error code - */ - TInt CreateDbFile( const TDesC& aDb ); - - /** - * Check Validity of database - * - * @since S60 5.1 - * @param None - * @return ETrue if database is OK - */ - TBool Validate(); - - /** - * Execute sql command (not a query) - * - * @since S60 5.1 - * @param aCommand, SQL clause to be executed (can include wildcards) - * @return TInt, KErrNone if successful, otherwise one of the error codes. - */ - void ExecuteL( const TDesC8& aCommand ); - - /** - * Sets fill file list into db - * - * @since S60 5.1 - * @param aItems, fill list item array - * @return TInt, Error code - */ - TInt SetFillFiles( RPointerArray& aItems ); - - /** - * Sets store file list into db - * - * @since S60 5.1 - * @param aItems, store list item array - * @return TInt, Error code - */ - TInt SetStoreFilesL( RPointerArray& aItems ); - - /** - * Set one store file into db - * - * @since S60 5.1 - * @param aItem, store list item - * @return TInt, Error code - */ - TInt AddStoreFile( CCmStoreListItem& aItem ); - - /** - * Add stored media into database - * - * @since S60 5.1 - * @param aFileName, store file name - * @param aUDN, mediaserver udn - * @param aTimeStamp, timestamp - * @return TInt, Error code - */ - TInt AddStoredL( - const TDesC& aFileName, - const TDesC8& aUDN, - TTime aTimeStamp ); - - /** - * Add fill rule into database - * - * @since S60 5.1 - * @param aFillRule, fill list - * @return TInt, Error code - */ - TInt AddFillRuleL( CCmFillRule* aFillRule ); - - /** - * Add fill rule specific media servers - * - * @since S60 5.1 - * @param aFillRule, fill list - * @return TInt, Error code - */ - TInt AddFillRuleMediaServersL( CCmFillRule* aFillRule ); - - /** - * Add fill rule informations and parameters - * - * @since S60 5.1 - * @param aFillRule, fill list - * @return TInt, Error code - */ - TInt AddFillRuleRulesAndParamsL( CCmFillRule* aFillRule ); - - /** - * Add store rule - * - * @since S60 5.1 - * @param aStoreRule, store list - * @return TInt, Error code - */ - TInt AddStoreRuleL( CCmStoreRule* aStoreRule ); - - /** - * Add store rule informations and parameters - * - * @since S60 5.1 - * @param aStoreRule, store list - * @return TInt, Error code - */ - TInt AddStoreRuleParamsL( CCmStoreRule* aStoreRule ); - - /** - * Add store rule mediaServers - * - * @since S60 5.1 - * @param aStoreRule, store list - * @return TInt, Error code - */ - TInt AddStoreRuleMediaServersL( CCmStoreRule* aStoreRule ); - - /** - * Add media server info into database - * - * @since S60 5.1 - * @param aMediaServer, media server - * @return TInt, Error code - */ - TInt AddMediaServerL( CCmMediaServerFull* aMediaServer ); - - /** - * Add hash value - * - * @since S60 5.1 - * @param aMediaServer, media server id - * @param aHashValue, hash value - * @return TInt, Error code - */ - TInt AddHashValue( TInt64 aMediaServerId, - CCmSearchResponseHash* aHashValue ); - - /** - * Query hash value - * - * @since S60 5.1 - * @param aMediaServer, media server id - * @param aHashValues, hash values - * @return TInt, Error code - */ - TInt QueryHashValuesL( TInt aMediaServer, - RPointerArray& aHashValues ); - - /** - * Sets is active status of the media server - * Sets the Media server's name - * @since S60 5.1 - * @param aServers, server list - * @return TInt, Error code - */ - TInt SetMediaServersL( - RPointerArray& aServers ); - - /** - * Sets last syncs time - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - TInt SetSyncTime(); - - /** - * Gets last syncs time - * @since S60 5.1 - * @param aTime last sync time - * @return TInt, Error code - */ - TInt GetSyncTime( TTime& aTime ); - - /** - * Sets Progress info - * @since S60 5.1 - * @param aTransferred how many files transferred - * @param aTotalCount how many will be trasferred - * @return TInt, Error code - */ - TInt SetProgressInfo( TInt aTransferred, TInt aTotalCount ); - - /** - * Gets Progress info - * @since S60 5.1 - * @param aTransferred how many files transferred - * @param aTotalCount how many will be trasferred - * @return TInt, Error code - */ - TInt GetProgressInfo( TInt& aTransferred, TInt& aTotalCount ); - - /** - * Sets Drives info - * @since S60 5.1 - * @param aDrives, drives to be set into database - * @return TInt, None - */ - void SetDrivesL( RPointerArray& aDrives ); - - /** - * Delete media server info from the database - * - * @since S60 5.1 - * @param aUDN, server udn - * @return TInt, Error code - */ - TInt DeleteMediaServer( const TDesC8& aUDN ); - - /** - * Delete fill rule - * - * @since S60 5.1 - * @param aName, fill list name - * @return TInt, Error code - */ - TInt DeleteFillRuleByName( const TDesC8& aName ); - - /** - * Delete all fill rules - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - TInt DeleteAllFillRules(); - - /** - * Delete all store rules - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - TInt DeleteAllStoreRules(); - - /** - * Delete all fill files - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - TInt DeleteFillFiles(); - - /** - * Delete all store files - * - * @since S60 5.1 - * @param None - * @return TInt, Error code - */ - TInt DeleteStoreFiles(); - - /** - * Delete deleted items - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteDeletedItemsL(); - - /** - * Delete deleted media servers - * - * @since S60 5.1 - * @param None - * @return None - */ - void DeleteDeletedMediaServersL(); - - /** - * Deletes hash values - * - * @since S60 5.1 - * @param aMediaServerId, media server id - * @param aSearchIndex, search index - * @return None - */ - void DeleteHashValuesL( const TInt aMediaserverId, - const TInt aSearchIndex ); - - /** - * Update media server info - * - * @since S 60 5.1 - * @param aMediaServer, mediaserver - * @return TInt, Error code - */ - TInt UpdateMediaServerInfo( CCmMediaServerFull* aMediaServer ); - - /** - * Update Fill rules selected state - * - * @since S60 5.1 - * @param aName, fill list name - * @param aSelected, selection status - * @return TInt, Error code - */ - TInt UpdateFillRuleSelected( const TDesC8& aName, TInt aSelected ); - - /** - * update the fill rule realsize and realcount field - * @since S60 5.1 - * @return TInt, error code - */ - TInt UpdateFillRuleGroupInfo(); - - /** - * Update download history - * - * @since S60 5.1 - * @param aMediaServerId, mediaserver id - * @param aDownloadData, download data size - * @param aDownloadTime, download time - * @return TInt, Error code - */ - TInt UpdateDownloadHistory( TUint aMediaServerId, TInt64& aDownloadData, - TInt64& aDownloadTime ); - - /** - * Update upload history - * - * @since S60 5.1 - * @param aMediaServerId, mediaserver id - * @param aUploadData, upload data size - * @param aUploadTime, upload time - * @return TInt, Error code - */ - TInt UpdateUploadHistory( TUint aMediaServerId, TInt64& aUploadData, - TInt64& aUploadTime ); - - /** - * Update status values - * - * @since S60 5.1 - * @param aStatusValues, item statuses - * @return TInt, Error code - */ - TInt UpdateStatusValues( - RPointerArray& aStatusValues ); - - /** - * Update fill list drive statuses - * - * @since S60 5.1 - * @param aDrive, drive info - * @para aDriveSelected, if ETrue drive selected but slot changed - * @return None - */ - void UpdateFillListDriveStatusesL( CCmDriveInfo* aOrigDrive, - CCmDriveInfo* aNewDrive, TBool aDriveSelected ); - - /** - * Update fill list item priorities and status - * - * @since S60 5.1 - * @param aContainer, fill list container - * @return TInt, Error code - */ - TInt UpdateFillListItemPriority( CCmFillRuleContainer* aContainer ); - - /** - * Update fill selection state into fill file table - * - * @since S60 5.1 - * @param aListName, fill list name - * @param aState, list status - * @return None - */ - void SetFillListStateL( const TUint aListName, - TCmFillRuleStatus aState ); - - /** - * Restoring file statuses - * - * @since S60 5.1 - * @param aFileNames, array of filled items - * @param aListName, list name - * @return None - */ - void RestoreFileStatusesL( - const RPointerArray& aItems, - const TDesC8& aListName ); - - /** - * DoRestoring file statuses - * - * @since S60 5.1 - * @param aItems, array of filled items - * @param aStatus, Status to be restored - * @return None - */ - void DoRestoreFileStatusesL( - const RPointerArray& aItems, - const TUint aStatus ); - - /** - * Initializes all reference ids to zero - * @since S60 5.1 - * @param None - * @return None - */ - void SetRefIdsToZero(); - - /** - * Increment image shrinking history info - * @since S60 5.1 - * @param aImageCount, image count - * @param aMilliSeconds, shrinking time - * @return TInt, Error code - */ - TInt IncrementShrinkTimeL( TInt aImageCount, - TInt aMilliSeconds ); - - /** - * Prepare query - * - * @since S60 5.1 - * @param Type, query type - * @return None - */ - void PrepareQueryCmdL( TCMQueryCmdType aType ); - - /** - * Query fill rule - * - * @since S60 5.1 - * @param aFillRule, fill list - * @return TInt, Error code - */ - TInt QueryFillRuleL( CCmFillRule* aFillRule ); - - /** - * Query fill rule servers - * - * @since S60 5.1 - * @param aFillRule, fill list - * @param aRuleGroupID, rule group id - * @return TInt, Error code - */ - TInt QueryFillRuleServersL( CCmFillRule* aFillRule, - TUint64 aRuleGroupID ); - - /** - * Query fill rule params - * - * @since S60 5.1 - * @param aFillRule, fill list - * @return TInt, Error code - */ - TInt QueryFillRuleParamsL( CCmFillRule* aFillRule ); - - /** - * Query selected ( 1 = selected and 0 = unselected ) - * fill rule names - * - * @since S60 5.1 - * @param aNames, list names - * @param aSelected, selection status - * @return None - */ - void QuerySelectedFillRuleNamesL( RPointerArray& aNames, - TInt aSelected ); - - /** - * Query names of all fill rules - * - * @since S60 5.1 - * @param aNames, on return fill rule names - * @return None - */ - void QueryFillRuleNamesL( RPointerArray& aNames ); - - /** - * Query store rule - * - * @since S60 5.1 - * @param aStoreRule, store list - * @return TInt, Error code - */ - TInt QueryStoreRuleL( CCmStoreRule* aStoreRule ); - - /** - * Query store rule defs - * - * @since S60 5.1 - * @param aStoreRule, store list - * @param aRuleGroupID, rule group id - * @return TInt, Error code - */ - TInt QueryStoreRuleDefsL( CCmStoreRule* aStoreRule, - TUint64 aRuleGroupID ); - - /** - * Query store rule names - * - * @since S60 5.1 - * @param aNames, store list names - * @return None - */ - void QueryStoreRuleNamesL( RPointerArray& aNames ); - - /** - * Query selected store rule namess - * - * @since S60 5.1 - * @param aNames, store list names - * @param aSelected, selection status - * @return TInt, Error code - */ - void QuerySelectedStoreRuleNamesL( RPointerArray& aNames, - TInt aSelected ); - - /** - * Query media server - * - * @since S60 5.1 - * @param aMediaServer, mediaserver - * @return TInt, Error code - */ - TInt QueryMediaServerL( CCmMediaServerFull* aMediaServer ); - - /** - * Query media server Id - * - * @since S60 5.1 - * @param aUDN, server udn - * @return TInt64, Server id - */ - TInt64 QueryMediaServerId( const TDesC8& aUDN ); - - /** - * Query media server udn - * - * @since S60 5.1 - * @param aUDN, server udn - * @param aId, server id - * @return TInt, Error code - */ - TInt QueryMediaServerUdn( HBufC8*& aUdn, - const TInt32 aId ); - - /** - * Query all media servers - * - * @since S60 5.1 - * @param aMediaServer, mediaserver - * @return TInt, Error code - */ - TInt QueryAllMediaServersL( CCmMediaServerFull* aMediaServer ); - - /** - * Get media servers - * - * @since S60 5.1 - * @param aMediaServers, mediaserver list - * @return None - */ - void GetMediaServersL( - RPointerArray& aMediaServers ); - - /** - * Query all lowest priority filled files - * - * @since S60 5.1 - * @param aDrive, drive id - * @param aFilled, list of filled items - * @return TInt, Error code - */ - TInt GetLowPriorityFilledFilesL( TInt aDrive, - RPointerArray& aFilled ); - - /** - * Query all files defined in fill file list using fill list name as - * a query parameter - * - * @since S60 5.1 - * @param aItems, fill list items - * @param aName, fill list name - * @param aStatus, selection status - * @return TInt, Error code - */ - TInt QueryFillFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint aStatus ); - - /** - * Query fill file list - * @since S60 5.1 - * @param aItems, fill list items - * @param aStatus, list status - * @return TInt, Error code - */ - TInt GetAllFillFilesL( - RPointerArray& aItems, TUint aStatus ); - - /** - * Query all files defined in store file list using store list name as - * a query parameter - * - * @since S60 5.1 - * @param aItems, store list items - * @param aName, store list name - * @param aStatus, store list status - * @return TInt, Error code - */ - TInt QueryStoreFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint aStatus ); - - /** - * Query store file list - * @since S60 5.1 - * @param aItems, store list items - * @param aStatus, list status - * @return TInt, Error code - */ - TInt GetAllStoreFilesL( - RPointerArray& aItems, TUint aStatus ); - - /** - * Query all files defined in fill file list - * - * @since S60 5.1 - * @param aItems, fill list items - * @return TInt, Error code - */ - TInt QueryAllFillFilesL( RPointerArray& aItems); - - /** - * Query all files defined in store file list - * - * @since S60 5.1 - * @param aItems, store list items - * @return TInt, Error code - */ - TInt QueryAllStoreFilesL( RPointerArray& aItems ); - - /** - * Query stored row - * - * @since S60 5.1 - * @param aFiles, stored items - * @param aUDN, server udn - * @param aAmount, item count - * @return None - */ - void QueryStoredRowL( - RPointerArray& aFiles, - const TDesC8& aUDN, - TInt aAmount ); - - /** - * Query transfer history - * - * @since S60 5.1 - * @param aUdn, server udn - * @param aDownloadData, downloaded data - * @param aUploadData, uploaded data - * @param aDownloadTime, download time - * @param aUploadTime, upload time - * @return None - */ - void QueryTransferHistory( - const TDesC8& aUdn, - TInt64& aDownloadData, - TInt64& aUploadData, - TInt64& aDownloadTime, - TInt64& aUploadTime ); - - - /** - * Query deleted items list - * - * @since S60 5.1 - * @param aUdn, server udn - * @param aArray, deleted items - * @param aStatus, item status - * @return None - */ - void QueryDeletedItemsListsL( - RPointerArray& aArray, TUint aStatus ); - - /** - * Query drives - * - * @since S60 5.1 - * @param aDrives, drive array - * @return None - */ - void QueryDrivesL( RPointerArray& aDrives ); - - /** - * Avarage image shrinking time - * - * @since S60 5.1 - * @param None - * @return TInt, Avarage image shrinking time in millisecond - */ - TInt GetAvgImageShrinkTime(); - - /** - * Get list name using list id - * - * @since S60 5.1 - * @param aListName, name of the fill list - * @param aListId, id of the named list - * @return None - */ - void GetFillListNameL( HBufC8*& aListName, - const TInt64 aListId ); - - /** - * Returns size of the named fill list - * - * @since S60 5.1 - * @param aListName, fill list name - * @param aStatus, list status - * @return TInt64, size of the list - */ - TInt64 FillListSize( const TDesC8& aListName, TUint aStatus ); - - /** - * Returns size of the named store list - * - * @since S60 5.1 - * @param aListName, store list name - * @param aStatus, lis status - * @return TInt64, size of the list - */ - TInt64 StoreListSize( const TDesC8& aListName, TUint aStatus ); - - /** - * Returns file count which are waiting to be stored - * - * @since S60 5.1 - * @param aStatus, item status - * @return TInt, size of the list - */ - TInt StoreFileCount( TUint aStatus ); - - /** - * Returns file count which are waiting to be stored - * - * @since S60 5.1 - * @param None - * @return TInt, size of the list - */ - TInt StoreFileCountNoDuplicates(); - - /** - * Returns file count which are waiting to be filled - * - * @since S60 5.1 - * @param aStatus, item status - * @return TInt, size of the list - */ - TInt FillFileCount( TUint aStatus ); - - /** - * Returns data amount filled - * @since S60 v3.1 - * @param aID id of fill rule - * @return sum of file sizes - */ - TInt64 BytesFilled( TUint aID ); - - /** - * @since S60 5.1 - * @param aMediaServerId, mediaserver id - * @param aStatus, item status - * @return TInt64, sum of file sizes - */ - TInt64 KBytesToBeFilled( TUint8 aMediaServerId, - TUint aStatus ); - - /** - * Returns data amount to be stored - * - * @since S60 5.1 - * @param aMediaServerId, mediaserver id - * @param aStatus, item status - * @return TInt64, sum of file sizes - */ - TInt64 KBytesToBeStored( TUint8 aMediaServerId, - TUint aStatus ); - - /** - * Updates list size and approx. transfer time - * - * @since S60 5.1 - * @param aService, service - * @param aCount, pieces - * @param aTime, in milliseconds - * @return TInt, error code - */ - TInt UpdateTransferInfo( TCmService aService, - TInt aCount, TInt aTime ); - - /** - * Updates file status - * - * @since S60 5.1 - * @param aStatus, transfer status - * @param aFid, file id - * @param aMsId, server id - * @return None - */ - void UpdateStoreTransferStatus( TUint aStatus, - TInt64 aFid, TInt64 aMsId ); - - /** - * Updates file status - * - * @since S60 5.1 - * @param aStatus, transfer status - * @param aItem, fill list item - * @return None - */ - void UpdateFillTransferStatus( TUint aStatus, - CCmFillListItem* aItem ); - - /** - * Get list size and approx. transfer time - * - * @since S60 5.1 - * @param aService, service - * @param aCount, pieces - * @param aTime, in milliseconds - * @return TInt, error code - */ - TInt GetTransferInfo( TCmService aService, TInt& aCount, TInt& aTime ); - - /** - * Files to be stored and included into specified list - * - * @since S60 5.1 - * @param aListName, store list name - * @param aStatus, list status - * @param aCount, pieces - * @return TInt, error code - */ - TInt GetStoreFileCount( - const TDesC8& aListName, - TUint aStatus, - TInt& aCount ); - - /** - * Files to be filled and included into specified list - * - * @since S60 5.1 - * @param aListName, fill list name - * @param aStatus, list status - * @param aCount, pieces - * @return TInt, error code - */ - TInt GetFillFileCount( - const TDesC8& aListName, - TUint aStatus, - TInt& aCount ); - - /** - * Files to be stored - * @since S60 5.1 - * @param aCount, file count - * @param aStatus, status - * @return None - */ - void GetStoreFileCountNoDuplicatesL( TInt& aCount, TUint aStatus ); - - /** - * Sets fill list real information - * - * @since S60 5.1 - * @param aListId, fill list id - * @param aRealCount, real item count - * @param aRealSize, real data size - * @return None - */ - void SetFillListRealCountAndSizeL( TInt64 aListId, - TInt64 aRealCount, TInt64 aRealSize ); - - /** - * Deletes in active rule servers - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - TInt DeleteInActiveRuleServers(); - - /** - * Deletes in active rule servers - * - * @since S60 5.1 - * @param None - * @return TInt, error code - */ - TInt DeleteInActiveFiles(); - - /** - * Deletes item by FillListId - * - * @since S60 5.1 - * @param FillListId, fill list id - * @return TInt error code - */ - TInt DeleteItemsByFillListId( TInt aFillListId ); - - /** - * Returns rule id with defined type - * - * @since S60 5.1 - * @param aName, rule name - * @param aType, rule type - * @return TInt64, Rule id - */ - TInt64 RuleId( const TDesC8& aName, TCmRuleType aType ); - - -private: - - /** - * Performs the first phase of two phase construction. - */ - CCmDmSQLiteConnection(); - - /** - * Performs the second phase construction. - */ - void ConstructL(); - - -private: - - /** - * iDatabase, interface to Sqlite database - */ - RSqlDatabase iDatabase; - - /** - * iStatement, interface to Sqlite database - */ - RSqlStatement iStatement; - - /** - * rule group id - */ - TUint64 iRuleGroupID; - /** - * rule id - */ - TUint64 iRuleID; - /** - * rule param id - */ - TUint64 iRuleParamID; - /** - * mediaserver id - */ - TUint64 iMediaServerID; - /** - * stored id - */ - TUint64 iStoredID; - /** - * filled id - */ - TUint64 iFilledID; - /** - * store rule id - */ - TUint64 iStoreRuleID; - /** - * store rule param id - */ - TUint64 iStoreRuleParamID; - /** - * fill file id - */ - TUint64 iFillFileId; - /** - * store file id - */ - TUint64 iStoreFileId; - /** - * Query handle - */ - TInt iHandle; - - }; - -#endif // C_CMDMSQLITECONNECTION_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/inc/cmdmsqlmaintenanceclauses.h --- a/upnpharvester/common/dbmanager/inc/cmdmsqlmaintenanceclauses.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,286 +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: Includes SQL clauses for creating and dropping tables -* -*/ - - - - - - -#ifndef __CMDMSQLMAINTENANCECLAUSES_H__ -#define __CMDMSQLMAINTENANCECLAUSES_H__ - -/////////////////////////////////////////////////////////////////// -// DROP CLAUSES -/////////////////////////////////////////////////////////////////// - -// Drop tables -_LIT8( KDropFillRuleGroup, "DROP TABLE FillRuleGroup;" ); -_LIT8( KDropRules, "DROP TABLE Rules;" ); -_LIT8( KDropRuleParams, "DROP TABLE RuleParams;" ); -_LIT8( KDropRuleGroupServers, "DROP TABLE RuleGroupServers;" ); -_LIT8( KDropMediaServers, "DROP TABLE MediaServers;" ); -_LIT8( KDropHashValues, "DROP TABLE HashValues;" ); -_LIT8( KDropStored, "DROP TABLE Stored;" ); -_LIT8( KDropFilled, "DROP TABLE Filled;" ); -_LIT8( KDropIDs, "DROP TABLE IDs;" ); -_LIT8( KDropStoreRules, "DROP TABLE StoreRules;" ); -_LIT8( KDropStoreRuleParams, "DROP TABLE StoreRuleParams;"); -_LIT8( KDropStoreRuleServers, "DROP TABLE StoreRuleServers;"); - -_LIT8( KDropFillFiles, "DROP TABLE FillFiles;"); -_LIT8( KDropStoreFiles, "DROP TABLE StoreFiles;"); -_LIT8( KDropStoreFileServers, "DROP TABLE StoreFileServers;"); -_LIT8( KDropImageShrinkingInfo, "DROP TABLE ImageShrinkingInfo;"); -_LIT8( KDropTransferInfo, "DROP TABLE TransferInfo;"); -_LIT8( KDropSyncTime, "DROP TABLE SyncTime;"); -_LIT8( KDropProgressInfo, "DROP TABLE ProgressInfo;"); - -_LIT8( KDropDrivesInfo, "DROP TABLE DrivesInfo;"); - -/////////////////////////////////////////////////////////////////// -// CREATE CLAUSES FOR TABLES -/////////////////////////////////////////////////////////////////// - -// ONTOLOGY TABLES -_LIT8( KCreateFillRuleGroup, - "CREATE TABLE FillRuleGroup(" - "RuleGroupID INTEGER NOT NULL," - "Name TEXT NOT NULL," - "Method INTEGER," - "LimitType INTEGER," - "Quantity INTEGER," - "Selected INTEGER," - "Priority INTEGER," - "TemplateId INTEGER," - "MediaType INTEGER," - "Status INTEGER," - "RealCount INTEGER," - "RealSize INTEGER," - "PRIMARY KEY(RuleGroupID));" - ); - -_LIT8( KCreateRules, - "CREATE TABLE Rules(" - "RuleID INTEGER NOT NULL," - "RuleGroupID INTEGER NOT NULL," - "MetadataField INTEGER," - "Operator INTEGER," - "PRIMARY KEY(RuleID));" - ); - -_LIT8( KCreateRuleParams, - "CREATE TABLE RuleParams(" - "RuleParamID INTEGER NOT NULL," - "RuleID INTEGER NOT NULL," - "ComparisonFieldData TEXT," - "ComparisonFieldIndex INTEGER," - "PRIMARY KEY(RuleParamID));" - ); - -_LIT8( KCreateRuleGroupServers, - "CREATE TABLE RuleGroupServers(" - "RuleGroupID INTEGER NOT NULL," - "MediaServerID INTEGER NOT NULL);" - ); - -_LIT8( KCreateMediaServers, - "CREATE TABLE MediaServers(" - "MediaServerID INTEGER NOT NULL," - "UDN TEXT NOT NULL," - "Name TEXT NOT NULL," - "SystemUpdateID INTEGER," - "VisibleDate DATETIME," - "DownloadData INTEGER," - "UploadData INTEGER," - "DownloadTime INTEGER," - "UploadTime INTEGER," - "IsActive INTEGER," - "CopyCapability INTEGER," - "FillUsage INTEGER," - "StoreUsage INTEGER," - "PRIMARY KEY(MediaServerID));" - ); - -_LIT8( KCreateHashValues, - "CREATE TABLE HashValues(" - "HashValueID INTEGER NOT NULL," - "MediaServerID INTEGER NOT NULL," - "StartIndex INTEGER NOT NULL," - "ItemCount INTEGER NOT NULL," - "Hash TEXT NOT NULL," - "PRIMARY KEY(HashValueID));" - ); - - -_LIT8( KCreateStored, - "CREATE TABLE Stored(" - "StoredFile TEXT NOT NULL," - "StoredID INTEGER NOT NULL," - "MediaServerID INTEGER NOT NULL," - "Date DATETIME," - "PRIMARY KEY(StoredID));" - ); - -_LIT8( KCreateIDs, - "CREATE TABLE IDs(" - "IDValue INTEGER NOT NULL," - "IDType INTEGER NOT NULL," - "PRIMARY KEY(IDType));" - ); - -_LIT8( KCreateStoreRules, - "CREATE TABLE StoreRules(" - "StoreRuleId INTEGER NOT NULL," - "Name TEXT NOT NULL," - "Selected INTEGER," - "Status INTEGER," - "PRIMARY KEY(StoreRuleId));" - ); - -_LIT8( KCreateStoreRuleParams, - "CREATE TABLE StoreRuleParams(" - "StoreRuleId INTEGER NOT NULL," - "StoreRuleParamId INTEGER NOT NULL," - "MediaType INTEGER," - "PRIMARY KEY(StoreRuleParamId));" - ); - -_LIT8( KCreateStoreRuleServers, - "CREATE TABLE StoreRuleServers(" - "StoreRuleId INTEGER NOT NULL," - "MediaServerID INTEGER NOT NULL);" - ); - -_LIT8( KCreateFillFiles, - "CREATE TABLE FillFiles(" - "FileId INTEGER NOT NULL," - "PrimaryText TEXT NOT NULL," - "SecondaryText TEXT," - "Path TEXT," - "Uri TEXT NOT NULL," - "ItemId TEXT NOT NULL," - "UpnpClass TEXT," - "MediaType INTEGER," - "Priority INTEGER,"// Highest priority is zero - "Size INTEGER,"// In bytes - "Status INTEGER," - "Date DATETIME," - "FillListId INTEGER NOT NULL," - "MediaServerId INTEGER NOT NULL," - "Selected INTEGER," - "RefId INTEGER," - "DriveId INTEGER," - "DriveNumber INTEGER );" - //"PRIMARY KEY(FileId));" - ); - -_LIT8( KCreateStoreFiles, - "CREATE TABLE StoreFiles(" - "FileId INTEGER NOT NULL," - "PrimaryText TEXT NOT NULL," - "SecondaryText TEXT," - "Path TEXT," - "Size INTEGER," - "Date DATETIME," - "StoreListId INTEGER NOT NULL," - "PRIMARY KEY(FileId));" - ); - -_LIT8( KCreateStoreFileServers, - "CREATE TABLE StoreFileServers(" - "Fid INTEGER NOT NULL," - "MediaServerId INTEGER NOT NULL," - "Status INTEGER );" - ); - -_LIT8( KCreateImageShrinkingInfo, - "CREATE TABLE ImageShrinkingInfo(" - "Count INTEGER," - "Time INTEGER );" - ); - -_LIT8( KCreateTransferInfo, - "CREATE TABLE TransferInfo(" - "Service INTEGER," - "Count INTEGER," - "Time INTEGER," - "PRIMARY KEY(Service));" - ); - -_LIT8( KCreateSyncTime, - "CREATE TABLE SyncTime(" - "Time DATETIME );" - ); - -_LIT8( KCreateProgressInfo, - "CREATE TABLE ProgressInfo(" - "Trasferred INTEGER," - "TotalCount INTEGER );" - ); - -_LIT8( KCreateDrivesInfo, - "CREATE TABLE DrivesInfo(" - "DriveNumber INTEGER," - "DriveType INTEGER," - "DriveName TEXT," - "Size INTEGER," - "Quota INTEGER," - "UsedQuota INTEGER," - "UniqueId INTEGER," - "Active INTEGER );" - ); - -/////////////////////////////////////////////////////////////////// -// CREATE CLAUSES FOR INDEXES -/////////////////////////////////////////////////////////////////// -_LIT8( KCreateStoreStatusIndex, - "CREATE INDEX Store_status_index ON StoreFiles(Status);" - ); - -_LIT8( KCreateFillStatusIndex, - "CREATE INDEX Fill_status_index ON FillFiles(Status);" - ); - -_LIT8( KCreateFillListIdIndex, - "CREATE INDEX FillListIdIndex ON FillFiles(FillListId);" - ); - -_LIT8( KCreateFillItemRefIndex, - "CREATE INDEX FillList_Ref_Index ON FillFiles( FileId, " - "RefId, Priority, Selected );" - ); - -// Dropping indexes -_LIT8( KDropStoreStatusIndex, - "DROP INDEX Store_status_index;" - ); - -_LIT8( KDropFillStatusIndex, - "DROP INDEX Fill_status_index;" - ); - -_LIT8( KDropFillListIdIndex, - "DROP INDEX FillListIdIndex;" - ); - -_LIT8( KDropFillItemRefIndex, - "DROP INDEX FillList_Ref_Index;" - ); - -#endif // __CMDMSQLMAINTENANCECLAUSES_H__ - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/src/cmdmmain.cpp --- a/upnpharvester/common/dbmanager/src/cmdmmain.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,962 +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: Main class in the Database manager component -* -*/ - - - - - - -#include -#include -#include "cmdmsqliteconnection.h" -#include "cmdmsqldbmaintenance.h" -#include "cmfillrule.h" -#include "cmstorerule.h" -#include "cmmediaserverfull.h" -#include "cmbaselistitem.h" -#include "cmfilllistitem.h" -#include "cmstorelistitem.h" -#include "cmdriveinfo.h" -#include "cmdmmain.h" -#include "msdebug.h" - - -// --------------------------------------------------------------------------- -// CCmDmMain::NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CCmDmMain* CCmDmMain::NewL() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::NewL()")); - CCmDmMain* self = CCmDmMain::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CCmDmMain::NewLC -// --------------------------------------------------------------------------- -// -EXPORT_C CCmDmMain* CCmDmMain::NewLC() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::NewLC()")); - CCmDmMain* self = new ( ELeave ) CCmDmMain(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmDmMain::~CCmDmMain -// --------------------------------------------------------------------------- -// -EXPORT_C CCmDmMain::~CCmDmMain() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::~CCmDmMain()")); - delete iConnection; - iConnection = NULL; - delete iMaintenance; - iMaintenance = NULL; - } - -// --------------------------------------------------------------------------- -// CCmDmMain::PrepareQueryCmdL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::PrepareQueryCmdL( TCMQueryCmdType aType ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::PrepareQueryCmdL()")); - iConnection->PrepareQueryCmdL( aType ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryFillRuleL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryFillRuleL( CCmFillRule* aFillRule ) - { - return iConnection->QueryFillRuleL( aFillRule ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QuerySelectedFillRuleNamesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QuerySelectedFillRuleNamesL( - RPointerArray& aNames, TInt aSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QuerySelectedFillRuleNamesL()")); - iConnection->QuerySelectedFillRuleNamesL( aNames, aSelected ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryFillRuleNamesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QueryFillRuleNamesL( RPointerArray& aNames ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryFillRuleNamesL()")); - iConnection->QueryFillRuleNamesL( aNames ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryStoreRuleL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryStoreRuleL(CCmStoreRule* aStoreRule) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreRuleL()")); - return iConnection->QueryStoreRuleL( aStoreRule ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryStoreRuleNamesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QueryStoreRuleNamesL( RPointerArray& aNames ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreRuleNamesL()")); - iConnection->QueryStoreRuleNamesL( aNames ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QuerySelectedStoreRuleNamesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QuerySelectedStoreRuleNamesL( - RPointerArray& aNames, TInt aSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QuerySelectedStoreRuleNamesL()")); - iConnection->QuerySelectedStoreRuleNamesL( aNames, aSelected ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryMediaServerL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryMediaServerL( CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerL()")); - return iConnection->QueryMediaServerL( aMediaServer ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryMediaServerId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmDmMain::QueryMediaServerId( const TDesC8& aUDN ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerId()")); - return iConnection->QueryMediaServerId( aUDN ); - } - -// --------------------------------------------------------------------------- -// CmDmMain::QueryMediaServerUdn -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryMediaServerUdn( HBufC8*& aUdn, - const TInt32 aId ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryMediaServerUdn()")); - return iConnection->QueryMediaServerUdn( aUdn, aId ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryAllMediaServersL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryAllMediaServersL( - CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllMediaServersL()")); - return iConnection->QueryAllMediaServersL( aMediaServer ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetMediaServersL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::GetMediaServersL( - RPointerArray& aMediaServers ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetMediaServersL()")); - iConnection->GetMediaServersL( aMediaServers ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetLowPriorityFilledFilesL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetLowPriorityFilledFilesL( TInt aDrive, - RPointerArray& aFilled ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetLowPriorityFilledFilesL()")); - return iConnection->GetLowPriorityFilledFilesL( aDrive, aFilled ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryFillFileListL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryFillFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryFillFileListL()")); - return iConnection->QueryFillFileListL( aItems, aName, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetAllFillFilesL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetAllFillFilesL( - RPointerArray& aItems, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetAllFillFilesL()")); - return iConnection->GetAllFillFilesL( aItems, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryStoreFileListL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryStoreFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoreFileListL()")); - return iConnection->QueryStoreFileListL( aItems, aName, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetAllStoreFilesL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetAllStoreFilesL( - RPointerArray& aItems, TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetAllStoreFilesL()")); - return iConnection->GetAllStoreFilesL( aItems, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryAllFillFilesL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryAllFillFilesL( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllFillFilesL()")); - return iConnection->QueryAllFillFilesL( aItems ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryAllStoreFilesL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryAllStoreFilesL( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryAllStoreFilesL()")); - return iConnection->QueryAllStoreFilesL( aItems ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryStoredRowL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QueryStoredRowL( RPointerArray& aFiles, - const TDesC8& aUDN, - TInt aAmount ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryStoredRowL()")); - iConnection->QueryStoredRowL( aFiles, aUDN, aAmount ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryTransferHistory -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QueryTransferHistory( - const TDesC8& aUdn, - TInt64& aDownloadData, - TInt64& aUploadData, - TInt64& aDownloadTime, - TInt64& aUploadTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryTransferHistory()")); - iConnection->QueryTransferHistory( aUdn, aDownloadData, - aUploadData, aDownloadTime, aUploadTime ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryDeletedItemsListsL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QueryDeletedItemsListsL( - RPointerArray& aArray, TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryDeletedItemsListsL()")); - iConnection->QueryDeletedItemsListsL( aArray, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryDrivesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::QueryDrivesL( RPointerArray& aDrives ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryDrivesL()")); - iConnection->QueryDrivesL( aDrives ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetAvgImageShrinkTime -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetAvgImageShrinkTime() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetAvgImageShrinkTime()")); - return iConnection->GetAvgImageShrinkTime(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetFillListNameL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::GetFillListNameL( HBufC8*& aListName, - const TInt64 aListId ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetFillListNameL()")); - return iConnection->GetFillListNameL( aListName, aListId ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::SetFillFiles -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::SetFillFiles( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::SetFillFiles()")); - return iConnection->SetFillFiles( aItems ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::SetStoreFilesL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::SetStoreFilesL( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::SetStoreFilesL()")); - return iConnection->SetStoreFilesL( aItems ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::AddStoreFile -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::AddStoreFile( CCmStoreListItem& aItem ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoreFile()")); - return iConnection->AddStoreFile( aItem ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::AddStoredL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::AddStoredL( - const TDesC& aFileName, - const TDesC8& aUDN, - TTime aTimeStamp ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoredL()")); - return iConnection->AddStoredL( aFileName, aUDN, aTimeStamp ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::AddFillRuleL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::AddFillRuleL( CCmFillRule* aFillRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::AddFillRuleL()")); - return iConnection->AddFillRuleL( aFillRule ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::AddStoreRuleL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::AddStoreRuleL( CCmStoreRule* aStoreRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::AddStoreRuleL()")); - return iConnection->AddStoreRuleL( aStoreRule ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::AddMediaServerL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::AddMediaServerL( CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::AddMediaServerL()")); - return iConnection->AddMediaServerL( aMediaServer ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::AddHashValue -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::AddHashValue( TInt64 aMediaServerId, - CCmSearchResponseHash* aHashValue ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::AddHashValue()")); - return iConnection->AddHashValue( aMediaServerId, aHashValue ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::QueryHashValuesL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::QueryHashValuesL( TInt aMediaServer, - RPointerArray& aHashValues ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::QueryHashValuesL()")); - return iConnection->QueryHashValuesL( aMediaServer, aHashValues ); - } -// --------------------------------------------------------------------------- -// CCmDmMain::SetMediaServersL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::SetMediaServersL( - RPointerArray& aServers ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::SetMediaServersL()")); - return iConnection->SetMediaServersL( aServers ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::SetSyncTime -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::SetSyncTime() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::SetSyncTime()")); - return iConnection->SetSyncTime(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetSyncTime -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetSyncTime( TTime& aTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetSyncTime()")); - return iConnection->GetSyncTime( aTime ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::SetProgressInfo -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::SetProgressInfo( TInt aTransferred, - TInt aTotalCount) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::SetProgressInfo()")); - return iConnection->SetProgressInfo( aTransferred, aTotalCount ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetProgressInfo -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetProgressInfo( TInt& aTransferred, - TInt& aTotalCount ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetProgressInfo()")); - return iConnection->GetProgressInfo( aTransferred, aTotalCount ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::SetDrivesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::SetDrivesL( RPointerArray& aDrives ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::SetDrivesL()")); - iConnection->SetDrivesL( aDrives ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteMediaServer -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::DeleteMediaServer( const TDesC8& aUDN ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteMediaServer()")); - return iConnection->DeleteMediaServer( aUDN ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteFillRuleByName -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::DeleteFillRuleByName( const TDesC8& aName ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteFillRuleByName()")); - return iConnection->DeleteFillRuleByName( aName ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteAllFillRules -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::DeleteAllFillRules() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteAllFillRules()")); - return iConnection->DeleteAllFillRules(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteAllStoreRules -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::DeleteAllStoreRules() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteAllStoreRules()")); - return iConnection->DeleteAllStoreRules(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteFillFiles -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::DeleteFillFiles() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteFillFiles()")); - return iConnection->DeleteFillFiles(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteStoreFiles -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::DeleteStoreFiles() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteStoreFiles()")); - return iConnection->DeleteStoreFiles(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteDeletedItemsL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::DeleteDeletedItemsL() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteDeletedItemsL()")); - iConnection->DeleteDeletedItemsL(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteItemsByFillListId -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::DeleteItemsByFillListId( TInt aFillListId ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteItemsByFillListId()")); - return iConnection->DeleteItemsByFillListId( aFillListId ); - } - - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteDeletedMediaServersL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::DeleteDeletedMediaServersL() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteDeletedMediaServersL()")); - iConnection->DeleteDeletedMediaServersL(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::DeleteHashValuesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::DeleteHashValuesL( const TInt aMediaserverId, - const TInt aSearchIndex ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::DeleteHashValuesL()")); - iConnection->DeleteHashValuesL( aMediaserverId, aSearchIndex ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateMediaServerInfo -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateMediaServerInfo( - CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateMediaServerInfo()")); - return iConnection->UpdateMediaServerInfo( aMediaServer ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateFillRuleSelected -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateFillRuleSelected( - const TDesC8& aName, - TInt aSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillRuleSelected()")); - return iConnection->UpdateFillRuleSelected( aName, aSelected ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateDownloadHistory -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateDownloadHistory( TUint aMediaServerId, - TInt64& aDownloadData, TInt64& aDownloadTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateDownloadHistory()")); - return iConnection->UpdateDownloadHistory( aMediaServerId, - aDownloadData, aDownloadTime ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateUploadHistory -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateUploadHistory( TUint aMediaServerId, - TInt64& aUploadData, TInt64& aUploadTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateUploadHistory()")); - return iConnection->UpdateUploadHistory( aMediaServerId, - aUploadData, aUploadTime ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateStatusValues -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateStatusValues( - RPointerArray& aStatusValues ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateStatusValues()")); - return iConnection->UpdateStatusValues( aStatusValues ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateFillListDriveStatusesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::UpdateFillListDriveStatusesL( - CCmDriveInfo* aOrigDrive, CCmDriveInfo* aNewDrive, - TBool aDriveSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillListDriveStatusesL()")); - iConnection->UpdateFillListDriveStatusesL( - aOrigDrive, aNewDrive, aDriveSelected ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateFillListItemPriority -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateFillListItemPriority( - CCmFillRuleContainer* aContainer ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillListItemPriority()")); - return iConnection->UpdateFillListItemPriority( aContainer ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::SetFillListStateL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::SetFillListStateL( const TUint aListId, - TCmFillRuleStatus aState ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::SetFillListStateL()")); - iConnection->SetFillListStateL( aListId, aState ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::RestoreFileStatusesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::RestoreFileStatusesL( - const RPointerArray& aItems, const TDesC8& aListName ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::RestoreFileStatusesL()")); - return iConnection->RestoreFileStatusesL( aItems, aListName ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::IncrementShrinkTimeL -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::IncrementShrinkTimeL( TInt aImageCount, - TInt aMilliSeconds ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::IncrementShrinkTimeL()")); - return iConnection->IncrementShrinkTimeL( aImageCount, - aMilliSeconds ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::ListSize -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmDmMain::ListSize( - TCmRuleType aType, - const TDesC8& aListName, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::ListSize()")); - - TInt64 size( KErrNone ); - if( aType == ECmFmFillRule ) - { - size = iConnection->FillListSize( aListName, aStatus ); - } - else - { - size = iConnection->StoreListSize( aListName, aStatus ); - } - return size; - } - -// --------------------------------------------------------------------------- -// CCmDmMain::StoreFileCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::StoreFileCount( TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::StoreFileCount()")); - return iConnection->StoreFileCount( aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::StoreFileCountNoDuplicates -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::StoreFileCountNoDuplicates() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::StoreFileCountNoDuplicates()")); - return iConnection->StoreFileCountNoDuplicates(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::FillFileCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::FillFileCount( TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::FillFileCount()")); - return iConnection->FillFileCount( aStatus ); - } - -// --------------------------------------------------------------------------- -// Amount of data filled -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmDmMain::BytesFilled( TUint aID ) - { - return iConnection->BytesFilled( aID ); - } - - -// CCmDmMain::KBytesToBeFilled -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmDmMain::KBytesToBeFilled( TUint8 aMediaServerId, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::KBytesToBeFilled()")); - return iConnection->KBytesToBeFilled( aMediaServerId, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::KBytesToBeStored -// --------------------------------------------------------------------------- -// -EXPORT_C TInt64 CCmDmMain::KBytesToBeStored( TUint8 aMediaServerId, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::KBytesToBeStored()")); - return iConnection->KBytesToBeStored( aMediaServerId, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateTransferInfo -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateTransferInfo( TCmService aService, - TInt aCount, TInt aTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateTransferInfo()")); - return iConnection->UpdateTransferInfo( aService, aCount, aTime ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateStoreTransferStatus -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::UpdateStoreTransferStatus( TUint aStatus, - TInt64 aFid, TInt64 aMsId ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateStoreTransferStatus()")); - iConnection->UpdateStoreTransferStatus( aStatus, aFid, aMsId ); - } - - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateFillTransferStatus -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::UpdateFillTransferStatus( TUint aStatus, - CCmFillListItem* aItem ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillTransferStatus()")); - iConnection->UpdateFillTransferStatus( aStatus, aItem ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetTransferInfo -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetTransferInfo( TCmService aService, - TInt& aCount, TInt& aTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetTransferInfo()")); - return iConnection->GetTransferInfo( aService, aCount, aTime ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetStoreFileCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetStoreFileCount( - const TDesC8& aListName, - TUint aStatus, - TInt& aCount ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetStoreFileCount()")); - return iConnection->GetStoreFileCount( aListName, aStatus, aCount ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetFillFileCount -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::GetFillFileCount( - const TDesC8& aListName, - TUint aStatus, - TInt& aCount ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetFillFileCount()")); - return iConnection->GetFillFileCount( aListName, aStatus, aCount ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::GetStoreFileCountNoDuplicatesL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::GetStoreFileCountNoDuplicatesL( TInt& aCount, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmMain::GetStoreFileCountNoDuplicatesL()")); - iConnection->GetStoreFileCountNoDuplicatesL( aCount, aStatus ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::SetFillListRealCountAndSizeL -// --------------------------------------------------------------------------- -// -EXPORT_C void CCmDmMain::SetFillListRealCountAndSizeL( TInt64 aListId, - TInt64 aRealCount, TInt64 aRealSize ) - { - TRACE( Print( _L("CCmDmMain::SetFillListRealCountAndSizeL \ - aListId =%ld,aRealCount=%ld,aRealSize=%ld"), - aListId,aRealCount, aRealSize ) ); - - TInt64 realCount = ( aRealCount > 0 ) ? aRealCount : 0; - TInt64 realSize = ( aRealSize > 0 ) ? aRealSize : 0; - iConnection->SetFillListRealCountAndSizeL( - aListId, realCount, realSize ); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::UpdateFillRuleGroupInfo -// --------------------------------------------------------------------------- -// -EXPORT_C TInt CCmDmMain::UpdateFillRuleGroupInfo() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::UpdateFillRuleGroupInfo()")); - return iConnection->UpdateFillRuleGroupInfo(); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::CCmDmMain -// --------------------------------------------------------------------------- -// -CCmDmMain::CCmDmMain() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::CCmDmMain()")); - } - -// --------------------------------------------------------------------------- -// CCmDmMain::ConstructL -// --------------------------------------------------------------------------- -// -void CCmDmMain::ConstructL() - { - LOG( _L( "[DB MNGR]\t CCmDmMain::ConstructL()")); - - RFs fs; - CleanupClosePushL( fs ); - TInt err = fs.Connect(); - TRAP(err, BaflUtils::EnsurePathExistsL(fs, KCmDbDir)); - CleanupStack::PopAndDestroy( &fs ); - - iConnection = CCmDmSQLiteConnection::NewL(); - iMaintenance = CCmDmSqlDbMaintenance::NewL(); - if( iMaintenance->InitConnection(*iConnection) ) - { - iMaintenance->CreateDbFile( *iConnection ); - } - if( !iConnection->Validate() ) - { - iMaintenance->CreateDb( *iConnection ); - iMaintenance->CreateIndexes( *iConnection ); - iConnection->InitIDs(); - } - - iConnection->LoadIDs(); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/src/cmdmsqldbmaintenance.cpp --- a/upnpharvester/common/dbmanager/src/cmdmsqldbmaintenance.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +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: SQL database maintenance class -* -*/ - - - - - - -#include "cmdmsqliteconnection.h" -#include "cmdmsqlmaintenanceclauses.h" -#include "cmdmsqldbmaintenance.h" -#include "cmdmsqlclausedef.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::NewL -// --------------------------------------------------------------------------- -// -CCmDmSqlDbMaintenance* CCmDmSqlDbMaintenance::NewL() - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::NewL()")); - - CCmDmSqlDbMaintenance* self = CCmDmSqlDbMaintenance::NewLC(); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::NewLC -// --------------------------------------------------------------------------- -// -CCmDmSqlDbMaintenance* CCmDmSqlDbMaintenance::NewLC() - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::NewLC()")); - - CCmDmSqlDbMaintenance* self = new ( ELeave ) CCmDmSqlDbMaintenance(); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::~CCmDmSqlDbMaintenance -// --------------------------------------------------------------------------- -// -CCmDmSqlDbMaintenance::~CCmDmSqlDbMaintenance() - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::~CCmDmSqlDbMaintenance()")); - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::InitConnection -// --------------------------------------------------------------------------- -// -TInt CCmDmSqlDbMaintenance::InitConnection( - CCmDmSQLiteConnection& aConnection ) - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::InitConnection()")); - return aConnection.OpenDb( KCmDatabase ); - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::CloseConnection -// --------------------------------------------------------------------------- -// -void CCmDmSqlDbMaintenance::CloseConnection( - CCmDmSQLiteConnection& aConnection ) - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CloseConnection()")); - aConnection.CloseDb(); - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::CreateDbFile -// --------------------------------------------------------------------------- -// -TInt CCmDmSqlDbMaintenance::CreateDbFile( - CCmDmSQLiteConnection& aConnection ) - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CreateDbFile()")); - return aConnection.CreateDbFile( KCmDatabase ); - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::CreateDb -// --------------------------------------------------------------------------- -// -void CCmDmSqlDbMaintenance::CreateDb( - CCmDmSQLiteConnection& aConnection ) - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CreateDb()")); - - /// DROP tables - TRAP_IGNORE( aConnection.ExecuteL( KDropFillRuleGroup )); - TRAP_IGNORE( aConnection.ExecuteL( KDropRules )); - TRAP_IGNORE( aConnection.ExecuteL( KDropRuleParams )); - TRAP_IGNORE( aConnection.ExecuteL( KDropRuleGroupServers )); - TRAP_IGNORE( aConnection.ExecuteL( KDropMediaServers )); - TRAP_IGNORE( aConnection.ExecuteL( KDropHashValues )); - TRAP_IGNORE( aConnection.ExecuteL( KDropStored )); - TRAP_IGNORE( aConnection.ExecuteL( KDropFilled )); - TRAP_IGNORE( aConnection.ExecuteL( KDropIDs )); - TRAP_IGNORE( aConnection.ExecuteL( KDropStoreRules )); - TRAP_IGNORE( aConnection.ExecuteL( KDropStoreRuleParams )); - TRAP_IGNORE( aConnection.ExecuteL( KDropStoreRuleServers )); - TRAP_IGNORE( aConnection.ExecuteL( KDropFillFiles )); - TRAP_IGNORE( aConnection.ExecuteL( KDropStoreFiles )); - TRAP_IGNORE( aConnection.ExecuteL( KDropStoreFileServers )); - TRAP_IGNORE( aConnection.ExecuteL( KDropImageShrinkingInfo )); - TRAP_IGNORE( aConnection.ExecuteL( KDropTransferInfo )); - TRAP_IGNORE( aConnection.ExecuteL( KDropSyncTime )); - TRAP_IGNORE( aConnection.ExecuteL( KDropProgressInfo )); - TRAP_IGNORE( aConnection.ExecuteL( KDropDrivesInfo )); - - // Create tables - TRAP_IGNORE( aConnection.ExecuteL( KCreateFillRuleGroup ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateRules ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateRuleParams ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateRuleGroupServers ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateMediaServers ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateHashValues ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateStored ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateIDs ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreRules ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreRuleParams ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreRuleServers ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateFillFiles ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreFiles ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreFileServers ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateImageShrinkingInfo ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateTransferInfo ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateSyncTime ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateProgressInfo ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateDrivesInfo )); - - // Init clauses - TRAP_IGNORE( aConnection.ExecuteL( KInitShrinkingTime ) ); - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::CreateIndexes -// --------------------------------------------------------------------------- -// -void CCmDmSqlDbMaintenance::CreateIndexes( - CCmDmSQLiteConnection& aConnection ) - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CreateIndexes()")); - - // Drop indexes - TRAP_IGNORE( aConnection.ExecuteL( KDropFillListIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KDropFillItemRefIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KDropStoreStatusIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KDropFillStatusIndex ) ); - - // Create indexes - TRAP_IGNORE( aConnection.ExecuteL( KCreateFillListIdIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateFillItemRefIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateStoreStatusIndex ) ); - TRAP_IGNORE( aConnection.ExecuteL( KCreateFillStatusIndex ) ); - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::CCmDmSqlDbMaintenance -// --------------------------------------------------------------------------- -// -CCmDmSqlDbMaintenance::CCmDmSqlDbMaintenance() - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::CCmDmSqlDbMaintenance()")); - } - -// --------------------------------------------------------------------------- -// CCmDmSqlDbMaintenance::ConstructL -// --------------------------------------------------------------------------- -// -void CCmDmSqlDbMaintenance::ConstructL() - { - LOG( _L( "[DB MNGR]\t CCmDmSqlDbMaintenance::ConstructL()")); - } - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/common/dbmanager/src/cmdmsqliteconnection.cpp --- a/upnpharvester/common/dbmanager/src/cmdmsqliteconnection.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3678 +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: SQLite Connection class -* -*/ - - - - - - -#include "cmdmsqliteconnection.h" -#include "cmdmsqlclausedef.h" -#include "cmfillrule.h" -#include "cmfillrulecontainer.h" -#include "cmmediaserverfull.h" -#include "cmstorerule.h" -#include "cmfilllistitem.h" -#include "cmstorelistitem.h" -#include "cmdriveinfo.h" -#include "cmsearchresponsehash.h" -#include "msdebug.h" - -// Constants -_LIT8( KCmDbPragmaCacheSize, "PRAGMA cache_size=4096;PRAGMA page_size=4096;"); -const TUint8 KAmountOfIDs = 10; - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::NewL -// --------------------------------------------------------------------------- -// -CCmDmSQLiteConnection* CCmDmSQLiteConnection::NewL() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::NewL()")); - - CCmDmSQLiteConnection* self = CCmDmSQLiteConnection::NewLC(); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::NewLC -// --------------------------------------------------------------------------- -// -CCmDmSQLiteConnection* CCmDmSQLiteConnection::NewLC() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::NewLC()")); - - CCmDmSQLiteConnection* self = new ( ELeave ) CCmDmSQLiteConnection(); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::~CCmDmSQLiteConnection -// --------------------------------------------------------------------------- -// -CCmDmSQLiteConnection::~CCmDmSQLiteConnection() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::~CCmDmSQLiteConnection()")); - - TRAP_IGNORE( BackUpIdL( ERuleGroupID, iRuleGroupID ) ); - TRAP_IGNORE( BackUpIdL( ERuleID, iRuleID ) ); - TRAP_IGNORE( BackUpIdL( ERuleParamID, iRuleParamID ) ); - TRAP_IGNORE( BackUpIdL( EMediaServerID, iMediaServerID ) ); - TRAP_IGNORE( BackUpIdL( EStoredID, iStoredID ) ); - TRAP_IGNORE( BackUpIdL( EFilledID, iFilledID ) ); - TRAP_IGNORE( BackUpIdL( EStoreRuleID, iStoreRuleID ) ); - TRAP_IGNORE( BackUpIdL( EStoreRuleParamID, iStoreRuleParamID ) ); - TRAP_IGNORE( BackUpIdL( EFillFileListId, iFillFileId ) ); - TRAP_IGNORE( BackUpIdL( EStoreFileListId, iStoreFileId ) ); - CloseDb(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::OpenDb -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::OpenDb( const TDesC& aDb ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::OpenDb()")); - - TInt err( iDatabase.Open( aDb, NULL ) ); - if ( err != KErrNone ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t CCmDmSQLiteConnection::OpenDb()\ - error %d"), err)); - } - else - { - err = iDatabase.Exec( KCmDbPragmaCacheSize ); - - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::CloseDb -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::CloseDb() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::CloseDb()")); - - iDatabase.Close(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::InitIDs -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::InitIDs() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::InitIDs()")); - - TInt err = iStatement.Prepare( iDatabase, KAddIDs ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::SetIDs() FAILED "))); - } - else - { - for( TInt j=1; j <= KAmountOfIDs ; j++ ) - { - SetID( static_cast(j) ); - } - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetID -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::SetID( TTypeOfID aType ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetID()")); - - // Init all ids to one - iStatement.BindInt64( 0, 1 ); - iStatement.BindInt( 1, aType ); - iStatement.Exec(); - iStatement.Reset(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::BackUpIdL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::BackUpIdL( TTypeOfID aType, TUint64 aID ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::BackUpIdL()")); - - iStatement.PrepareL( iDatabase, KUpdateID ); - iStatement.BindInt64( 0, aID ); - iStatement.BindInt( 1, aType ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::LoadIDs -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::LoadIDs() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::LoadIDs()")); - - TRAP_IGNORE( LoadIDL( iRuleGroupID, ERuleGroupID ) ); - TRAP_IGNORE( LoadIDL( iRuleID, ERuleID ) ); - TRAP_IGNORE( LoadIDL( iRuleParamID, ERuleParamID ) ); - TRAP_IGNORE( LoadIDL( iMediaServerID, EMediaServerID ) ); - TRAP_IGNORE( LoadIDL( iStoredID, EStoredID ) ); - TRAP_IGNORE( LoadIDL( iFilledID, EFilledID ) ); - TRAP_IGNORE( LoadIDL( iStoreRuleID, EStoreRuleID ) ); - TRAP_IGNORE( LoadIDL( iStoreRuleParamID, EStoreRuleParamID ) ); - TRAP_IGNORE( LoadIDL( iFillFileId, EFillFileListId) ); - TRAP_IGNORE( LoadIDL( iStoreFileId, EStoreFileListId) ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::LoadIDL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::LoadIDL( TUint64& aId, TTypeOfID aType ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::LoadIDL()")); - - TInt err = iStatement.Prepare( iDatabase, KSelectID ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::LoadIDL() FAILED "))); - User::Leave( err ); - } - else - { - iStatement.BindInt( 0, aType ); - - // get id - err = iStatement.Next(); - if ( err == KSqlAtRow ) - { - aId = iStatement.ColumnInt64( 0 ); - } - iStatement.Reset(); - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::CreateDbFile -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::CreateDbFile( const TDesC& aDb ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::CreateDbFile()")); - - TInt err( iDatabase.Create( aDb ) ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::Validate -// --------------------------------------------------------------------------- -// -TBool CCmDmSQLiteConnection::Validate() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::Validate()")); - - TInt ret( KErrNone ); - TInt err = iStatement.Prepare( iDatabase, - KValidateTableExistence ); - // Loop only one row in results - if( err ) - { - ret = KErrGeneral; - } - else - { - err = iStatement.Next(); - if ( err != KSqlAtRow ) - { - ret = KErrGeneral; - } - iStatement.Reset(); - iStatement.Close(); - } - TBool retval = EFalse; - if ( ret == KErrNone ) - { - retval = ETrue; - } - return retval; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::ExecuteL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::ExecuteL( const TDesC8& aCommand ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::ExecuteL()")); - - TInt err( iDatabase.Exec( aCommand ) ); - if ( KErrNone > err ) - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetFillFiles -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::SetFillFiles( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetFillFiles()")); - - iDatabase.Exec( KCmDbBeginTransaction ); - TInt err(KErrNone); - for( TInt i = 0; i < aItems.Count(); i++ ) - { - err = iStatement.Prepare( iDatabase, KAddFillFile ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t Prepare err = %d"), err )); - } - else - { - iStatement.BindInt64( 0, aItems[i]->DbId() ); - iStatement.BindText( 1, aItems[i]->PrimaryText() ); - iStatement.BindText( 2, - aItems[i]->SecondaryText() ); - iStatement.BindText( 3, aItems[i]->Path() ); - iStatement.BindBinary( 4, aItems[i]->Uri() ); - iStatement.BindBinary( 5, aItems[i]->ItemId() ); - iStatement.BindText( 6, aItems[i]->UpnpClass() ); - iStatement.BindInt( 7, aItems[i]->MediaType() ); - iStatement.BindInt( 8, aItems[i]->Priority() ); - iStatement.BindInt( 9, aItems[i]->Size() ); - iStatement.BindInt( 10, aItems[i]->Status() ); - iStatement.BindInt64( 11, aItems[i]->Date().Int64() ); - iStatement.BindInt( 12, aItems[i]->ListId() ); - iStatement.BindInt( 13, aItems[i]->DevId() ); - iStatement.BindInt64( 14, aItems[i]->RefId() ); - iStatement.BindInt( 15, aItems[i]->Selected() ); - iStatement.BindInt64( 16, aItems[i]->DriveId() ); - iStatement.BindInt( 17, aItems[i]->DriveNumber() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - iDatabase.Exec( KCmDbSqlCommit ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetStoreFilesL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::SetStoreFilesL( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetStoreFilesL()")); - - iDatabase.Exec( KCmDbBeginTransaction ); - TInt err(KErrNone); - for( TInt i = 0; i < aItems.Count(); i++ ) - { - err = iStatement.Prepare( iDatabase, KAddStoreFile ); - if( err ) - { - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iStoreFileId ); - iStatement.BindText( 1, aItems[i]->PrimaryText() ); - iStatement.BindText( 2, - aItems[i]->SecondaryText() ); - iStatement.BindText( 3, aItems[i]->Path() ); - iStatement.BindInt( 4, aItems[i]->Size() ); - iStatement.BindInt64( 5, aItems[i]->Date().Int64() ); - iStatement.BindInt( 6, aItems[i]->ListId() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - /** INSERT Server */ - RArray serverIds( aItems[i]->DevIds() ); - RArray statusValues( aItems[i]->StatusValues() ); - for( TInt j = 0; j < serverIds.Count(); j++ ) - { - err = iStatement.Prepare( iDatabase, KAddStoreFileServer ); - if( err ) - { - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iStoreFileId ); - iStatement.BindInt( 1, serverIds[j] ); - iStatement.BindInt( 2, statusValues[j] ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - iStoreFileId++; - } - iDatabase.Exec( KCmDbSqlCommit ); - BackUpIdL( EStoreFileListId, iStoreFileId ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddStoreFile -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddStoreFile( CCmStoreListItem& aItem ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoreFile()")); - - TInt err(KErrNone); - err = iStatement.Prepare( iDatabase, KAddStoreFile ); - if( err ) - { - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iStoreFileId ); - iStatement.BindText( 1, aItem.PrimaryText() ); - iStatement.BindText( 2, aItem.SecondaryText() ); - iStatement.BindText( 3, aItem.Path() ); - iStatement.BindInt( 4, aItem.Size() ); - iStatement.BindInt64( 5, aItem.Date().Int64() ); - iStatement.BindInt64( 6, aItem.ListId() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - /** INSERT Server */ - RArrayserverIds( aItem.DevIds() ); - RArraystatusValues( aItem.StatusValues() ); - for( TInt j = 0; j < serverIds.Count() ; j++ ) - { - err = iStatement.Prepare( iDatabase, KAddStoreFileServer ); - if( err ) - { - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iStoreFileId ); - iStatement.BindInt( 1, serverIds[j] ); - iStatement.BindInt( 2, statusValues[j] ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - } - iStoreFileId++; - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddStoredL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddStoredL( - const TDesC& aFileName, - const TDesC8& aUDN, - TTime aTimeStamp ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoredL()")); - /* FIRST QYERY MediaServerID from the MediaServer table - using UDN */ - TInt err = iStatement.Prepare( iDatabase, KSelectMediaServerIDByUDN ) ; - TUint64 mediaServerID(0); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t KSelectMediaServerIDByUDN \ - FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindBinary( 0, aUDN ); - // Loop only one row in results - err = iStatement.Next(); - if ( err == KSqlAtRow ) - { - // Get cell contents - mediaServerID = iStatement.ColumnInt64( 0 ); - iStatement.Reset(); - iStatement.Close(); // Destruct statement - err = KErrNone; - } - } - - err = iStatement.Prepare( iDatabase, KAddStored ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t KAddStored FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iStoredID ); - iStatement.BindText( 1, aFileName ); - iStatement.BindInt64( 2, mediaServerID ); - iStatement.BindInt64( 3, aTimeStamp.Int64() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - err = KErrNone; - } - iStoredID++; - BackUpIdL( EStoredID, iStoredID ); - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddFillRuleL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddFillRuleL( CCmFillRule* aFillRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddFillRuleL()")); - - iDatabase.Exec( KCmDbBeginTransaction ); - TInt err = iStatement.Prepare( iDatabase, KAddFillGroup ); - - if ( err == KErrNone ) - { - if( aFillRule->ListId() ) - { - iRuleGroupID = aFillRule->ListId(); - } - iStatement.BindInt64( 0, iRuleGroupID ); - iStatement.BindBinary( 1, aFillRule->Name() ); - iStatement.BindInt( 2, aFillRule->Method() ); - iStatement.BindInt( 3, aFillRule->LimitType() ); - iStatement.BindInt( 4, aFillRule->Amount() ); - iStatement.BindInt( 5, aFillRule->Selected() ); - iStatement.BindInt( 6, aFillRule->Priority() ); - iStatement.BindInt( 7, aFillRule->TemplateId() ); - iStatement.BindInt( 8, aFillRule->MediaType() ); - iStatement.BindInt( 9, aFillRule->Status() ); - iStatement.BindInt64( 10, aFillRule->ListRealCount() ); - iStatement.BindInt64( 11, aFillRule->ListRealSizeInBytes() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - err = AddFillRuleMediaServersL( aFillRule ); - - if ( err == KErrNone ) - { - err = AddFillRuleRulesAndParamsL( aFillRule ); - } - if ( err == KErrNone ) - { - iRuleGroupID++; - BackUpIdL( ERuleGroupID, iRuleGroupID ); - } - } - - iDatabase.Exec( KCmDbSqlCommit ); - - // in error cases force return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddFillRuleMediaServersL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddFillRuleMediaServersL( CCmFillRule* aFillRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - AddFillRuleMediaServersL()")); - - TInt mediaServerCount( aFillRule->MediaServerCount() ); - - TInt mediaserverID(0); - TInt err( KErrNone ); - for( TInt i = 0; i < mediaServerCount ; i++ ) - { - TPtrC8 udn = aFillRule->MediaServerL( i ); - aFillRule->MediaServerL( i, mediaserverID ); - if( udn.Length() ) - { - err = - iStatement.Prepare( iDatabase, KSelectMediaServerIDByUDN ); - if( !err ) - { - iStatement.BindBinary( 0, udn ); - // Loop all rows in results - while ( iStatement.Next() == KSqlAtRow ) - { - // Get cell contents - mediaserverID = iStatement.ColumnInt64( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); - } - if( mediaserverID > 0 ) - { - err = iStatement.Prepare( iDatabase, KAddRuleGroupServer ); - if( err ) - { - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, - iRuleGroupID ); - iStatement.BindInt64( 1, - mediaserverID ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - err = KErrNone; - } - } - } - - return err; - } -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddFillRuleRulesAndParamsL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddFillRuleRulesAndParamsL( - CCmFillRule* aFillRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - AddFillRuleRulesAndParamsL()")); - - TInt ruleCount(aFillRule->RuleCount()); - TInt err( KErrNone ); - TCmMetadataField metadataField; - TPtrC8 dataField; - TInt dataIndex; - TCmOperatorType oper; - TInt parameterCount(0); - for( TInt j = 0; j < ruleCount; j++) - { - aFillRule->RuleL( j, &metadataField, &oper, ¶meterCount ); - - err = iStatement.Prepare( iDatabase, KAddRule ); - - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::AddFilledL() FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iRuleID ); - iStatement.BindInt64( 1, iRuleGroupID ); - iStatement.BindInt( 2, metadataField ); - iStatement.BindInt( 3, oper ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - err = KErrNone; - } - - // Add params of the rule to table - for( TInt k = 0; k < parameterCount; k++) - { - aFillRule->RuleParamL( j, k, &dataField ); - aFillRule->RuleParamL( j, k, dataIndex ); - err = iStatement.Prepare( iDatabase, KAddRuleParam ); - - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::AddFilledL() FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iRuleParamID ); - iRuleParamID++; - iStatement.BindInt64( 1, iRuleID ); - if( dataField.Length() ) - { - iStatement.BindBinary( 2, dataField ); - } - else - { - iStatement.BindInt64( 3, dataIndex ); - } - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - err = KErrNone; - } - } - iRuleID++; - } - BackUpIdL( ERuleID, iRuleID ); - BackUpIdL( ERuleParamID, iRuleParamID ); - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddStoreRuleL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddStoreRuleL( CCmStoreRule* aStoreRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoreRuleL()")); - - TInt err = iStatement.Prepare( iDatabase, KAddStoreRule ); - - if ( err == KErrNone ) - { - iStatement.BindInt64( 0, iStoreRuleID ); - iStatement.BindBinary( 1, aStoreRule->Name() ); - iStatement.BindInt( 2, aStoreRule->Selected() ); - iStatement.BindInt( 3, aStoreRule->Status() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - err = AddStoreRuleParamsL( aStoreRule ); - - if ( err == KErrNone ) - { - err = AddStoreRuleMediaServersL( aStoreRule ); - } - if ( err == KErrNone ) - { - iStoreRuleID++; - BackUpIdL( EStoreRuleID, iStoreRuleID ); - } - } - - // in error cases force return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddStoreRuleParamsL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddStoreRuleParamsL( CCmStoreRule* aStoreRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddStoreRuleParamsL()")); - - TInt err( KErrNone ); - TCmMediaType mediaType; - // Ensin tavara fillrule group tauluun - for(TInt i = 0; i < aStoreRule->DefCount(); i++ ) - { - aStoreRule->StoreRule(i, &mediaType); - err = iStatement.Prepare( iDatabase, KAddStoreRuleParams ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::AddStoreRuleParamsL() FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iStoreRuleID ); - iStatement.BindInt64( 1, iStoreRuleParamID ); - iStatement.BindInt( 2, (TInt)mediaType ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - iStoreRuleParamID++; - } - BackUpIdL( EStoreRuleParamID, iStoreRuleParamID ); - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddStoreRuleMediaServersL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddStoreRuleMediaServersL( - CCmStoreRule* aStoreRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - AddStoreRuleMediaServersL()")); - - TInt err( KErrNone ); - TInt mediaServerCount( aStoreRule->MediaServerCount() ); - TRACE(Print(_L("[DATABASE MANAGER]\t \ - mediaServerCount = %d "), mediaServerCount)); - if( mediaServerCount > KErrNone ) - { - for( TInt i = 0; i < mediaServerCount ; i++ ) - { - err = iStatement.Prepare( iDatabase, - KSelectMediaServerIDByUDN ); - - TUint64 mediaserverID(0); - TPtrC8 udn = aStoreRule->MediaServerL( i ); - iStatement.BindBinary( 0, udn ); - if( err ) - { - err = KErrGeneral; - } - else - { - // Loop all rows in results - if ( iStatement.Next() == KSqlAtRow ) - { - // Get cell contents - mediaserverID = iStatement.ColumnInt64( 0 ); - iStatement.Reset(); - iStatement.Close(); - err = iStatement.Prepare( iDatabase, - KAddStoreRuleServers ); - if( err ) - { - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iStoreRuleID ); - iStatement.BindInt64( 1, mediaserverID ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - err = KErrNone; - } - - } - } - } - } - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddMediaServerL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddMediaServerL( - CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddMediaServerL()")); - - TInt err = iStatement.Prepare( iDatabase, KAddMediaServer ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::AddMediaServerL() FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, iMediaServerID ); - iStatement.BindBinary( 1, aMediaServer->MediaServer() ); - iStatement.BindBinary( 2, aMediaServer->MediaServerName() ); - iStatement.BindInt( 3, aMediaServer->SystemUpdateID() ); - iStatement.BindInt64( 4, aMediaServer->VisibleDate().Int64() ); - iStatement.BindInt( 5, KErrNone ); - iStatement.BindInt( 6, KErrNone ); - iStatement.BindInt( 7, KErrNone ); - iStatement.BindInt( 8, KErrNone ); - iStatement.BindInt( 9, KErrNone ); - iStatement.BindInt( 10, (TInt)aMediaServer->CopyCapability() ); - iStatement.BindInt( 11, aMediaServer->FillUsage() ); - iStatement.BindInt( 12, aMediaServer->StoreUsage() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - err = KErrNone; - } - iMediaServerID++; - BackUpIdL( EMediaServerID, iMediaServerID ); - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::AddHashValue -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::AddHashValue( TInt64 aMediaServerId, - CCmSearchResponseHash* aHashValue ) - - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::AddHashValue()")); - - TInt err = iStatement.Prepare( iDatabase, KAddHashValue ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::AddHashValue() FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, aMediaServerId ); - iStatement.BindInt( 1, aHashValue->StartIndex() ); - iStatement.BindInt( 2, aHashValue->ItemCount() ); - iStatement.BindBinary( 3, aHashValue->Hash() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - err = KErrNone; - } - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetMediaServersL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::SetMediaServersL( - RPointerArray& aServers ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetMediaServersL()")); - TInt err( KErrNone ); - - TInt sqlRet( iDatabase.Exec( KInitIsActiveFlags ) ); - - if ( sqlRet >= KErrNone ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - %d rows have been changed/inserted/deleted"), sqlRet )); - - TInt id( KErrNone ); - // Add new servers into - HBufC8* uuid = NULL; - for( TInt j = 0; j < aServers.Count(); j++ ) - { - uuid = aServers[j]->MediaServer().AllocLC(); - PrepareQueryCmdL(EMediaServerIdQuery); - id = QueryMediaServerId( *uuid ); - if( id == KErrNotFound ) - { - AddMediaServerL( aServers[j] ); - } - CleanupStack::PopAndDestroy( uuid ); - uuid = NULL; - } - - for( TInt i = 0; i < aServers.Count() ; i++ ) - { - err = iStatement.Prepare( iDatabase, KUpdateMsIsActive ); - - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::SetMediaServersL() FAILED "))); - err = KErrGeneral; - } - else - { - iStatement.BindInt( 0, aServers[i]->IsActive() ); - iStatement.BindInt( 1, aServers[i]->SystemUpdateID() ); - //update the server name - iStatement.BindBinary( 2, aServers[i]->MediaServerName() ); - iStatement.BindInt( 3, aServers[i]->FillUsage() ); - iStatement.BindInt( 4, aServers[i]->StoreUsage() ); - iStatement.BindBinary( 5, aServers[i]->MediaServer() ); - iStatement.Exec(); - } - iStatement.Reset(); - iStatement.Close(); - } - - if ( err == KErrNone ) - { - err = DeleteInActiveRuleServers(); - } - - if ( err == KErrNone ) - { - err = DeleteInActiveFiles(); - } - } - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetSyncTime -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::SetSyncTime() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetSyncTime()")); - - TInt err( iDatabase.Exec( KRemoveSyncTime ) ); - - if ( err == KErrNone ) - { - err = iStatement.Prepare( iDatabase, KSetSyncTime ); - if ( err == KErrNone ) - { - TTime time; - time.HomeTime(); - iStatement.BindInt64( 0, time.Int64() ); - iStatement.Exec(); - } - iStatement.Reset(); - iStatement.Close(); - } - // in error cases force return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetSyncTime -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetSyncTime( TTime& aTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetSyncTime()")); - - TInt err( iStatement.Prepare( iDatabase, KGetSyncTime ) ); - aTime = KErrNone; - if( err ) - { - err = KErrGeneral; - } - else - { - err = iStatement.Next(); - if ( err == KSqlAtRow ) - { - aTime = iStatement.ColumnInt64( 0 ); - err = KErrNone; - } - } - iStatement.Reset(); - iStatement.Close(); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetProgressInfo -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::SetProgressInfo( TInt aTransferred, - TInt aTotalCount) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetProgressInfo()")); - - TInt err( iDatabase.Exec( KRemoveProgressInfo ) ); - if ( err == KErrNone ) - { - err = iStatement.Prepare( iDatabase, KSetProgressInfo ); - if( err ) - { - err = KErrGeneral; - } - else - { - iStatement.BindInt( 0, aTransferred ); - iStatement.BindInt( 1, aTotalCount ); - iStatement.Exec(); - } - iStatement.Reset(); - iStatement.Close(); - } - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetProgressInfo -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetProgressInfo( TInt& aTransferred, - TInt& aTotalCount ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetProgressInfo()")); - - TInt err( iStatement.Prepare( iDatabase, KGetProgressInfo ) ); - if( err ) - { - err = KErrGeneral; - } - else - { - err = iStatement.Next(); - if ( err == KSqlAtRow ) - { - aTransferred = iStatement.ColumnInt( 0 ); - aTotalCount = iStatement.ColumnInt( 1 ); - err = KErrNone; - } - } - iStatement.Reset(); - iStatement.Close(); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetDrivesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::SetDrivesL( RPointerArray& aDrives ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetDrivesL()")); - - TInt err( iDatabase.Exec( KRemoveDrivesInfo ) ); - - if ( err == KErrNone) - { - iDatabase.Exec( KCmDbBeginTransaction ); - for( TInt i = 0; i < aDrives.Count(); i++ ) - { - err = iStatement.Prepare( iDatabase, KSetDrivesInfo ); - User::LeaveIfError( err ); - iStatement.BindInt( 0, aDrives[i]->DriveNumber() ); - iStatement.BindInt( 1, aDrives[i]->DriveType() ); - iStatement.BindText( 2, aDrives[i]->DriveName() ); - iStatement.BindInt64( 3, aDrives[i]->DriveSize() ); - iStatement.BindInt64( 4, aDrives[i]->DriveQuota() ); - iStatement.BindInt64( 5, aDrives[i]->UsedDriveQuota() ); - iStatement.BindInt64( 6, aDrives[i]->DriveId() ); - iStatement.BindInt( 7, aDrives[i]->Status() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - iDatabase.Exec( KCmDbSqlCommit ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::PrepareQueryCmdL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::PrepareQueryCmdL( TCMQueryCmdType aType ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::PrepareQueryCmdL()")); - - TInt err( KErrNone ); - switch( aType ) - { - case EFillRuleQuery: - { - iDatabase.Exec( KCmDbBeginTransaction ); - err = iStatement.Prepare( iDatabase, KSelectFillRule ); - break; - } - case EMediaServerInfoQyery: - { - err = iStatement.Prepare( iDatabase, - KSelectDeviceInfoByUDN ); - break; - } - case EMediaServerIdQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectMediaServerIDByUDN ); - break; - } - case EMediaServerUDNQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectMediaServerUDNByID ); - break; - } - case EMediaServersAllQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectAllMediaServers ); - break; - } - case EHashValueQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectHashValuesByMediaServer ); - break; - } - case EStoredQuery: - { - err = iStatement.Prepare( iDatabase, KIsFileAlreadyStored ); - break; - } - case EStoredRowQuery: - { - err = iStatement.Prepare( iDatabase, KSelectStoredByUDN ); - break; - } - case ESelectedFillRuleQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectSelectedFillRuleNames); - break; - } - case EFillRuleNamesQuery: - { - iDatabase.Exec( KCmDbBeginTransaction ); - err = iStatement.Prepare( iDatabase, KSelectFillRuleNames ); - break; - } - case EStoreRuleQuery: - { - err = iStatement.Prepare( iDatabase, KSelectStoreRule ); - break; - } - case EStoreRuleNamesQuery: - { - err = iStatement.Prepare( iDatabase, KSelectStoreRuleNames ); - break; - } - case ESelectedStoreRuleQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectSelectedStoreRuleNames ); - break; - } - case ETransferHistoryQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectTransferHistory ); - break; - } - case EFillFilesQuery: - { - err = iStatement.Prepare( iDatabase, KSelectFillFiles ); - break; - } - case EDeletedFillFilesQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectDeletedFillFiles ); - break; - } - case EStoreFilesQuery: - { - err = iStatement.Prepare( iDatabase, KSelectStoreFiles ); - break; - } - case EAllFillFilesQuery: - { - err = iStatement.Prepare( iDatabase, KSelectAllFillFiles ); - break; - } - case EAllStoreFilesQuery: - { - err = iStatement.Prepare( iDatabase, KSelectAllStoreFiles ); - break; - } - case EFilledLowPriorityQuery: - { - err = iStatement.Prepare( iDatabase, - KSelectLowestPriorityFilled ); - break; - } - case EAllFillFilesStatusQuery: - { - err = iStatement.Prepare( iDatabase, KGetAllFillFiles ); - break; - } - case EAllStoreFilesStatusQuery: - { - err = iStatement.Prepare( iDatabase, KGetAllStoreFiles ); - break; - } - case EDrivesQuery: - { - err = iStatement.Prepare( iDatabase, KGetDrives ); - break; - } - default: - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::PrepareQueryCmdL() \ - type not found")); - break; - } - - } - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t err = %d "), err )); - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryFillRuleL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryFillRuleL( CCmFillRule* aFillRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleL()")); - - TInt err( KErrNone ); - TUint64 ruleGroupID(0); - TPtrC8 tempptr; - iStatement.BindBinary( 0, aFillRule->Name() ); - // Loop only one row in results - err = iStatement.Next(); - if ( err == KSqlAtRow ) - { - // Get cell contents - ruleGroupID = iStatement.ColumnInt64( 0 ); - aFillRule->SetListId( (TUint8)ruleGroupID ); - iStatement.ColumnBinary( 1, tempptr ); - aFillRule->SetNameL( tempptr ); - aFillRule->SetMethod( - (TCmFillMethod)iStatement.ColumnInt( 2 ) ); - aFillRule->SetLimitType( - (TCmLimitType)iStatement.ColumnInt( 3 ) ); - aFillRule->SetAmount( - iStatement.ColumnInt( 4 ) ); - aFillRule->SetSelected( - (TCmFillRuleStatus)iStatement.ColumnInt( 5 ) ); - aFillRule->SetPriority( - (TUint8)iStatement.ColumnInt( 6 ) ); - aFillRule->SetTemplateId( - (TUint8)iStatement.ColumnInt( 7 ) ); - aFillRule->SetMediaType( - (TCmMediaType)iStatement.ColumnInt( 8 ) ); - aFillRule->SetStatus( - (TCmListItemStatus)iStatement.ColumnInt( 9 ) ); - aFillRule->SetListRealCount( iStatement.ColumnInt( 10 ) ); - aFillRule->SetListRealSizeInBytes( - iStatement.ColumnInt(11) ); - err = KErrNone; - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - err = QueryFillRuleServersL( aFillRule, ruleGroupID ); - if ( err ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleL() \ - error getting servers")); - } - - err = QueryFillRuleParamsL( aFillRule ); - if ( err ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleL() \ - error getting fill list parameters")); - } - - iDatabase.Exec( KCmDbSqlCommit ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryFillRuleServersL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryFillRuleServersL( CCmFillRule* aFillRule, - TUint64 aRuleGroupID ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleServersL()")); - - TInt err( iStatement.Prepare( iDatabase, - KSelectMediaServerIDByRuleGroupID ) ); - RArray mediaServerIds; - CleanupClosePushL( mediaServerIds ); - if( err ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - QueryFillRuleServersL() select mediaserver fail")); - } - else - { - iStatement.BindInt64( 0, aRuleGroupID ); - // Loop all rows in results - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - mediaServerIds.AppendL( - iStatement.ColumnInt64(0) ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - - TInt mediaServerCount( mediaServerIds.Count()); - - for( TInt mediaServerIndex = 0; mediaServerIndex < mediaServerCount ; - mediaServerIndex++ ) - { - aFillRule->AddMediaServerL( - mediaServerIds[mediaServerIndex]); - } - - mediaServerIds.Reset(); - CleanupStack::PopAndDestroy( &mediaServerIds ); - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryFillRuleParamsL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryFillRuleParamsL( CCmFillRule* aFillRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleParamsL()")); - - TInt err( iStatement.Prepare( iDatabase, KSelectRule ) ); - RArray ruleIds; - CleanupClosePushL( ruleIds ); - TPtrC8 temp; - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::QueryFillRule() FAIL5"))); - err = KErrGeneral; - } - else - { - iStatement.BindBinary( 0, aFillRule->Name() ); - // Loop all rows in results - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell content - ruleIds.AppendL( iStatement.ColumnInt64( 0 ) ); - aFillRule->AddRuleL( - (TCmMetadataField)iStatement.ColumnInt( 1 ), - (TCmOperatorType)iStatement.ColumnInt( 2 ) ); - } - - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - - TInt numberOfRules( ruleIds.Count() ); - for( TInt index = 0; index < numberOfRules ; index++ ) - { - err = iStatement.Prepare( iDatabase, - KSelectRuleParamsByRuleID ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - KSelectRuleParamsByRuleID FAIL"))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, ruleIds[index] ); - // Loop all rows in results - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - iStatement.ColumnBinary( 0, temp ); - if( temp.Length() ) - { - aFillRule->AddRuleParamL( index, temp ); - } - else - { - aFillRule->AddRuleParamL( index, - iStatement.ColumnInt64( 1 ) ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - } - - ruleIds.Reset(); - CleanupStack::PopAndDestroy( &ruleIds ); - - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::QueryFillRule() end"))); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QuerySelectedFillRuleNamesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QuerySelectedFillRuleNamesL( - RPointerArray& aNames, TInt aSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - QuerySelectedFillRuleNamesL()")); - - iStatement.BindInt( 0, aSelected ); - // Loop only one row in results - TPtrC8 tempPtr; - while( KSqlAtRow == iStatement.Next() ) - { - // Get cell contents - iStatement.ColumnBinary( 0, tempPtr ); - aNames.Append( tempPtr.AllocL() ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryFillRuleNamesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QueryFillRuleNamesL( - RPointerArray& aNames ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillRuleNamesL()")); - - // Loop only one row in results - TPtrC8 temp; - while( KSqlAtRow == iStatement.Next() ) - { - // Get cell contents - iStatement.ColumnBinary( 0, temp ); - aNames.Append( temp.AllocL() ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - iDatabase.Exec( KCmDbSqlCommit ); - TRACE(Print(_L("[DATABASE MANAGER]\t CCmDmSQLiteConnection::\ - QueryFillRuleNamesL() end"))); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryStoreRuleL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryStoreRuleL( CCmStoreRule* aStoreRule ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreRuleL()")); - - TUint64 ruleGroupID(0); - TPtrC8 temp; - iStatement.BindBinary( 0, aStoreRule->Name() ); - // Loop only one row in results - TInt err( iStatement.Next() ); - if ( err == KSqlAtRow ) - { - // Get cell contents - ruleGroupID = iStatement.ColumnInt64( 0 ); - aStoreRule->SetListId( ruleGroupID ); - iStatement.ColumnBinary( 1, temp ); - aStoreRule->SetNameL( temp ); - aStoreRule->SetSelected( - (TCmFillRuleStatus)iStatement.ColumnInt( 2 ) ); - aStoreRule->SetStatus( - (TCmListItemStatus)iStatement.ColumnInt( 3 ) ); - err = KErrNone; - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - err = QueryStoreRuleDefsL( aStoreRule, ruleGroupID ); - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryStoreRuleDefsL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryStoreRuleDefsL( CCmStoreRule* aStoreRule, - TUint64 aRuleGroupID ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreRuleDefsL()")); - - TInt err( iStatement.Prepare( iDatabase, KSelectStoreRuleDefs ) ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - CCmDmSQLiteConnection::QueryStoreRuleL() FAIL5"))); - err = KErrGeneral; - } - else - { - TPtrC8 temp; - iStatement.BindBinary( 0, aStoreRule->Name() ); - // Loop all rows in results - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - aStoreRule->AddStoreRuleL( - (TCmMediaType)iStatement.ColumnInt( 1 ) ); - } - - iStatement.Reset(); - iStatement.Close(); // Destruct statement - - err = iStatement.Prepare( iDatabase, KSelectStoreRuleMediaServerID ); - RArray mediaServerIds; - CleanupClosePushL( mediaServerIds ); - - if( err ) - { - TRACE( Print( - _L("[DATABASE MANAGER]\t KSelectMediaServerID FAIL") ) ); - } - else - { - iStatement.BindInt64( 0, aRuleGroupID ); - // Loop all rows in results - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - mediaServerIds.AppendL( - iStatement.ColumnInt64( 0 )); - } - iStatement.Reset(); - iStatement.Close();// Destruct statement - TInt mediaServerCount( mediaServerIds.Count() ); - for( TInt mediaServerIndex = 0; - mediaServerIndex < mediaServerCount ; mediaServerIndex++ ) - { - err = iStatement.Prepare( iDatabase, - KSelectRuleUDNsByMediaServerID ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - KSelectRuleUDNsByMediaServerID FAIL"))); - err = KErrGeneral; - } - else - { - iStatement.BindInt64( 0, - mediaServerIds[mediaServerIndex] ); - // Loop all rows in results - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - iStatement.ColumnBinary( 0, temp ); - aStoreRule->AddMediaServerL( temp ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - } - mediaServerIds.Reset(); - CleanupStack::PopAndDestroy( &mediaServerIds ); - } - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryStoreRuleNamesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QueryStoreRuleNamesL( - RPointerArray& aNames ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreRuleNamesL()")); - - // Loop only one row in results - TPtrC8 temp; - while( KSqlAtRow == iStatement.Next() ) - { - // Get cell contents - iStatement.ColumnBinary( 0, temp ); - aNames.Append( temp.AllocL() ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QuerySelectedStoreRuleNamesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QuerySelectedStoreRuleNamesL( - RPointerArray& aNames, TInt aSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - QuerySelectedStoreRuleNamesL()")); - - // Do binding only for the first row - iStatement.BindInt( 0, aSelected ); - // Loop only one row in results - TPtrC8 temp; - while( KSqlAtRow == iStatement.Next() ) - { - // Get cell contents - iStatement.ColumnBinary( 0, temp ); - aNames.Append( temp.AllocL() ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryMediaServerL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryMediaServerL( - CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryMediaServerL()")); - - iStatement.BindBinary( 0, aMediaServer->MediaServer() ); - // Loop only one row in results - TInt err( KErrNotFound ); - if ( KSqlAtRow == iStatement.Next() ) - { - TPtrC8 temp; - // Get cell contents - iStatement.ColumnBinary( 2, temp ); - aMediaServer->SetMediaServerNameL( temp ); - aMediaServer->SetSystemUpdateID( - iStatement.ColumnInt( 3 ) ); - aMediaServer->SetVisibleDate( - iStatement.ColumnInt64( 4 ) ); - aMediaServer->SetIsActive( - iStatement.ColumnInt( 5 ) ); - aMediaServer->SetFillUsage( - iStatement.ColumnInt( 6 ) ); - err = KErrNone; - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryMediaServerId -// --------------------------------------------------------------------------- -// -TInt64 CCmDmSQLiteConnection::QueryMediaServerId( const TDesC8& aUDN ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryMediaServerId()")); - - iStatement.BindBinary( 0, aUDN ); - // Loop only one row in results - TInt err( KErrNotFound ); - if ( KSqlAtRow == iStatement.Next() ) - { - // Get cell contents - err = iStatement.ColumnInt64( 0 ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryMediaServerUdn -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryMediaServerUdn( HBufC8*& aUdn, - const TInt32 aId ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryMediaServerId()")); - - iStatement.BindInt64( 0, aId ); - // Loop only one row in results - TInt err( iStatement.Next() ); - if ( err == KSqlAtRow ) - { - // Get cell contents - TPtrC8 temp; - iStatement.ColumnBinary( 0, temp ); - aUdn = temp.Alloc(); - err = KErrNone; - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryAllMediaServersL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryAllMediaServersL( - CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryAllMediaServersL()")); - - // Loop only one row in results - TInt err( KErrNotFound ); - if ( KSqlAtRow == iStatement.Next() ) - { - TPtrC8 temp; - // Get cell contents - iStatement.ColumnBinary( 0, temp ); - aMediaServer->SetUDNL(temp); - iStatement.ColumnBinary( 1, temp ); - aMediaServer->SetMediaServerNameL( temp ); - aMediaServer->SetSystemUpdateID( - iStatement.ColumnInt( 2 ) ); - aMediaServer->SetVisibleDate( - iStatement.ColumnInt64( 3 ) ); - aMediaServer->SetIsActive( - iStatement.ColumnInt( 4 ) ); - aMediaServer->SetDbId( - iStatement.ColumnInt( 5 ) ); - aMediaServer->SetCopyCapability( (TBool)iStatement.ColumnInt( 6 ) ); - aMediaServer->SetFillUsage( iStatement.ColumnInt( 7 ) ); - aMediaServer->SetStoreUsage( iStatement.ColumnInt( 8 ) ); - err = KErrNone; - } - if( KErrNotFound == err ) - { - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetMediaServersL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::GetMediaServersL( - RPointerArray& aMediaServers ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetMediaServersL()")); - - iStatement.PrepareL( iDatabase, KSelectAllMediaServers ); - // Loop only one row in results - while ( KSqlAtRow == iStatement.Next() ) - { - CCmMediaServerFull* server = CCmMediaServerFull::NewLC(); - TPtrC8 temp; - // Get cell contents - iStatement.ColumnBinary( 0, temp ); - server->SetUDNL(temp); - iStatement.ColumnBinary( 1, temp ); - server->SetMediaServerNameL( temp ); - server->SetSystemUpdateID( - iStatement.ColumnInt( 2 ) ); - server->SetVisibleDate( - iStatement.ColumnInt64( 3 ) ); - server->SetIsActive( - iStatement.ColumnInt( 4 ) ); - server->SetDbId( - iStatement.ColumnInt( 5 ) ); - server->SetCopyCapability( - iStatement.ColumnInt( 6 ) ); - server->SetFillUsage( iStatement.ColumnInt( 7 ) ); - server->SetStoreUsage( iStatement.ColumnInt( 8 ) ); - - aMediaServers.AppendL( server ); // transfer ownership - CleanupStack::Pop( server ); - server = NULL; - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryHashValuesL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryHashValuesL( TInt aMediaServer, - RPointerArray& aHashValues ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryHashValuesL()")); - - iStatement.BindInt( 0, aMediaServer ); - // Loop only one row in results - TInt err( KErrNone ); - while( ( err = iStatement.Next( ) ) == KSqlAtRow ) - { - CCmSearchResponseHash* newHash = CCmSearchResponseHash::NewL(); - CleanupStack::PushL( newHash ); - // Get cell contents - newHash->SetStartIndex( iStatement.ColumnInt( 0 )); - newHash->SetItemCount( iStatement.ColumnInt( 1 )); - TPtrC8 temp; - iStatement.ColumnBinary( 2, temp ); - newHash->SetHashL( temp ); - aHashValues.AppendL( newHash ); - CleanupStack::Pop( newHash ); - - } - iStatement.Reset( ); - iStatement.Close( ); // Destruct statement - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetLowPriorityFilledFilesL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetLowPriorityFilledFilesL( TInt aDrive, - RPointerArray& aFilled ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - GetLowPriorityFilledFilesL()")); - - TPtrC temp; - TUint32 size( KErrNone ); - TInt64 listId( KErrNone ); - TInt64 fileId( KErrNone ); - iStatement.BindInt( 0, (TInt)ECmFilled ); - iStatement.BindInt( 1, (TInt)ECmFilled ); - iStatement.BindInt( 2, aDrive ); - TInt err( KErrNone ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - iStatement.ColumnText( 0, temp ); - size = iStatement.ColumnInt( 1 ); - listId = iStatement.ColumnInt( 2 ); - fileId = iStatement.ColumnInt64( 3 ); - if( temp.Length() ) - { - CCmFillListItem* filled = CCmFillListItem::NewLC(); - filled->SetPathL( temp ); - filled->SetSize( size ); - filled->SetListId( listId ); - filled->SetDbId( fileId ); - aFilled.AppendL( filled ); - CleanupStack::Pop( filled ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryFillFileListL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryFillFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryFillFileListL()")); - - iStatement.BindInt( 0, aStatus ); - iStatement.BindBinary( 1, aName ); - TPtrC temp; - TInt ret( KErrNone ); - while( iStatement.Next() == KSqlAtRow ) - { - CCmBaseListItem* item = CCmBaseListItem::NewLC(); - /** - Read rows into package - */ - iStatement.ColumnText( 0, temp ); - item->SetPrimaryTextL( temp ); - iStatement.ColumnText( 1, temp ); - item->SetSecondaryTextL( temp ); - iStatement.ColumnText( 2, temp ); - item->SetPathL( temp ); - item->SetSize( iStatement.ColumnInt64( 3 )); - item->SetStatus( - (TCmListItemStatus)iStatement.ColumnInt( 4 )); - item->SetDate( iStatement.ColumnInt64( 5 ) ); - item->SetDbId( iStatement.ColumnInt64( 6 ) ); - item->SetRefId( iStatement.ColumnInt64( 7 ) ); - aItems.Append( item ); - CleanupStack::Pop( item ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return ret; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetAllFillFilesL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetAllFillFilesL( - RPointerArray& aItems, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetAllFillFilesL()")); - - TInt ret(KErrNone); - TPtrC temp16; - TPtrC8 temp8; - iStatement.BindInt( 0, aStatus ); - while( iStatement.Next() == KSqlAtRow) - { - CCmFillListItem* item = CCmFillListItem::NewLC(); - /** - Read rows into package - */ - item->SetDbId( iStatement.ColumnInt64( 0 ) ); - iStatement.ColumnText( 1, temp16 ); - item->SetPrimaryTextL( temp16 ); - iStatement.ColumnText( 2, temp16 ); - if ( temp16.Length() != 0 ) - { - item->SetSecondaryTextL( temp16 ); - } - else - { - item->SetSecondaryTextL( KNullDesC() ); - } - - iStatement.ColumnText( 3, temp16 ); - if ( temp16.Length() != 0 ) - { - item->SetPathL( temp16 ); - } - else - { - item->SetPathL( KNullDesC() ); - } - iStatement.ColumnBinary( 4, temp8 ); - item->SetUriL( temp8 ); - iStatement.ColumnBinary( 5, temp8 ); - item->SetItemIdL( temp8 ); - iStatement.ColumnText( 6, temp16 ); - item->SetUpnpClassL( temp16 ); - item->SetMediaType( (TCmMediaType) - iStatement.ColumnInt( 7 ) ); - item->SetPriority( iStatement.ColumnInt( 8 ) ); - item->SetSize( iStatement.ColumnInt64( 9 ) ); - item->SetStatus( - (TCmListItemStatus)iStatement.ColumnInt( 10 ) ); - item->SetDate( iStatement.ColumnInt64( 11 ) ); - item->SetListId( iStatement.ColumnInt( 12 ) ); - item->SetDevId( iStatement.ColumnInt( 13 ) ); - item->SetRefId( iStatement.ColumnInt64( 14 ) ); - item->SetSelected( (TCmFillRuleStatus) - iStatement.ColumnInt( 15 ) ); - item->SetDriveId( iStatement.ColumnInt64( 16 ) ); - item->SetDriveNumber( iStatement.ColumnInt( 17 ) ); - aItems.Append( item ); - CleanupStack::Pop( item ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return ret; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryStoreFileListL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryStoreFileListL( - RPointerArray& aItems, - const TDesC8& aName, - TUint /*aStatus*/ ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoreFileListL()")); - - TInt ret(KErrNone); - TPtrC temp16; - iStatement.BindBinary( 0, aName ); - while( iStatement.Next() == KSqlAtRow ) - { - CCmBaseListItem* item = CCmBaseListItem::NewLC(); - /** - Read rows into package - */ - iStatement.ColumnText( 0, temp16 ); - item->SetPrimaryTextL( temp16 ); - iStatement.ColumnText( 1, temp16 ); - item->SetSecondaryTextL( temp16 ); - iStatement.ColumnText( 2, temp16 ); - item->SetPathL( temp16 ); - item->SetSize( iStatement.ColumnInt64( 3 ) ); - item->SetDate( iStatement.ColumnInt64( 4 ) ); - aItems.Append(item); // transfer ownership - CleanupStack::Pop( item ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return ret; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetAllStoreFilesL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetAllStoreFilesL( - RPointerArray& aItems, TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetAllStoreFilesL()")); - - TInt ret(KErrNone); - iStatement.BindInt( 0, aStatus ); - TPtrC temp16; - TUint status(KErrNone); - TUint8 devId(KErrNone); - while( iStatement.Next() == KSqlAtRow ) - { - CCmStoreListItem* item = CCmStoreListItem::NewL(); - CleanupStack::PushL( item ); - /** - Read rows into package - */ - iStatement.ColumnText( 0, temp16 ); - item->SetPrimaryTextL( temp16 ); - iStatement.ColumnText( 1, temp16 ); - item->SetSecondaryTextL( temp16 ); - iStatement.ColumnText( 2, temp16 ); - item->SetPathL( temp16 ); - item->SetSize( iStatement.ColumnInt64( 3 )); - status = iStatement.ColumnInt( 4 ); - item->SetListId( iStatement.ColumnInt( 5 ) ); - devId = iStatement.ColumnInt( 6 ); - item->SetDevId( devId, (TCmListItemStatus)status ); - aItems.AppendL( item ); // transfer ownership - CleanupStack::Pop( item ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return ret; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryAllFillFilesL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryAllFillFilesL( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryAllFillFilesL()")); - - TInt ret(KErrNone); - TPtrC temp16; - TPtrC8 temp8; - while( iStatement.Next() == KSqlAtRow ) - { - CCmFillListItem* item = CCmFillListItem::NewL(); - CleanupStack::PushL( item ); - /** - Read rows into package - */ - item->SetDbId( iStatement.ColumnInt64( 0 ) ); - iStatement.ColumnText( 1, temp16 ); - item->SetPrimaryTextL( temp16 ); - iStatement.ColumnText( 2, temp16 ); - item->SetSecondaryTextL( temp16 ); - iStatement.ColumnText( 3, temp16 ); - item->SetPathL( temp16 ); - iStatement.ColumnBinary( 4, temp8 ); - item->SetUriL( temp8 ); - iStatement.ColumnBinary( 5, temp8 ); - item->SetItemIdL( temp8 ); - iStatement.ColumnText( 6, temp16 ); - item->SetUpnpClassL( temp16 ); - item->SetMediaType( (TCmMediaType) - iStatement.ColumnInt( 7 ) ); - item->SetPriority( iStatement.ColumnInt( 8 ) ); - item->SetSize( iStatement.ColumnInt64( 9 )); - item->SetStatus( - (TCmListItemStatus)iStatement.ColumnInt( 10 )); - item->SetDate( iStatement.ColumnInt64( 11 ) ); - item->SetListId( iStatement.ColumnInt( 12 ) ); - item->SetDevId( iStatement.ColumnInt( 13 ) ); - item->SetRefId( iStatement.ColumnInt64( 14 ) ); - item->SetSelected( ( TCmFillRuleStatus ) - iStatement.ColumnInt( 15 )); - item->SetDriveId( iStatement.ColumnInt64( 16 ) ); - item->SetDriveNumber( iStatement.ColumnInt( 17 ) ); - aItems.AppendL( item ); // transfer ownership - CleanupStack::Pop( item ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return ret; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryAllStoreFilesL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::QueryAllStoreFilesL( - RPointerArray& aItems ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryAllStoreFilesL()")); - - TInt ret(KErrNone); - TPtrC temp16; - TBool found( EFalse ); - TInt foundIndex( KErrNone ); - while( iStatement.Next() == KSqlAtRow ) - { - CCmStoreListItem* item = CCmStoreListItem::NewL(); - CleanupStack::PushL( item ); - /** - Read rows into package - */ - item->SetDbId( iStatement.ColumnInt64( 0 ) ); - iStatement.ColumnText( 1, temp16 ); - item->SetPrimaryTextL( temp16 ); - iStatement.ColumnText( 2, temp16 ); - item->SetSecondaryTextL( temp16 ); - iStatement.ColumnText( 3, temp16 ); - item->SetPathL( temp16 ); - item->SetSize( iStatement.ColumnInt64( 4 ) ); - TCmListItemStatus status = - (TCmListItemStatus)iStatement.ColumnInt( 5 ); - - item->SetListId( iStatement.ColumnInt( 6 ) ); - TInt devId = iStatement.ColumnInt( 7 ); - item->SetDevId( devId, status ); - for( TInt i = 0; i < aItems.Count() && !found ; i++ ) - { - if( aItems[i]->DbId() == item->DbId() ) - { - found = ETrue; - foundIndex = i; - } - } - if( !found ) - { - aItems.AppendL( item ); // transfer ownership - CleanupStack::Pop( item ); - } - else - { - aItems[foundIndex]->SetDevId( devId, status ); - CleanupStack::PopAndDestroy( item ); // Destroy item - } - found = EFalse; - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return ret; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryStoredRowL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QueryStoredRowL( - RPointerArray& aFiles, - const TDesC8& aUDN, - TInt aAmount ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryStoredRowL()")); - - iStatement.BindBinary( 0, aUDN ); - TInt amount = aAmount; - // Loop only one row in results - while( KSqlAtRow == iStatement.Next() || amount == 0 ) - { - // Get cell contents - TPtrC temp; - iStatement.ColumnText( 0, temp ); - aFiles.Append( temp.AllocL() ); - if( amount != KErrNotFound ) - { - amount--; - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryTransferHistory -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QueryTransferHistory( - const TDesC8& aUdn, - TInt64& aDownloadData, - TInt64& aUploadData, - TInt64& aDownloadTime, - TInt64& aUploadTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryTransferHistory()")); - - iStatement.BindBinary( 0, aUdn ); - // Loop only one row - if( KSqlAtRow == iStatement.Next() ) - { - // Get cell contents - aDownloadData = iStatement.ColumnInt64( 0 ); - aUploadData = iStatement.ColumnInt64( 1 ); - aDownloadTime = iStatement.ColumnInt64( 2 ); - aUploadTime = iStatement.ColumnInt64( 3 ); - } - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryDeletedItemsListsL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QueryDeletedItemsListsL( - RPointerArray& aArray, TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - QueryDeletedItemsListsL()")); - - TPtrC temp16; - iStatement.BindInt( 0, aStatus ); - while( iStatement.Next() == KSqlAtRow ) - { - CCmBaseListItem* item = CCmBaseListItem::NewLC(); - /** - Read rows into package - */ - iStatement.ColumnText( 0, temp16 ); - item->SetPrimaryTextL( temp16 ); - iStatement.ColumnText( 1, temp16 ); - item->SetSecondaryTextL( temp16 ); - iStatement.ColumnText( 2, temp16 ); - item->SetPathL( temp16 ); - item->SetSize( iStatement.ColumnInt64( 3 ) ); - item->SetStatus( - (TCmListItemStatus)iStatement.ColumnInt( 4 ) ); - item->SetDate(iStatement.ColumnInt64( 5 ) ); - item->SetDbId( iStatement.ColumnInt64( 6 ) ); - aArray.Append( item ); - CleanupStack::Pop( item ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::QueryDrivesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::QueryDrivesL( - RPointerArray& aDrives ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::QueryDrivesL()")); - - TPtrC temp16; - while( iStatement.Next() == KSqlAtRow ) - { - CCmDriveInfo* drive = CCmDriveInfo::NewLC(); - /** - Read rows into package - */ - drive->SetDriveNumber( iStatement.ColumnInt( 0 ) ); - drive->SetDriveType( iStatement.ColumnInt( 1 ) ); - iStatement.ColumnText( 2, temp16 ); - if ( temp16.Length() != 0 ) - { - drive->SetDriveNameL( temp16 ); - } - else - { - drive->SetDriveNameL( KNullDesC() ); - } - drive->SetDriveSize( iStatement.ColumnInt64( 3 ) ); - drive->SetDriveQuota( iStatement.ColumnInt64( 4 ) ); - drive->SetUsedDriveQuota( iStatement.ColumnInt64( 5 ) ); - drive->SetDriveId( iStatement.ColumnInt64( 6 ) ); - drive->SetStatus( (TBool)iStatement.ColumnInt( 7 ) ); - aDrives.AppendL( drive ); - CleanupStack::Pop( drive ); - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetAvgImageShrinkTime -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetAvgImageShrinkTime() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetAvgImageShrinkTime()")); - - TInt err( iStatement.Prepare( iDatabase, KImageShrinkingInfo ) ); - TInt64 count( KErrNone ); - TInt64 time( KErrNone ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - KImageShrinkingInfo illegal err = %d"), err )); - } - else - { - // Loop only one row - err = iStatement.Next(); - if( err == KSqlAtRow ) - { - // Get cell contents - count = iStatement.ColumnInt64( 0 ); - time = iStatement.ColumnInt64( 1 ); - } - } - - iStatement.Reset(); - iStatement.Close(); - if( count != KErrNone ) - { - return TInt(time/count); - } - else - { - return KErrNone; - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetFillListNameL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::GetFillListNameL( HBufC8*& aListName, - const TInt64 aListId ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetFillListNameL()")); - - TInt err( iStatement.Prepare( iDatabase, KSelectFillRuleName ) ); - if( err ) - { - User::Leave( err ); - } - else - { - iStatement.BindInt64( 0, aListId ); - // Loop only one row - err = iStatement.Next(); - if( err == KSqlAtRow ) - { - TPtrC8 temp; - iStatement.ColumnBinary( 0, temp ); - aListName = temp.Alloc(); - } - } - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteMediaServer -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteMediaServer( const TDesC8& aUDN ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteMediaServer()")); - - TInt err( iStatement.Prepare( iDatabase, KRemoveMediaServersByUDN ) ); - if( !err ) - { - iStatement.BindBinary( 0, aUDN ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - - // In error cases for return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteFillRuleByName -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteFillRuleByName( const TDesC8& aName ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteFillRuleByName()")); - - // Remove ruleparams - TInt err( iStatement.Prepare( iDatabase, KRemoveRuleParamsByRuleID) ); - if( !err ) - { - iStatement.BindBinary( 0, aName ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - // Remove rules - err = iStatement.Prepare( iDatabase, KRemoveRuleByRuleGroupID); - iStatement.BindBinary( 0, aName ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - // Remove Mediaservers from the mapping table - err = iStatement.Prepare( iDatabase, KRemoveRuleGroupServers); - iStatement.BindBinary( 0, aName ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - // Remove FillRules - err = iStatement.Prepare( iDatabase, KRemoveFillRuleByName ); - iStatement.BindBinary( 0, aName ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - - // In error cases for return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteAllFillRules -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteAllFillRules() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteAllFillRules()")); - - // Remove ruleparams - TInt err( iStatement.Prepare( iDatabase, KRemoveRuleParamAll ) ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - // Remove rules - err = iStatement.Prepare( iDatabase, KRemoveRuleAll ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - // Remove Mediaservers from the mapping table - err = iStatement.Prepare( iDatabase, KRemoveRuleGroupServerAll); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - // Remove FillRules - err = iStatement.Prepare( iDatabase, KRemoveFillRuleAll ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - } - iRuleGroupID = 1; - iRuleID = 1; - iRuleParamID = 1; - } - - // In error cases for return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteAllStoreRules -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteAllStoreRules() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteAllStoreRules()")); - - // Remove ruleparams - TInt err = iStatement.Prepare( iDatabase, KRemoveStoreRuleServers ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - - // Remove rules - err = iStatement.Prepare( iDatabase, KRemoveStoreRuleParams ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - // Remove Mediaservers from the mapping table - err = iStatement.Prepare( iDatabase, KRemoveStoreRules ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - else - { - err = KErrGeneral; - } - } - else - { - err = KErrGeneral; - } - } - - iStoreRuleID = 1; - iStoreRuleParamID = 1; - - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteFillFiles -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteFillFiles() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteFillFiles()")); - - return iDatabase.Exec( KRemoveFillFiles ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteStoreFiles -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteStoreFiles() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteStoreFiles()")); - - iDatabase.Exec( KRemoveStoreFiles ); - TInt err = iDatabase.Exec( KRemoveStoreFileServers ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteDeletedItemsL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::DeleteDeletedItemsL() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteDeletedItemsL()")); - - TInt err( iStatement.Prepare( iDatabase, KRemoveDeletedFillFiles ) ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - else - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteDeletedMediaServersL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::DeleteDeletedMediaServersL() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - DeleteDeletedMediaServersL()")); - - TInt err( iStatement.Prepare( iDatabase, KRemoveDeletedMediaServers ) ); - if( !err ) - { - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - else - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteHashValuesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::DeleteHashValuesL( const TInt aMediaserverId, - const TInt aSearchIndex ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteHashValuesL()")); - - TInt err( iStatement.Prepare( iDatabase, KRemoveHash ) ); - if( !err ) - { - iStatement.BindInt( 0, aMediaserverId ); - iStatement.BindInt( 1, aSearchIndex ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - else - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateMediaServerInfo -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateMediaServerInfo( - CCmMediaServerFull* aMediaServer ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateMediaServerInfo()")); - - // Remove ruleparams - TInt err( iStatement.Prepare( iDatabase, KUpdateMediaServerInfo ) ); - if( !err ) - { - iStatement.BindBinary( 0, aMediaServer->MediaServerName() ); - iStatement.BindInt( 1, aMediaServer->SystemUpdateID() ); - iStatement.BindInt64( 2, aMediaServer->VisibleDate().Int64() ); - iStatement.BindBinary( 3, aMediaServer->MediaServer() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - - // In error cases for return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateFillRuleSelected -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateFillRuleSelected( - const TDesC8& aName, - TInt aSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateFillRuleSelected()")); - - // Update Fill Rule - TInt err( iStatement.Prepare( iDatabase, KUpdateFillRuleSelected ) ); - if( !err ) - { - iStatement.BindInt( 0, aSelected ); - iStatement.BindBinary( 1, aName ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - - // In error cases for return value to KErrGeneral - return ( err ? KErrGeneral : KErrNone ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateFillRuleGroupInfo -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateFillRuleGroupInfo() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - UpdateFillRuleGroupInfo()")); - - TInt err = iDatabase.Exec( KSetNullRealSizes ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateDownloadHistory -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateDownloadHistory( TUint aMediaServerId, - TInt64& aDownloadData, TInt64& aDownloadTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateDownloadHistory()")); - - TInt err( iStatement.Prepare( iDatabase, KUpdateDownloadHistory ) ); - if( !err ) - { - iStatement.BindInt64( 0, aDownloadData ); - iStatement.BindInt64( 1, aDownloadTime ); - iStatement.BindInt( 2, aMediaServerId ); - err = iStatement.Exec(); - iStatement.Reset( ); - iStatement.Close(); - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateUploadHistory -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateUploadHistory( TUint aMediaServerId, - TInt64& aUploadData, TInt64& aUploadTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateUploadHistory()")); - - TInt err( iStatement.Prepare( iDatabase, KUpdateUploadHistory ) ); - if( !err ) - { - iStatement.BindInt64( 0, aUploadData ); - iStatement.BindInt64( 1, aUploadTime ); - iStatement.BindInt( 2, aMediaServerId ); - err = iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateStatusValues -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateStatusValues( - RPointerArray& aStatusValues ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateStatusValues()")); - - TInt err( KErrNone ); - iDatabase.Exec( KCmDbBeginTransaction ); - err = iStatement.Prepare( iDatabase, KUpdateFileStatus ); - if( !err ) - { - for( TInt i = 0; i < aStatusValues.Count(); i++ ) - { - iStatement.BindInt64( 0, aStatusValues[i]->Status() ); - iStatement.BindInt64( 1, aStatusValues[i]->DbId() ); - iStatement.BindInt64( 2, aStatusValues[i]->DbId() ); - iStatement.Exec(); - iStatement.Reset(); - } - } - iStatement.Close(); - iDatabase.Exec( KCmDbSqlCommit ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateFillListDriveStatusesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::UpdateFillListDriveStatusesL( - CCmDriveInfo* aOrigDrive, CCmDriveInfo* aNewDrive, - TBool aDriveSelected ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - UpdateFillListDriveStatusesL()")); - - if( aDriveSelected ) - { - // Update only drive number and drive id - TInt err( iStatement.Prepare( iDatabase, KUpdateFillDriveInfo ) ); - User::LeaveIfError( err ); - iStatement.BindInt( 0, aNewDrive->DriveNumber() ); - iStatement.BindInt64( 1, aNewDrive->DriveId() ); - iStatement.BindInt64( 2, aOrigDrive->DriveId() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - else - { - // Set path, drive number, drive id, quota, size to null and - // update fill status to orginal - TInt err( iStatement.Prepare( iDatabase, - KUpdateFillDriveAndStatusInfo ) ); - User::LeaveIfError( err ); - iStatement.BindText( 0, KNullDesC() ); - iStatement.BindInt( 1, 0 ); - iStatement.BindInt64( 2, 0 ); - iStatement.BindInt( 3, (TInt)ECmToBeFilled ); - iStatement.BindInt64( 4, aOrigDrive->DriveId() ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateFillListItemPriority -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateFillListItemPriority( - CCmFillRuleContainer* aContainer ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - UpdateFillListItemPriority()")); - - iDatabase.Exec( KCmDbBeginTransaction ); - TInt err( iStatement.Prepare( iDatabase, KUpdateFillItemPriorities ) ); - if ( !err ) - { - for( TInt i = 0; i < aContainer->FillRuleCount(); i++ ) - { - iStatement.BindInt( 0, aContainer->FillRule( i )->Priority() ); - iStatement.BindInt( 1, aContainer->FillRule( i )->Selected() ); - iStatement.BindBinary( 2, aContainer->FillRule( i )->Name() ); - iStatement.Exec(); - iStatement.Reset(); - } - } - iStatement.Close(); - iDatabase.Exec( KCmDbSqlCommit ); - - //update fill item's status - iDatabase.Exec( KCmDbBeginTransaction ); - TInt err1( iStatement.Prepare( - iDatabase, KUpdateFillItemStatusByRuleName ) ); - if ( !err1 ) - { - for( TInt i = 0; i < aContainer->FillRuleCount(); i++ ) - { - iStatement.BindInt( 0, aContainer->FillRule( i )->Status() ); - iStatement.BindBinary( 1, aContainer->FillRule( i )->Name() ); - iStatement.Exec(); - iStatement.Reset(); - } - } - iStatement.Close(); - iDatabase.Exec( KCmDbSqlCommit ); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetFillListStateL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::SetFillListStateL( const TUint aListId, - TCmFillRuleStatus aState ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetFillListStateL()")); - - TInt err( iStatement.Prepare( iDatabase, KUpdateSelectionStatus ) ); - if( err ) - { - User::Leave( err ); - } - else - { - iStatement.BindInt( 0, aState ); - iStatement.BindInt( 1, aListId ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::RestoreFileStatusesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::RestoreFileStatusesL( - const RPointerArray& aItems, - const TDesC8& aListName ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::RestoreFileStatusesL()")); - - TInt err( iStatement.Prepare( iDatabase, KGetFillListStatus ) ); - TRACE( Print( _L("[DB MNGR]\t KGetFillListStatus err = %d "), - err ) ); - - TUint status( KErrNone ); - - if( err ) - { - User::Leave( err ); - } - else - { - iStatement.BindBinary( 0, aListName ); - err = iStatement.Next(); - if ( err == KSqlAtRow ) - { - status = iStatement.ColumnInt( 0 ); - } - } - TRACE( Print( _L("[DB MNGR]\t Status to be updated = %d "), - status ) ); - iStatement.Reset(); - iStatement.Close(); - DoRestoreFileStatusesL( aItems, status ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DoRestoreFileStatusesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::DoRestoreFileStatusesL( - const RPointerArray& aItems, - const TUint aStatus ) - { - - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DoRestoreFileStatusesL")); - - iDatabase.Exec( KCmDbBeginTransaction ); - TInt err( iStatement.Prepare( iDatabase, KRestoreFileStatus ) ); - - if( err ) - { - User::Leave( err ); - } - - for( TInt i = 0; i < aItems.Count(); i++ ) - { - iStatement.BindInt( 0, aStatus ); - iStatement.BindInt64( 1, aItems[i]->DbId() ); - iStatement.BindInt64( 2, aItems[i]->DbId() ); - iStatement.Exec(); - iStatement.Reset(); - } - - iStatement.Close(); - iDatabase.Exec( KCmDbSqlCommit ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetRefIdsToZero -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::SetRefIdsToZero() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::SetRefIdsToZero()")); - - iDatabase.Exec( KUpdateFillItemRef_Zero ); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::IncrementShrinkTimeL -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::IncrementShrinkTimeL( TInt aImageCount, - TInt aMilliSeconds ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::IncrementShrinkTimeL()")); - - TInt err( iStatement.Prepare( iDatabase, KIncrementImageShrinkingInfo ) ); - if( err ) - { - User::Leave( err ); - } - else - { - iStatement.BindInt64( 0, aImageCount ); - iStatement.BindInt64( 1, aMilliSeconds ); - err = iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::FillListSize -// --------------------------------------------------------------------------- -// -TInt64 CCmDmSQLiteConnection::FillListSize( const TDesC8& aListName, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::FillListSize()")); - - TInt err( iStatement.Prepare( iDatabase, KFillListSize ) ); - TInt64 size(KErrNone); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - FillListSize illegal err = %d"), err )); - } - else - { - iStatement.BindInt( 0, aStatus ); - iStatement.BindBinary( 1, aListName ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - size = iStatement.ColumnInt64( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return size; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::StoreListSize -// --------------------------------------------------------------------------- -// -TInt64 CCmDmSQLiteConnection::StoreListSize( - const TDesC8& aListName, - TUint /*aStatus*/ ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::StoreListSize()")); - - TInt err( iStatement.Prepare( iDatabase, KStoreListSize ) ); - TInt64 size(KErrNone); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - StoreListSize illegal err = %d"), err )); - } - else - { - iStatement.BindBinary( 0, aListName ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - size = iStatement.ColumnInt64( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return size; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::StoreFileCount -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::StoreFileCount( TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::StoreFileCount()")); - - TInt err( iStatement.Prepare( iDatabase, KStoreFileCount ) ); - TInt count(KErrNone); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - Illegal err = %d"), err )); - } - else - { - iStatement.BindInt( 0, aStatus ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - count = iStatement.ColumnInt( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return count; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::StoreFileCountNoDuplicates -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::StoreFileCountNoDuplicates() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - StoreFileCountNoDuplicates()")); - - TInt err( iStatement.Prepare( iDatabase, KStoreFileCountNoDuplicates ) ); - TInt count(KErrNone); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - Illegal err = %d"), err )); - } - else - { - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - count = iStatement.ColumnInt( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return count; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::FillFileCount -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::FillFileCount( TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::FillFileCount()")); - - TInt err( iStatement.Prepare( iDatabase, KFillFileCount ) ); - TInt count(KErrNone); - if( err ) - { - // Do nothing - } - else - { - iStatement.BindInt( 0, aStatus ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - count = iStatement.ColumnInt( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return count; - } - -// --------------------------------------------------------------------------- -// Returns size of the filled items -// --------------------------------------------------------------------------- -// -TInt64 CCmDmSQLiteConnection::BytesFilled( TUint aID ) - { - TInt err( iStatement.Prepare( iDatabase, KDataAmountFilled ) ); - TInt64 size(KErrNone); - if( err ) - { - return size; - } - else - { - iStatement.BindInt( 0, aID ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - size = iStatement.ColumnInt64( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return size; - } - -// --------------------------------------------------------------------------- -// -TInt64 CCmDmSQLiteConnection::KBytesToBeFilled( TUint8 aMediaServerId, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::KBytesToBeFilled()")); - - TInt err( iStatement.Prepare( iDatabase, KDataAmountToBeFilled ) ); - TInt64 size(KErrNone); - if( err ) - { - return size; - } - else - { - iStatement.BindInt( 0, aStatus ); - iStatement.BindInt( 1, aMediaServerId ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - size = iStatement.ColumnInt64( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return (size/1000); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::KBytesToBeStored -// --------------------------------------------------------------------------- -// -TInt64 CCmDmSQLiteConnection::KBytesToBeStored( TUint8 aMediaServerId, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::KBytesToBeStored()")); - - TInt err( iStatement.Prepare( iDatabase, KDataAmountToBeStored ) ); - TInt64 size(KErrNone); - if( !err ) - { - iStatement.BindInt( 0, aMediaServerId ); - iStatement.BindInt( 1, aStatus ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - size = iStatement.ColumnInt64( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return (size/1000); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateTransferInfo -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::UpdateTransferInfo( TCmService aService, - TInt aCount, TInt aTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::UpdateTransferInfo()")); - - TInt err( iStatement.Prepare( iDatabase, KInitTransferInfo ) ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - KInitTransferInfo illegal err = %d"), err )); - } - else - { - iStatement.BindInt( 0, aService ); - err = iStatement.Exec(); - } - iStatement.Reset(); - iStatement.Close(); - err = iStatement.Prepare( iDatabase, KUpdateTransferInfo ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - KUpdateTransferInfo illegal err = %d"), err )); - } - else - { - iStatement.BindInt( 0, aCount ); - iStatement.BindInt( 1, aTime ); - iStatement.BindInt( 2, aService ); - err = iStatement.Exec(); - } - iStatement.Reset(); - iStatement.Close(); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateStoreTransferStatus -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::UpdateStoreTransferStatus( TUint aStatus, - TInt64 aFid, TInt64 aMsId ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - UpdateStoreTransferStatus()")); - - TInt err( iStatement.Prepare( iDatabase, KUpdateStoreTransferStatus )); - if( err ) - { - - } - else - { - iStatement.BindInt( 0, aStatus ); - iStatement.BindInt64( 1, aFid ); - iStatement.BindInt64( 2, aMsId ); - err = iStatement.Exec(); - } - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::UpdateFillTransferStatus -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::UpdateFillTransferStatus( TUint aStatus, - CCmFillListItem* aItem ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - UpdateFillTransferStatus()")); - - TInt err( iStatement.Prepare( iDatabase, KUpdateFillTransferStatus )); - if( err ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - UpdateFillTransferStatus() error preparing statement")); - } - else - { - iStatement.BindInt( 0, aStatus ); - iStatement.BindText( 1, aItem->Path() ); - iStatement.BindInt64( 2, aItem->DriveId() ); - iStatement.BindInt( 3, aItem->DriveNumber() ); - iStatement.BindInt64( 4, aItem->DevId() ); - iStatement.BindInt64( 5, aItem->DbId() ); - iStatement.BindInt64( 6, aItem->ListId() ); - iStatement.BindInt64( 7, aItem->DbId() ); - err = iStatement.Exec(); - } - iStatement.Reset(); - iStatement.Close(); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetTransferInfo -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetTransferInfo( TCmService aService, - TInt& aCount, TInt& aTime ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetTransferInfo()")); - - TInt err( iStatement.Prepare( iDatabase, KTranferValues ) ); - aCount = 0; - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - KTranferValues illegal err = %d"), err )); - } - else - { - iStatement.BindInt( 0, aService ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - aCount = iStatement.ColumnInt( 0 ); - err = KErrNone; - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - err = iStatement.Prepare( iDatabase, KTranferTime ); - aTime = 0; - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - KTranferTime illegal err = %d"), err )); - } - else - { - iStatement.BindInt( 0, aService ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - aTime = iStatement.ColumnInt( 0 ); - err = KErrNone; - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetStoreFileCount -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetStoreFileCount( - const TDesC8& aListName, - TUint /*aStatus*/, - TInt& aCount ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetStoreFileCount()")); - - TInt err( iStatement.Prepare( iDatabase, KStoreListFileCount ) ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - GetStoreFileCount illegal err = %d"), err )); - } - else - { - iStatement.BindBinary( 0, aListName ); - - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - aCount = iStatement.ColumnInt( 0 ); - err = KErrNone; - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::GetFillFileCount -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::GetFillFileCount( - const TDesC8& aListName, - TUint aStatus, - TInt& aCount ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::GetFillFileCount()")); - - TInt err( iStatement.Prepare( iDatabase, KFillListFileCount ) ); - if( err ) - { - TRACE(Print(_L("[DATABASE MANAGER]\t \ - GetFillFileCount illegal err = %d"), err )); - } - else - { - iStatement.BindInt( 0, aStatus ); - iStatement.BindBinary( 1, aListName ); - for ( err = iStatement.Next(); - err == KSqlAtRow; - err = iStatement.Next() ) - { - // Get cell contents - aCount = iStatement.ColumnInt64( 0 ); - err = KErrNone; - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - return err; - } - -// --------------------------------------------------------------------------- -// CmDmSQLiteConnection::GetStoreFileCountNoDuplicatesL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::GetStoreFileCountNoDuplicatesL( TInt& aCount, - TUint aStatus ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - GetStoreFileCountNoDuplicatesL()")); - - TInt err( iStatement.Prepare( iDatabase, - KGetStoreFileCountNoDuplicates )); - if( err ) - { - User::Leave( err ); - } - else - { - iStatement.BindInt( 0, aStatus ); - if( KSqlAtRow == iStatement.Next() ) - { - aCount = iStatement.ColumnInt( 0 ); - } - iStatement.Reset(); - iStatement.Close(); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::SetFillListRealCountAndSizeL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::SetFillListRealCountAndSizeL( TInt64 aListId, - TInt64 aRealCount, TInt64 aRealSize ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - SetFillListRealCountAndSizeL()")); - - // Update Fill Rule - TInt err = iStatement.Prepare( iDatabase, - KUpdateFillRuleRealInformation ); - if( !err ) - { - iStatement.BindInt64( 0, aRealCount ); - iStatement.BindInt64( 1, aRealSize ); - iStatement.BindInt64( 2, aListId ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - } - else - { - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteInActiveRuleServers -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteInActiveRuleServers() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - DeleteInActiveRuleServers()")); - - TInt err( KErrNone ); - err = iDatabase.Exec( KRemoveInActiveFillRuleServers ); - if( err >= KErrNone ) - { - err = iDatabase.Exec( KRemoveInActiveStoreRuleServers ); - } - if( err >= KErrNone ) - { - err = KErrNone; - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteInActiveFiles -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteInActiveFiles() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::DeleteInActiveFiles()")); - - TInt err( KErrNone ); - iDatabase.Exec( KRemoveInActiveFillFiles ); - iDatabase.Exec( KRemoveInActiveStoreFilesServers ); - err = iDatabase.Exec( KRemoveInActiveStoreFiles ); - if( err >= KErrNone ) - { - err = KErrNone; - } - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::DeleteItemsByFillListId -// --------------------------------------------------------------------------- -// -TInt CCmDmSQLiteConnection::DeleteItemsByFillListId( TInt aFillListId ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::\ - DeleteItemsByFillListId()")); - - TInt err( KErrNone ); - err = iStatement.Prepare( iDatabase, KRemoveFillListItems ); - iStatement.BindInt( 0, aFillListId ); - iStatement.Exec(); - iStatement.Reset(); - iStatement.Close(); - return err; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::RuleId -// --------------------------------------------------------------------------- -// -TInt64 CCmDmSQLiteConnection::RuleId( - const TDesC8& aName, - TCmRuleType aType ) - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::RuleId()")); - - TInt64 ret( KErrNone ); - // Fill rule id - if( ECmFmFillRule == aType ) - { - ret = iStatement.Prepare( iDatabase, KSelectRuleGroupID ); - } - // Store rule id - else - { - ret = iStatement.Prepare( iDatabase, KSelectStoreRuleID ); - } - if( ret ) - { - ret = KErrGeneral; - } - else - { - iStatement.BindBinary( 0, aName ); - // Loop only one row in results - ret = iStatement.Next(); - if ( ret == KSqlAtRow ) - { - // Get cell contents - ret = iStatement.ColumnInt64( 0 ); - } - } - iStatement.Reset(); - iStatement.Close(); // Destruct statement - TRACE(Print(_L("[DATABASE MANAGER]\t CCmDmSQLiteConnection::RuleId()\ - end"))); - return ret; - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::CCmDmSQLiteConnection -// --------------------------------------------------------------------------- -// -CCmDmSQLiteConnection::CCmDmSQLiteConnection() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::CCmDmSQLiteConnection()")); - } - -// --------------------------------------------------------------------------- -// CCmDmSQLiteConnection::ConstructL -// --------------------------------------------------------------------------- -// -void CCmDmSQLiteConnection::ConstructL() - { - LOG( _L( "[DB MNGR]\t CCmDmSQLiteConnection::ConstructL()")); - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/group/bld.inf --- a/upnpharvester/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2005 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 information file for CM Metadata Harvester -* -*/ - -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES - -#include "../common/cmlibrary/group/bld.inf" -#include "../common/cmsettings/group/bld.inf" -#include "../common/dbmanager/group/bld.inf" -#include "../common/cmsqlwrapper/group/bld.inf" -#include "../cdssync/common/bld.inf" -#include "../mdhserver/group/bld.inf" - -// CM Metadata Harvester ROM -#include "../rom/bld.inf" - -PRJ_TESTMMPFILES - -PRJ_TESTEXPORTS - -// None - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/10281fab.cre Binary file upnpharvester/install/10281fab.cre has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/cenrep.SIS Binary file upnpharvester/install/cenrep.SIS has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/cenrep.pkg --- a/upnpharvester/install/cenrep.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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: cenrep -; -&EN - -; Header -#{ "Upnp Harvester CenRep file"}, (0x10202BE9), 1, 0, 0, TYPE=SP - -; Supports Series 60 v3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Localised vendor name -%{"Nokia-EN"} -; Unique vendor name -:"Nokia" - -"\epoc32\release\armv5\urel\z\private\10202be9\10281fab.cre"-"!:\private\10202be9\persists\10281fab.cre" \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/cenrep.sisx Binary file upnpharvester/install/cenrep.sisx has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/make_upnpharvester_sis.bat --- a/upnpharvester/install/make_upnpharvester_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: Makes upnpharvester sisx -rem - -makesis cenrep.pkg -signsis cenrep.sis cenrep.sisx rd.cer rd-key.pem - -makesis upnpharvester.pkg -signsis upnpharvester.sis upnpharvester.sisx rd.cer rd-key.pem -del ..\sis\upnpharvester.sis /F -del ..\sis\upnpharvester.sisx /F -move .\upnpharvester.sis ..\sis -move .\upnpharvester.sisx ..\sis diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/make_upnpharvester_stub_sis.bat --- a/upnpharvester/install/make_upnpharvester_stub_sis.bat Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: upnpharvester stub sis -rem - -del upnpharvester_stub.sis /F -makesis -s upnpharvester_stub.pkg diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/upnpharvester.pkg --- a/upnpharvester/install/upnpharvester.pkg Mon Nov 01 13:44:24 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: mediaservant pkg -; -&EN - -; standard SIS file header -#{"Upnp Harvester"},(0x20022D5C),1,1,0, TYPE=SA, RU - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - - -; Files to copy -"\epoc32\release\armv5\urel\cmsqlwrapper.dll"-"!:\sys\bin\cmsqlwrapper.dll" -"\epoc32\release\armv5\urel\cmcommon.dll"-"!:\sys\bin\cmcommon.dll" -"\epoc32\release\armv5\urel\cmdatabasemanager.dll"-"!:\sys\bin\cmdatabasemanager.dll" -"\epoc32\release\armv5\urel\cmmdhclient.dll"-"!:\sys\bin\cmmdhclient.dll" -"\epoc32\release\armv5\urel\cmmdh.exe"-"!:\sys\bin\cmmdh.exe" -"\epoc32\release\armv5\urel\cmsettingsengine.dll"-"!:\sys\bin\cmsettingsengine.dll" -"\epoc32\release\armv5\urel\cdssync.dll"-"!:\sys\bin\cdssync.dll" - -; central repository -;@"cenrep.sisx", (0x10202BE9) - -; End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/upnpharvester_stub.SIS Binary file upnpharvester/install/upnpharvester_stub.SIS has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/install/upnpharvester_stub.pkg --- a/upnpharvester/install/upnpharvester_stub.pkg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +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: upnpharvester_stub -; -&EN - -; standard SIS file header -#{"Upnp Harvester"},(0x20022D5C),1,1,0, TYPE=SA - -;Localized Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -;[0x101F7961], 0, 0, 0, {"S60ProductID"} - -""-"z:\sys\bin\cmsqlwrapper.dll" -""-"z:\sys\bin\cmcommon.dll" -""-"z:\sys\bin\cmdatabasemanager.dll" -""-"z:\sys\bin\cmmdhclient.dll" -""-"z:\sys\bin\cmmdh.exe" -""-"z:\sys\bin\cmsettingsengine.dll" -""-"z:\sys\bin\cdssync.dll" - -""-"z:\private\10202be9\10281FAB.txt" - -""-"z:\system\data\MediaServant\CM_Database.sq" -""-"z:\system\data\MediaServant\cmmetadatacache.sq" diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/bwins/cmmdhclientu.def --- a/upnpharvester/mdhserver/bwins/cmmdhclientu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - ?NewCmMdhClientL@CCmMdhClientFactory@@SAPAVMCmMdhClient@@AAVMCmServiceObserver@@@Z @ 1 NONAME ; class MCmMdhClient * CCmMdhClientFactory::NewCmMdhClientL(class MCmServiceObserver &) - ?NewCmMdhClientLC@CCmMdhClientFactory@@SAPAVMCmMdhClient@@AAVMCmServiceObserver@@@Z @ 2 NONAME ; class MCmMdhClient * CCmMdhClientFactory::NewCmMdhClientLC(class MCmServiceObserver &) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/eabi/cmmdhclientu.def --- a/upnpharvester/mdhserver/eabi/cmmdhclientu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - _ZN19CCmMdhClientFactory15NewCmMdhClientLER18MCmServiceObserver @ 1 NONAME - _ZN19CCmMdhClientFactory16NewCmMdhClientLCER18MCmServiceObserver @ 2 NONAME - _ZTI12CCmMdhClient @ 3 NONAME ; ## - _ZTV12CCmMdhClient @ 4 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/group/bld.inf --- a/upnpharvester/mdhserver/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2005 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 information file for CM Metadata Harvester -* -*/ - - - - - - - -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS -// ADO internal interface -../inc/client/mdhclientsession.h |../../../inc/mdhclientsession.h -../inc/client/mdhclientfactory.h |../../../inc/mdhclientfactory.h -../inc/client/mmdhclient.h |../../../inc/mmdhclient.h - -PRJ_MMPFILES - -mdhclient.mmp -mdhserver.mmp - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/group/mdhclient.mmp --- a/upnpharvester/mdhserver/group/mdhclient.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +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 specification file for CM Metadata Harvester client -* -*/ - - - - - - -#include -#include "../inc/mdhuids.hrh" - -TARGET cmmdhclient.dll -TARGETTYPE dll -UID 0x1000008D KCmMdhClientUid - -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../src/client -SOURCE mdhclientsession.cpp -SOURCE mdhclient.cpp -SOURCE mdhclientfactory.cpp - -USERINCLUDE ../inc/client -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY efsrv.lib - -DEBUGLIBRARY flogger.lib - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/group/mdhserver.mmp --- a/upnpharvester/mdhserver/group/mdhserver.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +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 file -* -*/ - - - - - - -#include -#include "../inc/mdhuids.hrh" - -TARGET cmmdh.exe - -TARGETTYPE exe - -TARGETPATH /system/programs -UID 0x1000008d KCmMdhServerUid - -CAPABILITY CAP_SERVER -VENDORID VID_DEFAULT - -// Minimum heap size 2MB, maximum heap size 8MB, stack size 32kB -EPOCHEAPSIZE 4096 16388608 -EPOCSTACKSIZE 65536 - - -SOURCEPATH ../src/server -SOURCE mdhservermain.cpp -SOURCE mdhserver.cpp -SOURCE mdhserversession.cpp -SOURCE mdhavcpadapter.cpp -SOURCE mdhmediaservercontainer.cpp -SOURCE mdhmetadatacollector.cpp -SOURCE mdhconnectionmonitor.cpp - - -USERINCLUDE ../inc -USERINCLUDE ../../../inc -USERINCLUDE ../inc/server -USERINCLUDE ../../cdssync/cdssynclib/inc - -MW_LAYER_SYSTEMINCLUDE - -// UPnP stack -LIBRARY AVControlFramework.lib -LIBRARY upnpserviceframework.lib -LIBRARY upnpipserversutils.lib - -LIBRARY cdssync.lib -LIBRARY cmdatabasemanager.lib -LIBRARY cmcommon.lib -LIBRARY cmsettingsengine.lib - - -// Central Repository -LIBRARY centralrepository.lib - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY connmon.lib -LIBRARY hash.lib -DEBUGLIBRARY flogger.lib - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/client/mdhclient.h --- a/upnpharvester/mdhserver/inc/client/mdhclient.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server's client header -* -*/ - - - - - - - -#ifndef CMMDHCLIENT_H -#define CMMDHCLIENT_H - -// INCLUDES -#include -#include "mdhclientsession.h" -#include "mmdhclient.h" - -// FORWARD DECLARATION -class RCmMdhSession; -class MCmServiceObserver; - -// CLASS DECLARATION -/** -* Metadata Harvester client -* -* @lib cmmdhclient.lib -* @since S60 3.1 -*/ -class CCmMdhClient : public CActive, - public MCmMdhClient - { - public: - - enum TCmMdhClientState - { - ECmMdhClientIdle = 0, - ECmMdhClientSearching, - ECmMdhClientHarvesting - }; - - public: - - /** - * Two-phased constructor. - */ - static CCmMdhClient* NewL( MCmServiceObserver& aServer ); - - /** - * Two-phased constructor. - */ - static CCmMdhClient* NewLC( MCmServiceObserver& aServer ); - - /** - * Destructor - */ - virtual ~CCmMdhClient(); - - public: - - /** - * Starts harvesting - * @since S60 3.1 - * @return Error code - */ - TInt Harvest(); - - /** - * Cancels request - * @since S60 3.1 - * @return Error code - */ - void Stop(); - - /** - * Deletes the object - * @since S60 3.1 - */ - void Close(); - - private: - - /** - * From CActive - * Callback function. - * Invoked to handle responses from the server. - */ - void RunL(); - - /** - * From CActive - * Cancels any outstanding operation. - */ - void DoCancel(); - - private: - - /** - * Default constructor - */ - CCmMdhClient( MCmServiceObserver& aServer ); - - /** - * ConstructL - */ - void ConstructL( ); - - private: - - /** Instance of mdh session */ - RCmMdhSession iMdhSession; - - /** Observer */ - MCmServiceObserver& iServer; - - /** State of the client */ - TCmMdhClientState iState; - }; - -#endif // CMMDHCLIENT_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/client/mdhclientfactory.h --- a/upnpharvester/mdhserver/inc/client/mdhclientfactory.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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: Abstract factory for MdhClient -* -*/ - - - - - - - -#ifndef C_CMMDHCLIENTFACTORY_H -#define C_CMMDHCLIENTFACTORY_H - -#include -#include - -/* Forward declarations. */ -class MCmMdhClient; -class MCmServiceObserver; - -/** - * Abstract factory for MdhClient - * - * @lib cmmdhclient.lib - * @since S60 v3.1 - */ -class CCmMdhClientFactory : public CBase - { - -public: - - /** - * Creates a new instance of CSMdhClient - * @return pointer to CCmMdhClientEngine class - */ - IMPORT_C static MCmMdhClient* NewCmMdhClientL( MCmServiceObserver& aServer ); - - /** - * Creates a new instance of CSMdhClient. Instance is left in - * cleanup stack. - * @return pointer to CCmMdhClientEngine class - */ - IMPORT_C static MCmMdhClient* NewCmMdhClientLC( MCmServiceObserver& aServer ); - - }; - -#endif // C_CMMDHCLIENTFACTORY_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/client/mdhclientsession.h --- a/upnpharvester/mdhserver/inc/client/mdhclientsession.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server's client header -* -*/ - - - - - - - -#ifndef CMMDHCLIENTSESSION_H -#define CMMDHCLIENTSESSION_H - -// INCLUDES -#include - -// DATA TYPES - -// CLASS DECLARATION - -/** -* Metadata Harvester session -* -* @lib cmmdhclient.lib -* @since S60 3.1 -*/ -class RCmMdhSession : public RSessionBase - { - public: // Constructors and destructor - - /** - * Session constructor. - */ - RCmMdhSession(); - - - public: // New functions - - /** - * Make the client-server connection with Metadata Harvester. - * @since S60 3.1 - * @param None - * @return Status code depending on the success. - */ - TInt Connect(); - - /** - * Cancel ongoing search or harvest operation - * @since S60 3.1 - * @param None - * @return void - */ - void Cancel(); - - /** - * Search for media neighbourhood servers - * @since S60 3.1 - * @param aStatus asynchronous request status - * @return void - */ - void SearchMediaservers( TRequestStatus& aStatus ); - - - /** - * Harvest and synchronize metadata - * @since S60 3.1 - * @param aStatus, asynchronous request status - * @return void - */ - void Harvest( TRequestStatus& aStatus ); - - }; - - -#endif // CMMDHCLIENTSESSION_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/client/mmdhclient.h --- a/upnpharvester/mdhserver/inc/client/mmdhclient.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server's client header -* -*/ - - - - - - -#ifndef MCMMDHCLIENT_H -#define MCMMDHCLIENT_H - -// INCLUDES - -// FORWARD DECLARATION - -// CLASS DECLARATION -/** -* Metadata Harvester client -* -* @lib mcmmdhclient.lib -* @since S60 3.1 -*/ -class MCmMdhClient - { - public: - - /** - * Starts harvesting - * @since S60 3.1 - * @return Error code - */ - virtual TInt Harvest() = 0; - - /** - * Cancels request - * @since S60 3.1 - */ - virtual void Stop() = 0; - - /** - * Deletes the object - * @since S60 3.1 - */ - virtual void Close() = 0; - - }; - -#endif // MCMMDHCLIENT_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/mdhcommon.h --- a/upnpharvester/mdhserver/inc/mdhcommon.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2005 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: Common Client/Server header for CM Metadata Harvester -* -*/ - - - - - - -#ifndef CMMDHCOMMON_H -#define CMMDHCOMMON_H - -_LIT(KCmMdhServerExe,"cmmdh.exe"); /// -#include - -#include "mdhconnectionmonitorobserver.h" - -// CONSTANTS -// none - -// MACROS -// none - -// DATA TYPES -// none - -// FUNCTION PROTOTYPES -// none - -// FORWARD DECLARATIONS -// none - -// CLASS DECLARATION - -/** -* CMdHConnectionMonitor provides connection monitor for -* Metadata harvester. -* -* @lib mdhserver.exe -* @since S60 3.1 -*/ -class CMdHConnectionMonitor : public CBase, - public MConnectionMonitorObserver - { - -public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CMdHConnectionMonitor* NewL( - MMdHConnectionMonitorObserver& aObserver, TInt aAccessPoint ); - - /** - * Destructor. - */ - virtual ~CMdHConnectionMonitor(); - - -protected: // From MConnectionMonitorObserver - - /** - * Catches the Connection monitor events - * @since S60 3.1 - * @param aConnMonEvent event - * @return none - */ - void EventL( const CConnMonEventBase& aConnMonEvent ) ; - - -private: - - /** - * C++ default constructor. - */ - CMdHConnectionMonitor( MMdHConnectionMonitorObserver& aObserver, - TInt aAccessPoint ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - -private: // Data - - // Connection monitor server - RConnectionMonitor iConnectionMonitor; - - // Connection id - TInt iConnectionId; - - // Callback pointer - // not owned - MMdHConnectionMonitorObserver& iObserver; - - // Accesspoint to be observed - TInt iAccessPoint; - - }; - -#endif // C_MDHCONNECTIONMMONITOR_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/server/mdhconnectionmonitorobserver.h --- a/upnpharvester/mdhserver/inc/server/mdhconnectionmonitorobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2002-2007 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: MdH Connection monitor observer interface class declaration. -* -*/ - - - - - - -#ifndef M_MDHCONNECTIONMONITOROBSERVER_H -#define M_MDHCONNECTIONMONITOROBSERVER_H - -// INCLUDES -#include - -/** - * MMdHConnectionMonitorObserver is an interface for Connection Monitor. - * - * @lib mdhserver.exe - * @since S60 3.1 - */ -class MMdHConnectionMonitorObserver - { -public: - - /** - * This function will be called when WLan connection is lost for mdh - * - * @since S60 3.1 - */ - virtual void ConnectionLost() = 0; - }; - -#endif // M_MDHCONNECTIONMONITOROBSERVER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/server/mdhmediaservercontainer.h --- a/upnpharvester/mdhserver/inc/server/mdhmediaservercontainer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,466 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Metadata Harvester's media server container header -* -*/ - - - - - - - -#ifndef CMMDHMEDIASERVERCONTAINER_H -#define CMMDHMEDIASERVERCONTAINER_H - -// INCLUDES -#include -#include - -#include "mdhconnectionmonitorobserver.h" -#include "mdhavcpadapter.h" -#include "cmcommon.h" - -// CONSTANTS - -_LIT8( KRootContainerId, "0" ); - -_LIT8( KSearchCriteria, - "upnp:class derivedfrom "object.item" and @refID exists false"); - -_LIT8( KSearchFilter, "*" ); -_LIT8( KMdhSearchFilter, "dc:title,dc:date,upnp:class," - "upnp:album,upnp:artist,upnp:genre,res,upnp:albumArtURI," - "res@size,res@duration,@restricted,res@resolution," - "res@bitrate" ); - -_LIT8( KSortCriteria, "" ); - - -// FORWARD DECLARATIONS -class CMdHConnectionMonitor; -class CCmMdhMetadataCollector; -class CCmMdhServer; -class CCmDmMain; -class CCmSettingsEngine; -class CCmMediaServerFull; -class CCmSearchResponseHash; -class MCmSettings; - -// DATA TYPES - -enum TCmMdhMediaserverState - { - ECmMdhMediaserverSynchronized = 1, - ECmMdhMediaserverNotSynchronized, - ECmMdhMediaserverNoSearchCaps - }; - -// CLASS DECLARATION -/** -* CCmMdhMediaserverInfo -* Encapsulates server information -* -* @since S60 3.1 -*/ - -class CCmMdhMediaserverInfo : public CBase - { - public: - - /** - * Creates new CCmMdhMediaserverInfo class - * @return pointer to CCmSmItemInfo class - */ - static CCmMdhMediaserverInfo* NewL(); - - /** - * Creates new CCmMdhMediaserverInfo class - * @return pointer to CCmSmItemInfo class - */ - static CCmMdhMediaserverInfo* NewLC(); - - /** - * Destructor - */ - ~CCmMdhMediaserverInfo(); - - private: - - /** - * Default constructor - */ - CCmMdhMediaserverInfo(); - - /** - * ConstructL - */ - void ConstructL(); - - public: - - /** Media server identifier */ - HBufC8* iUuid; - - /** State of media server */ - TCmMdhMediaserverState iMediaserverState; - - /** media server's Systemupdate id */ - TInt iSystemUpdateId; - }; - - -// CLASS DECLARATION - -/** -* CCmMdhMediaserverContainer -* This is a class for metadata harvester server's -* media server container component -* -* @since S60 3.1 -*/ -class CCmMdhMediaserverContainer : public CCmMdhAvControlPointAdapter, - public MMdHConnectionMonitorObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CCmMdhMediaserverContainer* NewL( CCmMdhServer& aMdhServer ); - - /** - * Destructor. - */ - virtual ~CCmMdhMediaserverContainer(); - - public: // Functions from base classes - - /** - * Handles UPnP device discoveries. - * @param aDevice Device that is discovered. - */ - void DeviceDiscoveredL( CUpnpDevice* aDevice ); - - /** - * Handles UPnP device disappears. - * @param aDevice Device that disappeared. - */ - void DeviceDisappearedL( CUpnpDevice* aDevice ); - - /** - * Observer callback for Content Directory Search function. - * @since Series 60 2.0 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aContainerId - * @param aSearchCriteria - * @param aFilter - * @param aIndex - * @param arequest - * @param aSortCriteria - * @param aResult - * @param aReturned - * @param aMatches - * @param aUpdateID - */ - void CdsSearchResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aContainerId, - const TDesC8& aSearchCriteria, - const TDesC8& aFilter, - TInt aIndex, - TInt aRequest, - const TDesC8& aSortCriteria, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches, - const TDesC8& aUpdateID ); - - /** - * Observer callback for Content Directory - * GetSearchCapabilities function. - * @since Series 60 2.0 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aSearchCaps - */ - void CdsSearchCapabilitiesResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aSearchCaps ); - - /** - * Observer callback for Content Directory - * GetSystemUpdateID function. - * @since Series 60 2.0 - * @param aSessionId - * @param aErr UPnP error code. - * @param aSystemUpdateId - */ - void CdsSystemUpdateIdResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - TInt aSystemUpdateId ); - - - public: // From MUPnPConnectionMonitorObserver - - /** - * This function will be called when WLan connection is lost - * for UPnP - * - * @since S60 3.1 - */ - virtual void ConnectionLost(); - - - public: // New functions - - /** - * Searchs for media servers - * @since Series 60 2.0 - */ - void SearchMediaserversL(); - - /** - * Harvests media servers - * @since Series 60 2.0 - */ - void HarvestMediaserversL(); - - /** - * Static timer callback function - * @since Series 60 2.0 - * @param aNy media server container instance - */ - static TInt SearchTimerCompletedL( TAny* aNy ); - - /** - * Timer callback function - * @since Series 60 2.0 - */ - TInt DoSearchTimerCompletedL(); - - /** - * Harvest completion callback function - * @param aErr error code - * @since Series 60 2.0 - */ - void HarvestCompleteL( TInt aErr ); - - /** - * Cancels harvest - * @since Series 60 2.0 - */ - void CancelSearchL(); - - /** - * Cancels search - * @since Series 60 2.0 - */ - void CancelHarvestL(); - - /** - * Gets media server id from database - * @since Series 60 2.0 - * @param aSearchCaps - * @return media server id - */ - TInt IdForMediaServerL( TDesC8& aUuid ); - - /** - * Sends progress info - * @since Series 60 2.0 - * @param aProgress progressed item count - */ - void SendProgressInfo( TInt aProgress ); - - /** - * Add hash for search response - * @since S60 3.2 - * @param aMediaServerId, media server id - * @param aSearchIndex, search index - * @param aItemCount, item count - * @param aHash, hash code - * @return error code - */ - TInt AddHashValueForResponseL( TInt aMediaServerId, - TInt aSearchIndex, - TInt aItemCount, - const TDesC8& aHash ); - - /** - * Retrieves hash codes for defined media server - * @since S60 3.2 - * @param aMediaServerId, media server id - * @param aHashValues, hash codes - * @return None - */ - void HashValuesForMediaServerL( TInt aMediaServerId, - RPointerArray& aHashValues ); - - /** - * Deletes hash values - * @since S60 3.2 - * @param aMediaServerId, media server id - * @param aSearchIndex, search index - * @return None - */ - void DeleteOldHashValuesL( const TInt aMediaserverId, - const TInt aSearchIndex ); - - private: - - /** - * Constructor. - */ - CCmMdhMediaserverContainer(CCmMdhServer& aMdhServer); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Harvest a media server - * @since Series 60 2.0 - * @param aMediaServerIndex media server array index - */ - void DoHarvestMediaserverL( TInt aMediaserverIndex ); - - - /** - * Adds a media server to database if it doesn't exist there - * @since Series 60 2.0 - * @param aMediaServe media server device object - * @return whether server is active or not (new servers are not active) - */ - TBool AddToDbIfNewL( CUpnpDevice& aMediaserver ); - - /** - * Decreases pending responses counter and finishes search if ready - * @since Series 60 2.0 - */ - void DecResponsesAndFinishIfReadyL(); - - /** - * Leaving version of method CdsSystemUpdateIdResponse. - * @since Series 60 3.1 - * @param aErr UPnP error code. - * @param aSystemUpdateId - */ - void CdsSystemUpdateIdResponseL( - const TDesC8& aUuid, - TInt aErr, - TInt aSystemUpdateId ); - - /** - * Leaving version of GetSearchCapabilities function. - * @since Series 60 3.1 - * @param aUuid Source device UUID. - * @param aErr UPnP error code. - * @param aSearchCaps - */ - void CdsSearchCapabilitiesResponseL( - const TDesC8& aUuid, - TInt aErr, - const TDesC8& aSearchCaps ); - - /** - * Leaving version of CdsSearchResponseL function. - * @since Series 60 3.1 - * @param aUuid Source device UUID. - * @param aSessionId - * @param aErr UPnP error code. - * @param aContainerId - * @param aSearchCriteria - * @param aFilter - * @param aIndex - * @param arequest - * @param aSortCriteria - * @param aResult - * @param aReturned - * @param aMatches - * @param aUpdateID - */ - void CdsSearchResponseL( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches ); - - private: // Data - - // metadata collector container - CCmMdhMetadataCollector* iMetadataCollector; // owned - - // av control point - CUpnpAVControlPoint* iAvControlPoint; // owned - - // databse manager - CCmDmMain* iDbManager; // owned - - // reference to host server - CCmMdhServer& iMdhServer; - - // Settings engine - MCmSettings* iSettings; // owned - - // Connection monitor - CMdHConnectionMonitor* iMdHConMon; // owned - - // timer - CPeriodic* iTimer; // owned - - // array for media server information - RPointerArray iMediaservers; // items owned - - // array of old media servers - RPointerArray iOldMediaServers; // items owned - - TCmProgressInfo iProgressInfo; - - // index for storing which media server we are harvesting - TInt iMediaserverIndex; - - TInt iResponsesPending; - - TInt iTotalItemCount; - - // The IAP that is used - TInt iIap; - - TBool iHarvestErrCode; - - TBool iHarvestActive; - - TBool iAllFound; - - //index of havest item which has been sent to property - TInt iPropertyItemIndex; - - }; - -#endif // CMMDHMEDIASERVERCONTAINER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/server/mdhmetadatacollector.h --- a/upnpharvester/mdhserver/inc/server/mdhmetadatacollector.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Metadata Harvester's metadata collector header -* -*/ - - - - - - - -#ifndef CMMDHMETADATACOLLECTOR_H -#define CMMDHMETADATACOLLECTOR_H - -// INCLUDES -#include -#include "cdssync.h" - -// FORWARD DECLARATIONS -class CCmMdhMediaserverContainer; -class CUpnpAVControlPoint; -class CSHA1; -class CCmSearchResponseHash; - -// DATA TYPES - -// CLASS DECLARATION - -/** -* CCmMdhMetadataCollector -* This is a class for metadata harvester server's -* metadata collector component -* -* @since Series 60 3.0 -*/ -class CCmMdhMetadataCollector: public CBase, public MCdsSyncObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CCmMdhMetadataCollector* NewL( - CCmMdhMediaserverContainer& aMediaserverContainer, - CUpnpAVControlPoint& aControlPoint, - TInt aSearchChunkSize, - TInt aAddGranularity); - - /** - * Destructor. - */ - virtual ~CCmMdhMetadataCollector(); - - public: // New functions - - /** - * Observer callback for Content Directory Search function. - * @since Series 60 2.0 - * @param aSessionId - * @param aErr UPnP error code. - * @param aResult - * @param aReturned - * @param aMatches - */ - void CCmMdhMetadataCollector::CdsSearchResponse( - TInt aSessionId, - TInt aErr, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches); - - /** - * Harvests a media server - * @since Series 60 2.0 - * @param aUuid uuid - */ - void HarvestMediaserverL( TDesC8& aUuid ); - - /** - * Cancels harvest - * @since Series 60 2.0 - * @param aUuid uuid - */ - void CancelHarvest(); - - /** - * Static timer callback function - * @since Series 60 2.0 - * @param aNy instance of this class - */ - static TInt TimeoutTimerCompletedL( TAny* aNy ); - - - /** - * Timer callback function - * @since Series 60 2.0 - */ - TInt DoTimeoutTimerCompletedL(); - - - public: // MCdsSyncObserver functions - - /** - * Send progress data - * @since S60 3.1 - * @param aItemCount progressed items count - */ - void ProgressL( TInt aItemCount ); - - /** - * Notification of processed chunk - * @since S60 3.1 - */ - void ChunkCompleteL(); - - /** - * Cds Sync completion callback function - * @since S60 3.1 - */ - void SyncCompleteL(); - - /** - * Cds Sync error callback function - * @since S60 3.1 - * @param aError error code - */ - void SyncErrorL( TInt aError ); - - private: - - /** - * Constructor. - */ - CCmMdhMetadataCollector( - CCmMdhMediaserverContainer& aMediaserverContainer, - CUpnpAVControlPoint& aAvControlPoint, - TInt aSearchChunkSize, - TInt aAddGranularity); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Harvests a media server - * @since Series 60 2.0 - */ - void DoHarvestMediaserverL(); - - /** - * Handles Content Directory search response processing. - * @since Series 60 3.1 - * @param aSessionId - * @param aErr UPnP error code. - * @param aResult - * @param aReturned - * @param aMatches - */ - void HandleSearchResponseL( TInt aSessionId, - TInt aErr, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches ); - private: // Data - - // Cds synchronizer (owned) - CCdsSync* iCdsSync; - - RPointerArray iSourceDataArray; // elements owned - - // reference to mediaserver container - CCmMdhMediaserverContainer& iMediaserverContainer; - - // reference to av control point - CUpnpAVControlPoint& iAvControlPoint; - - // timeout timer - CPeriodic* iTimer; // owned - - TInt iSearchIndex; - TInt iSearchRetryCount; - TInt iSearchChunkSize; - TInt iAddGranularity; - TInt iSessionId; - TInt iItemsToParse; - TBool iResultIncomplete; - TBool iCanceled; - TBool iInit; - - HBufC8* iUuid; // owned - HBufC8* iXmlToParse; // owned - - TInt iMediaServerId; - -#ifdef _DEBUG - TTime iDebugTime; -#endif // _DEBUG - - - CSHA1* iHashGenerator; - - RPointerArray iHashValues; - - TInt iTempStartIndex; - - }; - -#endif // CMMDHMETADATACOLLECTOR_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/server/mdhserver.h --- a/upnpharvester/mdhserver/inc/server/mdhserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server executable header file -* -*/ - - - - - - - -#ifndef MDHSERVER_H -#define MDHSERVER_H - -// INCLUDES -#include -#include -#include "mdhmediaservercontainer.h" - -// --------------------------------------------------------------- -// Server's policy -// --------------------------------------------------------------- - -//Total number of ranges -const TUint KCmMdhServerRangeCount = 2; - -//Definition of the ranges of IPC numbers -const TInt KCmMdhServerRanges[KCmMdhServerRangeCount] = - { - 0, - 3 - }; - -//Policy to implement for each of the above ranges -const TUint8 KCmMdhServerElementsIndex[KCmMdhServerRangeCount] = - { - 1, //applies to 1st range - CPolicyServer::ENotSupported - }; - -//Specific capability checks -const CPolicyServer::TPolicyElement KCmMdhServerElements[] = - { - {_INIT_SECURITY_POLICY_C3(ECapabilityNetworkServices, - ECapabilityReadUserData, ECapabilityWriteUserData ), - CPolicyServer::EFailClient }, - {_INIT_SECURITY_POLICY_C1(ECapabilityNetworkServices), - CPolicyServer::EFailClient} - }; - -//Package all the above together into a policy -const CPolicyServer::TPolicy KCmMdhServerPolicy = - { - //specifies all connect attempts should pass - CPolicyServer::EAlwaysPass, - KCmMdhServerRangeCount, - KCmMdhServerRanges, - KCmMdhServerElementsIndex, - KCmMdhServerElements - }; - - -// DATA TYPES - -enum TCmMdhServerState - { - ECmMdhServerStateIdle = 0, - ECmMdhServerStateSearching, - ECmMdhServerStateHarvesting - }; - -// FORWARD DECLARATIONS - -// FUNCTION PROTOTYPES - -// Method to panic server in case of serious error -void PanicServer( TInt aPanic ); -// Method to panic client if e.g. message is malformed -void PanicClient( const RMessage2& aMessage, TInt aPanic ); - - -// CLASS DECLARATION - -/** -* Dummy Server Core class -* -* @lib CmMdhServer -* @since Series 60 3.1 -*/ -class CCmMdhServer : public CPolicyServer - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CCmMdhServer* NewLC(); - - /** - * Destructor. - */ - virtual ~CCmMdhServer(); - - public: // New functions - - /** - * Sets server's state - * @since S60 3.1 - * @param aServerState, server state - * @param aErrCode error code. - */ - void SetServerStateL( TCmMdhServerState aServerState, - TInt aErrCode = KErrNone ); - - /** - * Decrement server sessions - * @since S60 3.1 - */ - void DecrementSessions(); - - /** - * Returns server's current state - * @since S60 3.1 - * @return server state - */ - TCmMdhServerState ServerState(); - - /** - * Set current asyncronous message - * @since S60 3.1 - * @param aMessage, message - */ - void SetCurrentAsyncMsg( const RMessage2& aMessage ); - - /** - * Creates media server container instance - * @since S60 3.1 - */ - void CreateMediaserverContainerL(); - - /** - * Destroys media server container instance - * @since S60 3.1 - */ - void DestroyMediaserverContainer(); - - /** - * Returns media server container reference - * @since S60 3.1 - * @return media server container - */ - CCmMdhMediaserverContainer& MediaserverContainer(); - - /** - * Increments sessions - * @since S60 3.1 - */ - void IncrementSessions(); - - private: - - /** - * C++ default constructor. - */ - CCmMdhServer(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Functions from base classes - - CSession2* NewSessionL( const TVersion& aVersion, - const RMessage2& aMessage ) const; - - - private: // Data - - /** Current asyncronous message */ - RMessage2 iCurrentAsyncMsg; - - /** Media server container ( owned ) */ - CCmMdhMediaserverContainer* iMediaserverContainer; - - /** Server state */ - TCmMdhServerState iServerState; - - /** Count of sessions */ - TInt iSessionCount; - - }; - - -#endif // MDHSERVER_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/inc/server/mdhserversession.h --- a/upnpharvester/mdhserver/inc/server/mdhserversession.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Metadata Harvester server session header -* -*/ - - - - - - - -#ifndef CMMDHSERVERSESSION_H -#define CMMDHSERVERSESSION_H - -// INCLUDES -#include -//include "mdhmediaservercontainer.h" - -// FORWARD DECLARATIONS - -class CCmMdhMediaserverContainer; -class CCmMdhServer; - -// CLASS DECLARATION - -/** -* CCmMdhSession -* This is a class for metadata harvester server main session -* -* @lib - -* @since Series 60 3.0 -*/ -class CCmMdhSession : public CSession2 - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CCmMdhSession* NewL( - CCmMdhMediaserverContainer* aMediaserverContainer, - CCmMdhServer& aServer ); - - /** - * Destructor. - */ - ~CCmMdhSession(); - - public: // Functions from base classes - - /** - * ServiceL from base class CSession2. - * @since Series 60 3.0 - * @param aMessage Message for Metadata Harvester - * @return void - */ - void ServiceL( const RMessage2 &aMessage ); - - public: // New functions - - private: - - /** - * Constructor. - */ - CCmMdhSession( CCmMdhMediaserverContainer* aMediaserverContainer, - CCmMdhServer& aServer ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Server returns the server reference. - * @since Series 60 3.1 - * @param void - * @return Metadata harvester server reference - */ - CCmMdhServer& Server(); - - /** - * Completes message with busy error code if server is busy - * @since Series 60 3.1 - * @param aMessage message - * @return ETrue if completed - */ - TBool CompleteIfBusy( const RMessage2& aMessage ); - - - private: // Data - - // media server container pointer (not owned) - CCmMdhMediaserverContainer* iMediaserverContainer; - - // Server - CCmMdhServer& iServer; - - }; - -#endif // CMMDHSERVERSESSION_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/client/mdhclient.cpp --- a/upnpharvester/mdhserver/src/client/mdhclient.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server's client -* -*/ - - - - - - - -// INCLUDE FILES - -#include "mdhclient.h" -#include "cmserviceobserver.h" -#include "msdebug.h" - -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmMdhClient* CCmMdhClient::NewL( MCmServiceObserver& aServer ) - { - CCmMdhClient* self = CCmMdhClient::NewLC( aServer ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmMdhClient* CCmMdhClient::NewLC( MCmServiceObserver& aServer ) - { - CCmMdhClient* self = new ( ELeave ) CCmMdhClient( aServer ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmMdhClient::~CCmMdhClient() - { - LOG(_L("[CmMdh Server]\t CCmMdhClient::~CCmMdhClient\n")); - Cancel(); - iMdhSession.Close(); - LOG(_L("[CmMdh Server]\t CCmMdhClient::~CCmMdhClient end\n")); - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmMdhClient::CCmMdhClient( MCmServiceObserver& aServer ) : - CActive( EPriorityStandard ), - iServer( aServer ), iState( ECmMdhClientIdle ) - { - LOG(_L("[CmMdh Server]\t CCmMdhClient::CCmMdhClient\n")); - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmMdhClient::ConstructL( ) - { - } - -// --------------------------------------------------------------------------- -// Harvest -// --------------------------------------------------------------------------- -// -TInt CCmMdhClient::Harvest() - { - LOG(_L("[CmMdh Server]\t CCmMdhClient::Harvest\n")); - - if ( IsActive() ) - { - return KErrNotReady; - } - - TInt errCode = iMdhSession.Connect(); - if (errCode != KErrNone) - { - return errCode; - } - iMdhSession.SearchMediaservers( iStatus ); - SetActive(); - iState = ECmMdhClientSearching; - return KErrNone; - } - -// --------------------------------------------------------------------------- -// Stop -// --------------------------------------------------------------------------- -// -void CCmMdhClient::Stop() - { - LOG(_L("[CmMdh Server]\t CCmMdhClient::Stop\n")); - Cancel(); - } - -// --------------------------------------------------------------------------- -// Close -// --------------------------------------------------------------------------- -// -void CCmMdhClient::Close() - { - LOG(_L("[CmMdh Server]\t CCmMdhClient::Close\n")); - delete this; - } - -// --------------------------------------------------------------------------- -// DoCancel -// --------------------------------------------------------------------------- -// -void CCmMdhClient::DoCancel() - { - LOG(_L("[CmMdh Server]\t CCmMdhClient::DoCancel\n")); - iMdhSession.Cancel(); - iMdhSession.Close(); - iState = ECmMdhClientIdle; - iServer.ServiceExecuted( ECmServiceHarvest, KErrCancel ); - LOG(_L("[CmMdh Server]\t CCmMdhClient::DoCancel end\n")); - } - -// --------------------------------------------------------------------------- -// RunL -// --------------------------------------------------------------------------- -// -void CCmMdhClient::RunL() - { - LOG(_L("[CmMdh Server]\t CCmMdhClient::RunL\n")); - if ( iState == ECmMdhClientSearching && - iStatus == KErrNone ) - { - iMdhSession.Harvest( iStatus ); - SetActive(); - iState = ECmMdhClientHarvesting; - } - else // iState == ECmMdhClientHarvesting or error in search - { - iMdhSession.Close(); - iState = ECmMdhClientIdle; - iServer.ServiceExecuted ( ECmServiceHarvest, iStatus.Int() ); - } - } - -// End of file - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/client/mdhclientfactory.cpp --- a/upnpharvester/mdhserver/src/client/mdhclientfactory.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: The factory for MdHClient -* -*/ - - - - - - -#include "mdhclientfactory.h" -#include "mmdhclient.h" -#include "mdhclient.h" - - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// Constructor -// -------------------------------------------------------------------------- -// -EXPORT_C MCmMdhClient* CCmMdhClientFactory::NewCmMdhClientL( MCmServiceObserver& aServer ) - { - return CCmMdhClient::NewL( aServer ); - } - -// -------------------------------------------------------------------------- -// Constructor -// -------------------------------------------------------------------------- -// -EXPORT_C MCmMdhClient* CCmMdhClientFactory::NewCmMdhClientLC( MCmServiceObserver& aServer ) - { - return CCmMdhClient::NewLC( aServer ); - } - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/client/mdhclientsession.cpp --- a/upnpharvester/mdhserver/src/client/mdhclientsession.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server's client -* -*/ - - - - - - - -// INCLUDE FILES - -#include "mdhclientsession.h" -#include "mdhcommon.h" -#include "msdebug.h" - - -// CONSTANTS -// Number of retries to start server -const TInt KServerRetries = 2; - -// =========================== LOCAL FUNCTIONS =============================== - -// --------------------------------------------------------------------------- -// StartServer -// Starts the CM Metadata Harvester server. -// Returns: TInt error: Error status of the CM Metadata Harvester startup. -// --------------------------------------------------------------------------- -// -// --------------------------------------------------------------------------- -// StartServer -// Creates a new process for the server and starts it up. -// --------------------------------------------------------------------------- -// -static TInt StartServer() - { - LOG(_L("[CmMdh Server]\t StartServer\n")); - - TInt result( KErrNone ); - // create server - if one of this name does not already exist - TFindServer findServer( KCmMdhServerName ); - TFullName name; - if ( findServer.Next( name ) != KErrNone ) // we don't exist already - { - - TRequestStatus status( KRequestPending ); - RProcess server; - // Create the server process - result = server.Create( KCmMdhServerExe, KNullDesC ); - if( result != KErrNone ) - { - return result; - } - - // Process created successfully - server.Resume(); // start it going - server.Rendezvous( status ); - - // Wait until the completion of the server creation - // server signals us when it's up - User::WaitForRequest( status ); - - - if( status != KErrNone ) - { - server.Close(); - return status.Int(); - } - - - // Server created successfully - server.Close(); // we can close the handle to server process now - } - return result; - } - - -// ========================== MEMBER FUNCTIONS =============================== - -// --------------------------------------------------------------------------- -// RCmMdhSession::RCmMdhSession -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -RCmMdhSession::RCmMdhSession() - { - } - - -// --------------------------------------------------------------------------- -// RCmMdhSession::Connect -// Starts and creates a session of CM Metadata Harvester -// --------------------------------------------------------------------------- -// -TInt RCmMdhSession::Connect() - { - TInt tryLoop = 0; - TInt errCode = 0; - - for ( tryLoop = 0; tryLoop < KServerRetries; tryLoop++ ) - { - errCode = CreateSession(KCmMdhServerName, - TVersion( KCmMdhServerMajor, KCmMdhServerMinor, - KCmMdhServerBuild ) ); - //gives MessageSlots of -1 - //this uses global pool rather than local pool - - TRACE(Print(_L("[CmMdh Server]\t RCmMdhSession::Connect New Session \ - created with status %d\n"), errCode)); - if( errCode == KErrNotSupported ) - { - TRACE(Print(_L("[CmMdh Server]\t Version not supported!\n") )); - return errCode; - } - if ( errCode != KErrNotFound && errCode != KErrServerTerminated ) - { - return errCode; - } - - errCode = StartServer(); - - if ( errCode != KErrNone && errCode != KErrAlreadyExists ) - { - return errCode; - } - - } - return errCode; - } - -// --------------------------------------------------------------------------- -// RCmMdhSession::SearchMediaServers -// Searchs for neighborhood media servers -// --------------------------------------------------------------------------- -// -void RCmMdhSession::SearchMediaservers( TRequestStatus& aStatus ) - { - LOG(_L("[CmMdh Server]\t RCmMdhSession::SearchMediaservers\n")); - - SendReceive(ECmMdhSearchMediaservers, TIpcArgs(), aStatus); - } - - -// --------------------------------------------------------------------------- -// RCmMdhSession::Harvest -// Harvests and synchronizes metadata from found mediaservers -// --------------------------------------------------------------------------- -// -void RCmMdhSession::Harvest( TRequestStatus& aStatus ) - { - LOG(_L("[CmMdh Server]\t RCmMdhSession::SearchMediaServers\n")); - - SendReceive(ECmMdhHarvest, TIpcArgs(), aStatus); - } - -// --------------------------------------------------------------------------- -// RCmMdhSession::Cancel -// --------------------------------------------------------------------------- -// -void RCmMdhSession::Cancel() - { - LOG(_L("[CmMdh Server]\t RCmMdhSession::Cancel\n")); - - SendReceive(ECmMdhCancel, TIpcArgs()); - } - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/server/mdhavcpadapter.cpp --- a/upnpharvester/mdhserver/src/server/mdhavcpadapter.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,669 +0,0 @@ -/* -* Copyright (c) 2007 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: AvControlPoint adapter helper class implementation -* -*/ - - - - - - -#include "mdhavcpadapter.h" - -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmMdhAvControlPointAdapter* CCmMdhAvControlPointAdapter::NewL() - { - CCmMdhAvControlPointAdapter* self = - CCmMdhAvControlPointAdapter::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmMdhAvControlPointAdapter* CCmMdhAvControlPointAdapter::NewLC() - { - CCmMdhAvControlPointAdapter* self = - new ( ELeave ) CCmMdhAvControlPointAdapter( ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmMdhAvControlPointAdapter::~CCmMdhAvControlPointAdapter() - { - - } - -// --------------------------------------------------------------------------- -// Default constructor -// --------------------------------------------------------------------------- -// -CCmMdhAvControlPointAdapter::CCmMdhAvControlPointAdapter() - { - - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::ConstructL() - { - - } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::RcSetVolumeResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstance*/, - const TDesC8& /*aChannel*/, - const TDesC8& /*aDesiredVolume*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::RcVolumeResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstance*/, - const TDesC8& /*aChannel*/, - const TDesC8& /*aCurrentVolume*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::RcSetMuteResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstance*/, - const TDesC8& /*aChannel*/, - const TDesC8& /*aDesiredMute*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::RcMuteResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstance*/, - const TDesC8& /*aChannel*/, - const TDesC8& /*aCurrentMute*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtSetTransportUriResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aCurrentUri*/, - const TDesC8& /*aCurrentUriMetaData*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtSetNextTransportUriResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aNextUri*/, - const TDesC8& /*aNextUriMetaData*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtMediaInfoResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aNrTracks*/, - const TDesC8& /*aMediaDuration*/, - const TDesC8& /*aCurrentUri*/, - const TDesC8& /*aCurrentUriMetaData*/, - const TDesC8& /*aNextUri*/, - const TDesC8& /*aNextUriMetaData*/, - const TDesC8& /*aPlayMedium*/, - const TDesC8& /*aRecordMedium*/, - const TDesC8& /*aWriteStatus*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtGetTransportInfoResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aCurrenTransportState*/, - const TDesC8& /*aCurrentTransportStatus*/, - const TDesC8& /*aCurrentSpeed*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtPositionInfoResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aTrack*/, - const TDesC8& /*aTrackDuration*/, - const TDesC8& /*aTrackMetaData*/, - const TDesC8& /*aTrackURI*/, - const TDesC8& /*aRelTime*/, - const TDesC8& /*aAbsTime*/, - const TDesC8& /*aRelCount*/, - const TDesC8& /*aAbsCount*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtDeviceCapabilitiesResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aPlayMedia*/, - const TDesC8& /*aRecMedia*/, - const TDesC8& /*aRecQualityMode*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtTransportSettingsResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aPlayMode*/, - const TDesC8& /*aRecQualityMode*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtStopResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtPlayResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aSpeed*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtPauseResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtRecordResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtSeekResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aUnit*/, - const TDesC8& /*aTarget*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtNextResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/) { /*nothing*/ } -/** -* Observer callback for rendering control AV Previous response. -* @since Series 60 2.0 -* @param aUuid Source device UUID. -* @param aSessionId -* @param aErr UPnP error code. -*/ -void CCmMdhAvControlPointAdapter::AvtPreviousResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtSetPlayModeResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aNewPlayMode*/) { /*nothing*/ } -/** -* Observer callback for rendering control AV set record qualityresponse. -* @since Series 60 2.0 -* @param aUuid Source device UUID. -* @param aSessionId -* @param aErr UPnP error code. -* @param aNewRecordQuality -*/ -void CCmMdhAvControlPointAdapter::AvtSetRecordModeResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aNewRecordQuality*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtCurrentTransportActionsResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aInstanceId*/, - const TDesC8& /*aActions*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsSearchCapabilitiesResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aSearchCaps*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsSortCapabilitiesResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aSortCaps*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsSystemUpdateIdResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - TInt /*aSystemUpdateId*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsBrowseResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aObjectID*/, - const TDesC8& /* aBrowseFlag*/, - const TDesC8& /* aFilter*/, - TInt /*aIndex*/, - TInt /*aRequest*/, - const TDesC8& /* aSortCriteria*/, - const TDesC8& /* aResult*/, - TInt /*aReturned*/, - TInt /*aMatches*/, - const TDesC8& /* aUpdateID*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsSearchResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aContainerId*/, - const TDesC8& /*aSearchCriteria*/, - const TDesC8& /*aFilter*/, - TInt /*aIndex*/, - TInt /*aRequest*/, - const TDesC8& /*aSortCriteria*/, - const TDesC8& /*aResult*/, - TInt /*aReturned*/, - TInt /*aMatches*/, - const TDesC8& /*aUpdateID*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsDestroyObjectResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aObjectId */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsUpdateObjectResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aObjectId*/, - const TDesC8& /*aCurrentTagValue*/, - const TDesC8& /*aNewTagValue */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsImportResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aSourceURI*/, - const TDesC8& /*aDestinationURI*/, - const TDesC8& /*aTransferId */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsExportResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aSourceURI*/, - const TDesC8& /*aDestinationURI*/, - const TDesC8& /*aTransferId */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsStopTransferResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aTransferId */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsCTransferProgressResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aTransferId*/, - const TDesC8& /*aTransferStatus*/, - const TDesC8& /*aTransferLength*/, - const TDesC8& /*aTransferTotal */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsDeleteResourceResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aResourceUri */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsCreateReferenceResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aContainerId*/, - const TDesC8& /*aObjectId*/, - const TDesC8& /*aNewId */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsCreateObjectResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aContainerID*/, - const TDesC8& /*aElements*/, - const TDesC8& /*aObjectID*/, - const TDesC8& /*aResult */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmProtocolInfoResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aSource*/, - const TDesC8& /*aSink */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmPrepareResponse( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aRemoteProtocolInfo*/, - const TDesC8& /*aPeerConnectionManager*/, - const TDesC8& /*aPeerConnectionId*/, - const TDesC8& /*aDirection*/, - TInt /*aConnection*/, - TInt /*aTransport*/, - TInt /*aRsc */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmComplete( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - TInt /*aConnection */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmCurrentConnections( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - const TDesC8& /*aConnections*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmCurrentInfo( - const TDesC8& /*aUuid*/, - TInt /*aSessionId*/, - TInt /*aErr*/, - TInt /*rscId*/, - TInt /*transportId*/, - const TDesC8& /*aProtocolInfo*/, - const TDesC8& /*aPeerConnectionManager*/, - TInt /*peerId*/, - const TDesC8& /*aDirection*/, - const TDesC8& /*aStatus */) { /*nothing*/ } - -//***************************************************************** -//Functions for UPnP event handling -//***************************************************************** -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsUpdateEvent( - const TDesC8& /*aUuid*/, - TInt /*aSystemUpdateId - */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsContainerEvent( - const TDesC8& /*aUuid*/, - const TDesC8& /*aConteinerIds - */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CdsTransferEvent( - const TDesC8& /*aUuid*/, - const TDesC8& /*aTransferIds - */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::RcLastChangeEvent( - const TDesC8& /*aUuid*/, - const TDesC8& /*aLastChange - */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::AvtLastChangeEvent( - const TDesC8& /*aUuid*/, - const TDesC8& /*aLastChange - */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmSourceEvent( - const TDesC8& /*aUuid*/, - const TDesC8& /*aSource - */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmSinkEvent( - const TDesC8& /*aUuid*/, - const TDesC8& /*aSink - */) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::CmConnectionsEvent( - const TDesC8& /*aUuid*/, - const TDesC8& /*aConnections - */) { /*nothing*/ } - -//***************************************************************** -// Device and http functions. -//***************************************************************** -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::HttpResponseL( - CUpnpHttpMessage* /*aMessage*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::DeviceDiscoveredL( - CUpnpDevice* /*aDevice*/) { /*nothing*/ } - -// --------------------------------------------------------------------------- -// See upnpavcontrolpointobserver.h -// --------------------------------------------------------------------------- -// -void CCmMdhAvControlPointAdapter::DeviceDisappearedL( - CUpnpDevice* /*aDevice*/) { /*nothing*/ } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/server/mdhconnectionmonitor.cpp --- a/upnpharvester/mdhserver/src/server/mdhconnectionmonitor.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: UPnP Connection Monitor class implementation. -* -*/ - - - - - - -// INCLUDE FILES -#include - -#include "mdhconnectionmonitor.h" - -// ========================== MEMBER FUNCTIONS =============================== - -// --------------------------------------------------------------------------- -// CMdHConnectionMonitor::CMdHConnectionMonitor -// C++ default constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------------------------- -// -CMdHConnectionMonitor::CMdHConnectionMonitor( - MMdHConnectionMonitorObserver& aObserver, TInt aAccessPoint ) : - iObserver( aObserver ), - iAccessPoint( aAccessPoint ) - { - } - - -// --------------------------------------------------------------------------- -// CMdHConnectionMonitor::NewL -// Two-phased constructor. -// --------------------------------------------------------------------------- -// -EXPORT_C CMdHConnectionMonitor* CMdHConnectionMonitor::NewL( - MMdHConnectionMonitorObserver& aObserver, TInt aAccessPoint ) - { - CMdHConnectionMonitor* self = new(ELeave) CMdHConnectionMonitor( - aObserver, aAccessPoint ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMdHConnectionMonitor::ConstructL -// Symbian 2nd phase constructor can leave. -// --------------------------------------------------------------------------- -// -void CMdHConnectionMonitor::ConstructL() - { - iConnectionMonitor.ConnectL(); - - iConnectionMonitor.NotifyEventL( *this ); - - // Get the count of connections - TRequestStatus status = KRequestPending; - TUint connectionCount = 0; - iConnectionMonitor.GetConnectionCount(connectionCount, status); - User::WaitForRequest( status ); - - // Go through available connections and check to see - // if connection with iAccessPoint IAP is already running - if( status == KErrNone ) - { - for( TUint i=1; i < connectionCount+1; i++ ) - { - TUint connectionId; - TUint subConnectionCount; - TUint iapId = 0; - - iConnectionMonitor.GetConnectionInfo( - i, - connectionId, - subConnectionCount); - - TRequestStatus status = KRequestPending; - - iConnectionMonitor.GetUintAttribute( - connectionId, - 0, - KIAPId, - (TUint &) iapId, - status ); - User::WaitForRequest( status ); - - // Save connectionId if same iap - if( status == KErrNone && iAccessPoint == iapId ) - { - iConnectionId = connectionId; - } - } - } - - } - - -// --------------------------------------------------------------------------- -// CMdHConnectionMonitor::~CMdHConnectionMonitor() -// Destructor -// --------------------------------------------------------------------------- -// -CMdHConnectionMonitor::~CMdHConnectionMonitor() - { - iConnectionMonitor.CancelNotifications(); - - // Disconnect from CM server - iConnectionMonitor.Close(); - } - - - -// --------------------------------------------------------------------------- -// CMdHConnectionMonitor::EventL() -// Connection monitor observer -// --------------------------------------------------------------------------- -// -void CMdHConnectionMonitor::EventL( const CConnMonEventBase& aConnMonEvent ) - { - - TUint connectionId = 0; - - switch ( aConnMonEvent.EventType() ) - { - case EConnMonCreateConnection: - { - TUint iapId = 0; - - const CConnMonCreateConnection* eventCreate; - eventCreate = (const CConnMonCreateConnection*)&aConnMonEvent; - connectionId = eventCreate->ConnectionId(); - - TRequestStatus status = KRequestPending; - - // Get IAP id - iConnectionMonitor.GetUintAttribute( - eventCreate->ConnectionId(), - 0, - KIAPId, - iapId, - status ); - User::WaitForRequest( status ); - - // Save connectionId if same iap - if( iAccessPoint == iapId ) - { - iConnectionId = connectionId; - } - - break; - } - - // Connection is deleted - case EConnMonDeleteConnection: - { - const CConnMonDeleteConnection* eventDelete; - eventDelete = - ( const CConnMonDeleteConnection* ) &aConnMonEvent; - connectionId = eventDelete->ConnectionId(); - - // If connection id same as in createConnection - if( connectionId == iConnectionId ) - { - // Callback function - iObserver.ConnectionLost(); - } - - break; - } - default: - { - break; - } - } - } - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/server/mdhmediaservercontainer.cpp --- a/upnpharvester/mdhserver/src/server/mdhmediaservercontainer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,967 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server's mediaserver container component -* -*/ - - - - - - - -// INCLUDE FILES -#include -#include - -#include "cmsettingsfactory.h" -#include "cmsettings.h" -#include "cmdmmain.h" -#include "cmmediaserverfull.h" -#include "cmsearchresponsehash.h" -#include "cmsettings.h" -#include -#include -#include "mdhconnectionmonitor.h" -#include "mdhmediaservercontainer.h" -#include "mdhmetadatacollector.h" -#include "mdhserver.h" -#include "msdebug.h" - - -// CONSTANTS -#ifdef __SERIES60_31__ -_LIT8( KAVControlPointFriendlyName, "AVDevice" ); -#endif //__SERIES60_31__ -_LIT8( KMediaServer, "MediaServer" ); -#ifdef _DEBUG -_LIT8( KFriendlyNameTag, "friendlyName" ); -#endif - -const TInt KDefaultCaculateSize = 100; -const TInt KDefaultChunkSize = 150; -const TInt KDefaultAddGranularity = 500; - -// amount of microseconds in one second -const TInt KMicrosecondsInSecond = 1000000; -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmMdhMediaserverInfo* CCmMdhMediaserverInfo::NewL( ) - { - CCmMdhMediaserverInfo* self = CCmMdhMediaserverInfo::NewLC( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmMdhMediaserverInfo* CCmMdhMediaserverInfo::NewLC() - { - CCmMdhMediaserverInfo* self = new ( ELeave ) CCmMdhMediaserverInfo( ); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmMdhMediaserverInfo::~CCmMdhMediaserverInfo() - { - delete iUuid; - } - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -// -CCmMdhMediaserverInfo::CCmMdhMediaserverInfo( ) - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CCmMdhMediaserverInfo::ConstructL( ) - { - - } - -// --------------------------------------------------------------------------- -// Two-phased constructor. -// --------------------------------------------------------------------------- -CCmMdhMediaserverContainer* CCmMdhMediaserverContainer::NewL( - CCmMdhServer& aMdhServer) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::NewL")); - - CCmMdhMediaserverContainer* self = - new (ELeave) CCmMdhMediaserverContainer(aMdhServer); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor. -// --------------------------------------------------------------------------- -CCmMdhMediaserverContainer::CCmMdhMediaserverContainer( - CCmMdhServer& aMdhServer) - :iMdhServer( aMdhServer ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - CCmMdhMediaserverContainer")); - iAvControlPoint = NULL; - iMetadataCollector = NULL; - iTimer = NULL; - iMediaserverIndex = 0; - iResponsesPending = 0; - iTotalItemCount = 0; - iHarvestErrCode = KErrNone; - iHarvestActive = EFalse; - iPropertyItemIndex = 0; - iProgressInfo.iService = ECmServiceHarvest; - } - -// --------------------------------------------------------------------------- -// 2nd phase constructor. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::ConstructL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::ConstructL")); - iDbManager = CCmDmMain::NewL(); - iSettings = CCmSettingsFactory::NewCmSettingsEngineL(); - iSettings->GetIapL( iIap ); - TRACE( Print( _L("[CmMdh Server]\t Monitoring iap %d"), iIap )); - iMdHConMon = CMdHConnectionMonitor::NewL( *this, iIap ); - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -CCmMdhMediaserverContainer::~CCmMdhMediaserverContainer() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - ~CCmMdhMediaserverContainer")); - - TRACE( Print( _L("[CmMdh Server]\t deleting %d media servers"), - iMediaservers.Count())); - - iMediaservers.ResetAndDestroy(); - iOldMediaServers.ResetAndDestroy(); - - LOG(_L("[CmMdh Server]\t deleting settings engine..")); - if ( iSettings ) - { - iSettings->Close(); - } - - LOG(_L("[CmMdh Server]\t deleting db manager..")); - if ( iDbManager ) - { - delete iDbManager; - } - - LOG(_L("[CmMdh Server]\t deleting metadata collector..")); - if ( iMetadataCollector ) - { - delete iMetadataCollector; - } - - LOG(_L("[CmMdh Server]\t deleting av control point..")); - if ( iAvControlPoint ) - { - delete iAvControlPoint; - } - - LOG(_L("[CmMdh Server]\t deleting timer..")); - if ( iTimer ) - { - delete iTimer; - } - - LOG(_L("[CmMdh Server]\t deleting connection monitor..")); - if ( iMdHConMon ) - { - delete iMdHConMon; - } - - LOG(_L("[CmMdh Server]\t All deleted..")); - } - -// --------------------------------------------------------------------------- -// Harvest a media server -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::DoHarvestMediaserverL( - TInt aMediaserverIndex ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - DoHarvestMediaserverL")); - iMdhServer.SetServerStateL(ECmMdhServerStateHarvesting); - if ( iMediaservers[aMediaserverIndex]->iMediaserverState - == ECmMdhMediaserverNotSynchronized) - { - iMetadataCollector->HarvestMediaserverL( - *iMediaservers[aMediaserverIndex]->iUuid ); - iHarvestActive = ETrue; - } - else - { - LOG(_L("[CmMdh Server]\t No search caps or \ - no sync needed, skipping..")); - HarvestCompleteL( KErrNone ); - } - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - DoHarvestMediaserverL end")); - } - -// --------------------------------------------------------------------------- -// Adds a media server to database if it doesn't exist there -// --------------------------------------------------------------------------- -TBool CCmMdhMediaserverContainer::AddToDbIfNewL( CUpnpDevice& aMediaserver ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::AddToDbIfNewL")); - - CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC(); - tempServer->SetUDNL( aMediaserver.Uuid() ); - iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery ); - TInt errCode = iDbManager->QueryMediaServerL( tempServer ); - TBool ret = EFalse; - - if ( errCode != KErrNotFound ) - { - TRACE( Print( _L("[CmMdh Server]\t FillUsage: %d"), - tempServer->FillUsage())); - ret = (TBool)tempServer->FillUsage(); - iAllFound = ETrue; - for( TInt i = 0 ; i < iOldMediaServers.Count(); i++ ) - { - if( KErrNotFound != aMediaserver.Uuid().Match( - iOldMediaServers[i]->MediaServer() ) ) - { - TRACE( Print( _L("[CmMdh Server]\t In db..."))); - iOldMediaServers[i]->SetFillUsage( EFalse ); - } - if( iOldMediaServers[i]->FillUsage()) - { - TRACE( Print( _L("[CmMdh Server]\t All not found"))); - iAllFound = EFalse; - } - } - } - CleanupStack::PopAndDestroy( tempServer ); - return ret; - } - -// --------------------------------------------------------------------------- -// Decreases pending responses counter and finishes search if ready -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::DecResponsesAndFinishIfReadyL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - DecResponsesAndFinishIfReadyL")); - if ( !(--iResponsesPending ) ) - { - if( iAllFound ) - { - DoSearchTimerCompletedL(); - } - } - } - -// --------------------------------------------------------------------------- -// Static timer callback function. -// --------------------------------------------------------------------------- -TInt CCmMdhMediaserverContainer::SearchTimerCompletedL( TAny* aInstance ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - SearchTimerCompleted")); - return ((CCmMdhMediaserverContainer*)aInstance) - ->DoSearchTimerCompletedL(); - } - -// --------------------------------------------------------------------------- -// Timer callback function. -// --------------------------------------------------------------------------- -TInt CCmMdhMediaserverContainer::DoSearchTimerCompletedL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - DoSearchTimerCompleted")); - delete iTimer; - iTimer = NULL; - TRACE( Print( _L("[CmMdh Server]\t Found %d media servers"), - iMediaservers.Count())); - - if ( !iResponsesPending ) - { - iOldMediaServers.ResetAndDestroy(); - iMdhServer.SetServerStateL(ECmMdhServerStateIdle); - } - return KErrNone; - } - -// --------------------------------------------------------------------------- -// Handles UPnP device discoveries. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::DeviceDiscoveredL( CUpnpDevice* aDevice ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::DeviceDiscoveredL")); - -#ifdef _DEBUG - - HBufC* uuid = UpnpString::ToUnicodeL( aDevice->Uuid() ); - HBufC* name = UpnpString::ToUnicodeL( - aDevice->DescriptionProperty( KFriendlyNameTag() )); - HBufC* type = UpnpString::ToUnicodeL( aDevice->DeviceType() ); - TRACE( Print(_L("[CmMdh Server]\t type: %S uuid: %S, name %S"), - type, uuid, name )); - delete uuid; - delete name; - delete type; - -#endif - - - if (!iTimer) // search is no more active - { - LOG(_L("[CmMdh Server]\t Search no more active, returning..")); - return; - } - - if( aDevice->DeviceType().Find(KMediaServer) != KErrNotFound && - !iAllFound ) - { - LOG(_L("[CmMdh Server]\t Found a media server")); - - if ( AddToDbIfNewL( *aDevice ) ) - { - ++iResponsesPending; - iAvControlPoint->CdsSearchCapabilitiesActionL( aDevice->Uuid() ); - } -#ifdef _DEBUG - - else - { - LOG(_L("[CmMdh Server]\t not active, skipping..")); - } -#endif - - } - - } - -// --------------------------------------------------------------------------- -// Handles UPnP device disappears. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::DeviceDisappearedL( - CUpnpDevice* /* aDevice */ ) - { - LOG( _L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - DeviceDisappearedL") ); - } - -// --------------------------------------------------------------------------- -// Searches UPnP Media servers. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::SearchMediaserversL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - SearchMediaServersL")); - - iResponsesPending = 0; - iProgressInfo.iTotalItems = 0; - iProgressInfo.iProcessedItems = 0; - - if ( !iAvControlPoint ) - { - iSettings->GetIapL( iIap ); - // Create and start (automatic) the AV control point - TRACE( Print( _L("[CmMdh Server]\t IAP to use is %d"), iIap)); - LOG( _L("[CmMdh Server]\t Creating AV control point..." ) ); - - iAvControlPoint = CUpnpAVControlPoint::NewL( *this ); - } - - LOG( _L("[CmMdh Server]\t Creating CPeriodic timer..." ) ); - iTimer = CPeriodic::NewL(EPriorityHigh); - - TInt deviceDiscoveryDelay; - iSettings->GetDiscoveryDelay( deviceDiscoveryDelay ); - TRACE(Print(_L("[CmMdh Server]\t using device discovery delay %d\n"), - deviceDiscoveryDelay)); - - iTimer->Start(deviceDiscoveryDelay * KMicrosecondsInSecond, - 0, - TCallBack(SearchTimerCompletedL, this)); - - iMdhServer.SetServerStateL(ECmMdhServerStateSearching); - - iOldMediaServers.ResetAndDestroy(); - iDbManager->GetMediaServersL( iOldMediaServers ); - - for ( TInt i = 0; i < iOldMediaServers.Count(); i++ ) - { - if ( !iOldMediaServers[i]->FillUsage() && - iOldMediaServers[i]->SystemUpdateID() != KErrNotFound ) - { - iOldMediaServers[i]->SetSystemUpdateID( KErrNotFound ); - iDbManager->UpdateMediaServerInfo( iOldMediaServers[i] ); - } - } - - iAllFound = EFalse; - SendProgressInfo ( 0 ); - } - -// --------------------------------------------------------------------------- -// Harvests media servers -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::HarvestMediaserversL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - HarvestMediaserversL")); - - if ( !iAvControlPoint ) - { - User::Leave( KErrNotReady ); - } - - if ( !iMediaservers.Count() ) - { - User::Leave( KErrNotFound ); - } - - TBool harvestNeeded = EFalse; - for ( TInt i = 0; i < iMediaservers.Count(); i++ ) - { - if (iMediaservers[i]->iMediaserverState - == ECmMdhMediaserverNotSynchronized ) - { - harvestNeeded = ETrue; - i = iMediaservers.Count(); // break from the loop - } - } - - if ( !harvestNeeded ) - { - User::Leave( KErrAlreadyExists ); - } - - if ( !iMetadataCollector ) - { - LOG( _L("[CmMdh Server]\t Creating metadata collector.." ) ); - - TInt searchCount = KDefaultChunkSize; - TInt addGranularity = KDefaultAddGranularity; - iSettings->GetSearchCount( searchCount ); - iSettings->GetAddCount( addGranularity ); - TRACE( Print( - _L("[CmMdh Server]\t using chunk size %d and addgran %d"), - searchCount, addGranularity)); - iMetadataCollector = - CCmMdhMetadataCollector::NewL( - *this, *iAvControlPoint, searchCount, addGranularity ); - - } - iMediaserverIndex = 0; - iHarvestErrCode = KErrNone; - DoHarvestMediaserverL( iMediaserverIndex ); - - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - HarvestMediaserversL end")); - - } - -// --------------------------------------------------------------------------- -// Harvest completion callback function -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::HarvestCompleteL( TInt aErr ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::HarvestComplete")); - iHarvestActive = EFalse; - if ( aErr != KErrNone ) - { - iHarvestErrCode = aErr; - } - else - { - TInt newUpdateId = - iMediaservers[iMediaserverIndex]->iSystemUpdateId; - if ( newUpdateId ) // was set to 0 if no update needed - { - // store changed systemupdateid - CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC(); - tempServer->SetUDNL( - *(iMediaservers[iMediaserverIndex]->iUuid) ); - iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery ); - TInt errCode = iDbManager->QueryMediaServerL( tempServer ); - if ( errCode != KErrNotFound ) - { - TRACE( Print( _L - ("[CmMdh Server]\t Updating systemupdateid to %d.."), - newUpdateId )); - - tempServer->SetSystemUpdateID( newUpdateId ); - iDbManager->UpdateMediaServerInfo( tempServer ); - } - CleanupStack::PopAndDestroy( tempServer ); - } - } - - if ( ++iMediaserverIndex < iMediaservers.Count() ) - { - // harvest next - DoHarvestMediaserverL( iMediaserverIndex ); - } - else - { - // no more media servers - iMdhServer.SetServerStateL(ECmMdhServerStateIdle, iHarvestErrCode); - } - } - - -// --------------------------------------------------------------------------- -// Cancels search -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CancelSearchL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::CancelSearchL")); - if (!iTimer) // no search is active - { - User::Leave( KErrNotReady ); - } - - iTimer->Cancel(); - iMediaservers.ResetAndDestroy(); - delete iTimer; - iTimer = NULL; - iMdhServer.SetServerStateL(ECmMdhServerStateIdle, KErrCancel); - } - -// --------------------------------------------------------------------------- -// Cancels harvest -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CancelHarvestL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::CancelHarvestL")); - iHarvestActive = EFalse; - iMetadataCollector->CancelHarvest(); - iMdhServer.SetServerStateL(ECmMdhServerStateIdle, KErrCancel); - } - -// --------------------------------------------------------------------------- -// Gets media server id from database -// --------------------------------------------------------------------------- -TInt CCmMdhMediaserverContainer::IdForMediaServerL( TDesC8& aUuid ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::IdForMediaServerL")); - - iDbManager->PrepareQueryCmdL( EMediaServerIdQuery ); - - TInt id = iDbManager->QueryMediaServerId( aUuid ); - TRACE( Print( _L("[CmMdh Server]\t returning id %d"), id)); - - return id; - } - -// --------------------------------------------------------------------------- -// Sends progress info -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::SendProgressInfo( TInt aProgress ) - { - TRACE( Print( _L( - "[CmMdh Server]\t CCmMdhMediaserverContainer::\ - SendProgressInfo( %d )"), - aProgress)); - -#ifdef _DEBUG - - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE(Print(_L("[CmMdh Server]\t heap allocsize %d, size %d, cells %d"), - alloc, size, cells )); - -#endif - - - if ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems ) - { - iProgressInfo.iProcessedItems += aProgress; - TCmProgressInfoPckg progressPckg( iProgressInfo ); - TRACE( Print( _L("[CmMdh Server]\t processed: %d total %d"), - iProgressInfo.iProcessedItems, iProgressInfo.iTotalItems) ); - - if ( ( iProgressInfo.iTotalItems <= iProgressInfo.iProcessedItems ) || - ( iProgressInfo.iTotalItems > iProgressInfo.iProcessedItems && - iProgressInfo.iProcessedItems > 0 && - ( iProgressInfo.iProcessedItems - iPropertyItemIndex ) >= - iProgressInfo.iTotalItems / KDefaultCaculateSize ) - ) - { - iPropertyItemIndex = iProgressInfo.iProcessedItems; - TInt err = RProperty::Set( KCmPropertyCat, KCmProperty, - progressPckg ); - TRACE( Print( _L("[CmMdh Server]\t RProperty::Set returned %d"), - err)); - } - else - { - LOG(_L("[CmMdh Server]\t progress small no need to pub&sub")); - } - } - - else - { - iProgressInfo.iProcessedItems += aProgress; - LOG(_L("[CmMdh Server]\t Bigger than 100%% or not beginning")); - } - - } - - -// Responses - -// --------------------------------------------------------------------------- -// Observer callback for Content Directory Search function. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CdsSearchResponse( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& /*aContainerId*/, - const TDesC8& /*aSearchCriteria*/, - const TDesC8& /*aFilter*/, - TInt /*aIndex*/, - TInt /*aRequest*/, - const TDesC8& /*aSortCriteria*/, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches, - const TDesC8& /*aUpdateID*/) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - CdsSearchResponse")); - - TRAPD( err, CdsSearchResponseL( aUuid, - aSessionId, - aErr, - aResult, - aReturned, - aMatches ) ); - if ( err ) - { - TRACE( Print(_L("[CmMdh Server]\t CdsSearchResponseL leaved with err:\ - %d"), err ) ); - } - } - -// --------------------------------------------------------------------------- -// Leaving version of CdsSearchResponseL callback. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CdsSearchResponseL( - const TDesC8& aUuid, - TInt aSessionId, - TInt aErr, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches - ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - CdsSearchResponseL")); - if ( iHarvestActive ) - { - iMetadataCollector->CdsSearchResponse( - aSessionId, aErr, aResult, aReturned, aMatches ); - } - else if ( iTimer || iResponsesPending ) // media server search active - { - if ( aErr != EHttpOk ) - { - for( TInt i = 0; i < iMediaservers.Count(); i++ ) - { - if ( *(iMediaservers[i]->iUuid) == aUuid ) - { - LOG(_L("[CmMdh Server]\t search error, \ - will not sync this..")); - iMediaservers[i]->iMediaserverState = - ECmMdhMediaserverNoSearchCaps; - iMediaservers[i]->iSystemUpdateId = 0; - } - } - } - else - { - iProgressInfo.iTotalItems += aMatches; - TRACE( Print( _L("[CmMdh Server]\t total item count \ - increased to %d"), - iProgressInfo.iTotalItems)); - if( iAllFound ) - { - // when all servers are discovered,1 percentage is - // set. - SendProgressInfo( iProgressInfo.iTotalItems / - KDefaultCaculateSize ); - iProgressInfo.iProcessedItems = 0; - delete iTimer; - iTimer = NULL; - iOldMediaServers.ResetAndDestroy(); - TRACE( Print( _L("[CmMdh Server]\t All servers found!!!"))); - } - } - DecResponsesAndFinishIfReadyL(); - } - } - -// --------------------------------------------------------------------------- -// Observer callback for Content Directory SearchCapabilities function. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CdsSearchCapabilitiesResponse( - const TDesC8& aUuid, - TInt /* aSessionId */, - TInt aErr, - const TDesC8& aSearchCaps ) - { - - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - CdsSearchCapabilitiesResponse")); - - TRAPD( err, CdsSearchCapabilitiesResponseL( aUuid, - aErr, - aSearchCaps ) ); - if ( err ) - { - TRACE( Print(_L("[CmMdh Server]\t CdsSearchCapabilitiesResponseL \ - leaved with err: %d"), err ) ); - } - } - -// --------------------------------------------------------------------------- -// Leaving version of CdsSystemUpdateIdResponse callback. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CdsSearchCapabilitiesResponseL( - const TDesC8& aUuid, - TInt aErr, - const TDesC8& aSearchCaps ) - { - - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - CdsSearchCapabilitiesResponseL")); - -#ifdef _DEBUG - - HBufC* sc = UpnpString::ToUnicodeL( aSearchCaps ); - TRACE( Print(_L("[CmMdh Server]\t err: %d caps: %S"), - aErr, sc )); - delete sc; - -#endif - - - HBufC8* uuid = HBufC8::NewL( aUuid.Length() ); - uuid->Des().Copy( aUuid ); - CleanupStack::PushL( uuid ); - CCmMdhMediaserverInfo* info = CCmMdhMediaserverInfo::NewL( ); - CleanupStack::PushL( info ); - info->iUuid = uuid; - iMediaservers.AppendL( info ); - - if ( aErr == EHttpOk && aSearchCaps.Length() ) // has search capabilities - { - info->iMediaserverState = ECmMdhMediaserverNotSynchronized; - iAvControlPoint->CdsSystemUpdateIdActionL( aUuid ); - } - else - { - DecResponsesAndFinishIfReadyL(); - info->iSystemUpdateId = 0; - info->iMediaserverState = ECmMdhMediaserverNoSearchCaps; - } - - CleanupStack::Pop( info ); - CleanupStack::Pop( uuid ); - } - - -// --------------------------------------------------------------------------- -// Observer callback for Content Directory GetSystemUpdateID function. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CdsSystemUpdateIdResponse( - const TDesC8& aUuid, - TInt /* aSessionId */, - TInt aErr, - TInt aSystemUpdateId ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - CdsSystemUpdateIdResponse")); - - TRACE( Print(_L("[CmMdh Server]\t err: %d suid: %d"), - aErr, aSystemUpdateId )); - - TRAPD( err, CdsSystemUpdateIdResponseL( aUuid, - aErr, - aSystemUpdateId ) ); - if ( err ) - { - TRACE( Print(_L("[CmMdh Server]\t CdsSystemUpdateIdResponseL leaved \ - with err: %d"), err ) ); - } - } - -// --------------------------------------------------------------------------- -// Leaving version of CdsSystemUpdateIdResponse callback. -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::CdsSystemUpdateIdResponseL( - const TDesC8& aUuid, - TInt aErr, - TInt aSystemUpdateId ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - CdsSystemUpdateIdResponseL")); - - TRACE( Print(_L("[CmMdh Server]\t err: %d suid: %d"), - aErr, aSystemUpdateId )); - for( TInt i = 0; i < iMediaservers.Count(); i++ ) - { - if ( *(iMediaservers[i]->iUuid) == aUuid ) - - { - LOG(_L("[CmMdh Server]\t checking \ - media server's systemupdateid..")); - - TInt errCode = KErrNotFound; - if ( aErr == EHttpOk ) - { - CCmMediaServerFull* tempServer = CCmMediaServerFull::NewLC(); - tempServer->SetUDNL( aUuid ); - iDbManager->PrepareQueryCmdL( EMediaServerInfoQyery ); - errCode = iDbManager->QueryMediaServerL( tempServer ); - if ( errCode != KErrNotFound ) - { - TRACE( Print( _L - ("[CmMdh Server]\t returned id %d, old id %d"), - aSystemUpdateId, tempServer->SystemUpdateID() )); - - - if ( aSystemUpdateId == tempServer->SystemUpdateID() ) - { - LOG(_L("[CmMdh Server]\t systemupdateid \ - match, no sync needed..")); - iMediaservers[i]->iMediaserverState = - ECmMdhMediaserverSynchronized; - iMediaservers[i]->iSystemUpdateId = 0; - DecResponsesAndFinishIfReadyL(); - } - else - { - iMediaservers[i]->iSystemUpdateId = aSystemUpdateId; - errCode = iAvControlPoint->CdsSearchActionL( aUuid, - KRootContainerId, - KSearchCriteria, - KSearchFilter, - 0, - 1, - KSortCriteria ); - TRACE( Print( _L("[CmMdh Server]\t search \ - request returned %d"), errCode)); - } - } - CleanupStack::PopAndDestroy( tempServer ); - } - if ( aErr != EHttpOk || errCode < 0 ) - { - LOG(_L("[CmMdh Server]\t error with systemupdate \ - id response, not syncing this..")); - iMediaservers[i]->iMediaserverState = - ECmMdhMediaserverSynchronized; - iMediaservers[i]->iSystemUpdateId = 0; - DecResponsesAndFinishIfReadyL(); - } - } - } - } - - -// --------------------------------------------------------------------------- -// Observer callback for upnp utilities -// Called when wlan connection is lost -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::ConnectionLost() - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::\ - ConnectionLost")); - iHarvestActive = EFalse; - if( iMetadataCollector ) - { - iMetadataCollector->CancelHarvest(); - } - TRAP_IGNORE( iMdhServer.SetServerStateL( ECmMdhServerStateIdle, - KErrDisconnected ) ); - } - -// --------------------------------------------------------------------------- -// CCmMdhMediaserverContainer::AddHashValueForResponseL -// --------------------------------------------------------------------------- -TInt CCmMdhMediaserverContainer::AddHashValueForResponseL( - TInt aMediaServerId, - TInt aSearchIndex, - TInt aItemCount, - const TDesC8& aHash ) - { - CCmSearchResponseHash* newHash = CCmSearchResponseHash::NewL( aSearchIndex, - aItemCount, - aHash ); - CleanupStack::PushL( newHash ); - TInt errCode = iDbManager->AddHashValue( aMediaServerId, newHash ); - CleanupStack::PopAndDestroy( newHash ); - return errCode; - } - -// --------------------------------------------------------------------------- -// Gets media server hash values -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::HashValuesForMediaServerL( TInt aMediaServerId, - RPointerArray& aHashValues ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::HashValuesForMediaServerL")); - - iDbManager->PrepareQueryCmdL( EHashValueQuery ); - - TInt err = iDbManager->QueryHashValuesL( aMediaServerId, aHashValues ); - - return; - } - -// --------------------------------------------------------------------------- -// Deletes old hash values -// --------------------------------------------------------------------------- -void CCmMdhMediaserverContainer::DeleteOldHashValuesL( const TInt aMediaserverId, - const TInt aSearchIndex ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMediaserverContainer::DeleteOldHashValuesL")); - iDbManager->DeleteHashValuesL( aMediaserverId, aSearchIndex ); - } - -// End of file - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/server/mdhmetadatacollector.cpp --- a/upnpharvester/mdhserver/src/server/mdhmetadatacollector.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,490 +0,0 @@ -/* -* Copyright (c) 2007 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: Metadata Harvester server's metadata collector component -* -*/ - - - - - - - -// INCLUDE FILES -#include -#include -#include // HTTP error codes -#include -#include "cmsearchresponsehash.h" -#include "mdhmetadatacollector.h" -#include "msdebug.h" -#include "mdhmediaservercontainer.h" - -// CONSTANTS - -const TInt KSearchTimeout = 120000000; -const TInt KMaxSearchRetries = 3; -const TInt KSearchCountLimit = 1; - -// --------------------------------------------------------------------------- -// Two-phased constructor -// --------------------------------------------------------------------------- -CCmMdhMetadataCollector* CCmMdhMetadataCollector::NewL( - CCmMdhMediaserverContainer& aMediaserverContainer, - CUpnpAVControlPoint& aControlPoint, - TInt aSearchChunkSize, - TInt aAddGranularity ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::NewL")); - - CCmMdhMetadataCollector* self = new (ELeave) CCmMdhMetadataCollector ( - aMediaserverContainer, aControlPoint, - aSearchChunkSize, aAddGranularity ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -CCmMdhMetadataCollector::CCmMdhMetadataCollector( - CCmMdhMediaserverContainer& aMediaserverContainer, - CUpnpAVControlPoint& aAvControlPoint, - TInt aSearchChunkSize, - TInt aAddGranularity ) : - iMediaserverContainer( aMediaserverContainer ), - iAvControlPoint ( aAvControlPoint ), - iSearchChunkSize( aSearchChunkSize ), - iAddGranularity( aAddGranularity ) - - { - iCdsSync = NULL; - iXmlToParse = NULL; - iUuid = NULL; - iTimer = NULL; - iSearchRetryCount = 0; - iSessionId = 0; - iTempStartIndex = -1; - } - - -// --------------------------------------------------------------------------- -// 2nd phase constructor -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::ConstructL() - { - iHashGenerator = CSHA1::NewL(); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -CCmMdhMetadataCollector::~CCmMdhMetadataCollector() - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\ - ~CCmMdhMetadataCollector")); - delete iCdsSync; - delete iXmlToParse; - delete iTimer; - iSourceDataArray.ResetAndDestroy(); - delete iHashGenerator; - delete iUuid; - iHashValues.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// Harvests a media server -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::DoHarvestMediaserverL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::DoHarvestMediaserver")); - - // iUuid must be set before calling this method. - if ( !iUuid ) - { - User::Leave( KErrNotReady ); - } - -#ifdef _DEBUG - - HBufC* uuid = UpnpString::ToUnicodeL( *iUuid ); - TRACE( Print(_L("[CmMdh Server]\t search request, uuid: %S, \ - searchIndex %d, chunk size %d"), - uuid, iSearchIndex, iSearchChunkSize )); - delete uuid; - uuid = NULL; - iDebugTime.HomeTime(); - -#endif - - TInt err = iAvControlPoint.CdsSearchActionL( *iUuid, - KRootContainerId, - KSearchCriteria, - KMdhSearchFilter, - iSearchIndex, - iSearchChunkSize, - KSortCriteria ); - TRACE( Print( _L("[CmMdh Server]\t search request returned %d"), err)); - if ( err > 0 ) - { - iSessionId = err; - } - LOG( _L("[CmMdh Server]\t creating CPeriodic \ - timer for search timeout..." ) ); - iTimer = CPeriodic::NewL(EPriorityHigh); - iTimer->Start(KSearchTimeout, 0, TCallBack(TimeoutTimerCompletedL, this)); - - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\ - DoHarvestMediaserver end")); - - } - -// --------------------------------------------------------------------------- -// Harvests a media server -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::HarvestMediaserverL( TDesC8& aUuid ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::HarvestMediaserver")); - iSearchIndex = 0; - delete iUuid; iUuid = NULL; - iUuid = aUuid.AllocL(); - iItemsToParse = 0; - -#ifdef _DEBUG - - HBufC* uuid = UpnpString::ToUnicodeL( aUuid ); - - TRACE( Print( _L("[CmMdh Server]\t starting \ - to harvest, uuid: %S"), uuid)); - delete uuid; - -#endif - - if ( !iCdsSync ) - { - iCdsSync = CCdsSync::NewL(); - } - iResultIncomplete = ETrue; - iCanceled = EFalse; - iSearchRetryCount = 0; - iSourceDataArray.ResetAndDestroy(); - iHashValues.ResetAndDestroy(); - - iMediaServerId = iMediaserverContainer.IdForMediaServerL( aUuid ); - iMediaserverContainer.HashValuesForMediaServerL( iMediaServerId, iHashValues ); - - iCdsSync->InitL( iSourceDataArray, - iMediaServerId, - *this, - iAddGranularity ); - - DoHarvestMediaserverL(); - - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\ - HarvestMediaserver end")); - } - -// --------------------------------------------------------------------------- -// Cancels harvest -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::CancelHarvest() - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::CancelHarvestL")); - if( iCdsSync ) - { - // cancel parsing and mde operations - TRAP_IGNORE( iCdsSync->ResetL() ); - } - if ( iTimer ) - { - iTimer->Cancel(); - delete iTimer; iTimer = NULL; - } - - // Remove old hash values - TRAP_IGNORE(iMediaserverContainer.DeleteOldHashValuesL( - iMediaServerId, - iTempStartIndex ) ); - - iTempStartIndex = -1; - iSourceDataArray.ResetAndDestroy(); - iCanceled = ETrue; - } - - -// --------------------------------------------------------------------------- -// Static timer callback function -// --------------------------------------------------------------------------- -TInt CCmMdhMetadataCollector::TimeoutTimerCompletedL(TAny* aInstance) - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\ - TimeoutTimerCompletedL")); - return static_cast - ( aInstance )->DoTimeoutTimerCompletedL(); - } - -// --------------------------------------------------------------------------- -// Timer callback function -// --------------------------------------------------------------------------- -TInt CCmMdhMetadataCollector::DoTimeoutTimerCompletedL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::\ - DoTimeoutTimerCompletedL")); - - delete iTimer; iTimer = NULL; - - iMediaserverContainer.HarvestCompleteL( KErrTimedOut ); - - return KErrNone; - } - - - -// --------------------------------------------------------------------------- -// Observer callback for Content Directory Search function. -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::CdsSearchResponse( TInt aSessionId, - TInt aErr, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::CdsSearchResponse")); - TRACE( Print( _L("[CmMdh Server]\t session %d err %d \ - returned:%d matches %d"), - aSessionId, aErr, aReturned, aMatches) ); - - - TRAPD( err, HandleSearchResponseL( aSessionId, - aErr, - aResult, - aReturned, - aMatches ) ); - - if ( err ) - { - TRACE( Print( _L("[CmMdh Server]\t HandleSearchResponse leaved with \ - error %d"), err ) ); - } - } - -// --------------------------------------------------------------------------- -// Handles search response. -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::HandleSearchResponseL( TInt aSessionId, - TInt aErr, - const TDesC8& aResult, - TInt aReturned, - TInt aMatches ) - { - LOG(_L( - "[CmMdh Server]\t CCmMdhMetadataCollector::HandleSearchResponseL") ); - - if ( iSessionId != aSessionId ) - { - LOG( _L("[CmMdh Server]\t session id mismatch, returning..")); - return; - } - else - { - iSessionId = 0; - } - -#ifdef _DEBUG - TTime tempTime; - tempTime.HomeTime(); - - TRACE( Print( _L("[CmMdh Server]\t search request took %ld microsec"), - tempTime.MicroSecondsFrom( iDebugTime ).Int64() )); -#endif - - if ( iTimer ) - { - iTimer->Cancel(); - delete iTimer; - iTimer = NULL; - } - - if ( iXmlToParse ) - { - LOG( _L("[CmMdh Server]\t deleting old xml buffer..")); - - delete iXmlToParse; - iXmlToParse = NULL; - } - - if ( iCanceled ) - { - LOG(_L("[CmMdh Server]\t harvest canceled, returning..")); - return; - } - - if ( aErr && aErr != EHttpOk ) - { - if ( aErr == EActionFailed && - iSearchRetryCount++ < KMaxSearchRetries ) - // 501 = EActionFailed, retrying - { - TRACE( Print( _L("[CmMdh Server]\t retrying search, retry #%d"), - iSearchRetryCount )); - DoHarvestMediaserverL(); - } - else - { - LOG(_L("[CmMdh Server]\t Unrecoverable response \ - error, aborting.. ")); - delete iTimer; iTimer = NULL; - iMediaserverContainer.HarvestCompleteL( aErr ); - } - return; - } - - // Check the hash value (or should it be checked in the cdssync side...?) - iHashGenerator->Reset(); - iHashGenerator->Update( aResult ); - TPtrC8 hashValue = iHashGenerator->Final(); - - TBool foundMatch( EFalse ); - for ( TInt index(0); index < iHashValues.Count() && !foundMatch; index++ ) - { - CCmSearchResponseHash* hashInstance = iHashValues[index]; - if ( hashInstance->StartIndex() == iSearchIndex - && hashInstance->ItemCount() == aReturned - && hashInstance->Hash() == hashValue ) - { - LOG( _L("[CmMdh Server]\t FOUND HASH MATCH!!")); - foundMatch = ETrue; - // Update last matching search chuck to cds sync component - iCdsSync->SetSearchIndex( iSearchIndex + aReturned ); - } - } - - if ( !foundMatch ) - { - // Before updating hash values, remove all changed hash values - iMediaserverContainer.DeleteOldHashValuesL( iMediaServerId, - iSearchIndex ); - - iMediaserverContainer.AddHashValueForResponseL( iMediaServerId, - iSearchIndex, - aReturned, - hashValue ); - - // Save information about hash value in database in order to delete it - iTempStartIndex = iSearchIndex; - - TRACE( Print( _L("[CmMdh Server]\t HASH= Index:%d\tCount:%d\tHash:%S"), - iSearchIndex, aReturned, &hashValue )); - - iSearchIndex += aReturned; - iResultIncomplete = iSearchIndex < aMatches; - iSearchRetryCount = 0; - iItemsToParse = aReturned; - HBufC8* xmlToParse = aResult.AllocL(); - iSourceDataArray.Append( xmlToParse ); - TRACE( Print( _L("[CmMdh Server]\t source data array has %d items"), - iSourceDataArray.Count() )); - - iCdsSync->NotifySourceDataAddedL( !iResultIncomplete ); - - if ( iResultIncomplete && iCdsSync->ChunkCount() < KSearchCountLimit ) - { - DoHarvestMediaserverL(); - } - } - else // Found matching parsed search response - { - iSearchIndex += aReturned; - iResultIncomplete = iSearchIndex < aMatches; - iSearchRetryCount = 0; - iItemsToParse = aReturned; - // Send progress - iMediaserverContainer.SendProgressInfo( aReturned ); - - if ( iResultIncomplete && iCdsSync->ChunkCount() < KSearchCountLimit ) - { - DoHarvestMediaserverL(); - } - else - { - iMediaserverContainer.HarvestCompleteL( KErrNone ); - } - } - } - - -// --------------------------------------------------------------------------- -// Sends progress data -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::ProgressL( TInt aItemCount ) - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::ProgressL")); - - iMediaserverContainer.SendProgressInfo( aItemCount ); - - } - -// --------------------------------------------------------------------------- -// Cds Sync chunk completion callback function -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::ChunkCompleteL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::ChunkCompleteL")); - - // to check if all of the items have been processed successfully - // If it is not, the percentage need to be increased for those - // items that are not processed successfully - TInt processedItems = iCdsSync->ProcessedItemCount(); - if ( iItemsToParse > processedItems ) - { - ProgressL( iItemsToParse - processedItems ); - } - if ( iResultIncomplete && iCdsSync->ChunkCount() < KSearchCountLimit ) - { - DoHarvestMediaserverL(); - } - } - -// --------------------------------------------------------------------------- -// Cds Sync completion callback function -// --------------------------------------------------------------------------- -void CCmMdhMetadataCollector::SyncCompleteL() - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::SyncCompleteL")); - if ( iCanceled ) - { - LOG(_L("[CmMdh Server]\t harvest canceled, returning..")); - return; - } - - iMediaserverContainer.HarvestCompleteL( KErrNone ); - } - -// --------------------------------------------------------------------------- -// Cds Sync error callback function -// --------------------------------------------------------------------------- -#ifdef _DEBUG -void CCmMdhMetadataCollector::SyncErrorL( TInt aError ) -#else // _DEBUG -void CCmMdhMetadataCollector::SyncErrorL( TInt /*aError*/ ) -#endif // _DEBUG - { - LOG(_L("[CmMdh Server]\t CCmMdhMetadataCollector::SyncErrorL")); - TRACE( Print( _L("[CmMdh Server]\t error is %d"), aError )); - } - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/server/mdhserver.cpp --- a/upnpharvester/mdhserver/src/server/mdhserver.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,341 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Server core -* -*/ - - - - - - -#include - -#include "mdhserver.h" -#include "mdhcommon.h" -#include "mdhserversession.h" -#include "mdhmediaservercontainer.h" - -#include "msdebug.h" - -// ============================ MEMBER FUNCTIONS ============================= - -// --------------------------------------------------------------------------- -// CCmMdhServer::CCmMdhServer -// constructor -// --------------------------------------------------------------------------- -// -CCmMdhServer::CCmMdhServer() - : CPolicyServer( CActive::EPriorityHigh, KCmMdhServerPolicy ) - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::CCmMdhServer")); - iServerState = ECmMdhServerStateIdle; - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::ConstructL -// 2nd phase constructor -// --------------------------------------------------------------------------- -// -void CCmMdhServer::ConstructL() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::ConstructL")); - - iSessionCount = 0; - - StartL( KCmMdhServerName ); - - LOG(_L("[CmMdh Server]\t CCmMdhServer::ConstructL end")); - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::NewLC -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -CCmMdhServer* CCmMdhServer::NewLC() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::NewLC")); - CCmMdhServer *self = new (ELeave) CCmMdhServer(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::~CCmMdhServer -// destructor -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -CCmMdhServer::~CCmMdhServer() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::~CCmMdhServer")); - delete iMediaserverContainer; - LOG(_L("[CmMdh Server]\t CCmMdhServer::~CCmMdhServer end")); - } - -// --------------------------------------------------------------------------- -// CCmMdhServer:: -// -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmMdhServer::CreateMediaserverContainerL() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::CreateMediaserverContainerL")); - - if ( !iMediaserverContainer ) - { - iMediaserverContainer = - CCmMdhMediaserverContainer::NewL( *this ); - LOG(_L("[CmMdh Server]\t MediaserverContainer created")); - } - - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::DestroyMediaserverContainer -// -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmMdhServer::DestroyMediaserverContainer() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::DestroyMediaserverContainer")); - - if ( iMediaserverContainer ) - { - delete iMediaserverContainer; iMediaserverContainer = NULL; - LOG(_L("[CmMdh Server]\t MediaserverContainer destroyed")); - } - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::MediaserverContainer -// -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -CCmMdhMediaserverContainer& CCmMdhServer::MediaserverContainer() - { - return *iMediaserverContainer; - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::NewSessionL -// Creates a new session to the server if version information is correct. -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -CSession2* CCmMdhServer::NewSessionL( const TVersion & aVersion, - const RMessage2 &/*aMessage*/) const - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::NewSessionL")); - -#ifdef _DEBUG - - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE( Print( - _L("[CmMdh Server]\t NewSessionL allocsize %d, size %d, cells %d"), - alloc, - size, - cells ) ); - -#endif - - // check we're the right version - TVersion version( KCmMdhServerMajor, - KCmMdhServerMinor, - KCmMdhServerBuild); - - if( !User::QueryVersionSupported( version, aVersion ) ) - { - User::Leave( KErrNotSupported ); - } - // make new session - return CCmMdhSession::NewL( iMediaserverContainer, - *const_cast(this) ); - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::SetServerStateL -// -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmMdhServer::SetServerStateL( TCmMdhServerState aServerState, - TInt aErrCode /* = KErrNone */) - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::SetServerState")); - TRACE( Print( _L("[CmMdh Server]\t Setting server state from %d to %d"), - iServerState, aServerState)); - - if ( iServerState == aServerState ) - { - return; - } - - TBool validTransition = EFalse; - - switch ( iServerState ) - { - case ECmMdhServerStateIdle: - if ( aServerState ) // search or harvest started - { - validTransition = ETrue; - } - break; - case ECmMdhServerStateSearching: - if ( aServerState == ECmMdhServerStateIdle ) // search complete - { - if ( aErrCode ) - { - //DestroyMediaserverContainer(); - } - iCurrentAsyncMsg.Complete( aErrCode ); - validTransition = ETrue; - } - break; - case ECmMdhServerStateHarvesting: - if ( aServerState == ECmMdhServerStateIdle ) // harvest complete - { - //DestroyMediaserverContainer(); - LOG(_L("[CmMdh Server]\t Completing...")); - iCurrentAsyncMsg.Complete( aErrCode ); - LOG(_L("[CmMdh Server]\t Completed...")); - validTransition = ETrue; - if ( iSessionCount <= 0) - { - // shutdown server - LOG(_L("[CmMdh Server]\t Harvest complete, \ - shutting down..")); - CActiveScheduler::Stop(); - } - } - break; - default: - // nothing - break; - } - if (validTransition) - { - iServerState = aServerState; - } - else - { - User::Leave( KErrNotReady ); - } - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::DecrementSessions -// -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmMdhServer::DecrementSessions() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::DecrementSessions")); - - if ( --( iSessionCount) <= 0 - && iServerState!= ECmMdhServerStateHarvesting ) - { - LOG(_L("[CmMdh Server]\t Destroying media server container...")); - DestroyMediaserverContainer(); - // shutdown server - LOG(_L("[CmMdh Server]\t No sessions left, shutting down..")); - CActiveScheduler::Stop(); - } -#ifdef _DEBUG - - TInt alloc; - TInt cells = User::Heap().AllocSize( alloc ); - TInt size = User::Heap().Size(); - TRACE( Print( - _L( - "[CmMdh Server]\t DecrementSessions allocsize %d, size %d, cells %d" - ), - alloc, - size, - cells )); -#endif - } - -// -------------------------------------------------------------------------- -// CCmMdhServer::IncrementSessions -// -------------------------------------------------------------------------- -void CCmMdhServer::IncrementSessions() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::IncrementSessions")) - ++iSessionCount; - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::ServerState -// -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -TCmMdhServerState CCmMdhServer::ServerState() - { - LOG(_L("[CmMdh Server]\t CCmMdhServer::ServerState")); - return iServerState; - } - -// --------------------------------------------------------------------------- -// CCmMdhServer::SetCurrentAsyncMsg -// -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmMdhServer::SetCurrentAsyncMsg( const RMessage2& aMessage ) - { - LOG(_L("[CmMdh Server]\t CCmServer::SetCurrentAsyncMsg")); - iCurrentAsyncMsg = aMessage; - } - - -// ========================== OTHER EXPORTED FUNCTIONS ======================= - -// --------------------------------------------------------------------------- -// PanicServer -// Server panic handler -// Panic our own thread -// --------------------------------------------------------------------------- -// -void PanicServer(TInt aPanic) - { - TRACE(Print(_L("[CmMdh Server]\t PanicServer: Reason = %d\n"), aPanic)); - User::Panic( KCmMdhServerPanic, aPanic ); - } - -// --------------------------------------------------------------------------- -// PanicClient -// Client panic handler -// RMessage2::Panic() also completes the message. This is: -// (a) important for efficient cleanup within the kernel -// (b) a problem if the message is completed a second time -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void PanicClient( const RMessage2& aMessage, TInt aPanic ) - { - TRACE(Print(_L("[CmMdh Server]\t PanicClient: Reason = %d\n"), aPanic)); - aMessage.Panic( KCmMdhServerPanic, aPanic ); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/server/mdhservermain.cpp --- a/upnpharvester/mdhserver/src/server/mdhservermain.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Main functions to start the Metadata Harvester server -* -*/ - - - - - - -// INCLUDE FILES -#include "mdhserver.h" -#include "mdhcommon.h" -#include "msdebug.h" - - -// LOCAL FUNCTION PROTOTYPES -void RunServerL(); - - -// ============================= LOCAL FUNCTIONS ============================= - -// --------------------------------------------------------------------------- -// E32Main -// -// Module entry point -// --------------------------------------------------------------------------- -// - -TInt E32Main() - { - LOG(_L("[CmMdh Server]\t E32Main")); - - __UHEAP_MARK; - CTrapCleanup* cleanup = CTrapCleanup::New(); - TInt error = KErrNoMemory; - if ( cleanup ) - { - TRAP( error, RunServerL() ); - delete cleanup; - } - __UHEAP_MARKEND; - - return error; - } - - -// --------------------------------------------------------------------------- -// RunServerL -// -// Constructs Active Scheduler and starts the server up & running -// --------------------------------------------------------------------------- -// -void RunServerL() - { - LOG(_L("[CmMdh Server]\t RunServerL")); - // Create and install the active scheduler we need - CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler; - CleanupStack::PushL( scheduler ); - CActiveScheduler::Install( scheduler ); - - // Create server - CCmMdhServer* server = CCmMdhServer::NewLC(); - - // Initialisation complete, now signal the client - User::LeaveIfError( RThread().RenameMe( KCmMdhServerName ) ); - RProcess::Rendezvous( KErrNone ); - - // Ready to run - CActiveScheduler::Start(); - - // Cleanup the server and scheduler - CleanupStack::PopAndDestroy( server ); - CleanupStack::PopAndDestroy( scheduler ); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/mdhserver/src/server/mdhserversession.cpp --- a/upnpharvester/mdhserver/src/server/mdhserversession.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005 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: Session implementation class for Metadata Harvester Server -* -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include "mdhserversession.h" -#include "mdhcommon.h" -#include "mdhserver.h" -#include "mdhmediaservercontainer.h" - -#include "msdebug.h" - - -// ============================ MEMBER FUNCTIONS ============================= -// --------------------------------------------------------------------------- -// Two-phase API constructor -// --------------------------------------------------------------------------- -// -CCmMdhSession* CCmMdhSession::NewL( - CCmMdhMediaserverContainer* aMediaserverContainer, CCmMdhServer& aServer ) - { - LOG(_L("[CmMdh Server]\t CCmMdhSession::NewL")); - CCmMdhSession* self = - new (ELeave) CCmMdhSession( aMediaserverContainer, aServer ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -CCmMdhSession::CCmMdhSession( - CCmMdhMediaserverContainer* aMediaserverContainer, - CCmMdhServer& aServer ): iServer( aServer ) - { - iMediaserverContainer = aMediaserverContainer; - } - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -void CCmMdhSession::ConstructL() - { - LOG(_L("[CmMdh Server]\t CCmMdhSession::ConstructL")) - iServer.IncrementSessions(); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CCmMdhSession::~CCmMdhSession() - { - LOG(_L("[CmMdh Server]\t CCmMdhSession::~CCmMdhSession")); - iServer.DecrementSessions(); - } - -// --------------------------------------------------------------------------- -// CCmMdhSession::Server -// Returns a reference to server -// --------------------------------------------------------------------------- -// -CCmMdhServer& CCmMdhSession::Server() - { - return *static_cast - (const_cast(CSession2::Server())); - } - -// --------------------------------------------------------------------------- -// CCmMdhSession::CompleteIfBusy -// Completes message with busy error code if server is busy -// --------------------------------------------------------------------------- -TBool CCmMdhSession::CompleteIfBusy(const RMessage2& aMessage) - { - if (iServer.ServerState()) // operation already in progress - { - aMessage.Complete(KErrInUse); - return ETrue; - } - return EFalse; - } - -// --------------------------------------------------------------------------- -// CCmMdhSession::ServiceL -// Implements CSession2 -derived ServiceL -method. -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -void CCmMdhSession::ServiceL(const RMessage2& aMessage) - { - LOG(_L("[CmMdh Server]\t CCmMdhSession::ServiceL")); - - switch ( aMessage.Function() ) - { - case ECmMdhSearchMediaservers: - { - LOG(_L("[CmMdh Server]\t ECmMdhSearchMediaServers request")); - if ( !CompleteIfBusy(aMessage) ) - { - iServer.SetCurrentAsyncMsg( aMessage ); - iServer.CreateMediaserverContainerL(); - iServer.MediaserverContainer().SearchMediaserversL(); - } - break; - } - case ECmMdhHarvest: - { - LOG(_L("[CmMdh Server]\t ECmMdhHarvest request")); - iServer.SetCurrentAsyncMsg( aMessage ); - iServer.CreateMediaserverContainerL(); - iServer.MediaserverContainer().HarvestMediaserversL(); - break; - } - case ECmMdhCancel: - { - LOG(_L("[CmMdh Server]\t ECmMdhCancel request")); - switch ( iServer.ServerState() ) - { - case ECmMdhServerStateSearching: - { - iServer.MediaserverContainer().CancelSearchL(); - iServer.DestroyMediaserverContainer(); - - aMessage.Complete( KErrNone ); - break; - } - case ECmMdhServerStateHarvesting: - { - iServer.MediaserverContainer().CancelHarvestL(); - iServer.DestroyMediaserverContainer(); - - aMessage.Complete( KErrNone ); - break; - } - default: - { - aMessage.Complete( KErrNotReady ); - break; - } - } - break; - } - default: - { - // Unknown opcode --> panic client - PanicClient( aMessage, ECmMdhClientBadRequest ); - break; - } - } - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/rom/bld.inf --- a/upnpharvester/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 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" -* 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 information file for CM Metadata Harvester ROM -* -*/ - - - - - - -#include "../../group/upnpplatformvar.hrh" - - -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS -../install/upnpharvester_stub.SIS /epoc32/data/z/system/install/upnpharvester_stub.sis -../install/10281fab.cre /epoc32/release/armv5/urel/z/private/10202be9/10281fab.cre -../rom/upnpharvester.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpharvester.iby) - -PRJ_MMPFILES - -PRJ_TESTMMPFILES - -PRJ_TESTEXPORTS - -// None - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpharvester/rom/upnpharvester.iby --- a/upnpharvester/rom/upnpharvester.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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: upnpharvester -* -*/ - - - - -#ifndef __UPNPHARVESTER_IBY__ -#define __UPNPHARVESTER_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - -#include - -// Application and setup wizard - -file=ABI_DIR\BUILD_DIR\cmsqlwrapper.dll \sys\bin\cmsqlwrapper.dll -file=ABI_DIR\BUILD_DIR\cmcommon.dll \sys\bin\cmcommon.dll -file=ABI_DIR\BUILD_DIR\cmdatabasemanager.dll \sys\bin\cmdatabasemanager.dll -file=ABI_DIR\BUILD_DIR\cmmdhclient.dll \sys\bin\cmmdhclient.dll -file=ABI_DIR\BUILD_DIR\cmmdh.exe \sys\bin\cmmdh.exe -file=ABI_DIR\BUILD_DIR\cmsettingsengine.dll \sys\bin\cmsettingsengine.dll -file=ABI_DIR\BUILD_DIR\cdssync.dll \sys\bin\cdssync.dll -data=\epoc32\release\armv5\urel\z\private\10202be9\10281FAB.txt \private\10202be9\10281FAB.txt - -// export upnpharvester_stub.sis file -data=ZSYSTEM\install\upnpharvester_stub.sis system\install\upnpharvester_stub.sis - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPHARVESTER_IBY__ \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpdataservetransaction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpdataservetransaction.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,68 @@ +/** @file + * 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: CUpnpHttpDataServeTransaction declaration. + * + */ +#ifndef UPNPHTTPFILESERVETRANSACTION_H_ +#define UPNPHTTPFILESERVETRANSACTION_H_ + +#include "upnphttpservertransaction.h" + +class CUpnpDlnaFilter; +class CUpnpDlnaFilterHeaders; +class TInetAddr; + +class CUpnpHttpDataServeTransaction: public CUpnpHttpServerTransaction + { +public: + ~CUpnpHttpDataServeTransaction(); + + const TDesC8& SenderUri(); + + HBufC16* PathWithNewMethodL(); + + static CUpnpHttpDataServeTransaction* NewL( + CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri ); + + CUpnpDlnaFilterHeaders& FilterHeaders(); + +public: + virtual void OnCallbackL( TUpnpHttpServerEvent aEvent ); + + TBool IsOnFlyTransCoded(); + +protected: + CUpnpHttpDataServeTransaction( CUpnpDlnaFilter& aClientContext ); + void ConstructL( const TInetAddr& aSender, const TDesC8& aSenderUri ); + +private: + void DoCallbackL( TUpnpHttpServerEvent aEvent ); + + void InitializeFilterHeadersL(); + +private: + // Sender Uri. + HBufC8* iSenderUri; + // Sender address. + TInetAddr iSender; + + CUpnpDlnaFilter& iClientContext; + CUpnpDlnaFilterHeaders* iFilterHeaders; + + TFileName iPathWithNewMethod; + + TBool iIsOnFlyTransCoded; + }; + +#endif /* UPNPHTTPFILESERVETRANSACTION_H_ */ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpfileservetransaction.h --- a/upnpmediaserver/contentdirectoryservice/inc/dlna/upnphttpfileservetransaction.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/** @file - * 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: CUpnpHttpFileServeTransaction declaration. - * - */ -#ifndef UPNPHTTPFILESERVETRANSACTION_H_ -#define UPNPHTTPFILESERVETRANSACTION_H_ - -#include "upnphttpservertransaction.h" - -class CUpnpDlnaFilter; -class CUpnpDlnaFilterHeaders; -class TInetAddr; - -class CUpnpHttpFileServeTransaction: public CUpnpHttpServerTransaction - { -public: - ~CUpnpHttpFileServeTransaction(); - - const TDesC8& SenderUri(); - - HBufC16* PathWithNewMethodL(); - - static CUpnpHttpFileServeTransaction* NewL( - CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri ); - - CUpnpDlnaFilterHeaders& FilterHeaders(); - -public: - virtual void OnCallbackL( TUpnpHttpServerEvent aEvent ); - -protected: - CUpnpHttpFileServeTransaction( CUpnpDlnaFilter& aClientContext ); - void ConstructL( const TInetAddr& aSender, const TDesC8& aSenderUri ); - -private: - void DoCallbackL( TUpnpHttpServerEvent aEvent ); - - void InitializeFilterHeadersL(); - -private: - // Sender Uri. - HBufC8* iSenderUri; - // Sender address. - TInetAddr iSender; - - CUpnpDlnaFilter& iClientContext; - CUpnpDlnaFilterHeaders* iFilterHeaders; - - TFileName iPathWithNewMethod; - }; - -#endif /* UPNPHTTPFILESERVETRANSACTION_H_ */ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpdataservetransaction.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpdataservetransaction.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,208 @@ +/** @file + * 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: CUpnpHttpDataServeTransaction implementation. + * + */ +#include "upnphttpdataservetransaction.h" +#include "upnpdlnafilter.h" +#include "upnpdlnafilterheaders.h" +#include "upnperrors.h" +#include "upnpcons.h" + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::NewL +// +// --------------------------------------------------------------------------- +// +CUpnpHttpDataServeTransaction* CUpnpHttpDataServeTransaction::NewL( + CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri ) + { + CUpnpHttpDataServeTransaction* self = + new (ELeave) CUpnpHttpDataServeTransaction( aClientContext ); + CleanupStack::PushL( self ); + self->ConstructL( aSender, aUri ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::ConstructL +// +// --------------------------------------------------------------------------- +// +void CUpnpHttpDataServeTransaction::ConstructL( + const TInetAddr& aSender, const TDesC8& aSenderUri ) + { + iFilterHeaders = CUpnpDlnaFilterHeaders::NewL( ); + iSender = aSender; + iSenderUri = aSenderUri.AllocL(); + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::FilterHeaders +// +// --------------------------------------------------------------------------- +// +CUpnpDlnaFilterHeaders& CUpnpHttpDataServeTransaction::FilterHeaders() + { + return *iFilterHeaders; + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::CUpnpHttpDataServeTransaction +// +// --------------------------------------------------------------------------- +// +CUpnpHttpDataServeTransaction::CUpnpHttpDataServeTransaction( CUpnpDlnaFilter& aClientContext ) + : iClientContext( aClientContext ) + { } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::~CUpnpHttpDataServeTransaction +// +// --------------------------------------------------------------------------- +// +CUpnpHttpDataServeTransaction::~CUpnpHttpDataServeTransaction() + { + delete iFilterHeaders; + delete iSenderUri; + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::OnCallbackL +// +// --------------------------------------------------------------------------- +// +void CUpnpHttpDataServeTransaction::OnCallbackL( TUpnpHttpServerEvent aEvent ) + { + TRAPD( err, DoCallbackL( aEvent ) ); + if ( err ) + { + SetHttpCode( err ); + } + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::IsOnFlyTransCoded +// --------------------------------------------------------------------------- +// +TBool CUpnpHttpDataServeTransaction::IsOnFlyTransCoded() + { + return iIsOnFlyTransCoded; + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::SenderUri +// +// --------------------------------------------------------------------------- +// +const TDesC8& CUpnpHttpDataServeTransaction::SenderUri() + { + return *iSenderUri; + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::PathWithNewMethodL +// +// --------------------------------------------------------------------------- +// +HBufC16* CUpnpHttpDataServeTransaction::PathWithNewMethodL() + { + return iPathWithNewMethod.AllocL(); + } + +// --------------------------------------------------------------------------- +// CUpnpHttpDataServeTransaction::DoCallbackL +// +// --------------------------------------------------------------------------- +// +void CUpnpHttpDataServeTransaction::DoCallbackL( TUpnpHttpServerEvent aEvent ) + { + switch ( aEvent ) + { + case EOnRequestStart: + { + // 1. Format request file path + // + + TRAPD( error, iClientContext.FormatPathL( this, iPathWithNewMethod ) ); + + if ( error != KErrNone ) + { + SetHttpCode( error ); + } + else if ( iPathWithNewMethod.Length() == 0 ) + { + SetHttpCode( -EHttpNotFound ); + // Bad name, so such file doesn't exist and cannot be returned. + } + else + { + _LIT( KTranscodedTag, "?transcoded=true"); + if( iPathWithNewMethod.Find(KTranscodedTag()) >= 0 ) + { + iIsOnFlyTransCoded = ETrue; + TFileName fileName(iPathWithNewMethod); + iPathWithNewMethod.Zero(); + iPathWithNewMethod.Append( + fileName.Mid(0,fileName.Find(KTranscodedTag())) ); + } + error = iClientContext.AuthorizeRequestL( iPathWithNewMethod, iSender ); + if ( error == KErrNone ) + { + RFile file; + if ( file.Open( iClientContext.FileSession(), + iPathWithNewMethod, + EFileShareReadersOnly | EFileRead ) == KErrNone ) + { + SetDataSourceL( file ); + } + else + { + SetHttpCode( -EHttpNotFound ); + } + } + else + { + SetHttpCode( error ); + } + } + break; + } + case EOnComplete: + break; + case EOnResponseStart: + InitializeFilterHeadersL(); + SetHttpCode( iClientContext.PrepareHeaderL( *this ) ); + break; + default: + break; + } + } + +void CUpnpHttpDataServeTransaction::InitializeFilterHeadersL() + { + //Copy current KHdrContentFeatures and KHdrTransferMode to filterHeaders + if ( QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ).Length() > 0 ) + { + iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrContentFeatures, + QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ) ); + } + if ( QueryRequestHeader( UpnpDLNA::KHdrTransferMode ).Length() > 0 ) + { + iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrTransferMode, + QueryRequestHeader( UpnpDLNA::KHdrTransferMode ) ); + } + } + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpfileservetransaction.cpp --- a/upnpmediaserver/contentdirectoryservice/src/dlna/upnphttpfileservetransaction.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -/** @file - * 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: CUpnpHttpFileServeTransaction implementation. - * - */ -#include "upnphttpfileservetransaction.h" -#include "upnpdlnafilter.h" -#include "upnpdlnafilterheaders.h" -#include "upnperrors.h" -#include "upnpcons.h" - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::NewL -// -// --------------------------------------------------------------------------- -// -CUpnpHttpFileServeTransaction* CUpnpHttpFileServeTransaction::NewL( - CUpnpDlnaFilter& aClientContext, const TInetAddr& aSender, const TDesC8& aUri ) - { - CUpnpHttpFileServeTransaction* self = - new (ELeave) CUpnpHttpFileServeTransaction( aClientContext ); - CleanupStack::PushL( self ); - self->ConstructL( aSender, aUri ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::ConstructL -// -// --------------------------------------------------------------------------- -// -void CUpnpHttpFileServeTransaction::ConstructL( - const TInetAddr& aSender, const TDesC8& aSenderUri ) - { - iFilterHeaders = CUpnpDlnaFilterHeaders::NewL( ); - iSender = aSender; - iSenderUri = aSenderUri.AllocL(); - } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::FilterHeaders -// -// --------------------------------------------------------------------------- -// -CUpnpDlnaFilterHeaders& CUpnpHttpFileServeTransaction::FilterHeaders() - { - return *iFilterHeaders; - } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::CUpnpHttpFileServeTransaction -// -// --------------------------------------------------------------------------- -// -CUpnpHttpFileServeTransaction::CUpnpHttpFileServeTransaction( CUpnpDlnaFilter& aClientContext ) - : iClientContext( aClientContext ) - { } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::~CUpnpHttpFileServeTransaction -// -// --------------------------------------------------------------------------- -// -CUpnpHttpFileServeTransaction::~CUpnpHttpFileServeTransaction() - { - delete iFilterHeaders; - delete iSenderUri; - } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::OnCallbackL -// -// --------------------------------------------------------------------------- -// -void CUpnpHttpFileServeTransaction::OnCallbackL( TUpnpHttpServerEvent aEvent ) - { - TRAPD( err, DoCallbackL( aEvent ) ); - if ( err ) - { - SetHttpCode( err ); - } - } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::SenderUri -// -// --------------------------------------------------------------------------- -// -const TDesC8& CUpnpHttpFileServeTransaction::SenderUri() - { - return *iSenderUri; - } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::PathWithNewMethodL -// -// --------------------------------------------------------------------------- -// -HBufC16* CUpnpHttpFileServeTransaction::PathWithNewMethodL() - { - return iPathWithNewMethod.AllocL(); - } - -// --------------------------------------------------------------------------- -// CUpnpHttpFileServeTransaction::DoCallbackL -// -// --------------------------------------------------------------------------- -// -void CUpnpHttpFileServeTransaction::DoCallbackL( TUpnpHttpServerEvent aEvent ) - { - switch ( aEvent ) - { - case EOnRequestStart: - { - // 1. Format request file path - // - - TRAPD( error, iClientContext.FormatPathL( this, iPathWithNewMethod ) ); - - - if ( error != KErrNone ) - { - SetHttpCode( error ); - } - else if ( iPathWithNewMethod.Length() == 0 ) - { - SetHttpCode( -EHttpNotFound ); - // Bad name, so such file doesn't exist and cannot be returned. - } - else - { - error = iClientContext.AuthorizeRequestL( iPathWithNewMethod, iSender ); - if ( error == KErrNone ) - { - RFile file; - if ( file.Open( iClientContext.FileSession(), - iPathWithNewMethod, - EFileShareReadersOnly | EFileRead ) == KErrNone ) - { - SetDataSourceL( file ); - } - else - { - SetHttpCode( -EHttpNotFound ); - } - } - else - { - SetHttpCode( error ); - } - } - break; - } - case EOnComplete: - break; - case EOnResponseStart: - InitializeFilterHeadersL(); - SetHttpCode( iClientContext.PrepareHeaderL( *this ) ); - break; - default: - break; - } - } - -void CUpnpHttpFileServeTransaction::InitializeFilterHeadersL() - { - //Copy current KHdrContentFeatures and KHdrTransferMode to filterHeaders - if ( QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ).Length() > 0 ) - { - iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrContentFeatures, - QueryRequestHeader( UpnpDLNA::KHdrContentFeatures ) ); - } - if ( QueryRequestHeader( UpnpDLNA::KHdrTransferMode ).Length() > 0 ) - { - iFilterHeaders->AddHeaderL( UpnpDLNA::KHdrTransferMode, - QueryRequestHeader( UpnpDLNA::KHdrTransferMode ) ); - } - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmediaserver/rom/bld.inf --- a/upnpmediaserver/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/** @file -* Copyright (c) 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" -* 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 info for the UPnP Stack subsystem ROM -* -*/ - -#include - -PRJ_PLATFORMS -WINSCW ARMV5 -//DEFAULT - -PRJ_EXPORTS -../rom/upnpmediaserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpmediaserver.iby) -../conf/upnpmediaserver.confml MW_LAYER_CONFML(upnpmediaserver.confml) -../conf/upnpmediaserver_101F978F.crml MW_LAYER_CRML(upnpmediaserver_101F978F.crml) - - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmediaserver/rom/upnpmediaserver.iby --- a/upnpmediaserver/rom/upnpmediaserver.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/** @file -* Copyright (c) 2005-2006 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 UPnP Media Server subsystem -* -*/ - - -#ifndef __UPNPMEDIASERVER_IBY__ -#define __UPNPMEDIASERVER_IBY__ - -#ifdef __UPNP_STACK - -#ifdef __UPNP_MEDIASERVER -file=ABI_DIR\BUILD_DIR\avconnectionmanager.dll \sys\bin\avconnectionmanager.dll -file=ABI_DIR\BUILD_DIR\avcontentdirectory.dll \sys\bin\avcontentdirectory.dll -file=ABI_DIR\BUILD_DIR\avmediaserverclient.dll \sys\bin\avmediaserverclient.dll -file=ABI_DIR\BUILD_DIR\upnpavobjects.dll \sys\bin\upnpavobjects.dll -file=ABI_DIR\BUILD_DIR\avmediaserver.exe \sys\bin\avmediaserver.exe - -data=DATAZ_\private\101f977c\objects.xml \private\101f977c\objects.xml -data=DATAZ_\private\101f977c\public\MediaServer1\ConnectionManager1.xml \private\101f977c\public\MediaServer1\ConnectionManager1.xml -data=DATAZ_\private\101f977c\public\MediaServer1\ContentDirectory1.xml \private\101f977c\public\MediaServer1\ContentDirectory1.xml -data=DATAZ_\private\101f977c\public\MediaServer1\MediaServer1.xml \private\101f977c\public\MediaServer1\MediaServer1.xml - - -//Backup registartion -data=DATAZ_\private\101f977c\backup_registration.xml \private\101f977c\backup_registration.xml -data=DATAZ_\private\101f977d\backup_registration.xml \private\101f977d\backup_registration.xml -#endif // __UPNP_MEDIASERVER - -#endif // __UPNP_STACK - -#endif // __UPNPMEDIASERVER_IBY__ - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/group/bld.inf --- a/upnpmpxplugins/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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 information file for upnpmpxplugins -* -*/ - -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS - -PRJ_EXPORTS - -PRJ_MMPFILES - -// playback plugins -#include "../upnpplaybackplugins/group/bld.inf" - -// upnpmpxplugins ROM -#include "../rom/bld.inf" - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/rom/bld.inf --- a/upnpmpxplugins/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 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" -* 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 information file for upnpmpxplugins ROM -* -*/ - - - - - - -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS - -PRJ_EXPORTS -// ROM build -../rom/upnpmpxplugins.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpmpxplugins.iby) - -PRJ_MMPFILES -// none -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/rom/upnpmpxplugins.iby --- a/upnpmpxplugins/rom/upnpmpxplugins.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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: upnpmpxplugins subsystem ROM include file -* -*/ - - - - - -#ifndef __UPNPMPXPLUGINS_IBY__ -#define __UPNPMPXPLUGINS_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - //UpnpPlaybackplugins - ECOM_PLUGIN(upnpplaybackplugins.dll,upnpplaybackplugins.rsc) - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPMPXPLUGINS_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/group/bld.inf --- a/upnpmpxplugins/upnpplaybackplugins/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +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 information file for UpnpPlaybackPlugins -* -*/ - - - - - - -#include "../../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - - -PRJ_MMPFILES - - // MPX upnp music plugins - upnpplaybackplugins.mmp - -PRJ_TESTMMPFILES - -PRJ_TESTEXPORTS - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/group/upnpplaybackplugins.mmp --- a/upnpmpxplugins/upnpplaybackplugins/group/upnpplaybackplugins.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +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 upnpplaybackplugins -* -*/ - - - - - - -#include "../../../group/upnpplatformvar.hrh" - -TARGET upnpplaybackplugins.dll - -TARGETTYPE PLUGIN - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -// SIS installation + IAD support -VERSION 10.1 -paged - -EPOCALLOWDLLDATA - -// ECom Dll recognition UID followed by the unique UID for this dll -UID 0x10009D8D 0x20007568 - -SOURCEPATH ../src -SOURCE upnpmusicplayer.cpp -SOURCE upnpmusicpluginsproxy.cpp -SOURCE upnpmusicperiodizer.cpp -SOURCE upnpsingleton.cpp -SOURCE upnptrack.cpp -SOURCE upnpplaybackstatemachine.cpp -SOURCE upnpvaluestatemachine.cpp -SOURCE upnpaudiopolicy.cpp -SOURCE upnppluginserrortranslation.cpp -SOURCE upnpmusicdownloadproxy.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -// include paths (system) -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/mmf/common //before SF header reloaction, to avoid build breaks -SYSTEMINCLUDE /epoc32/include/mw/mmf/common //after SF header relocation - -START RESOURCE 20007568.rss -TARGET upnpplaybackplugins.rsg -END - -// SYSTEM -LIBRARY euser.lib ecom.lib -LIBRARY bafl.lib -LIBRARY efsrv.lib -LIBRARY inetprotutil.lib // EscapeUtils / string conversion -LIBRARY estor.lib // some MPX inline methods - -// UPNP STACK -LIBRARY upnpavobjects.lib -LIBRARY upnpipserversutils.lib - -// UPNP FRAMEWORK -LIBRARY upnpavcontrollerclient.lib -LIBRARY upnpavcontrollerhelper.lib -LIBRARY upnpsettingsengine.lib - -// XML -LIBRARY upnpxmlparser.lib - -// MPX FRAMEWORK -LIBRARY mpxcommon.lib - -// MMF -LIBRARY mmfdevsound.lib // for audio policy feature - -// DEBUG -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnpaudiopolicy.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnpaudiopolicy.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +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: Audio policy implementation for upnp remote plugin -* -*/ - - - - - - -#ifndef C_UPNPAUDIOPOLICY_H -#define C_UPNPAUDIOPOLICY_H - - -#include // for MDevSoundObserver - -// FORWARD DECLARATIONS -class MUPnPAudioPolicyObserver; -class CMMFBuffer; -class CMMFDevSound; - -/** - * A class that implements audio policy for upnp playback plugin. - * It registers for DevSound for a vrtual playback handle and is - * able to receive notifications from MMF. The purpose for this - * is to pause upnp playback when
- * - local playback begins
- * - there is an incoming call
- * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPAudioPolicy - : public CBase, - public MDevSoundObserver - { - -private: - - /** - * State of audiopolicy - * - * @since Series 60 3.1 - */ - enum TAudioPolicyState - { - EStateUninitialised, // waiting initialise devSound, can not be used - EStatePlaying, // audiopolicy initialized and playback started - EStateStopped, // playback stopped - }; - -public: // public services - - /** - * constructor - * @param aPlaybackMachine the playback states engine - */ - static CUPnPAudioPolicy* NewL( - MUPnPAudioPolicyObserver& aObserver ); - - /** - * destructor - */ - CUPnPAudioPolicy::~CUPnPAudioPolicy(); - - /** - * request for start playback - */ - void PlayL(); - - /** - * indicate playback stops - */ - void Stop(); - -protected: // MDevSoundObserver - - /** - * see MDevSoundObserver - */ - void InitializeComplete( TInt aError ); - - /** - * see MDevSoundObserver - */ - void ToneFinished( TInt aError ); - - /** - * see MDevSoundObserver - */ - void BufferToBeFilled( CMMFBuffer* aBuffer ); - - /** - * see MDevSoundObserver - */ - void PlayError( TInt aError ); - - /** - * see MDevSoundObserver - */ - void BufferToBeEmptied( CMMFBuffer* aBuffer ); - - /** - * see MDevSoundObserver - */ - void RecordError( TInt aError ); - - /** - * see MDevSoundObserver - */ - void ConvertError( TInt aError ); - - /** - * see MDevSoundObserver - */ - void DeviceMessage( TUid aMessageType, const TDesC8& aMsg ); - - /** - * see MDevSoundObserver - */ - void SendEventToClient( const TMMFEvent& aEvent ); - -private: // private methods - - /** - * default constructor - * @param aPlaybackMachine the playback states engine - */ - CUPnPAudioPolicy( - MUPnPAudioPolicyObserver& aObserver ); - - /** - * 2nd phase constructor - */ - void ConstructL(); - -private: // data - - /** - * the playback states engine - */ - MUPnPAudioPolicyObserver& iObserver; - - /** - * DevSound component for MMF access - */ - CMMFDevSound* iDevSound; - - /** - * Current AudioPolicy state - */ - TAudioPolicyState iAudioPolicyState; - - }; - -/** - * Callback interface for audio policy class - */ -class MUPnPAudioPolicyObserver - { - -public: - - /** - * A conflict was found between simultaneously playing audio - * resources. This means that this instance is active and - * meanwhile another party starts using audio resources in - * a way that has been defined to be illegal. The observer - * is expected to take apropriate actions after receiving - * this event - notifying the playback framework, which will - * then clear all resources and inform user. - * - * @param aError error to be issued to playback framework - */ - virtual void AudioConflict( TInt aError ) = 0; - - }; - -#endif // C_UPNPAUDIOPOLICY_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicdownloadproxy.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicdownloadproxy.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +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: Proxy for downloading upnp files and playing locally -* -*/ - - - - - - -#ifndef __CUPNPMUSICDOWNLOADPROXY_H__ -#define __CUPNPMUSICDOWNLOADPROXY_H__ - -// INCLUDES -#include -#include -#include -#include "upnptrackobserver.h" - -// FORWARD DECLARATIONS -class CUPnPSingleton; -class CUPnPTrack; -class MDesCArray; // for MPX compatibility - actually this is NOT a class - - -/** - * UPnP Proxy class for Local Player. - * - * Provides additional UPnP download functionality: first - * downloads the file and then uses the underlying plugin to - * execute commands (play,stop,pause) on the local copy of the - * song - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPMusicDownloadProxy : public CMPXPlaybackPlugin, - public MMPXPlaybackPluginObserver, - public MUPnPTrackObserver - { - -private: - - /** - * Defines internal player state - * - * EStateUninitialised - Initial and terminal state - * EStatePreparing - Preparatory phases before download - * EStateDownloading - Downloading the temporary file - * EStateInitialisingLocally - Download is complete, starting to - * initialize proxied local plugin - * EStateActive - Init complete, now acting as a proxy for - * the local plugin to play the temp file - * @since Series 60 3.1 - */ - enum TProxyState - { - EStateUninitialised = 0, // initial state - EStatePreparing, // preparatory phases - EStateDownloading, // download phase - EStateInitialisingLocally, // local init - EStateActive, // normal - EStateClosing // used if error during initialise - }; -public: - - /** - * Static 1st phase constructor. - * - * @since Series 60 3.1 - * @param aObs reference to call back interface - * @return A new player instance - */ - static CUPnPMusicDownloadProxy* NewL( MMPXPlaybackPluginObserver& aObs ); - - /** - * Destructor - * - * @since Series 60 3.1 - */ - ~CUPnPMusicDownloadProxy(); - - -private: - - /** - * Private default constructor - * - * @since Series 60 3.1 - * @param aObs reference to call back interface - */ - CUPnPMusicDownloadProxy( MMPXPlaybackPluginObserver& aObs ); - - /** - * 2nd phase constructor - * - * @since Series 60 3.1 - */ - void ConstructL(); - -public: // From CMPXPlaybackPlugin - - /** - * See CMPXPlaybackPlugin - */ - void InitialiseL( const TDesC& aSong ); - - /** - * See CMPXPlaybackPlugin - */ - void InitialiseL( RFile& aSong ); - - /** - * See CMPXPlaybackPlugin - */ - void CommandL( TMPXPlaybackCommand aCmd, TInt aData ); - - /** - * See CMPXPlaybackPlugin - */ - void SetL( TMPXPlaybackProperty aProperty, TInt aValue ); - - /** - * See CMPXPlaybackPlugin - */ - void ValueL( TMPXPlaybackProperty aProperty ) const; - - /** - * See CMPXPlaybackPlugin - */ - void SubPlayerNamesL(); - - /** - * See CMPXPlaybackPlugin - */ - void SelectSubPlayerL(TInt aIndex); - - /** - * See CMPXPlaybackPlugin - */ - const TDesC& SubPlayerName(); - - /** - * See CMPXPlaybackPlugin - */ - TInt SubPlayerIndex() const; - - /** - * See CMPXPlaybackPlugin - */ - void MediaL( const TArray& aAttrs ); - - /** - * See CMPXPlaybackPlugin - */ - void CancelRequest(); - - /** - * See CMPXPlaybackPlugin - */ - void SetObserver(MMPXPlaybackPluginObserver& aObs); - -protected: // From MMPXPlaybackPluginObserver - - /** - * See MMPXPlaybackPluginObserver - */ - void HandlePluginEvent( TEvent aEvent, TInt aData, TInt aError ); - - /** - * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback - */ - void HandleProperty( TMPXPlaybackProperty aProperty, TInt aValue, - TInt aError ); - - /** - * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback - */ - void HandleSubPlayerNames( TUid aPlayer, const MDesCArray* aSubPlayers, - TBool aComplete, TInt aError ); - - /** - * see MMPXPlaybackPluginObserver's base class MMPXPlaybackCallback - */ - void HandleMedia( const CMPXMedia& aProperties, TInt aError ); - -protected: // From MUPnPTrackObserver - - /** - * See MUPnPTrackObserver - */ - void ResolveURIComplete( TInt aError ); - -private: - - /** - * cleanup when going in uninitialised state - */ - void Cleanup(); - -private: // Data - - /** - * Local plugin instance - * Own. - */ - CMPXPlaybackPlugin* iLocalPlayer; - - /** - * The UPnP services singleton - * Own. - */ - CUPnPSingleton* iSingleton; - - /** - * Player state - */ - mutable TProxyState iProxyState; - - /** - * UPnP track - * Own. - */ - CUPnPTrack* iTrack; - }; - -#endif // __CUPNPMUSICDOWNLOADPROXY_H__ - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicperiodizer.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicperiodizer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +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: Periodic timer support resource -* -*/ - - - - - - -#ifndef __UPNPMUSICPERIODIZER_H__ -#define __UPNPMUSICPERIODIZER_H__ - -// INCLUDES -#include -#include "upnpmusicperiodizer.h" - -// FORWARD DECLARATIONS -class MUPnPMusicPeriodizerObserver; - -/** - * A class that provides periodic notifications. - * - * Once started, notifies an abstract interface periodically - * but only when Continue is called. This avoids situation - * where previous operation is still in progress when the next - * notification arrives. - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPMusicPeriodizer : public CTimer - { - -public: - - /** - * Static constructor - * - * @since Series 60 3.1 - * @param aObserver the party to be notified on timer trigger - * @param aTimerWavelength the timer delay in microseconds - */ - static CUPnPMusicPeriodizer* NewL( - MUPnPMusicPeriodizerObserver& aObserver, - TInt32 aTimerWavelength ); - - /** - * Static constructor - * - * @since Series 60 3.1 - * @param aObserver the party to be notified on timer trigger - * @param aTimerWavelength the timer delay in microseconds - */ - static CUPnPMusicPeriodizer* NewLC( - MUPnPMusicPeriodizerObserver& aObserver, - TInt32 aTimerWavelength ); - - /** - * Destructor - * - * @since Series 60 3.1 - */ - virtual ~CUPnPMusicPeriodizer(); - -private: - - /** - * Constructor - * - * @since Series 60 3.1 - * @param aObserver the party to be notified on timer trigger - * @param aTimerWavelength the timer delay in microseconds - */ - CUPnPMusicPeriodizer( - MUPnPMusicPeriodizerObserver& aObserver, - TInt32 aTimerWavelength ); - - /** - * 2nd phase constructor - * - * @since Series 60 3.1 - */ - void ConstructL(); - -public: - - /** - * Starts the periodizer - * - * @since Series 60 3.1 - */ - void Start(); - - /** - * Continues a next step for the periodizer - * - * @since Series 60 3.1 - */ - void Continue(); - - /** - * Stops periodizer - * - * @since Series 60 3.1 - */ - void Stop(); - -protected: // personal method - - /** - * Receives the timer triggering - * - * @since Series 60 3.1 - */ - void RunL(); - - -private: // data - - /** - * Observer of the timer - */ - MUPnPMusicPeriodizerObserver& iObserver; - - /** - * Timer wavelength as milliseconds to wait between notifications - */ - TInt32 iTimerWavelength; - - }; - -/** - * The interface to receive timer notifications - */ -class MUPnPMusicPeriodizerObserver - { - -public: - - /** - * Timer has triggered - * - * @since Series 60 3.1 - */ - virtual void HandlePeriod() = 0; - - /** - * Timer has triggered - * - * @since Series 60 3.2.3 - */ - virtual void HandlePeriodForEnd(){} - - }; - - -#endif // __UPNPMUSICPERIODIZER_H__ - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicplayer.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnpmusicplayer.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,454 +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 playing files in a remote upnp renderer -* -*/ - - - - - - -#ifndef __CUPNPMUSICPLAYER_H__ -#define __CUPNPMUSICPLAYER_H__ - -// INCLUDES -#include -#include // base class -#include "upnpavrenderingsessionobserver.h" // Avcontrol callback -#include "upnprendererselectorobserver.h" // for r.s.observer -#include "upnptrackobserver.h" // for track observer -#include "upnpaudiopolicy.h" // for audio policy observer - -// FORWARD DECLARATIONS -class MUPnPAVController; -class CUPnPSingleton; -class MUPnPAVRenderingSession; -class CUpnpAVDevice; -class CUPnPTrack; -class CUPnPPlaybackStateMachine; -class CUPnPValueStateMachine; - -// CONSTANTS -const TInt KMaxDeviceFriendlyName = 256; // from DLNA - -/** - * Plugin for playing files in a remote upnp renderer. - * - * This class implements a CPlayerPlugin that plays - * both local and remote files in a remote UPnP - * renderer. The class uses UPnP framework's AVControl - * resource to execute UPnP commands to achieve this. - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPMusicPlayer : public CMPXPlaybackPlugin, - public MUPnPAVRenderingSessionObserver, - public MUPnPRendererSelectorObserver, - public MUPnPTrackObserver, - public MUPnPAudioPolicyObserver - { - -public: - - /** - * Static 1st phase constructor. - * - * @since Series 60 3.1 - * @param aObs reference to call back interface - * @return A new player instance - */ - static CUPnPMusicPlayer* NewL( MMPXPlaybackPluginObserver& aObs ); - - /** - * Destructor - * - * @since Series 60 3.1 - */ - ~CUPnPMusicPlayer(); - - /** - * Compares renderers names - * - * @since Series 60 3.1 - * @param aRenderer current renderer to be compared - * @return TBool ETrue if match EFalse if not - */ - TBool MatchRenderer( const CUpnpAVDevice* aRenderer ) const; - - /** - * Returns currently used renderer device - * - * @since Series 60 3.1 - * @return CUpnpAVDevice currently used device - */ - CUpnpAVDevice& UsedRendererDevice() const; - - /** - * Set Plugin state to active - * - * @param aForceInitialise - * @since Series 60 3.1 - */ - void SetActive( TBool aForceInitialise ); - - /** - * Public access to the plugin's observer - */ - MMPXPlaybackPluginObserver& Observer() const; - - /** - * Public access to the playback state machine - */ - const CUPnPPlaybackStateMachine& PlaybackStateMachine() const; - - /** - * Public access to the value state machine - */ - const CUPnPValueStateMachine& ValueStateMachine() const; - - /** - * Public access to the track - */ - CUPnPTrack& Track() const; - - /** - * State handling when playback has started. - * Initiates song duration query. - */ - void HandlePlayStarted(); - - /** - * State handling when playback is complete. - * If there is another instance of plugin waiting, activates it. - */ - void HandlePlayComplete(); - - -public: // datatypes - - /** - * Defines internal player state - * - * EStateUninitialised - The plugin is in initial state and - * can not be used - * EStateUninitialising - Uninitialise called. - * EStateInitializing - Initialise for track is called - * EStateActive - Initialise is complete, plugin is - * readyto play - * EStatePreInitializing - Plugin is doing initialisation to - * the renderer by using - * SetNextAVTransportURI command. - * EStatePreInitialized - The plugin pre-initialisation phase - * iscomplete, but plugin is not yet - * ready to play - * EStateWaiting - Another instance of the plugin is - * active. This plugin is just waiting - * for activation - * EStateActiveForceInitialise - An instance that was waiting is - * activated, and is indicating that - * is in working state. However when - * it receives Play command, it will - * do normal initialisation - * - * EStatePauseInActiveForceInitialise - * - Plugin is on - * EStateActiveForceInitialise state - * and pause is called. This case - * happens when user skip to the next - * track when playback is paused. - * - * EStateError - connection failure. In this state - * the plugin has resources freed and - * does not accept any requests or - * notifications. It will ignore all - * other commands except close - * - * @since Series 60 3.1 - */ - enum TPlayerState - { - EStateNone = 0, - EStateUninitialised, - EStateUninitialising, - EStateInitializing, - EStateActive, - EStatePreInitializing, - EStatePreInitialized, - EStateWaiting, - EStateActiveForceInitialise, - EStatePauseInActiveForceInitialise, - EStateError - }; - -private: - - /** - * Private default constructor - * - * @since Series 60 3.1 - * @param aObs reference to call back interface - */ - CUPnPMusicPlayer( MMPXPlaybackPluginObserver& aObs ); - - /** - * 2nd phase constructor - * - * @since Series 60 3.1 - */ - void ConstructL(); - - /** - * Initializes a remote or local song for playback. - * - * @since Series 60 3.1 - * @param aSong URI of initialised song - */ - void InitialiseTrackL( const TDesC& aSong ); - - /** - * Uninitialises all local resources - * @param aToState the target player state - * (either EStateUninitialised or EStateError) - */ - void UninitialiseTrack( TPlayerState aToState = EStateUninitialised ); - - /** - * Set URI of track to be playing - * - * @since Series 60 3.1 - */ - void SetURIL(); - - /** - * Changes state internally - * @param aNewState a new plugin state - * - * @since Series 60 3.1 - */ - void ChangeState( TPlayerState aNewState ); - - /** - * A string representing the plugin state - * @param aState a state - * @return a descriptive string - */ - const TDesC* State( TPlayerState aState ) const; - -public: // From CMPXPlaybackPlugin - - /** - * See CMPXPlaybackPlugin - */ - void InitialiseL( const TDesC& aSong ); - - /** - * See CMPXPlaybackPlugin - */ - void InitialiseL( RFile& aSong ); - - /** - * See CMPXPlaybackPlugin - */ - void CommandL( TMPXPlaybackCommand aCmd, TInt aData ); - - /** - * See CMPXPlaybackPlugin - */ - void SetL( TMPXPlaybackProperty aProperty, TInt aValue ); - - /** - * See CMPXPlaybackPlugin - */ - void ValueL( TMPXPlaybackProperty aProperty ) const; - - /** - * See CMPXPlaybackPlugin - */ - void SubPlayerNamesL(); - - /** - * See CMPXPlaybackPlugin - */ - void SelectSubPlayerL(TInt aIndex) ; - - /** - * See CMPXPlaybackPlugin - */ - const TDesC& SubPlayerName(); - - /** - * See CMPXPlaybackPlugin - */ - TInt SubPlayerIndex() const; - - /** - * See CMPXPlaybackPlugin - */ - void MediaL( const TArray& aAttrs ); - - /** - * See CMPXPlaybackPlugin - */ - void CancelRequest(); - -protected: // From MUPnPAVRenderingSessionObserver - - /** - * See MUPnPAVRenderingSessionObserver - */ - void VolumeResult( TInt aError, TInt aVolumeLevel, - TBool aActionResponse ); - - /** - * See MUPnPAVRenderingSessionObserver - */ - void MuteResult( TInt aError, TBool aMute, TBool aActionResponse ); - - /** - * See MUPnPAVRenderingSessionObserver - */ - void InteractOperationComplete( TInt aErrorCode, - TUPnPAVInteractOperation aOperation ); - - /** - * See MUPnPAVRenderingSessionObserver - */ - void PositionInfoResult( TInt aStatus, const TDesC8& aTrackPosition, - const TDesC8& aTrackLength ); - - /** - * See MUPnPAVRenderingSessionObserver - */ - void SetURIResult( TInt aError ); - - /** - * See MUPnPAVRenderingSessionObserver - */ - void SetNextURIResult( TInt aError ); - - /** - * See MUPnPAVRenderingSessionObserver - */ - void MediaRendererDisappeared( TUPnPDeviceDisconnectedReason aReason ); - -protected: // From MUPnPAVSessionObserverBase - - /** - * See MUPnPAVSessionObserverBase - */ - void ReserveLocalMSServicesCompleted( TInt aError ); - -protected: // From MUPnPRendererSelectorObserver - - /** - * See MUPnPRendererSelectorObserver - */ - void HandleSubPlayerNames( const MDesCArray* aSubPlayers, - TBool aComplete, TInt aError ); - - /** - * See MUPnPRendererSelectorObserver - */ - void RendererListChanged(); - -protected: // From MUPnPTrackObserver - - /** - * See MUPnPTrackObserver - */ - void ResolveURIComplete( TInt aError ); - -protected: // From MUPnPAudioPolicyObserver - - /** - * See MUPnPAudioPolicyObserver - */ - void AudioConflict( TInt aError ); - -private: - - /** - * Pointer to the plugin that is - * active at the time - */ - static CUPnPMusicPlayer* iActivePlugIn; - - /** - * Pointer to the plugini that is - * waiting to activate (pre-initialized) - */ - static CUPnPMusicPlayer* iNextPlugIn; - - /** - * The singleton for AVController resources - */ - CUPnPSingleton* iSingleton; - - /** - * Pointer to renderer session - */ - MUPnPAVRenderingSession* iRendererSession; - - /** - * Pointer to playback state machine - */ - CUPnPPlaybackStateMachine* iPlaybackStateMachine; - - /** - * Pointer to value state machine - */ - CUPnPValueStateMachine* iValueStateMachine; - - /** - * UPnP track - */ - CUPnPTrack* iTrack; - - /** - * UPnP Audio policy handler - */ - CUPnPAudioPolicy* iAudioPolicy; - - /** - * The currently active device. OWNED - */ - CUpnpAVDevice* iSelectedRenderer; - - /** - * The currently active device - */ - TBuf iSelectedRendererName; - - /** - * The currently active device index - */ - TInt iSelectedRendererIndex; - - /** - * Current player state - */ - TPlayerState iPlayerState; - - /** - * Tells is remote device ready to give playback information - * (volume, duration and position). - */ - TBool iIsReady; - - }; - -#endif // __CUPNPMUSICPLAYER_H__ - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnpplaybackstatemachine.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnpplaybackstatemachine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,317 +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: Class for retrieving and selecting media renderers -* -*/ - - - - - - -#ifndef C_UPNPPLAYBACKSTATEMACHINE_H -#define C_UPNPPLAYBACKSTATEMACHINE_H - -// INCLUDES -#include -#include "upnpmusicperiodizer.h" - -// FORWARD DECLARATIONS -class CUPnPMusicPlayer; -class MUPnPPlayBackObserver; -class MUPnPAVRenderingSession; - -/** - * Class for handling playback state machine functionality - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPPlaybackStateMachine : public CBase, - public MUPnPMusicPeriodizerObserver - { - -public: - - /** - * Static 1st phase constructor - * - * @since Series 60 3.1 - * @param aParent the parent plugin instance - * @param aRenderingSession for playback commands - */ - static CUPnPPlaybackStateMachine* NewL( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ); - - - /** - * 2nd phase constructor - * - * @since Series 60 3.1 - */ - void ConstructL(); - - /** - * Destructor - * - * @since Series 60 3.1 - */ - virtual ~CUPnPPlaybackStateMachine(); - - /** - * Executes a command on the selected song - * - * @param aCmd a command - * @since Series 60 3.1 - */ - void CommandL( TMPXPlaybackCommand aCmd ); - - /** - * Sets the playback position within the current track - * @param aPosition position in milliseconds - */ - void PositionL( TInt aPosition ); - - /** - * Stops playback, does not provide any ACK event - */ - void SilentStopL(); - - /** - * Cancels any ongoing operation - * (actually it just resets the state so the result will be ignored - * and not reported) - */ - void Cancel(); - - /** - * Indicates that the requested interaction operation (play, stop, etc.) - * is complete. - * - * @since Series 60 3.1 - * @param aErrorCode TInt error code - * @param aOperation TInt operation (TAVInteractOperation) - * @return None - */ - void InteractOperationComplete( TInt aErrorCode, - TUPnPAVInteractOperation aOperation ); - - /** - * End any ongoing operation - * (actually it just resets the state so the result will play next song - */ - void PlayOvertimeEnd(); - -private: - - /** - * Private default constructor - * - * @since Series 60 3.1 - * @param aParent the parent plugin instance - * @param aRenderingSession for playback commands - */ - CUPnPPlaybackStateMachine( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ); - -public: // datatypes used in this class - - /** - * Defines internal state - * - * @since Series 60 3.1 - */ - enum TState - { - EStateStopped, - EStatePlaying, - EStatePaused, - EStateUnknown, // this state entered if a command fails. - // every state transition is accepted. - }; - - /** - * current type of operation - */ - enum TOperationType - { - EOperationNone, // no pending operations - EOperationCommand, // executing a command - EOperationPositionToZero, // adjusting position to zero - EOperationPositionToZeroDuringPause, // ...during pause state - EOperationSilentStop // stop without ack - }; - - /** - * An internal operation class - */ - class TOperation - { - public: - /** construction */ - TOperation( TOperationType aType ) - : iType( aType ) {} - TOperation( TMPXPlaybackCommand aCmd ) - : iType( EOperationCommand ), iCmd( aCmd ) {} - /** setters */ - void operator=( TOperationType aType ) - { - iType = aType; - } - void operator=( TMPXPlaybackCommand aCmd ) - { - iType = EOperationCommand; iCmd = aCmd; - } - void Reset() - { - iType = EOperationNone; - } - /** comparision */ - TBool operator==( TOperationType aType ) - { - return ( iType == aType ); - } - TBool operator==( TMPXPlaybackCommand aCmd ) - { - return ( iType == EOperationCommand && iCmd == aCmd ); - } - TBool None() - { - return ( iType == EOperationNone ); - } - /** identifies the operation type */ - TOperationType iType; - /** in case the operation is a command, the command */ - TMPXPlaybackCommand iCmd; - }; - -protected: // internal methods - - /** - * Handles the close command internally - */ - void HandleCloseL(); - - /** - * Checks if operations are in the queue, and executes - */ - void CheckOperationInQueueL(); - - /** - * Handle timers when playback start - */ - void TimePlay(); - - /** - * Handle timers when pause - */ - void TimePause(); - - /** - * Handle timers when continuing from pause - */ - void TimeContinue(); - - /** - * Handle timers when stopped - * Guesses if playback was completed or stopped by user. - * This is estimated by comparing track play time and track duration. - * @return ETrue if we guess the track playback was completed - */ - TBool TimeStop(); - - /** - * Changes the internal state - * @param aNewState the state to enter - */ - void ChangeState( TState aNewState ); - - /** - * textual representation of a state - */ - const TDesC* State( TState aState ); - -protected: // From MUPnPPeriodizerObserver - - /** - * See MUPnPMusicPeriodizerObserver - */ - void HandlePeriod(); - - /** - * See MUPnPMusicPeriodizerObserver - */ - void HandlePeriodForEnd(); - -private: // data - - /** - * Parent plugin instance - */ - CUPnPMusicPlayer& iParent; - - /** - * Rendering session - */ - MUPnPAVRenderingSession& iRendererSession; - - /** - * Playback state - */ - TState iState; - - /** - * currently ongoing operation - */ - TOperation iCurrentOperation; - - /** - * queue of operations pending - */ - RArray iOperationQueue; - - /** - * time when playback started - */ - TTime iPlayMark; - - /** - * time when pause started - */ - TTime iPauseMark; - - /** - * total time spent in pause (in milliseconds) - */ - TInt iPausetime; - - /** - * Timer support - * Own. - */ - CUPnPMusicPeriodizer* iPeriodizer; - - /** - * Timer support - * Own. - */ - CUPnPMusicPeriodizer* iPeriodizerEnd; - - }; - - -#endif // C_UPNPPLAYBACKSTATEMACHINE_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnppluginserrortranslation.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnppluginserrortranslation.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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: translate all plugins error code for music player -* -*/ - - - - - -#ifndef T_UPNPPLUGINSERRORTRANSLATION_H -#define T_UPNPPLUGINSERRORTRANSLATION_H - -// INCLUDES -#include -/** - * Class for translate all plugins error code for music player - * - * @since S60 v3.1 - */ -class TUpnpPluginsErrorTranslation -{ -public: - - /** - * Static function for translate error - * - * @since Series 60 3.1 - * @param aError the upnp plugins error code - * @return a valid error code - */ - static TInt ErrorTranslate( TInt aError ); -}; - -#endif /*UPNPPLUGINSERRORTRANSLATION_H*/ - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnprendererselectorobserver.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnprendererselectorobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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: Observer interface used in CUPnPSingleton -* -*/ - - - - - - -#ifndef M_UPNPRENDERERSELECTOROBSERVER_H -#define M_UPNPRENDERERSELECTOROBSERVER_H - -/** - * Observer interface for receiving a notification when the renderer - * list has changed - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class MUPnPRendererSelectorObserver - { - -public: - - /** - * Notification for the sub player list is available - * - * @since Series 60 3.1 - * @param aSubPlayers a list of sub players - * @param aComplete ETrue no more sub players. EFalse more subplayer - * expected - * @param aError Error code - */ - virtual void HandleSubPlayerNames( const MDesCArray* aSubPlayers, - TBool aComplete, TInt aError ) = 0; - - /** - * Notification for the sub player list has changed - * - * @since Series 60 3.1 - */ - virtual void RendererListChanged() = 0; - - }; - - -#endif // M_UPNPRENDERERSELECTOROBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnpsingleton.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnpsingleton.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,250 +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: Singleton class for main upnp related services -* -*/ - - - - - - -#ifndef C_UPNPSINGLETON_H -#define C_UPNPSINGLETON_H - -// INCLUDES -#include -#include "upnpavdeviceobserver.h" -#include "upnpmusicperiodizer.h" - -// FORWARD DECLARATIONS -class MUPnPAVController; -class MUPnPRendererSelectorObserver; -class CUpnpAVDevice; -class CUpnpAVDeviceList; -class MUPnPAVRenderingSession; - -/** - * A singleton class that provides main upnp services - * - * The class owns the AVController client session. Plugins that - * use this singleton class may then share the same session, or - * start rendering sessions in it. - * - * The class also provides device discovery routines. - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPSingleton : public CBase, - public MUPnPAVDeviceObserver, - public MUPnPMusicPeriodizerObserver - { - -private: - - /** - * State of renderer selection subprocess - * - * @since Series 60 3.1 - */ - enum TSelectorState - { - EStateWaiting, // waiting in device discovery phase - EStateComplete, // device discovery complete, still updating list - EStateReady, // steady state - list is untouched - EStateError, // WLAN connection lost - }; - -public: - - /** - * Singleton constructor - * - * @since Series 60 3.1 - * @return a new instance - */ - static CUPnPSingleton* GetInstanceL(); - - /** - * Singleton destructor - * - * @since Series 60 3.1 - * @param aInstance the instance pointer to lose - */ - static void LoseInstance( CUPnPSingleton* aInstance ); - - /** - * Destructor - * - * @since Series 60 3.1 - */ - ~CUPnPSingleton(); - - /** - * Get list of renderers from AVController. Returns names (async) - * - * @param aObserver the observer to receive the response - * @since Series 60 3.1 - */ - void GetRendererNamesL( MUPnPRendererSelectorObserver& aObserver ); - - /** - * Cancels an asynchronous query if it is pending - */ - void CancelGetRendererNames(); - - /** - * Selects renderer by index - * - * @since Series 60 3.1 - * @param aIndex Index of renderer to be selected - */ - const CUpnpAVDevice* SelectRendererByIndexL( TInt aIndex ); - - /** - * Return used renderer device - * - * @since Series 60 3.1 - * @return CUpnpAVDevice used renderer device - */ - const CUpnpAVDevice* DefaultDevice(); - - /** - * Provides reference to the AVController resource - */ - MUPnPAVController& AVC(); - - -protected: // From MUPnPAVDeviceObserver - - /** - * See MUPnPAVDeviceObserver - */ - void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ); - - /** - * See MUPnPAVDeviceObserver - */ - void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); - - /** - * See MUPnPAVDeviceObserver - */ - void WLANConnectionLost(); - -protected: // From MUPnPMusicPeriodizerObserver - - /** - * See MUPnPMusicPeriodizerObserver - */ - void HandlePeriod(); - -private: - - /** - * Clears the current device cache and copies the renderer list again - * from AVController - */ - void CacheRendererListL(); - - /** - * Sends an asynchronous response for subplayer names to observer. - * Uses the class members as parameters. - * @param aComplete the complete parameter to use in callback - * @param aError the error code to be transmitted - */ - void DeliverNamesToObserverL( TBool aComplete, TInt aError = KErrNone ); - - /** - * Checks if the device is available. If a device is not available, it - * has been disappeared. The method uses a proprietary flag. - * @param aDevice the device to check - * @return EFalse if the device has disappeared. - */ - TBool IsAvailable( const CUpnpAVDevice& aDevice ) const; - - /** - * Sets a device availability flag. If a device is not available, it - * has been disappeared. The method uses a proprietary flag. - * @param aDevice the device to set - * @param aAvailable if false, the device has disappeared. - */ - void SetAvailable( CUpnpAVDevice& aDevice, TBool aAvailable ) const; - - /** - * Private default constructor - * - * @since Series 60 3.1 - */ - CUPnPSingleton(); - - /** - * 2nd phase constructor - * - * @since Series 60 3.1 - */ - void ConstructL(); - -private: // data - - /** - * Reference count - */ - static TInt iInstanceCount; - - /** - * The singleton - */ - static CUPnPSingleton* iInstance; - - /** - * Pointer to AVController - */ - MUPnPAVController* iAVController; - - /** - * Temporary pointer to renderer selector observer - */ - MUPnPRendererSelectorObserver* iRendererselectorObserver; - - /** - * default device index - */ - static TInt iDefaultRendererIndex; - - /** - * Timer support - */ - CUPnPMusicPeriodizer* iPeriodizer; - - /** - * Array of renderer - */ - RPointerArray iMediaRenderers; - - /** - * Current selector state - */ - TSelectorState iSelectorState; - - /** - * Indicator for activity during next call to GetSubplayerNames - */ - TSelectorState iStateChangeDuringNextCall; - - }; - - -#endif // C_UPNPSINGLETON_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnptrack.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnptrack.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,372 +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: class for containing and obtaining music track-specific -* data from media server -* -*/ - - - - - - -#ifndef C_UPNPTRACK_H -#define C_UPNPTRACK_H - -// INCLUDES -#include -#include "upnpitemresolverobserver.h" -#include "upnpresourceselector.h" - -// FORWARD DECLARATIONS -class TMPXAttribute; -class TMPXAttributeData; -class MUPnPAVController; -class MUPnPAVBrowsingSession; -class MUPnPTrackObserver; -class MMPXPlaybackPluginObserver; -class CUpnpItem; -class MUPnPItemResolver; - -// CONSTANTS -const TInt KMaxElementSize = 256; - - -/** - * A helper class for containing and obtaining music track-specific data - * from media server - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPTrack - : public CBase - , public MUPnPItemResolverObserver - { - -public: // datatypes - - /** - * Defines direction of playback - * - * EDirectionRemote - Used in local to remote and remote to remote - * playback cases - * EDirectionLocal - Used only in remote to local case. - * - */ - enum TPlaybackDirection - { - EDirectionRemote = 0, - EDirectionLocal - }; -public: - - /** - * static constructor - * - * @param aAvController AVController - * @return a new CUPnPTrack instance - * @since Series 60 3.1 - */ - static CUPnPTrack* NewL( MUPnPAVController& aAvController ); - - /** - * Destructor - * - * @since Series 60 3.1 - */ - virtual ~CUPnPTrack(); - - /** - * Parse and saves the song path from given descriptor - * - * @param aCodedTrackUri track URI that may be coded - * @param atrackObserver observer to notify when resolve is complete - * @param aPlaybackDirection direction of playback - * @since Series 60 3.1 - */ - void ResolveURIL( const TDesC& aCodedTrackUri, - MUPnPTrackObserver& aTrackObserver, - TPlaybackDirection aPlaybackDirection ); - - /** - * Returns the original URI given in initialisation - * - * @return TDesC URI - * @since Series 60 3.1 - */ - const TDesC& URI() const; - - /** - * Returns the true UPNP URI of a remote track - * - * @return TDesC8 URI - * @since Series 60 3.1 - */ - const TDesC8& UpnpURI() const; - - /** - * Returns the remote upnp item that represents the track - * - * @return CUpnpItem the item reference - * @since Series 60 3.1 - */ - const CUpnpItem& UpnpItem() const; - - /** - * Returns the file path of local item - * - * @return TDesC file path - * @since Series 60 3.1 - */ - const TDesC& FilePath() const; - - /** - * Return location of track. ETrue = remote. EFalse = local - * - * @return TBool location of track - * @since Series 60 3.1 - */ - TBool IsRemote() const; - - /** - * Get metadata information for track from media server - * - * @param aAttrs list of wanted media propeties - * @param aObs the plugin observer that will receive the metadata - * @since Series 60 3.1 - */ - void GetMetaDataL( const TArray& aAttrs, - MMPXPlaybackPluginObserver& aObs ); - - /** - * Delivers media changed event to playback framework - * @param aObs the plugin observer - */ - void SendMediaChangedEventL( - MMPXPlaybackPluginObserver& aObs ); - - /** - * current track duration - * @return track duration in milliseconds - */ - TInt TrackDuration(); - - /** - * overrides current track duration. Normally a track can provide - * duration information for current remote track. However sometimes - * the data is missing. In this case it can be set using this method. - * @param aMilliseconds the duration in milliseconds - */ - void SetTrackDuration( TInt aMilliseconds ); - - /** - * - */ - void Delete(); - -protected: // MUPnPItemResolverObserver - - /** - * See MUPnPItemResolverObserver - */ - void ResolveComplete( const MUPnPItemResolver& aResolver, TInt aError ); - -private: - - /** - * Default constructor - * - * @param aAvController AVController - * @since Series 60 3.1 - */ - CUPnPTrack( MUPnPAVController& aAvController ); - - /** - * 2nd phase constructor - * - * @since Series 60 3.1 - */ - void ConstructL(); - - /** - * Parse and save HttpURI, media server id and object id from - * given descriptor - * - * @since Series 60 3.1 - * @param aSong descriptor to be parsed - */ - void ParsePiecesL( const TDesC& aSong ); - - /** - * See MUPnPAVBrowsingSessionObserver - * - * @since Series 60 3.1 - */ - void BrowseResponseL( const TDesC8& aBrowseResponse, TInt aError ); - - /** - * Starts a browsing session within the object - */ - void StartBrowsingSessionL(); - - /** - * Stops a browsing session within the object - */ - void StopBrowsingSession(); - - /** - * Delivers metadata to observer - * @param aAttrs list of wanted media propeties - * @param aObs the plugin observer that will receive the metadata - * @param aError error code to be delivered to client - */ - void DeliverMedataL( const TArray& aAttrs, - MMPXPlaybackPluginObserver& aObs, TInt aError = KErrNone ); - - /** - * Fills item metadata into given MediaL object - * @param aMedia the MPX media object to fill metadata into - * @param aAttrs list of metadata elements to fill - */ - void FillMediaFromItemL( CMPXMedia& aMedia, - const TArray& aAttrs ); - - /** - * Tests if given attribute exists in the attribute array - * returns true if it is found. - * @param aAttrs the attribute array - * @param aAttrData the attribute to look for - * @return ETrue if it was found, EFalse otherwise - */ - TBool Exists( const TArray& aAttrs, - const TMPXAttributeData& aAttrData ) const; - - /** - * A helper method that converts text from 8-bit to 16-bit. - * Note that a member buffer is used that has static length. - */ - const HBufC16* CUPnPTrack::To16LC( const TDesC8& aText ); - -private: // data - - /** - * Defines location of track - * - * @since Series 60 3.1 - */ - enum TTrackLocation - { - ETrackLocationLocal = 0, - ETrackLocationRemote - }; - - /** - * Defines track state - * - * @since Series 60 3.2 - */ - enum TTrackState - { - EStateIdle, - EStateResolving, - EStateSelfDestruct, - EStateReady - }; - - - /** - * Location of track - */ - TTrackLocation iTrackLocation; - - /** - * URI for local track - */ - HBufC* iOriginalURI; - - /** - * Media server name - */ - HBufC8* iMediaServer; - - /** - * Object id - */ - HBufC8* iObjectId; - - /** - * The AV Controller resource - */ - MUPnPAVController& iAvController; - - /** - * The rendering session - */ - MUPnPAVBrowsingSession* iBrowsingSession; - - /** - * Track observer during resolving phase - */ - MUPnPTrackObserver* iTrackObserver; - - /** - * Observer for metadata queries - * Stored in case metadata is not ready yet when queried - */ - MMPXPlaybackPluginObserver* iMetadataObserver; - - /** - * Attributes in metadata query - */ - RArray iQueriedAttributes; - - /** - * temp buffer used in 8->16 -bit conversion - */ - TBuf16 iTempBuf; - - /** - * track duration in milliseconds (from some other source) - */ - TInt iTrackDuration; - - /** - * Resolver for remote or local item (Owned). - */ - MUPnPItemResolver* iItemResolver; - - /** - * Selectors for remote item. - */ - TUPnPSelectDefaultResource iDefaultSelector; - - /** - * Selectors for local item. - */ - TUPnPSelectFirstResource iFirstSelector; - - /** - * Tells is resolve item completed. - */ - TBool iIsItemSolved; - - /** - * Current track state - */ - TTrackState iState; - }; - - -#endif // C_UPNPTRACK_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnptrackobserver.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnptrackobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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: announces notifications from helper class -* -*/ - - - - - - -#ifndef M_UPNPTRACKOBSERVER_H -#define M_UPNPTRACKOBSERVER_H - -/** - * An interface for observing changes in the track state. - * The class announces notifications through this interface - * to the plugin classes that use it. - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class MUPnPTrackObserver - { - -public: - - /** - * URI resolving is complete - * - * @since Series 60 3.1 - * @param aError error code - */ - virtual void ResolveURIComplete( TInt aError ) = 0; - - }; - - -#endif // M_UPNPTRACKOBSERVER_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/inc/upnpvaluestatemachine.h --- a/upnpmpxplugins/upnpplaybackplugins/inc/upnpvaluestatemachine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,311 +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: Class for retrieving and selecting media renderers -* -*/ - - - - - - -#ifndef C_UPNPVALUESTATEMACHINE_H -#define C_UPNPVALUESTATEMACHINE_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CUPnPMusicPlayer; -class MUPnPAVRenderingSession; - - - -/** - * Class for handling playback state machine functionality - * - * @lib upnpmusicplugins.lib - * @since S60 v3.1 - */ -class CUPnPValueStateMachine : public CBase - { - -public: // construction / destruction - - /** - * Static 1st phase constructor - * - * @since Series 60 3.1 - * @param aParent the parent plugin instance - * @param aRenderingSession for playback commands - */ - static CUPnPValueStateMachine* NewL( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ); - - /** - * Destructor - * - * @since Series 60 3.1 - */ - virtual ~CUPnPValueStateMachine(); - -public: // datatypes used in this class - - /** - * current type of operation - */ - enum TOperationType - { - EOperationNone, // no operation going on - EOperationValue, // value get - EOperationSet, // value set - EOperationDurationQuery, // internal duration query - EOperationPositionQuery, // internal position query - EOperationVolumeQuery, // internal volume query - EOperationMute // internal mute - }; - - /** - * An internal operation class - */ - class TOperation - { - public: - /** construction */ - TOperation( TOperationType aType ) - : iType( aType ) {} - TOperation( TOperationType aType, TInt aValue ) - : iType( aType ) - , iValue( aValue ) {} - TOperation( TMPXPlaybackProperty aProperty, TInt aValue ) - : iType( EOperationSet ) - , iProperty( aProperty ) - , iValue( aValue ) {} - TOperation( TMPXPlaybackProperty aProperty ) - : iType( EOperationValue ) - , iProperty( aProperty ) {} - - /** setters */ - void operator=( TOperationType aType ) - { - iType = aType; - } - void Set( TMPXPlaybackProperty aProperty, TInt aValue ) - { - iType = EOperationSet; - iProperty = aProperty; - iValue = aValue; - } - void Set( TMPXPlaybackProperty aProperty ) - { - iType = EOperationValue; - iProperty = aProperty; - } - void Reset() - { - iType = EOperationNone; - } - /** comparision */ - TBool operator==( TOperationType aType ) - { - return ( iType == aType ); - } - TBool Compare( TOperationType aType, TMPXPlaybackProperty aProperty ) - { - return ( iType == aType && iProperty == aProperty ); - } - TBool None() - { - return ( iType == EOperationNone ); - } - /** identifies the operation type */ - TOperationType iType; - /** playback property, if op == Value or Set */ - TMPXPlaybackProperty iProperty; - /** playback property value, if op == Set */ - TInt iValue; - }; - - /** - * A result of validation query. - * Indicates what to do with a Value- or a Set- call - */ - enum TValidationResult - { - EHandle, // handle the call in value state machine - EHandleStatic, // handle the call statically in v.s.m. - EErrorNotReady, // async error (KErrNotReady) - EErrorNotSupported, // async error (KErrNotSupported) - EIgnore // do absolutely nothing - }; - -public: // services - - /** - * A method to copy some static renderer-specific values from - * another instance of a state machine. Note that one instance is - * track specific, so track specific cached values are NOT copied, - * (track duration etc.) but renderer specific values are copied - * (volume etc) - * @param aOther another instance to copy values from - */ - void CopyValues( const CUPnPValueStateMachine& aOther ); - - /** - * See CMPXPlaybackPlugin - */ - void SetL( TMPXPlaybackProperty aProperty, TInt aValue ); - - /** - * See CMPXPlaybackPlugin - */ - void ValueL( TMPXPlaybackProperty aProperty ); - - /** - * See MUPnPRenderiongSessionObserver - */ - void VolumeResult( TInt aError, TInt aVolumeLevel, - TBool aActionResponse ); - - /** - * See MUPnPRenderiongSessionObserver - */ - void MuteResult( TInt aError, TBool aMute, TBool aActionResponse ); - - /** - * See MUPnPRenderiongSessionObserver - */ - void PositionInfoResult( TInt aStatus, const TDesC8& aTrackPosition, - const TDesC8& aTrackLength ); - - /** - * Initiates a duration request, which will be reported to - * the plugin observer as a change event - */ - void DurationQueryL(); - - /** - * Initiates a position request - */ - void PositionQueryL(); - - /** - * Initiates a volume request, which will be reported to - * the plugin observer as a change event - */ - void VolumeQueryL(); - - /** - * Initiates an internal mute request, which will not be reported. - * @param aMute if other than zero, mute will be activated - */ - void MuteRequestL( TInt aMute ); - - /** - * Validates a Value- or Set- call with given property in given - * player state. There will be a result indicating what to do with - * the call. - * @param aProperty the property to be either get or set - * @param aSetting true if setting the value, false if getting - * @param aPlayerState state of the player plugin - * @param aIsReady is remote device to gíve playback information - * @return result of validation - */ - static TValidationResult ValidatePropertyInState( - TMPXPlaybackProperty aProperty, - TBool aSetting, - TInt aPlayerState, - TBool aIsReady ); - - /** - * A static version of Value query - this one is capable of handling - * some fixed Value queries that do not need network resources - */ - static void ValueStatic( - TMPXPlaybackProperty aProperty, - MMPXPlaybackPluginObserver& aPlaybackObs ); - - /** - * Cancels any ongoing operation - * (actually it just resets the state so the result will be ignored - * and not reported) - */ - void Cancel(); - -private: - - /** - * Private default constructor - * - * @since Series 60 3.1 - * @param aParent the parent plugin instance - * @param aRenderingSession for playback commands - */ - CUPnPValueStateMachine( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ); - - /** - * Checks if operations are in the queue, and executes - */ - void CheckOperationInQueueL(); - - /** - * Check if given property are in queue - * @param aProperty property to be searched - * @return Etrue if found - */ - TBool FoundFromQueue( TMPXPlaybackProperty aProperty ); - -private: // data - - /** - * Parent plugin instance - */ - CUPnPMusicPlayer& iParent; - - /** - * Rendering session - */ - MUPnPAVRenderingSession& iRendererSession; - - /** - * currently ongoing operation - */ - TOperation iCurrentOperation; - - /** - * queue of operations pending - */ - RArray iOperationQueue; - - /** - * current renderer volume level. - * cached internally to avoid unnecessary message traffic. - */ - TInt iRendererVolume; - - /** - * current renderer muted state (1 = muted, 0 = normal) - * cached internally to avoid unnecessary message traffic. - */ - TInt iRendererMuted; - - }; - - -#endif // C_UPNPVALUESTATEMACHINE_H - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/20007568.rss --- a/upnpmpxplugins/upnpplaybackplugins/src/20007568.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2000 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: Resource definitions for UPnP Plugin -* -*/ - - - - - - -#include -#include - -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x20007568; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = KMPXPlaybackPluginInterfaceUid; - implementations = - { - // Info for UPnP Browser - IMPLEMENTATION_INFO - { - implementation_uid = 0x200075D8; - version_no = 2; - display_name = "Remote UPnP Player"; - default_data = "UPnP"; - opaque_data = "*.mp3;.aac;.3gp" - ""EPbRemote""; - } - }; - }, - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = KMPXPlaybackPluginInterfaceUid; - implementations = - { - // Info for UPnP Browser - IMPLEMENTATION_INFO - { - implementation_uid = 0x200075D9; - version_no = 2; - display_name = "Download proxy"; - default_data = "UPnP"; - opaque_data = "upnp.mp3;.aac;.3gp" - ""EPbLocal""; - } - }; - } - }; - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpaudiopolicy.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpaudiopolicy.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +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: Audio policy implementation for upnp remote plugin -* -*/ - - - - - - -// INCLUDES -#include // MMF base classes - -#include -#include -#include "upnpaudiopolicy.h" // myself - -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" -// CONSTANTS - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPAudioPolicy::NewL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPAudioPolicy* CUPnPAudioPolicy::NewL( - MUPnPAudioPolicyObserver& aObserver ) - { - __LOG( "CUPnPAudioPolicy::NewL 1" ); - CUPnPAudioPolicy* self = - new(ELeave) CUPnPAudioPolicy( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAudioPolicy::CUPnPAudioPolicy -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPAudioPolicy::CUPnPAudioPolicy( - MUPnPAudioPolicyObserver& aObserver ) - : iObserver( aObserver ) - , iAudioPolicyState( EStateUninitialised ) - { - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::ConstructL -// -------------------------------------------------------------------------- -// -void CUPnPAudioPolicy::ConstructL() - { - __LOG( "CUPnPAudioPolicy::ConstructL" ); - iDevSound = CMMFDevSound::NewL(); - __LOG( "CUPnPAudioPolicy::ConstructL end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAudioPolicy::CUPnPAudioPolicy -// destructor. -// -------------------------------------------------------------------------- -// -CUPnPAudioPolicy::~CUPnPAudioPolicy() - { - __LOG( "CUPnPAudioPolicy destructor" ); - delete iDevSound; - } - -// -------------------------------------------------------------------------- -// CUPnPAudioPolicy::PlayL -// requests for playback start -// -------------------------------------------------------------------------- -// -void CUPnPAudioPolicy::PlayL() - { - __LOG( "CUPnPAudioPolicy::PlayL()" ); - __LOG1( "CUPnPAudioPolicy::PlayL in state(%d)", TInt(iAudioPolicyState) ); - - // Ignore if already on playing state - if( iAudioPolicyState != EStatePlaying ) - { - __LOG( "CUPnPAudioPolicy: initialising devsound" ); - TRAPD( err, iDevSound->InitializeL( - *this, KFourCCCodeNokiaUPnP, EMMFStatePlaying ) ); - if( err != KErrNone ) - { - __LOG1( "CUPnPAudioPolicy: DevSound initialize err:(%d)",err ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAudioPolicy::Stop -// indicates playback will stop -// -------------------------------------------------------------------------- -// -void CUPnPAudioPolicy::Stop() - { - __LOG( "CUPnPAudioPolicy::Stop()" ); - __LOG1( "CUPnPAudioPolicy::Stop in state(%d)", TInt(iAudioPolicyState) ); - - // Ignore if already on stopped state - if( iAudioPolicyState == EStatePlaying ) - { - iAudioPolicyState = EStateStopped; - iDevSound->Stop(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAudioPolicy::InitializeComplete -// from MDevSoundObserver -// -------------------------------------------------------------------------- -// -void CUPnPAudioPolicy::InitializeComplete( TInt aError ) - { - __LOG1( "CUPnPAudioPolicy::InitializeComplete(%d)", aError ); - __LOG1( "CUPnPAudioPolicy::InitializeCompl in state(%d)", - TInt(iAudioPolicyState) ); - if( aError == KErrNone && iAudioPolicyState != EStatePlaying ) - { - __LOG( "CUPnPAudioPolicy: priority settings" ); - TMMFPrioritySettings mmfPrioSettings; - mmfPrioSettings.iPriority = KAudioPriorityUPnPRemotePlayback; - mmfPrioSettings.iPref = - (TMdaPriorityPreference)KAudioPrefUPnPPlayback; - mmfPrioSettings.iState = EMMFStatePlaying; - iDevSound->SetPrioritySettings(mmfPrioSettings); - - __LOG( "CUPnPAudioPolicy::InitializeComple calling PlayInitL.." ); - TRAPD( err, iDevSound->PlayInitL() ); - if( err == KErrNone ) - { - iAudioPolicyState = EStatePlaying; - } - else - { - __LOG1( "CUPnPAudioPolicy: PlayInitL err:(%d)", err ); - } - __LOG( "CUPnPAudioPolicy::InitializeComplete - end" ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAudioPolicy::PlayError -// from MDevSoundObserver -// -------------------------------------------------------------------------- -// -void CUPnPAudioPolicy::PlayError( TInt aError ) - { - __LOG1( "CUPnPAudioPolicy::PlayError(%d)", aError ); - __LOG1( "CUPnPAudioPolicylicy::PlayError in state(%d)", - TInt(iAudioPolicyState) ); - if ( aError == KErrDied || aError == KErrInUse ) - { - iAudioPolicyState = EStateStopped; - iObserver.AudioConflict( aError ); - } - } - -// -------------------------------------------------------------------------- -// Unused callbacks from MDevSoundObserver -// -------------------------------------------------------------------------- -void CUPnPAudioPolicy::ToneFinished( TInt /*aError*/ ) - { - __LOG( "CUPnPAudioPolicy::ToneFinished()" ); - } -void CUPnPAudioPolicy::BufferToBeFilled( CMMFBuffer* /*aBuffer*/ ) - { - __LOG( "CUPnPAudioPolicy::BufferToBeFilled()" ); - } -void CUPnPAudioPolicy::DeviceMessage( TUid /*aMessageType*/, - const TDesC8& /*aMsg*/ ) - { - __LOG( "CUPnPAudioPolicy::DeviceMessage()" ); - } -void CUPnPAudioPolicy::SendEventToClient( const TMMFEvent& /*aEvent*/ ) - { - __LOG( "CUPnPAudioPolicy::SendEventToClient()" ); - } -void CUPnPAudioPolicy::RecordError( TInt /*aError*/ ) - { - __LOG( "CUPnPAudioPolicy::RecordError()" ); - } -void CUPnPAudioPolicy::ConvertError( TInt /*aError*/ ) - { - __LOG( "CUPnPAudioPolicy::ConvertError()" ); - } -void CUPnPAudioPolicy::BufferToBeEmptied( CMMFBuffer* /*aBuffer*/ ) - { - __LOG( "CUPnPAudioPolicy::BufferToBeEmptied()" ); - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpmusicdownloadproxy.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicdownloadproxy.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,535 +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: Proxy for downloading upnp files and playing locally -* -*/ - - - - - - -// INCLUDES -#include -#include "upnpitemutility.h" // for ResourceFromItemL -#include "upnpavcontroller.h" -#include "upnpmusicdownloadproxy.h" -#include "upnpsingleton.h" -#include "upnptrack.h" - -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" - -#include "upnppluginserrortranslation.h" - -// CONSTANTS -// ** a message to music player to complete an immediate exit -const TInt KMusicPluginMessageExit = 3001; -const TUid KLocalPlayerDefinitionUid = { 0x101FFC06 }; - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::NewL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicDownloadProxy* CUPnPMusicDownloadProxy::NewL( - MMPXPlaybackPluginObserver& aObs ) - { - CUPnPMusicDownloadProxy* p = new ( ELeave ) - CUPnPMusicDownloadProxy( aObs ); - __LOG1( "DownloadProxy: NewL this=%d", p ); - CleanupStack::PushL( p ); - p->ConstructL(); - CleanupStack::Pop(); - return p; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::CUPnPMusicDownloadProxy -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicDownloadProxy::CUPnPMusicDownloadProxy( - MMPXPlaybackPluginObserver& aObs ) - : iProxyState( EStateUninitialised ) - { - iObs = &aObs; - iLocalPlayer = NULL; - iSingleton = NULL; - iTrack = NULL; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::ConstructL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::ConstructL() - { - __LOG( "DownloadProxy: ConstructL" ); - - // Construct the underlying local plugin - iLocalPlayer = CMPXPlaybackPlugin::NewL( - KLocalPlayerDefinitionUid ); - - // Create handle to singleton - iSingleton = CUPnPSingleton::GetInstanceL(); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::~CUPnPMusicDownloadProxy -// Destructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicDownloadProxy::~CUPnPMusicDownloadProxy() - { - __LOG1( "DownloadProxy: destructor [%d]", - this ); - Cleanup(); - - // Free memory of owned members - delete iLocalPlayer; - CUPnPSingleton::LoseInstance( iSingleton ); - } - - -// -------------------------------------------------------------------------- -// Methods from CMPXPlaybackPlugin -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::InitialiseL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::InitialiseL( const TDesC& aSong ) - { - __LOG2( "DownloadProxy::InitialiseL(%S) [%d]", - &aSong, this ); - - __ASSERTD( iProxyState == EStateUninitialised,__FILE__, __LINE__ ); - - iProxyState = EStatePreparing; - - // Create local track object to resolving URI - delete iTrack; - iTrack = 0; - iTrack = CUPnPTrack::NewL( iSingleton->AVC() ); - iTrack->ResolveURIL( aSong, *this, CUPnPTrack::EDirectionLocal ); - iProxyState = EStateDownloading; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::InitialiseL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::InitialiseL( RFile& /*aSong*/ ) - { - // Not used. Only remote file is supported - __PANICD( __FILE__, __LINE__ ); - User::Leave( KErrNotSupported ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::HandleMetaData -// from MUPnPTrackMetaDataObserver -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::ResolveURIComplete( TInt aError ) - { - __LOG1( "DownloadProxy::ResolveURIComplete [%d]", this ); - __ASSERTD( iProxyState == EStateDownloading,__FILE__, __LINE__ ); - - if ( aError == KErrNone ) - { - TRAPD( initerror, iLocalPlayer->InitialiseL( - iTrack->FilePath() ) ); - - if ( initerror != KErrNone ) - { - __LOG1( "DownloadProxy:local player init leaves: %d", - initerror ); - Cleanup(); - iProxyState = EStateUninitialised; - //translate error - initerror = TUpnpPluginsErrorTranslation::ErrorTranslate( - initerror ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, 0, initerror ); - } - else - { - iProxyState = EStateInitialisingLocally; - } - } - else - { - __LOG1("DownloadProxy::ResolveURIComplete: error %d", - aError ); - Cleanup(); - iProxyState = EStateUninitialised; - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( - aError ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, - 0, aError ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::CommandL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::CommandL( TMPXPlaybackCommand aCmd, - TInt aData ) - { - __LOG2( "DownloadProxy::CommandL(%d) [%d]", aCmd, this ); - - if( iProxyState == EStateActive ) - { - // ACTIVE state: all commands are forwarded to local plugin - __LOG( "DownloadProxy: command in active state" ); - iLocalPlayer->CommandL( aCmd, aData ); - } - else if ( iProxyState == EStatePreparing && aCmd == EPbCmdClose ) - { - __LOG( "DownloadProxy: Close during prepare" ); - Cleanup(); - iProxyState = EStateUninitialised; - iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPClosed, - 0, KErrNone ); - } - else if( iProxyState == EStateDownloading && aCmd == EPbCmdClose ) - { - __LOG( "DownloadProxy: Close during download" ); - Cleanup(); // this will cancel ongoing copy - iProxyState = EStateUninitialised; - iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPClosed, - 0, KErrNone ); - } - else if( iProxyState == EStateInitialisingLocally && - aCmd == EPbCmdClose ) - { - __LOG( "DownloadProxy: Close when initialising locally" ); - iLocalPlayer->CommandL( aCmd, aData ); - } - else if( iProxyState == EStateUninitialised && aCmd == EPbCmdClose ) - { - __LOG( "DownloadProxy: Close when uninitialized" ); - iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPClosed, - 0, KErrNone ); - } - else if( ( iProxyState == EStatePreparing || - iProxyState == EStateDownloading || - iProxyState == EStateInitialisingLocally || - iProxyState == EStateUninitialised ) && aCmd == EPbCmdStop ) - { - __LOG( "DownloadProxy: Stop during any state" ); - iLocalPlayer->CommandL( aCmd, aData ); - } - else // Not initialized - { - __LOG1( "DownloadProxy: Command not supported in this state: %d", - iProxyState ); - User::Leave( KErrNotReady ); - } - - // check for messages from upnp framework (aData param) - if ( aCmd == EPbCmdClose && - aData == KMusicPluginMessageExit ) - { - __LOG( "CommandL(Close, exit) -> cleanup and terminate" ); - - // cancel things that are ongoing - Cleanup(); - iLocalPlayer->CancelRequest(); - iProxyState = EStateUninitialised; - - // Create event to user - - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayerUnavailable, - 0, KErrDisconnected); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::SetL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::SetL( TMPXPlaybackProperty aProperty, - TInt aValue ) - { - __LOG1( "DownloadProxy::SetL [%d]", this ); - __LOG1( "Property=%d", (TInt)aProperty ); - iLocalPlayer->SetL( aProperty, aValue ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::ValueL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::ValueL( TMPXPlaybackProperty aProperty ) const - { - __LOG1( "DownloadProxy::ValueL [%d]", this ); - iLocalPlayer->ValueL( aProperty ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::SubPlayerNamesL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::SubPlayerNamesL() - { - iLocalPlayer->SubPlayerNamesL(); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::SelectSubPlayerL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::SelectSubPlayerL( TInt aIndex ) - { - iLocalPlayer->SelectSubPlayerL( aIndex ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::SubPlayerName -// Returns current sub player name -// -------------------------------------------------------------------------- -// -const TDesC& CUPnPMusicDownloadProxy::SubPlayerName() - { - return iLocalPlayer->SubPlayerName(); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::SubPlayerIndex -// -------------------------------------------------------------------------- -// -TInt CUPnPMusicDownloadProxy::SubPlayerIndex() const - { - return iLocalPlayer->SubPlayerIndex(); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::MediaL -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::MediaL( const TArray& aAttrs ) - { - // Get metadata from media server - if( iTrack ) - { - __LOG1( "DownloadProxy: Get metadata [%d]", this ); - iTrack->GetMetaDataL( aAttrs, *iObs ); - } - else - { - __LOG( "DownloadProxy: Get metadata - no track!" ); - User::Leave( KErrNotReady ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::CancelRequest -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::CancelRequest() - { - __LOG( "CUPnPMusicDownloadProxy::CancelRequest" ); - if( iProxyState == EStateDownloading ) - { - Cleanup(); // this will cancel ongoing copy - iProxyState = EStateUninitialised; - // Send "downloading cancelled" event to the user - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPDownloadingCanceled, - 0, KErrGeneral ); - } - iLocalPlayer->CancelRequest(); - } - - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::SetObserver -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::SetObserver(MMPXPlaybackPluginObserver& aObs) - { - CMPXPlaybackPlugin::SetObserver( aObs ); - - iLocalPlayer->SetObserver( *this ); - } - -// -------------------------------------------------------------------------- -// Methods from MMPXPlaybackPluginObserver -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::HandlePluginEvent -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::HandlePluginEvent( TEvent aEvent, - TInt aData, TInt aError ) - { - __LOG1( "DownloadProxy::HandlePluginEvent [%d]", this ); - - switch( aEvent ) - { - case EPInitialised: - { - __ASSERTD( iProxyState == EStateInitialisingLocally,__FILE__, - __LINE__ ); - __LOG1( "DownloadProxy: initialised event, err=%d", - aError ); - - // Proxied local plugin initialized - if ( aError == KErrNone ) - { - iProxyState = EStateActive; - - iObs->HandlePluginEvent( aEvent, aData, aError ); - } - else - { - iProxyState = EStateClosing; - TRAP_IGNORE ( - iLocalPlayer->CommandL( EPbCmdClose, 0 ) ); - } - - if ( iProxyState == EStateActive ) - { - TRAP_IGNORE( - iTrack->SendMediaChangedEventL( *iObs ); - ); - } - break; - } - case EPPlaying: // fall through - case EPPlayComplete: // fall through - case EPPaused: // fall through - case EPStopped: // fall through - case EPDownloadStarted: // fall through - case EPDownloadingComplete: // fall through - case EPSubPlayersChanged: // fall through - case EPVolumeChanged: // fall through - case EPSetComplete: - { - __LOG2( "DownloadProxy plugin event=%d err=%d", - (TInt)aEvent, aError ); - - // Just forward event to the user. - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( - aError ); - iObs->HandlePluginEvent( aEvent, aData, aError ); - break; - } - case EPClosed: - { - __LOG( "DownloadProxy: closed event" ); - - // a Stop command has changed. It will send back a Stopped event - // and then a Closed event. Following Pause command will not be - // accepted in Uninitialized state and CommandL() will leave. - // This change in MPX was necessary to let engine know the file - // was closed. One additional aData parameter is passed in - // iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed, - // EPbCmdStop, KErrNone); to know the difference between a - // real Close and a Stop/Close. When this happens, EPClosed event - // should be ignored. - if( aData == EPbCmdStop ) - { - break; - } - - Cleanup(); - - // If iProxyState is EStateClosing, initialise of - // localplaybackplugin is failed -> send initialised event with - // an error code to the user. - // Otherwise forward event to the user normally. - if( iProxyState == EStateClosing ) - { - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, - 0, KErrNotSupported ); - } - else - { - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( - aError ); - iObs->HandlePluginEvent( aEvent, aData, aError ); - } - iProxyState = EStateUninitialised; - break; - } - default: - { - __LOG( "DownloadProxy: Default event?" ); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::HandleProperty -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::HandleProperty( TMPXPlaybackProperty aProperty, - TInt aValue, TInt aError ) - { - __LOG1( "DownloadProxy::HandleProperty [%d]", this ); - - iObs->HandleProperty( aProperty, aValue, aError ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::HandleSubPlayerNames -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::HandleSubPlayerNames( TUid aPlayer, - const MDesCArray* aSubPlayers, TBool aComplete, TInt aError ) - { - iObs->HandleSubPlayerNames( aPlayer, aSubPlayers, aComplete, aError ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::HandleMedia -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::HandleMedia( const CMPXMedia& aProperties, - TInt aError ) - { - __LOG1( "DownloadProxy::HandleMedia [%d]", this ); - - iObs->HandleMedia( aProperties, aError ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicDownloadProxy::CleanUpSession -// -------------------------------------------------------------------------- -// -void CUPnPMusicDownloadProxy::Cleanup() - { - __LOG1( "DownloadProxy::Cleanup [%d]", this ); - if( iTrack ) - { - delete iTrack; - iTrack = 0; - } - __LOG( "DownloadProxy::Cleanup - End"); - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpmusicperiodizer.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicperiodizer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +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: Periodic timer support resource -* -*/ - - - - - - -// INCLUDES -#include "upnpmusicperiodizer.h" - -const TInt KPlaybackInfoTimeOutEnd = 2000000; // 2s wait check whether - //the playing is ended -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::NewL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicPeriodizer* CUPnPMusicPeriodizer::NewL( - MUPnPMusicPeriodizerObserver& aObserver, - TInt32 aTimerWavelength ) - { - CUPnPMusicPeriodizer* p = CUPnPMusicPeriodizer::NewLC( - aObserver, aTimerWavelength ); - CleanupStack::Pop(); - return p; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::NewLC -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicPeriodizer* CUPnPMusicPeriodizer::NewLC( - MUPnPMusicPeriodizerObserver& aObserver, - TInt32 aTimerWavelength ) - { - - CUPnPMusicPeriodizer* p = new(ELeave) CUPnPMusicPeriodizer( aObserver, - aTimerWavelength ); - CleanupStack::PushL( p ); - p->ConstructL(); - return p; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::~CUPnPMusicPeriodizer -// Desctructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicPeriodizer::~CUPnPMusicPeriodizer() - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::CUPnPMusicPeriodizer -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicPeriodizer::CUPnPMusicPeriodizer( - MUPnPMusicPeriodizerObserver& aObserver, - TInt32 aTimerWavelength ) - :CTimer( EPriorityStandard ), - iObserver( aObserver ), - iTimerWavelength( aTimerWavelength ) - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::ConstructL -// -------------------------------------------------------------------------- -// -void CUPnPMusicPeriodizer::ConstructL() - { - CTimer::ConstructL(); - CActiveScheduler::Add(this); - } - -// -------------------------------------------------------------------------- -// Periodizer services -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::Start -// Starts the periodizer. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPeriodizer::Start() - { - if ( !IsActive() ) - { - After( TTimeIntervalMicroSeconds32( iTimerWavelength ) ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::Continue -// Continues a next step for the periodizer. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPeriodizer::Continue() - { - After( TTimeIntervalMicroSeconds32( iTimerWavelength ) ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::RunL -// Receives the timer triggering. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPeriodizer::RunL() - { - // deliver the periodic event to the observer - if ( iTimerWavelength == KPlaybackInfoTimeOutEnd ) - { - iObserver.HandlePeriodForEnd(); - } - else - { - iObserver.HandlePeriod(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPeriodizer::Stop -// Stops periodizer. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPeriodizer::Stop() - { - Cancel(); - } - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpmusicplayer.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicplayer.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1466 +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 playing files in a remote upnp renderer -* -*/ - - - - - - -// INCLUDES -#include "upnpavcontrollerfactory.h" -#include "upnpavcontroller.h" -#include "upnpfileutility.h" -#include "upnpavrenderingsession.h" -#include "upnpavdevice.h" -#include - -#include "upnpmusicplayer.h" -#include "upnpsingleton.h" -#include "upnptrack.h" -#include "upnpplaybackstatemachine.h" -#include "upnpvaluestatemachine.h" -#include "upnppluginserrortranslation.h" - - -// CONSTANTS -// ** a message to music player to complete an immediate exit -const TInt KMusicPluginMessageExit = 3001; -const TUid KMusicPlayerUid = { 0x200075D8 }; - -_LIT( KStateUninitialized, "Uninitialised" ); -_LIT( KStateUninitialising, "Uninitialising" ); -_LIT( KStateInitializing, "Initializing" ); -_LIT( KStateActive, "Active" ); -_LIT( KStatePreInitializing, "PreInitializing" ); -_LIT( KStatePreInitialized, "PreInitialized" ); -_LIT( KStateWaiting, "Waiting" ); -_LIT( KStateActiveForceInit, "ActiveForceInit" ); -_LIT( KStateError, "Error" ); -_LIT( KStateUnknown, "Unknown" ); - - -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" - -// LOCAL FUNCTIONS - - /* - * a template helper function to safely delete a pointer - * (make sure pointer becomes NULL before delete is called) - * 1. first copy the given pointer to a local temp variable - * 2. then allocate a local member, then nullify the given pointer - * 3. last, delete the temporary pointer - */ - template - inline void SafeDelete( T*& aPointer ) - { - // first, store the given object into a local temp variable - T* tempPointer = aPointer; - // nullify the given pointer - aPointer = 0; - // last, delete the given object - delete tempPointer; - } - -// -------------------------------------------------------------------------- -// Static members of CUPnPMusicPlayer -// -------------------------------------------------------------------------- -// - -// Pointer to the plugin that is active at the time -CUPnPMusicPlayer* CUPnPMusicPlayer::iActivePlugIn; - -// Pointer to the plugini that is waiting to activate (pre-initialized) -CUPnPMusicPlayer* CUPnPMusicPlayer::iNextPlugIn; - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::NewL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicPlayer* CUPnPMusicPlayer::NewL( MMPXPlaybackPluginObserver& aObs ) - { - CUPnPMusicPlayer* p = new(ELeave) CUPnPMusicPlayer( aObs ); - CleanupStack::PushL( p ); - __LOG1( "CUPnPMusicPlayer::NewL [%d]", p ); - p->ConstructL(); - CleanupStack::Pop( p ); - return p; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::CUPnPMusicPlayer -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicPlayer::CUPnPMusicPlayer( MMPXPlaybackPluginObserver& aObs ) : - iSelectedRendererIndex( KErrNotFound ), - iPlayerState( EStateUninitialised ), - iIsReady( EFalse ) - { - iObs = &aObs; - iTrack = NULL; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::ConstructL -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::ConstructL() - { - __LOG( "CUPnPMusicPlayer::ConstructL" ); - - // get a handle to the shared singleton - iSingleton = CUPnPSingleton::GetInstanceL(); - - // audio policy - iAudioPolicy = CUPnPAudioPolicy::NewL( *this ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::~CUPnPMusicPlayer -// Destructor. -// -------------------------------------------------------------------------- -// -CUPnPMusicPlayer::~CUPnPMusicPlayer() - { - __LOG( "CUPnPMusicPlayer::~CUPnPMusicPlayer()" ); - UninitialiseTrack( EStateNone ); - - if( iSingleton != NULL ) - { - CUPnPSingleton::LoseInstance( iSingleton ); - iSingleton = NULL; - } - - delete iAudioPolicy; - iAudioPolicy = 0; - delete iSelectedRenderer; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::MatchRenderer -// Compares renderers names -// -------------------------------------------------------------------------- -// -TBool CUPnPMusicPlayer::MatchRenderer( - const CUpnpAVDevice* aRenderer ) const - { - if( aRenderer == NULL ) - { - // no renderer - using default renderer, which is always - // the same as previously selected renderer -> ALWAYS MATCH. - return ETrue; - } - - if( iSelectedRenderer == NULL ) - { - // Current renderer does not exist - this should never happen. - __PANICD( __FILE__, __LINE__ ); - return ETrue; - } - - // compare renderer pointer - if ( iSelectedRenderer == aRenderer ) - { - return ETrue; - } - - // Compare renderer UUID - if ( iSelectedRenderer->Uuid().Compare( aRenderer->Uuid() ) == 0 ) - { - return ETrue; - } - - return EFalse; - } - - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::UsedRendererDevice -// Returns currently used renderer device -// -------------------------------------------------------------------------- -// -CUpnpAVDevice& CUPnPMusicPlayer::UsedRendererDevice() const - { - return *iSelectedRenderer; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SetActive -// Set Plugin state to active. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::SetActive( TBool aForceInitialise ) - { - __LOG( "CUPnPMusicPlayer::SetActive" ); - - if ( iActivePlugIn != 0 && - iActivePlugIn->MatchRenderer( iSelectedRenderer ) ) - { - // Continuing playback on the same renderer. - // copy some cached values - // - iValueStateMachine->CopyValues( - iActivePlugIn->ValueStateMachine() ); - } - - if( iPlayerState == EStatePreInitialized ) - { - // Preinitialize is ready. Clear pointer from iNextPlugin and - // sets it to iActivePlugIn. - iActivePlugIn = this; - iNextPlugIn = NULL; - if( aForceInitialise ) - { - ChangeState( EStateActiveForceInitialise ); - TRAP_IGNORE( iAudioPolicy->PlayL() ); - } - else - { - ChangeState( EStateActive ); - TRAP_IGNORE( iAudioPolicy->PlayL() ); - } - } - else if( iPlayerState == EStateWaiting ) - { - // Used renderer does not support SetNextURI feature. Initialise - // track by SetURI after play command. - iActivePlugIn = this; - iNextPlugIn = NULL; - ChangeState( EStateActiveForceInitialise ); - } - else if( iPlayerState == EStateActive ) - { - // do nothing - iActivePlugIn = this; - iNextPlugIn = NULL; - ChangeState( EStateActive ); - TRAP_IGNORE( iAudioPolicy->PlayL() ); - } - else if( iPlayerState == EStatePreInitializing ) - { - // Do nothing. - } - else - { - __LOG1( "CUPnPMusicPlayer::SetActive in wrong state %S", - State( iPlayerState ) ); - __PANICD( __FILE__, __LINE__ ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::Observer -// -------------------------------------------------------------------------- -// -MMPXPlaybackPluginObserver& CUPnPMusicPlayer::Observer() const - { - __ASSERTD( iObs != 0, __FILE__, __LINE__ ); - return *iObs; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::PlaybackStateMachine -// -------------------------------------------------------------------------- -// -const CUPnPPlaybackStateMachine& - CUPnPMusicPlayer::PlaybackStateMachine() const - { - __ASSERTD( iPlaybackStateMachine != 0, __FILE__, __LINE__ ); - return *iPlaybackStateMachine; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::ValueStateMachine -// -------------------------------------------------------------------------- -// -const CUPnPValueStateMachine& - CUPnPMusicPlayer::ValueStateMachine() const - { - __ASSERTD( iValueStateMachine != 0, __FILE__, __LINE__ ); - return *iValueStateMachine; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::Track -// -------------------------------------------------------------------------- -// -CUPnPTrack& CUPnPMusicPlayer::Track() const - { - __ASSERTD( iTrack != 0, __FILE__, __LINE__ ); - return *iTrack; - } - - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::HandlePlayStarted -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::HandlePlayStarted() - { - __LOG( "CUPnPMusicPlayer::HandlePlayStarted" ); - - // Remote device is ready for give playback information - // (duration, position..) - iIsReady = ETrue; - - // Inform user that playback is started - iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlaying, 0, - KErrNone ); - - if( iValueStateMachine && iTrack ) - { - // always query volume. Duration if not already exist or in - // case of remote track. - TRAP_IGNORE( - iValueStateMachine->VolumeQueryL(); - if( iTrack->TrackDuration() == 0 || iTrack->IsRemote() ) - { - iValueStateMachine->DurationQueryL(); - } - ) - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::HandlePlayComplete -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::HandlePlayComplete() - { - __LOG( "CUPnPMusicPlayer::HandlePlayComplete" ); - - iAudioPolicy->Stop(); - - // If there is a next initialized plugin then active it - if( iActivePlugIn == this && iNextPlugIn != 0 ) - { - // Set iActivePlugIn to null. - iNextPlugIn->SetActive( EFalse ); - } - } - - -// -------------------------------------------------------------------------- -// Methods from CMPXPlaybackPlugin -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::InitialiseL( const TDesC& aSong ) -// Initializes a song for playback. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::InitialiseL( const TDesC& aSong ) - { - // Initialise song for play back. - InitialiseTrackL( aSong ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::InitialiseL( RFile& aSong ) -// Initializes a song for playback. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::InitialiseL( RFile& aSong ) - { - // At first get the song path from given resource file - HBufC* tempBuf = HBufC::NewL( KMaxFileName ); - CleanupStack::PushL( tempBuf ); - TPtr ptr = tempBuf->Des(); - TInt err = aSong.FullName( ptr ); - - // Leave if any error - if( err != KErrNone ) - { - User::Leave( KErrArgument ); - } - - // Initialise song for play back. - InitialiseTrackL( *tempBuf ); - CleanupStack::PopAndDestroy( tempBuf ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::InitialiseTrackL -// Initializes a remote or local song for playback -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::InitialiseTrackL( const TDesC& aSong ) - { - __LOG1( "CUPnPMusicPlayer::InitialiseTrackL [%d]", this ); - __ASSERTD( iPlayerState == EStateUninitialised, __FILE__, __LINE__ ); - - // some state checks - if ( iPlayerState != EStateUninitialised ) - { - __LOG( "CUPnPMusicPlayer::InitialiseTrackL: In wrong state! " ); - User::Leave( KErrNotReady ); - } - if( ( iActivePlugIn != NULL ) && ( iNextPlugIn != NULL ) ) - { - __LOG( "CUPnPMusicPlayer::InitialiseTrackL - \ - More than two plugin initialisezed at the same time! " ); - User::Leave( KErrNotReady ); - } - if( iSelectedRenderer == 0 ) - { - __LOG( "CUPnPMusicPlayer::InitialiseTrackL - \ - Subplayer not selected " ); - User::Leave( KErrNotReady ); - } - - if( aSong.Length() == 0 ) - { - User::Leave( KErrNotSupported ); - } - - __LOG( "CUPnPMusicPlayer::InitialiseTrackL: Start rendering session" ); - MUPnPAVRenderingSession* tempSession = - &iSingleton->AVC().StartRenderingSessionL( *iSelectedRenderer ); - - __LOG( "CUPnPMusicPlayer::InitialiseTrackL - \ - Set Rendering session observer" ); - // Set media observer - tempSession->SetObserver( *this ); - - // stop existing rendering session if exists - if( iRendererSession ) - { - __LOG( "CUPnPMusicPlayer::InitialiseTrackL: Stop old session" ); - // releasing local MS services is left to AVController - iSingleton->AVC().StopRenderingSession( *iRendererSession ); - iRendererSession = 0; - } - - iRendererSession = tempSession; - - // Set plugin to active and call SetURI if there is no track - // playing currently or the track playing currently is in - // different renderer - if( iActivePlugIn == NULL ) - { - // There is no track playing currently - iActivePlugIn = this; // Set Plugin to the active. - ChangeState( EStateInitializing ); - } - else // Track is currently playing. - { - // Check if track is playing in different renderer - if( iActivePlugIn->MatchRenderer( iSelectedRenderer ) ) - { - iNextPlugIn = this; // Set plugin to the next - ChangeState( EStatePreInitializing ); - } - else - { - // Track is playing but different renderer - ChangeState( EStateInitializing ); - } - } - - // Create state machines - iPlaybackStateMachine = CUPnPPlaybackStateMachine::NewL( - *this, *iRendererSession ); - - iValueStateMachine = CUPnPValueStateMachine::NewL( - *this, *iRendererSession ); - - // Create track object to resolving URI - iTrack = CUPnPTrack::NewL( iSingleton->AVC() ); - iTrack->ResolveURIL( aSong, *this, CUPnPTrack::EDirectionRemote ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::UninitialiseTrack -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::UninitialiseTrack( TPlayerState aToState ) - { - __LOG1( "CUPnPMusicPlayer::UninitialiseTrack(%S)", - State( aToState ) ); - ChangeState( EStateUninitialising ); - - if ( iAudioPolicy ) - { - iAudioPolicy->Stop(); - } - - if ( iActivePlugIn == this ) - { - iActivePlugIn = 0; - } - if ( iNextPlugIn == this ) - { - iNextPlugIn = 0; - } - - if( iPlaybackStateMachine ) - { - delete iPlaybackStateMachine; - iPlaybackStateMachine = 0; - } - - if( iValueStateMachine ) - { - delete iValueStateMachine; - iValueStateMachine = 0; - } - - // Rendering session is not cleared until destructor. - if( iRendererSession && aToState == EStateNone ) - { - // releasing local MS services is left to AVController - iSingleton->AVC().StopRenderingSession( *iRendererSession ); - iRendererSession = 0; - } - - iSelectedRendererIndex = KErrNotFound; - iIsReady = EFalse; - - if ( iTrack ) - { - // request track to delete itself - CUPnPTrack* tempTrack = iTrack; - iTrack = NULL; - tempTrack->Delete(); - } - - ChangeState( aToState ); - __LOG( "CUPnPMusicPlayer::UninitialiseTrack - End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::ResolveURIComplete -// from MUPnPTrackObserver -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::ResolveURIComplete( TInt aError ) - { - __LOG2( "CUPnPMusicPlayer::ResolveURIComplete in state %S [%d]", - State( iPlayerState ), this ); - - if ( aError == KErrNone ) - { - // Check is local or remote - TRAPD( error, SetURIL() ); - if ( error != KErrNone ) - { - __LOG1("CUPnPMusicPlayer::ResolveURIComplete: leaves with %d", - error ); - UninitialiseTrack(); - error = TUpnpPluginsErrorTranslation::ErrorTranslate( - error ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, - 0, error ); - } - } - else - { - __LOG1("CUPnPMusicPlayer::ResolveURIComplete: error %d", - aError ); - UninitialiseTrack(); - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( - aError ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, - 0, aError ); - } - } - - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SetURIL -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::SetURIL() - { - __LOG( "CUPnPMusicPlayer::SetURIL" ); - - switch( iPlayerState ) - { - case EStateInitializing: // flow through - case EStateActiveForceInitialise: - { - iRendererSession->SetURIL( - iTrack->UpnpURI(), iTrack->UpnpItem() ); - } - break; - case EStatePreInitializing: - { - // Set NextUri if action is supported by used device - if( iSelectedRenderer->NextAVTransportUri() ) - { - __LOG( "CUPnPMusicPlayer::SetURIL - \ - Remote:SetNextURI" ); - - iRendererSession->SetNextURIL( - iTrack->UpnpURI(), iTrack->UpnpItem() ); - } - else - { - __LOG( "CUPnPMusicPlayer::SetURI - \ - SetNextURI is not supported by used device" ); - - // Used renderer does not support SetNextURI feature. - // Initialise track by SetURI after play is called. - ChangeState( EStateWaiting ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, - iTrack->TrackDuration(), KErrNone ); - if ( iPlayerState == EStateWaiting ) - { - if( iTrack->IsRemote() ) - { - iTrack->SendMediaChangedEventL( *iObs ); - } - } - } - } - break; - case EStatePauseInActiveForceInitialise: - { - // This case happens when active plugin is paused and user - // skips to the next track from UI. - __LOG( "SetURI during EStatePauseInActiveForceInitialise" ); - iRendererSession->SetURIL( - iTrack->UpnpURI(), iTrack->UpnpItem() ); - } - break; - default: - { - __PANICD( __FILE__, __LINE__ ); - } - break; - } - - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::CommandL -// Executes a command on the selected song. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::CommandL( TMPXPlaybackCommand aCmd, TInt aData ) - { - __LOG3( "CUPnPMusicPlayer::CommandL(%d) in state %S [%d]", - aCmd, State( iPlayerState ), this ); - - switch( iPlayerState ) - { - case EStateUninitialised: // fall through - case EStateUninitialising: // fall through - { - // ignore everything - } - case EStateError: - { - // Only Stop and Close will be handled. - // All other commands ignored. - if ( aCmd == EPbCmdStop ) - { - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPStopped, - KErrNone, KErrNone ); - } - if ( aCmd == EPbCmdClose ) - { - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPClosed, - KErrNone, KErrNone ); - } - break; - } - case EStateInitializing: // fall through - case EStatePreInitializing: // fall through - case EStatePreInitialized: // fall through - case EStateWaiting: // fall through - case EStateActiveForceInitialise: - { - if( aCmd == EPbCmdStop ) - { - // answer directly to stopped message - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPStopped, - KErrNone, KErrNone ); - } - if( aCmd == EPbCmdPlay && - ( iPlayerState == EStateActiveForceInitialise ) ) - { - __LOG( "CUPnPMusicPlayer::Command(play)->SetURI" ); - SetURIL(); - } - if( aCmd == EPbCmdPlay && iPlayerState == EStateWaiting ) - { - // This plugin has to be set active because track has forced - // to be skipped by user. - SetActive( ETrue ); - SetURIL(); - } - if( aCmd == EPbCmdPlay && iPlayerState == EStatePreInitialized ) - { - // This plugin has to be set active because track has forced - // to be skipped by user. - SetActive( ETrue ); - SetURIL(); - } - if( aCmd == EPbCmdPause && - ( iPlayerState == EStateActiveForceInitialise || - iPlayerState == EStateWaiting ) ) - { - // This case happens when active plugin is paused and user - // skips to the next track from UI -> next track must be - // switched to paused state. - __LOG( "Pause command during EStateActiveForceInitialise" ); - iPlayerState = EStatePauseInActiveForceInitialise; - SetURIL(); - } - - if ( aCmd == EPbCmdClose ) - { - UninitialiseTrack(); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPClosed, - KErrNone, KErrNone ); - } - break; - } - case EStateActive: - { - iPlaybackStateMachine->CommandL( aCmd ); - if( aCmd == EPbCmdStop ) - { - if ( this == iActivePlugIn && iNextPlugIn != 0 ) - { - __LOG( "CommandL(stop)->SetActive()" ); - iNextPlugIn->SetActive( ETrue ); - } - } - if( aCmd == EPbCmdPause ) - { - if ( this == iActivePlugIn && iNextPlugIn != 0 ) - { - __LOG( "CommandL(pause)->SetActive()" ); - iNextPlugIn->SetActive( EFalse ); - } - } - if( aCmd == EPbCmdClose ) - { - if ( this == iActivePlugIn && iNextPlugIn != 0 ) - { - __LOG( "CommandL(close)->SetActive()" ); - iNextPlugIn->SetActive( ETrue ); - } - UninitialiseTrack(); - } - break; - } - default: - { - __LOG( "CUPnPMusicPlayer::CommandL - Default" ); - break; - } - } - - // check for messages from upnp framework (aData param) - if ( aCmd == EPbCmdClose && - aData == KMusicPluginMessageExit ) - { - __LOG( "CommandL(Close, exit) -> cleanup and terminate" ); - - // cancel things that are ongoing - CancelRequest(); - // clear resources - UninitialiseTrack( EStateError ); - - // Create event to user - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayerUnavailable, - 0, KErrDisconnected ); - } - - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SetL -// Sets a property of the plugin. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::SetL( TMPXPlaybackProperty aProperty, TInt aValue ) - { - __LOG2( "CUPnPMusicPlayer::SetL in state %S [%d]", - State( iPlayerState ), this ); - - CUPnPValueStateMachine::TValidationResult result = - CUPnPValueStateMachine::ValidatePropertyInState( - aProperty, ETrue, iPlayerState, iIsReady ); - - if ( result == CUPnPValueStateMachine::EHandle ) - { - if ( aProperty == EPbPropertyPosition ) - { - // Position changes are handled in playback s.m. - iPlaybackStateMachine->PositionL( aValue ); - } - else - { - // all other values in value s.m. - iValueStateMachine->SetL( aProperty, aValue ); - } - } - else if ( result == CUPnPValueStateMachine::EHandleStatic ) - { - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - (TInt)aProperty, KErrNone ); - } - else if ( result == CUPnPValueStateMachine::EErrorNotReady ) - { - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - (TInt)aProperty, KErrNotReady ); - } - else if ( result == CUPnPValueStateMachine::EErrorNotSupported ) - { - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - (TInt)aProperty, KErrNotSupported ); - } - else if ( result == CUPnPValueStateMachine::EIgnore ) - { - // do nothing - } - else - { - __PANICD( __FILE__, __LINE__ ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::ValueL -// Gets a property of the plugin (async). -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::ValueL( TMPXPlaybackProperty aProperty ) const - { - __LOG2( "CUPnPMusicPlayer::ValueL in state %S [%d]", - State( iPlayerState ), this ); - - CUPnPValueStateMachine::TValidationResult result = - CUPnPValueStateMachine::ValidatePropertyInState( - aProperty, EFalse, iPlayerState, iIsReady ); - - if ( result == CUPnPValueStateMachine::EHandle ) - { - iValueStateMachine->ValueL( aProperty ); - } - else if ( result == CUPnPValueStateMachine::EHandleStatic ) - { - CUPnPValueStateMachine::ValueStatic( aProperty, *iObs ); - } - else if ( result == CUPnPValueStateMachine::EErrorNotReady ) - { - iObs->HandleProperty( aProperty, - 0, KErrNotReady ); - } - else if ( result == CUPnPValueStateMachine::EErrorNotSupported ) - { - iObs->HandleProperty( aProperty, - 0, KErrNotSupported ); - } - else if ( result == CUPnPValueStateMachine::EIgnore ) - { - // do nothing - } - else - { - __PANICD( __FILE__, __LINE__ ); - } - - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SubPlayerNamesL -// Gets a list of sub players (async). -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::SubPlayerNamesL() - { - __LOG1( "CUPnPMusicPlayer::SubPlayerNamesL [%d]", this ); - - // Get media renderers from renderer selector - iSingleton->GetRendererNamesL( *this ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SelectSubPlayerL -// Select a sub player. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::SelectSubPlayerL( TInt aIndex ) - { - __LOG1( "CUPnPMusicPlayer::SelectSubPlayerL [%d]", this ); - - // this method can only be called in uninitialized state - __ASSERTD( iPlayerState == EStateUninitialised || - aIndex == iSelectedRendererIndex, __FILE__, __LINE__ ); - - // Select media renderer. Ignore if already selected. - if ( iSelectedRendererIndex != aIndex ) - { - iSelectedRendererIndex = aIndex; - CUpnpAVDevice* tempDev = CUpnpAVDevice::NewL( - *iSingleton->SelectRendererByIndexL( aIndex ) ); - delete iSelectedRenderer; - iSelectedRenderer = tempDev; - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SubPlayerName -// Returns current sub player name -// -------------------------------------------------------------------------- -// -const TDesC& CUPnPMusicPlayer::SubPlayerName() - { - __LOG1( "CUPnPMusicPlayer::SubPlayerName [%d]", this ); - if ( iSelectedRenderer ) - { - iSelectedRendererName.Copy( - iSelectedRenderer->FriendlyName() ); - } - else if ( iSingleton->DefaultDevice() ) - { - iSelectedRendererName.Copy( - iSingleton->DefaultDevice()->FriendlyName() ); - } - else - { - iSelectedRendererName.Copy( KNullDesC ); - } - return iSelectedRendererName; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SubPlayerIndex -// Return current sub player index. -// -------------------------------------------------------------------------- -// -TInt CUPnPMusicPlayer::SubPlayerIndex() const - { - __LOG1( "CUPnPMusicPlayer::SubPlayerIndex [%d]", this ); - - // Get current sub player index - return iSelectedRendererIndex; - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::MediaL -// Extended properties of the current file (async). -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::MediaL( const TArray& aAttrs ) - { - __LOG2( "CUPnPMusicPlayer::MediaL in state %S [%d]", - State( iPlayerState ), this ); - - // Get media if track is initialised - if( iTrack ) - { - iTrack->GetMetaDataL( aAttrs, *iObs ); - } - else - { - __LOG( "CUPnPMusicPlayer::MediaL - Wrong state!" ); - User::Leave( KErrNotReady ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::CancelRequest -// Cancel outstanding request. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::CancelRequest() - { - __LOG2( "CUPnPMusicPlayer::CancelRequest in state %S [%d]", - State( iPlayerState ), this ); - - // If cancel is called during initialise - if( iPlayerState == EStateInitializing || - iPlayerState == EStatePreInitializing || - iPlayerState == EStateActiveForceInitialise || - iPlayerState == EStateActive ) - { - // Stop rendering session -> SetURI operation will be cancelled - UninitialiseTrack( EStateNone ); - iPlayerState = EStateUninitialised; - } - else if( iPlayerState == EStateUninitialising ) - { - // Ignore. Do not call state machines. - return; - } - - if ( iSingleton != 0 ) - { - iSingleton->CancelGetRendererNames(); - } - if ( iPlaybackStateMachine ) - { - iPlaybackStateMachine->Cancel(); - } - if ( iValueStateMachine ) - { - iValueStateMachine->Cancel(); - } - } - -// -------------------------------------------------------------------------- -// Methods of MUPnPAVRenderingSessionObserver -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::VolumeResult -// Response for get/set volume property commands. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::VolumeResult( TInt aError, TInt aVolumeLevel, - TBool aActionResponse ) - { - __LOG2( "CUPnPMusicPlayer::VolumeResult in state %S [%d]", - State( iPlayerState ), this ); - - if( iValueStateMachine ) - { - iValueStateMachine->VolumeResult( aError, aVolumeLevel, - aActionResponse ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::MuteResult -// Response for get/set mute property commands. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::MuteResult( TInt aError, TBool aMute, - TBool aActionResponse ) - { - __LOG2( "CUPnPMusicPlayer::MuteResult in state %S [%d]", - State( iPlayerState ), this ); - - if( iValueStateMachine ) - { - iValueStateMachine->MuteResult( aError, aMute, aActionResponse ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::InteractOperationComplete -// Response for interaction operation (play, stop, etc.). -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::InteractOperationComplete( TInt aErrorCode, - TUPnPAVInteractOperation aOperation ) - { - __LOG3( "CUPnPMusicPlayer::InteractOp.Comp(%d) in state %S [%d]", - aOperation, State( iPlayerState ), this ); - - if( iPlayerState == EStateActive ) - { - if( iPlaybackStateMachine ) - { - iPlaybackStateMachine->InteractOperationComplete( aErrorCode, - aOperation ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::PositionInfoResult -// Response for position/duration requests. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::PositionInfoResult( TInt aStatus, - const TDesC8& aTrackPosition, const TDesC8& aTrackLength ) - { - __LOG2( "CUPnPMusicPlayer::PositionInfoResult in state %S [%d]", - State( iPlayerState ), this ); - - if( iValueStateMachine ) - { - iValueStateMachine->PositionInfoResult( aStatus, aTrackPosition, - aTrackLength ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SetURIResult -// Response for SetURI. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::SetURIResult( TInt aError ) - { - __LOG3( "CUPnPMusicPlayer::SetURIResult in state %S err=%d [%d]", - State( iPlayerState ), aError, this ); - - if( iPlayerState == EStateInitializing ) - { - // "Normal" response for SetURI - TInt duration(0); - if( aError == KErrNone ) - { - // Set player state to active - ChangeState( EStateActive ); - TRAP_IGNORE( iAudioPolicy->PlayL() ); - duration = iTrack->TrackDuration(); - } - else - { - UninitialiseTrack(); - } - // if aError is KErrGeneral, the music player doesn't skip to - //the next song . translate to KErrCorrupt. - if( aError == KErrGeneral) - { - aError = KErrCorrupt; - } - else - { - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError ); - } - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, duration, aError ); - if ( iPlayerState == EStateActive ) - { - TRAP_IGNORE( - if( iTrack->IsRemote() ) - { - iTrack->SendMediaChangedEventL( *iObs ); - } - ); - } - } - else if( iPlayerState == EStateActiveForceInitialise ) - { - // Response for preinitialise that is failed because of - // used device does not support SetNextUri functionality. - if( aError == KErrNone ) - { - __LOG( "SetURIResult,ActiveForceInitialise->Play" ); - // Set player state to active - iPlayerState = EStateActive; - TRAP_IGNORE( iAudioPolicy->PlayL() ); - - // Play - TRAPD( error, CommandL( EPbCmdPlay, TInt(0) ) ); - if ( error != KErrNone ) - { - UninitialiseTrack(); - // Send play event with error to user. Note play event - // because we are actually performing play command. - error = TUpnpPluginsErrorTranslation::ErrorTranslate( error ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlaying, - 0, error ); - // Send event that device is not available. - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayerUnavailable, - 0, KErrNotFound ); - } - } - else - { - UninitialiseTrack(); - // Send play event with error to user. Note play event - // because weare actually performing play command. - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlaying, - 0, aError ); - } - } - else if( iPlayerState == EStatePauseInActiveForceInitialise ) - { - // This case happens when active plugin is paused and user - // skips to the next track from UI. - __LOG( "SetUriResult during EStatePauseInActiveForceInitialise" ); - - iPlayerState = EStateActive; - if( aError == KErrNone ) - { - // Pause - TRAPD( error, CommandL( EPbCmdPause, TInt(0) ) ); - if ( error != KErrNone ) - { - UninitialiseTrack(); - // Send pause event with error to user. Note pause event - // because we are actually performing pause command. - error = TUpnpPluginsErrorTranslation::ErrorTranslate( error ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPaused, - 0, error ); - } - } - else - { - UninitialiseTrack(); - // Send pause event with error to user. Note pause event - // because we are actually performing pause command. - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPaused, 0, aError ); - } - } - else // Covers also if Cancel request is called during SetURI - { - __LOG( "CUPnPMusicPlayer::SetURIResult - Unknown state " ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::SetNextURIResult -// Response for SetNextURI. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::SetNextURIResult( TInt aError ) - { - __LOG2( "CUPnPMusicPlayer::SetNextURIResult err=%d [%d]", - aError, this ); - - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError ); - if( iPlayerState == EStatePreInitializing ) - { - TInt duration(0); - // Check if any error during SetNextURI call - if( aError == KErrNone ) - { - // Set palyer state to preinitialized - ChangeState( EStatePreInitialized ); - duration = iTrack->TrackDuration(); - } - else - { - // Used renderer does not support SetNextURI feature. - // Initialise track by SetURI after play is called. - ChangeState( EStateWaiting ); - } - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPInitialised, duration, aError ); - if ( iPlayerState == EStatePreInitialized ) - { - TRAP_IGNORE( - if( iTrack->IsRemote() ) - { - iTrack->SendMediaChangedEventL( *iObs ); - } - ); - } - } - else - { - __LOG( "CUPnPMusicPlayer::SetNextURIResult - Wrong state! " ); - __PANICD( __FILE__, __LINE__ ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::MediaRendererDisappeared -// Indication in case of renderer disappear -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::MediaRendererDisappeared( - TUPnPDeviceDisconnectedReason aReason ) - { - __LOG1( "CUPnPMusicPlayer::MediaRendererDisappeared [%d]", - this ); - - if ( aReason == MUPnPAVSessionObserverBase::EWLANLost ) - { - if( iTrack ) - { - if ( iTrack->IsRemote() ) - { - __LOG( "CUPnPMusicPlayer::MediaRendererDisappeared - \ - WLAN disappeared while playing a REMOTE track " ); - // WLAN disappeared while playing a REMOTE track - // stop rendering session and inform player - // Fixes ESLX-7KQERV - CancelRequest(); - UninitialiseTrack( EStateError ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayerUnavailable, - 0, KErrDisconnected ); - } - else - { - __LOG( "CUPnPMusicPlayer::MediaRendererDisappeared - \ - WLAN disappeared while playing a LOCAL track " ); - // WLAN disappeared while playing a LOCAL track - // signal not available. - UninitialiseTrack( EStateError ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayerUnavailable, - 0, KErrNone ); - } - } - else // Track does not exist -> state is already uninitialised - { - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayerUnavailable, - 0, KErrNone ); - } - } - else - { - // renderer disappeared - UninitialiseTrack( EStateUninitialised ); - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayerUnavailable, - 0, KErrNotFound ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::ReserveLocalMSServicesCompleted -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::ReserveLocalMSServicesCompleted( TInt /*aError*/ ) - { - __LOG1( "CUPnPMusicPlayer::ReserveMSCompleted!? [%d]", this ); - // Implementation no needed. - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::HandleSubPlayerNames -// Response for GetSubplayerNames request. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::HandleSubPlayerNames( const MDesCArray* aSubPlayers, - TBool aComplete, TInt aError ) - { - __LOG2( "CUPnPMusicPlayer::HandleSubPlayerNames in state %S [%d]", - State( iPlayerState ), this ); - - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError ); - // Return subplayer names - iObs->HandleSubPlayerNames( KMusicPlayerUid, aSubPlayers, - aComplete, aError ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::RendererListChanged -// Call back if reanderer list has changed. -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::RendererListChanged() - { - __LOG2( "CUPnPMusicPlayer::RendererListChanged in state %S [%d]", - State( iPlayerState ), this ); - - // Create EPSubPlayersChanged event - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSubPlayersChanged, - KErrNone, KErrNone ); - } - - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::AudioConflict -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::AudioConflict( TInt /*aError*/ ) - { - - // stop playing - TRAP_IGNORE( iPlaybackStateMachine->SilentStopL() ); - - // notify framework - iObs->HandlePluginEvent( - MMPXPlaybackPluginObserver::EPStopped, - 0, KErrNone ); - } - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::ChangeState -// -------------------------------------------------------------------------- -// -void CUPnPMusicPlayer::ChangeState( TPlayerState aNewState ) - { - __LOG3( "CUPnPMusicPlayer: STATE %S -> %S [%d]", - State( iPlayerState ), State( aNewState ), this ); - - iPlayerState = aNewState; - } - - -// -------------------------------------------------------------------------- -// CUPnPMusicPlayer::State -// -------------------------------------------------------------------------- -// -const TDesC* CUPnPMusicPlayer::State( TPlayerState aState ) const - { - switch( aState ) - { - case EStateUninitialised: - { - return &KStateUninitialized; - } - case EStateInitializing: - { - return &KStateInitializing; - } - case EStateUninitialising: - { - return &KStateUninitialising; - } - case EStateActive: - { - return &KStateActive; - } - case EStatePreInitializing: - { - return &KStatePreInitializing; - } - case EStatePreInitialized: - { - return &KStatePreInitialized; - } - case EStateWaiting: - { - return &KStateWaiting; - } - case EStateActiveForceInitialise: - { - return &KStateActiveForceInit; - } - case EStateError: - { - return &KStateError; - } - default: - { - return &KStateUnknown; - } - } - } - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpmusicpluginsproxy.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpmusicpluginsproxy.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: Defines ecom interface table -* -*/ - - - - - - -#include -#include - -#include "upnpmusicplayer.h" - -#include "upnpmusicdownloadproxy.h" - -// Provides a key value pair table, this is used to identify -// the correct construction function for the requested interface. - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x200075D8, CUPnPMusicPlayer::NewL ), - IMPLEMENTATION_PROXY_ENTRY( 0x200075D9, CUPnPMusicDownloadProxy::NewL ) - }; - - -// Function used to return an instance of the proxy table. -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - aTableCount = sizeof(ImplementationTable) / - sizeof(TImplementationProxy); - return ImplementationTable; - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpplaybackstatemachine.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpplaybackstatemachine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,796 +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: Class for retrieving and selecting media renderers -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "upnpavrenderingsession.h" -#include "upnpavrenderingsessionobserver.h" -#include "upnpavdevice.h" - -#include "upnpmusicplayer.h" // for parent.Observer() -#include "upnptrack.h" // for TrackDuration -#include "upnpvaluestatemachine.h" // -#include "upnpplaybackstatemachine.h" // myself -#include "upnppluginserrortranslation.h" - -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" - -// CONSTANTS -_LIT( KStateStoppedText, "Stopped" ); -_LIT( KStatePlayingText, "Playing" ); -_LIT( KStatePausedText, "Paused" ); -_LIT( KStateUnknownText, "Unknown" ); - -const TInt KDurationErrorMargin = 500; // 0.5 seconds -const TInt KPlaybackInfoTimeOut = 1000000; // 1s wait until device is ready -const TInt KPlaybackInfoTimeOutEnd = 2000000; // 2s wait check whether - //the playing is ended - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::NewL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPPlaybackStateMachine* CUPnPPlaybackStateMachine::NewL( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ) - { - __LOG( "PlaybackStateMachine::NewL" ); - CUPnPPlaybackStateMachine* self = - new(ELeave) CUPnPPlaybackStateMachine( - aParent, aRenderingSession ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::CUPnPPlaybackStateMachine -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPPlaybackStateMachine::CUPnPPlaybackStateMachine( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ) - :iParent( aParent ) - ,iRendererSession( aRenderingSession ) - ,iState( EStateStopped ) - ,iCurrentOperation( EOperationNone ) - { - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::ConstructL -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::ConstructL() - { - __LOG( "CUPnPPlaybackStateMachine::ConstructL" ); - - // Create timer for observing duration query time out. - TInt64 iTime = 0; - iPlayMark = TTime( iTime ); - iPauseMark = TTime( iTime ); - iPeriodizer = CUPnPMusicPeriodizer::NewL( *this, KPlaybackInfoTimeOut ); - iPeriodizerEnd = CUPnPMusicPeriodizer::NewL( *this, - KPlaybackInfoTimeOutEnd ); - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::~CUPnPPlaybackStateMachine -// Destructor. -// -------------------------------------------------------------------------- -// -CUPnPPlaybackStateMachine::~CUPnPPlaybackStateMachine() - { - __LOG( "PlaybackStateMachine destructor" ); - iOperationQueue.Close(); - delete iPeriodizer; - delete iPeriodizerEnd; - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::CommandL -// Executes a command on the selected song. -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::CommandL( TMPXPlaybackCommand aCmd ) - { - if ( aCmd == EPbCmdClose ) - { - // close can be handled parallel to other commands - HandleCloseL(); - return; - } - - if ( !iCurrentOperation.None() ) - { - __LOG( "PlaybackStateMachine::CommandL - Append to queue" ); - iOperationQueue.AppendL( aCmd ); - return; - } - - switch( aCmd ) - { - case EPbCmdPlay: - { - if( iState == EStatePlaying ) - { - // already playing - ignore - CheckOperationInQueueL(); - } - else - { - __LOG( "PlaybackStateMachine: command play" ); - iCurrentOperation = aCmd; - iRendererSession.PlayL(); - } - } - break; - case EPbCmdPause: - { - // Check if pause is supported by device - if( iParent.UsedRendererDevice().PauseCapability() ) - { - if( iState == EStatePaused ) - { - // already paused - ignore - CheckOperationInQueueL(); - } - else - { - __LOG( "PlaybackStateMachine: command pause" ); - iCurrentOperation = aCmd; - iRendererSession.PauseL(); - } - } - else - { - __LOG( "PlaybackStateMachine: Pause is not supported by \ - device!" ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPaused, 0, - KErrNotSupported ); - } - } - break; - case EPbCmdStop: - { - if( iState == EStateStopped ) - { - // already stopped - ignore - CheckOperationInQueueL(); - } - else - { - __LOG( "PlaybackStateMachine: command stop" ); - iCurrentOperation = aCmd; - iRendererSession.StopL(); - } - } - break; - case EPbCmdReplay: - { - iCurrentOperation = aCmd; - __LOG( "PlaybackStateMachine: command replay" ); - if( iState == EStatePlaying || iState == EStatePaused ) - { - // playing -must stop first - iRendererSession.StopL(); - } - else - { - // just play - iRendererSession.PlayL(); - } - } - break; - default: // Given command is not supported - { - __LOG( "PlaybackStateMachine: command default?" ); - CheckOperationInQueueL(); - User::Leave( KErrNotSupported ); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::PositionL -// Changes the position within the currently playing track -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::PositionL( TInt aPosition ) - { - - // Ignore if already called. - if( iCurrentOperation == EOperationPositionToZero ) - { - __LOG( "PlaybackStateMachine::PositionL - \ - EOperationPositionToZero called twice -> ignored" ); - return; - } - - if ( !iCurrentOperation.None() ) - { - __LOG( "PlaybackStateMachine::PositionL - Append to queue" ); - iOperationQueue.AppendL( EOperationPositionToZero ); - return; - } - if ( aPosition != 0 ) - { - CheckOperationInQueueL(); - User::Leave( KErrNotSupported ); - } - - // handle Position(0) - if ( iState == EStatePlaying ) - { - __LOG( "PlaybackStateMachine: position(0) while playing" ); - iCurrentOperation = EOperationPositionToZero; - iRendererSession.StopL(); - } - else if ( iState == EStatePaused ) - { - __LOG( "PlaybackStateMachine: PositionL(0) while paused" ); - iCurrentOperation = EOperationPositionToZeroDuringPause; - iRendererSession.StopL(); - } - else if ( iState == EStateStopped ) - { - __LOG( "PlaybackStateMachine: PositionL(0) while stopped" ); - CheckOperationInQueueL(); - - // immediate response ! - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - EPbPropertyPosition, KErrNone ); - - } - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::SilentStopL -// Stops playback, does not provide any ACK event -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::SilentStopL() - { - if ( !iCurrentOperation.None() ) - { - __LOG( "PlaybackStateMachine::SilentStopL - Append to queue" ); - iOperationQueue.AppendL( EOperationSilentStop ); - return; - } - - // handle stop - __LOG( "PlaybackStateMachine: SilentStopL" ); - if( iState == EStateStopped ) - { - // already stopped - ignore - CheckOperationInQueueL(); - } - else - { - iCurrentOperation = EOperationSilentStop; - iRendererSession.StopL(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::Cancel -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::Cancel() - { - // reset current operation and empty the queue -> no callbacks. - iCurrentOperation.Reset(); - iOperationQueue.Reset(); - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::HandleCloseL -// Handles the close command -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::HandleCloseL() - { - if ( iCurrentOperation == EPbCmdStop ) - { - // Stop pending - it can't be completed -> fake callback. - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPStopped, - KErrNone, KErrNone ); - } - - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPClosed, - KErrNone, KErrNone ); - } - - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::InteractOperationComplete -// Response for interaction operation (play, stop, etc.). -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::InteractOperationComplete( TInt aErrorCode, - TUPnPAVInteractOperation aOperation ) - { - __LOG1( "CUPnPPlaybackStateMachine::InteractOperationComplete: err:[%d]", - aErrorCode ); - aErrorCode = TUpnpPluginsErrorTranslation::ErrorTranslate( aErrorCode ); - switch( aOperation ) - { - case EUPnPAVPlayUser: - { - __LOG1( "PlaybackStateMachine: event play user, state[%d]",iState ); - - if ( aErrorCode == KErrNone ) - { - if ( iState == EStatePaused ) - { - TimeContinue(); - ChangeState( EStatePlaying ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlaying, KErrNone, - aErrorCode ); - if( iCurrentOperation == EPbCmdPlay ) - { - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - } - } - else if ( iState == EStatePlaying ) - { - iPeriodizer->Stop(); - iParent.HandlePlayStarted(); - } - else if ( iState == EStateStopped ) - { - if ( iCurrentOperation == EPbCmdPlay || - iCurrentOperation == EPbCmdReplay ) - { - TimePlay(); - iParent.HandlePlayStarted(); - ChangeState( EStatePlaying ); - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlaying, KErrNone, - aErrorCode ); - } - else - { - // spontaneous change to PLAYING state -> ignore - } - } - - } - else - { - ChangeState( EStateUnknown ); - } - break; - } - case EUPnPAVPlay: - { - if ( iState == EStatePlaying ) - { - __LOG( "PlaybackStateMachine: event play ignored" ); - break; - } - - __LOG( "PlaybackStateMachine: event play" ); - - if ( aErrorCode == KErrNone ) - { - if ( iState == EStateStopped ) - { - TimePlay(); - iPeriodizer->Start(); - iPeriodizerEnd->Start(); - } - else if ( iState == EStatePaused ) - { - TimeContinue(); - iPeriodizer->Stop(); - iPeriodizer->Start(); - iPeriodizerEnd->Stop(); - iPeriodizerEnd->Start(); - } - ChangeState( EStatePlaying ); - } - else - { - ChangeState( EStateUnknown ); - } - - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - break; - } - case EUPnPAVPauseUser: - { - if ( !iCurrentOperation.None() || - iState == EStatePaused ) - { - __LOG( "PlaybackStateMachine: event pause user ignored" ); - break; - } - __LOG( "PlaybackStateMachine: event pause user" ); - - if( aErrorCode == KErrNone ) - { - TimePause(); - ChangeState( EStatePaused ); - iPeriodizerEnd->Stop(); - } - else - { - ChangeState( EStateUnknown ); - } - - // Call callback - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPaused, KErrNone, - aErrorCode ); - break; - } - - case EUPnPAVPause: - { - __LOG( "PlaybackStateMachine: event pause" ); - - TInt err = aErrorCode; - if( aErrorCode == KErrNone ) - { - TimePause(); - ChangeState( EStatePaused ); - iPeriodizerEnd->Stop(); - } - else if( aErrorCode == KErrNotSupported ) - { - // Pause is supported (pause capability checked in CommandL ) - // but device is not ready. - err = KErrNotReady; - } - else - { - ChangeState( EStateUnknown ); - } - - if ( iCurrentOperation == EPbCmdPause ) - { - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPaused, KErrNone, - err ); - } - else - { - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - } - break; - } - case EUPnPAVStopUser: - { - iPeriodizerEnd->Stop(); - if ( !iCurrentOperation.None() || - iState == EStateStopped ) - { - __LOG( "PlaybackStateMachine: event stop user ignored" ); - break; - } - __LOG( "PlaybackStateMachine: event stop user" ); - - TBool trackComplete = TimeStop(); - if ( aErrorCode == KErrNone ) - { - ChangeState( EStateStopped ); - iParent.HandlePlayComplete(); - } - else - { - ChangeState( EStateUnknown ); - } - - // Call callback - if ( trackComplete ) - { - __LOG( "PlaybackStateMachine: play complete event to user" ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayComplete, KErrNone, - aErrorCode ); - } - else - { - __LOG( "PlaybackStateMachine: play stopped event to user" ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPStopped, KErrNone, - aErrorCode ); - } - break; - } - case EUPnPAVStop: - { - iPeriodizerEnd->Stop(); - if ( iState == EStateStopped ) - { - // already in this state - ignore - break; - } - __LOG( "PlaybackStateMachine: event stop" ); - - if ( aErrorCode == KErrNone ) - { - ChangeState( EStateStopped ); - } - else - { - ChangeState( EStateUnknown ); - } - - if ( iCurrentOperation == EPbCmdStop ) - { - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - // Call callback - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPStopped, KErrNone, - aErrorCode ); - } - else if ( iCurrentOperation == EPbCmdReplay || - iCurrentOperation == EOperationPositionToZero ) - { - // continue with play - TRAP_IGNORE( iRendererSession.PlayL() ); - } - else if ( iCurrentOperation == - EOperationPositionToZeroDuringPause ) - { - // position zero complete - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - EPbPropertyPosition, aErrorCode ); - } - else - { - // Note: covers also EOperationSilentStop - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - } - break; - } - default: - { - __LOG( "PlaybackStateMachine: event default?" ); - __PANICD( __FILE__, __LINE__ ); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::CheckOperationInQueueL -// Checks if operations are in the queue, and executes -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::CheckOperationInQueueL() - { - if ( !iCurrentOperation.None() ) - { - // check operation though a current operation exists! - __PANICD( __FILE__, __LINE__ ); - return; - } - - if ( iOperationQueue.Count() > 0 ) - { - TOperation op = iOperationQueue[0]; - iOperationQueue.Remove(0); - if ( op == EOperationCommand ) - { - CommandL( op.iCmd ); - } - else if ( op == EOperationPositionToZero ) - { - PositionL( 0 ); - } - else - { - __PANICD( __FILE__, __LINE__ ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::TimePlay -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::TimePlay() - { - iPlayMark.UniversalTime(); - iPausetime = 0; - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::TimePause -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::TimePause() - { - iPauseMark.UniversalTime(); - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::TimeContinue -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::TimeContinue() - { - TTime continueMark; - continueMark.UniversalTime(); - TTimeIntervalMicroSeconds paused = - continueMark.MicroSecondsFrom( iPauseMark ); - iPausetime += ( paused.Int64() / 1000 ); - } - - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::TimeStop -// -------------------------------------------------------------------------- -// -TBool CUPnPPlaybackStateMachine::TimeStop() - { - TBool isCompleted = ETrue; - if ( !iPlayMark.Int64() ) - { - isCompleted = EFalse; - return isCompleted; - } - TTime stopMark; - stopMark.UniversalTime(); - TTimeIntervalMicroSeconds played = - stopMark.MicroSecondsFrom( iPlayMark ); - - TInt duration = iParent.Track().TrackDuration(); - TInt playtime = ( played.Int64() / 1000 ) - iPausetime; - __LOG3("PlaybackStateMachine: playtime=%d duration=%d (pausetime=%d)", - playtime/1000, duration/1000, iPausetime/1000 ); - - if ( playtime >= 0 && - playtime < duration - KDurationErrorMargin ) - { - // [0 - duration-margin] - isCompleted= EFalse; - } - else if ( playtime >= duration - KDurationErrorMargin && - playtime <= duration + KDurationErrorMargin ) - { - // [duration-margin - duration+margin] - isCompleted= ETrue; - } - else - { - // position either negative or greater than duration ?? - __LOG2("Time ERROR: play=%d duration=%d ?", playtime, duration ); - isCompleted= ETrue; - } - - return isCompleted; - } - - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::ChangeState -// Changes the class state -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::ChangeState( TState aNewState ) - { - __LOG2( "PlaybackStateMachine: STATE %S -> %S", - State( iState ), State( aNewState ) ); - iState = aNewState; - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::State -// -------------------------------------------------------------------------- -// -const TDesC* CUPnPPlaybackStateMachine::State( TState aState ) - { - switch( aState ) - { - case EStateStopped: - return &KStateStoppedText; - case EStatePlaying: - return &KStatePlayingText; - case EStatePaused: - return &KStatePausedText; - default: - return &KStateUnknownText; - } - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::HandlePeriod -// Action when timer has expired. -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::HandlePeriod() - { - __LOG( "CUPnPPlaybackStateMachine::HandlePeriod" ); - - // Remote device is ready for give playback information. - iPeriodizer->Stop(); - iParent.HandlePlayStarted(); - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::HandlePeriodForEnd -// Action when timer has expired. -// -------------------------------------------------------------------------- -// -void CUPnPPlaybackStateMachine::HandlePeriodForEnd() - { - TBool trackComplete = TimeStop(); - if ( trackComplete ) - { - iPeriodizerEnd->Stop(); - PlayOvertimeEnd(); - } - else - { - iPeriodizerEnd->Start(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPPlaybackStateMachine::PlayOvertimeEnd -// Stoping the playing song. -// -------------------------------------------------------------------------- -// - void CUPnPPlaybackStateMachine::PlayOvertimeEnd() - { - if ( !iCurrentOperation.None() || - iState == EStateStopped || iState == EStateUnknown) - { - return; - } - ChangeState( EStateStopped ); - iParent.HandlePlayComplete(); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPPlayComplete, KErrNone, - KErrNone ); - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnppluginserrortranslation.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnppluginserrortranslation.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +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: translate all plugins error code for music player - * -*/ - - - - - - -// INCLUDES - -// debug -#include -#include "upnppluginserrortranslation.h" -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" - -// -------------------------------------------------------------------------- -// TUpnpPluginsErrorTranslation::ErrorTranslate -// translate function -// -------------------------------------------------------------------------- -// -TInt TUpnpPluginsErrorTranslation::ErrorTranslate( TInt aError) - { - TInt newError = KErrNone; - if ( aError != KErrNone) - { - __LOG1( "TUpnpPluginsErrorTranslation err=%d", aError ); - } - switch ( aError) - { - // if aError is valid, we don't need translate - case KErrNone: - newError = KErrNone; - break; - case KErrNotFound: - newError = KErrGeneral; - break; - case KErrNotSupported: - newError = KErrNotSupported; - break; - case KErrCorrupt: - newError = KErrCorrupt; - break; - case KErrCompletion: - newError = KErrCompletion; - break; - case KErrDied: - newError = KErrDied; - break; - case KErrGeneral: - newError = KErrGeneral; - break; - case KErrAccessDenied: - newError = KErrAccessDenied; - break; - case KErrArgument: - newError = KErrArgument; - break; - case KErrDisconnected: - newError = KErrDisconnected; - break; - case KErrDiskFull: //consume current disk full - newError = KErrDiskFull; - break; - case KErrNoMemory://consume memory entirely - newError = KErrNoMemory; - break; - case KErrOverflow: - newError = KErrGeneral; - break; - case KErrServerBusy://if Server has no memory - newError = KErrServerBusy; - break; - // if aError is not valid, we need translate - case KErrCancel: //fall through - case KErrTotalLossOfPrecision: ////fall through - case KErrBadHandle: //fall through - case KErrUnderflow: //fall through - case KErrAlreadyExists: //fall through - case KErrPathNotFound: //fall through - case KErrInUse: //fall through - case KErrServerTerminated: //fall through - case KErrNotReady: //fall through - case KErrUnknown: //fall through - case KErrLocked: //fall through - case KErrWrite: //fall through - case KErrDisMounted: //fall through - case KErrEof: //fall through - case KErrBadDriver: //fall through - case KErrBadName: //fall through - case KErrCommsLineFail: //fall through - case KErrCommsFrame: //fall through - case KErrCommsOverrun: //fall through - case KErrCommsParity: //fall through - case KErrTimedOut: //fall through - case KErrCouldNotConnect: //fall through - case KErrCouldNotDisconnect: //fall through - case KErrBadLibraryEntryPoint: //fall through - case KErrBadDescriptor: //fall through - case KErrAbort: //fall through - case KErrTooBig: //fall through - case KErrDivideByZero: //fall through - case KErrBadPower: //fall through - case KErrDirFull: //fall through - case KErrHardwareNotAvailable: //fall through - case KErrSessionClosed: //fall through - case KErrPermissionDenied: //fall through - case KErrExtensionNotSupported: //fall through - case KErrCommsBreak: - newError = KErrDisconnected; - break; - default: - newError = KErrDisconnected; - break; - } - - return newError; - - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpsingleton.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpsingleton.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,548 +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: Singleton class for main upnp related services -* -*/ - - - - - - -// INCLUDES -#include -#include "upnpavcontrollerfactory.h" -#include "upnpavcontroller.h" -#include "upnpavdevice.h" -#include "upnpavdevicelist.h" -#include "upnprendererselectorobserver.h" -#include "upnpsingleton.h" - -// CONSTANTS -const TInt KDefaultGranularity = 5; -const TInt32 KRendererRequestTimeOut = 5000000; - -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" - -// -------------------------------------------------------------------------- -// Static members of CUPnPSingleton -// -------------------------------------------------------------------------- -// - -// reference count -TInt CUPnPSingleton::iInstanceCount = 0; - -// reference count -CUPnPSingleton* CUPnPSingleton::iInstance = 0; - -// default device index -TInt CUPnPSingleton::iDefaultRendererIndex; - - -// -------------------------------------------------------------------------- -// CUPnPSingleton::GetInstanceL -// singleton constructor -// -------------------------------------------------------------------------- -// -CUPnPSingleton* CUPnPSingleton::GetInstanceL() - { - if( iInstanceCount == 0 ) - { - CUPnPSingleton* self = new(ELeave) CUPnPSingleton(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - iInstance = self; - } - - ++iInstanceCount; - return iInstance; - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::CUPnPSingleton -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPSingleton::CUPnPSingleton() - { - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::ConstructL -// ConstructL. -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::ConstructL() - { - // Create timer for observing play time out. - iPeriodizer = CUPnPMusicPeriodizer::NewL( *this, - KRendererRequestTimeOut ); - - // Create handle to AVController - iAVController = UPnPAVControllerFactory::NewUPnPAVControllerL(); - iAVController->SetDeviceObserver( *this ); - CacheRendererListL(); - if ( iMediaRenderers.Count() > 0 ) - { - iSelectorState = EStateReady; - } - else - { - iSelectorState = EStateWaiting; - iPeriodizer->Start(); - } - - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::LoseInstance -// singleton desctuctor -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::LoseInstance( CUPnPSingleton* aInstance ) - { - if( aInstance != 0 ) - { - __ASSERTD( aInstance == iInstance,__FILE__, __LINE__ ); - __ASSERTD( iInstanceCount > 0,__FILE__, __LINE__ ); - --iInstanceCount; - if( iInstanceCount == 0 ) - { - delete iInstance; - iInstance = 0; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::~CUPnPSingleton -// Destructor. -// -------------------------------------------------------------------------- -// -CUPnPSingleton::~CUPnPSingleton() - { - __LOG("CUPnPSingleton::~CUPnPSingleton()"); - iMediaRenderers.ResetAndDestroy(); - delete iPeriodizer; - if( iAVController ) - { - iAVController->Release(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::GetRendererNamesL -// Get renderes from AVController and return the renderer names. -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::GetRendererNamesL( - MUPnPRendererSelectorObserver& aObserver ) - { - __ASSERTD( iRendererselectorObserver == 0,__FILE__, __LINE__ ); - iRendererselectorObserver = &aObserver; - - switch( iSelectorState ) - { - case EStateWaiting: - { - __LOG("GetRendererNames: waiting"); - // wait for something to happen - } - break; - case EStateComplete: - { - __LOG("GetRendererNames: complete->ready"); - DeliverNamesToObserverL( ETrue ); - iSelectorState = EStateReady; - } - break; - case EStateReady: - { - CacheRendererListL(); - if ( iMediaRenderers.Count() > 0 ) - { - __LOG("GetRendererNames: ready"); - DeliverNamesToObserverL( ETrue ); - } - else - { - __LOG("GetRendererNames: ready->waiting"); - iSelectorState = EStateWaiting; - iPeriodizer->Start(); - } - } - break; - case EStateError: - { - __LOG("GetRendererNames: error"); - DeliverNamesToObserverL( ETrue, KErrDisconnected ); - } - break; - default: - { - __PANICD(__FILE__, __LINE__ ); - } - break; - } - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::CancelGetRendererNames -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::CancelGetRendererNames() - { - // just clear the observer -> no callbacks will occur. - iRendererselectorObserver = 0; - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::SelectRendererByIndexL -// Select renderer by given index. -// -------------------------------------------------------------------------- -// -const CUpnpAVDevice* CUPnPSingleton::SelectRendererByIndexL( TInt aIndex ) - { - if( iMediaRenderers.Count() <= aIndex || aIndex < 0 ) - { - __LOG("CUPnPSingl::SelectRendererByIndexL error: Wrong index"); - User::Leave( KErrArgument ); - } - - if ( iRendererselectorObserver != 0 ) - { - DeliverNamesToObserverL( ETrue ); - } - - if ( !IsAvailable( *iMediaRenderers[aIndex] ) ) - { - __LOG("CUPnPSingl::SelectRendererByIndexL error: disconnected"); - User::Leave( KErrDisconnected ); - } - - iDefaultRendererIndex = aIndex; - - return iMediaRenderers[aIndex]; - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::DefaultDevice -// Return return pointer of current renderer -// -------------------------------------------------------------------------- -// -const CUpnpAVDevice* CUPnPSingleton::DefaultDevice() - { - if ( iDefaultRendererIndex >= 0 ) - { - return iMediaRenderers[iDefaultRendererIndex]; - } - else - { - return 0; - } - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::AVC -// Provides reference to the AVController resource -// -------------------------------------------------------------------------- -// -MUPnPAVController& CUPnPSingleton::AVC() - { - return *iAVController; - } - - -// -------------------------------------------------------------------------- -// Method from MUPnPAVMediaObserver -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPSingleton::UPnPDeviceDiscovered -// Inform that new renderer device has discovered. -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ) - { - // Check if device is media renderer - if( aDevice.DeviceType() == CUpnpAVDevice::EMediaRenderer - && aDevice.AudioCapability() ) - { - if ( iSelectorState == EStateWaiting || - iSelectorState == EStateComplete ) - { - CUpnpAVDevice* dev = 0; - TRAP_IGNORE( dev = CUpnpAVDevice::NewL( aDevice ) ); - if( dev ) - { - iMediaRenderers.AppendL( dev ); - if ( iRendererselectorObserver != 0 ) - { - TRAP_IGNORE( DeliverNamesToObserverL( EFalse ) ); - } - } - } - } - else - { - // Do nothing with media servers - } - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::UPnPDeviceDisappeared -// Inform that renderer device has disappeared. -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ) - { - // Check if device is media renderer - if( aDevice.DeviceType() == CUpnpAVDevice::EMediaRenderer - && aDevice.AudioCapability() ) - { - if ( iSelectorState == EStateWaiting || - iSelectorState == EStateComplete ) - { - // In monitoring state. Remove the renderer from cache. - TInt count = iMediaRenderers.Count(); - for( TInt i = 0; i < count; i++ ) - { - if( aDevice.Uuid().Compare( - iMediaRenderers[i]->Uuid() ) == 0 ) - { - iMediaRenderers.Remove(i); - // we removed an renderer from the list so we want to - // continue the loop with the same i. - // Could break here if absolutely sure that there are - // no duplicates in iMediaRenderers. - count--; - i--; - } - } - if ( iRendererselectorObserver != 0 ) - { - TRAP_IGNORE( DeliverNamesToObserverL( EFalse ) ); - } - } - else if ( iSelectorState == EStateReady ) - { - // Device disappears in ready state. Can't remove from cache - // (because we use indexing to select to renderers) - // instead mark the renderer unusable. - __LOG( "Singleton: renderer disappeared in Ready state" ); - TInt count = iMediaRenderers.Count(); - TBool done = EFalse; - for( TInt i = 0; i < count && !done; i++ ) - { - if( aDevice.Uuid().Compare( - iMediaRenderers[i]->Uuid() ) == 0 ) - { - SetAvailable( *iMediaRenderers[i], EFalse ); - done = ETrue; - } - } - } - } - else - { - // Do nothing with media servers - } - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::WLANConnectionLost -// Inform that renderer device has disappeared. -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::WLANConnectionLost() - { - iMediaRenderers.ResetAndDestroy(); - if ( iSelectorState == EStateWaiting ) - { - iPeriodizer->Stop(); - } - - iSelectorState = EStateError; - - if ( iRendererselectorObserver != 0 ) - { - TRAP_IGNORE( DeliverNamesToObserverL( ETrue, KErrDisconnected ) ); - } - } - -// -------------------------------------------------------------------------- -// Methods of MUPnPMusicPeriodizerObserver -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPSingleton::HandlePeriod -// Action when timer has expired. -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::HandlePeriod() - { - __ASSERTD( iSelectorState == EStateWaiting,__FILE__, __LINE__ ); - - if ( iMediaRenderers.Count() > 0 ) - { - __LOG("GetRendererNames: timeout->complete"); - iSelectorState = EStateComplete; - if ( iRendererselectorObserver != 0 ) - { - __LOG("GetRendererNames: complete->ready"); - iSelectorState = EStateReady; - TRAP_IGNORE( DeliverNamesToObserverL( ETrue ) ); - } - } - else - { - __LOG("GetRendererNames: timeout->continue timer"); - iPeriodizer->Continue(); - if ( iRendererselectorObserver != 0 ) - { - TRAP_IGNORE( DeliverNamesToObserverL( ETrue ) ); - } - } - } - -// -------------------------------------------------------------------------- -// Private methods of CUPnPRendererSelector -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPSingleton::CacheRendererListL -// Refreshes the renderer cache from AVController -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::CacheRendererListL() - { - // Clean old devices array and device names - iDefaultRendererIndex = KErrNotFound; - - // Get media renderers - CUpnpAVDeviceList* devices = iAVController->GetMediaRenderersL(); - CleanupStack::PushL( devices ); - - // go through current renderer list - for ( TInt i = 0; i < iMediaRenderers.Count(); ++i ) - { - CUpnpAVDevice* renderer = iMediaRenderers[ i ]; - TBool exists = EFalse; - for ( TInt j = 0; j < devices->Count() && !exists; ++j ) - { - CUpnpAVDevice* device = (*devices)[j]; - if ( renderer->Uuid() == device->Uuid()) - { - // renderer still exists. - delete device; - devices->Remove( j ); - SetAvailable( *renderer, ETrue ); - --j; - exists = ETrue; - } - } - if ( !exists ) - { - // renderer has disappeared - delete renderer; - iMediaRenderers.Remove( i ); - --i; - } - } - - // Remaining devices are all new. Add them to end of the list. - while ( devices->Count() > 0 ) - { - __LOG("CacheRendererListL::Remaining devices are all new."); - CUpnpAVDevice* device = (*devices)[ 0 ]; - if( device->AudioCapability() ) - { - iMediaRenderers.AppendL( device ); - } - devices->Remove( 0 ); - } - - CleanupStack::PopAndDestroy( devices ); - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::DeliverNamesToObserverL -// Delivers current names in cached list to observer -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::DeliverNamesToObserverL( TBool aCompleted, - TInt aError ) - { - __ASSERTD( iRendererselectorObserver != 0,__FILE__, __LINE__ ); - - // Create an array for names - CDesCArrayFlat* deviceNames = new(ELeave) CDesCArrayFlat( - KDefaultGranularity ); - CleanupStack::PushL( deviceNames ); - - TInt count = iMediaRenderers.Count(); - for( TInt i = 0; i < count; i++ ) - { - HBufC* buf = HBufC::NewL( - iMediaRenderers[i]->FriendlyName().Length() ); - CleanupStack::PushL( buf ); - buf->Des().Copy( iMediaRenderers[i]->FriendlyName() ); - deviceNames->AppendL( *buf ); // Transfer ownership - CleanupStack::PopAndDestroy( buf ); - } - - // Call back current renderer names - __LOG1( "DeliverNamesToObserver: count=%d", count ); - MUPnPRendererSelectorObserver& obs = *iRendererselectorObserver; - iRendererselectorObserver = 0; - obs.HandleSubPlayerNames( deviceNames, aCompleted, aError ); - - CleanupStack::PopAndDestroy( deviceNames ); - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::IsAvailable -// checks if the device type is renderer -// -------------------------------------------------------------------------- -// -TBool CUPnPSingleton::IsAvailable( const CUpnpAVDevice& aDevice ) const - { - return aDevice.DeviceType() == CUpnpAVDevice::EMediaRenderer; - } - -// -------------------------------------------------------------------------- -// CUPnPSingleton::SetAvailable -// sets the device type to an illegal unrecognized type -// -------------------------------------------------------------------------- -// -void CUPnPSingleton::SetAvailable( - CUpnpAVDevice& aDevice, TBool aAvailable ) const - { - if ( aAvailable && !IsAvailable( aDevice ) ) - { - __LOG1( "CUPnPSingleton: renderer available: %S", - &aDevice.FriendlyName() ); - aDevice.SetDeviceType( - CUpnpAVDevice::EMediaRenderer ); - } - else if ( !aAvailable && IsAvailable ( aDevice ) ) - { - __LOG1( "CUPnPSingleton: renderer not available: %S", - &aDevice.FriendlyName() ); - aDevice.SetDeviceType( - (CUpnpAVDevice::TUpnpAVDeviceType)KErrUnknown ); - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnptrack.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnptrack.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,754 +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: Class for containing and obtaining music track-specific data -* from media server -* -*/ - - - - - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include // for messaging -#include // for messaging - -#include // for unicode conversion - -#include -#include -#include "upnpitemutility.h" // for FindElementByName & ResourceFromItemL -#include "upnpfileutility.h" // for IsFileProtectedL -#include "upnpconstantdefs.h" // browse filtering and item element names -#include // for resolving object mimetype -#include "upnpavcontroller.h" -#include "upnpavbrowsingsession.h" -#include "upnpavdevice.h" -#include "upnpavdevicelist.h" - -#include "upnpitemresolverobserver.h" // MUPnPItemResolverObserver -#include "upnpitemresolverfactory.h" // factory class -#include "upnpitemresolver.h" // MUPnPItemResolver - -#include "upnptrackobserver.h" -#include "upnptrack.h" - -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" - -// CONSTANTS -_LIT16( KUPnPPrefix, "upnp:" ); // Prefix for separate local/remote song -const TInt KUPnPPrefixLength = 5; -const TInt KCharCodeColon = 58; -const TInt KCharCodeSeparate = 42; -const TInt InitialTrackDuration = 1; -_LIT( KTimeFormatYearOnly, "%F%Y" ); - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPTrack::NewL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPTrack* CUPnPTrack::NewL( MUPnPAVController& aAvController ) - { - __LOG( "CUPnPTrack::NewL" ); - CUPnPTrack* self = new( ELeave ) CUPnPTrack( aAvController ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::Delete -// deletor -// -------------------------------------------------------------------------- -// -void CUPnPTrack::Delete() - { - __LOG1( "CUPnPTrack::Delete, state=%d", iState ); - if ( iState == EStateResolving ) - { - // asynchronous delete - will be deleted after - // asynchronous operation is complete. This is because the - // S60 command can not be cancelled - iState = EStateSelfDestruct; - } - else - { - delete this; - } - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::CUPnPTrack -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPTrack::CUPnPTrack( MUPnPAVController& aAvController ) - : iAvController( aAvController ) - , iQueriedAttributes() - { - iBrowsingSession = NULL; - iOriginalURI = NULL; - iMediaServer = NULL; - iObjectId = NULL; - iTrackObserver = NULL; - // Use initial duration value (1). It will guarantee that in - // case were remote device does not support duration query and playback - // is unpaused, SetPosition is called with real value even - // if remote player does not return real value for getposition - // call. Note that SetPosition(0) is used when user really wants - // to move to track beginning. - iTrackDuration = InitialTrackDuration; - iIsItemSolved = EFalse; - iState = EStateIdle; - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::~CUPnPTrack -// destructor. -// -------------------------------------------------------------------------- -// -CUPnPTrack::~CUPnPTrack() - { - __LOG( "CUPnPTrack::~CUPnPTrack()" ); - StopBrowsingSession(); - - // Free memory of owned members - delete iOriginalURI; - delete iMediaServer; - delete iObjectId; - delete iItemResolver; - iItemResolver = 0; - __LOG( "CUPnPTrack::~CUPnPTrack End" ); - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::ResolveURIL -// Resolve local / remote URI. -// -------------------------------------------------------------------------- -// -void CUPnPTrack::ResolveURIL( const TDesC& aCodedTrackUri, - MUPnPTrackObserver& aTrackObserver, - TPlaybackDirection aPlaybackDirection ) - { - __LOG( "CUPnPTrack::ResolveURI" ); - - delete iOriginalURI; - iOriginalURI = 0; - delete iMediaServer; - iMediaServer = 0; - delete iObjectId; - iObjectId = 0; - iTrackObserver = &aTrackObserver; - - // Either local to remote or remote to remote - if( aPlaybackDirection == EDirectionRemote ) - { - if( aCodedTrackUri.Find( KUPnPPrefix ) == 0 ) - { - // track is located in remote - iTrackLocation = ETrackLocationRemote; - // parse and save media server id and object id - ParsePiecesL( aCodedTrackUri ); - // start a browsing session - StartBrowsingSessionL(); - // create resolver - iItemResolver = - UPnPItemResolverFactory::NewRemoteItemResolverL( - *iObjectId, *iBrowsingSession, - iDefaultSelector, KFilterCommon ); - } - else // Local stored. Save URI to local member - { - // track is located in local file system - iTrackLocation = ETrackLocationLocal; - // store original URI - iOriginalURI = HBufC::NewL( aCodedTrackUri.Length() ); - iOriginalURI->Des().Copy( aCodedTrackUri ); - // check for DRM protection - if ( UPnPFileUtility::IsFileProtectedL( iOriginalURI->Des() ) ) - { - // call back directly with an error code - iTrackObserver->ResolveURIComplete( KErrNotSupported ); - return; - } - else - { - // create resolver. - iItemResolver = - UPnPItemResolverFactory::NewLocalItemResolverL( - *iOriginalURI, iAvController, iFirstSelector, - UPnPItemResolverFactory::EOmitDrmCheck ); - } - } - } - else // Remote to local direction - { - // track is located in remote - iTrackLocation = ETrackLocationRemote; - // parse and save media server id and object id - ParsePiecesL( aCodedTrackUri ); - // start a browsing session - StartBrowsingSessionL(); - // create resolver - iItemResolver = - UPnPItemResolverFactory::NewDownloadItemResolverL( - *iObjectId, iAvController, *iBrowsingSession, - iFirstSelector, KFilterCommon ); - } - - // Resolve remote item. Calls back to ResolveComplete - iState = EStateResolving; - TRAPD( e, iItemResolver->ResolveL( *this ); ) - if ( e != KErrNone ) - { - if ( iState == EStateSelfDestruct ) - { - __LOG( "CUPnPTrack: self-destructing" ); - delete this; - } - else - { - iState = EStateIdle; - User::Leave( e ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::StartBrowsingSessionL -// Finds the apropriate mediaserver and starts a browsing session -// -------------------------------------------------------------------------- -// -void CUPnPTrack::StartBrowsingSessionL() - { - // Get list of media servers - CUpnpAVDeviceList* devices = iAvController.GetMediaServersL(); - CleanupStack::PushL( devices ); - - // Find out index of wanted media server from media server list - TInt index = KErrNotFound; - TInt count = devices->Count(); - - for( TInt i = 0; i < count; i++ ) - { - // If media server id match. - if( !iMediaServer->Compare( (*devices)[ i ]->Uuid() ) ) - { - index = i; - break; - } - } - - // Leave if media server does not find by id - if( index == KErrNotFound ) - { - __LOG1( "CUPnPTrack: Media server not found: %S", - iMediaServer ); - User::Leave( KErrNotFound ); - } - - // start a browsing session - iBrowsingSession = &iAvController.StartBrowsingSessionL( - *(*devices)[ index ] ); - CleanupStack::PopAndDestroy( devices ); - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::StopBrowsingSession -// Finds the apropriate mediaserver and starts a browsing session -// -------------------------------------------------------------------------- -// -void CUPnPTrack::StopBrowsingSession() - { - // Stop browsing session if exist. - if( iBrowsingSession ) - { - __LOG( "Stop browsing session" ); - iAvController.StopBrowsingSession( *iBrowsingSession ); - iBrowsingSession = 0; - } - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::URI -// Return original URI of track. -// -------------------------------------------------------------------------- -// -const TDesC& CUPnPTrack::URI() const - { - __ASSERTD( iOriginalURI != 0,__FILE__, __LINE__ ); - return *iOriginalURI; - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::UpnpURI -// Return True UPNP URI of track. -// -------------------------------------------------------------------------- -// -const TDesC8& CUPnPTrack::UpnpURI() const - { - __ASSERTD( iIsItemSolved,__FILE__, __LINE__ ); - return iItemResolver->Resource().Value(); - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::UpnpItem -// Return True UPNP item representing the track -// -------------------------------------------------------------------------- -// -const CUpnpItem& CUPnPTrack::UpnpItem() const - { - __ASSERTD( iIsItemSolved,__FILE__, __LINE__ ); - return iItemResolver->Item(); - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::FilePath -// Returns the file path of local item -// -------------------------------------------------------------------------- -// -const TDesC& CUPnPTrack::FilePath() const - { - __ASSERTD( iTrackLocation == ETrackLocationRemote, __FILE__, __LINE__ ); - __ASSERTD( iIsItemSolved,__FILE__, __LINE__ ); - return iItemResolver->Resource().FilePath(); - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::IsRemote -// Return location of track. ETrue = remote. EFalse = local -// -------------------------------------------------------------------------- -// -TBool CUPnPTrack::IsRemote() const - { - return iTrackLocation == ETrackLocationRemote; - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::TrackDuration -// returns duration of the track -// -------------------------------------------------------------------------- -// -TInt CUPnPTrack::TrackDuration() - { - __LOG1( "CUPnPTrack::TrackDuration duration: %d", iTrackDuration ); - TInt ms = InitialTrackDuration; - if ( iTrackDuration > InitialTrackDuration ) - { - ms = iTrackDuration; - } - else if ( iIsItemSolved ) - { - const CUpnpAttribute* attr = UPnPItemUtility - ::FindAttributeByName( iItemResolver->Resource(), - KAttributeDuration ); - if ( attr != 0 ) - { - if ( UPnPItemUtility::UPnPDurationAsMilliseconds( - attr->Value(), ms ) == KErrNone ) - { - // store duration for quicker future queries - iTrackDuration = ms; - __LOG1( "store duration: %d", iTrackDuration ); - } - } - } - return ms; - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::SetTrackDuration -// overrides duration of the track -// -------------------------------------------------------------------------- -// -void CUPnPTrack::SetTrackDuration( TInt aMilliseconds ) - { - iTrackDuration = aMilliseconds; - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::GetMetaDataL -// Get metadata information for track from media server -// -------------------------------------------------------------------------- -// -void CUPnPTrack::GetMetaDataL( const TArray& aAttrs, - MMPXPlaybackPluginObserver& aObs ) - { - // Check if remote track - if( iTrackLocation == ETrackLocationLocal ) - { - __LOG( "CUPnPTrack::GetMetaData - No metadata for local track!" ); - User::Leave( KErrNotSupported ); - } - - if ( iIsItemSolved ) - { - __LOG( "CUPnPTrack::GetMetaDataL" ); - DeliverMedataL( aAttrs, aObs ); - } - else - { - __LOG( "CUPnPTrack::GetMetaDataL - pending" ); - iMetadataObserver = &aObs; - for( TInt i = 0; i < aAttrs.Count(); ++i ) - { - iQueriedAttributes.AppendL( aAttrs[i] ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::SendMediaChangedEventL -// -------------------------------------------------------------------------- -// -void CUPnPTrack::SendMediaChangedEventL( - MMPXPlaybackPluginObserver& aObs ) - { - RArray attrs; - CleanupClosePushL( attrs ); - attrs.AppendL( KMPXMediaGeneralTitle ); - attrs.AppendL( KMPXMediaMusicArtist ); - attrs.AppendL( KMPXMediaMusicAlbum ); - attrs.AppendL( KMPXMediaMusicGenre ); - attrs.AppendL( KMPXMediaGeneralDate ); - attrs.AppendL( KMPXMediaMusicYear ); - attrs.AppendL( KMPXMediaGeneralComment ); - attrs.AppendL( KMPXMediaGeneralMimeType ); - - // Create and fill CMPXMedia class - RArray suppIds; - CleanupClosePushL( suppIds ); - suppIds.AppendL( KMPXMediaIdMusic ); - suppIds.AppendL( KMPXMediaIdGeneral ); - suppIds.AppendL( KMPXMediaIdAudio ); - CMPXMedia* media = CMPXMedia::NewL( suppIds.Array() ); - CleanupStack::PopAndDestroy( &suppIds ); - CleanupStack::PushL( media ); - FillMediaFromItemL( *media, attrs.Array() ); - - // create an MPX message - CMPXMessage* msg = CMPXMessage::NewL(); - CleanupStack::PushL( msg ); - msg->SetTObjectValueL( - KMPXMessageGeneralId, KMPXMessagePbMediaChanged ); - msg->SetCObjectValueL( - KMPXMessagePbMedia, media ); - - // send message - aObs.HandlePlaybackMessage( *msg ); - - CleanupStack::PopAndDestroy( msg ); - CleanupStack::PopAndDestroy( media ); - CleanupStack::PopAndDestroy( &attrs ); - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::DeliverMedatataL -// -------------------------------------------------------------------------- -// -void CUPnPTrack::DeliverMedataL( const TArray& aAttrs, - MMPXPlaybackPluginObserver& aObs, TInt aError ) - { - __LOG( "CUPnPTrack::DeliverMedatata"); - - // Create and fill CMPXMedia class - RArray suppIds; - CleanupClosePushL( suppIds ); - suppIds.AppendL( KMPXMediaIdMusic ); - suppIds.AppendL( KMPXMediaIdGeneral ); - suppIds.AppendL( KMPXMediaIdAudio ); - CMPXMedia* media = CMPXMedia::NewL( suppIds.Array() ); - CleanupStack::PopAndDestroy( &suppIds ); - CleanupStack::PushL( media ); - - if ( aError == KErrNone ) - { - FillMediaFromItemL( *media, aAttrs ); - } - - // Return metadata - aObs.HandleMedia( *media, aError ); - CleanupStack::PopAndDestroy( media ); - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::FillMediaFromItemL -// -------------------------------------------------------------------------- -// -void CUPnPTrack::FillMediaFromItemL( CMPXMedia& aMedia, - const TArray& aAttrs ) - { - __ASSERTD( iIsItemSolved,__FILE__, __LINE__ ); - - // Fill metadata - const CUpnpElement* elem; - // Song title - if( Exists( aAttrs, KMPXMediaGeneralTitle ) ) - { - __LOG( "CUPnPTrack: Metadata: Title"); - aMedia.SetTextValueL( - KMPXMediaGeneralTitle, *To16LC( - iItemResolver->Item().Title() ) ); - CleanupStack::PopAndDestroy(); - } - // Artist - if( Exists( aAttrs, KMPXMediaMusicArtist ) ) - { - if ( ( elem = UPnPItemUtility::FindElementByName( - iItemResolver->Item(), KElementArtist ) ) != 0 ) - { - __LOG( "CUPnPTrack: Metadata: Artist" ); - aMedia.SetTextValueL( - KMPXMediaMusicArtist, *To16LC( elem->Value() ) ); - CleanupStack::PopAndDestroy(); - } - else if ( ( elem = UPnPItemUtility::FindElementByName( - iItemResolver->Item(), KElementCreator ) ) != 0 ) - { - __LOG( "CUPnPTrack: Metadata Creator" ); - aMedia.SetTextValueL( - KMPXMediaMusicArtist, *To16LC( elem->Value() ) ); - CleanupStack::PopAndDestroy(); - } - } - // Album - if( Exists( aAttrs, KMPXMediaMusicAlbum ) ) - { - if ( ( elem = UPnPItemUtility::FindElementByName( - iItemResolver->Item(), KElementAlbum ) ) != 0 ) - { - __LOG( "CUPnPTrack: Metadata: Album"); - aMedia.SetTextValueL( - KMPXMediaMusicAlbum, *To16LC( elem->Value() ) ); - CleanupStack::PopAndDestroy(); - } - } - // Genre - if( Exists( aAttrs, KMPXMediaMusicGenre ) ) - { - if ( ( elem = UPnPItemUtility::FindElementByName( - iItemResolver->Item(), KElementGenre ) ) != 0 ) - { - __LOG( "CUPnPTrack: Metadata: Genre" ); - aMedia.SetTextValueL( - KMPXMediaMusicGenre, *To16LC( elem->Value() ) ); - CleanupStack::PopAndDestroy(); - } - } - // Date / Year - if( ( elem = UPnPItemUtility::FindElementByName( - iItemResolver->Item(), KElementDate ) ) != 0 ) - { - TTime timestamp; - TInt conversionError = - UPnPItemUtility::UPnPDateAsTTime( elem->Value(), timestamp ); - if ( conversionError == KErrNone ) - { - if ( Exists( aAttrs, KMPXMediaGeneralDate ) ) - { - __LOG( "CUPnPTrack: Metadata: Date" ); - aMedia.SetTextValueL( - KMPXMediaGeneralDate, iTempBuf ); - } - if ( Exists( aAttrs, KMPXMediaMusicYear ) ) - { - __LOG( "CUPnPTrack: Metadata: Year" ); - timestamp.FormatL( iTempBuf, KTimeFormatYearOnly ); - aMedia.SetTextValueL( - KMPXMediaMusicYear, iTempBuf ); - } - } - } - // Duration - if( Exists( aAttrs, KMPXMediaGeneralDuration ) ) - { - TInt duration = TrackDuration(); - if ( duration >= 0 ) - { - aMedia.SetTObjectValueL( - KMPXMediaGeneralDuration, duration ); - } - } - // Size - if( Exists( aAttrs, KMPXMediaGeneralSize ) ) - { - const CUpnpAttribute* attr = UPnPItemUtility - ::FindAttributeByName( iItemResolver->Resource(), - KAttributeSize ); - if ( attr != 0 ) - { - __LOG( "CUPnPTrack: Metadata: Size" ); - TInt size; - TLex8 sizeconvert( attr->Value() ); - if ( sizeconvert.Val( size ) == KErrNone ) - { - aMedia.SetTObjectValueL( - KMPXMediaGeneralSize, size ); - } - } - } - // Mimetype - if( Exists( aAttrs, KMPXMediaGeneralMimeType ) ) - { - const CUpnpAttribute* attr = UPnPItemUtility - ::FindAttributeByName( iItemResolver->Resource(), - KAttributeProtocolInfo ); - if ( attr != 0 ) - { - __LOG( "CUPnPTrack: Metadata: MimeType" ); - CUpnpDlnaProtocolInfo* pInfo = - CUpnpDlnaProtocolInfo::NewL( attr->Value() ); - CleanupStack::PushL( pInfo ); - aMedia.SetTextValueL( - KMPXMediaGeneralMimeType, *To16LC( pInfo->ThirdField() ) ); - CleanupStack::PopAndDestroy(); - CleanupStack::PopAndDestroy( pInfo ); - pInfo = NULL; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::Exists -// -------------------------------------------------------------------------- -// -TBool CUPnPTrack::Exists( const TArray& aAttrs, - const TMPXAttributeData& aAttrData ) const - { - TBool found = EFalse; - for( TInt i = 0; i < aAttrs.Count() && !found; ++i ) - { - if ( aAttrs[i].ContentId() == aAttrData.iContentId && - aAttrs[i].AttributeId() & aAttrData.iAttributeId ) - { - found = ETrue; - } - } - return found; - } - -// -------------------------------------------------------------------------- -// CUPnPTrack::To16LC -// -------------------------------------------------------------------------- -// -const HBufC16* CUPnPTrack::To16LC( const TDesC8& aText ) - { - HBufC16* result = 0; - result = EscapeUtils::ConvertToUnicodeFromUtf8L( aText ); - CleanupStack::PushL( result ); - return result; - } - -// -------------------------------------------------------------------------- -// callbacks from MUPnPItemResolverObserver -// -------------------------------------------------------------------------- -// -void CUPnPTrack::ResolveComplete( const MUPnPItemResolver& /*aResolver*/, - TInt aError ) - { - __LOG1( "CUPnPTrack::ResolveComplete err: %d", aError ); - iIsItemSolved = ETrue; - if ( iState == EStateResolving ) - { - iState = EStateReady; - - // handle pending metadata query - if ( iTrackLocation == ETrackLocationRemote && iMetadataObserver ) - { - __LOG( "Handle pending metadata query"); - TRAP_IGNORE( - DeliverMedataL( iQueriedAttributes.Array(), *iMetadataObserver, - aError ) ); - iMetadataObserver = 0; - iQueriedAttributes.Reset(); - } - - // call back - MUPnPTrackObserver& observer = *iTrackObserver; - iTrackObserver = 0; - observer.ResolveURIComplete( aError ); - } - else if ( iState == EStateSelfDestruct ) - { - __LOG( "CUPnPTrack: self-destructing" ); - delete this; - } - } - -// -------------------------------------------------------------------------- -// Private methods of CUPnPTrack -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// CUPnPTrack::ParsePiecesL -// Parse and save media server id and object id from given descriptor -// -------------------------------------------------------------------------- -// -void CUPnPTrack::ParsePiecesL( const TDesC& aSong ) - { - // Delete if already exist - if( iMediaServer ) - { - delete iMediaServer; - iMediaServer = 0; - } - if( iObjectId ) - { - delete iObjectId; - iObjectId = 0; - } - - // Leave if argument is not valid - if( aSong.Length() < KUPnPPrefixLength ) - { - User::Leave( KErrArgument ); - } - - TInt lenght = aSong.Length(); - TInt position = 0; - TChar colon( KCharCodeColon ); - TChar separate( KCharCodeSeparate ); - - // At first separe "upnp:" prefix from descriptor - position = aSong.Locate( colon ); - TPtrC tmp = aSong.Mid( position + 1, (lenght - KUPnPPrefixLength ) ); - - // Get media server id - position = tmp.Locate( separate ); - // Leave if separator character not found - if( position == KErrNotFound ) - { - User::Leave( KErrNotFound ); - } - TPtrC mediaserverId = tmp.Left( position ); - iMediaServer = HBufC8::NewL( mediaserverId.Length() ); - iMediaServer->Des().Copy( mediaserverId ); - - // Get object id - TPtrC objId = tmp.Mid( position + 1, ( (tmp.Length() - - mediaserverId.Length() ) - 1 ) ); - iObjectId = HBufC8::NewL( objId.Length() ); - iObjectId->Des().Copy( objId ); - } - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpmpxplugins/upnpplaybackplugins/src/upnpvaluestatemachine.cpp --- a/upnpmpxplugins/upnpplaybackplugins/src/upnpvaluestatemachine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,966 +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: Class for retrieving and selecting media renderers -* -*/ - - - - - - -// INCLUDES -#include -#include -#include "upnpavrenderingsession.h" -#include "upnpavdevice.h" -#include "upnpitemutility.h" // for UPnPDurationToMilliseconds -#include "upnpmusicplayer.h" -#include "upnptrack.h" // for TrackDuration -#include "upnpvaluestatemachine.h" -#include "upnppluginserrortranslation.h" - -_LIT( KComponentLogfile, "musicplugins.txt"); -#include "upnplog.h" - -// CONSTANT -const TInt KDefaultMaxVolume = 100; -const TInt KDefaultMinVolume = 0; - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::NewL -// 1st phase constructor. -// -------------------------------------------------------------------------- -// -CUPnPValueStateMachine* CUPnPValueStateMachine::NewL( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ) - { - __LOG( "ValueStateMachine: NewL" ); - CUPnPValueStateMachine* self = new(ELeave) - CUPnPValueStateMachine( aParent, aRenderingSession ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::CUPnPValueStateMachine -// Default constructor. -// -------------------------------------------------------------------------- -// -CUPnPValueStateMachine::CUPnPValueStateMachine( - CUPnPMusicPlayer& aParent, - MUPnPAVRenderingSession& aRenderingSession ) : - iParent( aParent ), - iRendererSession( aRenderingSession ), - iCurrentOperation( EOperationNone ), - iRendererVolume( KErrNotFound ), - iRendererMuted( KErrNotFound ) - { - } - - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::~CUPnPValueStateMachine -// Destructor. -// -------------------------------------------------------------------------- -// -CUPnPValueStateMachine::~CUPnPValueStateMachine() - { - __LOG( "ValueStateMachine: destructor" ); - iOperationQueue.Close(); - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::CopyValues -// copies renderer-specific cached values from another instance -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::CopyValues( - const CUPnPValueStateMachine& aOther ) - { - iRendererVolume = aOther.iRendererVolume; - iRendererMuted = aOther.iRendererMuted; - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::ValidatePropertyInState -// defines the rules of getting / setting in different states -// -------------------------------------------------------------------------- -// -CUPnPValueStateMachine::TValidationResult - CUPnPValueStateMachine::ValidatePropertyInState( - TMPXPlaybackProperty aProperty, - TBool aSetting, - TInt aPlayerState, - TBool aIsReady ) - { - switch( aProperty ) - { - case EPbPropertyMaxVolume: // fall through - case EPbPropertyRemote: // fall through - case EPbPropertySupportedFeatures: - { - // allow getting in all states, - // trying to set will result to error - if ( !aSetting ) - { - return EHandleStatic; - } - else - { - return EErrorNotSupported; - } - } - case EPbPropertyVolume: // fall through - case EPbPropertyMute: - { - // allow volume get/set after initialisation when remote device - // is ready. In other states respond with error - if ( aPlayerState == - CUPnPMusicPlayer::EStateActive ) - { - if( !aIsReady ) - { - return EErrorNotReady; - } - else - { - return EHandle; - } - } - else if ( aPlayerState == - CUPnPMusicPlayer::EStatePreInitialized || - aPlayerState == - CUPnPMusicPlayer::EStateWaiting || - aPlayerState == - CUPnPMusicPlayer::EStateActiveForceInitialise ) - { - return EHandle; - } - else - { - return EErrorNotReady; - } - } - case EPbPropertyDuration: - { - // duration setting is not allowed - // getting is allowed after initialised, but will result - // to returning plain zero in other states except active - // when it is actually asked from the device - if ( aSetting ) - { - return EErrorNotSupported; - } - else if ( aPlayerState == - CUPnPMusicPlayer::EStateActive ) - { - if( aIsReady ) - { - return EHandle; - } - else - { - // On active state but device is not ready -> - // Use initial values. - return EHandleStatic; - } - } - else if ( aPlayerState == - CUPnPMusicPlayer::EStatePreInitialized || - aPlayerState == - CUPnPMusicPlayer::EStateWaiting || - aPlayerState == - CUPnPMusicPlayer::EStateActiveForceInitialise ) - { - return EHandleStatic; - } - else - { - return EErrorNotReady; - } - } - case EPbPropertyPosition: - { - // position get/set is allowed after init when remote device - // is ready. Only active state it will result to real action - if ( aPlayerState == - CUPnPMusicPlayer::EStateActive ) - { - if( aIsReady ) - { - return EHandle; - } - else - { - // On active state but device is not ready -> - // Use initial values. - return EHandleStatic; - } - } - else if ( aPlayerState == - CUPnPMusicPlayer::EStatePreInitialized || - aPlayerState == - CUPnPMusicPlayer::EStateWaiting || - aPlayerState == - CUPnPMusicPlayer::EStateActiveForceInitialise ) - { - return EHandleStatic; - } - else - { - return EErrorNotReady; - } - } - default: - { - // unsupported property - return EErrorNotSupported; - } - } - } - - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::SetL -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::SetL( TMPXPlaybackProperty aProperty, - TInt aValue ) - { - // Check if volume or mute is supported by device - if( ( aProperty == EPbPropertyVolume && - !iParent.UsedRendererDevice().VolumeCapability() ) || - ( aProperty == EPbPropertyMute && - !iParent.UsedRendererDevice().MuteCapability() ) - ) - { - __LOG( "ValueStateMachine::SetL - \ - Request is not supported by device" ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - (TInt)aProperty, KErrNotSupported ); - - return; - } - - // Check from queue if alredy requested. - if( FoundFromQueue( aProperty ) ) - { - __LOG( "ValueStateMachine::SetL: Volume query Ignored!" ); - // Ignore - return; - } - - if ( !iCurrentOperation.None() ) - { - __LOG( "ValueStateMachine::SetL - Append to queue" ); - iOperationQueue.AppendL( TOperation( aProperty, aValue ) ); - return; - } - - switch( aProperty ) - { - case EPbPropertyVolume: - { - __LOG1( "ValueStateMachine: SetVolume(%d)", - aValue ); - // Set the volume, do a sanity check - if( aValue < KDefaultMinVolume || aValue > KDefaultMaxVolume ) - { - // Given value out of range - CheckOperationInQueueL(); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - aProperty, KErrArgument ); - } - else if ( aValue == iRendererVolume ) - { - // re-setting the same volume - if ( iRendererMuted ) - { - MuteRequestL( 0 ); - } - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - aProperty, KErrNone ); - } - else - { - iCurrentOperation.Set( aProperty, aValue ); - iRendererSession.SetVolumeL( aValue ); - if ( iRendererMuted ) - { - // unmute after volume has been adjusted - MuteRequestL( 0 ); - } - } - break; - } - case EPbPropertyMute: - { - __LOG1( "ValueStateMachine: SetMute(%d)", - aValue ); - if( aValue != 0 && iRendererMuted != 1 ) - { - // set mute on - iCurrentOperation.Set( aProperty, 1 ); - iRendererSession.SetMuteL( ETrue ); - } - else if ( aValue == 0 && iRendererMuted != 0 ) - { - // set mute off - iCurrentOperation.Set( aProperty, 0 ); - iRendererSession.SetMuteL( EFalse ); - } - else - { - // mute is already in requested state - CheckOperationInQueueL(); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - aProperty, KErrNone ); - } - break; - } - default: // Given property is not supported - { - __LOG( "ValueStateMachine: Set - default" ); - CheckOperationInQueueL(); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - aProperty, KErrNotSupported ); - break; - } - } - - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::ValueL -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::ValueL( TMPXPlaybackProperty aProperty ) - { - // Check if volume or mute is supported by device - if( ( aProperty == EPbPropertyVolume && - !iParent.UsedRendererDevice().VolumeCapability() ) || - ( aProperty == EPbPropertyMute && - !iParent.UsedRendererDevice().MuteCapability() ) - ) - { - __LOG( "ValueStateMachine::ValueL - \ - Request is not supported by device" ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - (TInt)aProperty, KErrNotSupported ); - - return; - } - - if ( !iCurrentOperation.None() ) - { - __LOG( "ValueStateMachine::ValueL - Append to queue" ); - iOperationQueue.AppendL( TOperation( aProperty ) ); - return; - } - - switch( aProperty ) - { - case EPbPropertyVolume: - { - __LOG( "ValueStateMachine: Value(volume)" ); - iRendererSession.GetVolumeL(); - iCurrentOperation.Set( aProperty ); - break; - } - case EPbPropertyMute: - { - __LOG( "ValueStateMachine: Value(mute)" ); - iRendererSession.GetMuteL(); - iCurrentOperation.Set( aProperty ); - break; - } - case EPbPropertyDuration: - { - __LOG( "ValueStateMachine: Value(duration)" ); - if ( iParent.Track().TrackDuration() > 0 ) - { - // duration found in cache - CheckOperationInQueueL(); - iParent.Observer().HandleProperty( aProperty, - iParent.Track().TrackDuration(), KErrNone ); - } - else - { - iRendererSession.GetPositionInfoL(); - iCurrentOperation.Set( aProperty ); - } - break; - } - case EPbPropertyPosition: - { - __LOG( "ValueStateMachine: Value(position)" ); - iRendererSession.GetPositionInfoL(); - iCurrentOperation.Set( aProperty ); - break; - } - default: - { - __PANICD( __FILE__, __LINE__ ); - break; - } - } - } - - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::ValueStatic -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::ValueStatic( - TMPXPlaybackProperty aProperty, - MMPXPlaybackPluginObserver& aPlaybackObs ) - { - switch( aProperty ) - { - case EPbPropertyMaxVolume: - { - __LOG( "ValueStateMachine: ValueStatic(max volume)" ); - aPlaybackObs.HandleProperty( aProperty, - KDefaultMaxVolume, KErrNone ); - break; - } - case EPbPropertyRemote: - { - __LOG( "ValueStateMachine: ValueStatic(remote)" ); - aPlaybackObs.HandleProperty( aProperty, - (TInt)EFalse, KErrNone ); - break; - } - case EPbPropertySupportedFeatures: - { - __LOG( "ValueStateMachine: ValueStatic(features)" ); - // No support for any features - TInt supportedFeatures = 0; - aPlaybackObs.HandleProperty( aProperty, - supportedFeatures, KErrNone ); - break; - } - case EPbPropertyDuration: - { - __LOG( "ValueStateMachine: ValueStatic(duration)" ); - TInt initialDuration = 0; - aPlaybackObs.HandleProperty( aProperty, - initialDuration, KErrNone ); - break; - } - case EPbPropertyPosition: - { - __LOG( "ValueStateMachine: ValueStatic(position)" ); - TInt initialPosition = 1; - aPlaybackObs.HandleProperty( aProperty, - initialPosition, KErrNone ); - break; - } - default: - { - __PANICD( __FILE__, __LINE__ ); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::DurationQueryL -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::DurationQueryL() - { - // here we could check if the duration is already present in - // iParent.track() however it was decided that we check the duration - // from renderer anyway and trust the renderer's duration more. - if ( !iCurrentOperation.None() ) - { - __LOG( "ValueStateMachine::DurationQueryL - Append to queue" ); - iOperationQueue.AppendL( EOperationDurationQuery ); - return; - } - - __LOG( "ValueStateMachine::DurationQueryL" ); - iRendererSession.GetPositionInfoL(); - iCurrentOperation = EOperationDurationQuery; - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::PositionQueryL -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::PositionQueryL() - { - __LOG( "ValueStateMachine::PositionQueryL" ); - - if ( !iCurrentOperation.None() ) - { - __LOG( "ValueStateMachine::PositionQueryL - Append to queue" ); - iOperationQueue.AppendL( EOperationPositionQuery ); - return; - } - iRendererSession.GetPositionInfoL(); - iCurrentOperation = EOperationPositionQuery; - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::VolumeQueryL -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::VolumeQueryL() - { - // Check if volume feature is supported by device. - if( iParent.UsedRendererDevice().VolumeCapability() ) - { - if ( iRendererVolume != KErrNotFound ) - { - // Volume query not required - already cached. - return; - } - - if ( !iCurrentOperation.None() ) - { - __LOG( "ValueStateMachine::VolumeQueryL - Append to queue" ); - iOperationQueue.AppendL( EOperationVolumeQuery ); - return; - } - - __LOG( "ValueStateMachine::VolumeQueryL" ); - iRendererSession.GetVolumeL(); - iCurrentOperation = EOperationVolumeQuery; - } - else - { - // Get volume is not supported. Do nothing. - } - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::MuteRequestL -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::MuteRequestL( TInt aMute ) - { - if ( !iCurrentOperation.None() ) - { - __LOG( "ValueStateMachine::MuteRequestL - Append to queue" ); - iOperationQueue.AppendL( TOperation( EOperationMute, aMute ) ); - return; - } - - __LOG1( "ValueStateMachine: MuteRequest(%d)", aMute ); - if( aMute != 0 && iRendererMuted != 1 ) - { - // set mute on - iCurrentOperation = EOperationMute; - iRendererSession.SetMuteL( ETrue ); - } - else if ( aMute == 0 && iRendererMuted != 0 ) - { - // set mute off - iCurrentOperation = EOperationMute; - iRendererSession.SetMuteL( EFalse ); - } - else - { - // mute is already in requested state - CheckOperationInQueueL(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::VolumeResult -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::VolumeResult( TInt aError, TInt aVolumeLevel, - TBool aActionResponse ) - { - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError ); - // If response for get volume - - if( aActionResponse ) - { - if (aError == KErrNone) - { - iRendererVolume = aVolumeLevel; - } - - if( iCurrentOperation.Compare( EOperationValue, EPbPropertyVolume ) ) - { - __LOG( "ValueStateMachine::VolumeResult: Value resp." ); - - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - iParent.Observer().HandleProperty( EPbPropertyVolume, - iRendererVolume, aError ); - } - else if( iCurrentOperation.Compare( EOperationSet, - EPbPropertyVolume ) ) - { - __LOG( "ValueStateMachine::VolumeResult: Set resp." ); - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - (TInt)EPbPropertyVolume, aError ); - } - else if ( iCurrentOperation == EOperationVolumeQuery ) - { - __LOG1("VolumeQueryResult: Volume query resp err=%d", aError ); - - if ( aError == KErrNone ) - { - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPVolumeChanged, - iRendererVolume, aError ); - } - - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - } - else - { - iCurrentOperation.Reset(); - __LOG( "ValueStateMachine::VolumeResult: no request?" ); - } - } - else // Volume changed from device - { - // Ignore volume events from device if volume control - // is ongoing on handset. - if( iCurrentOperation.Compare( EOperationSet, EPbPropertyVolume ) ) - { - return; - } - - if (aError == KErrNone) - { - iRendererVolume = aVolumeLevel; - } - - if ( !iRendererMuted ) - { - __LOG1( "ValueStateMachine::VolumeResult: from device: (%d)", - aVolumeLevel ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPVolumeChanged, - iRendererVolume, aError ); - } - else - { - __LOG( "ValueStateMachine::VolumeResult: from device (muted)" ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::MuteResult -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::MuteResult( TInt aError, TBool aMute, - TBool aActionResponse ) - { - aError = TUpnpPluginsErrorTranslation::ErrorTranslate( aError ); - // Response for set mute - if( aActionResponse ) - { - if( iCurrentOperation.Compare( EOperationValue, EPbPropertyMute ) ) - { - __LOG( "ValueStateMachine::MuteResult: Value resp." ); - iRendererMuted = aMute; - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - iParent.Observer().HandleProperty( EPbPropertyMute, - (TInt)aMute, aError ); - } - else if ( iCurrentOperation.Compare( EOperationSet, - EPbPropertyMute ) ) - { - __LOG( "ValueStateMachine::MuteResult: Set resp." ); - iRendererMuted = aMute; - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPSetComplete, - (TInt)EPbPropertyMute, aError ); - } - else if ( iCurrentOperation == EOperationMute ) - { - // internal operation, no event. - iRendererMuted = aMute; - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - } - else - { - iRendererMuted = aMute; - iCurrentOperation.Reset(); - __LOG( "ValueStateMachine::MuteResult: no request?" ); - } - } - else // Mute changed from device - { - __LOG( "ValueStateMachine::MuteResult: Mute changed from device" ); - - if( aMute ) - { - iRendererMuted = ETrue; - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPVolumeChanged, - 0, aError ); - } - else - { - iRendererMuted = EFalse; - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPVolumeChanged, - iRendererVolume, aError ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::PositionInfoResult -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::PositionInfoResult( TInt aStatus, - const TDesC8& aTrackPosition, const TDesC8& aTrackLength ) - { - // Check if position info was asked - if( iCurrentOperation.Compare( EOperationValue, EPbPropertyPosition ) ) - { - __LOG1( "Position response err=%d", aStatus ); - TInt ms = 0; - if( aStatus == KErrNone ) - { - // Convert the descriptor to integer value - aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds( - aTrackPosition, ms ); - __LOG2( "ValueStateMachine::PositionInfoResult position=%d err=%d", - ms, aStatus ); - } - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - - // Use initial position value in case of errors or position 0. - // This will guarantee that in case of unpause, SetPosition - // is called with real value even if remote player does not - // return real value for getposition call. Note that - // SetPosition(0) is used when user really wants to move to - // track beginning. - if( aStatus != KErrNone ) - { - // GetPositionInfo is not supported by used device. - iParent.Observer().HandleProperty( EPbPropertyPosition, 1, - KErrNotSupported ); - } - else - { - if( ms == 0 ) - { - ms = 1; - } - iParent.Observer().HandleProperty( EPbPropertyPosition, ms, - aStatus ); - } - } - else if ( iCurrentOperation == EOperationPositionQuery ) - { - __LOG1( "PositionQuery response err=%d", aStatus ); - TInt ms = 0; - if( aStatus == KErrNone ) - { - // Convert the descriptor to integer value - aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds( - aTrackPosition, ms ); - __LOG2( "ValueStateMachine::PositionInfoResult position=%d err=%d", - ms, aStatus ); - } - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - - if( aStatus == KErrNone ) - { - if( ms == 0 ) - { - ms = 1; - } - //iParent.Observer().HandlePluginEvent( - //MMPXPlaybackPluginObserver::EPPositionChanged, ms, KErrNone ); - } - } - // Check if duration info was asked - else if( iCurrentOperation.Compare( EOperationValue, - EPbPropertyDuration ) ) - { - __LOG1( "Duration response err=%d", aStatus ); - TInt ms = 0; - if( aStatus == KErrNone ) - { - aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds( - aTrackLength, ms ); - __LOG2( "ValueStateMachine::PositionInfoResult -\ - duration=%d err=%d", ms, aStatus ); - - if ( aStatus == KErrNone ) - { - iParent.Track().SetTrackDuration( ms ); - } - } - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - - if( aStatus == KErrNotSupported ) - { - // GetDuration is not supported by used device. - // Use initial duration value (1). It will guarantee that in - // case of unpause, SetPosition is called with real value even - // if remote player does not return real value for getposition - // call. Note that SetPosition(0) is used when user really wants - // to move to track beginning. - iParent.Observer().HandleProperty( EPbPropertyDuration, 1, - KErrNone ); - } - else - { - iParent.Observer().HandleProperty( EPbPropertyDuration, - ms, aStatus ); - } - } - else if ( iCurrentOperation == EOperationDurationQuery ) - { - __LOG1( "DurationQuery response err=%d", aStatus ); - TInt ms = 0; - if( aStatus == KErrNone ) - { - aStatus = UPnPItemUtility::UPnPDurationAsMilliseconds( - aTrackLength, ms ); - __LOG2( "ValueStateMachine::PositionInfoResult - \ - duration=%d err=%d", - ms, aStatus ); - if ( aStatus == KErrNone ) - { - iParent.Track().SetTrackDuration( ms ); - } - } - iCurrentOperation.Reset(); - TRAP_IGNORE( CheckOperationInQueueL() ); - - if ( iParent.Track().TrackDuration() > 0 && aStatus == KErrNone ) - { - iParent.Observer().HandlePluginEvent( - MMPXPlaybackPluginObserver::EPDurationChanged, - iParent.Track().TrackDuration(), KErrNone ); - } - } - else - { - __LOG( "ValueStateMachine::PositionInfoResult: no request?" ); - } - } - - - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::Cancel -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::Cancel() - { - // reset current operation and empty the queue -> no callbacks. - iCurrentOperation.Reset(); - iOperationQueue.Reset(); - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::CheckOperationInQueueL -// Checks if operations are in the queue, and executes -// -------------------------------------------------------------------------- -// -void CUPnPValueStateMachine::CheckOperationInQueueL() - { - if ( !iCurrentOperation.None() ) - { - // check operation though a current operation exists! - __PANICD( __FILE__, __LINE__ ); - return; - } - - if ( iOperationQueue.Count() > 0 ) - { - TOperation op = iOperationQueue[0]; - iOperationQueue.Remove(0); - if ( op == EOperationValue ) - { - ValueL( op.iProperty ); - } - else if ( op == EOperationSet ) - { - SetL( op.iProperty, op.iValue ); - } - else if ( op == EOperationDurationQuery ) - { - DurationQueryL(); - } - else if ( op == EOperationVolumeQuery ) - { - VolumeQueryL(); - } - else if ( op == EOperationPositionQuery ) - { - PositionQueryL(); - } - else if ( op == EOperationMute ) - { - MuteRequestL( op.iValue ); - } - else - { - __PANICD( __FILE__, __LINE__ ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPValueStateMachine::FoundFromQueue -// Checks if operations are in the queue -// -------------------------------------------------------------------------- -// -TBool CUPnPValueStateMachine::FoundFromQueue(TMPXPlaybackProperty aProperty) - { - TBool found = EFalse; - TInt count = iOperationQueue.Count(); - - for( TInt i = 0; i < count; i++ ) - { - TOperation op = iOperationQueue[i]; - if( op.iProperty == aProperty ) - { - found = ETrue; - break; - } - } - return found; - } - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/appwizard/BWINS/upnpappwizardU.DEF --- a/upnpsettings/appwizard/BWINS/upnpappwizardU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - ?NewL@CUPnPAppWizard@@SAPAV1@ABVTDesC16@@PAVCUPnPFileSharingEngine@@@Z @ 1 NONAME ; class CUPnPAppWizard * CUPnPAppWizard::NewL(class TDesC16 const &, class CUPnPFileSharingEngine *) - ?StartL@CUPnPAppWizard@@QAEHXZ @ 2 NONAME ; int CUPnPAppWizard::StartL(void) - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/appwizard/EABI/upnpappwizardU.DEF --- a/upnpsettings/appwizard/EABI/upnpappwizardU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - _ZN14CUPnPAppWizard4NewLERK7TDesC16P22CUPnPFileSharingEngine @ 1 NONAME - _ZN14CUPnPAppWizard6StartLEv @ 2 NONAME - _ZTI14CUPnPAppWizard @ 3 NONAME ; ## - _ZTV14CUPnPAppWizard @ 4 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/appwizard/data/cupnpappwizard.rss --- a/upnpsettings/appwizard/data/cupnpappwizard.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,589 +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: upnp setup wizard resource description file -* -*/ - - - - - - - -// RESOURCE IDENTIFIER -NAME HORO // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - - -// RESOURCE DEFINITIONS - -// -------------------------------------------------------------------------- -// RSS_SIGNATURE -// -------------------------------------------------------------------------- -RESOURCE RSS_SIGNATURE - { - } - -// -------------------------------------------------------------------------- -// TBUF -// -------------------------------------------------------------------------- -RESOURCE TBUF - { - buf = ""; - } - - - -// -------------------------------------------------------------------------- -// -// R_UPNP_WIZARD_SOFTKEYS_NEXT_CANCEL__SELECT -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnp_wizard_softkeys_next_cancel__select - { - buttons = - { - CBA_BUTTON {id = EAknSoftkeyOk; txt = qtn_iupnp_softkey_next;}, - CBA_BUTTON {id = EAknSoftkeyCancel; txt = text_softkey_cancel;}, - CBA_BUTTON {id = EAknSoftkeyOk;} - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNP_WIZARD_SOFTKEYS_NEXT_BACK__SELECT -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnp_wizard_softkeys_next_back__select - { - buttons = - { - CBA_BUTTON {id = EAknSoftkeyOk; txt = qtn_iupnp_softkey_next;}, - CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, - CBA_BUTTON {id = EAknSoftkeyOk;} - }; - } - - -// -------------------------------------------------------------------------- -// -// R_UPNP_WIZARD_SOFTKEYS_DONE_BACK__SELECT -// -// -------------------------------------------------------------------------- -// -RESOURCE CBA r_upnp_wizard_softkeys_done_back__select - { - buttons = - { - CBA_BUTTON {id = EAknSoftkeyOk; txt = text_softkey_done;}, - CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, - CBA_BUTTON {id = EAknSoftkeyOk;} - }; - } -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_1 -// resource for wizard step 1 -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_wizard_popup_dialog_1 - { - flags = EGeneralQueryFlags | - EEikDialogFlagNoTitleBar | - EEikDialogFlagNoBorder | - EEikDialogFlagNoShadow; - buttons = r_upnp_wizard_softkeys_next_cancel__select; - - - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - bmpfile = ""; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -RESOURCE TBUF r_upnp_wizard_head_1_text - { - buf = qtn_iupnp_wizard_head_1; - } - -RESOURCE TBUF r_upnp_wizard_1_text - { - buf = qtn_iupnp_wizard_1; - } - -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_2 -// resource for wizard step 2 -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_wizard_popup_dialog_2 - { - flags = EGeneralQueryFlags | - EEikDialogFlagNoTitleBar | - EEikDialogFlagNoBorder | - EEikDialogFlagNoShadow; - buttons = r_upnp_wizard_softkeys_next_back__select; - - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - bmpfile = ""; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -RESOURCE TBUF r_upnp_wizard_head_2_text - { - buf = qtn_iupnp_wizard_head_2; - } - -RESOURCE TBUF r_upnp_wizard_2_text - { - buf = qtn_iupnp_wizard_2; - } - -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_3 -// resource for wizard step 3 -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_wizard_popup_dialog_3 - { - flags = EGeneralQueryFlags; - buttons = r_upnp_wizard_softkeys_next_back__select; - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - label = " "; - control = EDWIN - { - width = 5; - lines = 1; - maxlength = 64; - }; - }; - } - }; - } - -RESOURCE TBUF r_upnp_wizard_head_3_text - { - buf = qtn_iupnp_wizard_head_3; - } - -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_4 -// resource for wizard step 4 -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_wizard_popup_dialog_4 - { - flags = EGeneralQueryFlags | - EEikDialogFlagNoTitleBar | - EEikDialogFlagNoBorder | - EEikDialogFlagNoShadow; - buttons = r_upnp_wizard_softkeys_next_back__select; - - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - bmpfile = ""; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -RESOURCE TBUF r_upnp_wizard_head_4_text - { - buf = qtn_iupnp_wizard_head_4; - } - -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_5 -// resource for wizard step 5 -// -------------------------------------------------------------------------- -RESOURCE AVKON_LIST_QUERY r_upnp_wizard_popup_dialog_5 - { - flags = EGeneralQueryFlags; - softkeys = r_upnp_wizard_softkeys_next_back__select; - - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - }; - heading = " "; - }; - } - }; - } - -RESOURCE TBUF r_upnp_wizard_head_5_text - { - buf = qtn_iupnp_wizard_head_5; - } - -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_6 -// resource for wizard step 6 -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_wizard_popup_dialog_6 - { - flags = EGeneralQueryFlags | - EEikDialogFlagNoTitleBar | - EEikDialogFlagNoBorder | - EEikDialogFlagNoShadow; - buttons = r_upnp_wizard_softkeys_next_back__select; - - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - bmpfile = ""; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -RESOURCE TBUF r_upnp_wizard_head_6_text - { - buf = qtn_iupnp_wizard_head_6; - } - -//---------------------------------------------------------------------------- -// r_upnp_wizard_6_2_text -// text for r_upnp_wizard_popup_dialog_6 -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_6_2_text - { - buf = qtn_iupnp_wizard_6_2; - } - - -RESOURCE TBUF r_upnp_wizard_head_7_text - { - buf = qtn_iupnp_wizard_head_7; - } - - -RESOURCE TBUF r_upnp_wizard_head_8_text - { - buf = qtn_iupnp_wizard_head_8; - } - -//---------------------------------------------------------------------------- -// r_upnp_wizard_9a_text -// text for r_upnp_wizard_popup_dialog_9a -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_9a_text - { - buf = qtn_iupnp_wizard_9a_2; - } - -//---------------------------------------------------------------------------- -// r_upnp_wizard_9b_text -// text for r_upnp_wizard_popup_dialog_9b -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_9b_text -{ - buf = qtn_iupnp_wizard_9b_2; -} - - -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_9a -// resource for wizard step 9a -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_wizard_popup_dialog_9a - { - flags = EGeneralQueryFlags | - EEikDialogFlagNoTitleBar | - EEikDialogFlagNoBorder | - EEikDialogFlagNoShadow; - - buttons = r_upnp_wizard_softkeys_done_back__select; - - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - bmpfile = ""; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -RESOURCE TBUF r_upnp_wizard_head_9_text - { - buf = qtn_iupnp_wizard_head_9; - } - -// -------------------------------------------------------------------------- -// r_wizard_popup_dialog_9b -// resource for wizard step 9b -// -------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_wizard_popup_dialog_9b - { - flags = EGeneralQueryFlags | - EEikDialogFlagNoTitleBar | - EEikDialogFlagNoBorder | - EEikDialogFlagNoShadow; - - buttons = r_upnp_wizard_softkeys_done_back__select; - - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - bmpfile = ""; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -//--------------------------------------------------------------------------- -// r_upnp_wizard_starting_file_sharing_note -// text included from homeconnect.loc -// resource for starting filesharing wait note -//--------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnp_wizard_starting_file_sharing_note - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_iupnp_wait_sharing; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//--------------------------------------------------------------------------- -// r_upnp_wizard_always_ask_text -// text for always ask item in iap selection -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_always_ask_text - { - buf = qtn_iupnp_always_ask; - } - -//--------------------------------------------------------------------------- -// r_upnp_wizard_create_new_text -// text for create new item in iap selection -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_create_new_text - { - buf = qtn_iupnp_create_new; - } - -//--------------------------------------------------------------------------- -// r_settings_start_sharing_error_text -// included from homeconnect.loc -// text to infrom used that sharing activation failed -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_start_sharing_error_text - { - buf = qtn_iupnp_start_sharing_error; - } - -//--------------------------------------------------------------------------- -// r_upnp_wizard_4_text -// Text for wizard step 4 -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_4_text - { - buf = qtn_iupnp_wizard_4; - } - -//--------------------------------------------------------------------------- -// r_upnp_wizard_iap_turn_sharing_off -// note to show if sharing is on when trying to change iap or device name -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_iap_turn_sharing_off - { - buf = qtn_iupnp_ibu_gallery_connectionactive_note; - } - -//---------------------------------------------------------------------------- -// -// r_upnp_wizard_updating_content_note_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_updating_content_note_text - { - buf = qtn_iupnp_wait_updating_content; - } - -//---------------------------------------------------------------------------- -// -// r_upnp_wizard_updating_content_header -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_wizard_updating_content_header - { - buf = qtn_iupnp_updating_content_header; - } - -//---------------------------------------------------------------------------- -// -// r_upnp_wizard_info_query -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnp_wizard_info_query -{ - flags = EGeneralQueryFlags | EEikDialogFlagNoTitleBar | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; -} - -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/appwizard/group/bld.inf --- a/upnpsettings/appwizard/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2006-2007 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 information file for upnp setup wizard -* -*/ - - - - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// ADO internal interface -../inc/cupnpappwizard.h |../../../inc/cupnpappwizard.h - -PRJ_MMPFILES -cupnpappwizard.mmp - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/appwizard/group/cupnpappwizard.mmp --- a/upnpsettings/appwizard/group/cupnpappwizard.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2006-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: Project file for upnp settings wizard -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" -#include - -TARGET upnpappwizard.dll -TARGETTYPE dll -UID 0x100000D8 0x200009E7 - -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -// SIS installation + IAD support -VERSION 10.1 -paged - -// Include paths -MW_LAYER_SYSTEMINCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -START RESOURCE ../data/cupnpappwizard.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -SOURCEPATH ../src - -SOURCE cupnpappwizard.cpp - - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY avkon.lib -LIBRARY aknlayout.lib -LIBRARY AKNSKINS.lib -LIBRARY AknIcon.lib -LIBRARY AknLayout2Scalable.lib -LIBRARY eikctl.lib -LIBRARY eikdlg.lib -LIBRARY featmgr.lib -LIBRARY egul.lib -LIBRARY CommonEngine.lib -LIBRARY fbscli.lib -LIBRARY efsrv.lib -LIBRARY hlplch.lib -LIBRARY gdi.lib -LIBRARY commdb.lib -LIBRARY apengine.lib -LIBRARY ecom.lib -LIBRARY bafl.lib -LIBRARY esock.lib - -// upnp stack -LIBRARY upnpipserversutils.lib - -// upnp framework -LIBRARY upnpapplicationengine.lib -LIBRARY upnpsettingsengine.lib -LIBRARY upnpmultiselectionui.lib - - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/appwizard/inc/cupnpappwizard.h --- a/upnpsettings/appwizard/inc/cupnpappwizard.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,517 +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: Header file for the Setup wizard class -* -*/ - - - - - - -#ifndef CUPNPAPPWIZARD -#define CUPNPAPPWIZARD - -// INCLUDES -#include -#include // base class MAknBackgroundProcess - -#include "upnpfilesharingengine.h" //CUPnPFileSharingEngine & THomeConnectMediaType -#include "upnpfilesharingengineobserver.h" //MUPnPFileSharingEngineObserver - - - -// CONSTANTS -const TInt KUPnPAlwaysAskInd = 0; -const TInt KUPnPCreateNewInd = 1; - - -// FORWARD DECLARATIONS -class CAknViewAppUi; -class CUPnPSettingsEngine; -class CEikonEnv; -class CUPnPMultiselectionUi; -// CLASS DECLARATION - -/** - * CUPnPAppWizard class - * - * Class implementing the functionality of the setup wizard - * @since S60 v3.1 - * @lib upnpappwizard.lib - */ -class CUPnPAppWizard : public CBase, - private MUPnPFileSharingEngineObserver, - MAknBackgroundProcess - { -public: // Constructors and destructor - - enum TSharingStarting - { - ENotActive, - EStartingSharing, - ESharingStarted - }; - - enum TShareArrayState - { - ESetMarked, - EResetArray, - EAddToArray - }; - - /** - * Two-phased constructor. - * @since S60 v3.1 - * @param aFirstStepText, Text for the first wizard step, owned by \ -client. If length of the aFirstStepText is 0 default text is used - * @param aEng, Pointer to filesharing engine instance - */ - IMPORT_C static CUPnPAppWizard* NewL( const TDesC& aFirstStepText, - CUPnPFileSharingEngine* aEng ); - - /** - * Destructor. - */ - virtual ~CUPnPAppWizard(); - -public: // New functions - - /** - * Starts wizard - * - * @since S60 v3.1 - * @return TInt, Error code - */ - IMPORT_C TInt StartL(); - - /** - * Modifies iShareImgAndVideoArray and iShareMusicArray arrays - * - * @param aArrayState - * @param aValue - * @param aUiDlg - */ - void ModifyMarkedArrayL( TShareArrayState aArrayState - , TInt aValue = 0 - , CUPnPMultiselectionUi* aUiDlg = NULL ); - -private: - /** - * CSelectionStorage class - * - * Private class for user selections and handling their - * storage and retrieval - * @since S60 v3.1 - */ - NONSHARABLE_CLASS( CSelectionStorage ) : public CBase - { - public : - - enum TSharingStartResult - { - ESharingStarted, - ENothingToShare, - ESharingStartFailed - }; - /** - * C++ default constructor - * @param aSetEng. Pointer to CUPnPSettingsEngine, not owned - * @param aFileEng. Pointer to CUPnPFileSharingEngine, not owned - */ - CSelectionStorage( CUPnPSettingsEngine* aSetEng, - CUPnPFileSharingEngine* aFileEng ); - /** - * Destructor. - */ - virtual ~CSelectionStorage(); - - /** - * Store locally users selected device name - * @since S60 v3.1 - * @param aDeviceName. The new name - */ - void SetDeviceNameL( TDes& aDeviceName ); - - /** - * Get device name from local store of from cenrep - * @since S60 v3.1 - * @param aDeviceName. Descriptor to store the name - * @return success of the operation - */ - TInt GetDeviceNameL( TDes& aDeviceName ); - - /** - * Sets the IAP id of the user selected IAP - * @since S60 v3.1 - * @param aIapId. Iap id of the selected IAP - * @param aIndexForUi, Index of the iap in UI list - */ - void SetIapId( const TInt aIapId, - const TInt aIndexForUi ); - /** - * Function for getting the iapid from local storage or from cenrep - * @since S60 v3.1 - * @param aIapId. Iap id of the selected IAP - * @return success of the operation - */ - TInt GetIapId( TInt& aIapId ); - - /** - * Initialize Iap name and iap id arrays with some fixed texts - * @since S60 v3.1 - * @param aIapNameArr. Array pointer for the names - * @param aIApIdArr. Array pointer for iap IDs - */ - void InitializeIapArraysL( CDesCArray* aIapNameArr, - RArray& aIapIdArr ) const; - - /** - * Stores the user selections from filesharing popus to local storage - * @since S60 v3.1 - * @param aMedia. Type of media - * @param aSelections. Array of the selections user has made. - * Stored only locally - */ - void SetSharedContent( THomeConnectMediaType aMedia, - CArrayFix* aSelections ); - - /** - * Stores the devicename and IAP from local store to cenrep - * @since S60 v3.1 - * @return success of the operation - */ - TInt StoreSettingsL(); - - /** - * Stores the selected image and video albums from local store to - * cenrep - * @since S60 v3.2 - * @return error code - */ - TInt ImageStoreSharedFilesL(); - - /** - * Gets the users sharing selections as indexes from local storage - * @since S60 v3.1 - * @param aMedia. The kind of selections to get - * @param aSelections. Array for selections - */ - void GetSelectionsL( - THomeConnectMediaType aMedia, - CArrayFix* aSelections ); - - /** - * Determines if the is need to start sharing - * @since S60 v3.1 - * @return ETrue if sharing needs to be activated. - */ - TBool HasSomethingToShare() const; - - /** - * Gets the currently selected IAP index for the listbox UI - * @since S60 v3.1 - * @param aCurrentSelection. The new current selection - * @param aIapIdArr. Array of IAP ids of the IAPs shown in listbox - - */ - void GetCurrentSelection( TInt& aCurrentSelection, - RArray& aIapIdArr ); - - /** - * Gets the WAP iap associated to given IAPid - * @since S60 v3.1 - * @param aIAPId. Id to match - * @return. The id of the corresponding WAP record - */ - TInt ConvertIAPIdL( TInt aIAPId ); - - private : - /** - * Pointer to UPnP settings engine - * Not owned - */ - CUPnPSettingsEngine* iSetEng; - - /** - * Pointer to UPnP File sharing engine - * Not owned - */ - CUPnPFileSharingEngine* iFileEng; - - /** - * Pointer to UPnP device name - * Not owned - */ - HBufC* iDeviceName; - - /** - * Users selected IAP id - * - */ - TInt iIapId; - - /** - * Index for home network UI, to show the correct item as selected - * - */ - TInt iIndexForUi; - - /** - * The selection of Image& video sharing for Home Network UI - */ - TBool iVisualImageSelection; - - /** - * The selection of music sharing for Home Network UI - */ - TBool iVisualMusicSelection; - - /** - * The Array of the selected indexes user has made for sharing images - * and videos - * owned - */ - CArrayFix* iImageSelectionArray; - /** - * The Array of the selected indexes user has made for sharing music - * owned - */ - CArrayFix* iMusicSelectionArray; - - }; - - - /** - * Internal states of wizard - */ - enum TWizardStep - { - EInfo1 = 0, - EInfo2, - EDeviceName, - EInfo4, - EAccessPoint, - EInfo6, - EShareImages, - EShareMusic, - EInfo9, - EStoreSettings, - EFinished - }; - - /** - * C++ default constructor - */ - CUPnPAppWizard(); - - /** - * Show the information note with OK BACK buttons - * @since S60 v3.1 - * @param TInt, resource ID - * @return keycode of the button user has pressed. - */ - TInt ShowInfoStepL( TInt aMain ) const; - - /** - * Show the first step. The text is given in constructor - * @param TInt, resource ID - * @return keycode of the button user has pressed. - */ - TInt ShowFirstStepL( TInt aMain ) const; - /** - * Shows popup with text and header and edit box - * @since S60 v3.1 - * @param TInt, resource ID - * @return keycode of the button user has pressed. - */ - TInt ShowTextStepL( TInt aMain ); - - /** - * Show the information note without buttons - * @since S60 v3.1 - * @param TInt, resource ID - - */ - void ShowInfoNoteL( TInt aMain ) const; - - /** - * Show the UI dialog with selection list - * @since S60 v3.1 - * @param TInt, resource ID - * @return keycode of the button user has pressed. - */ - TInt ShowListStepL( TInt aMain ); - - - /** - * Determines the next wizard step - * @since S60 v3.1 - * @param TInt& The keycode of the users selection from previous dialog - - */ - void SetNextStep( const TInt& aSelection ); - - /** - * Shows the step for setting shared content - * @since S60 v3.1 - * @param TInt, resource ID - * @return keycode of the button user has pressed. - */ - TInt ShowMultiselectionStepL( TInt aText ); - - /** - * Show error note with given resource id - * @since S60 v3.1 - * @param TInt, resource ID - */ - void ShowErrorNoteL( TInt aMain ) const; - - /** - * Show wait note with given resource id - * @since S60 v3.1 - * @param TInt, resource ID - */ - void ShowWaitNoteL( TInt aMain ); - -private: //From MUPnPFileSharingEngineObserver - /** - * Function informs when file sharing was enabled or disabled - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aError, error code - * @param aPhase ETrue if current phase is sharing activation, - * otherwise EFalse - */ - void HandleSharingStatus( - CUPnPFileSharingEngine& aEngine, - TInt aError, - TBool aPhase ); - - /** - * Callback to inform if connection has been lost - * @since S60 3.1 - * @param aEngine File sharing engine - */ - void HandleSharingConnectionLost( - CUPnPFileSharingEngine& aEngine ); - -private: - /** - * Shows progress note to indicate progress of sharing files - * @since S60 v3.1 - * @param TInt, The number of objects - */ - void ShowProgressNoteL( TInt aObjectCount ); - - /** - * Called when waitnote wrapper is finished - * From MProgressDialogCallback - */ - void DialogDismissedL( TInt aButtonId ); - - /** - * EPOC default constructor. - */ - void ConstructL( const TDesC& aFirstStepText, - CUPnPFileSharingEngine* aEng ); - - void StepL(); - - TBool IsProcessDone() const; - - /** - * Display info note after starting sharing content - * @since S60 v3.1 - * @param TInt, Id of note header resource - * @param TInt, Id of note message resource - * @param TInt, Id of note resource - */ - void DisplayInfoL( - TInt aHeaderResourceId, - TInt aMessageResourceId, - TInt aDialogResourceId ); - - -private: // Data - - CAknViewAppUi* iAppUi; // Not owned - TInt iResFileOffset; // Resource file offset - CEikonEnv* iCoeEnv; // Not owned - /** - * The position of the wizard - */ - TInt iStep; - /** - * The class for retrieving and setting shared items - */ - CUPnPFileSharingEngine* iFileEng; - /** - * The class for setting the IAP id and deviceName - */ - CUPnPSettingsEngine* iSetEng; - /** - * The storage for the user selections - */ - CSelectionStorage* iSelections; - - /** - * Wait used in asynchronous operations - * Started when there is operation ongoing in filesharingengine - */ - CActiveSchedulerWait iWait; - - /** - * Array for IAP names - */ - CDesCArray* iIapNameArr; - - /** - * Status of the sharing when starting wizard - * ETrue = Sharing on - */ - TBool iSharingState; - - /** - * Text for the first wizard step - * - */ - HBufC* iFirstStepText; - - /** - * Indicator if starting sharing is ongoing - */ - TInt iStartingSharing; - - TBool iDialogDismissed; - - /** - * stores indexes if img and/or video is shared marked - */ - CArrayFix* iShareImgAndVideoArray; - - /** - * stores indexes if music is shared marked - */ - CArrayFix* iShareMusicArray; - - /** - * Flag the FeatureManager is initialized or not - */ - TBool iFeatureManagerInitialized; - }; - -#endif // CUPNPAPPWIZARD - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/appwizard/src/cupnpappwizard.cpp --- a/upnpsettings/appwizard/src/cupnpappwizard.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1314 +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: Implementation of setup Wizard - * -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include //CAknMessageQueryDialog -#include //CAknListQueryDialog -#include //RSocketServ -#include -#include -#include -#include -#include //CAknWaitDialog -#include -#include -#include // COMMS DB - for checking AP validity - -// upnp stack -#include "upnpstring.h" //String::ToUnicodeL - -// ADO internal interfaces -#include "upnpsettingsengine.h" //Friendly name, AP -#include "upnpsettingsengine.hrh" //AP -#include "cupnpmultiselectionui.h" //CUPnPMultiSelectionUi - -// this component -#include "cupnpappwizard.h" - -// logging facility -_LIT( KComponentLogfile, "upnpsetupwizard.txt"); -#include "upnplog.h" - -// CONSTANTS -// Filename of rsc file -_LIT( KUPnPSetupWizardRscFile, "\\resource\\cupnpappwizard.rsc" ); - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::CUPnPAppWizard -// -------------------------------------------------------------------------- -// -CUPnPAppWizard::CUPnPAppWizard() - { - __LOG("CUPnPAppWizard::CUPnPAppWizard"); - iDialogDismissed = ETrue; - iFeatureManagerInitialized = EFalse; - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::ConstructL( const TDesC& aFirstStepText, - CUPnPFileSharingEngine* aEng ) - { - __LOG("CUPnPAppWizard::ConstructL begin"); - - iShareImgAndVideoArray = new (ELeave) CArrayFixFlat(3); - iShareMusicArray = new (ELeave) CArrayFixFlat(3); - - iCoeEnv = CEikonEnv::Static(); - RFs& fileSession = iCoeEnv->FsSession(); - - - // Load resource file - TFileName rscFileName( KUPnPSetupWizardRscFile ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - rscFileName.Insert( 0, drive ); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - // Check if the resource file exists or not - if ( !BaflUtils::FileExists( fileSession, rscFileName ) ) - { - User::Leave( KErrNotFound ); - } - TInt err( KErrNone ); - TRAP( err, iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ) ); - - FeatureManager::InitializeLibL(); - iFeatureManagerInitialized = ETrue; - - // Get AppUI pointer - iAppUi = static_cast( iCoeEnv->EikAppUi() ); - - iSetEng = CUPnPSettingsEngine::NewL(); - if ( aEng ) - { - iFileEng = aEng; - } - else - { - User::Leave( KErrArgument); - } - iFileEng->SetObserver( this ); - iFirstStepText = aFirstStepText.AllocL(); - - iSharingState = iFileEng->SharingStateL(); - iSelections = new (ELeave) CSelectionStorage( iSetEng, iFileEng ); - __LOG("CUPnPAppWizard::ConstructL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::NewL() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPAppWizard* CUPnPAppWizard::NewL( const TDesC& aFirstStepText, - CUPnPFileSharingEngine* aEng ) - { - __LOG("CUPnPAppWizard::NewL begin"); - - CUPnPAppWizard* self = new ( ELeave) CUPnPAppWizard(); - CleanupStack::PushL( self ); - - self->ConstructL( aFirstStepText, aEng ); - - CleanupStack::Pop(); - __LOG("CUPnPAppWizard::NewL end"); - return self; - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPAppWizard::~CUPnPAppWizard() - { - __LOG("CUPnPAppWizard::~CUPnPAppWizard begin"); - - if ( iFeatureManagerInitialized ) - { - FeatureManager::UnInitializeLib(); - } - - // Un-Load resource file - if ( iResFileOffset ) - { - CEikonEnv::Static()->DeleteResourceFile( iResFileOffset ); - iResFileOffset = 0; - } - - delete iSetEng; - - delete iSelections; - delete iIapNameArr; - delete iFirstStepText; - - if ( iWait.IsStarted() ) - { - if ( iWait.CanStopNow() ) - { - iWait.AsyncStop(); - } - else - { - __LOG("CUPnPAppWizard: \ -Error cant stop iWait"); - } - } - - if ( iFileEng ) - { - iFileEng->SetObserver( NULL ); - } - - delete iShareImgAndVideoArray; - delete iShareMusicArray; - - __LOG("CUPnPAppWizard::~CUPnPAppWizard end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::StartL -// The main loop of setup wizard -// -------------------------------------------------------------------------- -// - -EXPORT_C TInt CUPnPAppWizard::StartL( ) - { - __LOG("CUPnPAppWizard::StartL begin"); - TInt ret(KErrNone); - do - { - switch ( iStep ) - { - case EInfo1: - { - ret = ShowFirstStepL( R_UPNP_WIZARD_POPUP_DIALOG_1 ); - } - break; - case EInfo2: - { - ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_2 ); - } - break; - case EDeviceName: - { - ret = ShowTextStepL( R_UPNP_WIZARD_POPUP_DIALOG_3 ); - } - break; - case EInfo4: - { - ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_4 ); - } - break; - case EAccessPoint: - { - ret = ShowListStepL( R_UPNP_WIZARD_POPUP_DIALOG_5 ); - } - break; - case EInfo6: - { - ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_6 ); - } - break; - case EShareImages: - { - ret = ShowMultiselectionStepL( R_UPNP_WIZARD_HEAD_7_TEXT ); - } - break; - case EShareMusic: - { - ret = ShowMultiselectionStepL(R_UPNP_WIZARD_HEAD_8_TEXT ); - } - break; - case EInfo9: - { - if ( iSelections->HasSomethingToShare() ) - { - ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_9A ); - } - else - { - iFileEng->SetObserver( this ); - ret = ShowInfoStepL( R_UPNP_WIZARD_POPUP_DIALOG_9B ); - } - } - break; - case EStoreSettings: - { - iSelections->StoreSettingsL(); - if ( !iSharingState && iSelections->HasSomethingToShare() ) - { - __LOG("CUPnPAppWizard::StartL: \ -Staring sharing.."); - // need to wait for DialogDismissed() - iDialogDismissed = EFalse; - ShowWaitNoteL( R_UPNP_WIZARD_STARTING_FILE_SHARING_NOTE ); - DisplayInfoL( R_UPNP_WIZARD_UPDATING_CONTENT_HEADER, - R_UPNP_WIZARD_UPDATING_CONTENT_NOTE_TEXT, - R_UPNP_WIZARD_INFO_QUERY ); - } - else if ( iSharingState && !iSelections->HasSomethingToShare() ) - { - __LOG("CUPnPAppWizard::StartL: \ -Stopping sharing.."); - iFileEng->SetSharingStateL( EFalse ); - iWait.Start(); - } - - // Stores also videofiles - iSelections->ImageStoreSharedFilesL(); - - - } - break; - default : - { - __LOG("CUPnPAppWizard::StartL: default!"); - _LIT(KUser, "USER"); - User::Panic(KUser, 0); - } - break; - } - SetNextStep( ret ); - } - while ( iStep != EFinished ); - __LOG("CUPnPAppWizard::StartL end"); - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ShowListStepL -// Show the UI dialog with selection list -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::ShowListStepL( TInt aMain ) - { - __LOG("CUPnPAppWizard::ShowListStepL begin"); - TInt returnValue(KErrNone); - TInt currentSel(0); - TInt selectedIap(1); - TInt oldIap; - iSelections->GetIapId( oldIap ); - TBool sharingCheck; - RArray iapIdArr; - TInt oldIapCount(0); - - if ( !iIapNameArr ) - { - iIapNameArr = new (ELeave) CDesCArrayFlat(3); - } - - do - { - sharingCheck = ETrue;// ok to exit - currentSel = 0; - iSelections->InitializeIapArraysL( iIapNameArr, iapIdArr ); - CUPnPSettingsEngine::GetWLANAccessPointsL( iIapNameArr, iapIdArr ); - - // Set correct initial selection for ui - if ( currentSel != KUPnPCreateNewInd ) - { - iSelections->GetCurrentSelection( currentSel, iapIdArr ); - } - else - { - // ..in case user has selected "Create new" - if ( !iSharingState && - returnValue && - oldIapCount ) - { - if ( oldIapCount != iapIdArr.Count() ) - { - currentSel = iapIdArr.Count() - 1; - } - } - } - CAknListQueryDialog* dlg = new - ( ELeave ) CAknListQueryDialog( ¤tSel ); - - if ( !dlg ) - { - User::Leave( KErrNoMemory ); - } - dlg->PrepareLC( aMain ); - - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_5_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - - dlg->SetItemTextArray( iIapNameArr ); - dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); - - CListBoxView* listBoxView = dlg->ListBox()->View(); - listBoxView->SetCurrentItemIndex( currentSel ); - - returnValue = dlg->RunLD(); - - TInt c( iapIdArr.Count() ); - - if ( currentSel == KUPnPCreateNewInd ) - { - /* call to Wlan creator API */ - - __LOG("CUPnPAppWizard::ShowListStepL:\ -Create new IAP.."); - CUPnPSettingsEngine::CreateAccessPointL(); - oldIapCount = iapIdArr.Count(); - } - else if ( currentSel-1 < c ) - { - // set last iap as selected if user succesfully created new iap - selectedIap = iapIdArr[ currentSel ]; - } - if ( iSharingState && - ( selectedIap != oldIap ) && - returnValue ) - { - // show info note if sharing is on and user pressed ok - sharingCheck = EFalse; - ShowInfoNoteL( R_UPNP_WIZARD_IAP_TURN_SHARING_OFF ); - } - iapIdArr.Reset(); - iIapNameArr->Reset(); - } - while ( currentSel == KUPnPCreateNewInd || - ! sharingCheck ); - - iSelections->SetIapId( selectedIap, currentSel ); - - iapIdArr.Reset(); - __LOG("CUPnPAppWizard::ShowListStepL end"); - return returnValue; - } - -// --------------------------------------------------------- -// CUPnPAppWizard::ShowTextStepL( TInt aMain ) -// Shows popup with text and header -// --------------------------------------------------------- -// -TInt CUPnPAppWizard::ShowTextStepL( TInt aMain ) - { - __LOG("CUPnPAppWizard::ShowTextStepL"); - TInt returnValue(KErrNone); - - TBuf<64> data; - TBool sharingCheck( ETrue ); - iSelections->GetDeviceNameL( data ); - HBufC16* oldName16 = HBufC16::NewL( data.Size() ); - CleanupStack::PushL( oldName16 ); - *oldName16 = data; - - do - { - sharingCheck = ETrue; - CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( data ); - - dlg->PrepareLC( aMain ); - - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_3_TEXT ); - dlg->SetPromptL( *head ); - CleanupStack::PopAndDestroy( head ); - - returnValue = dlg->RunLD(); - - if ( iSharingState && - returnValue ) - { - TInt compRes = oldName16->CompareF( data ); - if ( compRes ) - { - // show info note if sharing is on - sharingCheck = EFalse; - ShowInfoNoteL( R_UPNP_WIZARD_IAP_TURN_SHARING_OFF ); - data = *oldName16; - } - } - } - while ( !sharingCheck ); - CleanupStack::PopAndDestroy( oldName16 ); - if ( returnValue ) - { - iSelections->SetDeviceNameL( data ); - } - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ShowInfoNoteL -// Show the information note without buttons -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::ShowInfoNoteL( TInt aMain ) const - { - __LOG("CUPnPAppWizard::ShowInfoNoteL"); - - CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue); - HBufC* noteText = CCoeEnv::Static()->AllocReadResourceLC( - aMain); - note->ExecuteLD(*noteText); - CleanupStack::PopAndDestroy(noteText); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ShowInfoStepL -// Show the information note with OK BACK buttons -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::ShowInfoStepL( TInt aMain ) const - { - __LOG("CUPnPAppWizard::ShowInfoStepL"); - TInt returnValue(KErrNone); - HBufC* messageText; - - CAknMessageQueryDialog* dlg = new (ELeave) - CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); - - dlg->PrepareLC( aMain ); - - switch( aMain ) - { - case R_UPNP_WIZARD_POPUP_DIALOG_2: - { - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_2_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - - HBufC* body = StringLoader::LoadLC( R_UPNP_WIZARD_2_TEXT ); - dlg->SetMessageTextL( *body ); - CleanupStack::PopAndDestroy( body ); - - break; - } - case R_UPNP_WIZARD_POPUP_DIALOG_5: - { - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_5_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - break; - } - case R_UPNP_WIZARD_POPUP_DIALOG_6: - { - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_6_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - - messageText = StringLoader::LoadLC( R_UPNP_WIZARD_6_2_TEXT ); - dlg->SetMessageTextL( messageText->Des() ); - CleanupStack::PopAndDestroy( ); - break; - } - case R_UPNP_WIZARD_POPUP_DIALOG_9A: - { - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_9_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - - messageText = StringLoader::LoadLC( R_UPNP_WIZARD_9A_TEXT ); - dlg->SetMessageTextL( messageText->Des() ); - CleanupStack::PopAndDestroy( ); - break; - } - case R_UPNP_WIZARD_POPUP_DIALOG_9B: - { - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_9_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - - messageText = StringLoader::LoadLC( R_UPNP_WIZARD_9B_TEXT ); - dlg->SetMessageTextL( messageText->Des() ); - CleanupStack::PopAndDestroy( ); - break; - } - default: - break; - } - - if ( iStep == EInfo4 ) - { - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_4_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - - HBufC* itemText2 = StringLoader::LoadLC( R_UPNP_WIZARD_ALWAYS_ASK_TEXT ); - HBufC* itemText1 = StringLoader::LoadLC( R_UPNP_WIZARD_4_TEXT, - *itemText2 ); - - dlg->SetMessageTextL( itemText1->Des() ); - CleanupStack::PopAndDestroy( 2 ); //itemText 1 & 2 - } - returnValue = dlg->RunLD(); - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ShowFirstStepL -// Show the first information note with OK BACK buttons and given text -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::ShowFirstStepL( TInt aMain ) const - { - __LOG("CUPnPAppWizard::ShowFirstStepL"); - TInt returnValue( KErrNone ); - - CAknMessageQueryDialog* dlg = new (ELeave) - CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); - - dlg->PrepareLC( aMain ); - HBufC* head = StringLoader::LoadLC( R_UPNP_WIZARD_HEAD_1_TEXT ); - dlg->SetHeaderTextL( *head ); - CleanupStack::PopAndDestroy( head ); - - if ( iFirstStepText->Length() ) - { - // if the text for first step is given use it insted of default - __LOG( "Setting text" ); - dlg->SetMessageTextL( *iFirstStepText ); - } - else - { - __LOG( " StringLoader::LoadLC" ); - HBufC* body = StringLoader::LoadLC(R_UPNP_WIZARD_1_TEXT); - __LOG( "SetMessageTextL" ); - dlg->SetMessageTextL( *body ); - __LOG( "PopAndDestroy" ); - CleanupStack::PopAndDestroy(); - } - returnValue = dlg->RunLD(); - - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ShowInfoStepL -// Show the multiselection popup dialog for setting content to share -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::ShowMultiselectionStepL( TInt aText ) - { - __LOG("CUPnPAppWizard::ShowMultiselectionStepL"); - - TInt returnValue(KErrNone); - - THomeConnectMediaType mediaType( EImageAndVideo ); - - CArrayFix* resArr = new (ELeave) CArrayFixFlat(5); - CleanupStack::PushL( resArr ); - - if ( iStep == EShareMusic ) - { - mediaType = EPlaylist; - } - TInt visualSharingState; - HBufC* head = StringLoader::LoadLC( aText ); - - // no ownership transfers - CUPnPMultiselectionUi* uiDlg = CUPnPMultiselectionUi:: - NewL(mediaType, - iFileEng, - visualSharingState, - resArr, - CUPnPMultiselectionUi::EPopup, - head ); - CleanupStack::PushL( uiDlg ); - - ModifyMarkedArrayL(ESetMarked,NULL,uiDlg); - - returnValue = uiDlg->ExecutePopupLD(); - - CleanupStack::PopAndDestroy( uiDlg ); - - CleanupStack::PopAndDestroy( head ); - - if ( returnValue ) - { - ModifyMarkedArrayL(EResetArray); - for( TInt i = 0 ; i < resArr->Count() ; ++i ) - { - TInt tmp = resArr->At(i); - ModifyMarkedArrayL(EAddToArray,tmp); - } - // Transfer ownership of all dynamic variables( resARr ) - iSelections->SetSharedContent( mediaType, - resArr ); - iFileEng->SetSelectionIndexesL( mediaType, *resArr ); - } - - CleanupStack::PopAndDestroy( resArr ); - return returnValue; - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ModifyMarkedArrayL -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::ModifyMarkedArrayL( TShareArrayState aArrayState - , TInt aValue - , CUPnPMultiselectionUi* aUiDlg ) - { - CArrayFix* array = NULL; - if( iStep == EShareMusic ) - { - array = iShareMusicArray; - } - else if( EShareImages == iStep ) - { - array = iShareImgAndVideoArray; - } - if( array ) - { - switch(aArrayState) - { - case ESetMarked: - { - if( aUiDlg ) - { - aUiDlg->SetMarkedItemsL( *array ); - } - break; - } - case EResetArray: - { - array->Reset(); - break; - } - case EAddToArray: - { - array->AppendL(aValue); - break; - } - default: - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::SetNextStep -// Calculates the next step in wizard -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::SetNextStep( const TInt& aSelection ) - { - __LOG("CUPnPAppWizard::SetNextStep"); - - switch ( iStep ) - { - case EInfo1: - { - if ( aSelection ) - { - iStep++; - } - else - { - iStep = EFinished; - } - } - break; - case EInfo2: - // fall through - case EDeviceName: - // fall through - case EInfo4: - // fall through - case EAccessPoint: - // fall through - case EInfo6: - // fall through - case EShareImages: - // fall through - case EShareMusic: - // fall through - case EInfo9: - // fall through - case EStoreSettings: - { - if ( aSelection ) - { - iStep++; - } - else - { - iStep--; - } - } - break; - default : - { - __LOG("CUPnPAppWizard::SetNextStep: default!"); - _LIT(KUser, "USER"); - User::Panic(KUser, 0); - } - break; - } - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ShowErrorNoteL -// Shows note with error message -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::ShowErrorNoteL( TInt aMain ) const - { - __LOG("CUPnPAppWizard::ShowErrorNoteL begin"); - - // show error note - HBufC* errorNote = StringLoader::LoadLC( aMain ); - CAknErrorNote* note = new (ELeave) CAknErrorNote(ETrue); - note->ExecuteLD(*errorNote); - CleanupStack::PopAndDestroy(); //errorNote - __LOG("CUPnPAppWizard::ShowErrorNoteL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::ShowWaitNoteL -// Shows standard wait note -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::ShowWaitNoteL( TInt aMain ) - { - __LOG("CUPnPAppWizard::ShowWaitNoteL begin"); - - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL(reinterpret_cast(waitNoteWrapper)); - waitNoteWrapper->ExecuteL( - aMain, // TInt aResId, - *this, // MAknBackgroundProcess& aBackgroundProcess - ETrue); - CleanupStack::PopAndDestroy(); - __LOG("CUPnPAppWizard::ShowWaitNoteL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::StepL -// Step done during wait note -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::StepL(void) - { - if ( iStartingSharing == ENotActive ) - { - iStartingSharing = EStartingSharing; - } - - } - - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::IsProcessDone -// Returns ETrue if process finished -// -------------------------------------------------------------------------- -// -TBool CUPnPAppWizard::IsProcessDone(void) const - { - - TBool ret(EFalse); - if ( iStartingSharing == ENotActive ) - { - TRAPD( err, iFileEng->SetSharingStateL( ETrue ) ); - if( err != KErrNone ) - { - return ETrue; - } - } - else if ( iStartingSharing == ESharingStarted ) - { - ret = ETrue; - } - else - { - __LOG( "CUPnPAppWizard::IsProcessDone: else branch"); - } - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::HandleSharingStatus -// Function informs when file sharing was enabled or disabled -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::HandleSharingStatus( - CUPnPFileSharingEngine& /*aEngine*/, - TInt aError, - TBool aPhase ) - { - __LOG("CUPnPAppWizard::HandleSharingStatus begin"); - - if ( aPhase ) - { - __LOG("CUPnPAppWizard::HandleSharingStatus:\ - activating sharing"); - iStartingSharing = ESharingStarted; - if ( aError ) - { - // If there domtree wasn't able to be written due to disk full - // situation, send leave to kernel to inform user - if( aError == KErrDiskFull || - aError == KErrNoMemory || - aError == KErrInUse ) - { - //show some critical errors using - //default symbian error notes - CActiveScheduler::Current()->Error( aError ); - } - else - { - if ( !iDialogDismissed ) - { - // must ensure that wait note is gone, see DialogDismissed - iWait.Start(); - } - TRAP_IGNORE( - ShowErrorNoteL( - R_UPNP_WIZARD_START_SHARING_ERROR_TEXT ) ); - } - } - if ( iWait.IsStarted() ) - { - if ( iWait.CanStopNow() ) - { - iWait.AsyncStop(); - } - else - { - __LOG("CUPnPAppWizard: \ -Error cant stop iWait"); - } - } - } - else - { - __LOG("CUPnPAppWizard::HandleSharingStatus:\ - deactivating sharing"); - // stop showing wait note - if ( iWait.IsStarted() ) - { - iWait.AsyncStop(); - } - } - - __LOG("CUPnPAppWizard::HandleSharingStatus end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::HandleSharingConnectionLost -// Callback to inform if connection has been lost -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::HandleSharingConnectionLost( - CUPnPFileSharingEngine& /*aEngine*/ ) - { - __LOG( "[CUPnPAppWizard]\t CUPnPAppWizard::HandleSharingConnectionLost\ - begin" ); - - iSharingState = EFalse; - - __LOG( "[CUPnPAppWizard]\t CUPnPAppWizard::HandleSharingConnectionLost\ - end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::DialogDismissedL -// Callback for dialog disappearing -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::DialogDismissedL( TInt /*aButtonId*/ ) - { - __LOG( "[CUPnPAppWizard]\t DialogDismissedL begin" ); - - iDialogDismissed = ETrue; - if ( iWait.IsStarted()) - { - iWait.AsyncStop(); - } - - __LOG( "[CUPnPAppWizard]\t DialogDismissedL end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::DisplayInfoL() -// Shows message query to user -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::DisplayInfoL( - TInt aHeaderResourceId, - TInt aMessageResourceId, - TInt aDialogResourceId ) - { - __LOG("CUPnPAppWizard::DisplayInfoL begin"); - HBufC* noteHeader = StringLoader::LoadL( - aHeaderResourceId); - CleanupStack::PushL(noteHeader); - HBufC* noteMsg = StringLoader::LoadL( - aMessageResourceId); - CleanupStack::PushL(noteMsg); - - CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*noteMsg); - - - dlg->PrepareLC(aDialogResourceId); - dlg->QueryHeading()->SetTextL(*noteHeader); - dlg->RunLD(); - - - CleanupStack::PopAndDestroy(noteMsg); - CleanupStack::PopAndDestroy(noteHeader); - __LOG("CUPnPAppWizard::DisplayInfoL end"); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppWizard::CSelectionStorage functions -// -// -------------------------------------------------------------------------- -// - -// -------------------------------------------------------------------------- -// CSelectionStorage::CSelectionStorage -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPAppWizard::CSelectionStorage::~CSelectionStorage() - { - __LOG("[UPnPAppWizard]\tCSelectionStorage::~CSelectionStorage() begin"); - delete iDeviceName; - delete iMusicSelectionArray; - delete iImageSelectionArray; - __LOG("CSelectionStorage::~CSelectionStorage() end"); - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::CSelectionStorage -// Constructor -// -------------------------------------------------------------------------- -// -CUPnPAppWizard::CSelectionStorage::CSelectionStorage( - CUPnPSettingsEngine* aSetEng, - CUPnPFileSharingEngine* aFileEng ) - { - __LOG("CSelectionStorage::CSelectionStorage() begin"); - iSetEng = aSetEng; - iFileEng = aFileEng; - __LOG("CSelectionStorage::CSelectionStorage() end"); - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::SetDeviceNameL -// Function for setting the device name to local storage -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::CSelectionStorage::SetDeviceNameL( TDes& aDeviceName ) - { - __LOG("CSelectionStorage::SetDeviceNameL begin"); - delete iDeviceName; - iDeviceName = NULL; - iDeviceName = HBufC::NewL(aDeviceName.Length()); - - *iDeviceName = aDeviceName; - __LOG("CSelectionStorage::SetDeviceNameL end"); - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::GetDeviceNameL -// Function for getting the device name from local storage or from cenrep -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::CSelectionStorage::GetDeviceNameL( TDes& aDeviceName ) - { - __LOG("CSelectionStorage::GetDeviceNameL begin"); - TInt err(0); - if ( iDeviceName ) - { - aDeviceName = iDeviceName->Des(); - } - else - { - THostName data; - TBuf8<65> deviceName8; - err = iSetEng->GetLocalFriendlyName( deviceName8 ); - - HBufC* deviceName16 = UpnpString::ToUnicodeL( deviceName8 ); - CleanupStack::PushL( deviceName16 ); - aDeviceName = deviceName16->Des(); - CleanupStack::PopAndDestroy( deviceName16 ); - } - __LOG("CSelectionStorage::GetDeviceNameL end"); - return err; - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::GetIapId -// Function for getting the iapid from local storage or from cenrep -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::CSelectionStorage::GetIapId( TInt& aIapId ) - { - __LOG("CSelectionStorage::GetIapId begin"); - TInt err( KErrNone ); - if ( iIapId ) - { - aIapId = iIapId; - } - else - { - err = iSetEng->GetAccessPoint( iIapId ); - aIapId = iIapId; - } - __LOG("CSelectionStorage::GetIapId end"); - return err; - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::SetIapId -// Function for setting the iapid to local storage -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::CSelectionStorage::SetIapId( const TInt aIapId, - const TInt aIndexForUi ) - { - __LOG("CSelectionStorage::SetIapId begin"); - - iIapId = aIapId; - iIndexForUi = aIndexForUi; - - __LOG("CSelectionStorage::SetIapId end"); - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::StoreSettingsL -// Function for storing devicename and iapid to cenrep -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::CSelectionStorage::StoreSettingsL() - { - __LOG("CSelectionStorage::StoreSettingsL begin"); - TInt err(0); - if ( iDeviceName ) - { - HBufC8* name8 = UpnpString::FromUnicodeL( iDeviceName->Des() ); - CleanupStack::PushL( name8 ); - err = iSetEng->SetLocalFriendlyName( name8->Des() ); - CleanupStack::PopAndDestroy( name8 ); - } - if ( iIapId >= EUPnPSettingsEngineIAPIdAlwaysAsk ) - { - // Stores iap id. - iSetEng->SetAccessPoint( iIapId ); - - // Stores iap selection type. - TInt iapForHomeNetworkUi( EUPnPSettingsEngineIAPItemUserDefined ); - if ( iIapId == EUPnPSettingsEngineIAPIdAlwaysAsk ) - { - iapForHomeNetworkUi = EUPnPSettingsEngineIAPItemAlwaysAsk; - } - iSetEng->SetAccessPointSetting( iapForHomeNetworkUi ); - - // index for HN ui? - iSetEng->SetWapId( iIndexForUi+1 ); - } - - __LOG("CSelectionStorage::StoreSettingsL end"); - return err; - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::ImageStoreSharedFilesL -// Function for storing image and video -// -------------------------------------------------------------------------- -// -TInt CUPnPAppWizard::CSelectionStorage::ImageStoreSharedFilesL( ) - { - /* Save Images and Videos */ - __LOG( "CSelectionStorage::Sharing image and video .." ); - if ( iFileEng ) - { - iFileEng->ShareMediaL( EImageAndVideo ); - iFileEng->ShareMediaL( EPlaylist ); - } - __LOG( "CSelectionStorage::ImageStoreSharedFilesL end" ); - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::InitializeIapArraysL -// Add default items to iap name array -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::CSelectionStorage::InitializeIapArraysL( - CDesCArray* aIapNameArr, - RArray& aIapIdArr ) const - { - __LOG("[UPnPAppWizard]\tCSelectionStorage::InitializeIapArraysL begin"); - - HBufC* itemText1 = StringLoader::LoadLC( R_UPNP_WIZARD_ALWAYS_ASK_TEXT ); - HBufC* itemText2 = StringLoader::LoadLC( R_UPNP_WIZARD_CREATE_NEW_TEXT ); - - aIapNameArr->AppendL( itemText1->Des() ); - aIapIdArr.AppendL( EUPnPSettingsEngineIAPIdAlwaysAsk ); - aIapNameArr->AppendL( itemText2->Des() ); - aIapIdArr.AppendL( EUPnPSettingsEngineIAPIdCreateNew ); - - //aIapNameArr does not own the items - CleanupStack::PopAndDestroy(2); - - __LOG("[UPnPAppWizard]\tCSelectionStorage::InitializeIapArraysL end"); - } - -// ------------------------------------------------------------- -// CSelectionStorage::SetSharedContent() -// Sets the users sharing selections to local storage -// ------------------------------------------------------------- -// -void CUPnPAppWizard::CSelectionStorage::SetSharedContent( - THomeConnectMediaType aMedia, - CArrayFix* aSelections ) - { - __LOG("CSelectionStorage::SetSharedContent begin"); - - if ( aMedia == EImageAndVideo ) - { - // determine the users selections from UI - // if there is only one item selected and its value is not 0 - // -> Share all is selected - if ( ! (aSelections->Count() == 1 && aSelections->At(0) == 0 ) ) - { - iVisualImageSelection = ETrue; - } - } - else - { - - if ( ! (aSelections->Count() == 1 && aSelections->At(0) == 0 ) ) - { - // no difference between EShareAll and EShareMany - iVisualMusicSelection = ETrue; - } - - } - - __LOG("CSelectionStorage::SetSharedContent end"); - } - - -// ------------------------------------------------------------- -// CSelectionStorage::SetSharedContent() -// Gets the users sharing selections from local storage -// ------------------------------------------------------------- -// -void CUPnPAppWizard::CSelectionStorage::GetSelectionsL( - THomeConnectMediaType aMedia, - CArrayFix* aSelections ) - { - __LOG("CSelectionStorage::GetSelectionsL begin"); - - if ( aMedia == EImageAndVideo ) - { - if ( iImageSelectionArray ) - { - for ( TInt i = 0; i < iImageSelectionArray->Count(); i++ ) - { - TInt tmp = iImageSelectionArray->At( i ); - aSelections->AppendL( tmp ); - } - } - } - else - { - if ( iMusicSelectionArray ) - { - for ( TInt i = 0; i < iMusicSelectionArray->Count(); i++ ) - { - TInt tmp = iMusicSelectionArray->At( i ); - aSelections->AppendL( tmp ); - } - } - } - __LOG("CSelectionStorage::GetSelectionsL end"); - } - -// ------------------------------------------------------------- -// CSelectionStorage::HasSomethingToShare() -// Determines if the user has selected content to share -// ------------------------------------------------------------- -// -TBool CUPnPAppWizard::CSelectionStorage::HasSomethingToShare() const - { - __LOG("CSelectionStorage::HasSomethingToShare begin"); - TBool retVal( EFalse ); - if ( iVisualImageSelection || iVisualMusicSelection ) - { - retVal = ETrue; - } - __LOG("CSelectionStorage::HasSomethingToShare end"); - return retVal; - } - -// -------------------------------------------------------------------------- -// CSelectionStorage::GetCurrentSelection -// Gets the user selected iapid or iapid from cenrep -// -------------------------------------------------------------------------- -// -void CUPnPAppWizard::CSelectionStorage::GetCurrentSelection( - TInt& aCurrentSelection, RArray& aIapIdArr ) - { - __LOG("CSelectionStorage::GetCurrentSelection begin"); - // Get the current selection - TInt userIapId( 0 ); - GetIapId( userIapId ); - - if ( userIapId < 1 || - userIapId == aIapIdArr[ KUPnPAlwaysAskInd ] ) - { - aCurrentSelection = 0; - } - else - { - aCurrentSelection = aIapIdArr.Find( userIapId ); - - if ( aCurrentSelection <= KUPnPCreateNewInd ) - { - /* Current iap is not in the list or it is Always Ask */ - aCurrentSelection = 0; - } - } - __LOG("CSelectionStorage::GetCurrentSelection end"); - } - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/BWINS/UPnPMultiselectionUiU.DEF --- a/upnpsettings/multiselectionui/BWINS/UPnPMultiselectionUiU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ?ExecuteDlgLD@CUPnPMultiselectionUi@@QAEHXZ @ 1 NONAME ; int CUPnPMultiselectionUi::ExecuteDlgLD(void) - ?ExecutePopupLD@CUPnPMultiselectionUi@@QAEHXZ @ 2 NONAME ; int CUPnPMultiselectionUi::ExecutePopupLD(void) - ?NewL@CUPnPMultiselectionUi@@SAPAV1@W4THomeConnectMediaType@@PAVCUPnPFileSharingEngine@@AAHPAV?$CArrayFix@H@@W4TUiStyle@1@PBVHBufC16@@@Z @ 3 NONAME ; class CUPnPMultiselectionUi * CUPnPMultiselectionUi::NewL(enum THomeConnectMediaType, class CUPnPFileSharingEngine *, int &, class CArrayFix *, enum CUPnPMultiselectionUi::TUiStyle, class HBufC16 const *) - ?SetMarkedItemsL@CUPnPMultiselectionUi@@QAEXAAV?$CArrayFix@H@@@Z @ 4 NONAME ; void CUPnPMultiselectionUi::SetMarkedItemsL(class CArrayFix &) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/EABI/UPnPMultiselectionUiU.DEF --- a/upnpsettings/multiselectionui/EABI/UPnPMultiselectionUiU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -EXPORTS - _ZN21CUPnPMultiselectionUi12ExecuteDlgLDEv @ 1 NONAME - _ZN21CUPnPMultiselectionUi14ExecutePopupLDEv @ 2 NONAME - _ZN21CUPnPMultiselectionUi15SetMarkedItemsLER9CArrayFixIiE @ 3 NONAME - _ZN21CUPnPMultiselectionUi4NewLE21THomeConnectMediaTypeP22CUPnPFileSharingEngineRiP9CArrayFixIiENS_8TUiStyleEPK7HBufC16 @ 4 NONAME - _ZTI21CUPnPMultiselectionUi @ 5 NONAME ; ## - _ZTV21CUPnPMultiselectionUi @ 6 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/data/cupnpmultiselectionui.rss --- a/upnpsettings/multiselectionui/data/cupnpmultiselectionui.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: multiselectionui resource description -* -*/ - - - - - - - -// RESOURCE IDENTIFIER -NAME VORO // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cupnpmultiselectionui.hrh" - -// RESOURCE DEFINITIONS - -// -------------------------------------------------------------------------- -// RSS_SIGNATURE -// -------------------------------------------------------------------------- -RESOURCE RSS_SIGNATURE - { - } - -// -------------------------------------------------------------------------- -// TBUF -// -------------------------------------------------------------------------- -RESOURCE TBUF - { - buf = ""; - } - -//---------------------------------------------------------------------------- -// -// r_upnp_softkeys_ok_back__ok -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_upnp_softkeys_ok_back__ok - { - flags = 0; - buttons = - { - CBA_BUTTON {id = EAknSoftkeyOk; txt = qtn_iupnp_softkey_next;}, - CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, - CBA_BUTTON {id = EAknSoftkeyForwardKeyEvent;} - }; - } - -//---------------------------------------------------------------------------- -// -// r_upnp_softkeys_ok_back__ok_dialog -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_upnp_softkeys_ok_back__ok_dialog - { - flags = 0; - buttons = - { - CBA_BUTTON {id = EAknSoftkeyOk; txt = text_softkey_ok;}, - CBA_BUTTON {id = EAknSoftkeyBack; txt = text_softkey_back;}, - CBA_BUTTON {id = EAknSoftkeySelect;} - }; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_dialog -// -//--------------------------------------------------------------------------- -RESOURCE DIALOG r_upnp_multiselection_dialog - { - flags = EAknDialogMultiselectionList; - buttons = r_upnp_softkeys_ok_back__ok_dialog; - items = - { - DLG_LINE - { - type = EAknCtSingleGraphicListBox; - id = EMultiSelectionListBoxId; - control = LISTBOX - { - flags = EAknListBoxMultiselectionList; - }; - }, - DLG_LINE - { - itemflags = EEikDlgItemNonFocusing; - id = EFindControl; - type = EAknCtSelectionListPopupFind; - } - }; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_popup -// -//--------------------------------------------------------------------------- -RESOURCE AVKON_MULTISELECTION_LIST_QUERY r_upnp_multiselection_popup - { - flags = EGeneralQueryFlags; - softkeys = r_upnp_softkeys_ok_back__ok; - items = - { - AVKON_MULTISELECTION_LIST_QUERY_DLG_LINE - { - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSingleGraphicPopupMenuListBox; - listbox = AVKON_MULTISELECTION_LIST_QUERY_LIST - { - }; - heading = "Select items:"; - }; - }, - DLG_LINE - { - itemflags = EEikDlgItemNonFocusing; - id = EFindControl; - type = EAknCtListQuerySearchControl; - } - }; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_collecting_files_note -// -//--------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnp_multiselection_collecting_files_note - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_iupnp_saving_changes_note; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_searching_files_note -// -//--------------------------------------------------------------------------- -// -RESOURCE DIALOG r_upnp_multiselection_searching_files_note - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_iupnp_searching_files_note; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_sharing_visual_title_text -// -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_multiselection_sharing_visual_title_text - { - buf = qtn_iupnp_title_visual; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_sharing_music_title_text -// -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_multiselection_sharing_music_title_text - { - buf = qtn_iupnp_title_music; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_share_all_text -// -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_multiselection_share_all_text - { - buf = qtn_iupnp_set_share_all; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_do_not_share_text -// -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_multiselection_do_not_share_text - { - buf = qtn_iupnp_set_do_not_share; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_select_text -// -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_multiselection_select_text - { - buf = qtn_msk_select; - } - -//--------------------------------------------------------------------------- -// -// r_upnp_multiselection_unselect_text -// -//--------------------------------------------------------------------------- -// -RESOURCE TBUF r_upnp_multiselection_unselect_text - { - buf = qtn_iupnp_msk_unselect; - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/group/bld.inf --- a/upnpsettings/multiselectionui/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2005-2007 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 information file for multiselection UI component -* -*/ - - - - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// ADO internal interfaces -../inc/cupnpmultiselectionui.h |../../../inc/cupnpmultiselectionui.h - -PRJ_MMPFILES -cupnpmultiselectionui.mmp - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/group/cupnpmultiselectionui.mmp --- a/upnpsettings/multiselectionui/group/cupnpmultiselectionui.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2005-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: multiselectionui project definition file -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" -#include - -TARGET upnpmultiselectionui.dll -TARGETTYPE dll -UID 0x100000D8 0x200009E8 - -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -// SIS installation + IAD support -VERSION 10.1 -paged - -// Include paths -MW_LAYER_SYSTEMINCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -START RESOURCE ../data/cupnpmultiselectionui.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -SOURCEPATH ../src - -SOURCE upnpmultiselectionutility.cpp -SOURCE cupnpmultiselectionui.cpp -SOURCE upnpappmultiselectiondialog.cpp -SOURCE upnpappmultiselectionpopup.cpp - -LIBRARY AknIcon.lib -LIBRARY aknlayout.lib -LIBRARY AknLayout2Scalable.lib -LIBRARY AKNSKINS.lib -LIBRARY apparc.lib -LIBRARY avkon.lib -LIBRARY charconv.lib -LIBRARY CommonEngine.lib -LIBRARY cone.lib -LIBRARY efsrv.lib -LIBRARY egul.lib -LIBRARY eikcoctl.lib -LIBRARY eikcore.lib -LIBRARY eikctl.lib -LIBRARY eikdlg.lib -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY featmgr.lib -LIBRARY gdi.lib -LIBRARY hlplch.lib -LIBRARY ws32.lib - -// ecom -LIBRARY ecom.lib - -// string.h -LIBRARY upnpipserversutils.lib - -// rpointerarray tdesc16 -LIBRARY bafl.lib - -// esock -LIBRARY esock.lib - -// filesharingengine -LIBRARY upnpapplicationengine.lib - -// pathinfo:: -LIBRARY PlatformEnv.lib - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/inc/cupnpmultiselectionui.h --- a/upnpsettings/multiselectionui/inc/cupnpmultiselectionui.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +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: Multiselection UI class definition -* -*/ - - - - - - - -#ifndef CUPNPMULTISELECTIONUI -#define CUPNPMULTISELECTIONUI - -// INCLUDES -#include -#include "upnpfilesharingengine.h" // included to know THomeConnectMediaType -#include // for CListBoxView::CSelectionIndexArray -// CONSTANTS - -// FORWARD DECLARATIONS -class CAknViewAppUi; -class CEikonEnv; -class CUPnPAppMultiselectionDialog; -class CUPnPAppMultiselectionPopup; - - -// CLASS DECLARATION - -/** - * CUPnPMultiselectionUi class - * - * UI for showing the filesharing window either in popup or dialog style - * - * @lib upnpmultiselectionui.lib - */ -class CUPnPMultiselectionUi : public CBase - { - -public: // Constructors and destructor - - enum TUiStyle - { - EDialog, - EPopup - }; - - /** - * Two-phased constructor. - * @since S60 3.1 - * @param aMediaType. Media type for UI. Either Images&videos or music. - * @param aFileSharingEngine. Pointer to filesharingengine. - * @param aAlbumContainer. Container for the items user has selected. - * @param aVisualSharingState. State of the sharing for the home. - * network UI - * @param aSelectionIndexArray. Array for initial selection. - * @param aUiStyle. Describes if popup or dialog style ui is used. - */ - IMPORT_C static CUPnPMultiselectionUi* NewL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - TInt& aVisualSharingState, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray = NULL, - TUiStyle aUiStyle = EDialog, - const HBufC* aHeading = NULL - ); - - /** - * Sets marked items to popup dialog - * - * @param aMarkedItems - */ - IMPORT_C void SetMarkedItemsL( CArrayFix& aMarkedItems ); - - /** - * Destructor. - */ - virtual ~CUPnPMultiselectionUi(); - -public: - - /** - * Executes the file sharing UI as a dialog style - * - * @since S60 3.1 - * @return TInt, Error code - */ - IMPORT_C TInt ExecuteDlgLD(); - - /** - * Executes the file sharing UI as a popup style - * - * @since S60 3.1 - * @return TInt, Error code - */ - IMPORT_C TInt ExecutePopupLD(); - -private: - - /** - * C++ default constructor - */ - CUPnPMultiselectionUi(); - - - /** - * Symbian default constructor. - */ - void ConstructL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - TInt& aVisualSharingState, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - TUiStyle aStyle, - const HBufC* aHeading - ); - - -private: // Data - /** - * Resource file offse - */ - TInt iResFileOffset; // Resource file offset - /** - * Pointer to CEikonEnv - */ - CEikonEnv* iCoeEnv; - /** - * Pointer to multiselection dialog - */ - CUPnPAppMultiselectionDialog* iDlg; - /** - * Pointer to multiselection dialog - */ - CUPnPAppMultiselectionPopup* iPopup; - - /** - * Flag the FeatureManager is initialized or not - */ - TBool iFeatureManagerInitialized; - }; - -#endif // CUPNPMULTISELECTIONUI - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/inc/cupnpmultiselectionui.hrh --- a/upnpsettings/multiselectionui/inc/cupnpmultiselectionui.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +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: Resource headers for project Multiselection UI -* -*/ - - - - - - - -#ifndef MULTISELECTIONUI_HRH -#define MULTISELECTIONUI_HRH - - -// DATA TYPES -enum TMultiSelectionUiCommandIds - { - EHomeConnectCmdAppChange = 1 - }; - - - -enum TMultiSelectionUiFileSharingDlgItems - { - EVisibilitySettingItem = 0, - EVisualAlbumsSettingItem, - EPlaylistSettingItem - }; - -enum TMultiSelectionUiDlgLineIds - { - EListBoxId = 1, - ESettingsListBoxId, - EFileSharingListBoxId - }; - -enum TMultiSelectionUiDlgLineId - { - EMultiSelectionListBoxId = 1 - }; - -enum TMultiSelectionUiCbaButtons - { - EAknSoftkeyContinue = 1 - }; - -#endif // MULTISELECTIONUI - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/inc/upnpappmultiselectiondialog.h --- a/upnpsettings/multiselectionui/inc/upnpappmultiselectiondialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +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: CUPnPAppMultiselectionDialog class definition -* -*/ - - - - - - -#ifndef UPNPAPPMULTISELECTIONDIALOG_H -#define UPNPAPPMULTISELECTIONDIALOG_H - -// INCLUDES -#include -#include -#include -#include -#include //for status pane -#include -#include - -#include "upnpfilesharingengine.h" // included to know THomeConnectMediaType -#include "upnpmultiselectionutility.h" - - - -// FORWARD DECLARATIONS -class CAknColumnListBox; - -// CLASS DECLARATION - -/** -* CUPnPAppMultiselectionDialog dialog class -* @since S60 3.1 -*/ -NONSHARABLE_CLASS( CUPnPAppMultiselectionDialog ) : - public CAknSelectionListDialog, - MAknBackgroundProcess - { - public: // Constructors and destructor - /** - * Two-phased constructor. - * @since S60 3.1 - * @param aMediaType. Media type for UI. Either Images Or videos or \ -music. - * @param aFileSharingEngine. Pointer to filesharingengine. - * @param aSelectionIndexArray. Array for initial selection. - */ - static CUPnPAppMultiselectionDialog* NewL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CArrayFix* aSelectionIndexArray ); - - /** - * Destructor. - */ - virtual ~CUPnPAppMultiselectionDialog(); - - - protected: // New functions - void ConstructL(THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CArrayFix* aSelectionIndexArray ); - - protected: // Functions from base classes - /** - * From MAknBackgroundProcess, handles backround processing - * @since S60 3.1 - */ - virtual void StepL(); - - /** - * From MAknBackgroundProcess, handles backround processing - * @since S60 3.1 - * @return TBool, ETrue when the process is done - */ - virtual TBool IsProcessDone() const; - - /** - * From CAknSelectionListDialog, handles layout initialization - * @since S60 3.1 - */ - void PreLayoutDynInitL(); - - /** - * From CAknSelectionListDialog, handles initialization - * that doesn't affect layout - * @since S60 3.1 - */ - void PostLayoutDynInitL(); - - /** - * From CAknSelectionListDialog, handles key events. - * @since S60 3.1 - * @param TKeyEvent, Event to handled. - * @param TEventCode, Type of the key event. - * @return TKeyResponse, response code - * (EKeyWasConsumed, EKeyWasNotConsumed). - */ - TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, - TEventCode aType); - - /** - * From CAknSelectionListDialog, handles focus changes of the dialog - * @since S60 3.1 - * @param TInt, pressed button id - * @return TBool, ETrue if ready to close dialog, EFalse otherwise - */ - TBool OkToExitL( TInt aButtonId ); - - - private: - /** - * C++ default constructor. - */ - CUPnPAppMultiselectionDialog(); - - private: //data - // dialog control item - CAknColumnListBox* iListBox; // not owned - // Mediatype selected from listbox - THomeConnectMediaType iMediaType; - // File sharing engine member - CUPnPFileSharingEngine* iFileSharingEngine; //not owned - // title pane - CAknTitlePane* iTitlePane; - // selected item - needed for creation of CAknSelectionListDialog - TInt iSelectedItem; - - CAknWaitNoteWrapper* iWaitNoteWrapper; - // array of marked (shared) items. - CArrayFix* iMarkedItems; //not owned - - CUpnpMultiselectionUtility* iUtility; //owned - - CAknFilteredTextListBoxModel* iModel; //not owned - - CDesCArray* iSettingsTextArray; //not owned - - // Variable to transfer information about wait note end - TBool iDone; - - /** - * Msk's label. (Owned) - */ - HBufC* iMskSelectText; - - /** - * Msk's label. (Owned) - */ - HBufC* iMskUnselectText; - - /** - * Internal state - */ - enum TState - { - ELoadNone = 0, - ELoadContent, - ELoadIndexes, - ELoadDone - }; - TState iState; - }; - -#endif // UPNPAPPMULTISELECTIONDIALOG_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/inc/upnpappmultiselectionpopup.h --- a/upnpsettings/multiselectionui/inc/upnpappmultiselectionpopup.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +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: CUPnPAppMultiselectionPopup class definition -* -*/ - - - - - - -#ifndef UPNPAPPMULTISELECTIONPOPUP_H -#define UPNPAPPMULTISELECTIONPOPUP_H - -// INCLUDES -#include -#include -#include -#include -#include //for status pane -#include -#include -#include //caknlistquerydialog -#include //caknsearchfield - -#include "upnpfilesharingengine.h" // included to know THomeConnectMediaType -#include "upnpmultiselectionutility.h" - - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; - -// CLASS DECLARATION - -/** - * CUPnPAppMultiselectionPopup dialog class - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUPnPAppMultiselectionPopup ) : public CAknListQueryDialog, - MAknBackgroundProcess - { -public: // Constructors and destructor - /** - * Two-phased constructor. - * @since S60 3.1 - * @param aMediaType. Media type for UI. Either Images Or videos or \ -music. - * @param aFileSharingEngine. Pointer to filesharingengine. - * @param aSelectionIndexArray. Array for initial selection. - */ - static CUPnPAppMultiselectionPopup* NewL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const HBufC* aHeading); - - /** - * stores marked items to iUiMarked - * - * @param aMarkedItems - */ - void SetMarkedItemsL(CArrayFix& aMarkedItems); - - /** - * Destructor. - */ - virtual ~CUPnPAppMultiselectionPopup(); - - -protected: - - // New functions - void ConstructL(THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray); - - - -protected: // Functions from base classes - /** - * From MAknBackgroundProcess, handles backround processing - * @since S60 3.1 - */ - virtual void StepL (); - - /** - * From MAknBackgroundProcess, handles backround processing - * @since S60 3.1 - * @return TBool, ETrue when the process is done - */ - virtual TBool IsProcessDone () const; - - /** - * From CAknSelectionListDialog, handles layout initialization - * @since S60 3.1 - */ - void PreLayoutDynInitL(); - - /** - * From CAknSelectionListDialog, handles initialization - * that doesn't affect layout - * @since S60 3.1 - */ - void PostLayoutDynInitL (); - - /** - * From CAknSelectionListDialog, handles key events. - * @since S60 3.1 - * @param TKeyEvent, Event to handled. - * @param TEventCode, Type of the key event. - * @return TKeyResponse, response code - * (EKeyWasConsumed, EKeyWasNotConsumed). - */ - TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, - TEventCode aType); - /** - * From CAknSelectionListDialog, handles focus changes of the dialog - * @since S60 3.1 - * @param TInt, pressed button id - * @return TBool, ETrue if ready to close dialog, EFalse otherwise - */ - TBool OkToExitL( TInt aButtonId ); - - -private: - /** - * C++ default constructor. - */ - CUPnPAppMultiselectionPopup( - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const HBufC* aHeading ); - -private: //data - // dialog control item - - CEikListBox* iListBox; //not owned - - CAknFilteredTextListBoxModel* iModel; //not owned - - - - // Mediatype selected from listbox - THomeConnectMediaType iMediaType; - // File sharing engine member - CUPnPFileSharingEngine* iFileSharingEngine; //not owned - // Share all selection - TInt* iShareAllSelection; - // selected album indexes - CArrayFixFlat* iSelectedAlbums; - // title pane - CAknTitlePane* iTitlePane; - // selected item - needed for creation of CAknSelectionListDialog - TInt iSelectedItem; - // array for playlists - CDesCArrayFlat* iFileArray; - // wait note - CAknWaitNoteWrapper* iWaitNoteWrapper; - // array of marked (shared) items. - CArrayFix* iMarkedItems; - // If this is not NULL it is used instead of "normal" calculation of - // selections - CArrayFix* iPreviousSelection; - - // get marked items from appwizard - CArrayFix* iUiMarked; - - // The pointer to multiselectiondialog - CUpnpMultiselectionUtility* iUtility; - - CDesCArray* iSettingsTextArray; //not owned - - // Variable to transfer information about wait note end - TBool iDone; - - /** - * Msk's label. (Owned) - */ - HBufC* iMskSelectText; - - /** - * Msk's label. (Owned) - */ - HBufC* iMskUnselectText; - - /** - * Internal state - */ - enum TState - { - ELoadNone = 0, - ELoadContent, - ELoadIndexes, - ELoadDone - }; - TState iState; - - // Heading text - const HBufC* iHeading; //not owned - }; -#endif - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/inc/upnpmultiselectionutility.h --- a/upnpsettings/multiselectionui/inc/upnpmultiselectionutility.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +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: CUpnpMultiselectionUtility class definition - * -*/ - - - - - - -#ifndef UPNPMULTISELECTIONUTILITY_H -#define UPNPMULTISELECTIONUTILITY_H - -// INCLUDES -#include -#include -#include -#include -#include //for status pane -#include -#include //cakncolumnlistbox -#include -#include - -// FORWARD DECLARATIONS -// NONE - -// CLASS DECLARATION -enum TShareSelectionState - { - EUndefined = 0, - EItemsSelected, - EShareNoneSelected, - EShareAllSelected, - EShareNoneAndShareAllSelected, - ENoShareNoneOrShareAllSelected - }; -/** - * CUpnpMultiselectionUtility utility class - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUpnpMultiselectionUtility ): public CBase - { -public: // Constructors and destructor - - /** - * Destructor. - */ - virtual ~CUpnpMultiselectionUtility(); - - /** - * C++ default constructor. - */ - CUpnpMultiselectionUtility(); - - /** - * Collect selected items to a listbox - * @since S60 3.1 - */ - void CollectSelectedItemsL( CEikListBox* aListBox, - TBool aFirstRun = EFalse ); - - /** - * Do internal decisions based on user's selections on the UI - */ - void DoSelectionLogicL( CEikListBox* aListBox, - TBool aFirstRun, - const CArrayFix* aIndexes, - CAknListBoxFilterItems* aFilter, - TShareSelectionState aSelectionState ); - - /** - * Loads a possibly skinned icon and adds it to icon array - * @since S60 3.1 - * @param CAknIconArray, array of icons - * @param MAknsSkinInstance, skin instance - * @param TDesC, reference to icon file - * @param TAknsItemID, skinned icon id - * @param TInt, bitmap id - * @param TInt, bitmap mask id - */ - void AppendIconToArrayL( CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId ) const; - - /** - * Appends first item ("share all files") to the listbox - * @since S60 3.1 - * @param CDesCArray, listbox array - */ - void AppendShareAllSelectionL( CDesCArray* aListBoxArray ) const; - - /** - * Convert selections from UI to engine as "old style" selections - * Effect only in case Share All is selected - * @since S60 3.1 - * @param CArrayFix& The selection indexes to modify - */ - void ConvertSelectionsForEngineL( CArrayFix& aSelections ) const; - - /** - * Sets iShareNoneSelected and iShareAllSelected member variables. - * @since S60 3.1 - * @param TShareSelectionState share all and do not share selection state - */ - void SetShareSelectionState( TShareSelectionState aSelectionState ); - - /** - * Returns ShareSelectionState from the array. - * @since S60 3.1 - * @param const CArrayFix& array of selection indexes. - */ - TShareSelectionState ShareSelectionStateFromArray( - const CArrayFix& aIndexes ) const; - -private: - TBool iShareNoneSelected; - TBool iShareAllSelected; - }; - -#endif //UPNPMULTISELECTIONUTILITY_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/src/cupnpmultiselectionui.cpp --- a/upnpsettings/multiselectionui/src/cupnpmultiselectionui.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +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: Multiselection UI implementation -* -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include //caknmessagequerydialog -#include //caknlistquerydialog -#include //rsocketserv - -#include "upnpfilesharingengine.h" - -#include "upnpappmultiselectiondialog.h" -#include "upnpappmultiselectionpopup.h" -#include -#include "cupnpmultiselectionui.h" - -_LIT( KComponentLogfile, "multiselectionui.txt"); -#include "upnplog.h" - - -// Filename of rsc file -_LIT( KUPnPMultiSelectionRscFile, "\\resource\\CUPnPMultiselectionUi.rsc" ); - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPMultiselectionUi::CUPnPMultiselectionUi -// -------------------------------------------------------------------------- -// -CUPnPMultiselectionUi::CUPnPMultiselectionUi() - { - __LOG("CUPnPMultiselectionUi::CUPnPMultiselectionUi"); - iFeatureManagerInitialized = EFalse; - } - -// -------------------------------------------------------------------------- -// CUPnPMultiselectionUi::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPMultiselectionUi::ConstructL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - TInt& /*aVisualSharingState*/, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - TUiStyle aStyle, - const HBufC* aHeading ) - { - __LOG("CUPnPMultiselectionUi::ConstructL"); - - iCoeEnv = CEikonEnv::Static(); - RFs& fileSession = iCoeEnv->FsSession(); - - - // Load common ui resource file - TFileName rscFileName( KUPnPMultiSelectionRscFile ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - rscFileName.Insert( 0, drive ); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - // Check if the resource file exists or not - if ( !BaflUtils::FileExists( fileSession, rscFileName ) ) - { - User::Leave( KErrNotFound ); - } - iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ); - - FeatureManager::InitializeLibL(); - iFeatureManagerInitialized = ETrue; - - if ( aStyle == EDialog ) - { - - iDlg = CUPnPAppMultiselectionDialog::NewL( aMediaType, - aFileSharingEngine, - aSelectionIndexArray ); - } - else - { - iPopup = CUPnPAppMultiselectionPopup::NewL( aMediaType, - aFileSharingEngine, - aSelectionIndexArray, - aHeading ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPMultiselectionUi::NewL() -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPMultiselectionUi* CUPnPMultiselectionUi::NewL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - TInt& aVisualSharingState, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - TUiStyle aStyle, - const HBufC* aHeading ) - { - __LOG("CUPnPMultiselectionUi::NewL begin"); - - CUPnPMultiselectionUi* self = new ( ELeave) CUPnPMultiselectionUi(); - CleanupStack::PushL( self ); - - self->ConstructL( aMediaType, - aFileSharingEngine, - aVisualSharingState, - aSelectionIndexArray, - aStyle, - aHeading ); - - CleanupStack::Pop(); - __LOG("CUPnPMultiselectionUi::NewL end"); - return self; - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPMultiselectionUi::~CUPnPMultiselectionUi() - { - __LOG("CUPnPMultiselectionUi::~CUPnPMultiselectionUi begin"); - - if ( iFeatureManagerInitialized ) - { - FeatureManager::UnInitializeLib(); - } - - // Un-Load resource file - if ( iResFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResFileOffset ); - iResFileOffset = 0; - } - - __LOG("CUPnPMultiselectionUi::~CUPnPMultiselectionUi end"); - } - -// -------------------------------------------------------------------------- -// CUPnPMultiselectionUi::ExecuteDlgLD -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CUPnPMultiselectionUi::ExecuteDlgLD() - { - __LOG("CUPnPMultiselectionUi::ExecuteDlgLD"); - - TInt ret(KErrNone); - ret = iDlg->ExecuteLD( R_UPNP_MULTISELECTION_DIALOG ); - iDlg = NULL; - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPMultiselectionUi::ExecutePopupLD -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CUPnPMultiselectionUi::ExecutePopupLD() - { - __LOG("CUPnPMultiselectionUi::ExecutePopupLD"); - - TInt ret(KErrNone); - ret = iPopup->ExecuteLD( R_UPNP_MULTISELECTION_POPUP ); - iPopup = NULL; - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPMultiselectionUi::SetMarkedItems -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPMultiselectionUi::SetMarkedItemsL( CArrayFix& - aMarkedItems ) - { - if( iPopup ) - { - iPopup->SetMarkedItemsL(aMarkedItems); - } - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/src/upnpappmultiselectiondialog.cpp --- a/upnpsettings/multiselectionui/src/upnpappmultiselectiondialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,466 +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: Multiselection dialog implementation -* -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include "upnpappmultiselectiondialog.h" -#include "upnpfilesharingengine.h" - -#include "cupnpmultiselectionui.hrh" -#include - -_LIT( KComponentLogfile, "multiselectionui.txt"); -#include "upnplog.h" - - -//CONSTANTS -const TInt KOkSoftkeyCode = 63585; - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPAppMultiselectionDialog* CUPnPAppMultiselectionDialog::NewL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CArrayFix* aSelectionIndexArray ) - { - __LOG("CUPnPAppMultiselectionDialog::NewL begin"); - - CUPnPAppMultiselectionDialog* self = - new(ELeave) CUPnPAppMultiselectionDialog(); - - CleanupStack::PushL(self); - self->ConstructL( aMediaType, aFileSharingEngine, aSelectionIndexArray ); - CleanupStack::Pop(self); - __LOG("CUPnPAppMultiselectionDialog::NewL end"); - return self; - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionDialog::ConstructL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CArrayFix* aSelectionIndexArray ) - { - __LOG("CUPnPAppMultiselectionDialog::ConstructL begin"); - CAknSelectionListDialog::ConstructL( R_AVKON_SOFTKEYS_EMPTY ); - iMediaType = aMediaType; - iFileSharingEngine = aFileSharingEngine; - - iMarkedItems = aSelectionIndexArray; - iUtility = new (ELeave) CUpnpMultiselectionUtility(); - - iMskSelectText = - StringLoader::LoadL( R_UPNP_MULTISELECTION_SELECT_TEXT ); - iMskUnselectText = - StringLoader::LoadL( R_UPNP_MULTISELECTION_UNSELECT_TEXT ); - - __LOG("CUPnPAppMultiselectionDialog::ConstructL end"); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog() -: CAknSelectionListDialog(iSelectedItem, NULL, NULL), iSelectedItem(0) - { - __LOG("CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::CUPnPAppMultiselectionDialog -// C++ default destructor. -// -------------------------------------------------------------------------- -// -CUPnPAppMultiselectionDialog::~CUPnPAppMultiselectionDialog() - { - __LOG("CUPnPAppMultiselectionDialog::~CUPnPAppMultiselectionDialog"); - - iFileSharingEngine = NULL; - - delete iUtility; - delete iMskSelectText; - delete iMskUnselectText; - - __LOG("CUPnPAppMultiselectionDialog::~CUPnPAppMultiselectionDialog end"); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::OkToExitL(TInt aButtonId) -// called by framework when the softkey is pressed -// -------------------------------------------------------------------------- -// -TBool CUPnPAppMultiselectionDialog::OkToExitL(TInt aButtonId) - { - __LOG("CUPnPAppMultiselectionDialog::OkToExitL begin"); - TBool ret( EFalse ); - if ( aButtonId == EAknSoftkeyOk ) - { - TBool showWaitNote( ETrue ); - - const CArrayFix* selected; - - //get the true indexes of marked items - CAknListBoxFilterItems* filter - = static_cast < CAknFilteredTextListBoxModel* > - ( iListBox->Model() )->Filter(); - if ( filter ) - { - // Filter knows all. - filter->UpdateSelectionIndexesL(); - selected = filter->SelectionIndexes(); - } - else - { - // No filter. - selected = ListBox()->View()->SelectionIndexes(); - } - - // Show wait note if needed. - CAknWaitNoteWrapper* waitNoteWrapper( NULL ); - if ( selected->Count() == 1 && selected->At( 0 ) == 0 ) - { - showWaitNote = EFalse; - } - if ( showWaitNote ) - { - waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL(reinterpret_cast(waitNoteWrapper)); - waitNoteWrapper->ExecuteL( - R_UPNP_MULTISELECTION_COLLECTING_FILES_NOTE, // TInt aResId, - *this, // MAknBackgroundProcess& aBackgroundProcess - ETrue); - } - - // give the selection indexes to filesharing engine - iMarkedItems->Reset(); - for( TInt i(0); iCount(); i++ ) - { - iMarkedItems->AppendL( selected->At( i ) ); - } - iUtility->ConvertSelectionsForEngineL( *iMarkedItems ); - - if ( showWaitNote ) - { - CleanupStack::PopAndDestroy(waitNoteWrapper); - } - ret = ETrue; - } - - else if ( aButtonId == EAknSoftkeySelect ) - { - // msk event - __LOG("CUPnPAppMultiselectionDialog::msk event"); - TKeyEvent tmpEvent; - tmpEvent.iCode = EKeyOK; - tmpEvent.iModifiers = 0; - tmpEvent.iRepeats = 0; - tmpEvent.iScanCode = 0; - TEventCode eventType = EEventKey; - OfferKeyEventL( tmpEvent, eventType ); - - } - else if ( aButtonId == EAknSoftkeyBack ) - { - ret = ETrue; - } - - __LOG("CUPnPAppMultiselectionDialog::OkToExitL end"); - return ret; - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::PreLayoutDynInitL(); -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionDialog::PreLayoutDynInitL() - { - __LOG("CUPnPAppMultiselectionDialog::PreLayoutDynInitL begin"); - - iListBox = static_cast - (Control(EMultiSelectionListBoxId)); - - // display find box - SetupFind( CAknSelectionListDialog::EAdaptiveFind ); - - // get pointer to listbox data array - iModel = STATIC_CAST( - CAknFilteredTextListBoxModel*, iListBox->Model() ); - iSettingsTextArray = static_cast( - iModel->ItemTextArray() ); - - iUtility->AppendShareAllSelectionL( iSettingsTextArray ); - - - iFileSharingEngine->RequestSelectionContentL( iMediaType ); - iState = ELoadContent; - - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL(reinterpret_cast(waitNoteWrapper)); - waitNoteWrapper->ExecuteL( - R_UPNP_MULTISELECTION_SEARCHING_FILES_NOTE, // TInt aResId, - *this, // MAknBackgroundProcess& aBackgroundProcess - EFalse); // ETrue = Show immediately - - CleanupStack::PopAndDestroy(waitNoteWrapper); - - CAknIconArray* icons = new (ELeave) CAknIconArray(2); - CleanupStack::PushL( icons ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) ); - - iUtility->AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOn, - EMbmAvkonQgn_prop_checkbox_on, - EMbmAvkonQgn_prop_checkbox_on_mask ); - - iUtility->AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOff, - EMbmAvkonQgn_prop_checkbox_off, - EMbmAvkonQgn_prop_checkbox_off_mask ); - - - iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); - CleanupStack::Pop( icons ); - - iListBox->ActivateL(); - - - // set dialog title - CEikStatusPane* statusPane = - (( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); - iTitlePane = (CAknTitlePane*)statusPane->ControlL( - TUid::Uid(EEikStatusPaneUidTitle)); - - if ( iMediaType == EImageAndVideo ) - { - iTitlePane->SetTextL( *StringLoader::LoadLC( - R_UPNP_MULTISELECTION_SHARING_VISUAL_TITLE_TEXT) ); - } - else - { - iTitlePane->SetTextL( *StringLoader::LoadLC( - R_UPNP_MULTISELECTION_SHARING_MUSIC_TITLE_TEXT) ); - } - CleanupStack::PopAndDestroy(); - - CAknSelectionListDialog::PreLayoutDynInitL(); - __LOG("CUPnPAppMultiselectionDialog::PreLayoutDynInitL end"); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::PostLayoutDynInitL() -// Called by framework before dialog is shown. -// Needed because filter is not active until PreLayoutDynInitL(). -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionDialog::PostLayoutDynInitL() - { - __LOG("CUPnPAppMultiselectionDialog::PostLayoutDynInitL begin"); - - // Get state of do not share and share all selections and set them - // to utility. - TShareSelectionState selectionState = - iUtility->ShareSelectionStateFromArray( *iMarkedItems ); - iUtility->SetShareSelectionState( selectionState ); - - // filter out the first character of the search string - FindBox()->SetListColumnFilterFlags(0xFFFFFFFE); - - //mark selected albums - if ( iMarkedItems ) - { - if ( iMarkedItems->Count() ) - { - // - iListBox->SetSelectionIndexesL( iMarkedItems ); - } - } - iUtility->CollectSelectedItemsL( iListBox, ETrue ); - - //set msk's label depending on is item selected or not - HBufC* mskLabel( iMskSelectText ); - if( iListBox->View()->ItemIsSelected( iListBox->CurrentItemIndex() ) ) - { - mskLabel = iMskUnselectText; - } - ButtonGroupContainer().SetCommandL( EAknSoftkeySelect, *mskLabel ); - - __LOG("CUPnPAppMultiselectionDialog::PostLayoutDynInitL end"); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::OfferKeyEventL(); -// called by framework when key is pressed -// -------------------------------------------------------------------------- -// -TKeyResponse CUPnPAppMultiselectionDialog::OfferKeyEventL( - const TKeyEvent &aKeyEvent, - TEventCode aType) - { - __LOG("CUPnPAppMultiselectionDialog::OfferKeyEventL begin"); - - TKeyResponse status( EKeyWasNotConsumed ); - if ( aType == EEventKey ) // Is not key event - { - if (aKeyEvent.iCode == EKeyOK) - { - status = iListBox->OfferKeyEventL( aKeyEvent, aType ); - iUtility->CollectSelectedItemsL( iListBox ); - } - else if (aKeyEvent.iCode == KOkSoftkeyCode) - { - // disable draw - iListBox->View()->SetDisableRedraw(ETrue); - status = CAknSelectionListDialog::OfferKeyEventL(aKeyEvent,aType); - } - else - { - // Let the Akn dialog handle the key event. - // EKeyEscape key event deletes this dialog. - status = CAknSelectionListDialog::OfferKeyEventL(aKeyEvent,aType); - } - } - - // - // Set msk's label depending on is item selected or not. - // - // In case of EKeyEscape we cannot access objects in heap any more. - // Only local variables in stack. This is because CAknSelectionListDialog - // ::OfferKeyEventL deletes this dialog. When call returns heap memory is cleared - // and we cannot rely on values of member variables. - // - if ( status == EKeyWasConsumed && - aKeyEvent.iCode != EKeyEscape ) - { - HBufC* mskLabel(iMskSelectText); - if( iListBox->View()->ItemIsSelected( - iListBox->CurrentItemIndex() ) ) - { - mskLabel = iMskUnselectText; - } - ButtonGroupContainer().SetCommandL( EAknSoftkeySelect, *mskLabel ); - ButtonGroupContainer().DrawDeferred(); - } - - __LOG("CUPnPAppMultiselectionDialog::OfferKeyEventL end"); - return status; - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::StepL -// Step done during wait note -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionDialog::StepL(void) - { - switch ( iState ) - { - case ELoadContent: - { - TRAPD( err, iFileSharingEngine->GetSelectionContentL( - *iSettingsTextArray ) ); - if ( err == KErrNone ) - { - iState = ELoadIndexes; - iFileSharingEngine->RequestSelectionIndexesL( iMediaType ); - } - else if ( err == KErrInUse ) - { - //do nothing, request is being proceeded - } - else - { - User::Leave( err ); - } - break; - } - case ELoadIndexes: - { - TRAPD( err, iFileSharingEngine->GetSelectionIndexesL( - *iMarkedItems ) ); - if ( err == KErrNone ) - { - iState = ELoadDone; - iDone = ETrue; - } - else if ( err == KErrInUse ) - { - //do nothing, request is being proceeded - } - else - { - User::Leave( err ); - } - break; - } - case ELoadDone: - { - break; - } - default: - { - __PANICD( __FILE__, __LINE__ ); - break; - } - } - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionDialog::IsProcessDone -// Returns ETrue if process finished -// -------------------------------------------------------------------------- -// -TBool CUPnPAppMultiselectionDialog::IsProcessDone(void) const - { - return iDone; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/src/upnpappmultiselectionpopup.cpp --- a/upnpsettings/multiselectionui/src/upnpappmultiselectionpopup.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,441 +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: Multiselection popup implementation -* -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include -#include //clistboxview -#include -#include -#include -#include - -#include "upnpappmultiselectionpopup.h" -#include "upnpmultiselectionutility.h" -#include "upnpfilesharingengine.h" - -#include "cupnpmultiselectionui.hrh" -#include - -_LIT( KComponentLogfile, "multiselectionui.txt"); -#include "upnplog.h" - - -//CONSTANTS -const TInt KOkSoftkeyCode = 63585; - -//FORWARD DECLARATIONS -class CUPnPAppMultiselectionDialog; - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPAppMultiselectionPopup* CUPnPAppMultiselectionPopup::NewL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const HBufC* aHeading ) - { - __LOG( "CUPnPAppMultiselectionPopup::NewL begin" ); - - CUPnPAppMultiselectionPopup* self = - new(ELeave) CUPnPAppMultiselectionPopup( NULL, aHeading ); - - self->ConstructL( aMediaType, aFileSharingEngine,aSelectionIndexArray ); - - __LOG("CUPnPAppMultiselectionPopup::NewL end"); - return self; - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionPopup::ConstructL( - THomeConnectMediaType aMediaType, - CUPnPFileSharingEngine* aFileSharingEngine, - CListBoxView::CSelectionIndexArray* aSelectionIndexArray ) - { - __LOG("CUPnPAppMultiselectionPopup::ConstructL begin"); - - iMediaType = aMediaType; - iFileSharingEngine = aFileSharingEngine; - iPreviousSelection = aSelectionIndexArray; - iUiMarked = new(ELeave) CArrayFixFlat(3); - iMarkedItems = new(ELeave) CArrayFixFlat(3); - iUtility = new (ELeave) CUpnpMultiselectionUtility(); - iMskSelectText = - StringLoader::LoadL( R_UPNP_MULTISELECTION_SELECT_TEXT ); - iMskUnselectText = - StringLoader::LoadL( R_UPNP_MULTISELECTION_UNSELECT_TEXT ); - - __LOG("CUPnPAppMultiselectionPopup::ConstructL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::CUPnPAppMultiselectionPopup -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPAppMultiselectionPopup::CUPnPAppMultiselectionPopup( - CListBoxView::CSelectionIndexArray* aSelectionIndexArray, - const HBufC* aHeading ) - : CAknListQueryDialog( aSelectionIndexArray ) - - { - iHeading = aHeading; - __LOG("CUPnPAppMultiselectionPopup::CUPnPAppMultiselectionPopup"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup -// C++ default destructor. -// -------------------------------------------------------------------------- -// -CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup() - { - __LOG("CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup"); - - iFileSharingEngine = NULL; - - delete iUiMarked; - delete iMarkedItems; - delete iUtility; - delete iMskSelectText; - delete iMskUnselectText; - - __LOG("CUPnPAppMultiselectionPopup::~CUPnPAppMultiselectionPopup end"); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::OkToExitL(TInt aButtonId) -// called by framework when the softkey is pressed -// -------------------------------------------------------------------------- -// -TBool CUPnPAppMultiselectionPopup::OkToExitL( TInt aButtonId ) - { - __LOG("CUPnPAppMultiselectionPopup::OkToExitL begin"); - - if ( aButtonId == EAknSoftkeyOk ) - { - __LOG("CUPnPAppMultiselectionPopup::OkToExitL: OK"); - - const CArrayFix* selected; - - //get the true indexes of marked items - CAknListBoxFilterItems* filter - = static_cast < CAknFilteredTextListBoxModel* > - ( iListBox->Model() )->Filter(); - if ( filter ) - { - // Filter knows all. - filter->UpdateSelectionIndexesL(); - selected = filter->SelectionIndexes(); - } - else - { - // No filter. - selected = ListBox()->View()->SelectionIndexes(); - } - - if ( iPreviousSelection ) - { - iPreviousSelection->Reset(); - for ( TInt i = 0; i < selected->Count(); i++ ) - { - TInt tmp = selected->At( i ); - iPreviousSelection->AppendL( tmp ); - } - iUtility->ConvertSelectionsForEngineL( *iPreviousSelection ); - } - } - - - __LOG("CUPnPAppMultiselectionPopup::OkToExitL end"); - return ETrue; - } - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::PreLayoutDynInitL(); -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionPopup::PreLayoutDynInitL() - { - __LOG("CUPnPAppMultiselectionPopup::PreLayoutDynInitL begin"); - - //mark selected albums - - iListBox = ListBox(); - iModel = STATIC_CAST( - CAknFilteredTextListBoxModel*, iListBox->Model()); - - iSettingsTextArray = static_cast( - iModel->ItemTextArray()); - - iUtility->AppendShareAllSelectionL( iSettingsTextArray ); - - iFileSharingEngine->RequestSelectionContentL( iMediaType ); - iState = ELoadContent; - - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL(reinterpret_cast(waitNoteWrapper)); - waitNoteWrapper->ExecuteL( - R_UPNP_MULTISELECTION_SEARCHING_FILES_NOTE, // TInt aResId, - *this, // MAknBackgroundProcess& aBackgroundProcess - EFalse); // ETrue = Show immediately - - CleanupStack::PopAndDestroy(waitNoteWrapper); - - CAknIconArray* icons = new (ELeave) CAknIconArray(2); - CleanupStack::PushL( icons ); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) ); - - iUtility->AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOn, - EMbmAvkonQgn_prop_checkbox_on, - EMbmAvkonQgn_prop_checkbox_on_mask ); - - iUtility->AppendIconToArrayL( icons, skin, - iconsPath, - KAknsIIDQgnPropCheckboxOff, - EMbmAvkonQgn_prop_checkbox_off, - EMbmAvkonQgn_prop_checkbox_off_mask ); - - - CAknListQueryDialog::SetIconArrayL(icons); - - CleanupStack::Pop(icons); - - SetHeaderTextL( *iHeading ); - - ListBox()->ActivateL(); - - CAknListQueryDialog::PreLayoutDynInitL(); - - __LOG("CUPnPAppMultiselectionPopup::PreLayoutDynInitL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::PostLayoutDynInitL() -// Called by framework before dialog is shown. -// Needed because filter is not active until PreLayoutDynInitL(). -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionPopup::PostLayoutDynInitL() - { - __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL begin"); - - // Get state of do not share and share all selections and set them - // to utility. - TShareSelectionState selectionState = - iUtility->ShareSelectionStateFromArray( *iMarkedItems ); - iUtility->SetShareSelectionState( selectionState ); - - TBool useMarked = EFalse; - //mark selected albums - if ( iMarkedItems && iMarkedItems->Count() ) - { - if( iMarkedItems->At(0) != 0 ) - { - __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL using iMarkedItems"); - // if got selections stored in content server use that - iListBox->SetSelectionIndexesL( iMarkedItems ); - useMarked = ETrue; - } - } - if( !useMarked && iUiMarked->Count() ) - { - __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL using iUiMarked"); - iListBox->SetSelectionIndexesL( iUiMarked ); - } - - iUtility->CollectSelectedItemsL( iListBox, ETrue ); - - //set msk's label depending on is item selected or not - HBufC* mskLabel( iMskSelectText ); - if( iListBox->View()->ItemIsSelected( iListBox->CurrentItemIndex() ) ) - { - mskLabel = iMskUnselectText; - } - ButtonGroupContainer().SetCommandL( - EAknSoftkeyForwardKeyEvent, *mskLabel ); - - __LOG("CUPnPAppMultiselectionPopup::PostLayoutDynInitL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::OfferKeyEventL(); -// called by framework when key is pressed -// -------------------------------------------------------------------------- -// -TKeyResponse CUPnPAppMultiselectionPopup::OfferKeyEventL ( - const TKeyEvent &aKeyEvent, - TEventCode aType) - { - __LOG("CUPnPAppMultiselectionPopup::OfferKeyEventL begin"); - - TKeyResponse status( EKeyWasNotConsumed ); - if ( aType == EEventKey ) // Is not key event - { - if (aKeyEvent.iCode == EKeyOK) - { - status = ListBox()->OfferKeyEventL( aKeyEvent, aType ); - iUtility->CollectSelectedItemsL( iListBox ); - } - else if (aKeyEvent.iCode == KOkSoftkeyCode) - { - // disable draw - status = CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType ); - } - else - { - // Let the Akn dialog handle the key event. - // EKeyEscape key event deletes this dialog. - status = CAknListQueryDialog::OfferKeyEventL( aKeyEvent, aType ); - } - } - - // - // Set msk's label depending on is item selected or not. - // - // In case of EKeyEscape we cannot access objects in heap any more. - // Only local variables in stack. This is because CAknSelectionListDialog - // ::OfferKeyEventL deletes this dialog. When call returns heap memory is cleared - // and we cannot rely on values of member variables. - // - if ( status == EKeyWasConsumed && - aKeyEvent.iCode != EKeyEscape ) - { - HBufC* mskLabel(iMskSelectText); - if( iListBox->View()->ItemIsSelected( - iListBox->CurrentItemIndex() ) ) - { - mskLabel = iMskUnselectText; - } - ButtonGroupContainer().SetCommandL( - EAknSoftkeyForwardKeyEvent, *mskLabel ); - ButtonGroupContainer().DrawDeferred(); - } - - __LOG("CUPnPAppMultiselectionPopup::OfferKeyEventL end"); - return status; - } - - - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::StepL -// Step done during wait note -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionPopup::StepL(void) - { - switch ( iState ) - { - case ELoadContent: - { - TRAPD( err, iFileSharingEngine->GetSelectionContentL( - *iSettingsTextArray ) ); - if ( err == KErrNone ) - { - iState = ELoadIndexes; - iFileSharingEngine->RequestSelectionIndexesL( iMediaType ); - } - else if ( err == KErrInUse ) - { - //do nothing, request is being proceeded - } - else - { - User::Leave( err ); - } - break; - } - case ELoadIndexes: - { - TRAPD( err, iFileSharingEngine->GetSelectionIndexesL( - *iMarkedItems ) ); - if ( err == KErrNone ) - { - iState = ELoadDone; - iDone = ETrue; - } - else if ( err == KErrInUse ) - { - //do nothing, request is being proceeded - } - else - { - User::Leave( err ); - } - break; - } - case ELoadDone: - { - break; - } - default: - { - __PANICD( __FILE__, __LINE__ ); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::IsProcessDone -// Returns ETrue if process finished -// -------------------------------------------------------------------------- -// -TBool CUPnPAppMultiselectionPopup::IsProcessDone(void) const - { - return iDone; - } - -// -------------------------------------------------------------------------- -// CUPnPAppMultiselectionPopup::SetMarkedItemsL -// -------------------------------------------------------------------------- -// -void CUPnPAppMultiselectionPopup::SetMarkedItemsL(CArrayFix& aMarkedItems) - { - iUiMarked->Reset(); - for( TInt i=0 ; i < aMarkedItems.Count() ; ++i ) - { - iUiMarked->AppendL( aMarkedItems.At(i) ); - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/multiselectionui/src/upnpmultiselectionutility.cpp --- a/upnpsettings/multiselectionui/src/upnpmultiselectionutility.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,503 +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: Multiselection dialog implementation -* -*/ - - - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include - -#include -#include "upnpmultiselectionutility.h" -#include "upnpfilesharingengine.h" - -_LIT( KComponentLogfile, "multiselectionui.txt"); -#include "upnplog.h" - - -//CONSTANTS - -// Format string for listbox items -_LIT( KItemFormatString, "1\t%S" ); - -const TInt KShareNoneIndex = 0; // listbox index of "do not share" -const TInt KShareAllIndex = 1; // listbox index of "share all" -const TInt KPredefinedSelections = 2; // Share none and share all - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::CUpnpMultiselectionUtility -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpMultiselectionUtility::CUpnpMultiselectionUtility() - { - __LOG("CUpnpMultiselectionUtility::CUpnpMultiselectionUtility"); - iShareNoneSelected = EFalse; - iShareAllSelected = EFalse; - } - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::CUpnpMultiselectionUtility -// C++ default destructor. -// -------------------------------------------------------------------------- -// -CUpnpMultiselectionUtility::~CUpnpMultiselectionUtility() - { - __LOG("CUpnpMultiselectionUtility::~CUpnpMultiselectionUtility"); - } - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::CollectSelectedItemsL() -// Collects selected items to member variable for later use -// -------------------------------------------------------------------------- -// -void CUpnpMultiselectionUtility::CollectSelectedItemsL( - CEikListBox* aListBox, TBool aFirstRun ) - { - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL begin"); - - const CArrayFix* indexes = NULL; - - //get the true indexes of marked items - CAknListBoxFilterItems* filter - = static_cast < CAknFilteredTextListBoxModel* > - ( aListBox->Model() )->Filter(); - if ( filter ) - { - // Filter knows all. - filter->UpdateSelectionIndexesL(); - indexes = filter->SelectionIndexes(); - } - else - { - // No filter. - indexes = aListBox->View()->SelectionIndexes(); - } - - if ( indexes->Count() > 0 ) - { - // obtain selection state - TShareSelectionState selectionState = - ShareSelectionStateFromArray( *indexes ); - - // make some decisions based on the tabs selected - DoSelectionLogicL( aListBox, aFirstRun, - indexes, filter, selectionState ); - - } - else // no items selected - { - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \ -No items selected"); - - filter->ResetFilteringL(); - aListBox->View()->SelectItemL( KShareNoneIndex ); - } - - // update iShareNoneSelected and iShareAllSelected member variables - iShareNoneSelected = EFalse; - iShareAllSelected = EFalse; - - const CArrayFix* indexesAfter = NULL; - - if ( filter ) - { - // Filter knows all. - filter->UpdateSelectionIndexesL(); - indexesAfter = filter->SelectionIndexes(); - } - else - { - // No filter. - indexesAfter = aListBox->View()->SelectionIndexes(); - } - - for ( TInt i = 0 ; i < indexesAfter->Count() ; i++ ) - { - if ( indexesAfter->At( i ) == KShareNoneIndex ) - { - iShareNoneSelected = ETrue; - } - else if ( indexesAfter->At( i ) == KShareAllIndex ) - { - iShareAllSelected = ETrue; - } - } - - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL end"); - } - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::DoSelectionLogicL -// Do some decisions based on the selection state -// -------------------------------------------------------------------------- -// -void CUpnpMultiselectionUtility::DoSelectionLogicL( - CEikListBox* aListBox, - TBool aFirstRun, - const CArrayFix* aIndexes, - CAknListBoxFilterItems* aFilter, - TShareSelectionState aSelectionState ) - { - const TInt arrayGranularity( aIndexes->Count() + 1 ); - - // If "do not share" was not selected before and it is now, unselect - // all except "do not share". - if ( ( aSelectionState == EShareNoneSelected || - aSelectionState == EShareNoneAndShareAllSelected ) && - !iShareNoneSelected ) - { - // Create new selectionindexarray with only "do not share" - // selected and assign it to the listbox. - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL:\ -Do not share selected"); - CListBoxView::CSelectionIndexArray* noneArr = - new (ELeave) CArrayFixFlat( arrayGranularity ); - CleanupStack::PushL( noneArr ); - noneArr->AppendL( KShareNoneIndex ); - aListBox->SetSelectionIndexesL( noneArr ); - CleanupStack::PopAndDestroy( noneArr ); - } - // if "share all" was not selected before and it is now, select all - // except "do not share". - // OR if this method is executed first time (from PostLayoutDynInitL) - // and share all is selected, then we trust that all items should be - // selected. - else if ( ( ( aSelectionState == EShareAllSelected || - aSelectionState == EShareNoneAndShareAllSelected ) && - !iShareAllSelected ) - || aSelectionState == EShareAllSelected && aFirstRun ) - { - // Create new selectionindexarray with "share all" and all other - // items except "do not share" selected and assign it to the - // listbox. - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \ -All files selected"); - TInt itemCount = aFilter->NonFilteredNumberOfItems(); - - CListBoxView::CSelectionIndexArray* allArr = - new (ELeave) CArrayFixFlat( arrayGranularity ); - CleanupStack::PushL( allArr ); - allArr->AppendL( KShareAllIndex ); - for ( TInt i( KPredefinedSelections ); i < itemCount; i++ ) - { - allArr->AppendL( i ); - } - aFilter->ResetFilteringL(); - aListBox->SetSelectionIndexesL( allArr ); - CleanupStack::PopAndDestroy( allArr ); - } - // if share all selection is removed - else if ( aSelectionState == EItemsSelected && - iShareAllSelected ) - { - // Create new selectionindexarray with only "do not share" - // selected and assign it to the listbox. - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \ -Do not share selected"); - CListBoxView::CSelectionIndexArray* noneArr = - new (ELeave) CArrayFixFlat( arrayGranularity ); - CleanupStack::PushL( noneArr ); - noneArr->AppendL( KShareNoneIndex ); - aListBox->SetSelectionIndexesL( noneArr ); - CleanupStack::PopAndDestroy( noneArr ); - } - // if only some individual items have been modified - else if ( aSelectionState == EItemsSelected && - !iShareAllSelected && - !iShareNoneSelected ) - { - // do nothing. selections are kept as they are - } - // if share none is selected with some individual item, - // unselect share none - else if ( aSelectionState == EShareNoneSelected && aIndexes->Count() > 1 ) - { - // Create similar selectionindexarray without "do not share" - // selected and assign it to the listbox. - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \ -Do not share selected"); - - for( TInt y=0; y < aIndexes->Count(); y++ ) - { - TInt itemIndex = aIndexes->At(y); - if ( itemIndex == 0 || itemIndex == 1 ) - { - aListBox->View()->DeselectItem( - aFilter->VisibleItemIndex(itemIndex) ); - } - } - } - else if ( aSelectionState == EShareAllSelected && - aIndexes->Count() < aFilter->NonFilteredNumberOfItems() - 1 ) - { - if ( aIndexes->Count() > 0 ) - { - // all items were selected and some item (not share all) has - // been unselected -> remove selection also from share all. - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \ -Do not share selected"); - - for( TInt y=0; y < aIndexes->Count(); y++ ) - { - TInt itemIndex = aIndexes->At(y); - if ( itemIndex == KShareAllIndex ) - { - aListBox->View()->DeselectItem( - aFilter->VisibleItemIndex( itemIndex ) ); - } - } - - if ( !aListBox->View()->SelectionIndexes()->Count() ) - { - // Last individual item has been unselected. - // Create new selectionindexarray with only - // "do not share" selected and assign it to the listbox. - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \ -Do not share selected"); - CListBoxView::CSelectionIndexArray* noneArr = - new (ELeave) CArrayFixFlat( arrayGranularity ); - CleanupStack::PushL( noneArr ); - noneArr->AppendL( KShareNoneIndex ); - aListBox->SetSelectionIndexesL( noneArr ); - CleanupStack::PopAndDestroy( noneArr ); - } - } - else - { - // some item unselected and no other items left except - // "share all" - - // Create new selectionindexarray with only "do not share" - // selected and assign it to the listbox. - __LOG("CUpnpMultiselectionUtility::CollectSelectedItemsL: \ -Do not share selected"); - CListBoxView::CSelectionIndexArray* noneArr = - new (ELeave) CArrayFixFlat( arrayGranularity ); - CleanupStack::PushL( noneArr ); - noneArr->AppendL( KShareNoneIndex ); - aListBox->SetSelectionIndexesL( noneArr ); - CleanupStack::PopAndDestroy( noneArr ); - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::ConvertSelectionsForEngineL -// Convert the selections from UI to engine as "old style selections" -// Has effect only if "Share All" is selected -// -------------------------------------------------------------------------- -// -void CUpnpMultiselectionUtility::ConvertSelectionsForEngineL( - CArrayFix& aSelections ) const - { - __LOG("CUpnpMultiselectionUtility::ConvertSelectionsForEngineL begin"); - - for ( TInt i(0); i < aSelections.Count(); i++ ) - { - if ( aSelections.At( i ) == KShareAllIndex ) - { - aSelections.Reset(); - aSelections.AppendL( KShareAllIndex ); - i = aSelections.Count(); - } - } - - __LOG("CUpnpMultiselectionUtility::ConvertSelectionsForEngineL end"); - } - - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::AppendIconToArray -// Load a possibly skinned icon (with mask) and append it to an -// icon array. -// -------------------------------------------------------------------------- -// -void CUpnpMultiselectionUtility::AppendIconToArrayL(CAknIconArray* aArray, - MAknsSkinInstance* aSkin, - const TDesC& aMbmFile, - const TAknsItemID& aID, - TInt aBitmapId, - TInt aMaskId) const - { - __LOG("CUpnpMultiselectionUtility::AppendIconToArrayL begin"); - - __ASSERT_DEBUG(aArray != NULL, User::Leave(KErrArgument)); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC( aSkin, aID, - bitmap, mask, aMbmFile, aBitmapId, aMaskId ); - - CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); - icon->SetBitmapsOwnedExternally( EFalse ); - - // icon now owns the bitmaps, no need to keep on cleanup stack. - CleanupStack::Pop(2); // mask, bitmap - bitmap = NULL; - mask = NULL; - - CleanupStack::PushL( icon ); - - aArray->AppendL( icon ); - - // aArray now owns the icon, no need to delete. - CleanupStack::Pop(icon); - __LOG("CUpnpMultiselectionUtility::AppendIconToArrayL end"); - - } - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::AppendShareAllSelectionL -// Appends "share all files" item to the listbox -// -------------------------------------------------------------------------- -// -void CUpnpMultiselectionUtility::AppendShareAllSelectionL( - CDesCArray* aListBoxArray ) const - { - __LOG("CUpnpMultiselectionUtility::AppendShareAllSelectionL begin"); - HBufC* item = HBufC::NewL( KMaxFileName ); - CleanupStack::PushL( item ); - HBufC* item2 = HBufC::NewL( KMaxFileName ); - CleanupStack::PushL( item2 ); - HBufC* itemText1 = StringLoader::LoadLC( - R_UPNP_MULTISELECTION_SHARE_ALL_TEXT ); - HBufC* itemText2 = StringLoader::LoadLC( - R_UPNP_MULTISELECTION_DO_NOT_SHARE_TEXT ); - // create item string for the listbox (icon + album name) - item->Des().Format( KItemFormatString, itemText1 ); - item2->Des().Format( KItemFormatString, itemText2 ); - // append "share all files" -selection to the listbox - aListBoxArray->AppendL( item2->Des() ); - aListBoxArray->AppendL( item->Des() ); - - CleanupStack::PopAndDestroy(2); // stringloader - CleanupStack::PopAndDestroy(2); // item item2 - __LOG( "CUpnpMultiselectionUtility::AppendShareAllSelectionL end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::SetShareSelectionState -// (Commented in the header) -// -------------------------------------------------------------------------- -// -void CUpnpMultiselectionUtility::SetShareSelectionState( - TShareSelectionState aSelectionState ) - { - switch ( aSelectionState ) - { - case EShareNoneSelected: - { - iShareNoneSelected = ETrue; - iShareAllSelected = EFalse; - break; - } - case EShareAllSelected: - { - iShareNoneSelected = EFalse; - iShareAllSelected = ETrue; - break; - } - case ENoShareNoneOrShareAllSelected: - { - iShareNoneSelected = EFalse; - iShareAllSelected = EFalse; - break; - } - default: - { - // Should not be reached. - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpMultiselectionUtility::ShareSelectionStateFromArray -// (Commented in the header) -// -------------------------------------------------------------------------- -// -TShareSelectionState - CUpnpMultiselectionUtility::ShareSelectionStateFromArray( - const CArrayFix& aIndexes ) const - { - TShareSelectionState retval = EUndefined; - TBool shareNoneFound = EFalse; - TBool shareAllFound = EFalse; - TBool itemsSelected = EFalse; - - // Check if the indexes array contains do not share or share all. - for ( TInt i = 0 ; i < aIndexes.Count() ; i++ ) - { - if ( aIndexes.At( i ) == KShareNoneIndex ) - { - shareNoneFound = ETrue; - } - else if ( aIndexes.At( i ) == KShareAllIndex ) - { - shareAllFound = ETrue; - } - } - - // - if ( !shareAllFound && !shareNoneFound ) - { - // "do not share" or "share all" are not selected. Check if there are - // other items selected. - if ( aIndexes.Count() ) - { - itemsSelected = ETrue; - } - } - - // set retval - if ( itemsSelected ) - { - retval = EItemsSelected; - } - else if ( shareNoneFound && !shareAllFound ) - { - retval = EShareNoneSelected; - } - else if ( !shareNoneFound && shareAllFound ) - { - retval = EShareAllSelected; - } - else if ( shareNoneFound && shareAllFound ) - { - retval = EShareNoneAndShareAllSelected; - } - else if ( !shareNoneFound && !shareAllFound ) - { - retval = ENoShareNoneOrShareAllSelected; - } - - return retval; - } - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/rom/bld.inf --- a/upnpsettings/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +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: Exports for upnpsettings -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS - -PRJ_EXPORTS -// ROM build -upnpsettings.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsettings.iby) -upnpsettingsresources.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsettingsresources.iby) -// LOC files -UPNP_LOC_EXPORT(upnpsettings.loc) - -PRJ_MMPFILES -// none - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/rom/upnpsettings.iby --- a/upnpsettings/rom/upnpsettings.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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: upnpsettings subsystem ROM include file -* -*/ - - - - - -#ifndef __UPNPSETTINGS_IBY__ -#define __UPNPSETTINGS_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // UPNP settings engine - file=ABI_DIR\BUILD_DIR\upnpsettingsengine.dll \sys\bin\upnpsettingsengine.dll - data=ABI_DIR\BUILD_DIR\z\private\10202be9\20009cae.txt \private\10202be9\20009cae.txt - data=DATAZ_\private\20009CAE\backup_registration.xml \private\20009CAE\backup_registration.xml - - // setup wizard - file=ABI_DIR\BUILD_DIR\upnpappwizard.dll \sys\bin\upnpappwizard.dll - - // multiselection UI - file=ABI_DIR\BUILD_DIR\upnpmultiselectionui.dll \sys\bin\upnpmultiselectionui.dll - - //upnp generic settings plugin - ECOM_PLUGIN( upnpgsplugin.dll, upnpgsplugin.rsc ) - data=DATAZ_\resource\apps\upnpgspluginrsc.mif \resource\apps\upnpgspluginrsc.mif - - // sharing settings UI - file=ABI_DIR\BUILD_DIR\upnpsharingui.dll \sys\bin\upnpsharingui.dll - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPSETTINGS_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/rom/upnpsettingsresources.iby --- a/upnpsettings/rom/upnpsettingsresources.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +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: upnpsettings subsystem resource ROMinclude file -* -*/ - - - - - -#ifndef __UPNPSETTINGSRESOURCES_IBY__ -#define __UPNPSETTINGSRESOURCES_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // setup wizard - data=DATAZ_\resource\cupnpappwizard.rsc \resource\cupnpappwizard.rsc - - // multiselection UI - data=DATAZ_\resource\CUPnPMultiselectionUi.RSC \resource\CUPnPMultiselectionUi.RSC - - //upnp generic settings plugin - data=DATAZ_\resource\upnpgspluginrsc.rsc \resource\upnpgspluginrsc.rsc - - // sharing settings UI - data=DATAZ_\resource\upnpsharingui.rsc \resource\upnpsharingui.rsc - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPSETTINGSRESOURCES_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/bitmaps/qgn_menu_upnp_homemedia.svg --- a/upnpsettings/upnpgsplugin/bitmaps/qgn_menu_upnp_homemedia.svg Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/data/20009CAF.rss --- a/upnpsettings/upnpgsplugin/data/20009CAF.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2005 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: ECOM plugin resource file for Data Call Settings plugin. -* -*/ - - - - - - -#include -#include "upnpgsplugin.hrh" - -RESOURCE REGISTRY_INFO theInfo - { - //resource_format_version = RESOURCE_FORMAT_VERSION_2; - // UID for the DLL - dll_uid = KUPnPGSPluginDllUid; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - //GS ECOM interface UID, don't change! - interface_uid = 0x10207236; - implementations = - { - // Info for UPnP Browser - IMPLEMENTATION_INFO - { - implementation_uid = KUPnPGSPluginImplementationUid; - version_no = 1; - display_name = "UPnP Settings"; - default_data = "0x10207239"; // Parent UID; - opaque_data = "1000"; // Order number - //rom_only = 0; - } - }; - } - }; - } - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/data/upnpgspluginrsc.rss --- a/upnpsettings/upnpgsplugin/data/upnpgspluginrsc.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,449 +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: Upnp settings plugin resource file -* -*/ - - - - - - - -// RESOURCE IDENTIFIER -NAME UPGS // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include - -// USER INCLUDES -#include "upnpsettingsengine.hrh" -#include "upnpgsplugin.hrh" - -// CONSTANTS - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE - { - } - -//---------------------------------------------------- -// r_gs_datacall_view_caption -// -// Data call view caption for plugin -//---------------------------------------------------- -// -RESOURCE TBUF r_upnp_gs_settings_view_caption - { - buf = qtn_iupnp_gs_caption; - } - -//---------------------------------------------------- -// r_gs_datacall_view_caption -// -// Data call view caption for plugin -//---------------------------------------------------- -// -RESOURCE TBUF r_upnp_gs_settings_view_title - { - buf = qtn_iupnp_title_sharing; - } - -//---------------------------------------------------- -// -// r_gs_dcall_view -// Data call view. -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_gs_upnp_view - { - menubar = r_homeconnect_settings_menubar; - cba = r_settingsui_softkeys_options_back__change; - } - -//---------------------------------------------------------------------------- -// -// r_homeconnect_settings_menubar -// -//---------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_homeconnect_settings_menubar - { - titles = - { - MENU_TITLE { menu_pane = r_homeconnect_settings_menu;} - }; - } - -//---------------------------------------------------------------------------- -// -// r_homeconnect_settings_menu -// -//---------------------------------------------------------------------------- - -RESOURCE MENU_PANE r_homeconnect_settings_menu - { - items = - { - MENU_ITEM - { - command = EAknSoftkeyChange; - txt = qtn_options_change; - }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - - -// RESOURCE DEFINITIONS - -//---------------------------------------------------------------------------- -// -// r_homeconnect_settings_dialog -// -//---------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_ITEM_LIST r_upnp_gs_settings_list - { - items = - { - AVKON_SETTING_ITEM - { - identifier = EUPnPGSPluginItemIAP; - setting_page_resource = r_iap_setting_page; - associated_resource = r_iap_selection_page_texts; - name = qtn_iupnp_home_ap; - }, - AVKON_SETTING_ITEM - { - identifier = EUPnPGSPluginItemMyDeviceName; - setting_page_resource = r_my_device_name_setting_page; - name = qtn_iupnp_device_name; - }, - AVKON_SETTING_ITEM - { - identifier = EUPnPGSPluginItemCopyLocation; - name = qtn_iupnp_copy_location; - } - }; - - } - -//---------------------------------------------------------------------------- -// -// r_iap_setting_page -// -//---------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_iap_setting_page - { - label = qtn_iupnp_ap_head_set; - type = EAknCtPopupSettingList; - editor_resource_id = r_iap_selection_page_edit_controls; - } - -//---------------------------------------------------------------------------- -// -// r_iap_selection_page_edit_controls -// -//---------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_iap_selection_page_edit_controls - { - } -//---------------------------------------------------------------------------- -// -// r_iap_selection_page_texts -// -//---------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_iap_selection_page_texts - - { - setting_texts_resource = r_iap_selection_item_texts; - } - -//---------------------------------------------------------------------------- -// -// r_iap_selection_item_texts -// -//---------------------------------------------------------------------------- -// -RESOURCE ARRAY r_iap_selection_item_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = EUPnPSettingsEngineIAPItemNone; - text = qtn_iupnp_ap_none_set; - }, - AVKON_ENUMERATED_TEXT - { - value = EUPnPSettingsEngineIAPItemAlwaysAsk; - text = qtn_iupnp_ap_ask_set; - }, - AVKON_ENUMERATED_TEXT - { - value = EUPnPSettingsEngineIAPItemUserDefined; - text = qtn_iupnp_ap_user_defined; - } - }; - } - - - -//---------------------------------------------------------------------------- -// -// r_my_device_name_setting_page -// -//---------------------------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_my_device_name_setting_page - { - type = EEikCtEdwin; - editor_resource_id = r_my_device_name_edwin; - } - - -//---------------------------------------------------------------------------- -// -// home network IAP selection item texts -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_qtn_iupnp_item_home_iap_always_ask { buf = qtn_iupnp_ap_ask_set; } -RESOURCE TBUF r_qtn_iupnp_item_home_iap_user_defined { buf = qtn_iupnp_ap_user_defined; } -RESOURCE TBUF r_qtn_iupnp_item_home_iap_none { buf = qtn_iupnp_ap_none_set; } - -//---------------------------------------------------------------------------- -// -// home network IAP selection setting page texts -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_qtn_iupnp_home_iap_always_ask { buf = qtn_iupnp_ap_ask_set; } -RESOURCE TBUF r_qtn_iupnp_home_iap_create_new { buf = qtn_iupnp_ap_new_set; } -RESOURCE TBUF r_qtn_iupnp_home_iap_none { buf = qtn_iupnp_ap_none_set; } - -//---------------------------------------------------------------------------- -// -// r_my_device_name_edwin -// -//---------------------------------------------------------------------------- -// -RESOURCE EDWIN r_my_device_name_edwin - { - width = 64; - lines = 5; - maxlength = 64; - } - -//---------------------------------------------------------------------------- -// -// r_settingsui_softkeys_options_back__change -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_settingsui_softkeys_options_back__change - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyChange; txt= qtn_msk_change; } - }; - } - -//---------------------------------------------------------------------------- -// -// r_upnp_settings_menubar -// -//---------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_upnp_settings_menubar - { - titles = - { - MENU_TITLE { menu_pane = r_upnp_settings_menu;} - }; - } - -//---------------------------------------------------------------------------- -// -// r_upnp_settings_menu -// -//---------------------------------------------------------------------------- - -RESOURCE MENU_PANE r_upnp_settings_menu - { - items = - { - MENU_ITEM - { - command = EAknSoftkeyChange; - txt = qtn_options_change; - }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_unsecured_connections_confirmation_query -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_unsecured_connections_confirmation_query - { - flags = EGeneralQueryFlags; - buttons = r_softkeys_continue_cancel; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - label = qtn_iupnp_conf_unsecure; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_softkeys_continue_cancel -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_softkeys_continue_cancel - { - buttons = - { - CBA_BUTTON - { - id = EUPnPGSPluginCbaButtonContinue; - txt = qtn_iupnp_conf_continue; - }, - CBA_BUTTON - { - id = EAknSoftkeyCancel; - txt = text_softkey_cancel; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_ibu_gallery_update_note_title_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ibu_gallery_update_note_title_text - { - buf = qtn_iupnp_ibu_gallery_update_note_title_2; - } - -//---------------------------------------------------------------------------- -// -// r_ibu_gallery_update_note_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ibu_gallery_update_note_text - { - buf = qtn_iupnp_ibu_gallery_update_note_2; - } - -//---------------------------------------------------------------------------- -// -// r_ibu_gallery_update_notavail_note_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_ibu_gallery_update_notavail_note_text - { - buf = qtn_iupnp_ibu_gallery_notavail_note_2; - } - -//---------------------------------------------------------------------------- -// -// r_qtn_iupnp_iap_turn_sharing_off -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_qtn_iupnp_iap_turn_sharing_off - { - buf = qtn_iupnp_ibu_gallery_connectionactive_note; - } - -//---------------------------------------------------------------------------- -// -// r_homeconnect_info_query -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_homeconnect_info_query -{ - flags = EGeneralQueryFlags | EEikDialogFlagNoTitleBar | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; -} - -//End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/group/bld.inf --- a/upnpsettings/upnpgsplugin/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +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 information file for upnp settings plugin -* -*/ - - - - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// none - -PRJ_MMPFILES -upnpgsplugin.mmp - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE upnpgspluginrsc.mif -OPTION HEADERFILE upnpgspluginrsc.mbg -OPTION SOURCEDIR ../bitmaps -OPTION SOURCES -c8,8 qgn_menu_upnp_homemedia -END - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/group/upnpgsplugin.mmp --- a/upnpsettings/upnpgsplugin/group/upnpgsplugin.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +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: upnp settings plugin project specification file. -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" -#include // For RESOURCE_FILES_DIR - -CAPABILITY CAP_ECOM_PLUGIN -TARGET upnpgsplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x20009CAF -VENDORID VID_DEFAULT - -// System include paths -APP_LAYER_SYSTEMINCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT - -//User include paths -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -SOURCEPATH ../data -START RESOURCE 20009CAF.rss -TARGET upnpgsplugin.rsc -TARGETPATH ECOM_RESOURCE_DIR -END - -SOURCEPATH ../data -START RESOURCE upnpgspluginrsc.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -SOURCEPATH ../src -SOURCE upnpappsettingslist.cpp -SOURCE upnpappsettingitemhomeiap.cpp -SOURCE upnpappsettingitemmydevicename.cpp -SOURCE upnpsettingitemmemoryselection.cpp -SOURCE upnpgspluginimplementationtable.cpp -SOURCE upnpgspluginview.cpp - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY eikcoctl.lib -LIBRARY eikcore.lib -LIBRARY egul.lib -LIBRARY eikdlg.lib // eikon dialogs -LIBRARY upnpcontentserverclient.lib -LIBRARY upnpapplicationengine.lib -LIBRARY commondialogs.lib // CAknMemorySelectionDialog - -LIBRARY upnpavcontrollerclient.lib -LIBRARY upnpsettingsengine.lib -LIBRARY upnputilities.lib // IsAccesPointValidL -LIBRARY upnpipserversutils.lib -LIBRARY commdb.lib // used in upnpsettingitemhomeiap - -LIBRARY CommonEngine.lib // For RConeResourceLoader -LIBRARY featmgr.lib // Feature manager -LIBRARY aknskinsrv.lib // for enhanced skinning -LIBRARY AKNSKINS.lib // for enhanced skinning -LIBRARY hlplch.lib // for "Help" options menu -LIBRARY GSFramework.lib // For base classes -LIBRARY GSListBox.lib // For CGSListBoxItemTextArray -LIBRARY flogger.lib // For GSLogger -LIBRARY GSEcomPlugin.lib -LIBRARY PlatformEnv.lib -LIBRARY apengine.lib -LIBRARY aknlayout.LIB -LIBRARY AknIcon.lib -LIBRARY cmmanager.lib - -// End of File \ No newline at end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/inc/upnpappsettingitemhomeiap.h --- a/upnpsettings/upnpgsplugin/inc/upnpappsettingitemhomeiap.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +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: Declares home network IAP setting item class to home network -* setting item list -* -*/ - - - - - - -#ifndef UPNPAPPSETTINGITEMHOMEIAP_H -#define UPNPAPPSETTINGITEMHOMEIAP_H - - -// INCLUDES -#include - - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; - - -// CLASS DECLARATION - -/** -* UPnPAppSettingItemHomeIAP class. This class is used when -* creating home network IAP setting item to setting item list -* of home network application settings dialog. -* -* @lib CoverDisplaySettings.app -*/ -class UPnPAppSettingItemHomeIAP: public CAknEnumeratedTextPopupSettingItem - { - public: // Constructor and destructor - - /** - * Two-phased constructor. - */ - static UPnPAppSettingItemHomeIAP* NewL(TInt aIdentifier, - TInt& aIAPSetting, - TInt& aIAPId, TInt& aWAPId, TBool& aSharingState ); - - /** - * Destructor. - */ - virtual ~UPnPAppSettingItemHomeIAP(); - - public: // From CAknEnumeratedTextPopupSettingItem - - /** - * Returns setting text according to home network IAP setting. - * This text is visible in this setting item. - * - * @return home network IAP setting/name text - */ - const TDesC& SettingTextL(); - - /** - * Framework calls this method in order to create - * and execute setting page - */ - void CreateAndExecuteSettingPageL(); - - private: // From CAknEnumeratedTextPopupSettingItem - - /** - * Constructor. - */ - UPnPAppSettingItemHomeIAP(TInt aIdentifier, TInt& aIAPSetting, - TInt& aIAPId, TInt& aWAPId, TBool& aSharingState ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // New methods - - /** - * Changes iap name according to iap id - */ - void ChangeIAPNameL(); - - /** - * Checks if access point is unsecured and warns user - * @since S60 3.1 - * @param aAccessPoint, selected access point - * @return TInt, security mode - */ - TInt CheckAPSecurityL(TInt aAccessPoint); - - /** - * Displays message query - * @since S60 3.1 - * @param aHeaderResourceId, resource id of the title - * @param aMessageResourceId, resource id of the message - * @param TIaDialogResourceIdnt, resource id of the dialog - */ - void DisplayInfoL(TInt aHeaderResourceId, - TInt aMessageResourceId, - TInt aDialogResourceId); - - - /** - * Adds static items to the list - * @since S60 3.1 - * @param aArray, list array - */ - void AddStaticItemsL(CDesCArray* aArray); - - /** - * Use previous iap - * @since S60 5.1 - * @param aOldIap, previous iap id - */ - void UsePreviousIapL( TInt aOldIap ); - - /** - * Get iap index - * @since S60 5.1 - * @param aStaticCount the number of static items - * @return Index of iap - */ - TInt GetIAPIndex( TInt aStaticCount ); - - private: - - // pointer to home network IAP text - HBufC* iItemText; - - // pointer to home network IAP name - HBufC* iIAPName; - - // home network IAP ui selection (always ask, user defined or none) - TInt& iIAPSetting; - - // home network IAP id - TInt& iIAPId; - - // home network IAP wap id - TInt& iWAPId; - - // iap ids - RArray iIAPIdArray; - - // Control environment - CCoeEnv* iCoeEnv; - - // sharing status - TBool& iSharingState; - }; - -#endif - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/inc/upnpappsettingitemmydevicename.h --- a/upnpsettings/upnpgsplugin/inc/upnpappsettingitemmydevicename.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Declares home network my device name setting item class to -* home network setting item list -* -*/ - - - - - - -#ifndef UPNPAPPSETTINGITEMMYDEVICENAME_H -#define UPNPAPPSETTINGITEMMYDEVICENAME_H - - -// INCLUDES -#include - - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; - - -// CLASS DECLARATION - -/** -* UPnPAppSettingItemMyDeviceName class. This class is used when -* creating home network my device name setting item to setting item list -* of home network application settings dialog. -*/ -class UPnPAppSettingItemMyDeviceName: public CAknTextSettingItem - { - public: // Constructor and destructor - - /** - * Two-phased constructor. - */ - static UPnPAppSettingItemMyDeviceName* NewL(TInt aIdentifier, - TDes& aText, - TBool& aSharingState ); - - /** - * Destructor. - */ - virtual ~UPnPAppSettingItemMyDeviceName(); - - public: // From CAknTextSettingItem - - /** - * Framework calls this method in order to create - * and execute setting page - */ - void EditItemL(TBool aCalledFromMenu); - - private: // From CAknTextSettingItem - - /** - * Constructor. - */ - UPnPAppSettingItemMyDeviceName(TInt aIdentifier, - TDes& aText, - TBool& aSharingState ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - - // Sharing state - TBool& iSharingState; - }; - -#endif - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/inc/upnpappsettingslist.h --- a/upnpsettings/upnpgsplugin/inc/upnpappsettingslist.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +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: Settings list definition for Settings dialog -* -*/ - - - - - - - -#ifndef UPNPAPPSETTINGSLIST_H -#define UPNPAPPSETTINGSLIST_H - -// INCLUDES -#include -#include "upnpfilesharingengineobserver.h" - -// CLASS DECLARATION -class CUPnPSettingsEngine; -class CUPnPFileSharingEngine; - -// DATA TYPES -enum TWLanSecurityMode - { - EWLanUnsecured = 1 - }; - -/** - * Settings list class declaration - * @since S60 3.1 - */ -class CUPnPAppSettingsList : public CAknSettingItemList - { -public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUPnPAppSettingsList* NewL( TBool& aSharingState, - TInt aResourceId ); - - /** - * Destructor. - */ - virtual ~CUPnPAppSettingsList(); - -public: // New functions - - /** - * Reads data from storage to member variables - * @since S60 3.1 - */ - void LoadDataFromEngineL(); - -public: // Functions from base classes - - /** - * From CAknSettingItemList, this launches the setting page. - * @since S60 3.1 - * @param aIndex, index of selected list item - * @param aCalledFromMenu, indicates if editing is called - * trough menu or from keyboard - */ - void EditItemL ( TInt aIndex, TBool aCalledFromMenu ); - -protected: - - /** - * From CAknSettingItemList - */ - void HandleResourceChange( TInt aType ); - -private: - - /** - * C++ default constructor. - */ - CUPnPAppSettingsList( TBool& aSharingState ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( TInt aResourceId ); - - /** - * From CAknSettingItemList, Framework method to create a setting item. - * @since S60 3.1 - * @param aIdentifier, list item id to be created - * @return CAknSettingItem, pointer to list item - */ - CAknSettingItem* CreateSettingItemL( TInt aIdentifier ); - - -private: // Data - - // friendly name of my device - TBuf iFriendlyName; - // access point ID - TInt iIapId; - // wap id - TInt iWapId; - // my device name - HBufC8* iName; - // Settings engine for saving and reading data - CUPnPSettingsEngine* iSettingsEngine; - - // IAP ui selection (always ask, user defined or none) - TInt iIapSetting; - - // The drive to store copied files - TDriveNumber iCopyLocationDrive; - - // The status of the sharing (on/off) - TBool& iSharingState; - }; - -#endif // UPNPAPPSETTINGSLIST_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/inc/upnpgsplugin.hrh --- a/upnpsettings/upnpgsplugin/inc/upnpgsplugin.hrh Mon Nov 01 13:44:24 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: Resource headers for project Home Network -* -*/ - - - - - - -#ifndef UPNPSETTINGS_HRH -#define UPNPSETTINGS_HRH - -// DATA TYPES - -#define KUPnPGSPluginDllUid 0x20009CAF -#define KUPnPGSPluginImplementationUid 0x20009CB0 - -/** - * List of button ids used by UPnPGSPlugin. - */ -enum TUPnPGSPluginCbaButton - { - EUPnPGSPluginCbaButtonContinue = 1 - }; - -/** - * List of item ids supported by the UPnPGSPlugin. - */ -enum TUPnPGSPluginItem - { - EUPnPGSPluginItemIAP = 0, - EUPnPGSPluginItemMyDeviceName, - EUPnPGSPluginItemCopyLocation - }; - -#endif // UPNPSETTINGS_HRH - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/inc/upnpgspluginview.h --- a/upnpsettings/upnpgsplugin/inc/upnpgspluginview.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +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: Upnp general settings view. -* -*/ - - - - - - -#ifndef UPNPGSPLUGINVIEW_H -#define UPNPGSPLUGINVIEW_H - -#include -#include "upnpfilesharingengineobserver.h" -class CUPnPAppSettingsList; -class CAknNavigationDecorator; -class CAknNavigationControlContainer; -class CUPnPFileSharingEngine; - -/** - * MediaServant settings view. - * - * @lib msgsplugin.lib - */ -NONSHARABLE_CLASS( CUPnPGSPluginView ) : - public CGSPluginInterface, - private MUPnPFileSharingEngineObserver - { - - public: - - /** - * Two phased constructor. - */ - static CUPnPGSPluginView* NewL(); - - /** - * Destructor. - */ - virtual ~CUPnPGSPluginView(); - - protected: - - // From base class CAknView - - /** - * From CAknView - * See base class definition. - */ - TUid Id() const; - - /** - * From CAknView - * See base class definition - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknView - * See base class definition - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage); - - /** - * From CAknView - * See base class definition - */ - void DoDeactivate(); - - // From base class CGSPluginInterface - - /** - * From CGSPluginInterface - * See base class definition - */ - void GetCaptionL( TDes& aCaption ) const; - - /** - * From CGSPluginInterface - * See base class definition - */ - CGulIcon* CreateIconL( const TUid aIconType ); - - protected: // From MEikMenuObserver - - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - private: // From MUPnPFileSharingEngineObserver - - /** - * Function informs when file sharing was enabled or disabled - * @param aError, error code - * @param aEnabled ETrue if sharing was enabled, otherwise EFalse - */ - void OnSharingStatusChanged( TInt aError, TBool aEnabled ); - - /** - * Function informs when file sharing is ready - * @param aError, error code - */ - void OnSharingDone( TInt /*aError*/ ) {} - - /** - * Informs about status of the sharing progress - * @since S60 3.1 - * @param aProgressInfo Data type to contain information about \ - sharing progress - */ - void OnSharingProgress( - const RArray& /*aProgress*/ ) {} - - /** - * Callback to inform if connection has been lost - * @since S60 3.1 - */ - void OnSharingConnectionLost(); - - private: - - /** - * Default constructor. - */ - CUPnPGSPluginView(); - - /** - * Second phase constructor. - */ - void ConstructL(); - - /** - * Sets text by resource ID in title pane. - * - * @since S60 3.1 - * @param aResourceId, The ID of outline number to displayed next. - */ - void SetTitlePaneTextL( const TInt aResourceId ); - - private: // data - - /** - * Setting list - */ - CUPnPAppSettingsList* iSettingItemList; // owned - - /** - * Resource file offset - */ - TInt iResFileOffset; - - /** - * Control environment for file session - */ - CEikonEnv* iCoeEnv; // not owned - - CUPnPFileSharingEngine* iFileSharing; //owned - // iap ids - TInt iSharingState; - - /** - * View's ui to close when plugin is beign closed - */ - TVwsViewId iViewToClose; - - }; - -#endif // UPNPGSPLUGINVIEW_H diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/inc/upnpsettingitemmemoryselection.h --- a/upnpsettings/upnpgsplugin/inc/upnpsettingitemmemoryselection.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2007 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: Definition for UPnP memory selection setting item -* -*/ - - - - - - -#ifndef C_MSSETTINGITEMMMC_H -#define C_MSSETTINGITEMMMC_H - -// INCLUDES -#include -#include - -// CLASS DECLARATION - -/** - * CUPnPSettingItemMemorySelection class. - */ -NONSHARABLE_CLASS( CUPnPSettingItemMemorySelection ): - public CAknMemorySelectionSettingItemMultiDrive - { - public: // Constructor and destructor - - - - /** - * NewL - * 2-phase constructor. - */ - static CUPnPSettingItemMemorySelection* NewL( TInt aIdentifier, - TDriveNumber& aSelectedDrive ); - - - /** - * Destructor. - */ - virtual ~CUPnPSettingItemMemorySelection(); - - - protected: // From CAknSettingItem - - /** - * This method activates the memory selection dialog - */ - void EditItemL( TBool aCalledFromMenu ); - - private: - - - /** - * ConstructL - * Second phase constructor. - */ - void ConstructL(); - - /** - * Constructor. - */ - CUPnPSettingItemMemorySelection( - TInt aIdentifier, - TDriveNumber& aSelectedDrive ); - - }; - -#endif // C_MSSETTINGITEMMMC_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/src/upnpappsettingitemhomeiap.cpp --- a/upnpsettings/upnpgsplugin/src/upnpappsettingitemhomeiap.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,616 +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: Implements home network IAP setting item class to home -* network setting item list. -* -*/ - - - - - - - -// INCLUDE FILES -// System -#include // stringloader -#include // caknmessagequerydialog -#include // caknradiobuttonsettingpage -#include // wlan_service -#include // twlanssid -#include // rgenconagentdialogserver -#include // cakninformationnote -#include -#include -#include //CCommsDatabase -#include "upnpavcontrollerfactory.h" -#include "upnpsettingsengine.h" -#include "upnpsettingsengine.hrh" - -// internal -#include "upnpappsettingitemhomeiap.h" -#include "upnpappsettingslist.h" // ewlanunsecured -#include "upnpfilesharingengine.h" // cupnpfilesharingengine - -#include - -_LIT( KComponentLogfile, "upnpgsplugin.txt"); -#include "upnplog.h" - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::NewL() -// -------------------------------------------------------------------------- -// -UPnPAppSettingItemHomeIAP* UPnPAppSettingItemHomeIAP::NewL( - TInt aIdentifier, - TInt& aIAPSetting, - TInt& aIAPId, - TInt& aWAPId, - TBool& aSharingState ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - UPnPAppSettingItemHomeIAP* self = new (ELeave) UPnPAppSettingItemHomeIAP( - aIdentifier, - aIAPSetting, - aIAPId, - aWAPId, - aSharingState ); - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return self; - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::UPnPAppSettingItemHomeIAP() -// -------------------------------------------------------------------------- -// -UPnPAppSettingItemHomeIAP::UPnPAppSettingItemHomeIAP( - TInt aIdentifier, - TInt& aIAPSetting, - TInt& aIAPId, - TInt& aWAPId, - TBool& aSharingState ) : - CAknEnumeratedTextPopupSettingItem(aIdentifier, aIAPSetting), - iIAPSetting(aIAPSetting), - iIAPId(aIAPId), - iWAPId(aWAPId), - iSharingState( aSharingState ) - { - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::ConstructL() -// -------------------------------------------------------------------------- -// -void UPnPAppSettingItemHomeIAP::ConstructL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iCoeEnv = CCoeEnv::Static(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::~UPnPAppSettingItemHomeIAP() -// -------------------------------------------------------------------------- -// -UPnPAppSettingItemHomeIAP::~UPnPAppSettingItemHomeIAP() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - delete iItemText; - delete iIAPName; - - iIAPIdArray.Close(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingPageHomeIAP::CreateAndExecuteSettingPageL () -// -------------------------------------------------------------------------- -// -void UPnPAppSettingItemHomeIAP::CreateAndExecuteSettingPageL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - // if sharing is on, only information note is displayed - UPnPAVControllerFactory::TAVControllerServerStatus status; - UPnPAVControllerFactory::Status( status ); - if ( iSharingState || status == UPnPAVControllerFactory::EStatusActive ) - { - CAknInformationNote* note = new (ELeave) CAknInformationNote; - HBufC* noteText = iCoeEnv->AllocReadResourceLC( - R_QTN_IUPNP_IAP_TURN_SHARING_OFF); - note->ExecuteLD(*noteText); - CleanupStack::PopAndDestroy(noteText); - return; - } - - // Resets the member array for iap ids. - // Creates new array for iap names. - iIAPIdArray.Reset(); - CDesCArray* array = new (ELeave) CDesCArrayFlat(5); - CleanupStack::PushL(array); - - // adds static setting page items from resource - // and stores the number of static items. - AddStaticItemsL(array); - TInt staticItemCount = array->Count(); - - // adds wlan access points, array GETS the ownership - CUPnPSettingsEngine::GetWLANAccessPointsL( array, iIAPIdArray ); - - MAknQueryValue* qValue = QueryValue(); - User::LeaveIfNull(qValue); - LoadL(); - StoreL(); - - TInt idx = GetIAPIndex( staticItemCount ); - if ( idx >= array->MdcaCount() ) - { - idx = array->MdcaCount() - 1; - } - // setting page is launched - CAknSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage( - SettingPageResourceId(), - idx, - array); - - if (dlg->ExecuteLD()) - { - switch (idx) - { - case EUPnPSettingsEngineIAPItemNone: - { - DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT, - R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT, - R_HOMECONNECT_INFO_QUERY); - qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemNone); - iIAPId = EUPnPSettingsEngineIAPIdNone; - iIAPSetting = EUPnPSettingsEngineIAPItemNone; - break; - } - case EUPnPSettingsEngineIAPItemAlwaysAsk: - { - qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemAlwaysAsk); - iIAPId = EUPnPSettingsEngineIAPIdAlwaysAsk; - iIAPSetting = EUPnPSettingsEngineIAPItemAlwaysAsk; - DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT, - R_IBU_GALLERY_UPDATE_NOTE_TEXT, - R_HOMECONNECT_INFO_QUERY); - break; - } - case EUPnPSettingsEngineIAPItemUserDefined: // Create new - { - // new iap wlan iap creation is started here - - TInt old_iap = iIAPId; - - CUPnPSettingsEngine::CreateAccessPointL(); - - //We have to re-get all the wlan iaps again since - //user may modify the iap list - RArray newArray; - CleanupClosePushL( newArray ); - - //We only are interested in the iap ids - CUPnPSettingsEngine::GetWLANAccessPointsL( - NULL, - newArray ); - - if( newArray.Count() <= 0 ) //if no iap exisits - { - //if previous iap is not "None" or "Always ask" - if( old_iap > EUPnPSettingsEngineIAPIdAlwaysAsk ) - { - DisplayInfoL( - R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT, - R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT, - R_HOMECONNECT_INFO_QUERY); - iIAPId = EUPnPSettingsEngineIAPIdNone; - - qValue->SetCurrentValueIndex( - EUPnPSettingsEngineIAPItemNone ); - iIAPSetting = EUPnPSettingsEngineIAPItemNone; - } - iIAPIdArray.Reset(); - CleanupStack::PopAndDestroy( &newArray ); - } - else - { - TBool newiap = ETrue; - TInt lastItemIndex = newArray.Count() - 1; - //if the last item on the new iap list - //is found in the old iap array - //then we think no new iap is created - for( TInt i = 0; i < iIAPIdArray.Count(); i++ ) - { - if( newArray[lastItemIndex] == iIAPIdArray[i] ) - { - newiap = EFalse; - i = iIAPIdArray.Count(); - } - } - - //get the new iap list - iIAPIdArray.Reset(); - for( TInt i = 0; i < newArray.Count(); i++ ) - { - iIAPIdArray.AppendL( newArray[i] ); - } - CleanupStack::PopAndDestroy( &newArray ); - - if( newiap ) - { - iIAPId = iIAPIdArray[lastItemIndex];//get new iap - iIAPSetting = - EUPnPSettingsEngineIAPItemUserDefined; - // show confirmation note if connection is - // unsecured, the database store the value of - // the securitymode,such as EOpen,EWep,E802_1x, - // EWpa,if select other securitymode except - // EOpen, the return value of the - // CheckAPSecurityL fuction is not EWLanUnsecured - if ( CheckAPSecurityL(iIAPId) == EWLanUnsecured ) - { - CAknQueryDialog* dlg = - CAknQueryDialog::NewL(); - if (!(dlg->ExecuteLD( - R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY))) - { - //user cancels the dialog - UsePreviousIapL( old_iap ); - } - } - else - { - // show 'Sharing Changed' note ( None -> sharing) - if(old_iap == EUPnPSettingsEngineIAPIdNone && - iIAPId != old_iap ) - { - DisplayInfoL( - R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT, - R_IBU_GALLERY_UPDATE_NOTE_TEXT, - R_HOMECONNECT_INFO_QUERY); - } - } - } - else - { - UsePreviousIapL(old_iap); - } //if( newiap ) - } //if( newArray.Count() <= 0 ) - break; - } - default: // Predefined iap is selected - { - TInt index; - TInt old_iap = iIAPId; - TBool iapchange = EFalse; - // iap id is set - if ( idx - staticItemCount >= 0 ) - { - index = idx - staticItemCount; - if (CheckAPSecurityL(iIAPIdArray[index]) == - EWLanUnsecured) - { - // show confirmation note if connection is unsecured - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if (dlg->ExecuteLD( - R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY)) - { - //if "Continue" - iapchange = ETrue; - } - } - else - { - iapchange = ETrue; - } - - if( iapchange ) - { - iIAPSetting = EUPnPSettingsEngineIAPItemUserDefined; - iIAPId = iIAPIdArray[index]; - qValue->SetCurrentValueIndex( - EUPnPSettingsEngineIAPItemUserDefined); - - // if previous iap was 'None' and current iap - // is not 'None' - if ( old_iap == EUPnPSettingsEngineIAPIdNone && - iIAPId != old_iap ) - { - DisplayInfoL( - R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT, - R_IBU_GALLERY_UPDATE_NOTE_TEXT, - R_HOMECONNECT_INFO_QUERY); - } - } - } - break; - } - } - } - LoadL(); - StoreL(); - - CleanupStack::PopAndDestroy(array); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::ChangeIAPNameL() -// -------------------------------------------------------------------------- -// -void UPnPAppSettingItemHomeIAP::ChangeIAPNameL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - delete iIAPName; - iIAPName = NULL; - - iIAPName = CUPnPSettingsEngine::GetCurrentIapNameL( iIAPId ); - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::CheckAPSecurity -// Checks if selected access point is unsecured and shows warning note -// -------------------------------------------------------------------------- -// -TInt UPnPAppSettingItemHomeIAP::CheckAPSecurityL(TInt aAccessPoint) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - TUint32 serviceId = 0; - TUint32 securityMode = 0; - - CCommsDatabase* db = CCommsDatabase::NewL( EDatabaseTypeIAP ); - CleanupStack::PushL( db ); - - CCommsDbTableView* view = db->OpenViewMatchingUintLC(TPtrC(IAP), - TPtrC(COMMDB_ID), aAccessPoint); - - TInt error = view->GotoFirstRecord(); - - if( error == KErrNone ) - { - view->ReadUintL(TPtrC(IAP_SERVICE), serviceId); - } - - CCommsDbTableView* wLanServiceTable = NULL; - - TRAPD(err, - {// this leaves if the table is empty.... - wLanServiceTable = db->OpenViewMatchingUintLC( - TPtrC( WLAN_SERVICE ), - TPtrC( WLAN_SERVICE_ID ), - serviceId ); - CleanupStack::Pop( wLanServiceTable ); - }); - - if ( err == KErrNone ) - { - CleanupStack::PushL( wLanServiceTable ); - - TInt errorCode = wLanServiceTable->GotoFirstRecord(); - - if ( errorCode == KErrNone ) - {//read securityMode value - wLanServiceTable->ReadUintL(TPtrC( WLAN_SECURITY_MODE ), - securityMode ); - } - - CleanupStack::PopAndDestroy(wLanServiceTable); - } - - else if (err != KErrNotFound) - { - User::LeaveIfError(err); - } - - CleanupStack::PopAndDestroy(2); // view, db - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - - return securityMode; - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::DisplayInfoL(); -// Shows message query to user -// -------------------------------------------------------------------------- -// -void UPnPAppSettingItemHomeIAP::DisplayInfoL(TInt aHeaderResourceId, - TInt aMessageResourceId, - TInt aDialogResourceId) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - HBufC* noteHeader = StringLoader::LoadL( - aHeaderResourceId); - CleanupStack::PushL(noteHeader); - HBufC* noteMsg = StringLoader::LoadL( - aMessageResourceId); - CleanupStack::PushL(noteMsg); - - CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*noteMsg); - - dlg->PrepareLC(aDialogResourceId); - dlg->QueryHeading()->SetTextL(*noteHeader); - dlg->RunLD(); - - CleanupStack::PopAndDestroy(noteMsg); - CleanupStack::PopAndDestroy(noteHeader); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::SettingTextL() -// -------------------------------------------------------------------------- -// -const TDesC& UPnPAppSettingItemHomeIAP::SettingTextL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - delete iItemText; - iItemText = NULL; - LoadL(); - StoreL(); - - switch ( iIAPSetting ) - { - case EUPnPSettingsEngineIAPItemAlwaysAsk: - { - iItemText = iCoeEnv->AllocReadResourceL( - R_QTN_IUPNP_ITEM_HOME_IAP_ALWAYS_ASK ); - break; - } - case EUPnPSettingsEngineIAPItemUserDefined: - { - // changes iap name according to iap id - ChangeIAPNameL(); - - if ( !iIAPName ) - { - iItemText = iCoeEnv->AllocReadResourceL( - R_QTN_IUPNP_ITEM_HOME_IAP_USER_DEFINED ); - } - else - { - iItemText = iIAPName->AllocL(); - } - - break; - } - case EUPnPSettingsEngineIAPItemNone: - { - iItemText = iCoeEnv->AllocReadResourceL( - R_QTN_IUPNP_ITEM_HOME_IAP_NONE ); - break; - } - default: - { - break; - } - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return *iItemText; - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::AddStaticItemsL() -// -------------------------------------------------------------------------- -// -void UPnPAppSettingItemHomeIAP::AddStaticItemsL(CDesCArray* aArray) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - // None - HBufC* buf = iCoeEnv->AllocReadResourceLC( - R_QTN_IUPNP_HOME_IAP_NONE); - aArray->AppendL(*buf); - CleanupStack::PopAndDestroy(buf); // buf - buf = NULL; - - // Always ask - buf = iCoeEnv->AllocReadResourceLC( - R_QTN_IUPNP_HOME_IAP_ALWAYS_ASK); - aArray->AppendL(*buf); - CleanupStack::PopAndDestroy(buf); - buf = NULL; - - // Create new - buf = iCoeEnv->AllocReadResourceLC( - R_QTN_IUPNP_HOME_IAP_CREATE_NEW); - aArray->AppendL(*buf); - CleanupStack::PopAndDestroy(buf); - buf = NULL; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::UsePreviousIapL() -// -------------------------------------------------------------------------- -// -void UPnPAppSettingItemHomeIAP::UsePreviousIapL( TInt aOldIap ) - { - // dialog cancelled, using old iap value - iIAPId = aOldIap; - - if( iIAPId == EUPnPSettingsEngineIAPIdNone ) - { - iIAPSetting = EUPnPSettingsEngineIAPItemNone; - } - else if( iIAPId == EUPnPSettingsEngineIAPIdAlwaysAsk ) - { - iIAPSetting = EUPnPSettingsEngineIAPItemAlwaysAsk; - } - else //search for the old iap - { - TBool oldiapthere = EFalse; - for( TInt i = 0; i < iIAPIdArray.Count(); i++ ) - { - if( iIAPId == iIAPIdArray[i] ) - { - oldiapthere = ETrue; - i = iIAPIdArray.Count(); - } - } - if( !oldiapthere ) - { - iIAPId = EUPnPSettingsEngineIAPIdNone; - iIAPSetting = EUPnPSettingsEngineIAPItemNone; - DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT, - R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT, - R_HOMECONNECT_INFO_QUERY); - } - else - { - iIAPSetting = EUPnPSettingsEngineIAPItemUserDefined; - } - } - } - -// -------------------------------------------------------------------------- -// UPnPAppSettingItemHomeIAP::GetIAPIndex() -// -------------------------------------------------------------------------- -// -TInt UPnPAppSettingItemHomeIAP::GetIAPIndex( TInt aStaticCount ) - { - __LOG("GetIAPIndex"); - TInt iapIndex = KErrNotFound; - if( iIAPId == EUPnPSettingsEngineIAPIdNone ) //NONE - { - iapIndex = EUPnPSettingsEngineIAPItemNone; - } - else if( iIAPId == EUPnPSettingsEngineIAPIdAlwaysAsk ) //ALWAYS ASK - { - iapIndex = EUPnPSettingsEngineIAPItemAlwaysAsk; - } - else //pre-defined iap, index should never be Create New - { - iapIndex+=aStaticCount; - for( TInt i = 0; i < iIAPIdArray.Count(); i++ ) - { - iapIndex++; - __LOG1("iap %d", iIAPIdArray[i] ); - if( iIAPId == iIAPIdArray[i] ) - { - i = iIAPIdArray.Count(); - } - } - } - - return iapIndex; - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/src/upnpappsettingitemmydevicename.cpp --- a/upnpsettings/upnpgsplugin/src/upnpappsettingitemmydevicename.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Implements home network my device name setting item class to -* home network setting item list. -* -*/ - - - - - - -// INCLUDE FILES -#include "upnpappsettingitemmydevicename.h" -#include // CAknInformationNote -#include - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// UPnPAppSettingItemMyDeviceName::NewL() -// --------------------------------------------------------- -// -UPnPAppSettingItemMyDeviceName* UPnPAppSettingItemMyDeviceName::NewL( - TInt aIdentifier, - TDes& aText, - TBool& aSharingState ) - { - UPnPAppSettingItemMyDeviceName* self = new (ELeave) - UPnPAppSettingItemMyDeviceName( - aIdentifier, - aText, - aSharingState ); - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// ---------------------------------------------------------------- -// UPnPAppSettingItemMyDeviceName::UPnPAppSettingItemMyDeviceName() -// ---------------------------------------------------------------- -// -UPnPAppSettingItemMyDeviceName::UPnPAppSettingItemMyDeviceName( - TInt aIdentifier, - TDes& aText, - TBool& aSharingState ) : - CAknTextSettingItem(aIdentifier, aText), - iSharingState( aSharingState ) - { - } - -// --------------------------------------------------------- -// UPnPAppSettingItemMyDeviceName::ConstructL() -// --------------------------------------------------------- -// -void UPnPAppSettingItemMyDeviceName::ConstructL() - { - } - -// ----------------------------------------------------------------- -// UPnPAppSettingItemMyDeviceName::~UPnPAppSettingItemMyDeviceName() -// ----------------------------------------------------------------- -// -UPnPAppSettingItemMyDeviceName::~UPnPAppSettingItemMyDeviceName() - { - } - -// --------------------------------------------------------- -// UPnPAppSettingItemMyDeviceName::EditItemL() -// --------------------------------------------------------- -// -void UPnPAppSettingItemMyDeviceName::EditItemL(TBool aCalledFromMenu) - { - - // if sharing is on, only information note is displayed - if ( iSharingState ) - { - CAknInformationNote* note = new (ELeave) - CAknInformationNote; - HBufC* noteText = CCoeEnv::Static()->AllocReadResourceLC( - R_QTN_IUPNP_IAP_TURN_SHARING_OFF); - note->ExecuteLD(*noteText); - CleanupStack::PopAndDestroy(noteText); - } - else - { - // normal behaviour - CAknTextSettingItem::EditItemL(aCalledFromMenu); - } - - } - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/src/upnpappsettingslist.cpp --- a/upnpsettings/upnpgsplugin/src/upnpappsettingslist.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,327 +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: Setting list implementation for upnp GS plugin -* -*/ - - - - - - -// INCLUDE FILES -#include // CAknInformationNote -#include -#include - -#include "upnpsettingsengine.h" -#include "upnpsettingsengine.hrh" - -#include "upnpgsplugin.hrh" -#include "upnpappsettingslist.h" -#include "upnpappsettingitemhomeiap.h" -#include "upnpappsettingitemmydevicename.h" -#include - -#include -#include -#include "upnpsettingitemmemoryselection.h" - -_LIT( KComponentLogfile, "upnpgsplugin.txt"); -#include "upnplog.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::CUPnPAppSettingsList -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPAppSettingsList::CUPnPAppSettingsList( TBool& aSharingState ) - : iSharingState( aSharingState ) - { - __LOG("[gsplugin]\tCUPnPAppSettingsList::CUPnPAppSettingsList"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAppSettingsList::ConstructL( TInt aResourceId ) - { - __LOG("[gsplugin]\t CUPnPAppSettingsList::ConstructL"); - - iName = HBufC8::NewL( KMaxFriendlyNameLength ); - - iSettingsEngine = CUPnPSettingsEngine::NewL(); - - if( aResourceId != 0 ) - { - CAknSettingItemList::ConstructFromResourceL( aResourceId ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPAppSettingsList* CUPnPAppSettingsList::NewL( TBool& aSharingState, - TInt aResourceId ) - { - __LOG("[gsplugin]\t CUPnPAppSettingsList::NewL"); - - CUPnPAppSettingsList* self = new (ELeave) CUPnPAppSettingsList( - aSharingState ); - CleanupStack::PushL(self); - self->ConstructL( aResourceId ); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::~CUPnPAppSettingsList -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPAppSettingsList::~CUPnPAppSettingsList() - { - __LOG("[gsplugin]\t CUPnPAppSettingsList:: \ - ~CUPnPAppSettingsList"); - delete iName; - delete iSettingsEngine; - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::CreateSettingItemL -// Creates list items -// -------------------------------------------------------------------------- -// -CAknSettingItem* CUPnPAppSettingsList::CreateSettingItemL( TInt aIdentifier ) - { - __LOG("[gsplugin]\t CUPnPAppSettingsList::CreateSettingItemL"); - - LoadSettingsL(); - - CAknSettingItem* settingItem = NULL; - switch (aIdentifier) - { - case EUPnPGSPluginItemIAP: - { - settingItem = UPnPAppSettingItemHomeIAP::NewL( - aIdentifier, - iIapSetting, iIapId, - iWapId, - iSharingState ); - break; - } - case EUPnPGSPluginItemMyDeviceName: - { - settingItem = UPnPAppSettingItemMyDeviceName::NewL( - aIdentifier, - iFriendlyName, - iSharingState ); - break; - } - case EUPnPGSPluginItemCopyLocation: - { - settingItem = CUPnPSettingItemMemorySelection::NewL( - aIdentifier, iCopyLocationDrive); - } - break; - - default: - { - __LOG("[gsplugin]\t CUPnPAppSettingsList:: \ - CreateSettingItemL No such item!"); - break; - } - } - - return settingItem; - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::EditItemL -// Called when setting list item is modified -// -------------------------------------------------------------------------- -// -void CUPnPAppSettingsList::EditItemL (TInt aIndex, TBool aCalledFromMenu) - { - __LOG("[gsplugin]\t CUPnPAppSettingsList::EditItemL"); - - // Validates the access point. - TBool validiap = EFalse; - TRAPD(err, validiap = CUPnPSettingsEngine::IsAccessPointValidL( iIapId ) ); - if( err || !validiap ) - { - iIapId = EUPnPSettingsEngineIAPIdNone; - iIapSetting = EUPnPSettingsEngineIAPItemNone; - iWapId = EUPnPSettingsEngineIAPItemNone; - } - - if ( aIndex != EUPnPGSPluginItemCopyLocation ) - { - CAknSettingItemList::EditItemL (aIndex, aCalledFromMenu); - } - - StoreSettingsL(); - - switch (aIndex) - { - case EUPnPGSPluginItemIAP: - { - // if sharing is on, nothing is done - if ( !iSharingState ) - { - iSettingsEngine->SetAccessPoint(iIapId); - iSettingsEngine->SetAccessPointSetting(iIapSetting); - iSettingsEngine->SetWapId(iWapId); - } - break; - } - case EUPnPGSPluginItemMyDeviceName: - { - // if sharing is on, nothing is done - if ( !iSharingState ) - { - HBufC8* tmpStr = NULL; - tmpStr = UpnpString::FromUnicodeL( iFriendlyName ); - CleanupStack::PushL( tmpStr ); - - User::LeaveIfError( - iSettingsEngine->SetLocalFriendlyName( tmpStr->Des() )); - CleanupStack::PopAndDestroy( tmpStr ); - } - break; - } - case EUPnPGSPluginItemCopyLocation: - { - // if sharing is on, nothing is done - if ( !iSharingState ) - { - CAknSettingItemList::EditItemL ( aIndex, aCalledFromMenu ); - StoreSettingsL(); - iSettingsEngine->SetCopyLocationL( iCopyLocationDrive ); - } - else - { - CAknInformationNote* note = new (ELeave) - CAknInformationNote; - HBufC* noteText = CCoeEnv::Static()->AllocReadResourceLC( - R_QTN_IUPNP_IAP_TURN_SHARING_OFF); - note->ExecuteLD(*noteText); - CleanupStack::PopAndDestroy(noteText); - } - - break; - } - default: - { - __LOG("[gsplugin]\t CUPnPAppSettingsList::EditItemL \ - No such item!"); - break; - } - } - StoreSettingsL(); - // load settings to screen - CAknSettingItemList::LoadSettingsL (); - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::LoadDataFromEngineL -// Loads data from Central Repository to member variables -// (other items were commented in a header). -// -------------------------------------------------------------------------- -// -void CUPnPAppSettingsList::LoadDataFromEngineL() - { - __LOG("[gsplugin]\t CUPnPAppSettingsList::\ - LoadDataFromEngineL begin"); - - // Get friendly name - TPtr8 ptr( iName->Des() ); - iSettingsEngine->GetLocalFriendlyName( ptr ); - - HBufC* unicodeFriendlyName = UpnpString::ToUnicodeL( ptr ); - CleanupStack::PushL( unicodeFriendlyName ); - iFriendlyName.Copy( unicodeFriendlyName->Des() ); - CleanupStack::PopAndDestroy( unicodeFriendlyName ); - - iSettingsEngine->GetAccessPoint( iIapId ); - iSettingsEngine->GetAccessPointSetting(iIapSetting); - - iSettingsEngine->GetWapId(iWapId); - - TInt error( KErrNone ); - - TRAP(error, iSettingsEngine->GetCopyLocationDriveL( iCopyLocationDrive ) ) - - // Something wrong in getting copy location. It defaults to - // drive C and hopes that setting copy location succeeds - if( error != KErrNone ) - { - iCopyLocationDrive = EDriveC; - } - - // check if the IAP id is valid - if ( !CUPnPSettingsEngine::IsAccessPointValidL( iIapId ) ) - { - // Resets all variables related to iap. - iIapId = EUPnPSettingsEngineIAPIdNone; - iIapSetting = EUPnPSettingsEngineIAPItemNone; - iWapId = EUPnPSettingsEngineIAPItemNone; - - // set iap id - iSettingsEngine->SetAccessPoint( iIapId ); - // set iap UI setting - iSettingsEngine->SetAccessPointSetting( iIapSetting ); - // set iap wap id (needed for focus in iap selection component) - iSettingsEngine->SetWapId( iWapId ); - } - - //load settings to screen - CAknSettingItemList::LoadSettingsL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsList::HandleResourceChange -// -------------------------------------------------------------------------- -// -void CUPnPAppSettingsList::HandleResourceChange( TInt aType ) - { - __LOG("[gsplugin]\t CUPnPAppSettingsList::\ -HandleResourceChange"); - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EMainPane, mainPaneRect ); - - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( - TRect( TPoint( 0, 0 ), mainPaneRect.Size() ), - AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); - - ListBox()->SetRect( layoutRect.Rect() ); - } - - // Base call - CAknSettingItemList::HandleResourceChange( aType ); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/src/upnpgspluginimplementationtable.cpp --- a/upnpsettings/upnpgsplugin/src/upnpgspluginimplementationtable.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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: ECOM proxy table for GSDataCallPlugin -* -*/ - - - - - - -// INCLUDES -#include "upnpgspluginview.h" -#include "upnpgsplugin.hrh" - -#include -#include - -_LIT( KComponentLogfile, "upnpgsplugin.txt"); -#include "upnplog.h" - -// CONSTANTS -const TImplementationProxy KUPnPGSPluginImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( - KUPnPGSPluginImplementationUid, - CUPnPGSPluginView::NewL ) - }; - - -// --------------------------------------------------------------------------- -// ImplementationGroupProxy -// -// Gate/factory function -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - __LOG( "CUPnPGSPluginView::ImplementationGroupProxy" ); - aTableCount = sizeof( KUPnPGSPluginImplementationTable ) - / sizeof( TImplementationProxy ); - __LOG( "CUPnPGSPluginView::ImplementationGroupProxy-end" ); - return KUPnPGSPluginImplementationTable; - } - - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/src/upnpgspluginview.cpp --- a/upnpsettings/upnpgsplugin/src/upnpgspluginview.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,352 +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: CUPnPGSPluginView class implementation -* -*/ - - - - - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "upnpappsettingslist.h" -#include "upnpfilesharingengine.h" -#include "upnpgsplugin.hrh" -#include "upnpgspluginview.h" -#include "upnpsettingsengine.h" - -_LIT( KComponentLogfile, "upnpgsplugin.txt"); -#include "upnplog.h" - -// CONSTANTS -const TUid KUPnPGSPluginImpUid = { KUPnPGSPluginImplementationUid }; - -_LIT( KUPnPGSPluginRscFile, "\\resource\\upnpgspluginrsc.rsc" ); -_LIT( KAknHomeConnectMbmFileName, "\\resource\\apps\\upnpgspluginrsc.mif" ); - -// ======== MEMBER FUNCTIONS ======== - -// -------------------------------------------------------------------------- -// Two phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPGSPluginView* CUPnPGSPluginView::NewL() - { - CUPnPGSPluginView* self = new ( ELeave ) CUPnPGSPluginView(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::CUPnPGSPluginView() -// -------------------------------------------------------------------------- -// -CUPnPGSPluginView::CUPnPGSPluginView() - { - __LOG("CUPnPGSPluginView::CUPnPGSPluginView"); - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::ConstructL() -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::ConstructL() - { - __LOG( "CUPnPGSPlugin::ConstructL" ); - // Get the pointer to coe env (owned by Eikon env) - iCoeEnv = CEikonEnv::Static(); - - if( !iCoeEnv ) - { - User::Leave( KErrNotSupported ); - } - - // Get the filesession reference from coe env - RFs& fileSession = iCoeEnv->FsSession(); - - // Load resource file - TFileName rscFileName( KUPnPGSPluginRscFile ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - rscFileName.Insert( 0, drive ); - - // Get the exact filename of the resource file - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - - // Check if the resource file exists or not - if ( !BaflUtils::FileExists( fileSession, rscFileName ) ) - { - __LOG( "[UpnpCommand]\t Resource file does not exist!" ); - User::Leave( KErrNotFound ); - } - - // Read the resource file offset - iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ); - - BaseConstructL( R_GS_UPNP_VIEW ); - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::~CUPnPGSPluginView() -// -------------------------------------------------------------------------- -// -CUPnPGSPluginView::~CUPnPGSPluginView() - { - __LOG("CMSMainView::~CUPnPGSPluginView"); - - if ( iResFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResFileOffset ); - } - - DoDeactivate(); - } - -// -------------------------------------------------------------------------- -// TUid CUPnPGSPluginView::Id() -// -------------------------------------------------------------------------- -// -TUid CUPnPGSPluginView::Id() const - { - __LOG("CUPnPGSPluginView::Id"); - - return KUPnPGSPluginImpUid; - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::HandleCommandL(TInt aCommand) -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::HandleCommandL( TInt aCommand ) - { - switch ( aCommand ) - { - - case EAknSoftkeyChange: - { - TInt selectedItem = - iSettingItemList->ListBox()->CurrentItemIndex(); - iSettingItemList->EditItemL(selectedItem, ETrue); - - // fix ESLX-7LYLR7 - iSettingItemList->DrawNow(); - break; - } - case EAknSoftkeyBack: - { - AppUi()->ActivateLocalViewL( iViewToClose.iViewUid ); - break; - } - case EAknCmdHelp : - { - TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() )); - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::DoActivateL(...) -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::DoActivateL( - const TVwsViewId& aPrevViewId, TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - __LOG("CUPnPGSPluginView::DoActivateL"); - - iViewToClose = aPrevViewId; - - // Set title pane text to default - SetTitlePaneTextL( R_UPNP_GS_SETTINGS_VIEW_TITLE ); - - if( !iFileSharing ) - { - iFileSharing = CUPnPFileSharingEngine::NewL(); - iFileSharing->SetObserver( this ); - } - - if ( !iSettingItemList ) - { - iSharingState = static_cast( iFileSharing->SharingStateL() ); - // create settings screen - iSettingItemList = - CUPnPAppSettingsList::NewL( iSharingState, - R_UPNP_GS_SETTINGS_LIST ); - iSettingItemList->SetMopParent( this ); - iSettingItemList->LoadDataFromEngineL(); - // now control receives keyboard events - AppUi()->AddToStackL( *this, iSettingItemList ); - iSettingItemList->ActivateL(); - } - - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::DoDeactivate() -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::DoDeactivate() - { - __LOG("CUPnPGSPluginView::DoDeactivate"); - - if( iFileSharing ) - { - iFileSharing->SetObserver( NULL ); - } - delete iFileSharing; - iFileSharing = NULL; - - if ( iSettingItemList ) - { - AppUi()->RemoveFromStack( iSettingItemList ); - } - - delete iSettingItemList; // Deletes the container class object. - iSettingItemList = NULL; - } - -// -------------------------------------------------------------------------- -// Method for getting caption of this plugin. -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::GetCaptionL( TDes& aCaption ) const - { - HBufC* pluginText = StringLoader::LoadLC( - R_UPNP_GS_SETTINGS_VIEW_CAPTION ); - aCaption.Copy( *pluginText ); - CleanupStack::PopAndDestroy( pluginText ); - } - -// -------------------------------------------------------------------------- -// Creates a new icon of desired type. -// -------------------------------------------------------------------------- -// -CGulIcon* CUPnPGSPluginView::CreateIconL( const TUid /*aIconType*/ ) - { - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - TFileName iconsPath( AknIconUtils::AvkonIconFileName() ); - - CFbsBitmap* bitmap = NULL; - CFbsBitmap* mask = NULL; - - AknsUtils::CreateIconLC( - skin, - KAknsIIDDefault, - bitmap, - mask, - KAknHomeConnectMbmFileName, - EMbmUpnpgspluginrscQgn_menu_upnp_homemedia, - EMbmUpnpgspluginrscQgn_menu_upnp_homemedia_mask ); - - CGulIcon* icon = CGulIcon::NewL(bitmap, mask); - CleanupStack::Pop(mask); - CleanupStack::Pop(bitmap); - bitmap = NULL; - mask = NULL; - - return icon; - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::SetTitlePaneTextL() -// Sets text to title pane. -// -------------------------------------------------------------------------- -void CUPnPGSPluginView::SetTitlePaneTextL( TInt aResourceId ) - { - // Fetches pointer to the default title pane control. - CAknTitlePane* titlePane = static_cast( - StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - - TBuf titleText( 0 ); - iCoeEnv->ReadResourceL( titleText, aResourceId ); - titlePane->SetTextL( titleText ); - } - -// -------------------------------------------------------------------------- -// CUPnPGSPlugin::DynInitMenuPaneL() -// -// dynamically handle help item if not supported -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - if( aResourceId == R_HOMECONNECT_SETTINGS_MENU ) - { - User::LeaveIfNull( aMenuPane ); - - if ( FeatureManager::FeatureSupported( KFeatureIdHelp )) - { - aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPGSPlugin::OnSharingStatusChanged -// From MUPnPFileSharingEngineObserver -// Function informs when file sharing was enabled or disabled -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::OnSharingStatusChanged( - TInt aError, TBool aEnabled ) - { - __LOG("CUPnPGSPlugin::OnSharingStatusChanged"); - if ( !aError ) - { - iSharingState = aEnabled; - } - } - -// -------------------------------------------------------------------------- -// CUPnPGSPluginView::OnSharingConnectionLost -// From MUPnPFileSharingEngineObserver -// Callback to inform if connection has been lost -// -------------------------------------------------------------------------- -// -void CUPnPGSPluginView::OnSharingConnectionLost() - { - iSharingState = EFalse; - } - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpgsplugin/src/upnpsettingitemmemoryselection.cpp --- a/upnpsettings/upnpgsplugin/src/upnpsettingitemmemoryselection.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2007 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: CUPnPSettingItemMemorySelection class implementation -* -*/ - - - - - - -#include -#include -#include -#include -#include - -#include "upnpsettingitemmemoryselection.h" - -_LIT( KComponentLogfile, "upnpgsplugin.txt"); -#include "upnplog.h" - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CUPnPSettingItemMemorySelection::NewL -// -------------------------------------------------------------------------- -// -CUPnPSettingItemMemorySelection* CUPnPSettingItemMemorySelection::NewL( - TInt aIdentifier, - TDriveNumber& aSelectedDrive ) - { - __LOG("[gsplugin]\t CUPnPSettingItemMemorySelection::NewL"); - - CUPnPSettingItemMemorySelection* self = - new (ELeave) CUPnPSettingItemMemorySelection( - aIdentifier, - aSelectedDrive ); - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPSettingItemMemorySelection::ConstructL -// -------------------------------------------------------------------------- -// -void CUPnPSettingItemMemorySelection::ConstructL() - { - __LOG("[gsplugin]\t\ -CUPnPSettingItemMemorySelection::ConstructL"); - - } - -// -------------------------------------------------------------------------- -// CUPnPSettingItemMemorySelection::~CUPnPSettingItemMemorySelection() -// -------------------------------------------------------------------------- -// -CUPnPSettingItemMemorySelection::~CUPnPSettingItemMemorySelection() - { - __LOG("[gsplugin]\t\ -CUPnPSettingItemMemorySelection::~CUPnPSettingItemMemorySelection"); - - } - -// -------------------------------------------------------------------------- -// CUPnPSettingItemMemorySelection::EditItemL( TBool aCalledFromMenu ) -// -------------------------------------------------------------------------- -// -void CUPnPSettingItemMemorySelection::EditItemL( TBool /*aCalledFromMenu*/ ) - { - __LOG("[gsplugin]\t CUPnPSettingItemMemorySelection::EditItemL"); - - CAknMemorySelectionDialogMultiDrive* dlg = - CAknMemorySelectionDialogMultiDrive::NewL( - ECFDDialogTypeNormal, - 0, - EFalse, - AknCommonDialogsDynMem::EMemoryTypePhone | - AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage | - AknCommonDialogsDynMem::EMemoryTypeMMCExternal - ); - - CleanupStack::PushL(dlg); - - if (dlg->ExecuteL(iInternalData)) - { - // Call CAknMemorySelectionSettingItemMultiDrive::StoreL() - StoreL(); - } - - CleanupStack::PopAndDestroy(dlg); - - } - -// -------------------------------------------------------------------------- -// CUPnPSettingItemMemorySelection::CUPnPSettingItemMemorySelection -// -------------------------------------------------------------------------- -// -CUPnPSettingItemMemorySelection::CUPnPSettingItemMemorySelection( - TInt aIdentifier, - TDriveNumber& aSelectedDrive//, - ) : - CAknMemorySelectionSettingItemMultiDrive( aIdentifier, aSelectedDrive ) - { - } - - -// End of File - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/BWINS/upnpsharinguiu.def --- a/upnpsettings/upnpsharingui/BWINS/upnpsharinguiu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - ?ExecuteSharingDialogLD@CUPnPAppFileSharingDialog@@QAEHXZ @ 1 NONAME ; int CUPnPAppFileSharingDialog::ExecuteSharingDialogLD(void) - ?NewL@CUPnPAppFileSharingDialog@@SAPAV1@HAAVCUPnPFileSharingEngine@@@Z @ 2 NONAME ; class CUPnPAppFileSharingDialog * CUPnPAppFileSharingDialog::NewL(int, class CUPnPFileSharingEngine &) - ?UpdateFileSharingListL@CUPnPAppFileSharingDialog@@QAEXXZ @ 3 NONAME ; void CUPnPAppFileSharingDialog::UpdateFileSharingListL(void) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/EABI/upnpsharinguiu.def --- a/upnpsettings/upnpsharingui/EABI/upnpsharinguiu.def Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - _ZN25CUPnPAppFileSharingDialog4NewLEiR22CUPnPFileSharingEngine @ 1 NONAME - _ZTI25CUPnPAppFileSharingDialog @ 2 NONAME ; ## - _ZTV25CUPnPAppFileSharingDialog @ 3 NONAME ; ## - _ZN25CUPnPAppFileSharingDialog22ExecuteSharingDialogLDEv @ 4 NONAME - _ZN25CUPnPAppFileSharingDialog22UpdateFileSharingListLEv @ 5 NONAME - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/data/upnpsharingui.rss --- a/upnpsettings/upnpsharingui/data/upnpsharingui.rss Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,449 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: Resource definitions for project Home Network -* -*/ - - - - - - - -// RESOURCE IDENTIFIER -NAME SHUI // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include // CommonDialogs Enumerations -#include // CommonDialogs Resource structures -#include - -#include "upnpsharingui.hrh" - - -// RESOURCE DEFINITIONS - -// -------------------------------------------------------------------------- -// RSS_SIGNATURE -// Mandatory utility struct in resource file. Used by UIKON internally. -// -------------------------------------------------------------------------- -RESOURCE RSS_SIGNATURE - { - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_title_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_sharingui_title_text - { - buf = qtn_iupnp_title_share; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_softkeys_options_back__change -// -//---------------------------------------------------------------------------- -// -RESOURCE CBA r_sharingui_softkeys_options_back__change - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyChange; txt= qtn_msk_change; } - }; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_menubar -// -//---------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_sharingui_menubar - { - titles = - { - MENU_TITLE { menu_pane = r_sharingui_menu;} - }; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_menu -// -//---------------------------------------------------------------------------- - -RESOURCE MENU_PANE r_sharingui_menu - { - items = - { - MENU_ITEM - { - command = ESharingUiCmdAppChange; - txt = qtn_options_change; - }, - MENU_ITEM - { - command = ESharingUiCmdRefresh; - txt = qtn_iupnp_options_update_content; - }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - - -//---------------------------------------------------------------------------- -// -// r_sharingui_dialog -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sharingui_dialog - { - title = qtn_iupnp_title_share; - flags = EAknDialogSelectionList; - buttons = r_sharingui_softkeys_options_back__change; - items = - { - DLG_LINE - { - type = KAknCtLastControlId; - id = ESharingUiListBoxId; - control = AVKON_SETTING_ITEM_LIST - { - flags = EAknSettingItemIncludeHiddenInOrdinal; - initial_number = 1; - items = - { - AVKON_SETTING_ITEM - { - identifier = ESharingUiSettingItemVisibility; - associated_resource = r_sharingui_visibility_popup_texts; - name = qtn_iupnp_set_sharing; - }, - AVKON_SETTING_ITEM - { - identifier = ESharingUiSettingItemVisual; - name = qtn_iupnp_visual_albums; - }, - AVKON_SETTING_ITEM - { - identifier = ESharingUiSettingItemMusic; - name = qtn_iupnp_music_pl; - } - }; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_visibility_editor -// -//---------------------------------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_sharingui_visibility_editor - { - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_visibility_popup_texts -// -//---------------------------------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_sharingui_visibility_popup_texts - { - setting_texts_resource = r_sharingui_visibility_on_off_texts; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_visibility_on_off_texts -// -//---------------------------------------------------------------------------- -// -RESOURCE ARRAY r_sharingui_visibility_on_off_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = ESharingUiVisibilityOn; - text = qtn_iupnp_set_sharing_on; - }, - AVKON_ENUMERATED_TEXT - { - value = ESharingUiVisibilityOff; - text = qtn_iupnp_set_sharing_off; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_starting_file_sharing_note_dialog -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sharingui_starting_file_sharing_note_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_iupnp_wait_sharing; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_stopping_file_sharing_note_dialog -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sharingui_stopping_file_sharing_note_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_iupnp_wait_sharing_off; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -//---------------------------------------------------------------------------- -// -// r_visual_albums_share_nothing_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_visual_albums_share_nothing_text - { - buf = qtn_iupnp_visual_nothing; - } - - -//---------------------------------------------------------------------------- -// -// r_visual_albums_share_one_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_visual_albums_share_one_text - { - buf = qtn_iupnp_visual_one; - } - - -//---------------------------------------------------------------------------- -// -// r_visual_albums_share_many_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_visual_albums_share_many_text - { - buf = qtn_iupnp_visual_many; - } - - -//---------------------------------------------------------------------------- -// -// r_music_share_nothing_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_music_share_nothing_text - { - buf = qtn_iupnp_music_nothing; - } - - -//---------------------------------------------------------------------------- -// -// r_music_share_one_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_music_share_one_text - { - buf = qtn_iupnp_music_one; - } - - -//---------------------------------------------------------------------------- -// -// r_music_share_many_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_music_share_many_text - { - buf = qtn_iupnp_music_many; - } - -//---------------------------------------------------------------------------- -// -// r_settings_start_sharing_phone_error_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_settings_start_sharing_phone_error_text - { - buf = qtn_memlo_not_enough_device_memory; - } - -//---------------------------------------------------------------------------- -// -// r_settings_start_sharing_error_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_settings_start_sharing_error_text - { - buf = qtn_iupnp_start_sharing_error; - } - -// -------------------------------------------------------------------------- -// -// r_upnp_phone_visible_text -// -// -------------------------------------------------------------------------- -RESOURCE TBUF r_upnp_phone_hidden_text - { - buf = qtn_iupnp_phone_hidden; - } - -// -------------------------------------------------------------------------- -// -// r_upnp_phone_visible_text -// -// -------------------------------------------------------------------------- -RESOURCE TBUF r_upnp_phone_visible_text - { - buf = qtn_iupnp_phone_visible; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_info_query -// -//---------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sharingui_info_query -{ - flags = EGeneralQueryFlags | EEikDialogFlagNoTitleBar | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; -} - -//---------------------------------------------------------------------------- -// -// r_sharingui_updating_content_header -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_sharingui_updating_content_header - { - buf = qtn_iupnp_updating_content_header; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_updating_content_note_text -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_sharingui_updating_content_note_text - { - buf = qtn_iupnp_wait_updating_content; - } - -//---------------------------------------------------------------------------- -// -// r_sharingui_secondary_in_progress -// -//---------------------------------------------------------------------------- -// -RESOURCE TBUF r_sharingui_secondary_in_progress - { - buf = qtn_iupnp_updating_progress; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/group/bld.inf --- a/upnpsettings/upnpsharingui/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +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 information file for sharing UI component -* -*/ - - - - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// ADO internal interfaces -../inc/upnpappfilesharingdialog.h |../../../inc/upnpappfilesharingdialog.h - -PRJ_MMPFILES -upnpsharingui.mmp - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/group/upnpsharingui.mmp --- a/upnpsettings/upnpsharingui/group/upnpsharingui.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2005-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: Project definition file for sharing UI component -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../../group/upnpplatformvar.hrh" -#include - -TARGET upnpsharingui.dll -TARGETTYPE dll -UID 0x100000D8 0x20009CAD - -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -// SIS installation + IAD support -VERSION 10.1 -paged - -// Include paths -APP_LAYER_SYSTEMINCLUDE -UPNP_LOC_INCLUDE_PATH_COMPONENT - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -START RESOURCE ../data/upnpsharingui.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -SOURCEPATH ../src - -SOURCE upnpappfilesharingdialog.cpp -SOURCE upnpappfilesharinglist.cpp - -//system -LIBRARY euser.lib // s60 basic -LIBRARY eikcore.lib // CEikEnv -LIBRARY ws32.lib // RWindowBase -LIBRARY cone.lib // CCoeControl -LIBRARY avkon.lib // basic ui -LIBRARY eikcoctl.lib // basic ui -LIBRARY eikctl.lib // basic ui -LIBRARY eikdlg.lib // eikon dialogs -LIBRARY eikcdlg.lib // progress dialog -LIBRARY CommonEngine.lib // string loader -LIBRARY featmgr.lib // FeatureManager -LIBRARY hlplch.lib // help launcher -LIBRARY CdlEngine.lib // CdlEngine -LIBRARY bafl.lib // BaflUtils - -// upnp framework -LIBRARY upnpsettingsengine.lib // settings engine -LIBRARY upnpmultiselectionui.lib // multiselectionui -LIBRARY upnpapplicationengine.lib // filesharingengine -LIBRARY upnpappwizard.lib // setup wizard - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/inc/upnpappfilesharingdialog.h --- a/upnpsettings/upnpsharingui/inc/upnpappfilesharingdialog.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +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: File sharing dialog class definition -* -*/ - - - - - - -#ifndef UPNPAPPFILESHARINGDIALOG_H -#define UPNPAPPFILESHARINGDIALOG_H - -// INCLUDES -#include // base class -#include "upnpfilesharingengineobserver.h" // base class - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; -class CEikMenuPane; -class CUPnPAppFileSharingList; -class CAknTitlePane; -class CEikStatusPane; - -// CLASS DECLARATION - -/** -* File Sharing dialog class. -* Declares file sharing dialog -* @since S60 3.1 -*/ -class CUPnPAppFileSharingDialog - : public CAknDialog - , private MUPnPFileSharingEngineObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CUPnPAppFileSharingDialog* NewL( - TInt aMenuResource, - CUPnPFileSharingEngine& aEng ); - - /** - * Destructor. - */ - virtual ~CUPnPAppFileSharingDialog(); - - public: // Services - - /** - * Executes the dialog. - */ - IMPORT_C TInt ExecuteSharingDialogLD(); - - /** - * Get the pointer of iFileSharingList and update list - */ - IMPORT_C void UpdateFileSharingListL() ; - - protected: // Functions from base classes - - /** - * From CAknDialog, handles menu commands - * @since S60 3.1 - * @param aCommandId, command to be handled - */ - void ProcessCommandL( TInt aCommandId ); - - /** - * From CAknDialog, handles key events. - * @since S60 3.1 - * @param aKeyEvent, Event to handled. - * @param aType, Type of the key event. - * @return TKeyResponse, response code - * (EKeyWasConsumed, EKeyWasNotConsumed). - */ - TKeyResponse OfferKeyEventL( const TKeyEvent &aKeyEvent, - TEventCode aType ); - - /** - * From CoeControl - * @since S60 3.1 - * @param aContext, context of desired help - */ - void GetHelpContext( TCoeHelpContext& aContext ) const; - - protected: // for own use - - /** - * Opens album selection dialog and starts sharing - * @since S60 3.1 - */ - void RunMultiselectionDialogL(); - - private: //From MUPnPFileSharingEngineObserver - /** - * Function informs when file sharing was enabled or disabled - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aError, error code - * @param aPhase ETrue if current phase is sharing activation, - * otherwise EFalse - */ - void HandleSharingStatus( - CUPnPFileSharingEngine& aEngine, - TInt aError, - TBool aPhase ); - - /** - * Informs about status of the sharing progress - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aProgress Data information about sharing progress - */ - void HandleSharingProgress( - CUPnPFileSharingEngine& aEngine, - const RArray& aProgress ); - - /** - * Function informs when file sharing is done - * @param aEngine File sharing engine - * @param aError, error code - */ - void HandleSharingDone( - CUPnPFileSharingEngine& aEngine, TInt aError ); - - /** - * Callback to inform if connection has been lost - * @since S60 3.1 - * @param aEngine File sharing engine - */ - void HandleSharingConnectionLost( - CUPnPFileSharingEngine& aEngine ); - - protected: // Functions from base classes - - /** - * From CAknDialog, This is called in CAknDialog::ExecuteLD() - * before a form is drawn. - * @since S60 3.1 - */ - void PreLayoutDynInitL(); - - /** - * From CAknDialog : This is called by the dialog framework - * when softkey is pressed, returns true if the - * @since S60 3.1 - * @param aButtonId, ID of the pressed button - * @return TBool, returns ETrue if ready to close dialog, - * EFalse otherwise. - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * From MEikMenuObserver - * @since S60 3.1 - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - private: - - /** - * By default Symbian 2nd phase constructor is private. - * @since S60 3.1 - * @param aMenuResource, menu resource of the dialog - */ - void ConstructL(TInt aMenuResource); - - /** - * Creates custom control - */ - SEikControlInfo CreateCustomControlL(TInt aControlType); - - /** - * Display information note after starting sharing - * @since S60 3.1 - * @param aMessageResourceId Resource id for message text - * @param aDialogResourceId Resource id for the dialog - */ - void DisplayInfoL( TInt aHeaderResourceId, - TInt aMessageResourceId, - TInt aDialogResourceId ); - /** - * Default constructor - */ - CUPnPAppFileSharingDialog( CUPnPFileSharingEngine& aEng ); - - private: // Data - - // File sharing engine pointer - CUPnPFileSharingEngine& iFileSharingEngine; //not owned - - // Pointer to file sharing list for dialog data - CUPnPAppFileSharingList* iFileSharingList; //owned - // pointer to title pane - CAknTitlePane* iTitlePane; // not owned - // pointer to status pane - CEikStatusPane* iStatusPane; // not owned - - // UI environment - CEikonEnv* iCoeEnv; //not owned - // offset in resource file - TInt iResFileOffset; - /** - *Flag to keep in mind has FeatureManager been initialized or not - */ - TBool iFeatureManagerInitialized; - - }; - -#endif // UPNPAPPFILESHARINGDIALOG_H - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/inc/upnpappfilesharinglist.h --- a/upnpsettings/upnpsharingui/inc/upnpappfilesharinglist.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: File sharing list class definition for Home Network - * -*/ - - - - - - -#ifndef UPNPAPPFILESHARINGLIST_H -#define UPNPAPPFILESHARINGLIST_H - -// INCLUDES -#include // base class -#include // base class MAknBackgroundProcess - -// FORWARD CLASS DECLARATION -class CUPnPFileSharingEngine; -class CUPnPAppWizard; - -// CONSTANTS -const TInt KMaxTextSettingItemLenght = 128; - -/** - * Settings list class declaration - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUPnPAppFileSharingList ) - : public CAknSettingItemList - , public MAknBackgroundProcess - { -private: - /** - * The internal phases of wait note when changing sharing state - */ - enum TSharingStarting - { - EPhaseNotActive, - EPhaseProcessing, - EPhaseCompleted - }; -public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUPnPAppFileSharingList* NewL( - CUPnPFileSharingEngine* aFileSharingEngine ); - - /** - * Destructor. - */ - virtual ~CUPnPAppFileSharingList(); - -public: // New functions - /** - * From CAknSettingItemList, this launches the setting page. - * @since S60 3.1 - * @param aIndex, index of selected list item - * @param aCalledFromMenu, indicates if editing is called - * trough menu or from keyboard - */ - void EditItemL (TInt aIndex, TBool aCalledFromMenu); - - /** - * Reads data from storage to member variables - * @since S60 3.1 - */ - void LoadDataFromEngineL(); - -public: //From MUPnPFileSharingEngineObserver - - /** - * Function informs when file sharing was enabled or disabled - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aError, error code - * @param aPhase ETrue if current phase is sharing activation, - * otherwise EFalse - */ - void HandleSharingStatus( - CUPnPFileSharingEngine& aEngine, - TInt aError, - TBool aPhase ); - - /** - * Callback to inform if connection has been lost - * @since S60 3.1 - * @param aEngine File sharing engine - */ - void HandleSharingConnectionLost( - CUPnPFileSharingEngine& aEngine ); - -public: - - /** - * Processes progress information and sets secondary texts according to - * received progress - * @since S60 3.1 - * @param aProgressInfo, Type containg the progress information - */ - void SetFilesharingTextsL( - const RArray& aProgressInfo ); - - /** - * Sets the default secondary texts if no sharing is ongoing - * @since S60 3.1 - * @param aMediaType, Type of the media - * @param aState, State of the selection - */ - void SetDefaultSecondaryTextsL( - const TInt& aMediaType, - const TInt& aState ); - - /** - * Sets the secondary texts id there is sharing ongoing - * @since S60 3.1 - * @param aMediaType, Type of the media - * @param aProgress, The value of progress in percents - */ - void SetProgressSecondaryTextsL( - const TInt& aMediaType, - const TInt& aProgress ); - - /** - * Update the visibity of item ,when the list is switched foregroud. - */ - void UpdateVisibitySettingItemL(); - -protected: - - /** - * From CAknSettingItemList - */ - void HandleResourceChange( TInt aType ); - - /** - * From CoeControl - */ - void FocusChanged( - TDrawNow aDrawNow ); - -protected: - /** - * From MAknBackgroundProcess - */ - void StepL(); - - /** - * From MAknBackgroundProcess - */ - TBool IsProcessDone() const; - - -private: - - /** - * C++ default constructor. - */ - CUPnPAppFileSharingList(); - - /** - * By default Symbian 2nd phase constructor is private. - * @param aFileSharingEngine, engine pointer - */ - void ConstructL( CUPnPFileSharingEngine* aFileSharingEngine ); - - /** - * From CAknSettingItemList, Framework method to create a setting item. - * @since S60 3.1 - * @param aIdentifier, list item id to be created - * @return CAknSettingItem, pointer to list item - */ - CAknSettingItem* CreateSettingItemL( TInt aIdentifier ); - - /** - * Create and show the wait note when starting sharing - * @since S60 3.1 - */ - void ShowWaitNoteL(); - - -private: // Data - - /** - * list item text for visual albums - */ - TBuf iVisualAlbums; - /** - * list item text for playlists - */ - TBuf iPlayLists; - /** - * visibility setting item value - */ - TInt iVisibility; - /** - *access point id setting item value - */ - TInt iIapId; - /** - * engine pointer - */ - CUPnPFileSharingEngine* iFileSharingEngine; - /** - * Indicator if wizard is run to update UI - */ - TBool iWizardRun; - /** - * The state of sharing activation for progress note - */ - TInt iStartingSharing; - /** - * Pointer to wizard - */ - CUPnPAppWizard* iWizard; - - }; - -#endif // UPNPAPPFILESHARINGLIST_H -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/inc/upnpsharingui.hrh --- a/upnpsettings/upnpsharingui/inc/upnpsharingui.hrh Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: Resource headers for sharing settings UI -* -*/ - - - - - - -#ifndef UPNPSHARINGUI_HRH -#define UPNPSHARINGUI_HRH - -// DATA TYPES - -enum TSharingUiDlgLineIds - { - ESharingUiListBoxId = 1 - }; - -enum TSharingUiDlgItems - { - ESharingUiSettingItemVisibility = 0, - ESharingUiSettingItemVisual, - ESharingUiSettingItemMusic - }; - -enum TSharingUiVisibilityItem - { - ESharingUiVisibilityOff = 0, - ESharingUiVisibilityOn - }; - -enum TSharingUiCommandIds - { - ESharingUiCmdAppChange = 1, - ESharingUiCmdRefresh - }; - -#endif // UPNPSHARINGUI_HRH - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/src/upnpappfilesharingdialog.cpp --- a/upnpsettings/upnpsharingui/src/upnpappfilesharingdialog.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,596 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: File sharing view of Home Network application -* -*/ - - - - - - -// INCLUDE FILES -// system -#include -#include -#include -#include -#include -#include -#include -#include -#include //displayinfol -#include // CAknInputBlock -#include // BaflUtils - -// internal interfaces -#include "cupnpmultiselectionui.h" -#include "upnpfilesharingengine.h" -#include "upnpfilesharingengineobserver.h" - -// this component -#include -#include "upnpsharingui.hrh" -#include "upnpappfilesharinglist.h" -#include "upnpappfilesharingdialog.h" - - -_LIT( KComponentLogfile, "upnpsharingui.txt"); -#include "upnplog.h" - -// CONSTANTS -const TInt KHomeConnectUID3 = 0x10208A0A; // needed for help context -_LIT( KUPNP_HLP_SHARE_CONTENT, "UPNP_HLP_SHARE_CONTENT" ); -// Filename of rsc file -_LIT( KSharingUiRscFile, "\\resource\\upnpsharingui.rsc" ); - - -// ============================ MEMBER FUNCTIONS ============================ - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPAppFileSharingDialog* CUPnPAppFileSharingDialog::NewL( - TInt aMenuResource, - CUPnPFileSharingEngine& aEng ) - { - __LOG("CUPnPAppFileSharingDialog::NewL"); - - CUPnPAppFileSharingDialog* self = - new (ELeave) CUPnPAppFileSharingDialog( aEng ); - CleanupStack::PushL(self); - self->ConstructL( aMenuResource ); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// Constructor -// -------------------------------------------------------------------------- -// -CUPnPAppFileSharingDialog::CUPnPAppFileSharingDialog( - CUPnPFileSharingEngine& aEng ) - : iFileSharingEngine( aEng ) - , iFeatureManagerInitialized( EFalse ) - { - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::ConstructL( TInt aMenuResource ) - { - __LOG("CUPnPAppFileSharingDialog::ConstructL"); - - iFileSharingEngine.SetObserver(this); - - if ( aMenuResource == 0 ) - { - aMenuResource = R_SHARINGUI_MENUBAR; - } - - // determine resource file location - iCoeEnv = CEikonEnv::Static(); - RFs& fileSession = iCoeEnv->FsSession(); - TFileName rscFileName( KSharingUiRscFile ); - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' - rscFileName.Insert( 0, drive ); - BaflUtils::NearestLanguageFile( fileSession, rscFileName ); - if ( !BaflUtils::FileExists( fileSession, rscFileName ) ) - { - User::Leave( KErrNotFound ); - } - // load the resource file - iResFileOffset = iCoeEnv->AddResourceFileL( rscFileName ); - FeatureManager::InitializeLibL(); - iFeatureManagerInitialized = ETrue; - - CAknDialog::ConstructL( aMenuResource ); - } - -// -------------------------------------------------------------------------- -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPAppFileSharingDialog::~CUPnPAppFileSharingDialog() - { - __LOG("CUPnPAppFileSharingDialog::~CUPnPAppFileSharingDialog"); - - iFileSharingEngine.SetObserver( NULL ); - - // unload resource file - if ( iResFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResFileOffset ); - iResFileOffset = 0; - } - - if( iFeatureManagerInitialized ) - { - FeatureManager::UnInitializeLib(); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::ExecuteSharingDialogLD() -// Executes the dialog using the component's own resource -// -------------------------------------------------------------------------- -// -EXPORT_C TInt CUPnPAppFileSharingDialog::ExecuteSharingDialogLD() - { - return ExecuteLD( R_SHARINGUI_DIALOG ); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::OkToExitL(TInt aButtonId) -// called by framework when the softkey is pressed -// -------------------------------------------------------------------------- -// -TBool CUPnPAppFileSharingDialog::OkToExitL(TInt aButtonId) -{ - __LOG("CUPnPAppFileSharingDialog::OkToExitL"); - - TBool retval(EFalse); - if (aButtonId == EAknSoftkeyOptions) - { - DisplayMenuL(); - } - else if (aButtonId == EAknSoftkeyBack) - { - iTitlePane->SetTextToDefaultL(); - retval = ETrue; //back to previous dialog - } - else if ( aButtonId == EAknSoftkeyChange ) - { - // msk event - TKeyEvent tmpEvent; - tmpEvent.iCode = EKeyOK; - tmpEvent.iModifiers = 0; - tmpEvent.iRepeats = 0; - tmpEvent.iScanCode = 0; - TEventCode eventType = EEventKey; - OfferKeyEventL( tmpEvent, eventType ); - } - return retval; -} - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::DynInitMenuPaneL -// Dynamically initalizes menu pane -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - __LOG("CUPnPAppMainDialog::CUPnPAppFileSharingDialog"); - - if (aResourceId == R_SHARINGUI_MENU && - !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); - } - } - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::PreLayoutDynInitL() -// called by framework before dialog is shown -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::PreLayoutDynInitL() - { - __LOG("CUPnPAppFileSharingDialog::PreLayoutDynInitL"); - - iFileSharingList->LoadDataFromEngineL(); - - // set dialog title - iStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); - iTitlePane = (CAknTitlePane*)iStatusPane->ControlL( - TUid::Uid(EEikStatusPaneUidTitle)); - iTitlePane->SetTextL(*StringLoader::LoadLC( R_SHARINGUI_TITLE_TEXT ) ); - CleanupStack::PopAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::ProcessCommandL() -// called by framework when menu command is selected -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::ProcessCommandL(TInt aCommand) - { - __LOG("CUPnPAppFileSharingDialog::ProcessCommandL"); - - HideMenu(); - - switch ( aCommand ) - { - case ESharingUiCmdRefresh: - { - TInt selectedItem = iFileSharingList-> - ListBox()->CurrentItemIndex(); - iFileSharingEngine.RefreshSharedMediaL( EImageAndVideo ); - iFileSharingEngine.RefreshSharedMediaL( EPlaylist ); - DisplayInfoL( R_SHARINGUI_UPDATING_CONTENT_HEADER, - R_SHARINGUI_UPDATING_CONTENT_NOTE_TEXT, - R_SHARINGUI_INFO_QUERY ); - break; - } - case ESharingUiCmdAppChange: - { - TInt selectedItem = iFileSharingList->ListBox()->CurrentItemIndex(); - if ( selectedItem == ESharingUiSettingItemVisibility ) - { - iFileSharingList->EditItemL(selectedItem, ETrue); - } - else - { - RunMultiselectionDialogL(); - } - break; - } - - case EAknCmdExit: - { - User::Exit(KErrNone); - break; - } - - case EAknCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), - iEikonEnv->EikAppUi()->AppHelpContextL() ); - break; - } - - default: - { - __LOG("CUPnPAppFileSharingDialog::ProcessCommandL Unknown cmd"); - } - } - - CAknDialog::ProcessCommandL(aCommand); - } - -// -------------------------------------------------------------------------- -// CUPnPAppSettingsDialog::OfferKeyEventL() -// called by framework when key is pressed -// -------------------------------------------------------------------------- -// -TKeyResponse CUPnPAppFileSharingDialog::OfferKeyEventL( - const TKeyEvent &aKeyEvent, TEventCode aType ) - { - __LOG("CUPnPAppFileSharingDialog::OfferKeyEventL"); - - TKeyResponse retval = EKeyWasNotConsumed; - switch ( aKeyEvent.iCode ) - { - case EKeyDownArrow: - case EKeyUpArrow: - { - if (aType == EEventKey) - { - retval = iFileSharingList->OfferKeyEventL( aKeyEvent, aType ); - } - break; - } - - case EKeyOK: - { - if ( aType == EEventKey ) - { - TInt selectedItem = - iFileSharingList->ListBox()->CurrentItemIndex(); - if ( selectedItem == ESharingUiSettingItemVisibility ) - { - retval = iFileSharingList->OfferKeyEventL(aKeyEvent, aType); - } - else - { - RunMultiselectionDialogL(); - retval = EKeyWasConsumed; - } - } - break; - } - - default: - { - retval = CAknDialog::OfferKeyEventL(aKeyEvent, aType); - break; - } - } - - return retval; - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::HandleSharingStatus -// Function informs when file sharing was enabled or disabled -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::HandleSharingStatus( - CUPnPFileSharingEngine& aEngine, - TInt aError, - TBool aPhase ) - { - __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\ -HandleSharingStatus begin"); - - iFileSharingList->HandleSharingStatus( aEngine, aError, aPhase ); - - if( !aError ) - { - TInt strId( R_UPNP_PHONE_HIDDEN_TEXT ); - if( aPhase ) - { - strId = R_UPNP_PHONE_VISIBLE_TEXT; - } - - TRAP_IGNORE( - HBufC* str = StringLoader::LoadLC( strId ); - CAknInformationNote* note = new ( ELeave ) CAknInformationNote; - note->ExecuteLD( *str ); - CleanupStack::PopAndDestroy( str ) ); - } - - __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\ -HandleSharingStatus end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::HandleSharingProgress -// Informs about status of the sharing progress -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::HandleSharingProgress( - CUPnPFileSharingEngine& /*aEngine*/, - const RArray& aProgress ) - { - __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\ -HandleSharingProgress begin"); - - TRAPD( err, - CAknInputBlock::NewLC(); - iFileSharingList->SetFilesharingTextsL( aProgress ); - CleanupStack::PopAndDestroy() ); - if ( err != KErrNone ) - { - //show some critical errors using - //default symbian error notes - CActiveScheduler::Current()->Error( err ); - } - - __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\ -HandleSharingProgress end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::HandleSharingDone -// Function informs when file sharing is done -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::HandleSharingDone( - CUPnPFileSharingEngine& /*aEngine*/, TInt aError ) - { - __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\ -HandleSharingDone begin"); - - //Show information note that sharing is completed - if ( aError == KErrInUse || - aError == KErrNoMemory || - aError == KErrDiskFull ) - { - //show some critical errors using - //default symbian error notes - CActiveScheduler::Current()->Error( aError ); - } - - __LOG( "[CUPnPAppFileSharingDialog]\t CUPnPAppFileSharingDialog::\ -HandleSharingDone end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::HandleSharingConnectionLost -// Callback to inform if connection has been lost -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::HandleSharingConnectionLost( - CUPnPFileSharingEngine& aEngine ) - { - __LOG("CUPnPAppFileSharingDialog::HandleSharingConnectionLost"); - - TRAPD( err, - CAknInputBlock::NewLC(); - iFileSharingList->HandleSharingConnectionLost( aEngine ); - CleanupStack::PopAndDestroy() ); //CAknInputBlock - if ( err != KErrNone ) - { - //show some critical errors using - //default symbian error notes - CActiveScheduler::Current()->Error( err ); - } - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::RunMultiselectionDialogL(); -// Opens album selection dialog and sends selected albums -// to engine -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::RunMultiselectionDialogL(void) - { - __LOG("CUPnPAppFileSharingDialog::RunMultiselectionDialogL"); - - CUPnPMultiselectionUi* multiselectionDialog; - - TInt selectedItem = iFileSharingList->ListBox()->CurrentItemIndex(); - - TInt visualSharingState; - - - THomeConnectMediaType mediaType; - if ( selectedItem == ESharingUiSettingItemVisual ) - { - mediaType = - EImageAndVideo; - } - - else - { - mediaType = - EPlaylist; - } - CArrayFix* markedItems = new(ELeave) CArrayFixFlat(3); - CleanupStack::PushL( markedItems ); - multiselectionDialog = CUPnPMultiselectionUi::NewL( - mediaType, - &iFileSharingEngine, - visualSharingState, - markedItems ); - CleanupStack::PushL( multiselectionDialog ); - TInt ret = multiselectionDialog->ExecuteDlgLD(); - - CleanupStack::PopAndDestroy( multiselectionDialog ); - - multiselectionDialog = NULL; - - // Set title back - iTitlePane->SetTextL(*StringLoader::LoadLC( R_SHARINGUI_TITLE_TEXT )); - CleanupStack::PopAndDestroy(); - - if ( ret ) - { - __LOG("CUPnPAppFileSharingDialog::RunMultiselectionDialogL: \ -Calling ShareMediaFilesL.."); - // set selections - iFileSharingEngine.SetSelectionIndexesL( mediaType, *markedItems ); - - // Share files asynchronously - iFileSharingEngine.ShareMediaL( mediaType ); - - DisplayInfoL( R_SHARINGUI_UPDATING_CONTENT_HEADER, - R_SHARINGUI_UPDATING_CONTENT_NOTE_TEXT, - R_SHARINGUI_INFO_QUERY ); - } - CleanupStack::PopAndDestroy( markedItems ); - - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::GetHelpContext -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::GetHelpContext( - TCoeHelpContext& aContext) const - { - __LOG("CUPnPAppMainDialog::CUPnPAppFileSharingDialog"); - - aContext.iMajor = TUid::Uid( KHomeConnectUID3 ); - aContext.iContext = KUPNP_HLP_SHARE_CONTENT; - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::CreateCustomControlL -// From CAknDialog -// -------------------------------------------------------------------------- -// -SEikControlInfo CUPnPAppFileSharingDialog::CreateCustomControlL( - TInt aControlType) - { - __LOG( "[CUPnPAppFileSharingDialog]\t CreateCustomControlL"); - iFileSharingList = CUPnPAppFileSharingList::NewL( - &iFileSharingEngine ); - - SEikControlInfo controlInfo; - controlInfo.iControl = NULL; - controlInfo.iTrailerTextId = 0; - controlInfo.iFlags = 0; - - if ( aControlType == KAknCtLastControlId ) - { - controlInfo.iControl = iFileSharingList; - } - iFileSharingEngine.RequestSharingProgressL(); - - return controlInfo; - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::DisplayInfoL(); -// Shows message query to user -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingDialog::DisplayInfoL(TInt aHeaderResourceId, - TInt aMessageResourceId, - TInt aDialogResourceId) - { - HBufC* noteHeader = StringLoader::LoadL( - aHeaderResourceId); - CleanupStack::PushL(noteHeader); - HBufC* noteMsg = StringLoader::LoadL( - aMessageResourceId); - CleanupStack::PushL(noteMsg); - - CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*noteMsg); - - dlg->PrepareLC(aDialogResourceId); - dlg->QueryHeading()->SetTextL(*noteHeader); - dlg->RunLD(); - - CleanupStack::PopAndDestroy(noteMsg); - CleanupStack::PopAndDestroy(noteHeader); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingDialog::UpdateFileSharingListL(); -// Get the pointer of iFileSharingList,update the visibity of item -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPAppFileSharingDialog::UpdateFileSharingListL() - { - if( iFileSharingList ) - { - iFileSharingList->UpdateVisibitySettingItemL(); - } - - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsettings/upnpsharingui/src/upnpappfilesharinglist.cpp --- a/upnpsettings/upnpsharingui/src/upnpappfilesharinglist.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,674 +0,0 @@ -/* -* Copyright (c) 2005-2007 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: File sharing list implementation for File sharing view -* -*/ - - - - - - -// INCLUDE FILES -// system -#include -#include -#include -#include -#include -#include -#include - -// internal upnpfw interfaces -#include "upnpsettingsengine.h" -#include "upnpfilesharingengine.h" -#include "cupnpappwizard.h" -#include "upnpcontentserverclient.h" //TUpnpProgressInfo - -// this component -#include "upnpsharingui.hrh" -#include "upnpappfilesharinglist.h" - -_LIT( KComponentLogfile, "upnpsharingui.txt"); -#include "upnplog.h" - -// CONSTANTS -_LIT( KCDrive, "C" ); - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::CUPnPAppFileSharingList -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPAppFileSharingList::CUPnPAppFileSharingList() - { - __LOG("CUPnPAppFileSharingList::CUPnPAppFileSharingList"); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::ConstructL( - CUPnPFileSharingEngine* aFileSharingEngine) - { - __LOG("CUPnPAppFileSharingList::ConstructL"); - - iFileSharingEngine = aFileSharingEngine; - User::LeaveIfNull( iFileSharingEngine ); - iVisibility = 0; - if ( iFileSharingEngine->SharingStateL() ) - { - iVisibility = 1; - } - } - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUPnPAppFileSharingList* CUPnPAppFileSharingList::NewL( - CUPnPFileSharingEngine* aFileSharingEngine ) - { - __LOG("CUPnPAppFileSharingList::NewL"); - - CUPnPAppFileSharingList* self = new (ELeave) CUPnPAppFileSharingList( ); - CleanupStack::PushL(self); - self->ConstructL( aFileSharingEngine ); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::~CUPnPAppFileSharingList -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPAppFileSharingList::~CUPnPAppFileSharingList() - { - __LOG("CUPnPAppFileSharingList::~CUPnPAppFileSharingList"); - // This will kill the possible wait note - iStartingSharing = EPhaseCompleted; - delete iWizard; - iWizard = NULL; - } - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::CreateSettingItemL -// Creates list items -// -------------------------------------------------------------------------- -// -CAknSettingItem* CUPnPAppFileSharingList::CreateSettingItemL(TInt aIdentifier) - { - __LOG("CUPnPAppFileSharingList::CreateSettingItemL"); - - CAknSettingItem* settingItem = NULL; - switch (aIdentifier) - { - case ESharingUiSettingItemVisibility: - { - settingItem = - new (ELeave) CAknBinaryPopupSettingItem(aIdentifier, - iVisibility); - break; - } - - case ESharingUiSettingItemVisual: - { - settingItem = new (ELeave) CAknTextSettingItem(aIdentifier, - iVisualAlbums); - break; - } - - case ESharingUiSettingItemMusic: - { - settingItem = new (ELeave) CAknTextSettingItem(aIdentifier, - iPlayLists); - break; - } - - default: - { - __LOG("CUPnPAppFileSharingList::CreateSettingItemL \ -Unknown setting item!"); - } - } - - return settingItem; - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::EditItemL -// Called when setting list item is modified -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::EditItemL (TInt aIndex, - TBool /*aCalledFromMenu*/) - { - __LOG("CUPnPAppFileSharingList::EditItemL"); - - LoadDataFromEngineL(); - - switch ( aIndex ) - { - case ESharingUiSettingItemVisibility: - { - if ( !iVisibility ) - { - if ( iIapId != KErrNotFound ) - { - ShowWaitNoteL(); - } - else - { - iWizardRun = ETrue; - - MUPnPFileSharingEngineObserver* observer = - iFileSharingEngine->Observer(); - - delete iWizard; - iWizard = NULL; - iWizard = CUPnPAppWizard::NewL( - KNullDesC, iFileSharingEngine ); - iWizard->StartL(); - - - iFileSharingEngine->SetObserver(observer); - iFileSharingEngine->RequestSharingProgressL(); - - LoadDataFromEngineL(); - } - } - else - { - ShowWaitNoteL(); - } - } - break; - - default: - { - __LOG("CUPnPAppFileSharingList::EditItemL No such item!"); - } - } - - //load settings to screen - CAknSettingItemList::LoadSettingsL(); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::LoadDataFromEngineL -// Loads data from Central Repository to member variables -// (other items were commented in a header). -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::LoadDataFromEngineL() - { - __LOG("CUPnPAppFileSharingList::LoadDataFromEngineL"); - - CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL(); - CleanupStack::PushL( settingsEngine ); - - // Read file sharing state - iVisibility = 0; - if ( iFileSharingEngine->SharingStateL() ) - { - iVisibility = 1; - } - - // Read iap id - settingsEngine->GetAccessPoint( iIapId ); - - //load settings to screen - CAknSettingItemList::LoadSettingsL (); - CleanupStack::PopAndDestroy( settingsEngine ); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::HandleSharingStatus -// Function informs when file sharing was enabled or disabled -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::HandleSharingStatus( - CUPnPFileSharingEngine& /*aEngine*/, - TInt aError, - TBool aPhase ) - { - __LOG("CUPnPAppFileSharingList::HandleSharingStatus begin"); - - if ( aPhase ) - { - __LOG("start sharing"); - - if ( aError ) - { - // change state back to off - iVisibility = EFalse; - - // If there domtree wasn't able to be written due to disk full - // situation, send leave to kernel to inform user - if( aError == KErrDiskFull || - aError == KErrNoMemory || - aError == KErrInUse ) - { - // stop the wait note - iStartingSharing = EPhaseCompleted; - //show some critical errors using - //default symbian error notes - CActiveScheduler::Current()->Error( aError ); - } - else - { - // show error note - TRAP_IGNORE( - HBufC* errorNote = StringLoader::LoadLC( - R_SETTINGS_START_SHARING_ERROR_TEXT); - CAknErrorNote* note = new (ELeave) CAknErrorNote(ETrue); - note->ExecuteLD(*errorNote); - CleanupStack::PopAndDestroy() ); //errorNote - } - - } - else - { - // change secondary text - iVisibility = ETrue; - } - } - else - { - __LOG("stop sharing"); - - // If the media server lost, aError will be KErrGeneral or - // KErrServerTerminated. - // If there were other errors, stop sharing fails and visibility - // will remain true. - if ( !aError || KErrGeneral == aError || - KErrServerTerminated == aError ) - { - iVisibility = EFalse; - } - - // Note user not enough memory to change the phone state. - if ( KErrDiskFull == aError || - KErrNoMemory == aError || - KErrInUse == aError ) - { - __LOG1( "Not enough memory to change the \ - phone state error:%d ", aError ); - - //There is nothing to do if leaves - TRAP_IGNORE( - HBufC* errorNote = StringLoader::LoadLC( - R_SETTINGS_START_SHARING_PHONE_ERROR_TEXT, KCDrive ); - CAknErrorNote* note = new( ELeave ) CAknErrorNote( ETrue ); - note->ExecuteLD( *errorNote ); - CleanupStack::PopAndDestroy( errorNote ) ); - } - - TRAP_IGNORE( - CAknSettingItemList::EditItemL( - ESharingUiSettingItemVisibility, EFalse ) ); - } - - - iStartingSharing = EPhaseCompleted; - // Update UI - TRAP_IGNORE( CAknSettingItemList::LoadSettingsL() ); - DrawDeferred(); - - __LOG("CUPnPAppFileSharingList::HandleSharingStatus end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::HandleSharingConnectionLost -// Callback to inform if connection has been lost -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::HandleSharingConnectionLost( - CUPnPFileSharingEngine& /*aEngine*/ ) - { - __LOG("CUPnPAppFileSharingList::HandleSharingConnectionLost begin"); - - iVisibility = EFalse; - TRAPD( err, - CAknSettingItemList::EditItemL ( - ESharingUiSettingItemVisibility, EFalse); - LoadSettingsL(); - ); - DrawDeferred(); - if ( err != KErrNone ) - { - //show some critical errors using - //default symbian error notes - CActiveScheduler::Current()->Error( err ); - } - - __LOG("CUPnPAppFileSharingList::HandleSharingConnectionLost end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::HandleResourceChange -// From CAknDialog -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::HandleResourceChange( TInt aType ) - { - __LOG("CUPnPAppFileSharingList::HandleResourceChange"); - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( - AknLayoutUtils::EMainPane, mainPaneRect ); - - TAknLayoutRect layoutRect; - layoutRect.LayoutRect( - TRect( TPoint( 0, 0 ), mainPaneRect.Size() ), - AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); - - ListBox()->SetRect( layoutRect.Rect() ); - } - - // Base call - CAknSettingItemList::HandleResourceChange( aType ); - } - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::SetFilesharingTextsL -// Update the secondary texts in the dialog -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::SetFilesharingTextsL( - const RArray& aProgressInfo ) - { - __LOG( "[CUPnPAppFileSharingList]\t SetFilesharingTextsL begin" ); - - - for ( TInt i(0); i < aProgressInfo.Count(); i++ ) - { - if ( aProgressInfo[ i ].iProgressKind == EImageAndVideo ) - { - if ( aProgressInfo[ i ].iProgressType == - TUpnpProgressInfo::EVisualStatus ) - { - SetDefaultSecondaryTextsL( EImageAndVideo, - aProgressInfo[ i ].iProgress ); - } - else - { - SetProgressSecondaryTextsL( EImageAndVideo, - aProgressInfo[ i ].iProgress ); - } - } - else - { - if ( aProgressInfo[ i ].iProgressType == - TUpnpProgressInfo::EVisualStatus ) - { - SetDefaultSecondaryTextsL( EPlaylist, - aProgressInfo[ i ].iProgress ); - } - else - { - SetProgressSecondaryTextsL( EPlaylist, - aProgressInfo[ i ].iProgress ); - } - } - } - if( ListBox() && ListBox()->BottomItemIndex() > 1 ) - { - CAknSettingItemList::LoadSettingsL(); - DrawDeferred(); - } - __LOG( "[CUPnPAppFileSharingList]\t SetFilesharingTextsL end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::SetDefaultSecondaryTextsL -// Update the secondary texts in the dialog -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::SetDefaultSecondaryTextsL( - const TInt& aMediaType, - const TInt& aState ) - { - __LOG( "[CUPnPAppFileSharingList]\t \ -SetDefaultSecondaryTextsL begin" ); - HBufC* secondaryText = NULL; - switch ( aMediaType ) - { - case EImageAndVideo : - { - if ( aState == EShareAll) - { - secondaryText = StringLoader::LoadLC( - R_VISUAL_ALBUMS_SHARE_MANY_TEXT); - } - - else if ( aState == EShareNone) - { - secondaryText = StringLoader::LoadLC( - R_VISUAL_ALBUMS_SHARE_NOTHING_TEXT); - } - - else // there were shared files - { - secondaryText = StringLoader::LoadLC( - R_VISUAL_ALBUMS_SHARE_ONE_TEXT); - } - - iVisualAlbums.Copy( *secondaryText ); - } - break; - case EPlaylist : - { - if ( aState == EShareAll) - { - secondaryText = StringLoader::LoadLC(R_MUSIC_SHARE_MANY_TEXT); - } - - else if ( aState == EShareNone) - { - secondaryText = StringLoader::LoadLC( - R_MUSIC_SHARE_NOTHING_TEXT); - } - - else // there were shared files - { - secondaryText = StringLoader::LoadLC(R_MUSIC_SHARE_ONE_TEXT); - - } - - iPlayLists.Copy( *secondaryText ); - } - break; - default: - break; - } - CleanupStack::PopAndDestroy( secondaryText ); - __LOG( "[CUPnPAppFileSharingList]\t SetDefaultSecondaryTextsL end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::SetProgressSecondaryTextsL -// Update the secondary texts in the dialog -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::SetProgressSecondaryTextsL( - const TInt& aMediaType, - const TInt& aProgress ) - { - __LOG( "[CUPnPAppFileSharingList]\t \ -SetProgressSecondaryTextsL begin" ); - - HBufC* secondaryText = StringLoader::LoadLC( - R_SHARINGUI_SECONDARY_IN_PROGRESS, aProgress ); - - switch ( aMediaType ) - { - case EImageAndVideo : - { - iVisualAlbums.Copy(*secondaryText); - } - break; - case EPlaylist : - { - iPlayLists.Copy(*secondaryText); - } - break; - default: - break; - } - CleanupStack::PopAndDestroy( secondaryText ); - __LOG( "[CUPnPAppFileSharingList]\t SetProgressSecondaryTextsL end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::FocusChanged -// From CAknDialog -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::FocusChanged( - TDrawNow /*aDrawNow*/ ) - { - __LOG( "[CUPnPAppFileSharingList]\t \ -FocusChanged begin" ); - if ( iWizardRun ) - { - TRAP_IGNORE( iFileSharingEngine->RequestSharingProgressL()); - iWizardRun = EFalse; - } - - __LOG( "[CUPnPAppFileSharingList]\t FocusChanged end" ); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::ShowWaitNoteL -// Shows standard wait note -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::ShowWaitNoteL() - { - __LOG("[CUPnPAppFileSharingList]\t CUPnPAppFileSharingList::\ -ShowWaitNoteL begin"); - TInt resId( R_SHARINGUI_STOPPING_FILE_SHARING_NOTE_DIALOG ); - if ( !iVisibility ) - { - resId = R_SHARINGUI_STARTING_FILE_SHARING_NOTE_DIALOG; - } - - iStartingSharing = EPhaseNotActive; - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupStack::PushL(reinterpret_cast(waitNoteWrapper)); - waitNoteWrapper->ExecuteL( - resId, // TInt aResId, - *this, // MAknBackgroundProcess& aBackgroundProcess - ETrue); - CleanupStack::PopAndDestroy(); - __LOG("[CUPnPAppFileSharingList]\t CUPnPAppFileSharingList::\ -ShowWaitNoteL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::StepL -// Step done during wait note -// From MAknBackgroundProcess -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::StepL(void) - { - if ( iStartingSharing == EPhaseNotActive ) - { - iStartingSharing = EPhaseProcessing; - } - } - - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::IsProcessDone -// Returns ETrue if process finished -// From MAknBackgroundProcess -// -------------------------------------------------------------------------- -// -TBool CUPnPAppFileSharingList::IsProcessDone(void) const - { - - TBool ret(EFalse); - if ( iStartingSharing == EPhaseNotActive ) - { - if ( !iVisibility ) - { - TRAPD( err, iFileSharingEngine->SetSharingStateL( ETrue ) ); - if( err != KErrNone ) - { - return ETrue; - } - } - else - { - TRAPD( err, iFileSharingEngine->SetSharingStateL( EFalse ) ); - if( err != KErrNone ) - { - return ETrue; - } - } - } - else if ( iStartingSharing == EPhaseCompleted ) - { - ret = ETrue; - } - else - { - __LOG("CUPnPAppFileSharingList::IsProcessDone: else branch"); - } - return ret; - } - -// -------------------------------------------------------------------------- -// CUPnPAppFileSharingList::UpdateVisibitySettingItemL -// Update the visibity of item ,when the list is switched foregroud. -// -------------------------------------------------------------------------- -// -void CUPnPAppFileSharingList::UpdateVisibitySettingItemL() - { - CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL(); - CleanupStack::PushL( settingsEngine ); - - // Read file sharing state - TInt Visibility = 0; - if ( iFileSharingEngine->SharingStateL() ) - { - Visibility = 1; - } - CleanupStack::PopAndDestroy( settingsEngine ); - - if( Visibility != iVisibility ) - { - iVisibility = Visibility; - CAknSettingItemList::LoadSettingsL(); - DrawDeferred(); - } - - } -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/bwins/upnpapplicationengineU.DEF --- a/upnpsharing/applicationengine/bwins/upnpapplicationengineU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -EXPORTS - ??1CUPnPFileSharingEngine@@UAE@XZ @ 1 NONAME ; CUPnPFileSharingEngine::~CUPnPFileSharingEngine(void) - ?GetSelectionContentL@CUPnPFileSharingEngine@@QBEXAAVCDesC16Array@@@Z @ 2 NONAME ; void CUPnPFileSharingEngine::GetSelectionContentL(class CDesC16Array &) const - ?GetSelectionIndexesL@CUPnPFileSharingEngine@@QBEXAAV?$CArrayFix@H@@@Z @ 3 NONAME ; void CUPnPFileSharingEngine::GetSelectionIndexesL(class CArrayFix &) const - ?NewL@CUPnPFileSharingEngine@@SAPAV1@XZ @ 4 NONAME ; class CUPnPFileSharingEngine * CUPnPFileSharingEngine::NewL(void) - ?NewLC@CUPnPFileSharingEngine@@SAPAV1@XZ @ 5 NONAME ; class CUPnPFileSharingEngine * CUPnPFileSharingEngine::NewLC(void) - ?Observer@CUPnPFileSharingEngine@@QAEPAVMUPnPFileSharingEngineObserver@@XZ @ 6 NONAME ; class MUPnPFileSharingEngineObserver * CUPnPFileSharingEngine::Observer(void) - ?RefreshSharedMediaL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@@Z @ 7 NONAME ; void CUPnPFileSharingEngine::RefreshSharedMediaL(enum THomeConnectMediaType) - ?RequestSelectionContentL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@@Z @ 8 NONAME ; void CUPnPFileSharingEngine::RequestSelectionContentL(enum THomeConnectMediaType) - ?RequestSelectionIndexesL@CUPnPFileSharingEngine@@QBEXW4THomeConnectMediaType@@@Z @ 9 NONAME ; void CUPnPFileSharingEngine::RequestSelectionIndexesL(enum THomeConnectMediaType) const - ?RequestSharingProgressL@CUPnPFileSharingEngine@@QAEXXZ @ 10 NONAME ; void CUPnPFileSharingEngine::RequestSharingProgressL(void) - ?SetObserver@CUPnPFileSharingEngine@@QAEXPAVMUPnPFileSharingEngineObserver@@@Z @ 11 NONAME ; void CUPnPFileSharingEngine::SetObserver(class MUPnPFileSharingEngineObserver *) - ?SetSelectionIndexesL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@ABV?$CArrayFix@H@@@Z @ 12 NONAME ; void CUPnPFileSharingEngine::SetSelectionIndexesL(enum THomeConnectMediaType, class CArrayFix const &) - ?SetSharingStateL@CUPnPFileSharingEngine@@QAEXH@Z @ 13 NONAME ; void CUPnPFileSharingEngine::SetSharingStateL(int) - ?ShareMediaL@CUPnPFileSharingEngine@@QAEXW4THomeConnectMediaType@@@Z @ 14 NONAME ; void CUPnPFileSharingEngine::ShareMediaL(enum THomeConnectMediaType) - ?SharingStateL@CUPnPFileSharingEngine@@QAEHXZ @ 15 NONAME ; int CUPnPFileSharingEngine::SharingStateL(void) - ?StartUploadListenerL@CUPnPFileSharingEngine@@QAEXXZ @ 16 NONAME ; void CUPnPFileSharingEngine::StartUploadListenerL(void) - ?StopUploadListenerL@CUPnPFileSharingEngine@@QAEXXZ @ 17 NONAME ; void CUPnPFileSharingEngine::StopUploadListenerL(void) - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/data/upnp_ms_jpeg_lrg.jpg Binary file upnpsharing/applicationengine/data/upnp_ms_jpeg_lrg.jpg has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/data/upnp_ms_jpeg_sm.jpg Binary file upnpsharing/applicationengine/data/upnp_ms_jpeg_sm.jpg has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/data/upnp_ms_png_lrg.png Binary file upnpsharing/applicationengine/data/upnp_ms_png_lrg.png has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/data/upnp_ms_png_sm.png Binary file upnpsharing/applicationengine/data/upnp_ms_png_sm.png has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/eabi/upnpapplicationengineU.DEF --- a/upnpsharing/applicationengine/eabi/upnpapplicationengineU.DEF Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -EXPORTS - _ZN22CUPnPFileSharingEngine11SetObserverEP30MUPnPFileSharingEngineObserver @ 1 NONAME - _ZN22CUPnPFileSharingEngine11ShareMediaLE21THomeConnectMediaType @ 2 NONAME - _ZN22CUPnPFileSharingEngine13SharingStateLEv @ 3 NONAME - _ZN22CUPnPFileSharingEngine16SetSharingStateLEi @ 4 NONAME - _ZN22CUPnPFileSharingEngine19RefreshSharedMediaLE21THomeConnectMediaType @ 5 NONAME - _ZN22CUPnPFileSharingEngine19StopUploadListenerLEv @ 6 NONAME - _ZN22CUPnPFileSharingEngine20SetSelectionIndexesLE21THomeConnectMediaTypeRK9CArrayFixIiE @ 7 NONAME - _ZN22CUPnPFileSharingEngine20StartUploadListenerLEv @ 8 NONAME - _ZN22CUPnPFileSharingEngine23RequestSharingProgressLEv @ 9 NONAME - _ZN22CUPnPFileSharingEngine24RequestSelectionContentLE21THomeConnectMediaType @ 10 NONAME - _ZN22CUPnPFileSharingEngine4NewLEv @ 11 NONAME - _ZN22CUPnPFileSharingEngine5NewLCEv @ 12 NONAME - _ZN22CUPnPFileSharingEngine8ObserverEv @ 13 NONAME - _ZN22CUPnPFileSharingEngineD0Ev @ 14 NONAME - _ZN22CUPnPFileSharingEngineD1Ev @ 15 NONAME - _ZN22CUPnPFileSharingEngineD2Ev @ 16 NONAME - _ZNK22CUPnPFileSharingEngine20GetSelectionContentLER12CDesC16Array @ 17 NONAME - _ZNK22CUPnPFileSharingEngine20GetSelectionIndexesLER9CArrayFixIiE @ 18 NONAME - _ZNK22CUPnPFileSharingEngine24RequestSelectionIndexesLE21THomeConnectMediaType @ 19 NONAME - _ZTI22CUPnPFileSharingEngine @ 20 NONAME ; ## - _ZTV22CUPnPFileSharingEngine @ 21 NONAME ; ## - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/group/bld.inf --- a/upnpsharing/applicationengine/group/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2006-2007 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 information file for project Application Engine -* -*/ - - - - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -// Mediaserver icons -../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg -../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg -../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg -../data/upnp_ms_jpeg_lrg.jpg /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_jpeg_lrg.jpg - -../data/upnp_ms_jpeg_sm.jpg /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg -../data/upnp_ms_jpeg_sm.jpg /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg -../data/upnp_ms_jpeg_sm.jpg /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg -../data/upnp_ms_jpeg_sm.jpg /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_jpeg_sm.jpg - -../data/upnp_ms_png_lrg.png /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_png_lrg.png -../data/upnp_ms_png_lrg.png /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_png_lrg.png -../data/upnp_ms_png_lrg.png /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_png_lrg.png -../data/upnp_ms_png_lrg.png /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_png_lrg.png - -../data/upnp_ms_png_sm.png /epoc32/release/winscw/udeb/Z/system/apps/upnp/upnp_ms_png_sm.png -../data/upnp_ms_png_sm.png /epoc32/release/winscw/urel/Z/system/apps/upnp/upnp_ms_png_sm.png -../data/upnp_ms_png_sm.png /epoc32/release/armv5/udeb/Z/system/apps/upnp/upnp_ms_png_sm.png -../data/upnp_ms_png_sm.png /epoc32/release/armv5/urel/Z/system/apps/upnp/upnp_ms_png_sm.png - - -../inc/upnpfilesharingengine.h |../../../inc/upnpfilesharingengine.h -../inc/upnpfilesharingengineobserver.h |../../../inc/upnpfilesharingengineobserver.h - -PRJ_MMPFILES -upnpapplicationengine.mmp - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/group/upnpapplicationengine.mmp --- a/upnpsharing/applicationengine/group/upnpapplicationengine.mmp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2006-2007 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 project Application Engine -* -*/ - - - - - - -#include "../../../group/upnpplatformvar.hrh" - -TARGET upnpapplicationengine.dll -TARGETTYPE dll -UID 0x1000008d 0x10208A0B - -// Enable UPnPSecurity -MACRO ENABLE_UPNP_SECURITY - -// Capability assignment. -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -// SIS installation + IAD support -VERSION 10.1 -paged - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src -SOURCE upnpcontentrequestao.cpp -SOURCE upnpcontentshareao.cpp -SOURCE upnpfilesharingengine.cpp -SOURCE upnpfilesharingengineao.cpp -SOURCE upnpiconconfigurator.cpp -SOURCE upnpprogresswatcher.cpp - - -LIBRARY euser.lib -LIBRARY bafl.lib -LIBRARY centralrepository.lib -LIBRARY upnpserviceframework.lib -LIBRARY avmediaserverclient.lib -LIBRARY upnpipserversutils.lib -LIBRARY efsrv.lib -LIBRARY estor.lib - -// content server -LIBRARY upnpcontentserverclient.lib -// UPnPSecurity -LIBRARY upnpsecurity.lib -// PathInfo -LIBRARY PlatformEnv.lib -// UpnpCommonUtils -LIBRARY upnputilities.lib -// UPnPAVControllerFactory -LIBRARY upnpavcontrollerclient.lib -LIBRARY upnpavcontrollerhelper.lib -LIBRARY upnpsettingsengine.lib - -LIBRARY commdb.lib - -DEBUGLIBRARY flogger.lib - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/inc/upnpcontentrequestao.h --- a/upnpsharing/applicationengine/inc/upnpcontentrequestao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: content fetching engine active object class defition -* -*/ - - - - - - -#ifndef __UPNPCONTENTREQUESTAO_H__ -#define __UPNPCONTENTREQUESTAO_H__ - - -// Include Files -#include -#include //for CDesCArray -#include "upnpcontentserverclient.h" - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; - - -// CLASS DECLARATION -/** - * Active object class for querying shared content from upnpcontentserver - * @lib upnpapplicationengine.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUpnpContentRequestAO ): public CActive - { - -public: // Constructors and destructor - - /** - * C++ default constructor. - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aContentServer Handle to upnpcontentserver - */ - CUpnpContentRequestAO( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ); - - /** - * Destructor. - */ - virtual ~CUpnpContentRequestAO(); - -public: // new functions - - /** - * Request playlist or album names for UI from server, asynchronous - * @since S60 3.1 - * @param aType Type of selections to request - */ - void RequestSelectionContentL( UpnpContentServer::TUpnpMediaType aType ); - - /** - * Get playlist or album names for UI after request, synchronous - * @since S60 3.1 - * @param aArray Array for albums / playlist names - */ - void GetSelectionContentL( CDesCArray& aArray ); - - /** - * Request selected items for UI from server, asynchronous - * @since S60 3.1 - * @param aType Type of selections to request - */ - void RequestSelectionIndexesL( - UpnpContentServer::TUpnpMediaType aType ); - - /** - * Get the selected items for UI after request, synchronous - * @since S60 3.1 - * @param aCurrentSelection Array for selection indexes - */ - void GetSelectionIndexesL( CArrayFix& aCurrentSelection ); - -private: // from CActive - - /** - * Function is called when active request is ready - * @since S60 3.1 - */ - virtual void RunL(); - - /** - * Cancels active request - * @since S60 3.1 - */ - virtual void DoCancel(); - -private: // data - - /** - * file sharing engine - */ - CUPnPFileSharingEngine& iEngine; - - /** - * Content server session handle - */ - RUpnpContentServerClient& iContentServer; - - /** - * Current state - */ - enum TState - { - ENone = 0, - ERequestContent, - ERequestIndexes - }; - TState iState; - - }; - -#endif // __UPNPCONTENTREQUESTAO_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/inc/upnpcontentshareao.h --- a/upnpsharing/applicationengine/inc/upnpcontentshareao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +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: file sharing engine class definition -* -*/ - - - - - -#ifndef __UPNPCONTENTSHAREAO_H__ -#define __UPNPCONTENTSHAREAO_H__ - -// INCLUDES -#include -#include "upnpcontentserverclient.h" - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; - -/** - * A class to send request to content server and get the responce. - * * @since S60 3.2 - */ -NONSHARABLE_CLASS( CUpnpContentShareAO ) : public CActive - { - -private: - - /** - * C++ constructor. - * @since S60 3.2 - * @param aEngine the file sharing engine - * @aContentServer the contentserver client - */ - CUpnpContentShareAO( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ); - - /** - * Perform the second phase construction - * @since S60 3.2 - */ - void ConstructL(); - -public: - - /** - * Two-phased constructor. - * @since S60 3.2 - * @param aEngine the file sharing engine - * @aContentServer the contentserver client - */ - static CUpnpContentShareAO* NewL( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ); - - /** - * Two-phased constructor. - * @since S60 3.2 - * @param aEngine the file sharing engine - * @aContentServer the contentserver client - */ - static CUpnpContentShareAO* NewLC( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ); - - /** - * C++ destructor. - */ - virtual ~CUpnpContentShareAO(); - - /** - * Sends the selected indexes to server and starts sharing - * @since S60 3.2 - * @param aMarkedItems List of selected indexes - * @param aType Type of selection - */ - void ChangeSharedContentL( - UpnpContentServer::TUpnpMediaType aType, - const CArrayFix& aMarkedItems ); - - /** - * Updates shared objects in mediaserver - * @since S60 3.2 - * @param aType Type of media to refresh - */ - void RefreshSharedContentL( - UpnpContentServer::TUpnpMediaType aType ); - -protected: - - /** - * Function is called when active request is ready - * @since S60 3.2 - */ - void RunL(); - - /** - * Cancels active request - * @since S60 3.2 - */ - void DoCancel(); - - /** - * Handles a leave occurring in the request completion event handler RunL() - * @since S60 3.2 - */ - TInt RunError( TInt aError ); - -private: // New functions - - /** - * Removes queued objects by given index. - * @since S60 5.1 - * @param aIndex The index of objects to be removed. - */ - void RemoveQueuedObject( TInt aIndex ); - - /** - * Removes Queued objects by type. - * @since S60 5.1 - * @param aType The type of objects to be removed. - */ - void RemoveQueuedObjectByType( UpnpContentServer::TUpnpMediaType aType ); - - /** - * Appends given Queued objects. - * @since S60 5.1 - * @param aType The type to appended - * @param aSelections The selection array to be appended. Can be NULL. - */ - void AppendQueuedObjectL( - UpnpContentServer::TUpnpMediaType aType, - CArrayFix* aSelections ); - -private: // data - - /** - * File sharing engine - */ - CUPnPFileSharingEngine& iEngine; - - /** - * Content server session handle - */ - RUpnpContentServerClient& iContentServer; - - /** - * Queued selection indexes - */ - typedef CArrayFix CSelections; - RPointerArray iQueuedSelections; - - /** - * Queued selection types - */ - RArray iQueuedTypes; - - }; - -#endif // __UPNPCONTENTSHAREAO_H__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/inc/upnpfilesharingengine.h --- a/upnpsharing/applicationengine/inc/upnpfilesharingengine.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: file sharing engine class definition - * -*/ - - - - - -#ifndef __UPNPFILESHARINGENGINE_H__ -#define __UPNPFILESHARINGENGINE_H__ - - -// Include Files -#include // CBase -#include // TBuf -#include // for CDesCArray - -#include "upnpconnectionmonitorobserver.h" -#include "upnpcontentserverclient.h" -#include "upnpfilesharingengineobserver.h" - -// FORWARD DECLARATIONS -class CUpnpContentRequestAO; -class CUPnPFileSharingEngineAO; -class CUpnpContentShareAO; -class CUpnpProgressWatcher; -class CUPnPConnectionMonitor; - - -// CONSTANTS - - -// ENUMERATIONS - -enum THomeConnectMediaType - { - EImageAndVideo = 0, - EPlaylist, - EPhotoFile, - EVideoFile, - EMusicFile - }; - -enum THomeConnectSharingStates - { - ENoChange = -99, - EShareNone = 0, - EShareMany, - EShareAll - }; - -// CLASS DECLARATION - -/** - * File sharing engine class for UPnP Home Connect Application - * @lib upnpapplicationengine.lib - * @since S60 3.1 - */ -class CUPnPFileSharingEngine : public CBase, - public MUPnPConnectionMonitorObserver - { - -private: - - /** - * C++ default constructor. - */ - CUPnPFileSharingEngine(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - -public: // Constructors and destructor - - /** - * Two-phased constructor. - * @since S60 3.1 - */ - IMPORT_C static CUPnPFileSharingEngine* NewL(); - - /** - * Two-phased constructor. - * @since S60 3.1 - */ - IMPORT_C static CUPnPFileSharingEngine* NewLC(); - - /** - * Destructor. - * @since S60 3.1 - */ - IMPORT_C virtual ~CUPnPFileSharingEngine(); - -public: - - /** - * Sets observer for active object - * @since S60 3.1 - * @param aObserver, observer class - */ - IMPORT_C void SetObserver( MUPnPFileSharingEngineObserver* aObserver ); - - /** - * Return handle to MUPnPFileSharingEngineObserver interface - * @since S60 3.1 - */ - IMPORT_C MUPnPFileSharingEngineObserver* Observer(); - - /** - * Sets sharing state to on or off - * Asynchronous, callback to - * MUPnPFileSharingEngineObserver::HandleSharingStatus - * @since S60 3.1 - * @param aState ETrue to enable sharing, otherwise EFalse - */ - IMPORT_C void SetSharingStateL( TBool aState ); - - /** - * Gets file sharing state from local MediaServer - * @since S60 3.1 - * @return ETrue if sharing is ON otherwise EFalse - */ - IMPORT_C TBool SharingStateL(); - - /** - * Starts sharing process - * Asynchronous, callback to - * MUPnPFileSharingEngineObserver::HandleSharingDone and - * MUPnPFileSharingEngineObserver::HandleSharingProgress - * @since S60 3.1 - * @param aType, Type of media to share - */ - IMPORT_C void ShareMediaL( THomeConnectMediaType aType ); - - /** - * Updates shared objects - * Asynchronous, callback to - * MUPnPFileSharingEngineObserver::HandleSharingDone and - * MUPnPFileSharingEngineObserver::HandleSharingProgress - * @since S60 3.1 - * @param aType Type of media to refresh - */ - IMPORT_C void RefreshSharedMediaL( THomeConnectMediaType aType ); - - /** - * Gets the selected albums/playlist indexes - * Asynchronous, callback to - * MUPnPFileSharingEngineObserver::HandleSelectionIndexes - * @since S60 3.1 - * @param aType Type of media selected - */ - IMPORT_C void RequestSelectionIndexesL( - THomeConnectMediaType aType ) const; - - /** - * Gets the selected albums/playlist indexes - * @since S60 3.1 - * @param aMarkedItems The indexes of the selections user has made\ -relative to selections received from GetSelectionContentL - */ - IMPORT_C void GetSelectionIndexesL( - CArrayFix& aMarkedItems ) const; - - /** - * Sets the user selections - * @since S60 3.1 - * @param aType Type of media selected - * @param aMarkedItems The indexes of the selections user has made\ -relative to selections received from GetSelectionContentL - */ - IMPORT_C void SetSelectionIndexesL( - THomeConnectMediaType aType, - const CArrayFix& aMarkedItems ); - - /** - * Requests the album /playlist names - * Asynchronous, callback to - * MUPnPFileSharingEngineObserver::HandleSelectionContent - * @since S60 3.1 - * @param aType Type of the media requested - */ - IMPORT_C void RequestSelectionContentL( THomeConnectMediaType aType ); - - /** - * Gets the album /playlist names from upnpcontentserver once ready - * @since S60 3.1 - * @param aType Container type - * @param aArray Array containng the names for the UI - */ - IMPORT_C void GetSelectionContentL( CDesCArray& aArray ) const; - - /** - * Request information about sharing statuses / progress from the - * contentserver. The information is received via callback - * @since S60 3.1 - */ - IMPORT_C void RequestSharingProgressL(); - - /** - * Starts upload listener. Leave in case of error - * @since S60 3.1 - */ - IMPORT_C void StartUploadListenerL(); - - /** - * Stops upload listener. Leave in case of error - * @since S60 3.1 - */ - IMPORT_C void StopUploadListenerL(); - - /** - * Start or stop connection monitoring - * @since S60 3.1 - * @param aState ETrue = Start, EFalse = Stop - * @param aStatus TRequestStatus for async operation - */ - void SetConMonStateL( TBool aState, TRequestStatus& aStatus ); - - /** - * Set share file completed flag - * @since S60 3.2.3 - * @param aShareState set ETrue indicate imageandvideo or playlist shared completely, - * perhaps both of them shared completely. - * EFalse indicate imageandvideo or playlist shared incompletely, - * perhaps both of them shared completely. - */ - void SetShareFileComplete( TBool aShareState ) ; - -private: - - /** - * Helper function to copy TInts between arrays of CArrayFix& - * @since S60 3.1 - */ - void CopyTintArrayL( const CArrayFix& aSrc, - CArrayFix& aDst) const; - - /** - * Helper function to copy descriptors between arrays of CDesCArrays - * @since S60 3.1 - */ - void CopyCdescArrayL( const CDesCArray& aSrc, - CDesCArray& aDst ) const; - -private : // From MUPnPConnectionMonitorObserver - - /** - * Update the sharing state variable in case WLAN connection is lost - * From MUPnPConnectionMonitorObserver - * @since S60 3.1 - */ - void ConnectionLost(); - -private: // data - - /** - * Active object for asynchronous file sharing - */ - CUPnPFileSharingEngineAO* iAO; - - /** - * Active object for asynchronous get responce from content server - * Owned. - */ - CUpnpContentShareAO* iContentSharer; - - /** - * Active object class retrieving information about selections and - * content from upnpcontentserver - */ - CUpnpContentRequestAO* iContentRequestor; - - /** - * Cached image selections - */ - CArrayFixFlat* iImageSelections; - - /** - * Cached music selections - */ - CArrayFixFlat* iMusicSelections; - - /** - * Client side handle to upnpcontentserver - */ - RUpnpContentServerClient iContentServer; - - /** - * Observer for file sharing state - */ - MUPnPFileSharingEngineObserver* iObserver; - - /** - * Set share file completed flag. - */ - TBool iShareFileState; - - /** - * Connection monitor - */ - CUPnPConnectionMonitor* iConnMon; - - /** - * Active object handling querying progress - */ - CUpnpProgressWatcher* iProgress; - - }; - -#endif // __UPNPFILESHARINGENGINE_H__ -// End of file - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/inc/upnpfilesharingengineao.h --- a/upnpsharing/applicationengine/inc/upnpfilesharingengineao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: file sharing engine active object class definition -* -*/ - - - - - - -#ifndef __UPNPFILESHARINGENGINEAO_H__ -#define __UPNPFILESHARINGENGINEAO_H__ - - -// Include Files -#include -#include //for CDesCArray -#include -#include "upnpcontentserverclient.h" - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; -class CUPnPIconConfigurator; - -// CLASS DECLARATION -/** - * Active object class for file sharing - * Handles starting and stopping of filesharing and upload listener - * @lib upnpapplicationengine.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUPnPFileSharingEngineAO ): public CActive - { - -public: // Constructors and destructor - - /** - * C++ default constructor. - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aContentServer Handle to upnpcontentserver - */ - CUPnPFileSharingEngineAO( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ); - - /** - * Destructor. - */ - virtual ~CUPnPFileSharingEngineAO(); - -private: // From CActive - - /** - * Function is called when active request is ready - * @since S60 3.1 - */ - void RunL(); - - /** - * Handles a leave occurring in the request completion event handler - * @since S60 3.1 - * @param aError The leave code - */ - TInt RunError( TInt aError ); - - /** - * Cancels active request - * @since S60 3.1 - */ - void DoCancel(); - -public: // new functions - - /** - * Starts file sharing process - * @since S60 3.1 - * @param aState ETrue to enable sharing, otherwise EFalse - */ - void SetSharingStateL( TBool aState ); - - /** - * Gets file sharing state from local MediaServer - * @since S60 3.1 - * @return ETrue if sharing is ON otherwise EFalse - */ - TBool SharingStateL(); - - /** - * Set the internal state of class in case connection is lost - * @since S60 3.1 - */ - void ConnectionLost(); - - /** - * Check that there is enough disk space in c drive - * @since S60 3.1 - * @return EFalse if there is no disk space - */ - TBool HasDiskSpace(); - - /** - * Inform that settings of mediaserver icon is complete - * @since S60 3.2 - * @param aError Error code of the operation - */ - void SetIconComplete( TInt aError ); - -private: - - /** - * Open connection to media server - * @since S60 3.1 - */ - TInt OpenMediaServer(); - - /** - *Enables upnp security - */ - void EnableUpnpSecurityL(); - - /** - * Checks whether mediaserver icons need to be configured - */ - void CheckMediaserverIconsL(); - -private: // Data - - /** - * file sharing engine - */ - CUPnPFileSharingEngine& iEngine; - - /** - * Content server session handle - */ - RUpnpContentServerClient& iContentServer; - - /** - * mediaserver session handle - */ - RUpnpMediaServerClient iMediaServer; - - /** - * Internal state - */ - enum TState - { - ENotActive, - EStartSharing, - EStopSharing, - ECheckIcon, - EWaitSetConMonStateTrue, - EWaitSetConMonStateFalse - }; - TState iState; - - /** - * Cached value of sharing state - */ - enum TUpnpVisibility - { - EUnknown = 0, - EOnline, - EOffline - }; - TUpnpVisibility iVisibility; - - /** - * handle add icons - * owned - */ - CUPnPIconConfigurator* iIconConfigurator; - - }; - -#endif // __UPNPFILESHARINGENGINEAO_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/inc/upnpfilesharingengineobserver.h --- a/upnpsharing/applicationengine/inc/upnpfilesharingengineobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: File sharing observer class definition -* -*/ - - - - - - -#ifndef __UPNPAPPSHARINGENGINEOBSERVER_H__ -#define __UPNPAPPSHARINGENGINEOBSERVER_H__ - -// INCLUDE FILES -#include -#include "upnpcontentserverclient.h" - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; - - -// CONSTANTS - - -/** - * File sharing observer definition - * @lib upnpapplicationengine.lib - * @since S60 3.1 - */ -class MUPnPFileSharingEngineObserver - { - -public: - - /** - * Virtual destructor - */ - virtual ~MUPnPFileSharingEngineObserver() {}; - - /** - * Function informs when file sharing was enabled or disabled - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aError, error code - * @param aPhase ETrue if current phase is sharing activation, - * otherwise EFalse - */ - virtual void HandleSharingStatus( - CUPnPFileSharingEngine& /*aEngine*/, - TInt /*aError*/, - TBool /*aPhase*/ ) {} - - /** - * Informs about status of the sharing progress - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aProgress Data contains information about sharing\ - progress - */ - virtual void HandleSharingProgress( - CUPnPFileSharingEngine& /*aEngine*/, - const RArray& /*aProgress*/ ) {} - - /** - * Function informs when file sharing is done - * @param aEngine File sharing engine - * @param aError, error code - */ - virtual void HandleSharingDone( - CUPnPFileSharingEngine& /*aEngine*/, TInt /*aError*/ ) {} - - /** - * callback for CUPnPFileSharingEngine::RequestSelectionIndexesL - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aError Error code - */ - virtual void HandleSelectionIndexes( - CUPnPFileSharingEngine& /*aEngine*/, TInt /*aError*/ ) {} - - /** - * callback for CUPnPFileSharingEngine::RequestSelectionContentL - * @since S60 3.1 - * @param aEngine File sharing engine - * @param aError Error code - */ - virtual void HandleSelectionContent( - CUPnPFileSharingEngine& /*aEngine*/, TInt /*aError*/ ) {} - - /** - * Callback to inform if connection has been lost - * @since S60 3.1 - * @param aEngine File sharing engine - */ - virtual void HandleSharingConnectionLost( - CUPnPFileSharingEngine& /*aEngine*/ ) {} - - }; - -#endif //__UPNPAPPSHARINGENGINEOBSERVER_H__ - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/inc/upnpiconconfigurator.h --- a/upnpsharing/applicationengine/inc/upnpiconconfigurator.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +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: Configurator class for mediaserver icons -* -*/ - - - - - - -#ifndef __UPNPICONCONFIGURATOR_H__ -#define __UPNPICONCONFIGURATOR_H__ - - -// Include Files -#include -#include -#include "upnpcontentserverclient.h" -// FORWARD DECLARATIONS -class RUpnpMediaServerClient; -class CActiveSchedulerWait; -class CRepository; -class CUPnPFileSharingEngineAO; - -// CLASS DECLARATION -/** - * Active object class for add icons - * Handles add icons. - * @lib upnpapplicationengine.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUPnPIconConfigurator ): public CActive - { - -public: // Constructors and destructor - - /** - * C++ default constructor. - * @since S60 3.1 - * @param CUPnPFileSharingEngine*, pointer to file sharing engine - */ - CUPnPIconConfigurator( - RUpnpMediaServerClient& aMediaServer, - CUPnPFileSharingEngineAO& aFileShareingAO ); - - /** - * Destructor. - */ - virtual ~CUPnPIconConfigurator(); - -public: // thre icon configurator interface - - /** - * Checks if icons need to be configured. - * @return ETrue if icons are not yet configured, EFalse if they are - */ - TBool NeedToConfigureIcons(); - - /** - * Configure icons for upnp mediaserver - * Asynchronous method - wakes up given active object - * when operation is completed. - * @return error code - */ - void ConfigureIconsL(); - -protected: - - /** - * Function is called when active request is ready - * @since S60 3.1 - */ - virtual void RunL(); - - /** - * Cancels active request - * @since S60 3.1 - */ - virtual void DoCancel(); - - /** - * RunL error handler - * @param aError Error code - * return See CActive description - * @since S60 3.1 - */ - TInt RunError(TInt aError); - -private: // own methods - - /** - * Removes all icons - */ - void RemoveIcons(); - - /** - * Sets first icon - */ - void AddIcon1L(); - - /** - * Sets second icon - */ - void AddIcon2L(); - - /** - * Sets third icon - */ - void AddIcon3L(); - - /** - * Sets fourth icon - */ - void AddIcon4L(); - - /** - * Resolves the absolute icon path. The icon will be searched from - * the same drive where this DLL is located. - * @param relativePath relative path, without the drive, beginning with \ - * @param iconPath, output, receives absolute icon path. - */ - void ResolveIconPath( const TDesC& relativePath, TFileName& iconPath ); - - /** - * Checks if icons are added (from cenrep) - * @return true (configured) of false (icons not configured) - */ - TBool CheckIconsAddedL(); - -public: - - /** - * Marks icons configured to cenrep - * @param aMark true (configured) or false (not configured) - */ - static void MarkIconsAddedL( TBool aMark ); - -private: // data - - enum TConfiguratorState - { - EStateIdle, // ready - EStateRemoving, // removing all currently existing icons - // (only in debug mode) - EStateAdding1, // adding first icon - EStateAdding2, // adding second icon - EStateAdding3, // adding third icon - EStateAdding4 // adding fourth icon - }; - - /** - * mediaserver session handle - */ - RUpnpMediaServerClient& iMediaServer; - - /** - * Indicates whether the starting sharing or stopping - * sharing is ongoing. - */ - TConfiguratorState iState; - - /** - * icon - */ - CUpnpIcon* iIcon1; - CUpnpIcon* iIcon2; - CUpnpIcon* iIcon3; - CUpnpIcon* iIcon4; - - /** - * Sharing engine's active object - */ - CUPnPFileSharingEngineAO& iFileShareEngineAO; - - }; - -#endif // __UPNPICONCONFIGURATOR_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/inc/upnpprogresswatcher.h --- a/upnpsharing/applicationengine/inc/upnpprogresswatcher.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2007 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: file sharing engine active object class defition - * -*/ - - - - - - - -#ifndef __UPNPPROGRESSWATCHER_H__ -#define __UPNPPROGRESSWATCHER_H__ - - -// Include Files -#include -#include -#include "upnpcontentserverclient.h" -#include "upnpfilesharingengineobserver.h" - -// FORWARD DECLARATIONS - - -// CLASS DECLARATION -/** - * Active object class for observing sharing progress - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUpnpProgressWatcher ): public CActive - { -public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aEngine File sharing engine - */ - static CUpnpProgressWatcher* NewL( CUPnPFileSharingEngine& aEngine ); - - /** - * Destructor. - */ - virtual ~CUpnpProgressWatcher(); - -public: // New functions - - /** - * Starts listening property - * @since S60 3.1 - */ - void StartL(); - - /** - * Stops listening property - * @since S60 3.1 - */ - void Stop(); - -protected: - - /** - * Function is called when active request is ready - */ - virtual void RunL(); - - /** - * Cancels active request - */ - virtual void DoCancel(); - -private: - - /** - * C++ default constructor. - * @param aEngine File sharing engine - */ - CUpnpProgressWatcher( CUPnPFileSharingEngine& aEngine ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Determine if the sharing completed note needs to be shown - * @since S60 3.1 - * @param aProgress Progress information struct - */ - void SetShowCompleteNote( const TUpnpProgress& aProgress ); - - /** - * Determine if there is sharing ongoing - * @since S60 3.1 - * @param aProgress Progress information struct - * @return ETrue if there is sharing ongoing for at least one media type - */ - TBool SharingOngoing( const TUpnpProgress& aProgress ); - - /** - * Handle Errors - * @since S60 3.1 - * @param aProgress Progress information struct - */ - void HandleErrorL( const TUpnpProgress& aProgress ); - -private: // data - - /** - * file sharing engine - */ - CUPnPFileSharingEngine& iEngine; - - /** - * property subscribed - */ - RProperty iProgressInfo; - - /** - * Indicates if is is needed to show note about sharing end - */ - TBool iShowCompleteNote; - - }; - - -#endif // __UPNPPROGRESSWATCHER_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/src/upnpcontentrequestao.cpp --- a/upnpsharing/applicationengine/src/upnpcontentrequestao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CUpnpContentRequestAO class implementation - * -*/ - - - - - - -// INCLUDE FILES -// System -#include -#include - -// upnp stack api -#include - -// upnpframework / avcontroller api -#include "upnpavcontrollerfactory.h" - -// homeconnect internal -#include "upnpcontentrequestao.h" -#include "upnpfilesharingengine.h" - -_LIT( KComponentLogfile, "applicationengine.txt"); -#include "upnplog.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::CUpnpContentRequestAO -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpContentRequestAO::CUpnpContentRequestAO( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ) - : CActive( CActive::EPriorityStandard ), - iEngine( aEngine ), - iContentServer( aContentServer ) - { - CActiveScheduler::Add( this ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::~CUpnpContentRequestAO() -// Destructor -// -------------------------------------------------------------------------- -// -CUpnpContentRequestAO::~CUpnpContentRequestAO() - { - if ( IsActive() ) - { - __LOG( "CUpnpContentRequestAO destructor: IsActive == TRUE!" ); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - } - - Cancel(); - } - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::RequestSelectionContentL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentRequestAO::RequestSelectionContentL( - UpnpContentServer::TUpnpMediaType aType ) - { - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionContentL\ - begin"); - - // check media server availibility - if ( IsActive() || - UPnPAVControllerFactory::MSServicesInUse() ) - { - User::Leave( KErrInUse ); - } - iContentServer.GetSelectionContentL( aType, iStatus ); - SetActive(); - iState = ERequestContent; - - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionContentL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::GetSelectionContentL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentRequestAO::GetSelectionContentL( CDesCArray& aArray ) - { - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionContentL\ - begin"); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - iContentServer.GetSelectionContentResultL( aArray ); - - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionContentL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::RequestSelectionIndexesL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentRequestAO::RequestSelectionIndexesL( - UpnpContentServer::TUpnpMediaType aType ) - { - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionIndexesL\ - begin"); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - iContentServer.GetSelectionIndexesL( aType, iStatus ); - SetActive(); - iState = ERequestIndexes; - - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::RequestSelectionIndexesL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::GetSelectionIndexesL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentRequestAO::GetSelectionIndexesL( - CArrayFix& aCurrentSelection ) - { - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionIndexesL\ - begin"); - - if ( IsActive() ) - { - User::Leave( KErrInUse ); - } - iContentServer.GetSelectionIndexesResultL( aCurrentSelection ); - - __LOG("[UPNP_ENGINE]\t CUpnpContentRequestAO::GetSelectionIndexesL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::RunL -// Called when asyncronous request is ready -// -------------------------------------------------------------------------- -// -void CUpnpContentRequestAO::RunL() - { - __LOG1("[UPNP_ENGINE]\t CUpnpContentRequestAO::RunL, error=%d", - iStatus.Int()); - - TState state( iState ); - iState = ENone; - - if ( iStatus.Int() ) - { - __LOG1("CUpnpContentRequestAO::RunL: Error %d in iStatus", - iStatus.Int() ); - } - - if ( iEngine.Observer() ) - { - if ( state == ERequestContent ) - { - iEngine.Observer()->HandleSelectionContent( - iEngine, iStatus.Int() ); - } - else if ( state == ERequestIndexes ) - { - iEngine.Observer()->HandleSelectionIndexes( - iEngine, iStatus.Int() ); - } - else - { - __PANICD( __FILE__, __LINE__ ); - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpContentRequestAO::DoCancel -// Cancels the active request -// -------------------------------------------------------------------------- -// -void CUpnpContentRequestAO::DoCancel() - { - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/src/upnpcontentshareao.cpp --- a/upnpsharing/applicationengine/src/upnpcontentshareao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,321 +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: CUpnpContentShareAO class implementation -* -*/ - - - - - - -// INCLUDE FILES - -#include "upnpcontentshareao.h" -#include "upnpfilesharingengine.h" - -_LIT( KComponentLogfile, "applicationengine.txt"); -#include "upnplog.h" - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::CUpnpContentShareAO -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpContentShareAO::CUpnpContentShareAO( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ): - CActive( CActive::EPriorityStandard ), - iEngine( aEngine ), - iContentServer( aContentServer ) - { - CActiveScheduler::Add( this ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::ConstructL() -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::ConstructL() - { - __LOG( "CUpnpContentShareAO::ConstructL" ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::NewL -// -------------------------------------------------------------------------- -// -CUpnpContentShareAO* CUpnpContentShareAO::NewL( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ) - { - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewL begin" ); - CUpnpContentShareAO* self = CUpnpContentShareAO::NewLC( - aEngine, aContentServer ); - CleanupStack::Pop( self ); - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewL end" ); - return self; - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::NewLC -// -------------------------------------------------------------------------- -// -CUpnpContentShareAO* CUpnpContentShareAO::NewLC( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ) - { - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewLC begin" ); - CUpnpContentShareAO* self = new( ELeave ) - CUpnpContentShareAO( aEngine, aContentServer ); - CleanupStack::PushL( self ); - self->ConstructL(); - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::NewLC end" ); - return self; - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::~CUpnpContentShareAO() -// Destructor -// -------------------------------------------------------------------------- -// -CUpnpContentShareAO::~CUpnpContentShareAO() - { - __LOG( "CUpnpContentShareAO::~CUpnpContentShareAO " ); - - iQueuedSelections.ResetAndDestroy(); - iQueuedSelections.Close(); - iQueuedTypes.Close(); - - Cancel(); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::ChangeSharedContentL() -// Sends the selected indexes to server and starts sharing -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::ChangeSharedContentL( - UpnpContentServer::TUpnpMediaType aType, - const CArrayFix& aMarkedItems ) - { - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\ -ChangeSharedContentL begin" ); - - if ( !IsActive() ) - { - __ASSERTD( iQueuedTypes.Count() == 0, __FILE__, __LINE__ ); - iContentServer.ChangeSharedContentL( aType, aMarkedItems, iStatus ); - iStatus = KRequestPending; - SetActive(); - } - else - { - //remove all queued requests with this type - RemoveQueuedObjectByType( aType ); - - //queue this request - CArrayFix* selections = - new ( ELeave ) CArrayFixFlat( aMarkedItems.Count() ); - CleanupStack::PushL( selections ); - for ( TInt i ( 0 ); i < aMarkedItems.Count(); i++ ) - { - selections->AppendL( aMarkedItems.At(i) ); - } - - AppendQueuedObjectL( aType, selections ); - CleanupStack::Pop( selections ); - __ASSERTD( iQueuedSelections.Count() == iQueuedTypes.Count(), - __FILE__, __LINE__ ); - } - - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\ -ChangeSharedContentL end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::RefreshSharedContentL() -// Updates shared objects in mediaserver -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::RefreshSharedContentL( - UpnpContentServer::TUpnpMediaType aType ) - { - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\ -RefreshSharedContentL begin" ); - if ( !IsActive() ) - { - __ASSERTD( iQueuedTypes.Count() == 0, __FILE__, __LINE__ ); - iContentServer.RefreshSharedContentL( aType, iStatus ); - iStatus = KRequestPending; - SetActive(); - } - else - { - //remove all queued requests with this type - RemoveQueuedObjectByType( aType ); - - //queue this request - CArrayFix* selections( NULL ); - AppendQueuedObjectL( aType, selections ); - __ASSERTD( iQueuedSelections.Count() == iQueuedTypes.Count(), - __FILE__, __LINE__ ); - } - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::\ -RefreshSharedContentL end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::DoCancel -// Cancel the operation -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::DoCancel() - { - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::DoCancel" ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::RunL -// Function is called when active request is ready -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::RunL() - { - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::RunL begin" ); - __LOG1( "[UPNP_ENGINE]\t\t status: %d", iStatus.Int() ); - - TInt err = iStatus.Int(); - if ( err && - err != KErrServerBusy ) - { - // KErrServerBusy is a response to the - // CUpnpContentServer::RefreshSharedContentL call. Therefore we must - // not leave without cleaning queued objects. - // Otherwise next call to CUpnpContentShareAO::RefreshSharedContentL - // will panic (in UDEB builds only!!!!). - - // Clears queued objects and leaves. - iQueuedSelections.ResetAndDestroy(); - iQueuedTypes.Reset(); - User::Leave( err ); - } - - //When get the responce from the content server then change the UI - iEngine.RequestSharingProgressL(); - - if ( iQueuedTypes.Count() ) - { - // Get next queued objects - UpnpContentServer::TUpnpMediaType type = iQueuedTypes[ 0 ]; - CArrayFix* selections = iQueuedSelections[ 0 ]; - - // Clear arrays. - iQueuedSelections.Remove( 0 ); - iQueuedTypes.Remove( 0 ); - - if ( selections ) - { - //share request - CleanupStack::PushL( selections ); - iContentServer.ChangeSharedContentL( type, *selections, iStatus ); - CleanupStack::PopAndDestroy( selections ); - } - else - { - //refresh request - iContentServer.RefreshSharedContentL( type, iStatus ); - } - - iStatus = KRequestPending; - SetActive(); - } - __LOG( "[UPNP_ENGINE]\t CUpnpContentShareAO::RunL end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::RunError -// Handles a leave occurring in the request completion -// -------------------------------------------------------------------------- -// -TInt CUpnpContentShareAO::RunError( TInt aError ) - { - __LOG( "CUpnpContentShareAO::RunError" ); - if ( iEngine.Observer() ) - { - iEngine.Observer()->HandleSharingDone( iEngine, aError ); - } - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::RemoveQueuedObjects -// Removed queued objects by index. -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::RemoveQueuedObject( TInt aIndex ) - { - // Checks argument in udeb build. - // USER 130 panic will occure in urel builds if argument is - // incorrent. - TInt count = iQueuedTypes.Count(); - __ASSERTD( aIndex >= 0 && aIndex < iQueuedTypes.Count(), - __FILE__, __LINE__ ); - - iQueuedTypes.Remove( aIndex ); - if ( iQueuedSelections[ aIndex ] ) - { - delete iQueuedSelections[ aIndex ]; - } - iQueuedSelections.Remove( aIndex ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::RemoveQueuedObjectByType -// Removed queued objects by type. -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::RemoveQueuedObjectByType( - UpnpContentServer::TUpnpMediaType aType ) - { - //remove all queued requests with this type - for ( TInt i( iQueuedTypes.Count() - 1 ); i >= 0; i-- ) - { - if ( iQueuedTypes[ i ] == aType ) - { - RemoveQueuedObject( i ); - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpContentShareAO::AppendQueuedObjectL -// Appends given objects. -// -------------------------------------------------------------------------- -// -void CUpnpContentShareAO::AppendQueuedObjectL( - UpnpContentServer::TUpnpMediaType aType, - CArrayFix* aSelections ) - { - iQueuedTypes.AppendL( aType ); - TRAPD( err, iQueuedSelections.AppendL( aSelections ) ); - if ( err ) - { - // Couldn't append array to the iQueuedSelections array. - // Removes the type and leaves. - iQueuedTypes.Remove( iQueuedTypes.Count() - 1 ); - User::Leave( err ); - } - } diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/src/upnpfilesharingengine.cpp --- a/upnpsharing/applicationengine/src/upnpfilesharingengine.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,522 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CUPnPFileSharingEngine class implementation - * -*/ - - - - - - -// Include Files -#include -#include -#include -#include - -#include -#include "upnpfilesharingengine.h" -#include "upnpfilesharingengineao.h" -#include "upnpcontentrequestao.h" -#include "upnpcontentshareao.h" -#include "upnpcontentserverclient.h" -#include "upnpsettingsengine.h" -#include "upnpprogresswatcher.h" -#include "upnpcommonutils.h" -#include "upnpdownloaditemresolver.h" -#include "upnpcontentshareao.h" -#include "upnpconnectionmonitor.h" -#include "upnpiconconfigurator.h" - -_LIT( KComponentLogfile, "applicationengine.txt"); -#include "upnplog.h" - -// ============================ MEMBER FUNCTIONS ============================= - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::CUPnPFileSharingEngine -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPFileSharingEngine::CUPnPFileSharingEngine() - { - iShareFileState = EFalse; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngine::ConstructL() - { - iContentServer.OpenL(); - iAO = new (ELeave) CUPnPFileSharingEngineAO( *this, iContentServer ); - iContentSharer = CUpnpContentShareAO::NewL( *this, iContentServer ); - UPnPCommonUtils::DeleteTempFilesL(); - CUPnPDownloadItemResolver::DeleteTempDownloadFilesL(); - iContentRequestor = new (ELeave) CUpnpContentRequestAO( - *this, iContentServer ); - - // create connection monitor, so we can receive wlan lost notifications - // immideatly and observe connection if application was restarted - CUPnPSettingsEngine* settings = CUPnPSettingsEngine::NewLC(); - TInt iap( 0 ); - User::LeaveIfError( settings->GetAccessPoint( iap ) ); - CleanupStack::PopAndDestroy( settings ); - iConnMon = CUPnPConnectionMonitor::NewL( *this, iap ); - - //set flag that icons hasn't been set - CUPnPIconConfigurator::MarkIconsAddedL( EFalse ); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPFileSharingEngine* CUPnPFileSharingEngine::NewL() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewL begin"); - CUPnPFileSharingEngine* self = CUPnPFileSharingEngine::NewLC(); - CleanupStack::Pop( self ); - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewL end"); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::NewLC -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPFileSharingEngine* CUPnPFileSharingEngine::NewLC() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewLC begin"); - CUPnPFileSharingEngine* self = new (ELeave) CUPnPFileSharingEngine; - CleanupStack::PushL( self ); - self->ConstructL(); - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::NewLC end"); - return self; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::~CUPnPFileSharingEngine -// Destructor -// -------------------------------------------------------------------------- -// -EXPORT_C CUPnPFileSharingEngine::~CUPnPFileSharingEngine() - { - __LOG("[UPNP_ENGINE]\tCUPnPFileSharingEngine::~CUPnPFileSharingEngine\ - begin"); - - delete iConnMon; - delete iAO; - delete iContentSharer; - - delete iImageSelections; - delete iMusicSelections; - delete iContentRequestor; - - - iContentServer.Close(); - delete iProgress; - - __LOG("[UPNP_ENGINE]\tCUPnPFileSharingEngine::~CUPnPFileSharingEngine\ - end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::SetObserver -// Set observer -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::SetObserver( - MUPnPFileSharingEngineObserver* aObserver ) - { - iObserver = aObserver; - if ( !iObserver ) - { - if ( iProgress ) - { - iProgress->Stop(); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::Observer -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -EXPORT_C MUPnPFileSharingEngineObserver* CUPnPFileSharingEngine::Observer() - { - return iObserver; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::SetSharingState -// Starts/Stops file sharing using UPnP Media server API -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::SetSharingStateL( TBool aState ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSharingState \ -begin"); - if ( iProgress && iShareFileState ) - { - iProgress->Stop(); - } - iAO->SetSharingStateL( aState ); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSharingState \ -end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::SharingState -// Gets file sharing status. -// -------------------------------------------------------------------------- -// -EXPORT_C TBool CUPnPFileSharingEngine::SharingStateL() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SharingState \ -begin"); - - TBool status( EFalse ); - if ( iAO ) - { - status = iAO->SharingStateL(); - } - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SharingState \ -end"); - return status; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::ShareMediaL -// Starts sharing process -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::ShareMediaL( - THomeConnectMediaType aType ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::ShareMediaL begin"); - - switch ( aType ) - { - case EImageAndVideo : - { - iContentSharer->ChangeSharedContentL( - UpnpContentServer::TUpnpMediaType( aType ), - *iImageSelections ); - } - break; - case EPlaylist: - { - iContentSharer->ChangeSharedContentL( - UpnpContentServer::TUpnpMediaType( aType ), - *iMusicSelections ); - } - break; - default : - User::Leave( KErrArgument ); - break; - } - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::ShareMediaL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::RefreshSharedMediaL -// Updates shared objects -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::RefreshSharedMediaL( - THomeConnectMediaType aType ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RefreshSharedMediaL\ - begin"); - - // clear UI cache - delete iImageSelections; - iImageSelections = NULL; - delete iMusicSelections; - iMusicSelections = NULL; - - - iContentSharer->RefreshSharedContentL( - UpnpContentServer::TUpnpMediaType( aType ) ); - RequestSharingProgressL(); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RefreshSharedMediaL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::RequestSelectionIndexesL -// Gets the selected albums/playlist indexes -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::RequestSelectionIndexesL( - THomeConnectMediaType aType ) const - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionIndexesL\ - begin"); - - iContentRequestor->RequestSelectionIndexesL( - UpnpContentServer::TUpnpMediaType( aType ) ); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionIndexesL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::GetSelectionIndexes -// Gets the selected albums/playlist indexes -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::GetSelectionIndexesL( - CArrayFix& aMarkedItems ) const - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::GetSelectionIndexesL\ - begin"); - - iContentRequestor->GetSelectionIndexesL( aMarkedItems ); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::GetSelectionIndexesL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::SetSelectionIndexes -// Sets the user selections -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::SetSelectionIndexesL( - THomeConnectMediaType aType, - const CArrayFix& aMarkedItems ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSelectionIndexesL\ - begin"); - - switch ( aType ) - { - case EImageAndVideo: - { - delete iImageSelections; - iImageSelections = NULL; - iImageSelections = new (ELeave) CArrayFixFlat - (aMarkedItems.Count()); - CopyTintArrayL( aMarkedItems, *iImageSelections ); - } - break; - case EPlaylist: - { - delete iMusicSelections; - iMusicSelections = NULL; - iMusicSelections = new (ELeave) CArrayFixFlat - (aMarkedItems.Count()); - CopyTintArrayL( aMarkedItems, *iMusicSelections ); - - } - break; - default: - User::Leave( KErrArgument ); - break; - } - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::SetSelectionIndexesL\ - end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::RequestSelectionContentL -// Requests the album /playlist names -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::RequestSelectionContentL( - THomeConnectMediaType aType ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionContentL\ - begin"); - - iContentRequestor->RequestSelectionContentL( - UpnpContentServer::TUpnpMediaType( aType ) ); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::RequestSelectionContentL\ - begin"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::GetSelectionContentL -// Get all albums/playlists identifiers from Media gallery -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::GetSelectionContentL( - CDesCArray& aArray ) const - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine:: \ -GetSelectionContentL begin"); - - iContentRequestor->GetSelectionContentL( aArray ); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine:: \ -GetSelectionContentL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::RequestSharingProgressL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::RequestSharingProgressL() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -RequestSharingProgressL begin"); - if( !iProgress ) - { - iProgress = CUpnpProgressWatcher::NewL( *this ); - } - iProgress->StartL(); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -RequestSharingProgressL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::StartUploadListenerL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::StartUploadListenerL() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -StartUploadListenerL begin"); - iContentServer.StartUploadListenerL(); - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -StartUploadListenerL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::StopUploadListenerL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -EXPORT_C void CUPnPFileSharingEngine::StopUploadListenerL() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -StopUploadListenerL begin"); - iContentServer.StopUploadListenerL(); - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -StopUploadListenerL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::SetConMonState -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngine::SetConMonStateL( - TBool aState, TRequestStatus& aStatus ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -SetConMonState begin"); - - delete iConnMon; - iConnMon = NULL; - - if ( aState ) - { - // (Re)Start - CUPnPSettingsEngine* settings = CUPnPSettingsEngine::NewLC(); - TInt iap( KErrNotFound ); - User::LeaveIfError( settings->GetAccessPoint( iap ) ); - iConnMon = CUPnPConnectionMonitor::NewL( *this, iap ); - CleanupStack::PopAndDestroy( settings ); - iContentServer.StartConnectionMonitorL( iap, aStatus ); - } - else - { - iContentServer.StopConnectionMonitorL( aStatus ); - } - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -SetConMonState end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::ConnectionLost -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngine::ConnectionLost() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -ConnectionLost begin"); - if( iAO->SharingStateL() ) - { - iAO->ConnectionLost(); - if ( iObserver ) - { - iObserver->HandleSharingConnectionLost( *this ); - } - } - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngine::\ -ConnectionLost end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngine::CopyTintArrayL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngine::CopyTintArrayL( const CArrayFix& aSrc, - CArrayFix& aDst ) const - { - for ( TInt i(0); i -#include -#include -#include -#include - -// upnp stack api -#include -#include - -// upnpframework / avcontroller api -#include "upnpavcontrollerfactory.h" - -// upnpframework / internal api's -#include "upnpsecaccesscontroller.h" - -// homemedia internal -#include "upnpfilesharingengineao.h" -#include "upnpfilesharingengine.h" -#include "upnpapplicationcrkeys.h" //KUPnPAppMediaServerIcon -#include "upnpfileutilitytypes.h" //KJpegMime2 -#include "upnpiconconfigurator.h" - -_LIT( KComponentLogfile, "applicationengine.txt"); -#include "upnplog.h" - - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::CUPnPFileSharingEngineAO -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUPnPFileSharingEngineAO::CUPnPFileSharingEngineAO( - CUPnPFileSharingEngine& aEngine, - RUpnpContentServerClient& aContentServer ) - : CActive(CActive::EPriorityStandard), - iEngine( aEngine ), - iContentServer( aContentServer ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \ - CUPnPFileSharingEngineAO"); - CActiveScheduler::Add( this ); - } - - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::~CUPnPFileSharingEngineAO() -// Destructor -// -------------------------------------------------------------------------- -// -CUPnPFileSharingEngineAO::~CUPnPFileSharingEngineAO() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \ - ~CUPnPFileSharingEngineAO"); - - if ( IsActive() ) - { - __LOG( "CUPnPFileSharingEngineAO destructor: IsActive==TRUE!" ); - iState = ENotActive; - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - } - - Cancel(); - iMediaServer.Close(); - - delete iIconConfigurator; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::RunL -// Called when asyncronous request is ready -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngineAO::RunL() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL begin"); - - TInt err( iStatus.Int() ); - if ( err ) - { - __LOG1( "iStatus err =%d",err ); - } - switch ( iState ) - { - case ENotActive : - { - if ( err ) - { - // Inform Observer to handle the error. - if ( iEngine.Observer() ) - { - iEngine.Observer()-> - HandleSharingStatus( iEngine, err, EFalse ); - } - } - break; - } - // Show files outside - case ECheckIcon : - { - if( !err ) - { - __LOG1( "[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::ECheckIcon\ -err=%d", err ); - iState = EStartSharing; - // callback SetIconComplete - iIconConfigurator->ConfigureIconsL(); - } - else - { - iState = ENotActive; - if ( iEngine.Observer() ) - { - iEngine.Observer()-> - HandleSharingStatus( iEngine, err, ETrue ); - } - } - } - break; - case EStartSharing : - { - iMediaServer.Close(); - - if ( !err ) - { - iVisibility = EOnline; - iEngine.SetConMonStateL( ETrue, iStatus ); - SetActive(); - iState = EWaitSetConMonStateTrue; - } - else - { - iState = ENotActive; - if ( iEngine.Observer() ) - { - iEngine.Observer()-> - HandleSharingStatus( iEngine, err, ETrue ); - } - } - break; - } - case EWaitSetConMonStateTrue: - { - iState = ENotActive; - if ( iEngine.Observer() ) - { - iEngine.Observer()-> - HandleSharingStatus( iEngine, err, ETrue ); - } - break; - } - case EStopSharing : - { - if ( !err ) - { - iEngine.SetConMonStateL( EFalse, iStatus ); - SetActive(); - iState = EWaitSetConMonStateFalse; - } - else - { - iState = ENotActive; - if ( iEngine.Observer() ) - { - iEngine.Observer()-> - HandleSharingStatus( iEngine, err, EFalse ); - } - } - } - break; - case EWaitSetConMonStateFalse: - { - iState = ENotActive; - if ( iEngine.Observer() ) - { - iEngine.Observer()-> - HandleSharingStatus( iEngine, err, EFalse ); - } - break; - } - default : - { - __PANICD( __FILE__, __LINE__ ); - break; - } - } - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::RunError -// Handles a leave occurring in the request completion event handler -// -------------------------------------------------------------------------- -// -TInt CUPnPFileSharingEngineAO::RunError( TInt aError ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL begin"); - TState state ( iState ); - iState = ENotActive; - if ( iEngine.Observer() ) - { - TBool phase( EFalse ); - if( state == EStartSharing || - state == ECheckIcon || - state == EWaitSetConMonStateTrue ) - { - phase = ETrue; - } - - iEngine.Observer()-> - HandleSharingStatus( iEngine, aError, phase ); - } - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::RunL end"); - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::DoCancel -// Cancels active object -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngineAO::DoCancel() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::DoCancel begin"); - if ( iIconConfigurator ) - { - iIconConfigurator->Cancel(); - } - - if ( iEngine.Observer() && - iState != ENotActive ) - { - TBool phase( EFalse ); - if( iState == EStartSharing || - iState == ECheckIcon || - iState == EWaitSetConMonStateTrue ) - { - phase = ETrue; - } - - iEngine.Observer()-> - HandleSharingStatus( iEngine, KErrCancel, phase ); - } - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::DoCancel end"); - } - -// -------------------------------------------------------------------------- -// CUPnPSettingsEngineAO::SetSharingState -// Starts or stops file sharing -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngineAO::SetSharingStateL( TBool aState ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SetSharingState \ - begin"); - - if ( IsActive() ) - { - User::Leave ( KErrInUse ); - } - - // Open file sharing session from mediaserver - TBool started = SharingStateL(); - TInt err = OpenMediaServer(); - - if ( aState && !started ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -SetSharingState: StartSharing"); - - // check media server availibility - if ( !err ) - { - EnableUpnpSecurityL(); - - CheckMediaserverIconsL(); - - if ( !UPnPAVControllerFactory::MSServicesInUse() ) - { - if ( !HasDiskSpace() ) - { - err = KErrDiskFull; - } - } - else - { - err = KErrInUse; - } - } - if ( !err ) - { - iMediaServer.Start( iStatus ); - SetActive(); - } - else - { - SetActive(); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, err ); - } - } - else if ( !aState && started ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -SetSharingState: StopSharing"); - iState = EStopSharing; - // Ask current state of content server - TUpnpProgress totalProgress; - TPckgBuf progressBuf( totalProgress ); - TInt pubErr = RProperty::Get( KUpnpContentServerCat, - ESharingProgress, progressBuf ); - TBool sharingOngoing( EFalse ); - if ( !pubErr ) - { - Mem::Copy( &totalProgress, - progressBuf.Ptr(), sizeof( TUpnpProgress ) ); - if( totalProgress.iImageVideoProgress.iProgressType != - TUpnpProgressInfo::EVisualStatus || - totalProgress.iMusicProgress.iProgressType != - TUpnpProgressInfo::EVisualStatus ) - { - sharingOngoing = ETrue; - } - } - - if( !err ) - { - if ( !sharingOngoing ) - { - // no sharing operations ongoing, stop possible - err = iMediaServer.Stop(); - } - else - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -->Offline"); - err = iMediaServer.StartOffline(); - } - - if ( err != KErrNone ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:: \ -Error: iMediaServer"); - err = KErrGeneral; - // if the MediaServer lost, setting iVisibility = EUnknown - // will insure the function SharingState() to start the - // MediaServer session again. - iVisibility = EUnknown; - } - else - { - iVisibility = EOffline; - } - - iMediaServer.Close(); - } - SetActive(); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, err ); - } - else - { - //do nothing, it's already started - iState = EStopSharing; - if ( aState ) - { - iState = EStartSharing; - } - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - } - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SetSharingState \ - end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::SharingState -// Gets file sharing status. -// -------------------------------------------------------------------------- -// -TBool CUPnPFileSharingEngineAO::SharingStateL() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SharingState begin"); - - TBool status( EFalse ); - if ( iVisibility == EUnknown ) - { - // Start media server session - TInt err( OpenMediaServer() ); - if ( err == KErrNoMemory ) - { - User::Leave( KErrNoMemory ); - } - - if ( !err ) - { - TInt s( 0 ); - err = iMediaServer.Status( s ); - if ( s == RUpnpMediaServerClient::EStartedOnline ) - { - status = ETrue; - } - iMediaServer.Close(); - } - if ( status && !err ) - { - iVisibility = EOnline; - } - else - { - iVisibility = EOffline; - } - } - else if( iVisibility == EOffline ) - { - TInt err( OpenMediaServer() ); - if ( err == KErrNoMemory ) - User::Leave( KErrNoMemory ); - if ( !err ) - { - TInt s( 0 ); - err = iMediaServer.Status( s ); - if ( s == RUpnpMediaServerClient::EStartedOnline ) - { - status = ETrue; - } - iMediaServer.Close(); - } - } - else if ( iVisibility == EOnline ) - { - status = ETrue; - } - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::SharingState end"); - return status; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::ConnectionLost -// Gets file sharing status. -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngineAO::ConnectionLost() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -ConnectionLost begin"); - iVisibility = EOffline; - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -ConnectionLost end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::HasDiskSpace -// Check that there is enough disk space in c drive -// -------------------------------------------------------------------------- -// -TBool CUPnPFileSharingEngineAO::HasDiskSpace() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -HasDiskSpace begin"); - const TInt KDiskSpaceThreshold( 4096 ); //4kB - RFs fileServer; - TInt error = fileServer.Connect(); - TBool retVal( EFalse ); - TVolumeInfo freeVol; - if( !error ) - { - error = fileServer.SetSessionPath( PathInfo::PhoneMemoryRootPath() ); - if( !error ) - { - error = fileServer.Volume( freeVol ); - } - } - fileServer.Close(); - - if( !error ) - { - if( freeVol.iFree > KDiskSpaceThreshold ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO:\ -disk space:OK!"); - retVal = ETrue; - } - } - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -HasDiskSpace end"); - return retVal; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::SetIconComplete -// callback from icon configurator -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngineAO::SetIconComplete( TInt aError ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -SetIconComplete begin"); - - if ( aError != KErrNone ) - { - iMediaServer.Stop(); - } - - // delete iconConfigurator as not needed anymore - delete iIconConfigurator; - iIconConfigurator = NULL; - - // continue sharing - iState = EStartSharing; - __ASSERTD( !IsActive(), __FILE__, __LINE__ ); - SetActive(); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, aError ); - - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -SetIconComplete end"); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::OpenMediaServer -// Creates connection to mediaserver -// -------------------------------------------------------------------------- -// -TInt CUPnPFileSharingEngineAO::OpenMediaServer() - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -OpenMediaServer start"); - - TInt error = iMediaServer.Connect(); - if ( error == KErrNoMemory ) - { - return error; - } - - if ( error != KErrNone ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -OpenMediaServer: Connect FAILed"); - - // try to reconnect - iMediaServer.Close(); - error = iMediaServer.Connect(); - if( error ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -OpenMediaServer: ReConnect FAILed"); - } - - } - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -OpenMediaServer end"); - return error; - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::EnableUpnpSecurityL -// store the cenrep value -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngineAO::EnableUpnpSecurityL() - { - // Check if the stack's security is enabled - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -EnableUpnpSecurityL: Checking the state of stack's security manager"); - TBool upnpSecurityEnabled = EFalse; - TRAPD( secCheckError, - upnpSecurityEnabled = - CUpnpSecAccessController::IsMediaServerSecurityEnabledL()); - - // If the security is not enabled, enable it now - if( !secCheckError && - !upnpSecurityEnabled ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -EnableUpnpSecurityL: Activating stack's security manager"); - TRAPD( secEnableError, - CUpnpSecAccessController::EnableMediaServerSecurityL()); - if( secEnableError ) - { - __LOG("[UPNP_ENGINE]\t CUPnPFileSharingEngineAO::\ -EnableUpnpSecurityL: Failed to activate stack's security manager"); - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::CheckMediaserverIconsL -// Checks whether icons should be configured -// -------------------------------------------------------------------------- -// -void CUPnPFileSharingEngineAO::CheckMediaserverIconsL() - { - // Create the icon configurator and see if icons must be configured. - // If they need to, start asynchronous icon configuration process. - delete iIconConfigurator; - iIconConfigurator = NULL; - iIconConfigurator = new (ELeave ) - CUPnPIconConfigurator( iMediaServer, *this ); - if ( iIconConfigurator->NeedToConfigureIcons() ) - { - iState = ECheckIcon; - } - else - { - // icons already configured, go directly to sharing state - delete iIconConfigurator; - iIconConfigurator = NULL; - iState = EStartSharing; - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/src/upnpiconconfigurator.cpp --- a/upnpsharing/applicationengine/src/upnpiconconfigurator.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,376 +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: Configurator class for mediaserver icons - * -*/ - - - - - - -// INCLUDE FILES -// System -#include - -// upnp stack -#include - -// upnp framework internal API's -#include "upnpfileutilitytypes.h" // utilities / mime type definitions - -// app.engine internal -#include "upnpapplicationcrkeys.h" //KUPnPAppMediaServerIcon -#include "upnpfilesharingengineao.h" -#include "upnpiconconfigurator.h" - - -// constants -_LIT( KIcon1Path, "\\system\\apps\\upnp\\upnp_ms_jpeg_sm.jpg"); -const TInt KIcon1Width( 48 ); -const TInt KIcon1Height( 48 ); -const TInt KIcon1Depth( 24 ); - -_LIT( KIcon2Path, "\\system\\apps\\upnp\\upnp_ms_jpeg_lrg.jpg"); -const TInt KIcon2Width( 120 ); -const TInt KIcon2Height( 120 ); -const TInt KIcon2Depth( 24 ); - -_LIT( KIcon3Path, "\\system\\apps\\upnp\\upnp_ms_png_sm.png"); -const TInt KIcon3Width( 48 ); -const TInt KIcon3Height( 48 ); -const TInt KIcon3Depth( 24 ); - -_LIT( KIcon4Path, "\\system\\apps\\upnp\\upnp_ms_png_lrg.png"); -const TInt KIcon4Width( 120 ); -const TInt KIcon4Height( 120 ); -const TInt KIcon4Depth( 24 ); - -_LIT(KComponentLogfile, "applicationengine.txt"); -#include "upnplog.h" - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::CUPnPIconConfigurator -// -------------------------------------------------------------------------- -// -CUPnPIconConfigurator::CUPnPIconConfigurator( - RUpnpMediaServerClient& aMediaServer, - CUPnPFileSharingEngineAO& aFileShareingAO ) - : CActive(CActive::EPriorityStandard), - iMediaServer( aMediaServer ), - iFileShareEngineAO( aFileShareingAO ) - { - __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::CUPnPIconConfigurator" ); - CActiveScheduler::Add( this ); - } - - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::~CUPnPIconConfigurator() -// -------------------------------------------------------------------------- -// -CUPnPIconConfigurator::~CUPnPIconConfigurator() - { - - if ( IsActive() ) - { - iState = EStateIdle; - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - } - Cancel(); - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::NeedToConfigureIcons() -// -------------------------------------------------------------------------- -// -TBool CUPnPIconConfigurator::NeedToConfigureIcons() - { -#ifdef _DEBUG - // in debug mode ALWAYS add new icons - return ETrue; -#else - // in normal mode only add icons if they DO NOT exist - TBool iconsExist = EFalse; - TRAP_IGNORE( iconsExist = CheckIconsAddedL() ); - __LOG1( "[UPNP_ENGINE] CUPnPIconConfigurator: iconsExist %d", - iconsExist ); - return !iconsExist; -#endif - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::ConfigureIconsL() -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::ConfigureIconsL() - { - RemoveIcons(); - } - -// -------------------------------------------------------------------------- -// CUPnPFileSharingEngineAO::RunL -// Called when asyncronous request is ready -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::RunL() - { - __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::RunL" ); - - TInt err( iStatus.Int() ); - - if ( ( err != KErrNone ) && ( err != KErrNotFound ) ) - { - iFileShareEngineAO.SetIconComplete( err ); - } - else - { - switch ( iState ) - { - case EStateRemoving: - { - AddIcon1L(); - iState = EStateAdding1; - } - break; - case EStateAdding1: - { - delete iIcon1; - iIcon1 = NULL; - AddIcon2L(); - iState = EStateAdding2; - } - break; - case EStateAdding2: - { - delete iIcon2; - iIcon2 = NULL; - AddIcon3L(); - iState = EStateAdding3; - } - break; - case EStateAdding3: - { - delete iIcon3; - iIcon3 = NULL; - AddIcon4L(); - iState = EStateAdding4; - } - break; - case EStateAdding4: - { - delete iIcon4; - iIcon4 = NULL; - // operation complete. - MarkIconsAddedL( ETrue ); - Cancel(); - iFileShareEngineAO.SetIconComplete( KErrNone ); - } - break; - default: - { - __PANICD( __FILE__, __LINE__ ); - } - break; - } - } - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::RunError -// RunL error handler -// -------------------------------------------------------------------------- -// -TInt CUPnPIconConfigurator::RunError( TInt aError ) - { - __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::RunError begin" ); - - iFileShareEngineAO.SetIconComplete( aError ); - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::DoCancel -// Cancels active object -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::DoCancel() - { - __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::DoCancel" ); - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::RemoveIconsL -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::RemoveIcons() - { - __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::RemoveIconsL" ); - iState = EStateRemoving; - iMediaServer.RemoveIcons( iStatus ); - if ( !IsActive() ) - { - SetActive(); - } - else - { - __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::RemoveIconsL Error :\ - Already active"); - } - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::AddIcon1 -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::AddIcon1L() - { - __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon1" ); - TFileName iconPath; - ResolveIconPath( KIcon1Path, iconPath ); - iIcon1 = CUpnpIcon::NewL( iconPath, - KIcon1Width, KIcon1Height, KIcon1Depth, KJpegMime ); - iMediaServer.AddIcon( iIcon1, iStatus ); - if ( !IsActive() ) - { - SetActive(); - } - else - { - __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon1L Error :\ - Already active"); - } - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::AddIcon2 -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::AddIcon2L() - { - __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon2" ); - TFileName iconPath; - ResolveIconPath( KIcon2Path, iconPath ); - iIcon2 = CUpnpIcon::NewL( iconPath, - KIcon2Width, KIcon2Height, KIcon2Depth, KJpegMime ); - iMediaServer.AddIcon( iIcon2, iStatus ); - if ( !IsActive() ) - { - SetActive(); - } - else - { - __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon2L Error :\ - Already active"); - } - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::AddIcon3 -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::AddIcon3L() - { - __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon3" ); - TFileName iconPath; - ResolveIconPath( KIcon3Path, iconPath ); - iIcon3 = CUpnpIcon::NewL( iconPath, - KIcon3Width, KIcon3Height, KIcon3Depth, KPngMime ); - iMediaServer.AddIcon( iIcon3, iStatus ); - if ( !IsActive() ) - { - SetActive(); - } - else - { - __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon3L Error :\ - Already active"); - } - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::AddIcon4 -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::AddIcon4L() - { - __LOG( "[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon4" ); - TFileName iconPath; - ResolveIconPath( KIcon4Path, iconPath ); - iIcon4 = CUpnpIcon::NewL( iconPath, - KIcon4Width, KIcon4Height, KIcon4Depth, KPngMime ); - iMediaServer.AddIcon( iIcon4, iStatus ); - if ( !IsActive() ) - { - SetActive(); - } - else - { - __LOG("[UPNP_ENGINE]\t CUPnPIconConfigurator::AddIcon4L Error :\ - Already active"); - } - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::ResolveIconPath -// Resolves absolute icon path -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::ResolveIconPath( - const TDesC& relativePath, TFileName& iconPath ) - { - iconPath = relativePath; - TFileName dllName; - Dll::FileName( dllName ); - TBuf<2> drive = dllName.Left(2); // Drive letter followed by ':' - iconPath.Insert( 0, drive ); - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::CheckIconsAddedL -// Set the mediaserver icon if it is needed -// -------------------------------------------------------------------------- -// -TBool CUPnPIconConfigurator::CheckIconsAddedL() - { - __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::CheckIconsAddedL" ); - - TInt iconSet ( EFalse ); - CRepository *repository = CRepository::NewL( KCRUidUPnPApplication ); - repository->Get( KUPnPAppMediaServerIcon, iconSet ); - delete repository; - repository = NULL; - return iconSet; - } - -// -------------------------------------------------------------------------- -// CUPnPIconConfigurator::MarkIconsAddedL -// store the cenrep value -// -------------------------------------------------------------------------- -// -void CUPnPIconConfigurator::MarkIconsAddedL( TBool aMark ) - { - __LOG( "[UPNP_ENGINE] CUPnPIconConfigurator::MarkIconsAddedL" ); - - CRepository *repository = CRepository::NewL( KCRUidUPnPApplication ); - repository->Set( KUPnPAppMediaServerIcon, aMark ); - delete repository; - repository = NULL; - } - - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/applicationengine/src/upnpprogresswatcher.cpp --- a/upnpsharing/applicationengine/src/upnpprogresswatcher.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,311 +0,0 @@ -/* -* Copyright (c) 2007 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: CUpnpProgressWatcher class implementation - * -*/ - - - - - - - -// Include Files -#include -#include -#include -#include "upnpprogresswatcher.h" -#include "upnpfilesharingengine.h" - -_LIT( KComponentLogfile, "applicationengine.txt"); -#include "upnplog.h" - - -// CONSTANTS -// The maximum numbers of sharingrequests that can be currently received -const TInt KMaxSharingReqs = 2; - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::CUpnpProgressWatcher -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpProgressWatcher::CUpnpProgressWatcher( CUPnPFileSharingEngine& aEngine ) - : CActive(CActive::EPriorityStandard), - iEngine( aEngine ) - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::CUpnpProgressWatcher"); - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUpnpProgressWatcher* CUpnpProgressWatcher::NewL( - CUPnPFileSharingEngine& aEngine ) - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::NewL"); - CUpnpProgressWatcher* self = - new ( ELeave ) CUpnpProgressWatcher( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUpnpProgressWatcher::ConstructL() - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::ConstructL"); - - User::LeaveIfError( - iProgressInfo.Attach( KUpnpContentServerCat, ESharingProgress ) ); - CActiveScheduler::Add(this); - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::~CUpnpProgressWatcher -// Destructor -// -------------------------------------------------------------------------- -// -CUpnpProgressWatcher::~CUpnpProgressWatcher() - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::~CUpnpProgressWatcher"); - - Cancel(); - iProgressInfo.Close(); - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::StartL -// Starts active object -// -------------------------------------------------------------------------- -// -void CUpnpProgressWatcher::StartL() - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::StartL begin"); - - TUpnpProgress totalProgress; - TPckgBuf progressBuf( totalProgress ); - TInt pubErr = iProgressInfo.Get( progressBuf ); - iEngine.SetShareFileComplete( EFalse ); - if ( !pubErr ) - { - Mem::Copy( &totalProgress, - progressBuf.Ptr(), sizeof( TUpnpProgress ) ); - - // update UI - SetShowCompleteNote( totalProgress ); - TProgressInfos progressArr( KMaxSharingReqs ); - progressArr.Append( totalProgress.iImageVideoProgress ); - progressArr.Append( totalProgress.iMusicProgress ); - CleanupClosePushL( progressArr ); - if ( iEngine.Observer() ) - { - iEngine.Observer()->HandleSharingProgress( - iEngine, progressArr ); - } - CleanupStack::PopAndDestroy( &progressArr ); - } - - if ( !IsActive() && SharingOngoing( totalProgress ) ) - { - // start periodical reporting of progress - RunL(); - } - - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::StartL end"); - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::Stop -// Stops active object -// -------------------------------------------------------------------------- -// -void CUpnpProgressWatcher::Stop() - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::Stop"); - Cancel(); - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::RunL -// Called when asyncronous request is ready -// -------------------------------------------------------------------------- -// -void CUpnpProgressWatcher::RunL() - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::RunL"); - - // resubscribe before processing new value to prevent missing updates - iProgressInfo.Subscribe( iStatus ); - SetActive(); - - TUpnpProgress totalProgress; - TPckgBuf< TUpnpProgress > paramspkg( totalProgress ); - - - // get value - if ( iProgressInfo.Get( - KUpnpContentServerCat, - ESharingProgress, - paramspkg ) == KErrNotFound ) - { - // property deleted, do necessary actions here... - } - else - { - Mem::Copy( &totalProgress, paramspkg.Ptr(), sizeof( TUpnpProgress ) ); - - - TProgressInfos progressArr( KMaxSharingReqs ); - - progressArr.Append( totalProgress.iImageVideoProgress ); - progressArr.Append( totalProgress.iMusicProgress ); - - CleanupClosePushL( progressArr ); - if ( totalProgress.iError ) - { - HandleErrorL( totalProgress ); - } - else - { - if ( iEngine.Observer() ) - { - // update UI - iEngine.Observer()->HandleSharingProgress( - iEngine, progressArr ); - } - if ( progressArr.Count() ) - { - __LOG2( "ProgressCallbackL: cout:%d progress:%d\n", - progressArr.Count(), - progressArr[0].iProgress ); - } - else - { - __LOG( "progressArr empty" ); - } - - SetShowCompleteNote( totalProgress ); - - if ( iShowCompleteNote && !SharingOngoing( totalProgress ) ) - { - // no sharing operations ongoing, stop query - Cancel(); - // inform UI to show final note - if ( iEngine.Observer() && iShowCompleteNote ) - { - iShowCompleteNote = EFalse; - iEngine.Observer()->HandleSharingDone( - iEngine, KErrNone ); - } - } - } - CleanupStack::PopAndDestroy( &progressArr ); - } - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::DoCancel -// Cancels active object -// -------------------------------------------------------------------------- -// -void CUpnpProgressWatcher::DoCancel() - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::DoCancel"); - iEngine.SetShareFileComplete( ETrue ); - iProgressInfo.Cancel(); - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::SetShowCompleteNote -// determine need to show complete note, handle errors -// -------------------------------------------------------------------------- -// -void CUpnpProgressWatcher::SetShowCompleteNote( - const TUpnpProgress& aProgress ) - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::SetShowCompleteNote"); - - if( !iShowCompleteNote ) - { - if( aProgress.iImageVideoProgress.iProgressType != - TUpnpProgressInfo::EVisualStatus || - aProgress.iMusicProgress.iProgressType != - TUpnpProgressInfo::EVisualStatus) - { - iShowCompleteNote = ETrue; - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::SharingOngoing -// determine need to show complete note, handle errors -// -------------------------------------------------------------------------- -// -TBool CUpnpProgressWatcher::SharingOngoing( const TUpnpProgress& aProgress ) - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::SharingOngoing"); - TBool ret( EFalse ); - - if( aProgress.iImageVideoProgress.iProgressType != - TUpnpProgressInfo::EVisualStatus || - aProgress.iMusicProgress.iProgressType != - TUpnpProgressInfo::EVisualStatus) - { - ret = ETrue; - } - return ret; - } - -// -------------------------------------------------------------------------- -// CUpnpProgressWatcher::HandleErrorL -// determine need to show complete note, handle errors -// -------------------------------------------------------------------------- -// -void CUpnpProgressWatcher::HandleErrorL( const TUpnpProgress& aProgress ) - { - __LOG("[UPNP_ENGINE]\t CUpnpProgressWatcher::HandleIfErrorL"); - Cancel(); - if( aProgress.iError == KErrNoMemory || - aProgress.iError == KErrDiskFull ) - { - // update UI - TProgressInfos progressArr( KMaxSharingReqs ); - CleanupClosePushL( progressArr ); - progressArr.Append( aProgress.iImageVideoProgress ); - progressArr.Append( aProgress.iMusicProgress ); - - if ( iEngine.Observer() ) - { - iEngine.Observer()->HandleSharingProgress( - iEngine, progressArr ); - } - CleanupStack::PopAndDestroy( &progressArr ); - iShowCompleteNote = EFalse; - User::Leave( aProgress.iError ); - } - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/rom/bld.inf --- a/upnpsharing/rom/bld.inf Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 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" -* 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 information file for upnpsharing ROM -* -*/ - - - - - - -// For compatibility with S60 3.2 and IAD branch -#include "../../group/upnpplatformvar.hrh" - -PRJ_PLATFORMS - -PRJ_EXPORTS -// ROM build -../rom/upnpsharing.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsharing.iby) -../rom/upnpsharingresources.iby CORE_MW_LAYER_IBY_EXPORT_PATH(upnpsharingresources.iby) -// LOC files -UPNP_LOC_EXPORT(upnpsharing.loc) - -PRJ_MMPFILES -// none - -// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/rom/upnpsharing.iby --- a/upnpsharing/rom/upnpsharing.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: upnpsharing subsystem resource ROM include file -* -*/ - -#ifndef __UPNPSHARING_IBY__ -#define __UPNPSHARING_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // UPnP Security - file=ABI_DIR\BUILD_DIR\upnpsecuritymanagerserver.exe \sys\bin\upnpsecuritymanagerserver.exe - file=ABI_DIR\BUILD_DIR\upnpsecuritymanagerclient.dll \sys\bin\upnpsecuritymanagerclient.dll - file=ABI_DIR\BUILD_DIR\upnpsecurity.dll \sys\bin\upnpsecurity.dll - ECOM_PLUGIN( upnpsecuritymanagerplugin.dll, upnpsecuritymanagerplugin.rsc ) - - // DLNA Profiler - file=ABI_DIR\BUILD_DIR\dlnaprofiler.dll \sys\bin\dlnaprofiler.dll - - // sharing engine - file=ABI_DIR\BUILD_DIR\upnpapplicationengine.dll \sys\bin\upnpapplicationengine.dll - - // mediaserver icons - data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_jpeg_lrg.jpg \system\apps\upnp\upnp_ms_jpeg_lrg.jpg - data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_jpeg_sm.jpg \system\apps\upnp\upnp_ms_jpeg_sm.jpg - data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_png_lrg.png \system\apps\upnp\upnp_ms_png_lrg.png - data=ABI_DIR\BUILD_DIR\z\system\apps\upnp\upnp_ms_png_sm.png \system\apps\upnp\upnp_ms_png_sm.png - - // content sharing server - data=ABI_DIR\BUILD_DIR\z\private\10202be9\20007564.txt \private\10202be9\20007564.txt - file=ABI_DIR\BUILD_DIR\upnpcontentserver.exe \sys\bin\upnpcontentserver.exe - file=ABI_DIR\BUILD_DIR\upnpcontentserverclient.dll \sys\bin\upnpcontentserverclient.dll - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPSHARING_IBY__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/rom/upnpsharingresources.iby --- a/upnpsharing/rom/upnpsharingresources.iby Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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: upnpsharing subsystem resource ROM include file -* -*/ - - - - - -#ifndef __UPNPSHARINGRESOURCES_IBY__ -#define __UPNPSHARINGRESOURCES_IBY__ - -#ifdef FF_UPNP_FRAMEWORK_2_0 // UPnP feature flag - - // UPnP Security - data=DATAZ_\resource\UPnPNotifier.RSC \resource\UPnPNotifier.RSC - -#endif // FF_UPNP_FRAMEWORK_2_0 - -#endif // __UPNPSHARINGRESOURCES_IBY__ - diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/cenrep/20007564.cre Binary file upnpsharing/upnpcontentserver/cenrep/20007564.cre has changed diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/inc/upnpcontainercheckerao.h --- a/upnpsharing/upnpcontentserver/inc/upnpcontainercheckerao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,381 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: This module handlers the cleaning and creating of the -* filesystem to mediaserver -* -*/ - - - - - -#ifndef __UPNPCONTAINERCHECKERAO_H__ -#define __UPNPCONTAINERCHECKERAO_H__ - -// INCLUDES -#include - -#include -#include -#include -#include -#include -#include -#include -#include "upnpcontentserverdefs.h" -#include "upnpsharingcallback.h" - -/** - * A class to check, create and clean the default filesystem in Media server - * - * @since S60 3.1 - */ -class CUpnpContainerCheckerAo : public CActive - { - /** - * Indicates the ongoing operation of the CUpnpContainerCheckerAo - */ - enum THandlerOperations - { - EInitialize, - EQueryDefaultContainers, - EUnshareItemList, - EQueryDefaultContainersResult, - EQueryItemFromMediaServer, - EQueryItemFromMediaServerResult, - - EUnshareContainer, - EUnshareContainerResult, - - EShareContainer, - EShareContainerResult, - ENotActive - }; - - /** - * Indicates the current state of the handler - */ - enum THandlerState - { - EResolveDefaultContainerIds, - ECleanFileStructure, - EShareDefaultContainers, - EEmptyUploadedContainer, - EEmptyUploadedContainerItems, - EEmptyRootContainerItems, - EUnshareExtraContainers, - EUnshareExtraItems, - EIdle - }; - - /** - * Indicates the current state of the handler - */ - enum TErrorState - { - ENoError, - EDropAllContent, - EDropAllContentResult - }; - - /** - * The operating modes - */ - enum TOperationMode - { - EValidateContainers, - ECheckDefaultContainers - }; - -public: - /** - * The folder checking operations - */ - enum TContainerPosition - { - EImageAndVideo = 0, - EMusic, - EUploaded - }; - - /** - * C++ constructor. - * @since S60 3.1 - * @param aWait, the client side wait - */ - CUpnpContainerCheckerAo( MUpnpSharingCallback* aCallback ); - - /** - * C++ destructor. - */ - virtual ~CUpnpContainerCheckerAo(); - - /** - * Creates the default containers if they do not exist, - * empties root container and cleans uploaded container - * @since S60 3.1 - * @return Errorcode of the operation start - */ - TInt ValidateContainerStructureL( RArray* aIds ); - - /** - * Creates the default containers if they do not exist - * Add ids of the default containers to array - * @since S60 3.1 - * @param aIds The container Ids, indexed using TContainerPosition type - * @return Errorcode of the operation start - */ - TInt CheckDefaultContainersL( RArray* aIds ); - - /** - * Request this active ocject to stop as soon as is possible - * Stop is indicated to client via callback - * @since S60 3.1 - * @param aStopType Type of stop operation - */ - void RequestStop( MUpnpSharingCallback::TSharingStopType aStopType ); - - -private: - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * The active object main loop - * @since S60 3.1 - */ - void RunL(); - - /** - * The active object cancel function - * @since S60 3.1 - */ - void DoCancel(); - - /** - * Perform cleanup in case RunL leaves - * @since S60 3.1 - * @return error code - */ - TInt RunError( TInt aError ); - - /** - * Perform allocating of resources needed for processing upload events - * @since S60 3.1 - * @return error code - */ - TInt InitializeL(); - - /** - * Query default container structure ids from media server - * @since S60 3.1 - */ - void QueryDefaultContainerIdsL(); - - /** - * Handle the query result - * @since S60 3.1 - */ - void QueryDefaultContainerIdsResultL(); - - /** - * Handle the item query result - * @since S60 3.1 - */ - void QueryItemFromCdsResultL(); - - /** - * Unshare the items in iItemList - * @since S60 3.1 - */ - void UnshareItemListL(); - - /** - * Share container on basis of ID - * @since S60 3.1 - */ - void ShareContainerL( TInt aPos ); - - /** - * Handle the sharing operation result - * @since S60 3.1 - */ - void ShareContainerResult( ); - - /** - * Unshares container under processing - * @since S60 3.1 - */ - void UnshareContainerL(); - - /** - * Handle result of the unshare container operation - * @since S60 3.1 - */ - void UnshareContainerResultL(); - - /** - * Query containers in root level - * @since S60 3.1 - */ - void QueryContainerItemsL(); - - /** - * Create browse criteria for media server query - * @since S60 3.1 - * @return pointer to CUpnpBrowseCriteria instance - */ - CUpnpBrowseCriteria* CreateBrowseCriteriaLC() const; - - /** - * Clean allocated resources for possible next run - * @since S60 3.1 - */ - void Cleanup(); - - /** - * Complete own request - * @since S60 3.1 - * @param aError Errorcode to use in completion - */ - void SelfComplete( TInt aError ); - - - -private: - - /** - * Media server API to share files - * owned - */ - CUpnpFileSharing* iFileSharing; - - /** - * Media server session handle - */ - RUpnpMediaServerClient iMediaServer; - - /** - * Used to hold the upper ao - * Stopped when this class has nothing to do. Not owned. - */ - MUpnpSharingCallback* iCallback; - - /** - * Hanlders current state - */ - TInt iState; - - /** - * Handlers current operation - */ - TInt iCurrentOperation; - - /** - * Id of the Images& Videos container - */ - TInt iImageVideoContainerId; - - /** - * Id of the Music container - */ - TInt iMusicContainerId; - - /** - * Id of the Upload container - */ - TInt iUploadContainerId; - - /** - * Array of shared container IDs - */ - RArray iSharedContainerIds; - - /** - * The currently processed container - * owned - */ - CUpnpContainer* iTmpContainer; - - /** - * Structure used to hold the containers queries from media server - * In practice it is used to hold "Images& VIdeos" & "Music" & "Uploaded" - * containers. - * owned - */ - CUpnpContainerList* iContainerList; - - /** - * Structure used to hold possbile unwanted items when cleaning - * some folder - * owned - */ - CUpnpItemList* iItemList; - - /** - * Holds the position of the container under processing - */ - TInt iContainerPosition; - - /** - * The number of items in item query - */ - TInt iTotalMatches; - - /** - * The position when unsharing list of items - */ - TInt iExecStatus; - - /** - * Operation mode as defined by TOperationMode - */ - TInt iOperationMode; - - /** - * Pointer to client structure to contain the container ids - * Not owned - */ - RArray* iClientIds; - - /** - * Indicates if the client has requested stop - * Value is the stop type - */ - TInt iStopRequested; - - /** - * State variable which informs if there is need to do - * error handling - */ - TInt iRecoverError; - - /** - * The number of matches returned by media server - * Not used but required by CUpnpFileSharing API - */ - TInt iMatchCount; - - /** - * temporary storage for object count when querying items from media - * server - */ - TInt iObjectCount; - }; - - -#endif // __UPNPCONTAINERCHECKERAO_H__ diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/inc/upnpcontentsharerao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpcontentserver/inc/upnpcontentsharerao.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2006-2007 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: file sharing engine active object class defition + * +*/ + +#ifndef __UPNPCONTENTSHARERAO_H__ +#define __UPNPCONTENTSHARERAO_H__ + + +// Include Files +#include +#include //for CDesCArray + +#include "upnpsharingcallback.h" +#include "upnpcontentserverdefs.h" +#include "upnpsharingrequest.h" + +#include "upnpsharingalgorithm.h" + + +// FORWARD DECLARATIONS +class MUpnpSharingCallback; + + +// CLASS DECLARATION + +/** +* Active object class for file sharing +* @since S60 5.2 +*/ +NONSHARABLE_CLASS( CUpnpContentSharerAo ) : public CActive +{ + +public: // Constructors and destructor + + /** + * Two-phased constructor. + * @since S60 5.2 + * @param aEngine Callback to handler + * @param aSharingAlgorithm Pointer to SharingAlgorithm + */ + static CUpnpContentSharerAo *NewL( + MUpnpSharingCallback* aEngine, + MUpnpSharingAlgorithm* aSharingAlgorithm ); + + /** + * Destructor. + * @since S60 5.2 + */ + virtual ~CUpnpContentSharerAo(); + +protected: //From CActive + /** + * See CActive + */ + virtual void RunL(); + + /** + * See CActive + */ + virtual void DoCancel(); + + /** + * See CActive + */ + TInt RunError(TInt aError); + +public: //new functions + + /** + * Starts file sharing process + * @since S60 5.2 + * @param aSharingRequest List of files to be shared + */ + void StartSharing( const CUpnpSharingRequest *aSharingRequest ); + + /** + * Checks that if sharing is ongoing + * @since S60 5.2 + * @return ETrue if sharing is ongoing, otherwise EFalse + */ + TBool SharingOngoing(); + + /** + * Stops sharing process + * @since S60 5.2 + */ + void StopSharing(); + + /** + * Forces to set progress in next file sharing process + * @since S60 5.2 + */ + void ForceSetProgress(); + +private: + + /** + * C++ default constructor. + * @since S60 5.2 + * @param aEngine Pointer to handler callback + * @param aSharingAlgorithm Pointer to SharingAlgorithm + */ + CUpnpContentSharerAo( MUpnpSharingCallback *aEngine, + MUpnpSharingAlgorithm* aSharingAlgorithm ); + + /** + * By default Symbian 2nd phase constructor is private. + * @since S60 5.2 + */ + void ConstructL(); + + /** + * Writes sharing status to file with upnpselectionwriter + * @since S60 5.2 + */ + void WriteSharingStatusL(); + + /** + * Shares and unshares one file from each array + * @since S60 5.2 + * @return error code + */ + TInt DoSingleOperation(); + + /** + * Sets progress to engine + * @since S60 5.2 + */ + void SetProgressL(); + + /** + * Performs complete callback + * @param aPtr Pointer to CUpnpContentSharerAo instance + * @return KErrNone + */ + static TInt CompleteL( TAny* aPtr ); + +private: + + /** + * Pointer to calling handler + * not owned + */ + MUpnpSharingCallback *iSharingEngine; + + /** + * Pointer to request under work. Request contains lists of file to be + * shared and unshared. + * not owned + */ + const CUpnpSharingRequest *iSharingRequest; + + /** + * Pointer to sharing algorith which performs the actual sharing. + * Not owned. + */ + MUpnpSharingAlgorithm* iSharingAlgorithm; + + /** + * Index number of current file in share file array + */ + TInt iShareIndex; + + /** + * Index number of current file in unshare file array + */ + TInt iUnshareIndex; + + /** + * Flag if we should cancel current operation + */ + TBool iCancel; + + /** + * Currently processed progress percent + */ + TInt iCurrentProgressPercent; + + /** + * Idle for complete callback + * Owned. + */ + CIdle* iIdle; + + /** + * Error code for callback + */ + TInt iError; + + }; + +#endif // __UPNPCONTENTSHARINGAO_H__ + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/inc/upnpcontentsharingao.h --- a/upnpsharing/upnpcontentserver/inc/upnpcontentsharingao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,560 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: file sharing engine active object class defition - * -*/ - - - - - - - -#ifndef __UPNPCONTENTSHARINGAO_H__ -#define __UPNPCONTENTSHARINGAO_H__ - - -// Include Files -#include -#include //for CDesCArray -#include -#include -#include -#include "upnpplaylistservices.h" -#include "upnpalbumservices.h" -#include "upnpselectionwriter.h" -#include "upnpsharingcallback.h" -#include "upnpcontentserverdefs.h" -#include "upnpcontentmetadatautility.h" - -// FORWARD DECLARATIONS -class CUPnPFileSharingEngine; -class CUpnpContainer; -class CUpnpObject; -class CUpnpFileSharing; -class CUpnpItemList; -class CUpnpSelectionWriter; -class CUpnpContentMetadataUtility; -class MUpnpSharingCallback; - - -// CLASS DECLARATION -/** - -* Active object class for file sharing -* @since S60 3.1 -*/ -NONSHARABLE_CLASS( CUpnpContentSharingAo ): public CActive - { - /** - * Enumeration for different sharing types - */ - enum TSharingType - { - ESharing, - EUnsharing - }; - - /** - * States of this active object - */ - enum TUPnPSharingState - { - ENotActive, - EShareFiles, - EStartSharing, - EStopSharing, - EUnshareMainContainers, - EShareMainContainers, - // 2.0 - EValidateDefaultContainers, - EGetSharedContainers, - EGetSharedItems,//8 - EUnshareContainers, - EUnshareContainersResult, - EUnshareItems,//11 - EShareDefaultContainers, - EShareDefaultContainersResult, - EShareContainers, - EShareContainersResult, - EShareItems, //16 - EShareItemsResult, - EShareAllItems,//18 - EShareAllItemsResult, - ECompleteSharingRequest, - EEnumerateSelections - }; - - /** - * Sub states of this active object - */ - enum TUpnpSharingSubState - { - EIdle, - EProfileItemList, - EProfileItemListResult, - EShareItemList, - EShareItemListResult - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @since S60 3.1 - * @param aEngine Callback to handler - * @param aMetadata Pointer to CLF API - */ - static CUpnpContentSharingAo* NewL( - MUpnpSharingCallback* aEngine, - CUpnpContentMetadataUtility* aMetadata ); - - /** - * Destructor. - * @since S60 3.1 - */ - virtual ~CUpnpContentSharingAo(); - - protected: - - /** - * Function is called when active request is ready - * @since S60 3.1 - */ - virtual void RunL(); - - /** - * Cancels active request - * @since S60 3.1 - */ - virtual void DoCancel(); - - /** - * Handle leaves from RunL - * @since S60 3.1 - */ - TInt RunError( TInt aError ); - - public: // new functions - - /** - * Initialize parameters needed in sharing - * @since S60 3.2 - * @param aContainerType Type of sharing ongoing - * @param aCurrentSelection Array of album/playlist selections - * @param aPlaylistIds Ids of collections - * @param aPlaylistNames names of collections - * @param aClientStatus Clients TRequestStatus - */ - void InitializeL( - TUpnpMediaType aContainerType, - const RArray& aCurrentSelection, - CDesCArray& aPlaylistIds, - CDesCArray& aPlaylistNames, - const TInt aContainerId ); - - /** - * Starts file sharing process - * @since S60 3.1 - */ - void ShareFiles( ); - - - /** - * Return the number of shared items in current selection - * @since S60 3.1 - * @param aContainerType Type of selections - * @return TInt Object count - */ - TInt SelectionObjectCountL( - const TUpnpMediaType aContainerType ); - - /** - * Return progress of the current sharing operation and type of sharing - * Progress is shown as procents - * @since S60 3.1 - * @param aContainerType Type of the sharing requested - * @return the progress value - */ - TInt SharingProgress( - TUpnpMediaType& aContainerType ) const; - - /** - * From CActive - * @since S60 3.1 - */ - TBool IsActive() const; - - /** - * Request this active ocject to stop as soon as is possible - * Stop is indicated to client via callback - * @since S60 3.1 - * @param aStopType Type of stop operation - */ - void RequestStop( MUpnpSharingCallback::TSharingStopType aStopType ); - - - private: - - /** - * C++ default constructor. - * @since S60 3.1 - * @param aEngine Pointer to handler callback - * @param aMetadata Pointer to CLF API - */ - CUpnpContentSharingAo( MUpnpSharingCallback* aEngine, - CUpnpContentMetadataUtility* aMetadata ); - - /** - * By default Symbian 2nd phase constructor is private. - * @since S60 3.1 - */ - void ConstructL(); - - /** - * Opens mediaserver and file sharing session - * @since S60 3.1 - * @return TInt, KErrNone if connection is ok - * error code otherwise - */ - TInt OpenFileSharingSession(); - - /** - * Closes file sharing and mediaserver session - * @since S60 3.1 - */ - void CloseFileSharingSession(); - - /** - * Create container - * @since S60 3.1 - * @param aContainerType Type of container to create - * @param aTitle Title of the container - */ - CUpnpContainer* CreateContainerL( TUpnpMediaType aContainerType, - const TDesC8& aTitle ) const; - - /** - * Connects to media server - * @since S60 3.1 - */ - TInt ConnectMediaServer(); - - /** - * Processes containers to unshare - * @since S60 3.1 - */ - void UnshareContainersL(); - - /** - * Adjust the value iShareAllSelection on basis of user selections - * @since S60 3.1 - * @param aSelections The selections received from UI - */ - void AdjustShareAllSelection( - const RArray& aSelections ); - - /** - * Share the current container, iContainer - * @since S60 3.1 - */ - void ShareContainersL(); - - /** - * Shares the current set of items, iItemList - * @since S60 3.1 - */ - void ShareItemsL(); - - - /** - * Process the result of the container sharing operation - * @since S60 3.1 - */ - void ShareContainersResultL(); - - /** - * Process the result of items sharing operation - * @since S60 3.1 - */ - void ShareItemsResultL(); - - /** - * Share individual items, not in any album/playlist - * @since S60 3.1 - */ - void ShareAllItemsL(); - - /** - * Process the result of sharing individual items - * @since S60 3.1 - */ - void AllItemsResultL(); - - /** - * Calculate correct index for indexing CLF on basis of - * iCurrentSelection and iShareAllSelection - * Verifies that the container selections user has made are valid against - * current CLF / playlist content - * @since S60 3.1 - * @return Index as TInt, KErrNotFound if the selection is not valid - */ - TInt GetContainerIndexL(); - - /** - * Complete own request - * @since S60 3.1 - */ - void SelfComplete( const TInt aError ); - - /** - * Appends image files to iItemList. Starts from index iImageIndex and - * appends maximum of KContentDirCommitAmount items. Updates iImageIndex. - * @since S60 3.1 - */ - void AppendImageFilesToListL(); - - /** - * Appends video files to iItemList. Starts from index iVideoIndex and - * appends maximum of KContentDirCommitAmount items. Updates iVideoIndex. - * @since S60 3.1 - */ - void AppendVideoFilesToListL(); - - /** - * Profiles list of items - * @since S60 3.1 - */ - void ProfileItemListL(); - - /** - * Handles the result of profiling single item - * @since S60 3.1 - */ - void ProfileItemListResult(); - - /** - * Shares list of UpnpItems - * @since S60 3.1 - */ - void ShareItemListL( const TInt& aParentId ); - - /** - * Handles the result of ShareItemListL() - * @since S60 3.1 - */ - void ShareItemListResultL(); - - /** - * Determines next state according to iSharingSubState variable - * @since S60 3.1 - */ - void HandleSharingSubstatesL(); - - /** - * Find a conatiner name from available containers on basis of id - * @since S60 3.1 - * @param aId Id to search - * @param aPlaylistName Name of playlist pointed by id - * @param aContainerType Type of the container - */ - TInt GetContainerNameByIdL( const TDesC& aId, TDes8& aPlaylistName, - const TInt aContainerType ); - - /** - * When delete the iItenList Item pointer, - * also delete the CUpnpObject object the pointer pointed. - */ - void DeleteListUpnpObject(); - - private: // data - - /** - * Pointer to calling handler - * not owned - */ - MUpnpSharingCallback* iEngine; - - /** - * main level container index - */ - TInt iContainerIdx; - - /** - * object level container index - */ - TInt iObjectIdx; - - /** - * mediaserver session handle - */ - RUpnpMediaServerClient iMediaServer; - - /** - * Media server API to share files - * owned - */ - CUpnpFileSharing* iFileSharing; - - /** - * Type of container to be unshared; Music or Images & video - */ - TUpnpMediaType iContainerType; - - /** - * Indicates whether the starting sharing or stopping - * sharing is ongoing. - */ - TInt iSharingState; - - /** - * Container holder to use when sharing containers - * owned - */ - CUpnpContainer* iTmpContainer; - - /** - * item holder used during sharing items - * owned - */ - CUpnpItem* iTmpItem; - - /** - * Structure used to hold multiple items during sharing - * owned - */ - CUpnpItemList* iItemList; - - /** - * Indexes relative to queried content in UI - * Received when starting sharing ShareFilesL - */ - RArray iCurrentSelections; - - /** - * The IDs of the shared containers will appear here - * owned - */ - CArrayFix* iSharedContainerIds; - - /** - * Id of the default container to where share - * Obtained from handler - */ - TInt iContainerId; - - /** - * The type of sharing: EShareNone, EShareAll, EShareMany - */ - TInt iShareAllSelection; - - /** - * Utility class for CLF - * owned - */ - CUpnpContentMetadataUtility* iMetadataUtility; - - /** - * The number of succesfully shared items( containers not incl.) - */ - TInt iSharedContainersCount; - - /** - * Class handling the updating of the shared items - * owned - */ - CUpnpSelectionWriter* iWriter; - - /** - * Progress of the sharing process - */ - TInt iSharingProgress; - - /** - * Are all images already shared? - */ - TBool iAllImagesShared; - - /** - * Are all videos already shared? - */ - TBool iAllVideosShared; - - /** - * iImageIndex indicates up to which index is image sharing done so far. - */ - TInt iImageIndex; - - /** - * iVideoIndex indicates up to which index is video sharing done so far. - */ - TInt iVideoIndex; - - /** - * Possbile states when processing items. See TUpnpSharingSubState - */ - TInt iSharingSubState; - - /** - * Index used during profiling - */ - TInt iProfileInd; - - /** - * Array holding filenames of items to be shared - */ - CDesCArray* iFileNameArr; - - /** - * Flag indicating if there is profiling ongoing - */ - TBool iProfilerActive; - - /** - * Flag indicating if there if the destructor is called - */ - TBool iDeletePending; - - /** - * Indicates if the client has requested stop - * Value is the stop type - */ - TInt iStopRequested; - - /** - * Handle to MPX interface - */ - CUPnPPlaylistServices* iPlaylists; - - /** - * Handle to MPX interface - */ - CUPnPAlbumServices* iCollections; - - /** - * List of playlist ids - * Not owned - */ - CDesCArray* iContainerIds; - - /** - * List of playlist names - * Not owned - */ - CDesCArray* iContainerNames; - }; - -#endif // __UPNPCONTENTSHARINGAO_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/inc/upnpcustomgrouper.h --- a/upnpsharing/upnpcontentserver/inc/upnpcustomgrouper.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Custom grouper class definition -* -*/ - - - - - - - - -#ifndef __CUPNPAPPCUSTOMGROUPER_H__ -#define __CUPNPAPPCUSTOMGROUPER_H__ - -// INCLUDES -#include -#include -#include -#include -// this will be included when it back in SDK -// #include - -#include "upnpcontentserverdefs.h" - -// FORWARD DECLARATIONS -class MCLFItem; -class MCLFModifiableItem; - -// CLASS DECLARATION - -/** -* CLF Custom Grouper. -* Example of Custom Grouper that can be used to group files in the -* list model. With Custom Groupers you can create grouping functionality that -* is not supported in Content Listing Framework by default. This Custom -* Grouper can group items of a list model by any field. In this example -* application, this Custom Grouper is used to group music items by artist -* name. -*/ -class CUpnpCustomGrouper - : public CBase, - public MCLFCustomGrouper - { - public: // Constructors and destructor - - /** - * Creates and returns a new instance of this class. - * @param aGroupingCriteria Group items by this criteria - * @return Pointer to the CCECustomGrouper object - */ - - static CUpnpCustomGrouper* NewL( - TCLFExtendedFieldId aGroupingCriteria ); - - /** - * Destructor. - */ - virtual ~CUpnpCustomGrouper(); - - private: // Constructors - /** - * C++ default constructor. - * @param aGroupingCriteria Group list items by this criteria - */ - CUpnpCustomGrouper( TCLFExtendedFieldId aGroupingCriteria ); - - protected: // Functions from base classes - - /** - * From MCLFCustomGrouper. Method for grouping Content Listing - * Framework items. Will get called when grouping operation is executed - * by calling refresh for the list model. - * @since S60 3.1 - * @param aSourceList Source list - * @param aGroupedList Grouped/destination list - */ - void GroupItemsL( const TArray& aSourceList, - RPointerArray& aGroupedList ); - - private: // New functions - - /** - * Checks if group has been added to the destination array already. - * @param aGroupName Name of the group to be checked - * @return ETrue If group has been added to the model, EFalse if not - */ - TBool GroupAlreadyExists( const TDesC& aGroupName ); - - private: // Data - - // Array for keeping track, which items have been added to the - // model. Deletes items when they are no longer needed. - RPointerArray iModItems; - - // Criteria for grouping - TCLFExtendedFieldId iGroupingCriteria; - - }; - -#endif // __CUPNPAPPCUSTOMGROUPER_H__ - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/inc/upnpmetadataobserver.h --- a/upnpsharing/upnpcontentserver/inc/upnpmetadataobserver.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: metadata observer class definition -* -*/ - - - - - - -#ifndef __UPNPMETADATAOBSERVER_H__ -#define __UPNPMETADATAOBSERVER_H__ - -// INCLUDE FILES -#include - -/** - * Callback class for receiving events from CupnpContentMetadataUtility - * @lib upnpcontentserver.lib - * @since S60 3.1 - */ -class MUpnpMetadataObserver - { -public: - /** - * Informs that CLF refresh has completed - * @since S60 3.1 - */ - virtual void RefreshDoneL() = 0; - - /** - * Virtual destructor - */ - virtual ~MUpnpMetadataObserver() {}; - }; - -#endif //UPNPMETADATAOBSERVER - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/inc/upnppostfilter.h --- a/upnpsharing/upnpcontentserver/inc/upnppostfilter.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Post filter class defintion -* -*/ - - - - - - - -#ifndef __CUPNPAPPPOSTFILTER_H__ -#define __CUPNPAPPPOSTFILTER_H__ - -// INCLUDES -#include -#include -#include -#include -// this will be included when it back in SDK -// #include - - -#include "upnpcontentserverdefs.h" - -// FORWARD DECLARATIONS -class MCLFItem; - -// CLASS DECLARATION - -/** -* CLF Post Filter. -* Example of Post Filter that can be used to filter items from the -* list model. With post filter your can select, which kind of items are -* excluded from the list model. For example, you can include only music -* files of some specific artist and remove all other items. -*/ -class CUpnpPostFilter - : public CBase, - public MCLFPostFilter - { - public: // Constructors and destructor - - /** - * Creates and returns a new instance of this class. - * @param aFilterCriteria Filtering criteria (for example - * ECLFFielIdAlbum or ECLFFieldIdArtist) - * @param aFilterParameter Filtering parameter (for example - * name of album or artist) - * @return Pointer to the CCEPostFilter object - */ - static CUpnpPostFilter* NewL( - const TCLFExtendedFieldId aFilterCriteria, - const TDesC& aFilterParameter, - TBool aRemoveDuplicates ); - - /** - * Creates and returns a new instance of this class. Pointer is - * left to the CleanupStack. - * @param aFilterCriteria Filtering criteria (for example - * ECLFFielIdAlbum or ECLFFieldIdArtist) - * @param aFilterParameter Filtering parameter (for example - * name of album or artist) - * @return Pointer to the CCEPostFilter object - */ - static CUpnpPostFilter* NewLC( - const TCLFExtendedFieldId aFilterCriteria, - const TDesC& aFilterParameter, - TBool aRemoveDuplicates); - - /** - * Destructor. - */ - virtual ~CUpnpPostFilter(); - - private: // Constructors - /** - * C++ default constructor. - * @param aFilterCriteria Filtering criteria - */ - CUpnpPostFilter( const TCLFExtendedFieldId aFilterCriteriaconst, - TBool aRemoveDuplicates ); - - - /** - * Symbian 2nd phase constructor. - */ - void ConstructL( const TDesC& aFilterParameter ); - - protected: // Functions from base classes - - /** - * From MCLFPostFilter. Method for filtering the source list. - * Will get called when post filtering operation is executed by - * calling refresh for the list model. - * @since S60 3.1 - * @param aItemList Source item list - * @param aFilteredItemList Filtered/destination item list - */ - void FilterItemsL( const TArray& aItemList, - RPointerArray& aFilteredItemList ); - - /** - * Remove duplicate items - * @since S60 3.1 - * @param aFilteredItemList, Already added items - * @param aFieldValue, value to search - */ - TBool IsAdded( RPointerArray& aFilteredItemList, - TPtrC& aFieldValue ); - - private: // Data - - // Parameter for filtering (owned) - HBufC* iFilterParameter; - - // Criteria for filtering - - TCLFExtendedFieldId iFilterCriteria; - // remove duplicate items if ETrue - TBool iRemoveDuplicates; - - }; - -#endif // __CUPNPAPPPOSTFILTER_H__ - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/inc/upnpunsharerao.h --- a/upnpsharing/upnpcontentserver/inc/upnpunsharerao.h Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,301 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CUpnpUnsharerAo class definitions -* -*/ - - - - - -#ifndef __UPNPUNSHARERAO_H__ -#define __UPNPUNSHARERAO_H__ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "upnpcontentserverdefs.h" -#include "upnpsharingcallback.h" - -// CLASS DECLARATION -/** - * Active object class for unsharing UPnP containers in an incremental way - * @since S60 3.1 - */ -NONSHARABLE_CLASS( CUpnpUnsharerAo ): public CActive - { - /** - * Indicates the ongoing operation of the CUpnpUnsharerAo - */ - enum THandlerOperations - { - EInitialize, - EQueryContainersFromMediaServer, - EQueryContainersFromMediaServerResult, - EQueryItemsFromMediaServer, - EQueryItemsFromMediaServerResult, - EUnshareItemList, - EUnshareContainer, - EUnshareContainerResult, - - ENotActive - }; - - public: // Constructors and destructor - - /** - * C++ default constructor. - * @since S60 3.1 - * @param aClientWait, reference to client wait, for signalling completion - * @param aPriority, Priority value for this active object - */ - CUpnpUnsharerAo( MUpnpSharingCallback* aCallback, TInt aPriority ); - - /** - * Destructor. - */ - virtual ~CUpnpUnsharerAo(); - - protected: - - /** - * Function is called when active request is ready - * @since S60 3.1 - */ - virtual void RunL(); - - /** - * Cancels active request - * @since S60 3.1 - */ - virtual void DoCancel(); - - /** - * Handle leaves from RunL function - * @since S60 3.1 - */ - TInt RunError( TInt aError ); - - public: // new functions - - /** - * Unshares all items and subcontainers from given container recursively - * Leaves the containers with aContainerId - * @since S60 3.1 - * @param aContainerId Id of the container to empty - * @return Error code of the operation - */ - TInt EmptyContainer( TInt& aContainerId ); - - /** - * Request this active ocject to stop as soon as is possible - * Stop is indicated to client via callback - * @since S60 3.1 - * @param aStopType Type of stop operation - */ - void RequestStop( MUpnpSharingCallback::TSharingStopType aStopType ); - - /** - * Return progress of the current unsharing operation - * Progress is shown as procents - * @since S60 3.2.3 - * @return the progress value - */ - TInt UnSharingProgress( ) ; - - /** - * Get total items of the all unsharing operation - * @since S60 3.2.3 - * @return a numbers of the unsharing items - */ - TInt TotalItemsForUnShare( ) ; - - private: - - /** - * Qyery list of containers from media server - * @since S60 3.1 - * @param aId Id of the container to query containers from - */ - void QueryContainersFromMediaServerL( TInt aId ); - - /** - * Handle the result of the container query - * @since S60 3.1 - */ - void QueryContainersFromMediaServerResultL(); - - /** - * Query items from certain container from media server - * @since S60 3.1 - * @param aId Id of the container to query items from - */ - void QueryContainerItemsL( TInt aId ); - - /** - * Handle the result of the container query - * @since S60 3.1 - */ - void QueryContainerItemsResultL(); - - /** - * Unshare the items in iItemList - * @since S60 3.1 - */ - void UnshareItemListL(); - - /** - * Unshare the container pointed by iCurrentContainerId - * @since S60 3.1 - */ - void UnshareContainerL(); - - /** - * Handle the result of container unshare - * @since S60 3.1 - */ - void UnshareContainerResultL(); - - /** - * Perform allocating of resources needed for processing upload events - * @since S60 3.1 - * @param aContainerId The id of the initial container - * @return error code - */ - TInt InitializeL( TInt& aContainerId ); - - /** - * Creates browse criteria for media server querys - * @since S60 3.1 - */ - CUpnpBrowseCriteria* CreateBrowseCriteriaLC() const; - - /** - * Complete own async request - * @since S60 3.1 - * @param aError Error code to complete request - */ - void SelfComplete( TInt aError ); - - /** - * Clean the internal variables after error/when finished - * @since S60 3.1 - */ - void Cleanup(); - - - - private: // data - - /** - * Media server API to share files - * owned - */ - CUpnpFileSharing* iFileSharing; - - /** - * Media server session handle - */ - RUpnpMediaServerClient iMediaServer; - - /** - * Structure used to hold the containers queries from media server - * In practice it is used to hold "Images& VIdeos" & "Music" & "Uploaded" - * containers. - * Ordering from end to beginning - * owned - */ - CUpnpContainerList* iContainerList; - - /** - * The id of the current container - */ - TInt iCurrentContainerId; - - /** - * Array for all container levels used in processing - * Ordering top-down. - */ - RPointerArray iContainerLists; - - /** - * Structure used to hold possbile unwanted items when cleaning - * some folder - */ - CUpnpItemList* iItemList; - - /** - * This is started by client if needed. Stopped when profiling is ready - * not owned. - */ - MUpnpSharingCallback* iCallback; - - /** - * The container to process - */ - TInt iUpContainer; - - /** - * Total number of items in all operations to media server - */ - TInt iAllTotalItems; - - /** - * Total number of items in some operations to media server - */ - TInt iTotalItems; - - /** - * Total number of containers received in media server container query - */ - TInt iTotalContainers; - - /** - * The position when querying containers in segments - */ - TInt iContainerBrowsePosition; - - /** - * The postion when incrementally processing large number of items - */ - TInt iExecStatus; - - /** - * State of the active object used to determine the next operation after - * RunL completes - */ - TInt iCurrentOperation; - - /** - * Indicates if the client has requested stop - * Value is the stop type - */ - TInt iStopRequested; - - /** - * Indicates the last successfully unshared item - * Not used but required by CUpnpFileSharing API - */ - TInt iUnsharePosition; - }; - -#endif // __UPNPUNSHARERAO_H__ - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/src/upnpcontainercheckerao.cpp --- a/upnpsharing/upnpcontentserver/src/upnpcontainercheckerao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,838 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: This module handlers the cleaning and creating of the - * filesystem to mediaserver - * -*/ - - - - - -#include -#include "upnpcommonutils.h" -#include "upnpcontentserverdefs.h" -#include "upnpcontainercheckerao.h" -#include "upnpunsharerao.h" - -_LIT( KComponentLogfile, "contentserver.txt"); -#include "upnplog.h" - -// CONSTANTS -const TInt KDefaultBrowseReqCount( 100 ); -const TInt KDefaultBrowseStartingInd( 0 ); - -using namespace UpnpContentServer; - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::CUpnpContainerCheckerAo() -// C++ constructor. -// -------------------------------------------------------------------------- -// -CUpnpContainerCheckerAo::CUpnpContainerCheckerAo( - MUpnpSharingCallback* aCallback ) : - CActive( CActive::EPriorityIdle ), - iCallback( aCallback ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iCurrentOperation = ENotActive; - iState = EIdle; - iTotalMatches = KErrNotFound; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::~CUpnpContainerCheckerAo() -// C++ destructor. -// -------------------------------------------------------------------------- -// -CUpnpContainerCheckerAo::~CUpnpContainerCheckerAo() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - delete iFileSharing; - iFileSharing = NULL; - iMediaServer.Close(); - - if ( IsActive() ) - { - __LOG1("CUpnpContainerCheckerAo destructor IsActive iCurrentOp=%d", - iCurrentOperation ); - iCurrentOperation = ENotActive; - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - } - - Cancel(); - - Cleanup(); - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::ValidateContainerStructureL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContainerCheckerAo::ValidateContainerStructureL( - RArray* aIds ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - CActiveScheduler::Add( this ); - TInt err( KErrNotFound ); - - iClientIds = aIds; - - // First initialize resources - iOperationMode = EValidateContainers; - iCurrentOperation = EInitialize; - SelfComplete( KErrNone ); - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return err; - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::GetDefaultContainerIdsL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContainerCheckerAo::CheckDefaultContainersL( - RArray* aIds ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iOperationMode = ECheckDefaultContainers; - TInt err( KErrNone ); - - iClientIds = aIds; - - CActiveScheduler::Add( this ); - iCurrentOperation = EInitialize; - SelfComplete( KErrNone ); - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return err; - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::RequestStop -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::RequestStop( - MUpnpSharingCallback::TSharingStopType aStopType ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iStopRequested = aStopType; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::InitializeL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContainerCheckerAo::InitializeL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - // First initialize resources - iFileSharing = CUpnpFileSharing::NewL(); - TInt error( iMediaServer.Connect() ); - if ( error ) - { - __LOG8_1( "iMediaServer.Connect err: %d",error ); - } - User::LeaveIfError( error ); - - if ( !error ) - { - // start offline if not started - TInt status( RUpnpMediaServerClient::EStopped ); - error = iMediaServer.Status( status ); - if ( !error && status == RUpnpMediaServerClient::EStopped ) - { - error = iMediaServer.StartOffline(); - } - } - - SelfComplete( error ); - iCurrentOperation = EQueryDefaultContainers; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return error; - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::QueryDefaultContainerIdsL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::QueryDefaultContainerIdsL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iState = EResolveDefaultContainerIds; - - CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC(); - - delete iContainerList; - iContainerList = NULL; - - iContainerList = CUpnpContainerList::NewL(); - - // Get shared containers to iContainerList - iFileSharing->GetSharedContainerListL( KRootContainerId, - *browseCriteria, - *iContainerList, - iMatchCount, - iStatus ); - iCurrentOperation = EQueryDefaultContainersResult; - CleanupStack::PopAndDestroy( browseCriteria ); - SetActive(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::QueryDefaultContainerIdsResultL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::QueryDefaultContainerIdsResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - CUpnpContainer* tmpContainer( NULL ); - if ( !iContainerList ) - { - User::Leave( KErrGeneral ); - } - switch ( iContainerPosition ) - { - case CUpnpContainerCheckerAo::EImageAndVideo : - { - tmpContainer = - UPnPCommonUtils::FindContainerByTitle( *iContainerList, - KImageContainerName ); - if ( tmpContainer ) - { - iImageVideoContainerId = UPnPCommonUtils::DesC8ToInt( - tmpContainer->Id() ); - iContainerList->RemoveAndDestroy( tmpContainer->Id() ); - tmpContainer = NULL; - iContainerPosition++; - iCurrentOperation = EQueryDefaultContainersResult; - SelfComplete( KErrNone ); - } - else - { - iCurrentOperation = EShareContainer; - ShareContainerL( iContainerPosition ); - } - } - break; - case CUpnpContainerCheckerAo::EMusic : - { - tmpContainer = - UPnPCommonUtils::FindContainerByTitle( *iContainerList, - KMusicContainerName ); - if ( tmpContainer ) - { - iMusicContainerId = UPnPCommonUtils::DesC8ToInt( - tmpContainer->Id() ); - iContainerList->RemoveAndDestroy( tmpContainer->Id() ); - tmpContainer = NULL; - iContainerPosition++; - iCurrentOperation = EQueryDefaultContainersResult; - SelfComplete( KErrNone ); - } - else - { - iCurrentOperation = EShareContainer; - ShareContainerL( iContainerPosition ); - } - } - break; - case CUpnpContainerCheckerAo::EUploaded : - { - tmpContainer = - UPnPCommonUtils::FindContainerByTitle( *iContainerList, - KUploadedContainerName ); - if ( tmpContainer ) - { - iUploadContainerId = UPnPCommonUtils::DesC8ToInt( - tmpContainer->Id() ); - iContainerList->RemoveAndDestroy( tmpContainer->Id() ); - tmpContainer = NULL; - iContainerPosition++; - iCurrentOperation = EQueryDefaultContainersResult; - SelfComplete( KErrNone ); - } - else - { - iCurrentOperation = EShareContainer; - ShareContainerL( iContainerPosition ); - } - } - break; - default : - { - // Store IDs of possible unwanted containers - if ( iOperationMode != ECheckDefaultContainers ) - { - for ( TInt i(0); i< iContainerList->ObjectCount(); i++ ) - { - tmpContainer = static_cast< CUpnpContainer* >( - iContainerList->operator[]( i )); - iSharedContainerIds.AppendL( - UPnPCommonUtils::DesC8ToInt( tmpContainer->Id() ) ); - } - - - iState = EUnshareExtraContainers; - iCurrentOperation = EUnshareContainer; - } - else - { - iCurrentOperation = ENotActive; - } - - // Just add the Ids to client - if ( iClientIds ) - { - iClientIds->Reset(); - iClientIds->Append( iImageVideoContainerId ); - iClientIds->Append( iMusicContainerId ); - iClientIds->Append( iUploadContainerId ); - iClientIds->Compress(); - } - delete iContainerList; - iContainerList = NULL; - SelfComplete( KErrNone ); - } - break; - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::RunL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::RunL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( iStatus.Int() ) - { - __LOG1( "Error: %d", iStatus.Int() ); - } - - if ( iStatus.Int() == KErrCorrupt ) - { - if ( iRecoverError == ENoError ) - { - iRecoverError = EDropAllContent; - } - else - { - iCurrentOperation = ENotActive; - iRecoverError = ENoError; - } - } - else if ( iStatus.Int() == KErrNoMemory || - iStatus.Int() == KErrDiskFull || - iStatus.Int() == KErrServerTerminated ) - { - iCurrentOperation = ENotActive; - SelfComplete( iStatus.Int() ); - } - - - if ( iRecoverError ) - { - switch ( iRecoverError ) - { - case EDropAllContent : - { - iFileSharing->DropAllContentL( iStatus ); - iRecoverError = EDropAllContentResult; - SetActive(); - } - break; - case EDropAllContentResult : - { - if ( iStatus.Int() == KErrCorrupt ) - { - iCurrentOperation = ENotActive; - SelfComplete( iStatus.Int() ); - } - else - { - iRecoverError = ENoError; - SelfComplete( KErrNone ); - } - } - break; - default: - __LOG1( "Error: %d", __LINE__ ); - break; - } - - } - else - { - - if ( iStopRequested == MUpnpSharingCallback::ESharingPause ) - { - delete iFileSharing; - iFileSharing = NULL; - iFileSharing = CUpnpFileSharing::NewL(); - TInt e = iMediaServer.Stop( - RUpnpMediaServerClient::EStopSilent ); - if ( e ) - { - __LOG1( "Error: %d", e ); - } - e = iMediaServer.StartOffline(); - if ( e ) - { - __LOG1( "Error: %d", e ); - } - iStopRequested = MUpnpSharingCallback::ESharingNoStop; - } - - switch ( iCurrentOperation ) - { - case EInitialize : - { - InitializeL(); - } - break; - case EQueryDefaultContainers : - { - QueryDefaultContainerIdsL(); - } - break; - case EQueryDefaultContainersResult : - { - QueryDefaultContainerIdsResultL(); - } - break; - case EUnshareItemList : - { - UnshareItemListL(); - } - break; - case EQueryItemFromMediaServer : - { - QueryContainerItemsL(); - } - break; - case EQueryItemFromMediaServerResult : - { - QueryItemFromCdsResultL(); - } - break; - case EShareContainer : - { - __LOG1( "Error: %d", __LINE__ ); - } - break; - case EShareContainerResult : - { - ShareContainerResult(); - } - break; - case ENotActive : - { - Cleanup(); - if ( iCallback ) - { - iCallback->CompleteSharingOperationL( iStatus.Int(), 0 ); - } - } - // all operations requested done - break; - case EUnshareContainer : - { - UnshareContainerL(); - } - break; - case EUnshareContainerResult : - { - UnshareContainerResultL(); - } - break; - default : - { - __LOG1( "Error: %d", __LINE__ ); - break; - } - } - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::DoCancel -// Cancels active object -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::DoCancel() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - // NOTE: The cancelling of mediaserver request must be made in destructor - // because there is no cancel in CUpnpFileSharing - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::RunError -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContainerCheckerAo::RunError( TInt aError ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( aError ) - { - __LOG8_1( "CUpnpContainerCheckerAo::RunError", aError ); - } - TInt ret( KErrNone ); - if ( aError == KErrNoMemory || - aError == KErrDiskFull || - aError == KErrCorrupt ) - { - iCurrentOperation = ENotActive; - SelfComplete( aError ); - } - else - { - - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return ret; - } - - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::QueryItemFromCdsResultL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::QueryItemFromCdsResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - TInt objCount( iItemList->ObjectCount() ); - if ( objCount && ( iExecStatus < iTotalMatches ) ) - { - iCurrentOperation = EUnshareItemList; - } - else - { - if ( iState == EEmptyRootContainerItems ) - { - iState = EEmptyUploadedContainerItems; - iCurrentOperation = EQueryItemFromMediaServer; - } - else - { - iState = EIdle; - iCurrentOperation = ENotActive; - } - iExecStatus = 0; - iTotalMatches = KErrNotFound; - - } - - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::UnshareItemListL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::UnshareItemListL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iExecStatus += iItemList->ObjectCount(); - iFileSharing->UnshareItemListL( *iItemList, iMatchCount, iStatus ); - - delete iItemList; - iItemList = NULL; - iCurrentOperation = EQueryItemFromMediaServer; - SetActive(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::ShareContainerL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::ShareContainerL( TInt aPos ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - /* iTmpContainer = CUpnpContainer::NewL(); - iTmpContainer->SetParentIdL( *UPnPCommonUtils::IntToDesC8LC( - KRootContainerId ) ); - CleanupStack::PopAndDestroy(); //UPnPCommonUtils::IntToDesC8LC - iTmpContainer->SetObjectClassL( KStorageFolderContainerClass ); - - switch ( aPos ) - { - case CUpnpContainerCheckerAo::EImageAndVideo : - { - iTmpContainer->SetTitleL( KImageContainerName ); - } - break; - case CUpnpContainerCheckerAo::EMusic : - { - iTmpContainer->SetTitleL( KMusicContainerName ); - } - break; - case CUpnpContainerCheckerAo::EUploaded : - { - iTmpContainer->SetTitleL( KUploadedContainerName ); - } - break; - default : - break; - } - if ( iTmpContainer ) - { - iFileSharing->ShareContainerL( - *UPnPCommonUtils::IntToDesC8LC( KRootContainerId ), - *iTmpContainer, - iStatus ); - iCurrentOperation = EShareContainerResult; - CleanupStack::PopAndDestroy(); // UPnPCommonUtils::IntToDesC8LC - iCurrentOperation = EShareContainerResult; - SetActive(); - }*/ - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::ShareContainerResult -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::ShareContainerResult( ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( !iStatus.Int() ) - { - // Store the IDs - if ( iContainerPosition == CUpnpContainerCheckerAo::EUploaded ) - { - iUploadContainerId = UPnPCommonUtils::DesC8ToInt( - iTmpContainer->Id() ); - } - - else if ( iContainerPosition == - CUpnpContainerCheckerAo::EImageAndVideo ) - { - iImageVideoContainerId = UPnPCommonUtils::DesC8ToInt( - iTmpContainer->Id() ); - } - else if ( iContainerPosition == CUpnpContainerCheckerAo::EMusic ) - { - iMusicContainerId = UPnPCommonUtils::DesC8ToInt( - iTmpContainer->Id() ); - } - - - } - delete iTmpContainer; - iTmpContainer = NULL; - - iCurrentOperation = EQueryDefaultContainersResult; - iContainerPosition++; - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::UnshareContainerL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::UnshareContainerL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iCurrentOperation = EUnshareContainerResult; - switch ( iState ) - { - case EEmptyUploadedContainer : - { - __LOG1( "Error: %d", __LINE__ ); - } - break; - case EUnshareExtraContainers : - { - if ( iSharedContainerIds.Count() ) - { - iSharedContainerIds.Compress(); - iFileSharing->UnshareContainerL( iSharedContainerIds[ 0 ], - iStatus ); - iSharedContainerIds.Remove( 0 ); - SetActive(); - } - else - { - iState = EEmptyRootContainerItems; - QueryContainerItemsL(); - } - } - break; - default : - { - __LOG1( "Error: %d", __LINE__ ); - } - break; - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::UnshareContainerResultL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::UnshareContainerResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( iState == EEmptyUploadedContainer ) - { - __LOG1( "Error: %d", __LINE__ ); - } - else if ( iState == EUnshareExtraContainers ) - { - if ( iSharedContainerIds.Count() ) - { - iCurrentOperation = EUnshareContainer; - } - else - { - iState = EEmptyRootContainerItems; - iCurrentOperation = EQueryItemFromMediaServer; - } - SelfComplete( KErrNone ); - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::QueryContainerItemsL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::QueryContainerItemsL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - delete iItemList; - iItemList = NULL; - iItemList = CUpnpItemList::NewL(); - TInt containerId( KRootContainerId ); - if ( iState == EEmptyUploadedContainerItems ) - { - containerId = iUploadContainerId; - } - CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC(); - if ( iTotalMatches == KErrNotFound ) - { - iFileSharing->GetSharedItemListL ( - containerId, *browseCriteria, - *iItemList, iTotalMatches, iStatus ); - } - else - { - TInt tmp( 0 ); - iFileSharing->GetSharedItemListL ( - containerId, *browseCriteria, - *iItemList, tmp, iStatus ); - } - iCurrentOperation = EQueryItemFromMediaServerResult; - CleanupStack::PopAndDestroy( browseCriteria ); - SetActive(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::CreateBrowseCriteriaLC -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -CUpnpBrowseCriteria* CUpnpContainerCheckerAo::CreateBrowseCriteriaLC() const - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - CUpnpBrowseCriteria* browseCriteria = CUpnpBrowseCriteria::NewLC(); - browseCriteria->SetRequestedCount( KDefaultBrowseReqCount ); - browseCriteria->SetStartingIndex( KDefaultBrowseStartingInd ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return browseCriteria; - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::Cleanup -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::Cleanup() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iExecStatus = 0; - iTotalMatches = KErrNotFound; - iImageVideoContainerId = 0; - iMusicContainerId = 0; - iUploadContainerId = 0; - iContainerPosition = 0; - iClientIds = NULL; - delete iItemList; - iItemList = NULL; - delete iContainerList; - iContainerList = NULL; - delete iTmpContainer; - iTmpContainer = NULL; - iSharedContainerIds.Close(); - iState = EIdle; - iCurrentOperation = ENotActive; - if ( IsAdded() ) - { - Deque(); - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContainerCheckerAo::SelfComplete -// Start observing events -// -------------------------------------------------------------------------- -// -void CUpnpContainerCheckerAo::SelfComplete( TInt aError ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - SetActive(); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, aError ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/src/upnpcontentsharerao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpcontentserver/src/upnpcontentsharerao.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,440 @@ +/* + * Copyright (c) 2006-2007 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: CUpnpContentSharerAo class implementation + * + */ +// Include Files + +#include "upnpcontentsharerao.h" +#include "upnpcontentserverdefs.h" +#include "upnpselectionwriter.h" + +_LIT( KComponentLogfile, "contentserver.txt"); +#include "upnplog.h" + +// FORWARD DECLARATIONS +// CONSTANTS + +const TInt KPercent = 100; + +using namespace UpnpContentServer; + +// ============================ MEMBER FUNCTIONS ============================= + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::CUpnpContentSharerAo +// C++ default constructor can NOT contain any code, that +// might leave. +// -------------------------------------------------------------------------- +// +CUpnpContentSharerAo::CUpnpContentSharerAo( + MUpnpSharingCallback* aEngine, + MUpnpSharingAlgorithm* aSharingAlgorithm ) + : + CActive(CActive::EPriorityIdle), + iSharingRequest( NULL ) + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + iSharingEngine = aEngine; + iSharingAlgorithm = aSharingAlgorithm; + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::NewL +// Two-phased constructor. +// -------------------------------------------------------------------------- +// +CUpnpContentSharerAo* CUpnpContentSharerAo::NewL( + MUpnpSharingCallback* aEngine, + MUpnpSharingAlgorithm* aSharingAlgorithm ) + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + CUpnpContentSharerAo* self = + new (ELeave) CUpnpContentSharerAo( aEngine, aSharingAlgorithm ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::ConstructL +// Symbian 2nd phase constructor can leave. +// -------------------------------------------------------------------------- +// +void CUpnpContentSharerAo::ConstructL() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + CActiveScheduler::Add(this); + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::~CUpnpContentSharerAo +// Destructor +// -------------------------------------------------------------------------- +// +CUpnpContentSharerAo::~CUpnpContentSharerAo() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + Cancel(); + if ( iIdle ) + { + delete iIdle; + iIdle = NULL; + } + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::RunL +// Called when asyncronous request is ready +// -------------------------------------------------------------------------- +// + +void CUpnpContentSharerAo::RunL() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + __LOG8_1( "CUpnpContentSharerAo::RunL, iStatus=%d", iStatus.Int() ); + + if ( iCancel ) + { + // if Cancel wanted, then put iError as KErrCancel + iError = KErrCancel; + } + else if ( iStatus.Int() == KErrCorrupt || + iStatus.Int() == KErrDiskFull || + iStatus.Int() == KErrNoMemory ) + { + // if writing sharing status failed or diskspace is full or no + // memory, then stop the process + iError = iStatus.Int(); + } + + if( !iError && + ( iShareIndex < iSharingRequest->iShareArr->Count() || + iUnshareIndex < iSharingRequest->iUnshareArr->Count() ) ) + { + // handle next single file share or unshare + TInt err = DoSingleOperation(); + + // set progress so that Ui knows the current sharing progress. + SetProgressL(); + + //start another round + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + SetActive(); + } + else + { + //we are done, process complete using CIdle + if ( iIdle ) + { + delete iIdle; + iIdle = NULL; + } + iIdle = CIdle::NewL( CActive::EPriorityIdle ); + iIdle->Start( TCallBack( CompleteL, this ) ); + } + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::DoSingleOperation +// Handles one file sharing or unsharing +// -------------------------------------------------------------------------- +// +TInt CUpnpContentSharerAo::DoSingleOperation() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + TInt err = KErrNone; + + // first we go through the whole share list and then unsharing + if ( iShareIndex < iSharingRequest->iShareArr->Count() ) + { + + TFileName fileName = (*(iSharingRequest->iShareArr))[iShareIndex]; + TRAP( err, iSharingAlgorithm->ShareFileL( fileName ) ); + iShareIndex++; + if (err != KErrNone) + { + // Sharing failed for some reason, not doing break here. + // Just log and try next one. + __LOG8_1( "Sharing item error: ", err ); + } + } + + // share list done, next process the unshare list one by one + if ( iShareIndex == iSharingRequest->iShareArr->Count() && + iUnshareIndex < iSharingRequest->iUnshareArr->Count() ) + { + TFileName fileName = + (*(iSharingRequest->iUnshareArr))[iUnshareIndex]; + TRAP( err, iSharingAlgorithm->UnshareFileL( fileName ) ); + iUnshareIndex++; + if (err != KErrNone) + { + // Unsharing failed for some reason, not doing break here. + // Just log and try next one. + __LOG8_1( "Unsharing item error: ", err ); + } + } + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + return err; + } +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::DoCancel +// Cancels active object +// -------------------------------------------------------------------------- +// +void CUpnpContentSharerAo::DoCancel() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + // do nothing + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::RunError +// Cancels active object +// -------------------------------------------------------------------------- +// +TInt CUpnpContentSharerAo::RunError(TInt aError) + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + __LOG8_1( "RunError = ", aError ); + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + return KErrNone; + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::StartSharing +// Starts file sharing +// -------------------------------------------------------------------------- +// +void CUpnpContentSharerAo::StartSharing( + const CUpnpSharingRequest* aSharingRequest ) + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + if ( IsActive() ) + { + Cancel(); + } + + // initialize values for variables + iSharingRequest = aSharingRequest; + iCancel = EFalse; + iError = KErrNone; + iShareIndex = 0; + iUnshareIndex = 0; + iCurrentProgressPercent = 0; + + TInt err( KErrNone ); + if ( iSharingRequest->iShareArr && iSharingRequest->iUnshareArr ) + { + __LOG2( "CUpnpContentSharerAo::StartSharing \ + shareArr.Count=%d, unshareArr.Count=%d", + iSharingRequest->iShareArr->Count(), + iSharingRequest->iUnshareArr->Count() ); + + // write the sharing status to cenrep and clf ids to file + TRAP( err, WriteSharingStatusL() ); + + // if writing sharing status failed, map all errors to KErrCorrupt + // so that RunL handles the error + if ( err ) + { + err = KErrCorrupt; + } + } + else + { + err = KErrCorrupt; + } + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, err ); + + SetActive(); + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::SetProgressL +// Sets progress to engine +// -------------------------------------------------------------------------- +// +void CUpnpContentSharerAo::SetProgressL() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + TInt progress(0); + + // Summarize total count of shared and unshared files + TInt totalCount = iSharingRequest->iShareArr->Count() + + iSharingRequest->iUnshareArr->Count(); + // Find out how many of the files are processed already + TInt currentCount = iShareIndex + iUnshareIndex; + + // No div by zero + if( totalCount > 0 ) + { + // calculate percent for sharing progress + progress = currentCount * KPercent / totalCount ; + } + + if ( iCurrentProgressPercent != progress ) + { + // Set the progress information + iCurrentProgressPercent = progress; + iSharingEngine->SetProgressL( progress ); + } + else + { + // progress percent not changed, no need to set it + } + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::WriteSharingStatusL +// Writes the sharing status to cenrep and files +// -------------------------------------------------------------------------- +// +void CUpnpContentSharerAo::WriteSharingStatusL() + { + __LOG8_1( "%s start.", __PRETTY_FUNCTION__ ); + + // Create selection writer + CUpnpSelectionWriter* writer = + CUpnpSelectionWriter::NewL( iSharingRequest->iMediaType ); + CleanupStack::PushL( writer ); + + // if sharing request is EShareMany, append clf ids to writer + if( iSharingRequest->iSharingType == EShareMany ) + { + if ( iSharingRequest->iClfIds ) + { + for ( TInt i(0); i < iSharingRequest->iClfIds->MdcaCount(); i++ ) + { + TPtrC collId = iSharingRequest->iClfIds->MdcaPoint(i); + writer->AppendItemL( collId ); + } + } + else + { + // no clf ids, leave + User::Leave( KErrCorrupt ); + } + } + + // write sharing status to cenrep and/or file + writer->SaveSharingStateL( iSharingRequest->iSharingType ); + + CleanupStack::PopAndDestroy( writer ); + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::SharingOngoing +// Checks whether sharing is ongoing or not. +// -------------------------------------------------------------------------- +// +TBool CUpnpContentSharerAo::SharingOngoing() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + TBool ret(EFalse); + if ( iSharingRequest && + iSharingRequest->iShareArr && + iSharingRequest->iUnshareArr ) + { + TInt totalCount = iSharingRequest->iShareArr->Count() + + iSharingRequest->iUnshareArr->Count(); + TInt currentCount = iShareIndex + iUnshareIndex; + if ( currentCount < totalCount ) + { + // sharing still ongoing + ret = ETrue; + } + } + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + return ret; + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::StopSharing +// Stops the sharing. +// -------------------------------------------------------------------------- +// +void CUpnpContentSharerAo::StopSharing() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + iCancel = ETrue; + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::CompleteL +// Operation complete. +// -------------------------------------------------------------------------- +// +TInt CUpnpContentSharerAo::CompleteL( TAny* aPtr ) + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + CUpnpContentSharerAo* sharer = + static_cast( aPtr ); + // callback for operation completed. + sharer->iSharingEngine->CompleteSharingOperationL( sharer->iError, + sharer->iSharingRequest->iMediaType ); + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + return KErrNone; + } + +// -------------------------------------------------------------------------- +// CUpnpContentSharerAo::ForceSetProgress +// Forces itself to set progress in next file operation +// -------------------------------------------------------------------------- +// +void CUpnpContentSharerAo::ForceSetProgress() + { + __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); + + // let's change the value of the current sharing progress so that + // the progress property is set in next file sharing operation. + iCurrentProgressPercent--; + + __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); + } + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/src/upnpcontentsharingao.cpp --- a/upnpsharing/upnpcontentserver/src/upnpcontentsharingao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1972 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CUpnpContentSharingAo class implementation - * -*/ - - - - - - -// Include Files -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "upnpcommonutils.h" // FindContainerByTitle -#include "upnpcdsreselementutility.h" -// CLF headers -#include -#include -#include -#include - -//#include - -#include - -#include "upnpcontentsharingao.h" -#include "upnpcontentmetadatautility.h" -#include "upnpselectionwriter.h" -#include "upnpcontainercheckerao.h" -#include "upnpcontentserverdefs.h" -#include "upnpunsharerao.h" - -_LIT( KComponentLogfile, "contentserver.txt"); -#include "upnplog.h" - -// FORWARD DECLARATIONS -class UPnPCommonUtils; - -// CONSTANTS - -const TInt KUiSelectionOffset = 2; -const TInt KDefaultGranularity( 10 ); - -// KContentDirCommitAmount should be in sync with KCommitEveryNum in -// upnpcontentdirectoryglobals.h which is not exported -const TInt KContentDirCommitAmount = 10; - -using namespace UpnpContentServer; - -// ============================ MEMBER FUNCTIONS ============================= - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::CUpnpContentSharingAo -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpContentSharingAo::CUpnpContentSharingAo( - MUpnpSharingCallback* aEngine, - CUpnpContentMetadataUtility* aMetadata ) - : CActive( CActive::EPriorityStandard ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iEngine = aEngine; - iMetadataUtility = aMetadata; - iContainerId = KErrNotFound; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUpnpContentSharingAo* CUpnpContentSharingAo::NewL( - MUpnpSharingCallback* aEngine, - CUpnpContentMetadataUtility* aMetadata ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - CUpnpContentSharingAo* self = new (ELeave) - CUpnpContentSharingAo( aEngine, aMetadata ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return self; - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ConstructL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iContainerIdx = 0; - iObjectIdx = 0; - iVideoIndex = 0; - iImageIndex = 0; - iAllVideosShared = EFalse; - iAllImagesShared = EFalse; - - CActiveScheduler::Add( this ); - - iFileSharing = CUpnpFileSharing::NewL(); - ConnectMediaServer(); - iWriter = CUpnpSelectionWriter::NewL( iContainerType ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - - -// Destructor -CUpnpContentSharingAo::~CUpnpContentSharingAo() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iMediaServer.Close(); - delete iFileSharing; - iFileSharing = NULL; - - - if ( IsActive() ) - { - __LOG1("CUpnpContentSharingAo destructor IsActive==\ -true iSharingState: %d", iSharingState ); - iSharingState = ENotActive; - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - } - - Cancel(); - iEngine = NULL; - iContainerIds = NULL; - - delete iTmpContainer; - delete iSharedContainerIds; - delete iWriter; - DeleteListUpnpObject(); - delete iFileNameArr; - delete iTmpItem; - delete iPlaylists; - delete iCollections; - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::RunL -// Called when asyncronous request is ready -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::RunL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - __LOG8_1( "iStatus", iStatus.Int() ); - if ( iStatus.Int() == KErrCorrupt || - iStatus.Int() == KErrDiskFull || - iStatus.Int() == KErrNoMemory ) - { - iSharingState = ENotActive; - } - if ( iStopRequested == MUpnpSharingCallback::ESharingPause ) - { - TInt err = iMediaServer.Stop( - RUpnpMediaServerClient::EStopSilent ); - __LOG1( "Error: %d", err ); - err = iMediaServer.StartOffline(); - __LOG1( "Error: %d", err ); - - iStopRequested = MUpnpSharingCallback::ESharingNoStop; - } - - switch ( iSharingState ) - { - case EUnshareContainers : - { - // Unshare the container structure - UnshareContainersL(); - } - break; - case EShareContainers : - { - // Share the container structure - ShareContainersL(); - } - break; - case EShareContainersResult : - { - // advance to next container or share items - ShareContainersResultL(); - } - break; - case EShareItems : - { - // coming here after all containers are shared - // then at least once per container - HandleSharingSubstatesL(); - } - break; - case EShareItemsResult : - { - // advance to next item or end - ShareItemsResultL(); - } - break; - case EShareAllItems : - { - //..coming to here once "All files" is selected and - // individual albums are already shared - HandleSharingSubstatesL(); - } - break; - case EShareAllItemsResult : - { - // advance to next item set or end - AllItemsResultL(); - } - break; - case ENotActive : - // informs handler that we are done - { - TInt err ( iStatus.Int() ); - if ( iStopRequested == MUpnpSharingCallback::ESharingFullStop ) - { - // normal case - err = KErrCancel; - iStopRequested = EFalse; - } - - TRAP_IGNORE( - iEngine->CompleteSharingOperationL( err, - iContainerType )); - } - break; - - default : - { - __LOG( "RunL - default" ); - } - break; - } - - __LOG( "RunL - end" ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::DoCancel -// Cancels active object -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::DoCancel() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::RunError -// Cancels active object -// -------------------------------------------------------------------------- -// -TInt CUpnpContentSharingAo::RunError( TInt aError ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - __LOG8_1( "RunError = ", aError ); - if ( aError == KErrNoMemory || - aError == KErrDiskFull || - aError == KErrCorrupt ) - { - iSharingState = ENotActive; - } - if ( iSharingState == EUnshareContainers ) - { - if ( iShareAllSelection == EShareNone ) - { - iSharingState = ENotActive; - TRAP_IGNORE( iWriter->SaveSharingStateL( EShareNone ) ); - } - else - { - iSharingState = EShareContainers; - } - } - else - { - iSharingState = ENotActive; - } - if ( iSharingState != EEnumerateSelections ) - { - SelfComplete( aError ); - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return KErrNone; - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::IsActive() -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TBool CUpnpContentSharingAo::IsActive() const - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - TBool ret( CActive::IsActive()); - if ( !ret ) - { - ret = iProfilerActive; - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return ret; - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::HandleSharingSubstatesL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::HandleSharingSubstatesL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( iSharingSubState == EIdle ) - { - if ( iSharingState == EShareItems ) - { - ShareItemsL(); - } - else if ( iSharingState == EShareAllItems ) - { - ShareAllItemsL(); - } - else - { - } - } - else if ( iSharingSubState == EProfileItemList ) - { - ProfileItemListL(); - } - else if ( iSharingSubState == EProfileItemListResult ) - { - ProfileItemListResult(); - } - else if ( iSharingSubState == EShareItemList ) - { - TInt parentId( KErrNotFound ); - if ( iSharingState == EShareItems ) - { - parentId = iSharedContainerIds->operator[]( iContainerIdx ); - } - else if ( iSharingState == EShareAllItems ) - { - parentId = iContainerId; - } - else - { - } - ShareItemListL( parentId ); - } - else if ( iSharingSubState == EShareItemListResult ) - { - ShareItemListResultL(); - } - else - { - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareFilesL -// Starts file sharing -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::InitializeL( - TUpnpMediaType aContainerType, - const RArray& aCurrentSelection, - CDesCArray& aPlaylistIds, - CDesCArray& aPlaylistNames, - const TInt aContainerId ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - // Initialize values - iObjectIdx = 0; - iContainerIdx = 0; - iVideoIndex = 0; - iImageIndex = 0; - iAllVideosShared = EFalse; - iAllImagesShared = EFalse; - iSharingProgress = 0; - - iContainerType = aContainerType; - - delete iWriter; - iWriter = NULL; - iWriter = CUpnpSelectionWriter::NewL( iContainerType ); - - AdjustShareAllSelection( aCurrentSelection ); - iCurrentSelections = aCurrentSelection; - iContainerIds = &aPlaylistIds; - iContainerNames = &aPlaylistNames; - iContainerId = aContainerId; - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareFilesL -// Starts file sharing -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ShareFiles( ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - // Open file sharing session from mediaserver. - // Start offline if not started. - TInt status( RUpnpMediaServerClient::EStopped ); - iMediaServer.Status( status ); - if ( status == RUpnpMediaServerClient::EStopped ) - { - iMediaServer.StartOffline(); - } - iSharingState = EUnshareContainers; - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUPnPSettingsEngineAO::CreateContainerL -// creates container -// -------------------------------------------------------------------------- -// -CUpnpContainer* CUpnpContentSharingAo::CreateContainerL( - TUpnpMediaType aContainerType, - const TDesC8& aTitle ) const - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - CUpnpContainer* cont= CUpnpContainer::NewL(); - CleanupStack::PushL( cont ); - cont->SetParentIdL( KRootContainerIdDesc8 ); - cont->SetTitleL( aTitle ); - switch ( aContainerType ) - { - case EImageAndVideo : - { - cont->SetObjectClassL( KImageVideoContainerClass ); - } - break; - case EPlaylist : - { - cont->SetObjectClassL( KStorageFolderContainerClass ); - } - break; - default : - { - __LOG( "CreateContainerL - default"); - } - break; - } - CleanupStack::Pop( cont ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return cont; - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::CloseFileSharingSession -// Closes mediaserver and file sharing session -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::CloseFileSharingSession() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iMediaServer.Close(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::UnshareContainersL -// Unshares objects, this should only be called from RunL -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::UnshareContainersL( ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - // All old containers unshred, move to next state - if ( iShareAllSelection == EShareNone ) - { - iSharingState = ENotActive; - iWriter->SaveSharingStateL( EShareNone ); - } - else - { - iSharingState = EShareContainers; - } - - // All old containers unshred, move to next state - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ConnectMediaServer -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContentSharingAo::ConnectMediaServer() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - TInt error = iMediaServer.Connect(); - __LOG8_1( "ConnectMediaServer error %d", error ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return error; - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::AdjustShareAllSelection -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::AdjustShareAllSelection( - const RArray& aSelections ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( aSelections.Count() == 1 ) - { - - if ( aSelections[0] == 0 ) - { - __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: \ -EShareNone"); - iShareAllSelection = EShareNone; - } - else if ( aSelections[0] == 1 ) - { - __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: \ -EShareAll"); - iShareAllSelection = EShareAll; - } - else - { - __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: \ -EShareMany"); - iShareAllSelection = EShareMany; - } - } - else - { - __LOG("CUpnpContentSharingAo::AdjustShareAllSelection: EShareMany"); - iShareAllSelection = EShareMany; - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareContainersL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ShareContainersL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - /* iMetadataUtility->ClearPostFiltersL(); - - TInt ind( 0 ); - // Theres is still containers to share - switch ( iContainerType ) - { - case EImageAndVideo : - { - // get the correct index for CLF - ind = GetContainerIndexL(); - HBufC8* albumName( NULL ); - if ( ind != KErrNotFound ) - { - albumName = UpnpString::FromUnicodeL( - iContainerNames->MdcaPoint( ind ) ); - CleanupStack::PushL( albumName ); - - TInt plErr( KErrNone ); - - - if ( !plErr ) - { - iWriter->AppendItemL( iContainerIds->MdcaPoint( ind ) ); - - iTmpContainer = CreateContainerL( iContainerType, - *albumName ); - - iFileSharing->ShareContainerL( - *UPnPCommonUtils::IntToDesC8LC ( iContainerId ), - *iTmpContainer, - iStatus ); - CleanupStack::PopAndDestroy(); //UPnPCommonUtils::IntToDesC8LC - CleanupStack::PopAndDestroy( albumName ); - SetActive(); - } - else - { - SelfComplete( KErrNotFound ); - } - } - else - { - SelfComplete( KErrNone ); - } - } - break; - case EPlaylist : - { - - // get the correct index for CLF - ind = GetContainerIndexL(); - if ( ind != KErrNotFound ) - { - HBufC8* playlistName( NULL ); - playlistName = UpnpString::FromUnicodeL( - iContainerNames->MdcaPoint( ind ) ); - CleanupStack::PushL( playlistName ); - - TInt plErr( KErrNone ); - if ( !plErr ) - { - // do the id.. - iWriter->AppendItemL( iContainerIds->MdcaPoint( ind ) ); - - // ..then do the name for the container - iTmpContainer = CreateContainerL( iContainerType, - *playlistName ); - - iFileSharing->ShareContainerL( - *UPnPCommonUtils::IntToDesC8LC( iContainerId ), - *iTmpContainer, - iStatus ); - - CleanupStack::PopAndDestroy(); // IntToDesC8LC - - SetActive(); - } - else - { - SelfComplete( KErrNotFound ); - } - CleanupStack::PopAndDestroy( playlistName ); - } - else - { - SelfComplete( KErrNone ); - } - } - break; - default : - break; - } - - iSharingState = EShareContainersResult; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );*/ - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareItemsL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ShareItemsL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - delete iFileNameArr; - iFileNameArr = NULL; - iFileNameArr = new (ELeave) - CDesCArrayFlat( 4 ); - DeleteListUpnpObject(); - iItemList = CUpnpItemList::NewL(); - TInt ind( 0 ); - - - TInt parentId( 0 ); - - switch ( iContainerType ) - { - case EImageAndVideo : - { - if ( !iCollections ) - { - iCollections = CUPnPAlbumServices::NewL(); - } - - // get the correct index for CLF - ind = GetContainerIndexL(); - - // ..then do the name for the container - CDesCArray* items = new (ELeave) CDesCArrayFlat(4); - CleanupStack::PushL( items ); - TInt itemCount( 0 ); - if ( ind < iContainerIds->MdcaCount() && ind != KErrNotFound ) - { - TPtrC plId( iContainerIds->MdcaPoint( ind ) ); - TRAPD( albErr, iCollections->OpenAlbumL( plId, - *items )); - delete iCollections; - iCollections = NULL; - - if( !albErr ) - { - itemCount = items->MdcaCount(); - } - } - - if ( itemCount ) - { - - parentId = - iSharedContainerIds->operator[]( iContainerIdx ); - TInt i = iObjectIdx; - - delete iFileNameArr; - iFileNameArr = NULL; - iFileNameArr = new (ELeave) - CDesCArrayFlat( 4 ); - TBool canAppend = items->MdcaCount(); - - while ( i < itemCount && canAppend ) - { - // process all items in curret collection - HBufC8* id = UPnPCommonUtils::IntToDesC8LC( parentId ); - TPtrC item( items->MdcaPoint( i ) ); - TRAPD( itemErr, - iTmpItem = iMetadataUtility->CreateItemL( - item, - *id )); - if ( !itemErr && iTmpItem ) - { - if ( !itemErr ) - { - if( !iMetadataUtility->UpdateMetadataL( - EPhotoFile, - iTmpItem, - item )) - { - // The item was not found from prev model - if( !iMetadataUtility->UpdateMetadataL( - EVideoFile, - iTmpItem, - item ) ) - { - iTmpItem->SetObjectClassL( - KImageItemObjectClass ); - } - } - iItemList->AppendObjectL( *iTmpItem ); - iFileNameArr->AppendL( - item ); - // transfer ownership - } - else - { - delete iTmpItem; - } - iTmpItem = NULL; - i++; - if ( iItemList->ObjectCount() > - KContentDirCommitAmount ) - { - // the list is full, next share it - canAppend = EFalse; - // save the current position in list for - // next run - iObjectIdx = i; - } - } - else - { - i++; - iTmpItem = NULL; - } - CleanupStack::PopAndDestroy(); // IntToDesC8LC - - } - } - CleanupStack::PopAndDestroy( items ); - - if ( iItemList->ObjectCount() <= KContentDirCommitAmount ) - { - // next time start with new album - iSharingProgress += iObjectIdx; - iObjectIdx = 0; - iMetadataUtility->ClearPostFiltersL(); - } - - if ( iItemList->ObjectCount() ) - { - iSharingSubState = EProfileItemList; - SelfComplete( KErrNone ); - } - else - { - // update indexes - iMetadataUtility->ClearPostFiltersL(); - iSharingSubState = EShareItemListResult; - SelfComplete( KErrNone ); - } - } - break; - case EPlaylist : - { - if ( !iPlaylists ) - { - iPlaylists = CUPnPPlaylistServices::NewL(); - } - - // get the correct index for CLF - ind = GetContainerIndexL(); - - // ..then do the name for the container - CDesCArray* items = new (ELeave) CDesCArrayFlat(4); - CleanupStack::PushL( items ); - TInt itemCount( 0 ); - if ( ind < iContainerIds->MdcaCount() && ind != KErrNotFound ) - { - TPtrC plId( iContainerIds->MdcaPoint( ind ) ); - TRAPD( plErr, iPlaylists->OpenPlaylistL( plId, - *items ) ); - delete iPlaylists; - iPlaylists = NULL; - - if( !plErr ) - { - itemCount = items->MdcaCount(); - } - } - - if ( itemCount ) - { - - parentId = - iSharedContainerIds->operator[]( iContainerIdx ); - TInt i = iObjectIdx; - - TBool canAppend = items->MdcaCount(); - - while ( i < itemCount && canAppend ) - { - // process all items in curret collection - HBufC8* id = UPnPCommonUtils::IntToDesC8LC( parentId ); - TPtrC item( items->MdcaPoint( i ) ); - TRAPD( plErr, - iTmpItem = iMetadataUtility->CreateItemL( - item, - *id )); - if ( !plErr && iTmpItem ) - { - if ( !plErr ) - { - iMetadataUtility->UpdateMetadataL( - EMusicFile, - iTmpItem, - item ); - iTmpItem->SetObjectClassL( - KMusicItemObjectClass ); - iItemList->AppendObjectL( *iTmpItem ); - iFileNameArr->AppendL( - item ); - // transfer ownership - } - else - { - delete iTmpItem; - } - iTmpItem = NULL; - i++; - if ( iItemList->ObjectCount() > - KContentDirCommitAmount ) - { - // the list is full, next share it - canAppend = EFalse; - // save the current position in list for - // next run - iObjectIdx = i; - } - } - else - { - i++; - iTmpItem = NULL; - } - CleanupStack::PopAndDestroy(); // IntToDesC8LC - - } - } - CleanupStack::PopAndDestroy( items ); - - if ( iItemList->ObjectCount() <= KContentDirCommitAmount ) - { - // next time start with new album - iSharingProgress += iObjectIdx; - iObjectIdx = 0; - iMetadataUtility->ClearPostFiltersL(); - } - - - if ( iItemList->ObjectCount() ) - { - iSharingSubState = EProfileItemList; - SelfComplete( KErrNone ); - } - else - { - // goto RunL and update indexes - iMetadataUtility->ClearPostFiltersL(); - iSharingSubState = EShareItemListResult; - SelfComplete( KErrNone ); - } - } - break; - default : - break; - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareAllItemsL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ShareAllItemsL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - delete iFileNameArr; - iFileNameArr = NULL; - iFileNameArr = new (ELeave) - CDesCArrayFlat( 4 ); - - DeleteListUpnpObject(); - iItemList = CUpnpItemList::NewL(); - - switch ( iContainerType ) - { - case EImageAndVideo: - { - if ( !iAllImagesShared ) - { - AppendImageFilesToListL(); - } - - // do not share videos if the list is already full - if ( !iAllVideosShared && - iItemList->ObjectCount() <= KContentDirCommitAmount ) - { - AppendVideoFilesToListL(); - } - } - break; - case EPlaylist: - { - const MCLFItemListModel* list(NULL); - list = &iMetadataUtility->MusicFiles(); - if ( !list ) - { - User::Leave( KErrArgument ); - } - TInt musicCount = list->ItemCount(); - - if ( iObjectIdx < musicCount ) - { - // sharing images - TBool canAppend( list->ItemCount() ); - TInt i( iObjectIdx ); - - while ( i < list->ItemCount() && canAppend ) - { - // process all items in curret collection - HBufC8* id = UPnPCommonUtils::IntToDesC8LC( - iContainerId ); - TRAPD( plErr, iTmpItem = iMetadataUtility->CreateItemL( - list->Item( i ), - *id )); - if ( !plErr && iTmpItem ) - { - TPtrC fullFileName; - list->Item( i ).GetField( ECLFFieldIdFileNameAndPath, - fullFileName ); - - if ( !plErr ) - { - iMetadataUtility->UpdateMetadataL( - EMusicFile, - iTmpItem, - fullFileName ); - iTmpItem->SetObjectClassL( KMusicItemObjectClass ); - iItemList->AppendObjectL( *iTmpItem ); - iFileNameArr->AppendL( fullFileName ); - } - else - { - delete iTmpItem; - } - iTmpItem = NULL; - i++; - if ( iItemList->ObjectCount() > - KContentDirCommitAmount ) - { - // the list is full, next share it - canAppend = EFalse; - } - } - else - { - i++; - iTmpItem = NULL; - } - - CleanupStack::PopAndDestroy(); // IntToDesC8LC - } - // save the current position in list, for next run - iObjectIdx = i; - } - - } - break; - default : - break; - } - - // do not share empty list - if ( iItemList->ObjectCount() ) - { - iSharingSubState = EProfileItemList; - SelfComplete( KErrNone ); - } - else - { - // update indexes - iSharingSubState = EShareItemListResult; - SelfComplete( KErrNone ); - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ProfileItemListL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ProfileItemListL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - if ( iProfileInd < iItemList->ObjectCount() ) - { - iProfilerActive = ETrue; - - CUpnpItem* - tmpItem = static_cast( - iItemList->operator[]( iProfileInd )); - - TPtrC fileName = iFileNameArr->MdcaPoint( iProfileInd ); - - iSharingSubState = EProfileItemListResult; - - TRAPD( err, UpnpCdsResElementUtility::AddResElementL( - *tmpItem, - fileName )); - if ( iDeletePending ) - { - DeleteListUpnpObject(); - delete iFileNameArr; - iFileNameArr = NULL; - } - else - { - SetActive(); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, err ); - } -#ifdef _DEBUG - HBufC* log = HBufC::NewLC(512); - log->Des().Append(_L("CUpnpContentSharingAo: Profiling: ")); - log->Des().Append( fileName ); - __LOG16( *log ); - __LOG2( "CUpnpContentSharingAo: Profile index: (%d of %d)", - iProfileInd, - iItemList->ObjectCount()); - CleanupStack::PopAndDestroy( log ); -#endif - iProfilerActive = EFalse; - } - else - { - // update indexes - iProfileInd = 0; - iSharingSubState = EShareItemListResult; - SelfComplete( KErrNone ); - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ProfileItemListResult -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ProfileItemListResult() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( iStatus.Int() ) - { - CUpnpItem* tmpItem = static_cast( - iItemList->operator[]( iProfileInd )); - TPtrC8 id( tmpItem->Id() ); - iItemList->RemoveAndDestroy( id ); - - iFileNameArr->Delete(iProfileInd); - } - else - { - iProfileInd++; - } - - if ( iProfileInd < iItemList->ObjectCount() ) - { - iSharingSubState = EProfileItemList; - } - else - { - iProfileInd = 0; - delete iFileNameArr; - iFileNameArr = NULL; - iSharingSubState = EShareItemList; - } - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareItemListL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ShareItemListL( const TInt& aParentId ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - // do not share empty list - if ( iItemList && iItemList->ObjectCount() ) - { - iFileSharing->ShareItemListL( - *UPnPCommonUtils::IntToDesC8LC( aParentId ), - *iItemList, - iSharedContainersCount, iStatus ); - CleanupStack::PopAndDestroy(); // UPnPCommonUtils::IntToDesC8LC - iSharingSubState = EShareItemListResult; - SetActive(); - } - else - { - // update indexes - iSharingSubState = EShareItemListResult; - SelfComplete( KErrNone ); - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareItemListResultL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ShareItemListResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iTmpItem = NULL; - if ( iSharingState == EShareItems ) - { - ShareItemsResultL(); - } - else if ( iSharingState == EShareAllItems ) - { - AllItemsResultL(); - } - iSharingSubState = EIdle; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::AllItemsResultL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::AllItemsResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - TInt totalItemCount( 0 ); - - if ( iItemList ) - { - // This updates the field needed in UI for progress - iSharingProgress += iItemList->ObjectCount(); - iEngine->SetProgressL( iSharingProgress ); - DeleteListUpnpObject(); - delete iFileNameArr; - iFileNameArr = NULL; - } - iTmpItem = NULL; - - switch ( iContainerType ) - { - case EImageAndVideo: - { - totalItemCount = iMetadataUtility->ImageFiles().ItemCount() + - iMetadataUtility->VideoFiles().ItemCount(); - } - break; - case EPlaylist : - { - totalItemCount = iMetadataUtility->MusicFiles().ItemCount(); - } - break; - default : - break; - } - // Fix EYSN-7CWDZ5 error in UPnP FW2.1 - // Have not changed it in UPnP FW2.5 because the FW 2.5 have - // so much change. - if ( iObjectIdx < totalItemCount ) - { - // Continue sharing process since not everything is shared yet. - iSharingState = EShareAllItems; - } - else - { - if ( !iWriter ) - { - User::Leave( KErrGeneral ); - } - iWriter->SaveSharingStateL( iShareAllSelection ); - iSharingState = ENotActive; - - } - - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareContainersResultL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::ShareContainersResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - - if ( !iStatus.Int() ) - { - // previous container shared OK, save the album name - iWriter->AppendStatusL( iContainerIdx ); - } - - if ( iTmpContainer ) - { - TInt newId = UPnPCommonUtils::DesC8ToInt( iTmpContainer->Id() ); - __LOG1("CUpnpContentSharingAo::ShareContainersResultL:\ - id: %d", newId ); - if ( !iSharedContainerIds ) - { - iSharedContainerIds = - new (ELeave) CArrayFixFlat( 10 ); - } - iSharedContainerIds->AppendL( newId ); - delete iTmpContainer; - iTmpContainer = NULL; - } - - TInt totalContainers( 0 ); - // determine next state - if ( iShareAllSelection == EShareAll ) - { - switch ( iContainerType ) - { - // totalContainers is used as index -> -1 - case EImageAndVideo : - { - totalContainers = iContainerIds->MdcaCount() -1; - } - break; - case EPlaylist : - { - totalContainers = iContainerIds->MdcaCount() -1; - } - break; - default: - break; - } - } - else if ( iShareAllSelection == EShareMany ) - { - totalContainers = iCurrentSelections.Count() -1; - } - - if ( iContainerIdx < totalContainers ) - { - iContainerIdx++; - iSharingState = EShareContainers; - } - else - { - // all selected containers shared, next share items - iContainerIdx = 0; - iSharingState = EShareItems; - } - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::ShareItemsResultL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -void CUpnpContentSharingAo::ShareItemsResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( !iMetadataUtility ) - { - User::Leave( KErrGeneral ); - } - - if ( iItemList ) - { - // This updates the field needed in UI for progress - iSharingProgress += iItemList->ObjectCount(); - iEngine->SetProgressL( iSharingProgress ); - DeleteListUpnpObject(); - delete iFileNameArr; - iFileNameArr = NULL; - } - iTmpItem = NULL; - iSharingState = EShareItems; - - TInt totalContainers( 0 ); - // Clear postfilters, they are re-set if needed: ShareItemsL/ - // ShareAllItemsL - iMetadataUtility->ClearPostFiltersL(); - // determine next state - if ( iShareAllSelection == EShareAll ) - { - switch ( iContainerType ) - { - case EImageAndVideo : - { - totalContainers = iContainerIds->MdcaCount() -1; - } - break; - case EPlaylist : - { - totalContainers = iContainerIds->MdcaCount() -1; - - } - break; - default: - break; - } - } - else if ( iShareAllSelection == EShareMany ) - { - if( iSharedContainerIds ) - { - totalContainers = iSharedContainerIds->Count() -1; - } - else - { - // sharing of all containers failed or the containers under - // sharing were deleted - totalContainers = KErrNotFound; - } - } - - - if ( !iObjectIdx ) - { - - // all files were shared from current container - if ( iContainerIdx < totalContainers ) - { - // more items in the selected.. - iContainerIdx++; - } - else - { - // all selected containers shared.. - if ( iShareAllSelection == EShareAll ) - { - // next share individual files - iSharingState = EShareAllItems; - } - else - { - // sharing process is done. - if ( totalContainers == KErrNotFound ) - { - iShareAllSelection = EShareNone; - } - iWriter->SaveSharingStateL( iShareAllSelection ); - iSharingState = ENotActive; - } - } - } - - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::SelectionObjectCountL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContentSharingAo::SelectionObjectCountL( - const TUpnpMediaType aContainerType ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - TInt totalCount( 0); - if ( iShareAllSelection != EShareNone ) - { - switch ( aContainerType ) - { - case EImageAndVideo : - { - if ( !iCollections ) - { - iCollections = CUPnPAlbumServices::NewL(); - } - __LOG("albumserv created"); - CDesCArray* collIds = new ( ELeave ) CDesCArrayFlat( - KDefaultGranularity ); - CleanupStack::PushL( collIds ); - CDesCArray* collNames = new ( ELeave ) CDesCArrayFlat( - KDefaultGranularity ); - CleanupStack::PushL( collNames ); - iCollections->ListAlbumsL( *collIds, *collNames ); - __LOG("albums listed"); - collNames->Reset(); - - if ( iShareAllSelection == EShareAll ) - { - __LOG("EShareAll"); - for( TInt i(0); iMdcaCount(); i++ ) - { - TPtrC id( collIds->MdcaPoint( i ) ); - RDebug::Print(_L("id: %S"), &id ); - TRAPD( lcode, iCollections->OpenAlbumL( id, - *collNames )); - if( !lcode ) - { - totalCount += collNames->MdcaCount(); - } - else - { - } - collNames->Reset(); - __LOG("Loop cycle end"); - } - __LOG("Loop done"); - // Add individual files count - const MCLFItemListModel* imgList = - &iMetadataUtility->ImageFiles(); - totalCount += imgList->ItemCount(); - const MCLFItemListModel* vidList = - &iMetadataUtility->VideoFiles(); - totalCount += vidList->ItemCount(); - __LOG("EShareAll done"); - } - else if ( iShareAllSelection == EShareMany ) - { - for( iContainerIdx = 0; - iContainerIdx < iCurrentSelections.Count(); - iContainerIdx++ ) - { - TInt ind = GetContainerIndexL(); - - if ( ind != KErrNotFound ) - { - TPtrC id = iContainerIds->MdcaPoint( ind ); - TRAPD( openErr, iCollections->OpenAlbumL( - id, - *collNames )); - if( !openErr ) - { - totalCount += collNames->MdcaCount(); - collNames->Reset(); - } - } - __LOG("end for(..)"); - } - iContainerIdx = 0; - } - delete iCollections; - iCollections = NULL; - __LOG("iCollections deleted"); - CleanupStack::PopAndDestroy( collNames ); - CleanupStack::PopAndDestroy( collIds ); - } - break; - case EPlaylist : - { - if ( !iPlaylists ) - { - iPlaylists = CUPnPPlaylistServices::NewL(); - } - - CDesCArray* plIds = new ( ELeave ) CDesCArrayFlat( - KDefaultGranularity ); - CleanupStack::PushL( plIds ); - CDesCArray* plNames = new ( ELeave ) CDesCArrayFlat( - KDefaultGranularity ); - CleanupStack::PushL( plNames ); - iPlaylists->ListPlaylistsL( *plIds, *plNames ); - plNames->Reset(); - - if ( iShareAllSelection == EShareAll ) - { - for( TInt i(0); iMdcaCount(); i++ ) - { - TPtrC id( plIds->MdcaPoint( i ) ); - iPlaylists->OpenPlaylistL( id, - *plNames ); - - totalCount += plNames->MdcaCount(); - plNames->Reset(); - } - // Add individual files count - const MCLFItemListModel* musicList = - &iMetadataUtility->MusicFiles(); - totalCount += musicList->ItemCount(); - } - else if ( iShareAllSelection == EShareMany ) - { - for( iContainerIdx = 0; - iContainerIdx < iCurrentSelections.Count(); - iContainerIdx++ ) - { - TInt ind = GetContainerIndexL(); - - if ( ind != KErrNotFound ) - { - TPtrC id = iContainerIds->MdcaPoint( ind ); - iPlaylists->OpenPlaylistL( id, - *plNames ); - totalCount += plNames->MdcaCount(); - plNames->Reset(); - } - - } - iContainerIdx = 0; - } - delete iPlaylists; - iPlaylists = NULL; - CleanupStack::PopAndDestroy( plNames ); - CleanupStack::PopAndDestroy( plIds ); - } - break; - default : - { - } - break; - } - } - __LOG1("CUpnpContentSharingAo::SelectionObjectCountL: totalCount: %d", - totalCount ); - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return totalCount; - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::SharingProgress -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContentSharingAo::SharingProgress( - TUpnpMediaType& aContainerType ) const - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - aContainerType = iContainerType; - __LOG1("CUpnpContentSharingAo::SharingProgress: iObjectIdx: %d", - iSharingProgress ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return iSharingProgress; - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::GetContainerIndexL -// Returns IntValue for aObject -// -------------------------------------------------------------------------- -// -TInt CUpnpContentSharingAo::GetContainerIndexL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - TInt ind( KErrNone ); - if ( iShareAllSelection == EShareAll ) - { - if( iContainerIds->MdcaCount() ) - { - ind = iContainerIdx; - } - else - { - ind = KErrNotFound; - } - } - else if ( iContainerIdx >= iCurrentSelections.Count() || - ( iCurrentSelections[ iContainerIdx ]- KUiSelectionOffset - >= iContainerIds->MdcaCount() )) - { - ind = KErrNotFound; - } - else - { - if ( iShareAllSelection == EShareMany ) - { - ind = iCurrentSelections[ iContainerIdx ] - - KUiSelectionOffset; - - } - else - { - User::Leave( KErrArgument ); - } - } - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return ind; // correct index or KErrNotFound - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::SelfComplete -// Complete own request -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::SelfComplete( const TInt aError ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( iStopRequested ) - { - iSharingState = ENotActive; - } - SetActive(); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, aError ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::AppendImageFilesToListL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::AppendImageFilesToListL() - { - // Obtain list of image files from CLF - const MCLFItemListModel* list(NULL); - list = &iMetadataUtility->ImageFiles(); - if ( !list ) - { - User::Leave( KErrArgument ); - } - - // check if the iImageIndex is still less than the number of images - // -> there are still images to be shared - TInt imageCount = list->ItemCount(); - if ( !imageCount ) - { - iAllImagesShared = ETrue; - return; - } - - if ( iImageIndex < imageCount ) - { - - // Prepare storage for filenames - // Loop until all images are processed or until we have - // KContentDirCommitAmount files in the list of objects to be shared. - while ( !iAllImagesShared && - iItemList->ObjectCount() <= KContentDirCommitAmount ) - { - // Create an item with parent id of Images&Videos container. - HBufC8* id = UPnPCommonUtils::IntToDesC8LC( - iContainerId ); - TRAPD( imgErr, iTmpItem = iMetadataUtility->CreateItemL( - list->Item( iImageIndex ), - *id ) ); - - if ( !imgErr && iTmpItem ) - { - TPtrC fullFileName; - list->Item( iImageIndex ).GetField( - ECLFFieldIdFileNameAndPath, - fullFileName ); - - if ( !imgErr && iTmpItem ) - { - // Update item's metadata and append it to iItemList. - iMetadataUtility->UpdateMetadataL( - EPhotoFile, - iTmpItem, - fullFileName ); - iTmpItem->SetObjectClassL( KImageItemObjectClass ); - iItemList->AppendObjectL( *iTmpItem ); - iFileNameArr->AppendL( fullFileName ); - } - else - { - delete iTmpItem; - } - } - else - { - } - - // set iTmpItem to NULL - iTmpItem = NULL; - - // clean up - CleanupStack::PopAndDestroy(); // IntToDesC8LC - - // increment counter to process next image. - iImageIndex++; - - if ( iImageIndex >= imageCount ) - { - iAllImagesShared = ETrue; - } - } - - } - // update iObjectIdx to keep the progressbar ok. - iObjectIdx = iImageIndex; - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::AppendVideoFilesToListL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::AppendVideoFilesToListL() - { - // Obtain list of video files from CLF - const MCLFItemListModel* list(NULL); - list = &iMetadataUtility->VideoFiles(); - if ( !list ) - { - User::Leave( KErrArgument ); - } - - // Obtain the number of video file items in the list. - TInt videoCount( list->ItemCount() ); - if ( !videoCount ) - { - iAllVideosShared = ETrue; - return; - } - - // Check that there are still videos to be shared. - if ( iVideoIndex < videoCount ) - { - - if ( !iFileNameArr ) - { - iFileNameArr = new (ELeave) - CDesCArrayFlat( 4 ); - } - // Loop until all videos are processed or until we have - // KContentDirCommitAmount files in the list of objects to be shared. - while ( !iAllVideosShared && - iItemList->ObjectCount() <= KContentDirCommitAmount ) - { - // Create an item with parent id of Images&Videos container. - HBufC8* id = UPnPCommonUtils::IntToDesC8LC( - iContainerId ); - TRAPD( vidErr, iTmpItem = iMetadataUtility->CreateItemL( - list->Item( iVideoIndex ), - *id ) ); - - if ( !vidErr && iTmpItem ) - { - TPtrC fullFileName; - list->Item( iVideoIndex ).GetField( - ECLFFieldIdFileNameAndPath, - fullFileName ); - - - if ( !vidErr && iTmpItem ) - { - // Update item's metadata and append it to iItemList. - iMetadataUtility->UpdateMetadataL( - EVideoFile, - iTmpItem, - fullFileName ); - iTmpItem->SetObjectClassL( KVideoItemObjectClass ); - iItemList->AppendObjectL( *iTmpItem ); - iFileNameArr->AppendL( fullFileName ); - } - else - { - delete iTmpItem; - iTmpItem = NULL; - } - } - else - { - } - - // set iTmpItem to NULL - iTmpItem = NULL; - - // clean up - CleanupStack::PopAndDestroy(); // IntToDesC8LC - - // increment counter to process next video. - iVideoIndex++; - - if ( iVideoIndex >= videoCount ) - { - // all videos are processed. - // Set iAllVideosShared -> ETrue to end the while loop. - iAllVideosShared = ETrue; - } - } - } - - // update iObjectIdx to keep the progressbar ok. - // Remember to add iImageIndex here! - iObjectIdx = iImageIndex + iVideoIndex; - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::RequestStop -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpContentSharingAo::RequestStop( - MUpnpSharingCallback::TSharingStopType aStopType ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iStopRequested = aStopType; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpContentSharingAo::GetPlaylistNameByIdL -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TInt CUpnpContentSharingAo::GetContainerNameByIdL( const TDesC& aId, - TDes8& aPlaylistName, - const TInt aContainerType ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - TInt err( KErrNone ); - CDesCArray* newIds = new ( ELeave )CDesCArrayFlat( 4 ); - CleanupStack::PushL(newIds); - CDesCArray* newNames = new ( ELeave )CDesCArrayFlat( 4 ); - CleanupStack::PushL(newNames); - - if( aContainerType == EImageAndVideo ) - { - if ( !iCollections ) - { - iCollections = CUPnPAlbumServices::NewL(); - } - iCollections->ListAlbumsL( *newIds, *newNames ); - delete iCollections; - iCollections = NULL; - } - else if ( aContainerType == EPlaylist ) - { - if ( !iPlaylists ) - { - iPlaylists = CUPnPPlaylistServices::NewL(); - } - iPlaylists->ListPlaylistsL( *newIds, *newNames ); - delete iPlaylists; - iPlaylists = NULL; - } - - if ( !newIds->MdcaCount() ) - { - err = KErrGeneral; - } - else - { - for ( TInt i(0); iMdcaCount();i++ ) - { - if ( aId.Compare( newIds->MdcaPoint( i ) ) == 0 ) - { - HBufC8* name8 = - UpnpString::FromUnicodeL( newNames->MdcaPoint( i ) ); - CleanupStack::PushL( name8 ); - TPtr8 name8tmp = name8->Des(); - aPlaylistName = name8tmp; - CleanupStack::PopAndDestroy( name8 ); - } - } - } - CleanupStack::PopAndDestroy( newNames ); - CleanupStack::PopAndDestroy( newIds ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return err; - } - -void CUpnpContentSharingAo::DeleteListUpnpObject() - { - if ( iItemList ) - { - TInt count = iItemList->ObjectCount(); - for ( TInt i = count - 1; i >= 0; --i ) - { - CUpnpItem* tmpItem = static_cast( - iItemList->operator[]( i )); - TPtrC8 id( tmpItem->Id() ); - iItemList->RemoveAndDestroy( id ); - } - delete iItemList; - iItemList = NULL; - } - } -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/src/upnpcustomgrouper.cpp --- a/upnpsharing/upnpcontentserver/src/upnpcustomgrouper.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CUPnPCustomGrouper class implementation -* -*/ - - - - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include "upnpcustomgrouper.h" - -// ============================ MEMBER FUNCTIONS ============================= - -// -------------------------------------------------------------------------- -// CUpnpCustomGrouper::CUpnpCustomGrouper -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpCustomGrouper::CUpnpCustomGrouper( - const TCLFExtendedFieldId aGroupingCriteria ) - : iGroupingCriteria( aGroupingCriteria ) - { - } - -// -------------------------------------------------------------------------- -// CUpnpCustomGrouper::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// -CUpnpCustomGrouper* CUpnpCustomGrouper::NewL( - TCLFExtendedFieldId aGroupingCriteria ) - { - CUpnpCustomGrouper* self = - new (ELeave) CUpnpCustomGrouper( aGroupingCriteria ); - return self; - } - -// Destructor -CUpnpCustomGrouper::~CUpnpCustomGrouper() - { - iModItems.ResetAndDestroy(); - } - -// -------------------------------------------------------------------------- -// CUpnpCustomGrouper::GroupItemsL -// Method for grouping Content Listing Framework items. -// -------------------------------------------------------------------------- -// -void CUpnpCustomGrouper::GroupItemsL(const TArray& aSourceList, - RPointerArray& aGroupedList) - { - // Delete old modifiable items (groups) is any - iModItems.ResetAndDestroy(); - - // Process all items of the source list - TInt count( aSourceList.Count() ); - for( TInt i = 0; i < count; i++ ) - { - // Get value of the field in iGroupingCriteria. - // For example, if iFilterCriteria contains ECLFFieldIdArtist, - // name of the artist is stored to fieldValue variable. - TPtrC fieldValue; - MCLFItem* currentItem = aSourceList[i]; - TInt error( currentItem->GetField( - iGroupingCriteria, fieldValue ) ); - - if( error == KErrNone ) - { - // Check if the group is already added to the list - if( !GroupAlreadyExists( fieldValue ) ) - { - // Create a new modifiable item and add a field - // name and value of the field. - // For example, if grouping criteria is ECLFFieldIdArtist, - // the field is added to the item with name of the artist. - MCLFModifiableItem* modItem = - ContentListingFactory::NewModifiableItemLC(); - modItem->AddFieldL( iGroupingCriteria, fieldValue ); - - // Add the item to the iModItems array to keep track, - // which groups are already in the list (for example, which - // groups are already in the list). The iModItems array - // also deletes these items, when they are no longer needed. - iModItems.AppendL( modItem ); // ownership transferred - - CleanupStack::Pop(); // modItem - - // Add the item to the model - aGroupedList.AppendL( modItem ); - } - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpCustomGrouper::GroupAlreadyExists -// Checks if group has been added to the model already. -// -------------------------------------------------------------------------- -// -TBool CUpnpCustomGrouper::GroupAlreadyExists( const TDesC& aGroupName ) - { - TBool status = EFalse; - TInt count( iModItems.Count() ); - for( TInt i = 0; i < count; i++ ) - { - // Get value of the field in iGroupingCriteria. - // For example, if iGroupingCriteria contains ECLFFieldIdArtist, - // name of the artist is stored to fieldValue variable. - TPtrC fieldValue; - MCLFItem* currentItem = iModItems[i]; - TInt error( currentItem->GetField( - iGroupingCriteria, fieldValue ) ); - - if( error == KErrNone ) - { - if( fieldValue == aGroupName ) - { - // Group is in the list - status = ETrue; - } - } - } - - // Group is not in the list - return status; - } - - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/src/upnppostfilter.cpp --- a/upnpsharing/upnpcontentserver/src/upnppostfilter.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CUPnPPostFilter class implementation -* -*/ - - - - - - - -// INCLUDE FILES -#include -#include -#include -#include - -#include "upnppostfilter.h" -#include "upnpcontentserverdefs.h" - -_LIT( KComponentLogfile, "contentserver.txt"); -#include "upnplog.h" - -// ============================ MEMBER FUNCTIONS ============================= - -// -------------------------------------------------------------------------- -// CUpnpPostFilter::CUpnpPostFilter -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// - -CUpnpPostFilter::CUpnpPostFilter( - const TCLFExtendedFieldId aFilterCriteria, - TBool aRemoveDuplicates ) - : iFilterCriteria( aFilterCriteria ), - iRemoveDuplicates( aRemoveDuplicates ) - { - } - -// -------------------------------------------------------------------------- -// CCEPostFilter::ConstructL -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CUpnpPostFilter::ConstructL( const TDesC& aFilterParameter ) - { - iFilterParameter = aFilterParameter.AllocL(); - } - -// -------------------------------------------------------------------------- -// CCEPostFilter::NewL -// Two-phased constructor. -// -------------------------------------------------------------------------- -// - -CUpnpPostFilter* CUpnpPostFilter::NewL( - const TCLFExtendedFieldId aFilterCriteria, - const TDesC& aFilterParameter, - TBool aRemoveDuplicates ) - { - CUpnpPostFilter* self = - CUpnpPostFilter::NewLC( aFilterCriteria, aFilterParameter, - aRemoveDuplicates ); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CUpnpPostFilter::NewLC -// Two-phased constructor, pointer is left to the CleanupStack. -// -------------------------------------------------------------------------- -// -CUpnpPostFilter* CUpnpPostFilter::NewLC( - const TCLFExtendedFieldId aFilterCriteria, - const TDesC& aFilterParameter, - TBool aRemoveDuplicates ) - { - CUpnpPostFilter* self = new (ELeave) CUpnpPostFilter( - aFilterCriteria, aRemoveDuplicates ); - CleanupStack::PushL( self ); - self->ConstructL( aFilterParameter ); - return self; - } - -// Destructor -CUpnpPostFilter::~CUpnpPostFilter() - { - delete iFilterParameter; - } - -// -------------------------------------------------------------------------- -// CCEPostFilter::FilterItemsL -// Method for filtering the source list. -// -------------------------------------------------------------------------- -// -void CUpnpPostFilter::FilterItemsL( const TArray& aItemList, - RPointerArray& aFilteredItemList ) - { - // Process all items in the item list - TInt count( aItemList.Count() ); - for( TInt i = 0; i < count; i++ ) - { - // Get value of the field defined in iFilterCriteria. - // For example, if iFilterCriteria contains ECLFFieldIdAlbum, - // name of the album is stored to fieldValue variable. - TPtrC fieldValue; - MCLFItem* currentItem = aItemList[i]; - TInt error( currentItem->GetField( - iFilterCriteria, fieldValue ) ); - - // Add the music file to the filtered list, - // if value of of the field is same as iFilterParameter. - // For example, if it is from the desired album. - if( error == KErrNone ) - { - TBool add( EFalse ); - if ( iRemoveDuplicates ) - { - if ( !IsAdded( aFilteredItemList, fieldValue ) ) - { - add = ETrue; - } - } - else - { - if( fieldValue == iFilterParameter->Des() ) - { - add = ETrue; - } - } - if( add ) - { - aFilteredItemList.AppendL( currentItem ); - } - } - } - } - -// -------------------------------------------------------------------------- -// CUpnpPostFilter::IsAdded -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -TBool CUpnpPostFilter::IsAdded( RPointerArray& aFilteredItemList, - TPtrC& aFieldValue ) - { - TBool isAdded( EFalse ); - for( TInt i(0); iGetField( - iFilterCriteria, fieldValue ) ); - - if( error == KErrNone ) - { - if ( fieldValue == aFieldValue ) - { - isAdded = ETrue; - __LOG("found duplicate"); - } - } - } - return isAdded; - } - -// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpcontentserver/src/upnpunsharerao.cpp --- a/upnpsharing/upnpcontentserver/src/upnpunsharerao.cpp Mon Nov 01 13:44:24 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,669 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: CUpnpUnsharerAo class implementation - * -*/ - - - - - - - -// INCLUDE FILES -#include "upnpdlnaprofiler.h" -#include "upnpcdsreselementutility.h" -#include "upnpcommonutils.h" -#include - -#include "upnpunsharerao.h" - -_LIT( KComponentLogfile, "contentserver.txt"); -#include "upnplog.h" - -// CONSTANTS -const TInt KDefaultBrowseReqCount( 20 ); -const TInt KDefaultBrowseStartingInd( 0 ); - -using namespace UpnpContentServer; - -// ============================ MEMBER FUNCTIONS ============================ - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::CUpnpUnsharerAo -// C++ default constructor can NOT contain any code, that -// might leave. -// -------------------------------------------------------------------------- -// -CUpnpUnsharerAo::CUpnpUnsharerAo( MUpnpSharingCallback* aCallback, - TInt aPriority ) - : CActive( aPriority ), - iCallback( aCallback ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iTotalItems = KErrNotFound; - iAllTotalItems = 0; - CActiveScheduler::Add( this ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::~CUpnpUnsharerAo() -// C++ destructor. -// -------------------------------------------------------------------------- -// -CUpnpUnsharerAo::~CUpnpUnsharerAo() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - delete iFileSharing; - iFileSharing = NULL; - iMediaServer.Close(); - - if ( IsActive() ) - { - __LOG1("IsActive: true iCurrentOperation: %d", iCurrentOperation ); - iCurrentOperation = ENotActive; - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - } - - Cancel(); - - Cleanup(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::RunL -// Called when asyncronous request is ready -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::RunL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( iStatus.Int() == KErrCorrupt || - iStatus.Int() == KErrNoMemory || - iStatus.Int() == KErrDiskFull ) - { - iCurrentOperation = ENotActive; - } - - if ( iStopRequested == MUpnpSharingCallback::ESharingPause ) - { - delete iFileSharing; - iFileSharing = NULL; - iFileSharing = CUpnpFileSharing::NewL(); - iStopRequested = MUpnpSharingCallback::ESharingNoStop; - } - - switch ( iCurrentOperation ) - { - case EInitialize : - { - TInt err( InitializeL( iUpContainer ) ); - if ( !err ) - { - QueryContainersFromMediaServerL( iUpContainer ); - } - else - { - iCurrentOperation = ENotActive; - SelfComplete( KErrNone ); - } - } - break; - case EQueryContainersFromMediaServer : - { - QueryContainersFromMediaServerL( iCurrentContainerId ); - } - break; - case EQueryContainersFromMediaServerResult : - { - QueryContainersFromMediaServerResultL(); - } - break; - case EQueryItemsFromMediaServer : - { - QueryContainerItemsL( iCurrentContainerId ); - } - break; - case EUnshareItemList: - { - UnshareItemListL(); - } - break; - case EQueryItemsFromMediaServerResult : - { - QueryContainerItemsResultL(); - } - break; - case EUnshareContainer : - { - UnshareContainerL(); - } - break; - case EUnshareContainerResult : - { - UnshareContainerResultL(); - } - break; - case ENotActive : - { - Cleanup(); - if ( iCallback ) - { - iCallback->CompleteSharingOperationL( iStatus.Int(), 0 ); - } - } - break; - default : - break; - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::DoCancel -// Cancels active object -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::DoCancel() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - // NOTE: The cancelling of mediaserver request must be made in destructor - // because there is no cancel in CUpnpFileSharing - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::RunError -// Handle leaves -// -------------------------------------------------------------------------- -// -TInt CUpnpUnsharerAo::RunError( TInt aError ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - TInt ret( KErrNone ); - if ( aError == KErrNoMemory || - aError == KErrDiskFull || - aError == KErrCorrupt ) - { - iCurrentOperation = ENotActive; - SelfComplete( aError ); - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return ret; - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::QueryContainersFromMediaServerL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::QueryContainersFromMediaServerL( TInt aId ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC(); - browseCriteria->SetStartingIndex( iContainerBrowsePosition ); - - if ( iContainerList ) - { - delete iContainerList; - iContainerList = NULL; - } - iContainerList = CUpnpContainerList::NewL(); - - // Get shared containers to iContainerList - iFileSharing->GetSharedContainerListL( aId, - *browseCriteria, - *iContainerList, - iTotalContainers, - iStatus ); - iCurrentOperation = EQueryContainersFromMediaServerResult; - CleanupStack::PopAndDestroy( browseCriteria ); - SetActive(); - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::QueryContainersFromMediaServerResultL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::QueryContainersFromMediaServerResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - CUpnpContainer* nextContainer( NULL ); - TInt containerCount( iContainerList->ObjectCount() ); - if ( containerCount ) - { - // there are subcontainers -> store them and query if they - // have subcontainers - iContainerLists.AppendL( iContainerList ); //Transfer ownership - // check if we neet to get containers in segments - - if ( iContainerBrowsePosition + containerCount - >= iTotalContainers ) - { - // all segments queried - // next container under processing is always last in the list - nextContainer = - static_cast< CUpnpContainer* >( - iContainerList->operator[]( - containerCount - 1 ) ); - iCurrentContainerId = UPnPCommonUtils::DesC8ToInt( - nextContainer->Id()); - iContainerList = NULL; - iContainerBrowsePosition = 0; - } - else - { - __LOG("CUpnpUnsharerAo: retrieving next segment"); - // set the starting position for retrieving next segment - iContainerBrowsePosition += KDefaultBrowseReqCount; - iContainerList = NULL; - } - - iCurrentOperation = EQueryContainersFromMediaServer; - } - else - { - // no subcontainers -> query the items - if ( iContainerLists.Count() ) - { - CUpnpContainerList* contList = - iContainerLists[ iContainerLists.Count()-1 ]; - nextContainer = - static_cast< CUpnpContainer* >( - contList->operator[]( - contList->ObjectCount() - 1 ) ); - iCurrentContainerId = UPnPCommonUtils::DesC8ToInt( - nextContainer->Id() ); - // there should be at least the initial container - iCurrentOperation = EQueryItemsFromMediaServer; - - delete iContainerList; - iContainerList = NULL; - - iCurrentOperation = EQueryItemsFromMediaServer; - - } - else - { - // error: no initial container - iCurrentOperation = ENotActive; - - } - } - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::QueryContainerItemsL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::QueryContainerItemsL( TInt aId ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - delete iItemList; - iItemList = NULL; - iItemList = CUpnpItemList::NewL(); - if ( !iFileSharing ) - { - User::Leave( KErrGeneral ); - } - CUpnpBrowseCriteria* browseCriteria = CreateBrowseCriteriaLC(); - if ( iTotalItems == KErrNotFound ) - { - iFileSharing->GetSharedItemListL ( - aId, *browseCriteria, - *iItemList, iTotalItems, iStatus ); - - if ( iTotalItems > 0 ) - { - iAllTotalItems += iTotalItems; - } - } - else - { - TInt tmp( 0 ); - iFileSharing->GetSharedItemListL ( - aId, *browseCriteria, - *iItemList, tmp, iStatus ); - - if ( tmp > 0 ) - { - iAllTotalItems += tmp; - } - } - iCurrentOperation = EQueryItemsFromMediaServerResult; - CleanupStack::PopAndDestroy( browseCriteria ); - SetActive(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::QueryContainerItemsResultL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::QueryContainerItemsResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - if ( !iItemList ) - { - User::Leave( KErrGeneral ); - } - TInt objCount( iItemList->ObjectCount() ); - if ( objCount && ( iExecStatus < iTotalItems ) ) - { - // unshare the items in parts - iCurrentOperation = EUnshareItemList; - - } - else - { - // the container iCurrentContainerId is empty -> unshare it unless it - // is the container received at the start - - if ( iContainerLists.Count() > 1 ) - { - iCurrentOperation = EUnshareContainer; - } - else - { - // all done - iCurrentOperation = ENotActive; - } - } - - if ( iExecStatus > 0 ) - { - iCallback->SetProgressL( iExecStatus ); - } - - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::UnshareItemListL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::UnshareItemListL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - iExecStatus += iItemList->ObjectCount(); - iFileSharing->UnshareItemListL( *iItemList, iUnsharePosition, iStatus ); - - delete iItemList; - iItemList = NULL; - iCurrentOperation = EQueryItemsFromMediaServer; - SetActive(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::UnshareContainerL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::UnshareContainerL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iFileSharing->UnshareContainerL( iCurrentContainerId, iStatus ); - iCurrentOperation = EUnshareContainerResult; - iExecStatus = 0; - iTotalItems = KErrNotFound; - SetActive(); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::UnshareContainerResultL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::UnshareContainerResultL() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - if ( iContainerLists.Count() ) - { - // one container is now fully handled -> remove from list of - // containers - CUpnpContainerList* contList = - iContainerLists[ iContainerLists.Count()-1 ]; - // note: iCurrentContainerId is always last in the list - contList->RemoveAndDestroy( *UPnPCommonUtils::IntToDesC8LC( - iCurrentContainerId ) ); - CleanupStack::PopAndDestroy(); // UPnPCommonUtils::IntToDesC8LC - if ( contList->ObjectCount() ) - { - // get the next container ( last of the list ) to process - TInt nextPos = contList->ObjectCount() - 1; - CUpnpContainer* nextContainer = static_cast< CUpnpContainer* >( - contList->operator[]( nextPos )); - iCurrentContainerId = UPnPCommonUtils::DesC8ToInt( - nextContainer->Id()); - // Restart cycle: query if it has subcontainers - iCurrentOperation = EQueryContainersFromMediaServer; - - } - else - { - // one directory hierarchy is empty - CUpnpContainerList* removeList = iContainerLists[ - iContainerLists.Count()-1 ]; - iContainerLists.Remove( iContainerLists.Count()-1 ); - delete removeList; - if ( iContainerLists.Count() ) - { - // go back in containerlists - contList = - iContainerLists[ iContainerLists.Count()-1 ]; - TInt backPos( contList->ObjectCount() - 1 ); - CUpnpContainer* nextContainer = - static_cast< CUpnpContainer* >( - contList->operator[]( backPos )); - iCurrentContainerId = UPnPCommonUtils::DesC8ToInt( - nextContainer->Id() ); - // Restart cycle: query if it has items - // no need to query containers - iCurrentOperation = EQueryItemsFromMediaServer; - - } - else - { - // all done - iCurrentOperation = ENotActive; - } - } - } - else - { - // all done - iCurrentOperation = ENotActive; - } - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::EmptyContainer -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -TInt CUpnpUnsharerAo::EmptyContainer( TInt& aContainerId ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - - TInt err( KErrNotFound ); - - iUpContainer = aContainerId; - iCurrentContainerId = aContainerId; - iCurrentOperation = EInitialize; - SelfComplete( KErrNone ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return err; - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::RequestStop -// ( other items are commented in header ) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::RequestStop( - MUpnpSharingCallback::TSharingStopType aStopType ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iStopRequested = aStopType; - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::InitializeL -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -TInt CUpnpUnsharerAo::InitializeL( TInt& aContainerId ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - // First initialize resources - iFileSharing = CUpnpFileSharing::NewL(); - TInt error( iMediaServer.Connect() ); - if ( !error ) - { - // start offline if not started - TInt status( RUpnpMediaServerClient::EStopped ); - iMediaServer.Status( status ); - if ( status == RUpnpMediaServerClient::EStopped ) - { - error = iMediaServer.StartOffline(); - } - if ( !error ) - { - CUpnpContainerList* beginList = CUpnpContainerList::NewLC(); - CUpnpContainer* beginContainer = CUpnpContainer::NewL(); - CleanupStack::PushL( beginContainer ); - beginContainer->SetIdL( - *UPnPCommonUtils::IntToDesC8LC( aContainerId ) ); - CleanupStack::PopAndDestroy(); // IntToDesC8LC - beginList->AppendObjectL( *beginContainer ); //Transfer ownership - CleanupStack::Pop( beginContainer ); - iContainerLists.AppendL( beginList ); //Transfer ownership - CleanupStack::Pop( beginList ); - } - } - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return error; - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::CreateBrowseCriteriaLC -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -CUpnpBrowseCriteria* CUpnpUnsharerAo::CreateBrowseCriteriaLC() const - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - CUpnpBrowseCriteria* browseCriteria = CUpnpBrowseCriteria::NewLC(); - browseCriteria->SetRequestedCount( KDefaultBrowseReqCount ); - browseCriteria->SetStartingIndex( KDefaultBrowseStartingInd ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - return browseCriteria; - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::SelfComplete -// Complete own request -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::SelfComplete( TInt aError ) - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - SetActive(); - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, aError ); - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::Cleanup -// (other items are commented in header) -// -------------------------------------------------------------------------- -// -void CUpnpUnsharerAo::Cleanup() - { - __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ ); - iExecStatus = 0; - iTotalItems = KErrNotFound; - iTotalContainers = KErrNotFound; - iContainerBrowsePosition = 0; - - iCurrentContainerId = KErrNotFound; - iUpContainer = KErrNotFound; - iStopRequested = MUpnpSharingCallback::ESharingNoStop; - - delete iItemList; - iItemList = NULL; - delete iContainerList; - iContainerList = NULL; - - iContainerLists.ResetAndDestroy(); - - iCurrentOperation = ENotActive; - - __LOG8_1( "%s end.", __PRETTY_FUNCTION__ ); - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::UnSharingProgress -// (the usage in header) -// -------------------------------------------------------------------------- -// -TInt CUpnpUnsharerAo::UnSharingProgress( ) - { - TInt progress( 0 ); - if ( iExecStatus >= 0 ) - { - progress = iExecStatus; - } - return progress; - } - -// -------------------------------------------------------------------------- -// CUpnpUnsharerAo::TotalItemsForUnShare -// (the usage in header) -// -------------------------------------------------------------------------- -// -TInt CUpnpUnsharerAo::TotalItemsForUnShare( ) - { - TInt items( 0 ); - if ( iTotalItems >= 0 ) - { - items = iTotalItems; - } - return items; - } - -// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/bwins/upnpgstwrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/bwins/upnpgstwrapperu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,32 @@ +EXPORTS + ??1CUpnpGstWrapper@@EAE@XZ @ 1 NONAME ; CUpnpGstWrapper::~CUpnpGstWrapper(void) + ??1CUpnpRendererCfg@@UAE@XZ @ 2 NONAME ; CUpnpRendererCfg::~CUpnpRendererCfg(void) + ??1CUpnpRendererCfgParser@@UAE@XZ @ 3 NONAME ; CUpnpRendererCfgParser::~CUpnpRendererCfgParser(void) + ?AudioInfo@CUpnpGstWrapper@@QAEABVTDesC16@@XZ @ 4 NONAME ; class TDesC16 const & CUpnpGstWrapper::AudioInfo(void) + ?Close@CUpnpGstWrapper@@QAEXXZ @ 5 NONAME ; void CUpnpGstWrapper::Close(void) + ?Duration@CUpnpGstWrapper@@QAE_JXZ @ 6 NONAME ; long long CUpnpGstWrapper::Duration(void) + ?ErrorMsg@CUpnpGstWrapper@@QAEABVTDesC16@@XZ @ 7 NONAME ; class TDesC16 const & CUpnpGstWrapper::ErrorMsg(void) + ?FeatureListL@CUpnpGstWrapper@@QAEPAVCDesC16Array@@XZ @ 8 NONAME ; class CDesC16Array * CUpnpGstWrapper::FeatureListL(void) + ?GetInstanceL@CUpnpGstWrapper@@SAPAV1@XZ @ 9 NONAME ; class CUpnpGstWrapper * CUpnpGstWrapper::GetInstanceL(void) + ?InitAppsinkL@CUpnpGstWrapper@@QAEXXZ @ 10 NONAME ; void CUpnpGstWrapper::InitAppsinkL(void) + ?NewL@CUpnpRendererCfg@@SAPAV1@ABVTDesC16@@ABVTDesC8@@1@Z @ 11 NONAME ; class CUpnpRendererCfg * CUpnpRendererCfg::NewL(class TDesC16 const &, class TDesC8 const &, class TDesC8 const &) + ?NewL@CUpnpRendererCfgParser@@SAPAV1@XZ @ 12 NONAME ; class CUpnpRendererCfgParser * CUpnpRendererCfgParser::NewL(void) + ?NewLC@CUpnpRendererCfg@@SAPAV1@ABVTDesC16@@ABVTDesC8@@1@Z @ 13 NONAME ; class CUpnpRendererCfg * CUpnpRendererCfg::NewLC(class TDesC16 const &, class TDesC8 const &, class TDesC8 const &) + ?NewLC@CUpnpRendererCfgParser@@SAPAV1@XZ @ 14 NONAME ; class CUpnpRendererCfgParser * CUpnpRendererCfgParser::NewLC(void) + ?ParseRendererCfgL@CUpnpRendererCfgParser@@QAEXAAVCUpnpRendererCfg@@@Z @ 15 NONAME ; void CUpnpRendererCfgParser::ParseRendererCfgL(class CUpnpRendererCfg &) + ?Pipeline@CUpnpRendererCfg@@QBEABVTDesC8@@XZ @ 16 NONAME ; class TDesC8 const & CUpnpRendererCfg::Pipeline(void) const + ?PipelinePtr@CUpnpGstWrapper@@QAEPAXXZ @ 17 NONAME ; void * CUpnpGstWrapper::PipelinePtr(void) + ?Position@CUpnpGstWrapper@@QAE_JXZ @ 18 NONAME ; long long CUpnpGstWrapper::Position(void) + ?ProtocolInfo@CUpnpRendererCfg@@QBEABVTDesC8@@XZ @ 19 NONAME ; class TDesC8 const & CUpnpRendererCfg::ProtocolInfo(void) const + ?PullBufferL@CUpnpGstWrapper@@QAEHAAVTPtr8@@HPAVRBuf8@@@Z @ 20 NONAME ; int CUpnpGstWrapper::PullBufferL(class TPtr8 &, int, class RBuf8 *) + ?RemoveObserver@CUpnpGstWrapper@@QAEXAAVMUpnpGstWrapperObserver@@@Z @ 21 NONAME ; void CUpnpGstWrapper::RemoveObserver(class MUpnpGstWrapperObserver &) + ?SetObserverL@CUpnpGstWrapper@@QAEXAAVMUpnpGstWrapperObserver@@@Z @ 22 NONAME ; void CUpnpGstWrapper::SetObserverL(class MUpnpGstWrapperObserver &) + ?SetPipelineL@CUpnpGstWrapper@@QAEXABVTDesC8@@@Z @ 23 NONAME ; void CUpnpGstWrapper::SetPipelineL(class TDesC8 const &) + ?SetTranscodedFileSize@CUpnpGstWrapper@@QAEXH@Z @ 24 NONAME ; void CUpnpGstWrapper::SetTranscodedFileSize(int) + ?SizeMultiplier@CUpnpRendererCfg@@QBENXZ @ 25 NONAME ; double CUpnpRendererCfg::SizeMultiplier(void) const + ?StartL@CUpnpGstWrapper@@QAEXXZ @ 26 NONAME ; void CUpnpGstWrapper::StartL(void) + ?Stop@CUpnpGstWrapper@@QAEXXZ @ 27 NONAME ; void CUpnpGstWrapper::Stop(void) + ?TranscodedBytes@CUpnpGstWrapper@@QAEHXZ @ 28 NONAME ; int CUpnpGstWrapper::TranscodedBytes(void) + ?TranscodedFileSize@CUpnpGstWrapper@@QAEHXZ @ 29 NONAME ; int CUpnpGstWrapper::TranscodedFileSize(void) + ?VideoInfo@CUpnpGstWrapper@@QAEABVTDesC16@@XZ @ 30 NONAME ; class TDesC16 const & CUpnpGstWrapper::VideoInfo(void) + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/data/UpnpCfgs.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/data/UpnpCfgs.xml Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,11 @@ + + + + + + mpegtsmux output-buf-size=0x19000 name=mux ! appsink max-buffers=50 name=sinkbuffer filesrc location=%S ! qtdemux name=demux ! queue max-size-bytes=0xAAAA ! mux. demux. ! queue max-size-bytes=0xAAAA ! mux. + http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_TS_SD_EU_ISO;DLNA.ORG_FLAGS=8d700000000000000000000000000000 + 1.2 + + + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/eabi/upnpgstwrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/eabi/upnpgstwrapperu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,46 @@ +EXPORTS + _ZN15CUpnpGstWrapper11PipelinePtrEv @ 1 NONAME + _ZN15CUpnpGstWrapper11PullBufferLER5TPtr8iP5RBuf8 @ 2 NONAME + _ZN15CUpnpGstWrapper12FeatureListLEv @ 3 NONAME + _ZN15CUpnpGstWrapper12GetInstanceLEv @ 4 NONAME + _ZN15CUpnpGstWrapper12InitAppsinkLEv @ 5 NONAME + _ZN15CUpnpGstWrapper12SetObserverLER23MUpnpGstWrapperObserver @ 6 NONAME + _ZN15CUpnpGstWrapper12SetPipelineLERK6TDesC8 @ 7 NONAME + _ZN15CUpnpGstWrapper14RemoveObserverER23MUpnpGstWrapperObserver @ 8 NONAME + _ZN15CUpnpGstWrapper15TranscodedBytesEv @ 9 NONAME + _ZN15CUpnpGstWrapper18TranscodedFileSizeEv @ 10 NONAME + _ZN15CUpnpGstWrapper21SetTranscodedFileSizeEi @ 11 NONAME + _ZN15CUpnpGstWrapper4StopEv @ 12 NONAME + _ZN15CUpnpGstWrapper5CloseEv @ 13 NONAME + _ZN15CUpnpGstWrapper6StartLEv @ 14 NONAME + _ZN15CUpnpGstWrapper8DurationEv @ 15 NONAME + _ZN15CUpnpGstWrapper8ErrorMsgEv @ 16 NONAME + _ZN15CUpnpGstWrapper8PositionEv @ 17 NONAME + _ZN15CUpnpGstWrapper9AudioInfoEv @ 18 NONAME + _ZN15CUpnpGstWrapper9VideoInfoEv @ 19 NONAME + _ZN15CUpnpGstWrapperD0Ev @ 20 NONAME + _ZN15CUpnpGstWrapperD1Ev @ 21 NONAME + _ZN15CUpnpGstWrapperD2Ev @ 22 NONAME + _ZN16CUpnpRendererCfg4NewLERK7TDesC16RK6TDesC8S5_ @ 23 NONAME + _ZN16CUpnpRendererCfg5NewLCERK7TDesC16RK6TDesC8S5_ @ 24 NONAME + _ZN16CUpnpRendererCfgD0Ev @ 25 NONAME + _ZN16CUpnpRendererCfgD1Ev @ 26 NONAME + _ZN16CUpnpRendererCfgD2Ev @ 27 NONAME + _ZN22CUpnpRendererCfgParser17ParseRendererCfgLER16CUpnpRendererCfg @ 28 NONAME + _ZN22CUpnpRendererCfgParser4NewLEv @ 29 NONAME + _ZN22CUpnpRendererCfgParser5NewLCEv @ 30 NONAME + _ZN22CUpnpRendererCfgParserD0Ev @ 31 NONAME + _ZN22CUpnpRendererCfgParserD1Ev @ 32 NONAME + _ZN22CUpnpRendererCfgParserD2Ev @ 33 NONAME + _ZNK16CUpnpRendererCfg12ProtocolInfoEv @ 34 NONAME + _ZNK16CUpnpRendererCfg14SizeMultiplierEv @ 35 NONAME + _ZNK16CUpnpRendererCfg8PipelineEv @ 36 NONAME + _ZTI15CUpnpGstWrapper @ 37 NONAME ; ## + _ZTI16CUpnpRendererCfg @ 38 NONAME ; ## + _ZTI20CUpnpGstWrapperPimpl @ 39 NONAME ; ## + _ZTI22CUpnpRendererCfgParser @ 40 NONAME ; ## + _ZTV15CUpnpGstWrapper @ 41 NONAME ; ## + _ZTV16CUpnpRendererCfg @ 42 NONAME ; ## + _ZTV20CUpnpGstWrapperPimpl @ 43 NONAME ; ## + _ZTV22CUpnpRendererCfgParser @ 44 NONAME ; ## + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/group/bld.inf Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 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" +* 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 information file for upnpgstwrapper +* +*/ + +#include "../../../group/upnpplatformvar.hrh" + +PRJ_PLATFORMS + + +PRJ_EXPORTS +../inc/upnpgstwrapper.h |../../../inc/upnpgstwrapper.h +../inc/upnpgstwrapperobserver.h |../../../inc/upnpgstwrapperobserver.h +../inc/upnpgstwrapperconsts.h |../../../inc/upnpgstwrapperconsts.h +../inc/upnprenderercfg.h |../../../inc/upnprenderercfg.h +../inc/upnprenderercfgparser.h |../../../inc/upnprenderercfgparser.h +../data/UpnpCfgs.xml /epoc32/winscw/c/data/UpnpCfgs.xml + +PRJ_MMPFILES +#ifdef UPNP_USE_GSTREAMER +upnpgstwrapper.mmp +#endif + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/group/upnpgstwrapper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/group/upnpgstwrapper.mmp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 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" +* 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 specification file for upnpgstwrapper component +* +*/ + +// For compatibility with IAD branch +#include "../../../group/upnpplatformvar.hrh" +#include + +TARGET upnpgstwrapper.dll +TARGETTYPE dll +UID 0x1000008D 0x20009C9D + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +// SIS installation + IAD support +VERSION 10.1 +paged + +// User include paths, own headers +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// System include paths +OS_LAYER_LIBC_SYSTEMINCLUDE +OS_LAYER_GLIB_SYSTEMINCLUDE +MW_LAYER_SYSTEMINCLUDE + +/* + * temporary systeminclude, the real path will be used once gstream has done + * the export to the epoc32/include... + */ +SYSTEMINCLUDE /sf/mw/gstreamer/include/gstreamer + +// Source files +SOURCEPATH ../src +SOURCE upnpgstwrapper.cpp +SOURCE upnprenderercfgparser.cpp +SOURCE upnprenderercfg.cpp + +// Platform and UI libraries +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY xmlframework.lib +LIBRARY flogger.lib + +LIBRARY libgstreamer.lib +LIBRARY libglib.lib +LIBRARY libgobject.lib +LIBRARY libgstapp.lib + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/inc/upnpgstwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/inc/upnpgstwrapper.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,281 @@ +/* +* Copyright (c) 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" +* 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: UPnP GStreamer wrapper +* +*/ + +#ifndef C_UPNPGSTWRAPPER_H +#define C_UPNPGSTWRAPPER_H + +// INCLUDES +#include +#include +#include + +#include "upnpgstwrapperobserver.h" + +class CUpnpGstWrapperPimpl; + +class CUpnpGstWrapper : public CActive + { + +public: // construction / destruction + + + /** + * Get wrapper instance. + * Increased reference count by 1. + * + * @return none + */ + IMPORT_C static CUpnpGstWrapper* GetInstanceL(); + + /** + * Decreses reference count by 1. + * If reference count decreses to zero, singleton will be deleted. + * + * @return none + */ + IMPORT_C void Close(); + +private: // construction, private part + + /** + * Constructor + */ + CUpnpGstWrapper(); + + /** + * Destructor + */ + IMPORT_C virtual ~CUpnpGstWrapper(); + + /** + * 2nd phrase Constructor + */ + void ConstructL(); + +public: + + /** + * Set observer + * + * @param MUpnpGstWrapperObserver observer to be set + * @return none + */ + IMPORT_C void SetObserverL( MUpnpGstWrapperObserver& aObserver ); + + /** + * Remove observer + * + * @param MUpnpGstWrapperObserver observer to be removed + * @return none + */ + IMPORT_C void RemoveObserver( MUpnpGstWrapperObserver& aObserver ); + + /** + * Start a pipeline; e.g. transcoding. This is used when client knows + * exactly what the pipeline is and the elements inside + * + * @return none + */ + IMPORT_C void StartL(); + + /** + * Stop the pipeline; e.g. transcoding + * + * @param none + * @return none + */ + IMPORT_C void Stop(); + + /** + * Return the error description + * + * @param None + * @return A reference to the error description + */ + IMPORT_C const TDesC& ErrorMsg(); + + /** + * Return list of currently supported GStreamer features + * Note: Ownership of the array is passed to the caller + * + * @param None + * @return A pointer to descriptor array + */ + IMPORT_C CDesCArray* FeatureListL(); + + /** + * Return the video info descriptor + * + * E.g.: + * video/x-h264, width=(int)1280, height=(int)720, + * framerate=(fraction)30000/1, codec_data=(buffer)0164401fffe10010276400 + * 1fac2b402802dd80b4078913501000528ee025cb0 + * + * @param None + * @return A reference to video info descriptor + */ + IMPORT_C const TDesC& VideoInfo(); + + /** + * Return the audio info descriptor + * + * E.g.: + * audio/mpeg, rate=(int)48000, channels=(int)1, + * channel-positions=(GstAudioChannelPosition)< + * GST_AUDIO_CHANNEL_POSITION_FRONT_MONO >, mpegversion(int)4, + * codec_data=(buffer)1188 + * + * @param None + * @return A reference to audio info descriptor + */ + IMPORT_C const TDesC& AudioInfo(); + + /** + * Return (transoding) position in nanoseconds. + * + * @return Postion in nanoseconds; KErrNotFound if position not available + */ + IMPORT_C TInt64 Position(); + + /** + * Return (transoding) duration in nanoseconds. + * + * @return Duration in nanoseconds; KErrNotFound if duration not available + */ + IMPORT_C TInt64 Duration(); + + /** + * Return pointter to GStreamer pipeline. + * + * @return Pointer to GStreamer pipeline. + */ + IMPORT_C TAny* PipelinePtr(); + + /** + * Initialises gstreamer appsink element named sinkbuffer if there is + */ + IMPORT_C void InitAppsinkL(); + + /** + * pulls buffer from gstreamer appsink element + * + * @return boolean true if end of transcoding + */ + IMPORT_C TBool PullBufferL( TPtr8& aPointer,TInt aMaxBytesLength, RBuf8* aBuf=NULL ); + + /** + * returns count of bytes transcoded so far + */ + IMPORT_C TInt TranscodedBytes(); + + /** + * Setter + */ + IMPORT_C void SetTranscodedFileSize( TInt aSize ); + + /** + * getter + */ + IMPORT_C TInt TranscodedFileSize(); + + /** + * sets pipline has to be set before calling start() + * + * @param aPipeline + */ + IMPORT_C void SetPipelineL( const TDesC8& aPipeline ); + + +private: + + /** + * Set error message + * + * @param TDesC& a reference to error message descriptor + * @return none + */ + void SetErrorMsgL( const TDesC& aErrorMsg ); + + /** + * Set error message + * + * @param TDesC& a reference to error message descriptor + * @return none + */ + void SetErrorMsg( HBufC* const aErrorMsg ); + + /** + * Convert char array to symbian descriptor + * + * @param char* the reference of input string + * @return HBufC* the pointer to the output + */ + HBufC* ConvertCharToDescL( const char* aString ); + + /** + * Convert symbian description to char array + * + * @param TDesC8& the reference of input string + * @return char* the pointer to the output + */ + char* ConvertDescToCharL( const TDesC8& aDescriptor ); + + /** + * Send an event to every registered observer. + * + * @param Gst::TEvent evnet to be sent + * @return None + */ + void SendEventToObsevers( Gst::TEvent aEvent ); + +private: // from CActive + + /** + * @see e32base.h + */ + void RunL(); + + /** + * @see e32base.h + */ + void DoCancel(); + +private: + + CUpnpGstWrapperPimpl* iPimpl; + TThreadId iClientThreadId; + HBufC* iErrorMsg; //owned + HBufC* iVideoInfo; //owned + HBufC* iAudioInfo; //owned + RArray iEventQueue; + RMutex iMutex; + TInt64 iDuration; + TInt iSingletonRefCount; + RPointerArray iObservers; + TInt iFileSize; + + HBufC8* iPipeline; + +private: + + friend class CUpnpGstWrapperPimpl; + + }; + + +#endif // C_UPNPGSTWRAPPER_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/inc/upnpgstwrapperconsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/inc/upnpgstwrapperconsts.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 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" +* 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: UPnP GStreamer wrapper constants +* +*/ + +#ifndef C_UPNPGSTWRAPPERCONSTS_H +#define C_UPNPGSTWRAPPERCONSTS_H + +namespace Gst + { + + enum TEvent + { + EUnknown = 1, + EError = 2, + EEOS = 3, + EVideoStreamInfoAvailable = 4, + EAudioStreamInfoAvailable = 5 + }; + + } + + +#endif // C_UPNPGSTWRAPPERCONSTS_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/inc/upnpgstwrapperobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/inc/upnpgstwrapperobserver.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 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" +* 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: UPnP GStreamer wrapper observer +* +*/ + +#ifndef C_UPNPGSTWRAPPEROBSERVER_H +#define C_UPNPGSTWRAPPEROBSERVER_H + +#include "upnpgstwrapperconsts.h" + +class MUpnpGstWrapperObserver + { + +public: + + /** + * Indicates GStreamer event + * @param Gst::TEvent A event to be handled + * + */ + virtual void HandleGstEvent( Gst::TEvent aEvent ) = 0; + + }; + + +#endif // C_UPNPGSTWRAPPEROBSERVER_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/inc/upnprenderercfg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/inc/upnprenderercfg.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 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" +* 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: UPnP Renderer config container class +* +*/ + +#ifndef C_UPNPRENDERERCFG_H +#define C_UPNPRENDERERCFG_H + +#include + +class CUpnpRendererCfg : public CBase + { + +public: + + /** + * Static NewL + * + * @param aConfigFile Reference to config file descriptor + * @param aModelName Reference to model name 8-bit descriptor + * @param aSrcMimeType Reference to source mime type 8-bit descriptor + * + * @return instance to CUpnpRendererCfg + */ + IMPORT_C static CUpnpRendererCfg* NewL( const TDesC& aConfigFile, + const TDesC8& aModelName, const TDesC8& aSrcMimeType ); + + /** + * Static NewLC + * + * @param aConfigFile Reference to config file descriptor + * @param aModelName Reference to model name 8-bit descriptor + * @param aSrcMimeType Reference to source mime type 8-bit descriptor + * + * @return instance to CUpnpRendererCfg + */ + IMPORT_C static CUpnpRendererCfg* NewLC( const TDesC& aConfigFile, + const TDesC8& aModelName, const TDesC8& aSrcMimeType ); + + IMPORT_C ~CUpnpRendererCfg(); + +private: + + /** + * Destructor + */ + CUpnpRendererCfg(); + + /** + * 2nd phrase Constructor + */ + void ConstructL( const TDesC& aConfigFile, const TDesC8& aModelName, + const TDesC8& aSrcMimeType ); + +public: + + /* + * Return pipeline descriptor + * + * @return Reference to pipeline descriptor if pipeline set, otherwise + * KNullDesC8 + */ + IMPORT_C const TDesC8& Pipeline() const; + + /* + * Return protocol info descriptor + * + * @return Reference to protocol info descriptor if pipeline set, + * otherwise KNullDesC8 + */ + + IMPORT_C const TDesC8& ProtocolInfo() const; + + /* + * Return protocol info descriptor + * + * @return Size multiplier if set, otherwise KErrNotFound + */ + IMPORT_C TReal SizeMultiplier() const; + +private: + + HBufC* iConfigFile; //owned + HBufC8* iModelName; //owned + HBufC8* iSrcMimeType; //owned + + HBufC8* iPipeline; //owned + HBufC8* iProtocolInfo; //owned + TReal iSizeMultiplier; + +private: + + /* + * CUpnpRendererCfgParser sets directly following private member + * variables, if found from renderer config xml: + * - iPipeline + * - iProtocolInfo + * - iSizeMultiplier + */ + friend class CUpnpRendererCfgParser; + + }; + +#endif // C_UPNPRENDERERCFG_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/inc/upnprenderercfgparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/inc/upnprenderercfgparser.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 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" +* 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: UPnP Renderer config parser +* +*/ + +#ifndef C_UPNPRENDERERCFGPARSER_H +#define C_UPNPRENDERERCFGPARSER_H + +// INCLUDES +#include +#include +#include + +class CUpnpRendererCfg; + +namespace Xml + { + class CParser; + class CMatchData; + } + +class CUpnpRendererCfgParser : public CBase + , public Xml::MContentHandler + { + + /* + * Valid tags in renderer configuration xml file + */ + enum TCfgElements + { + EUnknown, + EConfig, + ERenderer, + ETranscoding, + EPipeline, + EProtocolInfo, + ESizeMultiplier + }; + +public: + + /** + * Static NewL + * + * @param none + * @return instance to CUpnpRendererCfgParser + */ + IMPORT_C static CUpnpRendererCfgParser* NewL(); + + /** + * Static NewLC + * + * @param none + * @return instance to CUpnpRendererCfgParser + */ + IMPORT_C static CUpnpRendererCfgParser* NewLC(); + + /** + * Destructor + */ + IMPORT_C ~CUpnpRendererCfgParser(); + +private: + + /** + * Constructor + */ + CUpnpRendererCfgParser(); + + /** + * 2nd phrase Constructor + */ + void ConstructL(); + +public: + + /** + * Parse renderer config. + * + * @param aRendereConfig Reference to renderer config container; after + * succesfull call, all the configs are stored in the container + * + * @see upnprenderercfg.h + */ + IMPORT_C void ParseRendererCfgL( CUpnpRendererCfg& aRendereConfig ); + +private: + + /* + * Start parsing. + * + * @param aFile Renderer configuration xml file + */ + void XMLParseL( const TDesC& aFile ); + + /* + * Reset memeber variables. + */ + inline void Reset(); + + /* + * Fetch element enumeration. + * + * @param aElement Reference to element's tag info + * + * @return Enumeration of the element + */ + TCfgElements Element( const Xml::RTagInfo& aElement ); + + /* + * Checks if an attribute array contains an attribute with matching name + * and matching value. + * + * @param aAttributes Reference to atttribute array + * @param aAttributeName Reference to 8-bit name descriptor + * @param aAttributeValue Reference to 8-bit value descriptor + * @param aExactValueMatch Boolean for exact value match + * + * @param ETrue if found, otherwise EFalse + */ + TBool ContainsAttribute( const Xml::RAttributeArray& aAttributes, + const TDesC8& aAttributeName, const TDesC8& aAttributeValue, + TBool aExactValueMatch ); + +private: // from MContentHandler + + /** + * From MContentHandler. + * @param aDocParam, not used. + * @param aErrorCode, not used. + */ + void OnStartDocumentL( const Xml::RDocumentParameters& aDocParam, + TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aErrorCode, not used. + */ + void OnEndDocumentL( TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aElement, holds the element info. + * @param aAttributes, holds the element's attributes. + * @param aErrorCode, if not KErrNone, the method is ignored. + */ + void OnStartElementL( const Xml::RTagInfo& aElement, + const Xml::RAttributeArray& aAttributes, + TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aElement, holds the element info. + * @param aErrorCode, if not KErrNone, the method is ignored. + */ + void OnEndElementL( const Xml::RTagInfo& aElement, TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aBytes, The value of the content. + * @param aErrorCode, if not KErrNone, the method is ignored. + */ + void OnContentL( const TDesC8& aBytes, TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aPrefix, not used. + * @param aUri, not used. + * @param aErrorCode, not used. + */ + void OnStartPrefixMappingL( const RString& aPrefix, + const RString& aUri, + TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aPrefix, not used. + * @param aErrorCode, not used. + */ + void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aBytes, not used. + * @param aErrorCode, not used. + */ + void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aName, not used. + * @param aErrorCode, not used. + */ + void OnSkippedEntityL( const RString& aName, TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aTarget, not used. + * @param aData, not used. + * @param aErrorCode, not used. + */ + void OnProcessingInstructionL( const TDesC8& aTarget, + const TDesC8& aData, + TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aErrorCode + */ + void OnError( TInt aErrorCode ); + + /** + * From MContentHandler. + * @param aUid, not used. + * @return None. + */ + TAny* GetExtendedInterface( const TInt32 aUid ); + +private: + + RFs iFs; + TCfgElements iCurrentElement; + TBool iCorrectModel; + TBool iCorrectTranscoding; + Xml::CParser* iParser; // owned + Xml::CMatchData* iMatchData; // owned + HBufC8* iModelName; // not owned + HBufC8* iSrcMimeType; // not owned + + // not owned if ParseRendererCfgL() doesn't LEAVE; otherwise owned + HBufC8* iPipeline; + + // not owned if ParseRendererCfgL() doesn't LEAVE; otherwise owned + HBufC8* iProtocolInfo; + + TReal iSizeMultiplier; + + }; + + +#endif // C_UPNPRENDERERCFGPARSER_H + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/src/upnpgstwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/src/upnpgstwrapper.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,955 @@ +/* +* Copyright (c) 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" +* 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: Implementation of UPnP GStreamer wrapper +* +*/ + +// INCLUDES +#include + +#include + +#include +#include + +#include +#include + +#include "upnpgstwrapper.h" + +_LIT( KComponentLogfile, "upnpgstwrapper.txt"); +#include "upnplog.h" + +#define __FUNC_LOG __LOG8_1( "%s", __PRETTY_FUNCTION__ ); + +_LIT( KAlreadyInUseErrorMsg, "GST already in use (call Stop first)" ); +_LIT( KUnknownErrorErrorMsg, "Unknown error" ); +_LIT( KOutOfMemoryErrorMsg, "Out of memory" ); + +const char* const KMimeTypeVideo = "video/"; +const char* const KMimeTypeAudio = "audio/"; +const char* const KDemuxerName = "demux"; + +class CUpnpGstWrapperPimpl : CBase + { + +public: // construction / destruction + + /** + * Static NewL + * + * @param none + * @return instance to CUpnpGstWrapperPimpl + */ + static CUpnpGstWrapperPimpl* NewL(); + + /** + * Destructor + */ + ~CUpnpGstWrapperPimpl(); + +private: + + /** + * Constructor + */ + CUpnpGstWrapperPimpl(); + + /** + * 2nd phrase Constructor + */ + void ConstructL(); + +public: + + inline void SetPipeline( GstElement* aPipeline ); + + inline GstElement* Pipeline(); + + inline void SetDemuxer( GstElement* aDemuxer ); + + inline GstElement* Demuxer(); + + inline void InitAppSinkL(); + + inline TBool PullBufferL( TPtr8& aPointer,TInt aMaxBytesLength, RBuf8* aBuf ); + + inline TInt TranscodedBytes(); + +public: //callbacks + + /** + * A function to receive any message occured within the pipeline + * Note that the function will be called in the same thread context as + * the posting object. + * + * @param GstBus* a bus to create the watch for + * @param GstMessage* a message created within the pipeline + * @param gponter the user data that has been given, + * when registering the handler + * @return GstBusSyncReply indicates whether the message is also added + * into async queue (after this callback) or dropped + */ + static GstBusSyncReply SyncBusCallback( GstBus* aBus, GstMessage* aMsg, + gpointer aData ); + + /** + * A function to receive callback from demuxer whenever source pad is + * added into it + * + * @param GstElement* an element (demuxer) where the source pad was added + * @param GstPad* a souce pad that was added + * @param gponter the user data that has been given, + * when registering the handler + */ + static void DemuxPadAddedCallback( GstElement* aElement, GstPad* aPad, + gpointer aData ); + + /** + * Internal log handler. + * Implements GStreamer's log handler callback. + * Ouputs GStreamer debug traces if DEBUG_ENABLE flag is enabled in + * GStreamer. + */ + static void LogCallback( GstDebugCategory *category, GstDebugLevel level, + const gchar *file, const gchar *function, gint line, + GObject *object, GstDebugMessage *message, gpointer data ); + +private: + + GstElement* iPipeline; + GstElement* iDemuxer; + + TInt iBytesOffSet; + + GstElement* iAppsink; + + GstElement* iElement; + + GstBuffer* iGstBuffer; + + }; + +// -------------------------------------------------------------------------- +// CUpnpGstWrapperPimpl::NewL +//--------------------------------------------------------------------------- +CUpnpGstWrapperPimpl* CUpnpGstWrapperPimpl::NewL() + { + __FUNC_LOG; + + CUpnpGstWrapperPimpl* self = new( ELeave ) CUpnpGstWrapperPimpl(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapperPimpl::~CUpnpGstWrapperPimpl +//--------------------------------------------------------------------------- +CUpnpGstWrapperPimpl::~CUpnpGstWrapperPimpl() + { + __FUNC_LOG; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapperPimpl::CUpnpGstWrapperPimpl +//--------------------------------------------------------------------------- +CUpnpGstWrapperPimpl::CUpnpGstWrapperPimpl() + { + __FUNC_LOG; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapperPimpl::ConstructL +//--------------------------------------------------------------------------- +void CUpnpGstWrapperPimpl::ConstructL() + { + __FUNC_LOG; + } + +void CUpnpGstWrapperPimpl::SetPipeline( GstElement* aPipeline ) + { + __FUNC_LOG; + + iPipeline = aPipeline; + } + +GstElement* CUpnpGstWrapperPimpl::Pipeline() + { + __FUNC_LOG; + return iPipeline; + } + +void CUpnpGstWrapperPimpl::SetDemuxer( GstElement* aDemuxer ) + { + __FUNC_LOG; + + iDemuxer = aDemuxer; + } + +GstElement* CUpnpGstWrapperPimpl::Demuxer() + { + __FUNC_LOG; + + return iDemuxer; + } + +void CUpnpGstWrapperPimpl::InitAppSinkL() + { + iAppsink = gst_bin_get_by_name ( + GST_BIN ( iPipeline ), "sinkbuffer"); + + if( !iAppsink ) + User::Leave( KErrNotFound); + + g_object_set ( + G_OBJECT (iAppsink), "emit-signals", TRUE, "sync", FALSE, NULL); + gst_object_unref (iAppsink); + } + +TBool CUpnpGstWrapperPimpl::PullBufferL( TPtr8& aPointer,TInt aMaxBytesLength, RBuf8* aBuf ) + { + guint size; + + if( iGstBuffer ) + { + delete [] GST_BUFFER_DATA(iGstBuffer); + GST_BUFFER_DATA(iGstBuffer) = NULL; + } + + iGstBuffer = gst_app_sink_pull_buffer( GST_APP_SINK ( iAppsink )); + + if( iGstBuffer ) + { + size = GST_BUFFER_SIZE( iGstBuffer ); + + iBytesOffSet += size; + + if( aBuf && ( size + aBuf->Length() ) > aBuf->MaxLength() ) + { + HBufC8* tmp(NULL); + TInt len(aBuf->Length()); + if( len > 0 ) + { + tmp = aBuf->AllocLC(); + } + aBuf->Close(); + aBuf->CreateL(size+len); + if( tmp ) + { + aBuf->Append(*tmp); + CleanupStack::PopAndDestroy(tmp); + } + + aBuf->Append( (TUint8*)GST_BUFFER_DATA(iGstBuffer),size ); + } + else + { + __ASSERT( (aMaxBytesLength >= size), __FILE__, __LINE__ ); + aPointer.Set((TUint8*)GST_BUFFER_DATA(iGstBuffer),size,aMaxBytesLength); + } + } + return ( iGstBuffer ) ? EFalse : ETrue; + } + +TInt CUpnpGstWrapperPimpl::TranscodedBytes() + { + return iBytesOffSet; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapperPimpl::SyncBusCallback +//--------------------------------------------------------------------------- +GstBusSyncReply CUpnpGstWrapperPimpl::SyncBusCallback( GstBus* /*aBus*/, + GstMessage* aMsg, gpointer aData ) + { + __FUNC_LOG; + + GstMessageType messageType = GST_MESSAGE_TYPE( aMsg ); + + if( messageType == GST_MESSAGE_EOS || + messageType == GST_MESSAGE_ERROR ) + { + __ASSERT( aData, __FILE__, __LINE__ ); + + CUpnpGstWrapper* parent = static_cast( aData ); + Gst::TEvent event = Gst::EUnknown; + + parent->iMutex.Wait(); + + switch( messageType ) + { + case GST_MESSAGE_EOS: + { + event = Gst::EEOS; + break; + } + case GST_MESSAGE_ERROR: + { + GError* err = NULL; + + char* debug; + gst_message_parse_error( aMsg, &err, &debug ); + g_free( debug ); + + if( err ) + { + TRAP_IGNORE( parent->SetErrorMsg( + parent->ConvertCharToDescL( + err->message ) ) ); + g_error_free( err ); + err = NULL; + } + event = Gst::EError; + break; + } + default: + { + __ASSERT( EFalse, __FILE__, __LINE__ ); + } + } + + parent->iEventQueue.Append( event ); + + __ASSERT( parent->IsActive(), __FILE__, __LINE__ ); + if( parent->iStatus == KRequestPending ) + { + TRequestStatus* status = &parent->iStatus; + RThread thread; + TInt err = thread.Open( parent->iClientThreadId ); + __ASSERT( !err, __FILE__, __LINE__ ); + + thread.RequestComplete( status, KErrNone ); + thread.Close(); + } + + parent->iMutex.Signal(); + + gst_message_unref( aMsg ); + } + + return GST_BUS_DROP; //do not add anything into async queue + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapperPimpl::DemuxPadAddedCallback +//--------------------------------------------------------------------------- +void CUpnpGstWrapperPimpl::DemuxPadAddedCallback( GstElement* /*aElement*/, + GstPad* aPad, gpointer aData ) + { + __FUNC_LOG; + __ASSERT( aData, __FILE__, __LINE__ ); + + CUpnpGstWrapper* parent = static_cast( aData ); + + GstCaps* caps = gst_pad_get_caps( aPad ); + char* str = gst_caps_to_string( caps ); + Gst::TEvent event = Gst::EUnknown; + + parent->iMutex.Wait(); + + if( g_str_has_prefix( str, KMimeTypeVideo ) ) + { + delete parent->iVideoInfo; parent->iVideoInfo = NULL; + TRAPD( err, parent->iVideoInfo = parent->ConvertCharToDescL( str ) ); + if( !err ) + { + event = Gst::EVideoStreamInfoAvailable; + } + else + { + event = Gst::EError; + TRAP_IGNORE( parent->SetErrorMsgL( KOutOfMemoryErrorMsg ) ); + } + } + else if( g_str_has_prefix( str, KMimeTypeAudio ) ) + { + delete parent->iAudioInfo; parent->iAudioInfo = NULL; + TRAPD( err, parent->iAudioInfo = parent->ConvertCharToDescL( str ) ); + if( !err ) + { + event = Gst::EAudioStreamInfoAvailable; + } + else + { + event = Gst::EError; + TRAP_IGNORE( parent->SetErrorMsgL( KOutOfMemoryErrorMsg ) ); + } + } + else + { + __ASSERT( EFalse, __FILE__, __LINE__ ); + } + + parent->iEventQueue.Append( event ); + + __ASSERT( parent->IsActive(), __FILE__, __LINE__ ); + if( parent->iStatus == KRequestPending ) + { + TRequestStatus* status = &parent->iStatus; + RThread thread; + TInt err = thread.Open( parent->iClientThreadId ); + __ASSERT( !err, __FILE__, __LINE__ ); + + thread.RequestComplete( status, KErrNone ); + thread.Close(); + } + + parent->iMutex.Signal(); + + g_free(str); + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapperPimpl::LogCallback +//--------------------------------------------------------------------------- +void CUpnpGstWrapperPimpl::LogCallback( GstDebugCategory* category, + GstDebugLevel level, const char* file, const char* function, + gint line, GObject* /*object*/, GstDebugMessage* message, + gpointer /*data*/ ) + { + if (level > gst_debug_category_get_threshold (category)) + { + return; + } + +#ifndef __UPNP_LOG_FILE + const char* const KGstLogFmt = "%s %20s %s:%d:%s %s\n"; + RDebug::Printf( KGstLogFmt, + gst_debug_level_get_name (level), + gst_debug_category_get_name (category), file, line, function, + gst_debug_message_get (message) ); +#else + _LIT8( KGstLogFmtDesc, "%s %20s %s:%d:%s %s\n" ); + RFileLogger::WriteFormat( KLogDir, KComponentLogfile, + EFileLoggingModeAppend, KGstLogFmtDesc, + gst_debug_level_get_name (level), + gst_debug_category_get_name (category), file, line, function, + gst_debug_message_get (message) ); +#endif + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::GetInstanceL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C CUpnpGstWrapper* CUpnpGstWrapper::GetInstanceL() + { + CUpnpGstWrapper* singleton = static_cast( Dll::Tls() ); + if ( singleton == 0 ) + { + // singleton must be created first + singleton = new ( ELeave ) CUpnpGstWrapper(); + CleanupStack::PushL( singleton ); + singleton->ConstructL(); + User::LeaveIfError( Dll::SetTls( singleton ) ); + CleanupStack::Pop( singleton ); + } + singleton->iSingletonRefCount++; + + return singleton; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::Close +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpGstWrapper::Close() + { + if(--iSingletonRefCount == 0) + { + Dll::FreeTls(); + delete this; + } + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::~CUpnpGstWrapper +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C CUpnpGstWrapper::~CUpnpGstWrapper() + { + __FUNC_LOG; + + Stop(); + + Cancel(); + + gst_deinit(); + + delete iErrorMsg; + delete iVideoInfo; + delete iAudioInfo; + + iEventQueue.Close(); + iMutex.Close(); + iObservers.Close(); + + delete iPimpl; + delete iPipeline; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::CUpnpGstWrapper +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +CUpnpGstWrapper::CUpnpGstWrapper() + : CActive( EPriorityStandard ) + , iDuration( KErrNotFound ) + { + __FUNC_LOG; + + CActiveScheduler::Add( this ); + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::ConstructL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +void CUpnpGstWrapper::ConstructL() + { + __FUNC_LOG; + + iPimpl = CUpnpGstWrapperPimpl::NewL(); + + iMutex.CreateLocal(); + + RThread thread; + iClientThreadId = thread.Id(); + + /* + * Install our own log handler + * FIXME: After this there is two log handlers: + * + * Default: Uses glib's g_printerr() that prints + * RDebug::RawPrints ONLY in full udeb mode + * Our own: See behaviour in LogCallback function below + * + * We should somehow get rid of the default one... + */ + gst_debug_add_log_function( CUpnpGstWrapperPimpl::LogCallback, this ); + + __LOG( "Initializing GStreamer..." ); + gst_init( NULL, NULL ); + __LOG( "GStreamer initialization done!" ); + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::SetObserverL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpGstWrapper::SetObserverL( + MUpnpGstWrapperObserver& aObserver ) + { + if( iObservers.Find( &aObserver ) < 0 ) + { + iObservers.AppendL( &aObserver ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::RemoveObserverL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpGstWrapper::RemoveObserver( + MUpnpGstWrapperObserver& aObserver ) + { + TInt index = iObservers.Find( &aObserver ); + if( index >= 0 ) + { + iObservers.Remove( index ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::StartL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpGstWrapper::StartL() + { + __FUNC_LOG; + + if( !iPipeline ) + { + SetErrorMsgL( KAlreadyInUseErrorMsg ); + User::Leave( KErrNotReady ); + } + + //Create pipeline according to the input description + char* pipelineStr = ConvertDescToCharL( *iPipeline ); + + GError* err = NULL; + /** + * Create a new pipeline based on command line syntax. + * Please note that you might get a return value that is not NULL even + * though the error is set. In this case there was a recoverable + * parsing error and you can try to play the pipeline + */ + __LOG( "Parsing GStreamer pipeline..." ); + GstElement* pipeline = gst_parse_launch( pipelineStr, &err ); + __LOG( "GStreamer pipeline parsing done!" ); + User::Free( pipelineStr ); + + if( err ) + { + SetErrorMsg( ConvertCharToDescL( err->message ) ); + g_error_free( err ); + err = NULL; + User::Leave( KErrGeneral ); + } + + iPimpl->SetPipeline( pipeline ); + + //TODO: Hardcoded demuxer name 'KDemuxerName -> should be fetched somehow + //dynamically ?? + GstElement* demuxer = gst_bin_get_by_name( GST_BIN( pipeline ), + KDemuxerName ); + + //If a demuxer is found, create 'pad-added' callback; else do nothing + if( demuxer ) + { + g_signal_connect( demuxer, "pad-added", + G_CALLBACK( CUpnpGstWrapperPimpl::DemuxPadAddedCallback ), + this ); + iPimpl->SetDemuxer( demuxer ); + } + + GstBus* bus = NULL; + bus = gst_pipeline_get_bus( GST_PIPELINE( pipeline ) ); + if( !bus ) + { + //unknown error + User::Leave(KErrGeneral); + } + + if( !IsActive() ) + { + iStatus = KRequestPending; + SetActive(); + } + + gst_bus_set_sync_handler( bus, CUpnpGstWrapperPimpl::SyncBusCallback, this ); + + gst_object_unref( bus ); + + gst_element_set_state( pipeline, GST_STATE_PLAYING ); + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::Stop +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C void CUpnpGstWrapper::Stop() + { + __FUNC_LOG; + GstElement* demuxer = iPimpl->Demuxer(); + if( demuxer ) + { + gst_object_unref( GST_OBJECT( demuxer ) ); + iPimpl->SetDemuxer( NULL ); + } + + GstElement* pipeline = iPimpl->Pipeline(); + if( pipeline ) + { + gst_element_set_state( pipeline, GST_STATE_NULL ); + gst_object_unref( GST_OBJECT( pipeline ) ); + iPimpl->SetPipeline( NULL ); + } + //Cancel(); + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::ErrorMsg +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C const TDesC& CUpnpGstWrapper::ErrorMsg() + { + __FUNC_LOG; + + if( iErrorMsg ) + { + return *iErrorMsg; + } + else + { + return KUnknownErrorErrorMsg(); + } + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::FeatureListL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C CDesCArray* CUpnpGstWrapper::FeatureListL() + { + __FUNC_LOG; + + CDesCArray* array = new (ELeave) CDesCArrayFlat( 5 ); + CleanupStack::PushL( array ); + + GList* features = gst_registry_get_feature_list( + gst_registry_get_default(), GST_TYPE_ELEMENT_FACTORY ); + while( features ) + { + GstPluginFeature* feature = (GstPluginFeature*)features->data; + HBufC* tempBuf = ConvertCharToDescL( gst_plugin_feature_get_name( + feature ) ); + CleanupStack::PushL( tempBuf ); + array->AppendL( *tempBuf ); + CleanupStack::PopAndDestroy( tempBuf ); + features = features->next; + } + + CleanupStack::Pop( array ); + return array; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::VideoInfo +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C const TDesC& CUpnpGstWrapper::VideoInfo() + { + __FUNC_LOG; + + if( iVideoInfo ) + { + return *iVideoInfo; + } + else + { + return KNullDesC; + } + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::AudioInfo +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C const TDesC& CUpnpGstWrapper::AudioInfo() + { + __FUNC_LOG; + + if( iAudioInfo ) + { + return *iAudioInfo; + } + else + { + return KNullDesC; + } + } +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::Position +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C TInt64 CUpnpGstWrapper::Position() + { + __FUNC_LOG; + + GstFormat fmt = GST_FORMAT_TIME; + TInt64 position = KErrNotFound; + + //fetch position from pipeline (not from the demuxer) + GstElement* pipeline = iPimpl->Pipeline(); + + if( pipeline ) + { + gst_element_query_position( pipeline, &fmt, &position ); + } + + return position; + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::Duration +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +EXPORT_C TInt64 CUpnpGstWrapper::Duration() + { + __FUNC_LOG; + + if( iDuration < 0 ) + { + GstFormat fmt = GST_FORMAT_TIME; + if( iPimpl->Demuxer() ) + { + //fetch duration from demuxer + gst_element_query_duration( iPimpl->Demuxer(), &fmt, &iDuration ); + } + else if( iPimpl->Pipeline() ) + { + //backup plan: not so good choice as demuxer + gst_element_query_position( iPimpl->Pipeline(), &fmt, &iDuration ); + } + } + + return iDuration; + } + +EXPORT_C TAny* CUpnpGstWrapper::PipelinePtr() + { + return iPimpl->Pipeline(); + } + +EXPORT_C void CUpnpGstWrapper::InitAppsinkL() + { + iPimpl->InitAppSinkL(); + } + +EXPORT_C TBool CUpnpGstWrapper::PullBufferL( TPtr8& aPointer,TInt aMaxBytesLength, RBuf8* aBuf ) + { + return iPimpl->PullBufferL(aPointer,aMaxBytesLength,aBuf); + } + +EXPORT_C TInt CUpnpGstWrapper::TranscodedBytes() + { + return iPimpl->TranscodedBytes(); + } + +EXPORT_C void CUpnpGstWrapper::SetTranscodedFileSize( TInt aSize ) + { + iFileSize = aSize; + } + +EXPORT_C TInt CUpnpGstWrapper::TranscodedFileSize() + { + return iFileSize; + } + +EXPORT_C void CUpnpGstWrapper::SetPipelineL( const TDesC8& aPipeline ) + { + delete iPipeline; + iPipeline = NULL; + iPipeline = aPipeline.AllocL(); + } + + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::SetErrorMsgL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +void CUpnpGstWrapper::SetErrorMsgL( const TDesC& aErrorMsg ) + { + __FUNC_LOG; + + delete iErrorMsg; iErrorMsg = NULL; + iErrorMsg = aErrorMsg.AllocL(); + + __LOG1( "CUpnpGstWrapper::SetErrorMsgL Error desc: %S", iErrorMsg ); + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::SetErrorMsg +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +void CUpnpGstWrapper::SetErrorMsg( HBufC* const aErrorMsg ) + { + delete iErrorMsg; iErrorMsg = NULL; + iErrorMsg = aErrorMsg; + + __LOG1( "CUpnpGstWrapper::SetErrorMsg Error desc: %S", iErrorMsg ); + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::ConvertCharToDescL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +HBufC* CUpnpGstWrapper::ConvertCharToDescL( const char* aString ) + { + __FUNC_LOG; + + HBufC* desc = NULL; + TPtrC8 tempPtr8( (TUint8*)(aString) ); + desc = HBufC::NewL( tempPtr8.Length() ); + desc->Des().Copy( tempPtr8 ); + + return desc; + } + + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::ConvertDescToCharL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +char* CUpnpGstWrapper::ConvertDescToCharL( const TDesC8& aDescriptor ) + { + __FUNC_LOG; + + TUint length = aDescriptor.Length(); + char* string = (char*)User::AllocL( length + 1 ); + Mem::Copy((char*)string, aDescriptor.Ptr(), length ); + string[length] = 0; //null terminated + return string; + } + +void CUpnpGstWrapper::SendEventToObsevers( Gst::TEvent aEvent ) + { + __FUNC_LOG; + + TInt observerCount = iObservers.Count(); + for( TInt i = 0; i < observerCount; i++ ) + { + iObservers[i]->HandleGstEvent( aEvent ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::RunL +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +void CUpnpGstWrapper::RunL() + { + __FUNC_LOG; + if( iStatus.Int() >= KErrNone ) + { + TBool completed = EFalse; + + iMutex.Wait(); + + TInt eventQueueCount = iEventQueue.Count(); + for( TInt i = 0; i < eventQueueCount; i++ ) + { + Gst::TEvent event = iEventQueue[i]; + SendEventToObsevers( event ); + if( event == Gst::EEOS || event == Gst::EError ) + { + __LOG1( "CUpnpGstWrapper::RunL Completed: %d (2=Error, 3=EOS)", + event); + completed = ETrue; + } + } + iEventQueue.Reset(); + + if( !completed ) + { + iStatus = KRequestPending; + SetActive(); + } + iMutex.Signal(); + } + } + +// -------------------------------------------------------------------------- +// CUpnpGstWrapper::DoCancel +// See upnpgstwrapper.h +//--------------------------------------------------------------------------- +void CUpnpGstWrapper::DoCancel() + { + __FUNC_LOG; + } + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/src/upnprenderercfg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/src/upnprenderercfg.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 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" +* 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: Implementation of UPnP Renderer config container class +* +*/ + +// INCLUDES +#include "upnprenderercfg.h" + +_LIT( KComponentLogfile, "upnprenderercfg.txt"); +#include "upnplog.h" + +#define __FUNC_LOG __LOG8_1( "%s", __PRETTY_FUNCTION__ ); + +EXPORT_C CUpnpRendererCfg* CUpnpRendererCfg::NewL( const TDesC& aConfigFile, + const TDesC8& aModelName, const TDesC8& aSrcMimeType ) + { + __FUNC_LOG; + + CUpnpRendererCfg* self = CUpnpRendererCfg::NewLC( aConfigFile, + aModelName, aSrcMimeType ); + CleanupStack::Pop( self ); + return self; + } + +EXPORT_C CUpnpRendererCfg* CUpnpRendererCfg::NewLC( const TDesC& aConfigFile, + const TDesC8& aModelName, const TDesC8& aSrcMimeType ) + { + __FUNC_LOG; + + CUpnpRendererCfg* self = new( ELeave ) CUpnpRendererCfg(); + CleanupStack::PushL( self ); + self->ConstructL( aConfigFile, aModelName, aSrcMimeType ); + return self; + } + +EXPORT_C CUpnpRendererCfg::~CUpnpRendererCfg() + { + __FUNC_LOG; + + delete iConfigFile; + delete iModelName; + delete iSrcMimeType; + delete iPipeline; + delete iProtocolInfo; + } + +CUpnpRendererCfg::CUpnpRendererCfg() + : iSizeMultiplier( KErrNotFound ) + { + __FUNC_LOG; + } + +void CUpnpRendererCfg::ConstructL( const TDesC& aConfigFile, const TDesC8& aModelName, + const TDesC8& aSrcMimeType ) + { + __FUNC_LOG; + + iConfigFile = aConfigFile.AllocL(); + iModelName = aModelName.AllocL(); + iSrcMimeType = aSrcMimeType.AllocL(); + } + +EXPORT_C const TDesC8& CUpnpRendererCfg::Pipeline() const + { + __FUNC_LOG; + + if( !iPipeline ) + { + return KNullDesC8; + } + else + { + return *iPipeline; + } + } + +EXPORT_C const TDesC8& CUpnpRendererCfg::ProtocolInfo() const + { + __FUNC_LOG; + + if( !iProtocolInfo ) + { + return KNullDesC8; + } + else + { + return *iProtocolInfo; + } + } + +EXPORT_C TReal CUpnpRendererCfg::SizeMultiplier() const + { + __FUNC_LOG; + + return iSizeMultiplier; + } + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpgstwrapper/src/upnprenderercfgparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpgstwrapper/src/upnprenderercfgparser.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,611 @@ +/* +* Copyright (c) 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" +* 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: Implementation of UPnP GStreamer wrapper +* +*/ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +#include "upnprenderercfg.h" +#include "upnprenderercfgparser.h" + +_LIT( KComponentLogfile, "upnprenderercfgparser.txt"); +#include "upnplog.h" + +#define __FUNC_LOG __LOG8_1( "%s", __PRETTY_FUNCTION__ ); + +//tags +_LIT8( KTranscoding, "transcoding" ); +_LIT8( KPipeline, "pipeline" ); +_LIT8( KProtocolInfo, "protocolInfo" ); +_LIT8( KSizeMultiplier, "sizeMultiplier" ); +_LIT8( KRenderer, "renderer" ); +_LIT8( KConfig, "config" ); + +//attributes +_LIT8( KExactMatch, "exactMatch" ); +_LIT8( KModelName, "modelName" ); +_LIT8( KSrcMimeType, "srcMimeType" ); + +_LIT8( KFalse, "0" ); + +_LIT8( KXmlMimeType, "text/xml" ); +_LIT8( KLIB2XML, "libxml2" ); + +const TUint8 KCharSpace = 32; // Space +const TUint8 KCharDel = 127; // DEL + +using namespace Xml; + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::NewL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpRendererCfgParser* CUpnpRendererCfgParser::NewL() + { + __FUNC_LOG; + + CUpnpRendererCfgParser* self = CUpnpRendererCfgParser::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::NewLC() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpRendererCfgParser* CUpnpRendererCfgParser::NewLC() + { + __FUNC_LOG; + + CUpnpRendererCfgParser* self = new( ELeave ) CUpnpRendererCfgParser(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::~CUpnpRendererCfgParser() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpRendererCfgParser::~CUpnpRendererCfgParser() + { + __FUNC_LOG; + + delete iParser; + delete iMatchData; + + iFs.Close(); + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::CUpnpRendererCfgParser() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +CUpnpRendererCfgParser::CUpnpRendererCfgParser() + : iSizeMultiplier( KErrNotFound ) + { + __FUNC_LOG; + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::ConstructL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::ConstructL() + { + __FUNC_LOG; + + iMatchData = CMatchData::NewL(); + iMatchData->SetMimeTypeL( KXmlMimeType ); + iMatchData->SetVariantL( KLIB2XML ); + iParser = CParser::NewL( *iMatchData, *this ); + iParser->EnableFeature( ESendFullContentInOneChunk ); + + User::LeaveIfError( iFs.Connect() ); + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::ParseRendererCfgL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpRendererCfgParser::ParseRendererCfgL( + CUpnpRendererCfg& aRendereConfig ) + { + __FUNC_LOG; + + if( aRendereConfig.iPipeline || + aRendereConfig.iProtocolInfo || + aRendereConfig.iSizeMultiplier != KErrNotFound ) + { + //these values should be still untouched + User::Leave( KErrArgument ); + } + + iModelName = aRendereConfig.iModelName; + iSrcMimeType = aRendereConfig.iSrcMimeType; + + //syncronous call -> returns when the file is fully parsed + XMLParseL( *aRendereConfig.iConfigFile ); + + if( !iPipeline || !iProtocolInfo || iSizeMultiplier == KErrNotFound ) + { + __LOG8_1( "Couldn't find all the config elements for %S", + iModelName ); + + //delete allocated bufs and reset vars + delete iPipeline; iPipeline = NULL; + delete iProtocolInfo; iProtocolInfo = NULL; + + //make sure that everything is in init state + Reset(); + + User::Leave( KErrNotFound ); + } + + aRendereConfig.iPipeline = iPipeline; //ownership transfer + aRendereConfig.iProtocolInfo = iProtocolInfo; //ownership transfer + aRendereConfig.iSizeMultiplier = iSizeMultiplier; + + //make sure that everything is in init state + Reset(); + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::XMLParseL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::XMLParseL( const TDesC& aFile ) + { + __FUNC_LOG; + + RFile file; + User::LeaveIfError( file.Open( iFs, aFile , EFileRead ) ); + CleanupClosePushL( file ); + + TInt size; + User::LeaveIfError( file.Size( size ) ); + + HBufC8* buf = HBufC8::NewLC( size ); + TPtr8 ptr = buf->Des(); + User::LeaveIfError( file.Read( ptr ) ); + + Xml::ParseL( *iParser, *buf ); + + CleanupStack::PopAndDestroy( buf ); + CleanupStack::PopAndDestroy( &file ); + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::Reset() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::Reset() + { + __FUNC_LOG; + + iCurrentElement = EUnknown; + iCorrectModel = EFalse; + iCorrectTranscoding = EFalse; + iModelName = NULL; + iSrcMimeType = NULL; + iPipeline = NULL; + iProtocolInfo = NULL; + iSizeMultiplier = KErrNotFound; + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::Element() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +CUpnpRendererCfgParser::TCfgElements CUpnpRendererCfgParser::Element( + const RTagInfo& aElement ) + { + __FUNC_LOG; + + TCfgElements element = EUnknown; + + const TDesC8& desName = aElement.LocalName().DesC(); + + if( desName.CompareF( KTranscoding ) == 0 ) + { + element = ETranscoding; + } + else if( desName.CompareF( KPipeline ) == 0 ) + { + element = EPipeline; + } + else if( desName.CompareF( KProtocolInfo ) == 0 ) + { + element = EProtocolInfo; + } + else if( desName.CompareF( KSizeMultiplier ) == 0 ) + { + element = ESizeMultiplier; + } + else if( desName.CompareF( KRenderer ) == 0 ) + { + element = ERenderer; + } + else if( desName.CompareF( KConfig ) == 0 ) + { + element = EConfig; + } + else + { + __LOG8_1( "Error: Unknown element %S", &desName ); + __ASSERT( EFalse, __FILE__, __LINE__ ); + } + + return element; + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::ContainsAttribute() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +TBool CUpnpRendererCfgParser::ContainsAttribute( + const RAttributeArray& aAttributes, const TDesC8& aAttributeName, + const TDesC8& aAttributeValue, TBool aExactValueMatch ) + { + __FUNC_LOG; + + TInt attributeCount = aAttributes.Count(); + for( TInt i = 0; i < attributeCount; i++ ) + { + Xml::RAttribute attr = aAttributes[i]; + + if( attr.Attribute().LocalName().DesC() == aAttributeName ) + { + if( aExactValueMatch ) + { + if( aAttributeValue.CompareF( attr.Value().DesC() ) == 0 ) + { + //requested exact value match found + return ETrue; + } + } + else if( aAttributeValue.FindF( attr.Value().DesC() ) >= 0 ) + { + //requested non-exact value match (sub-string) found + return ETrue; + } + } + } + + return EFalse; + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnStartDocumentL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnStartDocumentL( + const RDocumentParameters& /*aDocParam*/, + TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnEndDocumentL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnEndDocumentL( TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnStartElementL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnStartElementL( const RTagInfo& aElement, + const RAttributeArray& aAttributes, TInt aErrorCode ) + { + __FUNC_LOG; + __ASSERT( !aErrorCode, __FILE__, __LINE__ ); + + iCurrentElement = Element( aElement ); + + switch( iCurrentElement ) + { + case EConfig: //fall through + case EPipeline: //fall through + case EProtocolInfo: //fall through + case ESizeMultiplier: + { + break; + } + case ERenderer: + { + TBool exactMatch = ETrue; + if( ContainsAttribute( aAttributes, KExactMatch, KFalse, + ETrue ) ) + { + exactMatch = EFalse; + } + + if( ContainsAttribute( aAttributes, KModelName, *iModelName, + exactMatch ) ) + { + iCorrectModel = ETrue; + } + else + { + iCorrectModel = EFalse; + } + break; + } + case ETranscoding: + { + if( iCorrectModel && + ContainsAttribute( aAttributes, KSrcMimeType, *iSrcMimeType, + ETrue ) ) + { + // correct transcoding found + // -> assert if something is already set + __ASSERT( !iPipeline, __FILE__, __LINE__ ); + __ASSERT( !iProtocolInfo, __FILE__, __LINE__ ); + __ASSERT( iSizeMultiplier == KErrNotFound, __FILE__, + __LINE__ ); + + iCorrectTranscoding = ETrue; + } + break; + } + default: + { + __ASSERT( EFalse, __FILE__, __LINE__ ); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnEndElementL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnEndElementL( const RTagInfo& aElement, + TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + if( iCurrentElement == EUnknown ) + { + //at least second OnEndElementL callback in a row -> fetch enum + iCurrentElement = Element( aElement ); + } + + switch( iCurrentElement ) + { + case EPipeline: //fall through + case EProtocolInfo: //fall through + case ESizeMultiplier: + { + break; + } + case EUnknown: //fall through + case EConfig: //fall through + case ERenderer: + { + iCorrectModel = EFalse; + //fall through + } + case ETranscoding: + { + iCorrectTranscoding = EFalse; + break; + } + default: + { + __ASSERT( EFalse, __FILE__, __LINE__ ); + } + } + + //exiting from element -> reset current element + iCurrentElement = EUnknown; + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnContentL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnContentL( const TDesC8& aBytes, + TInt aErrorCode ) + { + __FUNC_LOG; + __ASSERT( !aErrorCode, __FILE__, __LINE__ ); + + TUint8 firstChar = aBytes[0]; + if( firstChar <= KCharSpace || firstChar == KCharDel ) + { + //1st char of the content is a special char -> skip + return; + } + + switch( iCurrentElement ) + { + case EConfig: //fall through + case ERenderer: //fall through + case ETranscoding: + break; + case EPipeline: + { + if( iCorrectTranscoding ) + { + //shouldn't contain any parsed value yet + __ASSERT( !iPipeline, __FILE__, __LINE__ ); + + iPipeline = HBufC8::NewL( aBytes.Length() ); + iPipeline->Des().Copy( aBytes ); + } + break; + } + case EProtocolInfo: + { + if( iCorrectTranscoding ) + { + //shouldn't contain any parsed value yet + __ASSERT( !iProtocolInfo, __FILE__, __LINE__ ); + + iProtocolInfo = HBufC8::NewL( aBytes.Length() ); + iProtocolInfo->Des().Copy( aBytes ); + } + break; + } + case ESizeMultiplier: + { + if( iCorrectTranscoding ) + { + //shouldn't contain any parsed value yet + __ASSERT( iSizeMultiplier == KErrNotFound, __FILE__, + __LINE__ ); + + TLex8 lex; + lex.Assign( aBytes ); + TInt err = lex.Val( iSizeMultiplier ); + + __ASSERT( !err, __FILE__, __LINE__ ); + } + break; + } + default: + { + __ASSERT( EFalse, __FILE__, __LINE__ ); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnStartPrefixMappingL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnStartPrefixMappingL( + const RString& /*aPrefix*/, const RString& /*aUri*/, + TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnEndPrefixMappingL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnEndPrefixMappingL( const RString& /*aPrefix*/, + TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnIgnorableWhiteSpaceL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, + TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnSkippedEntityL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnSkippedEntityL( const RString& /*aName*/, + TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnProcessingInstructionL() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnProcessingInstructionL( + const TDesC8& /*aTarget*/, + const TDesC8& /*aData*/, + TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::OnError() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +void CUpnpRendererCfgParser::OnError( TInt /*aErrorCode*/ ) + { + __FUNC_LOG; + + // No implementation needed + } + +// -------------------------------------------------------------------------- +// CUpnpRendererCfgParser::GetExtendedInterface() +// (See comments in header file) +// -------------------------------------------------------------------------- +// +TAny* CUpnpRendererCfgParser::GetExtendedInterface( const TInt32 /*aUid*/ ) + { + __FUNC_LOG; + + // No implementation needed + return NULL; + } + + +// end of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/bwins/upnpsharingalgorithmu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/bwins/upnpsharingalgorithmu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,27 @@ +EXPORTS + ??1CUpnpCdsLiteObject@@UAE@XZ @ 1 NONAME ; CUpnpCdsLiteObject::~CUpnpCdsLiteObject(void) + ?IsFileSharedL@CUpnpSharingAlgorithmImpl@@UAEHABV?$TBuf@$0BAA@@@@Z @ 2 NONAME ; int CUpnpSharingAlgorithmImpl::IsFileSharedL(class TBuf<256> const &) + ?RemoveObjectAtL@CUpnpCdsLiteObjectArray@@QAEXI@Z @ 3 NONAME ; void CUpnpCdsLiteObjectArray::RemoveObjectAtL(unsigned int) + ?RemoveL@CUpnpCdsLiteObjectArray@@QAEXPBVCUpnpObject@@@Z @ 4 NONAME ; void CUpnpCdsLiteObjectArray::RemoveL(class CUpnpObject const *) + ?FindRefItemIdByOriginalIdL@CUpnpCdsLiteObjectArray@@QAEHABVTDesC8@@@Z @ 5 NONAME ; int CUpnpCdsLiteObjectArray::FindRefItemIdByOriginalIdL(class TDesC8 const &) + ?FindByNameAndParentId@CUpnpCdsLiteObjectArray@@QAEHABVTDesC8@@0@Z @ 6 NONAME ; int CUpnpCdsLiteObjectArray::FindByNameAndParentId(class TDesC8 const &, class TDesC8 const &) + ?ParentId@CUpnpCdsLiteObject@@QAEAAVTDesC8@@XZ @ 7 NONAME ; class TDesC8 & CUpnpCdsLiteObject::ParentId(void) + ?FindByName@CUpnpCdsLiteObjectArray@@QAEHAAVTDesC8@@@Z @ 8 NONAME ; int CUpnpCdsLiteObjectArray::FindByName(class TDesC8 &) + ?ObjectClass@CUpnpCdsLiteObject@@QAEAAVTDesC8@@XZ @ 9 NONAME ; class TDesC8 & CUpnpCdsLiteObject::ObjectClass(void) + ?NewSharingApiL@CUPnPSharingAlgorithmFactory@@SAPAVMUpnpSharingAlgorithm@@XZ @ 10 NONAME ; class MUpnpSharingAlgorithm * CUPnPSharingAlgorithmFactory::NewSharingApiL(void) + ?NewL@CUpnpCdsLiteObjectArray@@SAPAV1@XZ @ 11 NONAME ; class CUpnpCdsLiteObjectArray * CUpnpCdsLiteObjectArray::NewL(void) + ?ObjectId@CUpnpCdsLiteObject@@QAEAAVTDesC8@@XZ @ 12 NONAME ; class TDesC8 & CUpnpCdsLiteObject::ObjectId(void) + ?AppendL@CUpnpCdsLiteObjectArray@@QAEXPAVCUpnpCdsLiteObject@@@Z @ 13 NONAME ; void CUpnpCdsLiteObjectArray::AppendL(class CUpnpCdsLiteObject *) + ??1CUpnpCdsLiteObjectArray@@UAE@XZ @ 14 NONAME ; CUpnpCdsLiteObjectArray::~CUpnpCdsLiteObjectArray(void) + ?Type@CUpnpCdsLiteObject@@QAE?AW4TCdsLiteObjectType@1@XZ @ 15 NONAME ; enum CUpnpCdsLiteObject::TCdsLiteObjectType CUpnpCdsLiteObject::Type(void) + ?FindByObjectId@CUpnpCdsLiteObjectArray@@QAEHABVTDesC8@@@Z @ 16 NONAME ; int CUpnpCdsLiteObjectArray::FindByObjectId(class TDesC8 const &) + ?SetOriginalItemIdL@CUpnpCdsLiteObject@@QAEXABVTDesC8@@@Z @ 17 NONAME ; void CUpnpCdsLiteObject::SetOriginalItemIdL(class TDesC8 const &) + ?OriginalItemIdL@CUpnpCdsLiteObject@@QAEAAVTDesC8@@XZ @ 18 NONAME ; class TDesC8 & CUpnpCdsLiteObject::OriginalItemIdL(void) + ?Count@CUpnpCdsLiteObjectArray@@QAEHXZ @ 19 NONAME ; int CUpnpCdsLiteObjectArray::Count(void) + ?ObjectAtL@CUpnpCdsLiteObjectArray@@QAEAAVCUpnpCdsLiteObject@@I@Z @ 20 NONAME ; class CUpnpCdsLiteObject & CUpnpCdsLiteObjectArray::ObjectAtL(unsigned int) + ?FindByMediaClassAndParentId@CUpnpCdsLiteObjectArray@@QAEHABVTDesC8@@0@Z @ 21 NONAME ; int CUpnpCdsLiteObjectArray::FindByMediaClassAndParentId(class TDesC8 const &, class TDesC8 const &) + ?Name@CUpnpCdsLiteObject@@QAEAAVTDesC8@@XZ @ 22 NONAME ; class TDesC8 & CUpnpCdsLiteObject::Name(void) + ?ChildCount@CUpnpCdsLiteObjectArray@@QAEHABVTDesC8@@@Z @ 23 NONAME ; int CUpnpCdsLiteObjectArray::ChildCount(class TDesC8 const &) + ?AppendL@CUpnpCdsLiteObjectArray@@QAEXPBVCUpnpObject@@@Z @ 24 NONAME ; void CUpnpCdsLiteObjectArray::AppendL(class CUpnpObject const *) + ?NewL@CUpnpCdsLiteObject@@SAPAV1@ABVTDesC8@@W4TCdsLiteObjectType@1@000@Z @ 25 NONAME ; class CUpnpCdsLiteObject * CUpnpCdsLiteObject::NewL(class TDesC8 const &, enum CUpnpCdsLiteObject::TCdsLiteObjectType, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &) + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/data/upnpsharingalgorithm.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/data/upnpsharingalgorithm.rss Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,110 @@ +/* +* 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: Main resource file +* +*/ + +// INCLUDES +#include +#include "upnpsharing.loc" + +//---------------------------------------------------------------------------- +// +// r_upnp_share_music_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_music_text + { + txt=qtn_iupnp_share_music; + } + +//---------------------------------------------------------------------------- +// +// r_upnp_share_image_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_image_text + { + txt=qtn_iupnp_share_images; + } + +//---------------------------------------------------------------------------- +// +// r_upnp_share_video_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_video_text + { + txt=qtn_iupnp_share_videos; + } + +//---------------------------------------------------------------------------- +// +// r_upnp_share_all_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_all_text + { + txt=qtn_iupnp_share_all; + } + +//---------------------------------------------------------------------------- +// +// r_upnp_share_by_date_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_by_date_text + { + txt=qtn_iupnp_share_by_date; + } + +//---------------------------------------------------------------------------- +// +// r_upnp_share_by_album_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_by_album_text + { + txt=qtn_iupnp_share_by_album; + } + +//---------------------------------------------------------------------------- +// +// r_upnp_share_by_artist_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_by_artist_text + { + txt=qtn_iupnp_share_by_artist; + } + +//---------------------------------------------------------------------------- +// +// r_upnp_share_by_genre_text +// +//---------------------------------------------------------------------------- +// +RESOURCE LBUF r_upnp_share_by_genre_text + { + txt=qtn_iupnp_share_by_genre; + } + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/eabi/upnpsharingalgorithmu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/eabi/upnpsharingalgorithmu.def Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,40 @@ +EXPORTS + _ZN18CUpnpCdsLiteObject11ObjectClassEv @ 1 NONAME + _ZN18CUpnpCdsLiteObject15OriginalItemIdLEv @ 2 NONAME + _ZN18CUpnpCdsLiteObject18SetOriginalItemIdLERK6TDesC8 @ 3 NONAME + _ZN18CUpnpCdsLiteObject4NameEv @ 4 NONAME + _ZN18CUpnpCdsLiteObject4NewLERK6TDesC8NS_18TCdsLiteObjectTypeES2_S2_S2_ @ 5 NONAME + _ZN18CUpnpCdsLiteObject4TypeEv @ 6 NONAME + _ZN18CUpnpCdsLiteObject8ObjectIdEv @ 7 NONAME + _ZN18CUpnpCdsLiteObject8ParentIdEv @ 8 NONAME + _ZN18CUpnpCdsLiteObjectD0Ev @ 9 NONAME + _ZN18CUpnpCdsLiteObjectD1Ev @ 10 NONAME + _ZN18CUpnpCdsLiteObjectD2Ev @ 11 NONAME + _ZN23CUpnpCdsLiteObjectArray10ChildCountERK6TDesC8 @ 12 NONAME + _ZN23CUpnpCdsLiteObjectArray10FindByNameER6TDesC8 @ 13 NONAME + _ZN23CUpnpCdsLiteObjectArray14FindByObjectIdERK6TDesC8 @ 14 NONAME + _ZN23CUpnpCdsLiteObjectArray15RemoveObjectAtLEj @ 15 NONAME + _ZN23CUpnpCdsLiteObjectArray21FindByNameAndParentIdERK6TDesC8S2_ @ 16 NONAME + _ZN23CUpnpCdsLiteObjectArray26FindRefItemIdByOriginalIdLERK6TDesC8 @ 17 NONAME + _ZN23CUpnpCdsLiteObjectArray27FindByMediaClassAndParentIdERK6TDesC8S2_ @ 18 NONAME + _ZN23CUpnpCdsLiteObjectArray4NewLEv @ 19 NONAME + _ZN23CUpnpCdsLiteObjectArray5CountEv @ 20 NONAME + _ZN23CUpnpCdsLiteObjectArray7AppendLEP18CUpnpCdsLiteObject @ 21 NONAME + _ZN23CUpnpCdsLiteObjectArray7AppendLEPK11CUpnpObject @ 22 NONAME + _ZN23CUpnpCdsLiteObjectArray7RemoveLEPK11CUpnpObject @ 23 NONAME + _ZN23CUpnpCdsLiteObjectArray9ObjectAtLEj @ 24 NONAME + _ZN23CUpnpCdsLiteObjectArrayD0Ev @ 25 NONAME + _ZN23CUpnpCdsLiteObjectArrayD1Ev @ 26 NONAME + _ZN23CUpnpCdsLiteObjectArrayD2Ev @ 27 NONAME + _ZN28CUPnPSharingAlgorithmFactory14NewSharingApiLEv @ 28 NONAME + _ZTI14CUpnpSharingAO @ 29 NONAME ; ## + _ZTI16CUpnpCdsReaderAO @ 30 NONAME ; ## + _ZTI18CUpnpCdsLiteObject @ 31 NONAME ; ## + _ZTI22CUpnpContainerResolver @ 32 NONAME ; ## + _ZTI23CUpnpCdsLiteObjectArray @ 33 NONAME ; ## + _ZTV14CUpnpSharingAO @ 34 NONAME ; ## + _ZTV16CUpnpCdsReaderAO @ 35 NONAME ; ## + _ZTV18CUpnpCdsLiteObject @ 36 NONAME ; ## + _ZTV22CUpnpContainerResolver @ 37 NONAME ; ## + _ZTV23CUpnpCdsLiteObjectArray @ 38 NONAME ; ## + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/group/bld.inf Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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: Build information file for UPnPSharingAlgorithm +* +*/ + +#include "../../../group/upnpplatformvar.hrh" + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/upnpsharingalgorithm.h |../../../inc/upnpsharingalgorithm.h +../inc/upnpcdsliteobject.h |../../../inc/upnpcdsliteobject.h +../inc/upnpcdsliteobjectarray.h |../../../inc/upnpcdsliteobjectarray.h +../inc/upnpsharingalgorithmfactory.h |../../../inc/upnpsharingalgorithmfactory.h + +PRJ_MMPFILES +upnpsharingalgorithm.mmp + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/group/upnpsharingalgorithm.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/group/upnpsharingalgorithm.mmp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,67 @@ +/** + * 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: Project definition file for UpnpSharingAlgorithm component + * + */ + +#include "../../../group/upnpplatformvar.hrh" +#include "../inc/upnpsharingalgorithmuids.hrh" +#include + +TARGET upnpsharingalgorithm.dll +TARGETTYPE dll +UID 0x1000008d KUPnPSharingAlgorithmDllUid + +// Capabilities +CAPABILITY CAP_GENERAL_DLL + +VENDORID VID_DEFAULT + +USERINCLUDE ../inc +USERINCLUDE ../../loc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE ../../../inc // ADO internal interfaces + +SOURCEPATH ../src +SOURCE upnpsharingalgorithmfactory.cpp +SOURCE upnpcdsliteobject.cpp +SOURCE upnpcdsliteobjectarray.cpp +SOURCE upnpsharingalgorithmimpl.cpp +SOURCE upnpcdsreaderao.cpp +SOURCE upnpsharingao.cpp +SOURCE upnpcontainerresolver.cpp + +// LIBRARIES +LIBRARY euser.lib +LIBRARY avmediaserverclient.lib // for file sharing +LIBRARY dlnaprofiler.lib // for resolving dlna profile +LIBRARY upnputilities.lib // for metadata fetching +LIBRARY inetprotutil.lib // for EscapeUtils +LIBRARY upnpavobjects.lib // for UpnpObjects +LIBRARY efsrv.lib // for TParse +LIBRARY bafl.lib // for file check and BaflUtils +LIBRARY charconv.lib // for CnvUtfConverter +LIBRARY platformenv.lib // for PathInfo +LIBRARY upnpavcontrollerhelper.lib // for UPnPItemUtility + +DEBUGLIBRARY flogger.lib + +START RESOURCE ../data/upnpsharingalgorithm.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpcdsliteobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpcdsliteobject.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,197 @@ +/* +* 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: Lite object for storing container/item structure +* +*/ + +#ifndef C_UPNP_CDS_LITE_OBJECT_H +#define C_UPNP_CDS_LITE_OBJECT_H + +// INCLUDES +#include + +/** + * Defines the CUpnpCdsLiteObject class. Used to store container/item + * structure of the CDS. + * + * @lib upnpsharingalgorithm.lib + * @since S60 5.2 + */ +class CUpnpCdsLiteObject : public CBase + { + + public: // Enums + + enum TCdsLiteObjectType + { + EContainer = 1, + EItem, + EItemReference, + EUnknown + }; + + public: // Constructors and destructors + + /** + * Two-phased constructor. Leaves with KErrArgument if the given + * parameters are not valid. Can also leave in case of out-of-memory. + * + * @since S60 5.2 + * @param aName, filename/container title of the object + * @param aType, type of the object + * @param aObjectId, CDS object ID of the object + * @param aParentId, CDS object ID of the parent object + * @param aObjectClass, object class type + * @return CDSLite object + */ + IMPORT_C static CUpnpCdsLiteObject* NewL( const TDesC8 &aName, + const TCdsLiteObjectType aType, + const TDesC8 &aObjectId, + const TDesC8 &aParentId, + const TDesC8 &aObjectClass ); + + /** + * Destructor. + * + * @since S60 5.2 + */ + IMPORT_C virtual ~CUpnpCdsLiteObject(); + + public: // Business logic methods + + /** + * Returns the name of the object. For UpnpItems and UpnpItemRefences + * this is the filename (including filepath). For UpnpContainer this + * it the title of the container. + * + * @since S60 5.2 + * @return object name + */ + IMPORT_C TDesC8& Name(); + + /** + * Returns the type of the object + * + * @since S60 5.2 + * @return object type + */ + IMPORT_C CUpnpCdsLiteObject::TCdsLiteObjectType Type(); + + /** + * Returns the CDS object ID of the object + * + * @since S60 5.2 + * @return object id + */ + IMPORT_C TDesC8& ObjectId(); + + /** + * Returns the CDS object ID of the parent object + * + * @since S60 5.2 + * @return parent object id + */ + IMPORT_C TDesC8& ParentId(); + + /** + * Returns the object class + * + * @since S60 5.2 + * @return object class + */ + IMPORT_C TDesC8& ObjectClass(); + + /** + * Returns the CDS object ID of the original object. Leaves with + * KErrNotSupported if the type of the object is not EItemReference. + * Can also leave in case of out-of-memory. + * + * @since S60 5.2 + * @return original item id + */ + IMPORT_C TDesC8& OriginalItemIdL(); + + /** + * Sets the CDS object ID of the original object. Leaves with + * KErrArgument if the given parameter is not valid. Can also leave + * in case of out-of-memory. + * + * @since S60 5.2 + * @param aOriginalItemId, CDS object ID of the original UpnpItem + */ + IMPORT_C void SetOriginalItemIdL( const TDesC8 &aOriginalItemId ); + + private: // Constructors + + /** + * Default c++ constructor + * + * @since S60 5.2 + */ + CUpnpCdsLiteObject(); + + /** + * Second-phase constructor. + * + * @since S60 5.2 + * @param aName, filename/container title of the object + * @param aType, type of the object + * @param aObjectId, CDS object ID of the object + * @param aParentId, CDS object ID of the parent object + * @param aObjectClass, object class type + */ + void ConstructL( const TDesC8 &aName, + const TCdsLiteObjectType aType, + const TDesC8 &aObjectId, + const TDesC8 &aParentId, + const TDesC8 &aObjectClass ); + + private: // Data members + + /** + * The type of the object + */ + TCdsLiteObjectType iType; + + /** + * The name of the object. Owned. + */ + HBufC8* iName; + + /** + * The CDS object ID. Owned. + */ + HBufC8* iObjectId; + + /** + * The CDS object ID of the parent container. Owned. + */ + HBufC8* iParentId; + + /** + * The CDS object class type. Owned. + */ + HBufC8* iObjectClass; + + /** + * The CDS object ID of the original UpnpItem to which this + * reference item points to. Used only if the type is EItemReference. + * Owned. + */ + HBufC8* iOriginalItemId; + + }; + +#endif /* C_UPNP_CDS_LITE_OBJECT_H */ +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpcdsliteobjectarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpcdsliteobjectarray.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,230 @@ +/* +* 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: Array to store the CUpnpCdsLiteObject objects +* +*/ + +#ifndef C_UPNP_CDS_LITE_OBJECT_ARRAY_H +#define C_UPNP_CDS_LITE_OBJECT_ARRAY_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CUpnpCdsLiteObject; +class CUpnpObject; + +/** + * Defines the CUpnpCdsLiteObjectArray class. Used to store container/item + * structure of the CDS. + * + * @lib upnpsharingalgorithm.lib + * @since S60 5.2 + */ +class CUpnpCdsLiteObjectArray : public CBase + { + + public: // Constructors and destructors + + /** + * Two-phased constructor. Leaves in case of out-of-memory. + * + * @since S60 5.2 + * @return array of cdsliteobjects + */ + IMPORT_C static CUpnpCdsLiteObjectArray* NewL(); + + /** + * Destructor. + * + * @since S60 5.2 + */ + IMPORT_C virtual ~CUpnpCdsLiteObjectArray(); + + public: // Business logic methods + + /** + * Adds one object to the array. Ownership of the object is transfered. + * Leaves with KErrArgument if the given object is not valid. + * + * @since S60 5.2 + * @param aObject, the object + */ + IMPORT_C void AppendL( CUpnpCdsLiteObject *aObject ); + + /** + * Adds one object to the array. Leaves with KErrArgument if the given + * object is not valid. + * + * @since S60 5.2 + * @param aObject, the UPnPObject object + */ + IMPORT_C void AppendL( const CUpnpObject *aObject ); + + /** + * Finds a CUpnpCdsLiteObject object from the array. Returns + * KErrNotFound if object not found. + * + * @since S60 5.2 + * @param aName, title of a container / filename + * @return index of the array where the object resides + */ + IMPORT_C TInt FindByName( TDesC8& aName ); + + /** + * Finds a CUpnpCdsLiteObject object with defined parent id + * from the array. Returns KErrNotFound if object not found. + * + * @since S60 5.2 + * @param aName, title of a container / filename + * @param aParentId, parent id of a container / filename + * @return index of the array where the object resides + */ + IMPORT_C TInt FindByNameAndParentId( const TDesC8& aName, + const TDesC8& aParentId ); + + /** + * Finds a CUpnpCdsLiteObject object that have defined media + * class and parent id. Returns KErrNotFound if object not found. + * + * @since S60 5.2 + * @param aMediaClass, class type of a container / filename + * @param aParentId, parent id of a container / filename + * @return index of the array where the object resides + */ + IMPORT_C TInt FindByMediaClassAndParentId( const TDesC8& aMediaClass, + const TDesC8& aParentId ); + + /** + * Finds a CUpnpCdsLiteObject object from the array. Returns + * KErrNotFound if object not found. + * + * @since S60 5.2 + * @param aObjectId, the object ID + * @return index of the array where the object resides + */ + IMPORT_C TInt FindByObjectId( const TDesC8& aObjectId ); + + /** + * Finds a CUpnpCdsLiteObject object index from the array using + * original item's id as a search parameter. Returns KErrNotFound + * if object not found. + * Can leave with symbian error codes. + * + * @since S60 5.2 + * @param aOriginalId, original item id + * @return index of the array where the object resides + */ + IMPORT_C TInt FindRefItemIdByOriginalIdL( + const TDesC8& aOriginalId ); + + /** + * Returns the child count of a container + * + * @since S60 5.2 + * @param aParentId, parent object id + * @return child count + */ + IMPORT_C TInt ChildCount( const TDesC8& aParentId ); + + /** + * Returns the object count of the array + * + * @since S60 5.2 + * @return item count + */ + IMPORT_C TInt Count( ); + + /** + * Returns an object from the array. Does not remove the object from + * the array. Leaves with KErrArgument if the given index is out of + * bounds. + * + * @since S60 5.2 + * @param aIndex, index of the array + * @return the object + */ + IMPORT_C CUpnpCdsLiteObject& ObjectAtL( TUint aIndex ); + + /** + * Removes an object from the array. Leaves with KErrArgument if the + * given index is out of bounds. + * + * @since S60 5.2 + * @param aIndex, index of the array + */ + IMPORT_C void RemoveObjectAtL( TUint aIndex ); + + /** + * Searches the array looking for the matching item, if one is found + * it is removed from the array. Leaves with KErrArgument if the given + * object is not valid. + * + * @since S60 5.2 + * @param aObject, the UPnPObject object + */ + IMPORT_C void RemoveL( const CUpnpObject *aObject ); + + private: // Private business logic methods + + /** + * Creates an CUpnpCdsLiteObject. Leaves with KErrArgument if the + * given object is not valid. + * + * @since S60 5.2 + * @param aObject, the UPnPObject object + * @return a new CUpnpCdsLiteObject + */ + CUpnpCdsLiteObject* CreateUpnpCdsLiteObjectL( + const CUpnpObject *aObject ); + + /** + * Resolves the filename information from the given UpnpObject. Leaves + * with KErrArgument if the given object is not valid. + * Allocates memory for the returned descriptor. Does not handle the + * freeing of the allocation. + * + * @since S60 5.2 + * @param aObject, the UPnPObject object + * @return the filename (including path) + */ + HBufC8* ResolveFileNameL( const CUpnpObject *aObject ); + + private: // Constructors + + /** + * Default c++ constructor + * + * @since S60 5.2 + */ + CUpnpCdsLiteObjectArray() {}; + + /** + * Second-phase constructor. + * + * @since S60 5.2 + */ + void ConstructL() {}; + + private: // Data members + + /** + * The array of objects. Owned. + */ + RPointerArray iArray; + + }; + +#endif /* C_UPNP_CDS_LITE_OBJECT_ARRAY_H */ +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpcdsreaderao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpcdsreaderao.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,154 @@ +/** + * 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 : CUpnpCdsReaderAO class definiton + * + */ + +#ifndef UPNP_CDS_READER_AO_H +#define UPNP_CDS_READER_AO_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CUpnpItem; +class CUpnpFileSharing; +class CUpnpCdsLiteObjectArray; + +/** + * CUpnpCdsReaderAO class definition + * + * @lib upnpsharingalgorithm.lib + * @since S60 5.2 + */ +class CUpnpCdsReaderAO : public CActive + { + +public: + // Constructors and destructor. + + /** + * Two-phased constructor. + * + * @param aUpnpCdsLiteObjects, reference to the array of cds objects + */ + static CUpnpCdsReaderAO* NewL( + CUpnpCdsLiteObjectArray &aUpnpCdsLiteObjects ); + + /** + * Destructor. + */ + virtual ~CUpnpCdsReaderAO(); + +public: + /** + * Reads the shared stucture from content directory to the array passed + * as parameter to the NewL + * + * @since S60 5.2 + */ + void ReadCdsStructureL(); + +protected: + + // From base class CActive + + /** + * From CActive + * See base class definition + */ + void RunL(); + + /** + * From CActive + * See base class definition + */ + void DoCancel(); + +private: + + /** + * Second-phase constructor. + */ + void ConstructL(); + + /** + * C++ default constructor. + * @param aUpnpCdsLiteObjects, reference to the array of cds objects + */ + CUpnpCdsReaderAO( CUpnpCdsLiteObjectArray &aUpnpCdsLiteObjects ): + CActive( CActive::EPriorityStandard ), + iUpnpCdsLiteObjects( aUpnpCdsLiteObjects ) {} + + /** + * Waits that request completes + * This does not block other AO's + * + * @since S60 5.2 + */ + void WaitRequestToComplete(); + + /** + * Stops waiting request complete + * + * @since S60 5.2 + */ + void StopWaitingRequestComplete(); + + /** + * Get container and analyse container objects + * + * @since S60 5.2 + * @param aContainerId, where items and containers are searched + */ + void GetContainersL( const TDesC8& aContainerId ); + + /** + * Gets all file objects of one container + * + * @since S60 5.2 + * @param aContainerId where items are searched + */ + void GetItemsL( const TDesC8& aContainerId ); + + /** + * Sets the object active and waits for the request to complete + * + * @since S60 5.2 + */ + void CompleteRequestL(); + +private: + + /** + * MediaServer file sharing instance - owned + */ + CUpnpFileSharing* iFileSharing; + /** + * Waits request to complete - owned + */ + CActiveSchedulerWait* iWaitRequest; + /** + * Object array + */ + CUpnpCdsLiteObjectArray& iUpnpCdsLiteObjects; + /** + * Active scheduler pointer + */ + CActiveScheduler* iScheduler; + }; + +#endif // UPNPCDSREADERAO_H + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpcontainerresolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpcontainerresolver.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,232 @@ +/* +* 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: Header file for the CUpnpContainerResolver class. +* +*/ + +#ifndef C_UPNP_CONTAINER_RESOLVER_H +#define C_UPNP_CONTAINER_RESOLVER_H + +#include +#include // for RResourceFile +#include +#include "upnpcdsliteobjectarray.h" + +// FORWARD DECLARTIONS +class CUpnpItem; + +// CLASS DECLARATION + +/** +* CUpnpContainerResolver class definition +* +* @lib upnpsharingalgorithm.lib +* @since S60 5.2 +*/ +class CUpnpContainerResolver : public CBase + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @since S60 5.2 + * @param aCdsLiteObjectArray, array of cds objects + * @return container resolver object + */ + static CUpnpContainerResolver* NewL( + CUpnpCdsLiteObjectArray& aCdsLiteObjectArray ); + + /** + * Destructor. + * + * @since S60 5.2 + */ + virtual ~CUpnpContainerResolver(); + + /** + * Resolves containers that need to be created. + * Container list is returned to the caller. + * + * @since S60 5.2 + * @param aItem, upnp item to be shared + * @return RPointerArray, array containing created containers + */ + RPointerArray + ResolveContainerStructureL( CUpnpItem& aItem ); + + /** + * Resolves containers that need to be created for a reference item. + * Container list is returned to the caller. + * + * @since S60 5.2 + * @param aType, reference media type + * @param aItem, upnp item to be shared + * @return RPointerArray, array containing created containers + */ + RPointerArray + ResolveReferenceContainersL( TInt aType, CUpnpItem& aItem ); + + /** + * Resolves containers that need to be removed (containers + * that does not contain items anymore) after an item + * has been unshared + * + * @since S60 5.2 + * @param aContainerId, Container id where item belongs. + * @return RPointerArray, containers to be removed + */ + RPointerArray + ResolveEmptyContainersL( TDesC8& aContainerId ); + + private: // Second-phase contstruction + + /** + * Default c++ constructor + * + * @since S60 5.2 + * @param aCdsLiteObjectArray, array of cds objects + */ + CUpnpContainerResolver( + CUpnpCdsLiteObjectArray& aCdsLiteObjectArray ): + iCdsLiteObjectArray( aCdsLiteObjectArray ) {} + + /** + * Second-phase constructor. + * + * @since S60 5.2 + */ + void ConstructL(); + + /** + * Creates a new UpnpContainer according to the given parameters + * + * @since S60 5.2 + * @param aTitle, title of created container + * @param aClass, class of created container + * @return CUpnpContainer, created container + */ + CUpnpContainer* CreateContainerL( const TDesC8& aTitle, + const TDesC8& aClass ); + + /** + * Finds non-existing containers from CDS and creates them. + * If new containers are not created, returned parent id + * is for item, otherwise for last found container + * + * @since S60 5.2 + * @param aContainerNames, container names to be resolved + * @param aContainers, containers that need to be shared + * @param aMediaClass, media class type + * @return HBufC8, parent id of a container / item + */ + HBufC8* CreateContainersL( + RPointerArray& aContainerNames, + RPointerArray& aContainers, + const TDesC8& aMediaClass ); + + + /** + * Reads resource text from component resource file. + * + * @since S60 5.2 + * @param aResourceId, resource id + * @return HBufC8, resource text + */ + HBufC8* ReadResourceTextL( TInt aResourceId ); + + /** + * Finds element value of a certain element + * + * @since S60 5.2 + * @param elements, element array + * @return HBufC8, element value + */ + HBufC8* GetElementL( const RUPnPElementsArray& elements, + const TDesC8& aElement ); + + /** + * Modifies aDate parameter so that month and day + * values are decreased by one. This is because + * month and day count need to be started from + * zero, not from 1. + * + * @since S60 5.2 + * @param aDate, date to be adjusted + * @return HBufC8, adjusted date + */ + HBufC8* AdjustDateL( const TDesC8& aDate ); + + /** + * Adds date containers to the aContainerNames + * list. Year, Month and Day are added separately. + * Returns KErrNotFound, if date metadata is missing. + * + * @since S60 5.2 + * @param aContainerNames, list of containers + * @param aElements, list of item elements + * @return TInt, error code + */ + TInt AddByDateContainersL( + RPointerArray& aContainerNames, + const RUPnPElementsArray& aElements ); + + /** + * Finds an element and modifies element value so + * that only the first letter of the element is + * capitalized. Modified element value is appended + * to the aContainerNames array. Returns KErrNotFound, + * if date metadata is missing. + * + * @since S60 5.2 + * @param aContainerNames, list of containers + * @param aElements, list of item elements + * @param aElementType, element type + */ + void ModifyAndAppendElementL( + RPointerArray& aContainerNames, + const RUPnPElementsArray& aElements, + const TDesC8& aElementType ); + + /** + * Appends container name to array. + * Container name is read from resource. + * @since S60 5.2 + * @param aArray, array of container names + * @param TInt, resource text id + */ + void AppendContainerNameToArrayL( RPointerArray& aArray, + TInt aResourceTextId ); + private: // Data members + + /** + * Reference to the object array + */ + CUpnpCdsLiteObjectArray& iCdsLiteObjectArray; + + /** + * Resource file. Owned + */ + RResourceFile iResourceFile; + + /** + * File server session. Owned + */ + RFs iFs; + }; + +#endif // C_UPNP_CONTAINER_RESOLVER_H + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithm.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,89 @@ +/* +* 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: upnpsharingalgorithm interface +* +*/ + +#ifndef M_UPNP_SHARING_ALGORITHM_H +#define M_UPNP_SHARING_ALGORITHM_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CUpnpCdsLiteObjectArray; + +/** + * Defines the upnp sharing algorithm interface + * + * @lib upnpsharingalgorithm.lib + * @since S60 5.2 + */ +class MUpnpSharingAlgorithm + { + +public: + + /** + * Shares the given file using the local M-DMS. Does not share the same + * file twice. Checks the validity of the parameter, existance of the + * file and drm protection. Leaves with KErrArgument if the given + * parameter is invalid or if the file does not exist. Leaves with + * KErrAccessDenied if the file is drm protected. Leaves normally if + * out-of-memory. + * + * @since S60 5.2 + * @param aFileName, file to be shared + */ + virtual void ShareFileL( const TFileName &aFileName ) = 0; + + /** + * Unshares the given file using the local M-DMS. Does not do anything if + * the file is not shared. Leaves with KErrCorrupt if the component's + * internal object array is corrupted. Leaves normally if out-of-memory. + * + * @since S60 5.2 + * @param aFileName, file to be unshared + */ + virtual void UnshareFileL( const TFileName &aFileName ) = 0; + + /** + * Reads the shared content from UPnPSharingalgoritm + * + * @since S60 5.2 + * @return a reference to the shared content array in UPnPSharingalgoritm. + */ + virtual CUpnpCdsLiteObjectArray& ReadSharedContent() = 0; + + /** + * Deletes the object and frees its resources. + * + * @since S60 5.2 + */ + virtual void Close() = 0; + + /** + * Check if item is shared based on item filename + * + * @since S60 5.2 + * @param aFileName, file to be checked + * @return TBool, ETrue if item is shared, EFalse otherwise + */ + virtual TBool IsFileSharedL( const TFileName &aFileName ) = 0; + }; + +#endif /* M_UPNP_SHARING_ALGORITHM_H */ + +// End of File + diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmconstants.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,53 @@ +/* +* 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: UpnpSharingAlgoritm component constants +* +*/ + +#ifndef UPNP_SHARING_ALGORITHM_CONSTANTS_H +#define UPNP_SHARING_ALGORITHM_CONSTANTS_H + +// DEBUG file name +_LIT( KComponentLogfile, "upnpsharingalgorithm.txt"); + +// Resource file +_LIT( KSharingAlgorithmRscFile, "\\resource\\upnpsharingalgorithm.rsc" ); + +// CDS Browse filter criteria +_LIT8( KBrowseCriteriaFilter, "*" ); + +// CDS Container names +_LIT8( KRootContainer, "0" ); + +// CDS container class types +_LIT8( KMusicClassContainer, "object.container.music" ); +_LIT8( KImageClassContainer, "object.container.image" ); +_LIT8( KVideoClassContainer, "object.container.video" ); +_LIT8( KContainerClass, "object.container" ); +_LIT8( KItemClass, "object.item" ); + +// Metadata container types +enum TMetadataContainerTypes + { + EGenreType = 0, + EAlbumType, + EArtistType, + EMusicByDateType, + EImageByDateType, + EVideoByDateType + }; + +#endif // UPNP_SHARING_ALGORITHM_CONSTANTS_H + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmfactory.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,50 @@ +/* +* 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: Factory for UPnPSharingAlgorithm +* +*/ + + +#ifndef C_UPNP_SHARING_ALGORITHM_FACTORY_H +#define C_UPNP_SHARING_ALGORITHM_FACTORY_H + +#include +#include + +// Forward declarations +class MUpnpSharingAlgorithm; + +/** + * Factory for UPnPSharingAlgorithm + * + * @lib upnpsharingalgorithm.lib + * @since S60 5.2 + */ +class CUPnPSharingAlgorithmFactory : public CBase + { + +public: + + /** + * Creates a new instance of UpnpSharingAlgorithm + * + * @since S60 5.2 + * @return pointer of type MUpnpSharingAlgorithm class + */ + IMPORT_C static MUpnpSharingAlgorithm* NewSharingApiL(); + + }; + +#endif // C_UPNP_SHARING_ALGORITHM_FACTORY_H +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmimpl.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,231 @@ +/* +* 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: Header file for the CUPnPSharingAlgorithm class. +* +*/ + +#ifndef C_UPNP_SHARING_ALGORITHM_IMPL_H +#define C_UPNP_SHARING_ALGORITHM_IMPL_H + +// INCLUDES +#include +#include "upnpsharingalgorithm.h" + +// FORWARD DECLARATIONS +class CUpnpContainer; +class CUpnpItem; +class CUpnpSharingAO; +class CUpnpCdsLiteObjectArray; +class CUpnpCdsLiteObject; +class CUpnpContainerResolver; + +// CLASS DECLARATION + +/** +* CUPnPSharingAlgorithm class definition +* +* @lib upnpsharingalgorithm.lib +* @since S60 5.2 +*/ +NONSHARABLE_CLASS( CUpnpSharingAlgorithmImpl ) + : public CBase, + MUpnpSharingAlgorithm + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CUpnpSharingAlgorithmImpl* NewL(); + + /** + * Two-phased constructor. + */ + static CUpnpSharingAlgorithmImpl* NewLC(); + + /** + * Destructor. + */ + virtual ~CUpnpSharingAlgorithmImpl(); + + public: + + /** + * Check if item is shared based on item filename + * + * @since S60 5.2 + * @param aFileName, file to be checked + * @return TBool, ETrue if item is shared, EFalse otherwise + */ + IMPORT_C TBool IsFileSharedL( const TFileName &aFileName ); + + public: + + // From base class MUpnpSharingAlgorithm + + /** + * From MUpnpSharingAlgorithm + * See base class definition + */ + void ShareFileL( const TFileName &aFileName ); + + /** + * From MUpnpSharingAlgorithm + * See base class definition + */ + void UnshareFileL( const TFileName &aFileName ); + + /** + * From MUpnpSharingAlgorithm + * See base class definition + */ + CUpnpCdsLiteObjectArray& ReadSharedContent( ); + + /** + * From MUpnpSharingAlgorithm + * See base class definition + */ + void Close(); + + private: // Private business logic methods + + /** + * Checks if file exists + * Leaves with KErrArgument if file not exist + * + * @since S60 5.2 + * @param aFileName, filename with path + */ + void CheckFileExistenceL( const TFileName& aFileName ); + + /** + * Checks if there are empty containers in the tree and + * unshares them + * Leaves with symbian error codes in error cases + * + * @since S60 5.2 + * @param aParentId, parent container id where item locates + * @return TBool, ETrue if container is unshared, EFalse otherwise + */ + TBool UnshareEmptyContainersL( TDesC8& aParentId ); + + /** + * Shares containers based on item metadata + * Leaves with Symbian error codes if error + * + * @since S60 5.2 + * @param aContainerArray, container structure for item + */ + void ShareContainersL( + RPointerArray& aContainerArray ); + + /** + * Unshares objects and removes from cdsliteobjectarray + * Leaves with Symbian error codes if error + * + * @since S60 5.2 + * @param aContainerArray, container structure + */ + void RemoveSharedObjectsL( + RPointerArray& aContainerArray ); + + /** + * Shares reference items with containers + * Leaves with Symbian error codes if error + * + * @since S60 5.2 + * @param aItem, item to be shared + */ + void ShareReferenceObjectsL( CUpnpItem* aItem ); + + /** + * Shares reference item with container + * Leaves with Symbian error codes if error + * + * @since S60 5.2 + * @param aContainerArray, reference container array + * @param aOriginalObject, original item + * @param aItem, reference item to be shared. Item gets data on + * sharing based on original item data + */ + void ShareReferenceObjectL( + RPointerArray& aContainerArray, + CUpnpCdsLiteObject& aOriginalObject, + CUpnpItem& aItem ); + + /** + * Finds original object's reference objects and ushares them. + * Leaves with Symbian error codes if error + * + * @since S60 5.2 + * @param aOriginalObject, original cds object + */ + void UnshareReferenceObjectsL( CUpnpCdsLiteObject& aOriginalObject ); + + /** + * Starts server offline mode if not started yet + * + * @since S60 5.2 + */ + void StartServer(); + + /** + * Checks if file is protected + * Leaves with KErrAccessDenied if file is protected + * + * @since S60 5.2 + * @param aFileName, filename with path + */ + void CheckFileProtectionL( const TFileName& aFileName ); + + private: // Second-phase contstruction + + /** + * Default c++ constructor + */ + CUpnpSharingAlgorithmImpl() {}; + + /** + * Second-phase constructor. + */ + void ConstructL(); + + private: // Data members + + /** + * Asyncronous file sharing handler. Owned + */ + CUpnpSharingAO* iSharingAO; + + /** + * Shared content array. Owned. + */ + CUpnpCdsLiteObjectArray* iSharedContentArray; + + /** + * Media server session handle. Owned + */ + RUpnpMediaServerClient iMediaServer; + + /** + * Container structure resolver. Owned + */ + CUpnpContainerResolver* iContainerResolver; + + }; + +#endif // C_UPNP_SHARING_ALGORITHM_IMPL_H + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmuids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpsharingalgorithmuids.hrh Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,25 @@ +/* +* 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: UpnpSharingAlgoritm component uids +* +*/ + +#ifndef UPNP_SHARING_ALGORITHM_UIDS_H +#define UPNP_SHARING_ALGORITHM_UIDS_H + +#define KUPnPSharingAlgorithmDllUid 0x20022E6E + +#endif // UPNP_SHARING_ALGORITHM_UIDS_H + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/inc/upnpsharingao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/inc/upnpsharingao.h Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,183 @@ +/** + * 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 : CUpnpSharingAO class definiton + * + */ + +#ifndef UPNP_SHARING_AO_H +#define UPNP_SHARING_AO_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CUpnpItem; +class CUpnpFileSharing; + +/** + * UpnpSharingAO class definition + * + * @lib upnpsharingalgorithm.lib + * @since S60 5.2 + */ +class CUpnpSharingAO : public CActive + { + + public: + // Constructors and destructor. + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CUpnpSharingAO* NewL(); + + /** + * Two-phased constructor. + * @since S60 5.2 + */ + static CUpnpSharingAO* NewLC(); + + /** + * Destructor. + * @since S60 5.2 + */ + virtual ~CUpnpSharingAO(); + + public: + + /** + * Shares file + * + * @since S60 5.2 + * @param aParentContainerId, parent container id where + * item is shared + * @param aItem, UpnpItem to be shared + */ + void ShareFileL( const TDesC8& aParentContainerId, + CUpnpItem* aItem ); + + /** + * Shares reference item based on original items id. + * Item data is filled on sharing. + * + * @since S60 5.2 + * @param aParentContainerId, parent container id where + * item is shared + * @param aOriginalItemId, original item id from + * which reference is created + * @param aItem, reference UpnpItem to be shared + */ + void ShareReferenceL( const TInt aParentContainerId, + const TInt aOriginalItemId, + CUpnpItem* aItem ); + + /** + * Shares container + * + * @since S60 5.2 + * @param aContainer, Container object which is going to be shared + */ + void ShareContainerL( CUpnpContainer* aContainer ); + + /** + * Unshares file + * + * @since S60 5.2 + * @param aItemId, itemid of UPnPItem to be shared + */ + void UnshareFileL( const TInt aItemId ); + + /** + * Unshares container + * + * @since S60 5.2 + * @param aContainerId, id for container which is going to be unshared + */ + void UnshareContainerL( const TInt aContainerId ); + + protected: + + // From base class CActive + + /** + * From CActive + * See base class definition + */ + void RunL(); + + /** + * From CActive + * See base class definition + */ + void DoCancel(); + + private: + + /** + * Second-phase constructor. + * + * @since S60 5.2 + */ + void ConstructL(); + + /** + * C++ default constructor. + * @since S60 5.2 + */ + CUpnpSharingAO::CUpnpSharingAO() : + CActive( CActive::EPriorityStandard ) {} + + /** + * Waits that request completes + * This does not block other AO's + * + * @since S60 5.2 + */ + void WaitRequestToComplete(); + + /** + * Stops waiting request complete + * + * @since S60 5.2 + */ + void StopWaitingRequestComplete(); + + /** + * Sets the object active and waits for the request to complete + * + * @since S60 5.2 + */ + void CompleteRequestL(); + + private: + + /** + * MediaServer file sharing instance. Owned + */ + CUpnpFileSharing* iFileSharing; + + /** + * Waits request to complete. Owned + */ + CActiveSchedulerWait* iWaitRequest; + + /** + * Active scheduler pointer. Owned. + */ + CActiveScheduler* iScheduler; + }; + +#endif // UPNP_SHARING_AO_H +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/src/upnpcdsliteobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/src/upnpcdsliteobject.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,197 @@ +/* +* 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: Implementation of CUpnpCdsLiteObject +* +*/ + +// INCLUDE FILES +#include "upnpcdsliteobject.h" +#include "upnpsharingalgorithmconstants.h" +#include "upnplog.h" + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::NewL +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpCdsLiteObject* CUpnpCdsLiteObject::NewL( const TDesC8 &aName, + const TCdsLiteObjectType aType, + const TDesC8 &aObjectId, + const TDesC8 &aParentId, + const TDesC8 &aObjectClass ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObject::NewL" ); + + // Verify the validity of the parameters + if( aName == KNullDesC8 || + aObjectId == KNullDesC8 || + aParentId == KNullDesC8 || + aObjectClass == KNullDesC8 || + ( aType != EContainer && + aType != EItem && + aType != EItemReference ) ) + { + User::Leave( KErrArgument ); + } + + CUpnpCdsLiteObject* self = new ( ELeave ) CUpnpCdsLiteObject(); + CleanupStack::PushL( self ); + self->ConstructL( aName, aType, aObjectId, aParentId, aObjectClass ); + CleanupStack::Pop( self ); + + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::CUpnpCdsLiteObject +// -------------------------------------------------------------------------- +// +CUpnpCdsLiteObject::CUpnpCdsLiteObject() + { + iType = EUnknown; + iName = NULL; + iObjectId = NULL; + iParentId = NULL; + iObjectClass = NULL; + iOriginalItemId = NULL; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::~CUpnpCdsLiteObject +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpCdsLiteObject::~CUpnpCdsLiteObject() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObject::\ +~CUpnpCdsLiteObject" ); + delete iName; + iName = NULL; + + delete iObjectId; + iObjectId = NULL; + + delete iParentId; + iParentId = NULL; + + delete iObjectClass; + iObjectClass = NULL; + + delete iOriginalItemId; + iOriginalItemId = NULL; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::ConstructL +// -------------------------------------------------------------------------- +// +void CUpnpCdsLiteObject::ConstructL( const TDesC8 &aName, + const TCdsLiteObjectType aType, + const TDesC8 &aObjectId, + const TDesC8 &aParentId, + const TDesC8 &aObjectClass ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObject::ConstructL" ); + + iType = aType; + iName = aName.AllocL(); + iObjectId = aObjectId.AllocL(); + iParentId = aParentId.AllocL(); + iObjectClass = aObjectClass.AllocL(); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::Name +// -------------------------------------------------------------------------- +// +EXPORT_C TDesC8& CUpnpCdsLiteObject::Name() + { + return *iName; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::Type +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpCdsLiteObject::TCdsLiteObjectType CUpnpCdsLiteObject::Type() + { + return iType; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::ObjectId +// -------------------------------------------------------------------------- +// +EXPORT_C TDesC8& CUpnpCdsLiteObject::ObjectId() + { + return *iObjectId; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::ParentId +// -------------------------------------------------------------------------- +// +EXPORT_C TDesC8& CUpnpCdsLiteObject::ParentId() + { + return *iParentId; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::ObjectClass +// -------------------------------------------------------------------------- +// +EXPORT_C TDesC8& CUpnpCdsLiteObject::ObjectClass() + { + return *iObjectClass; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::OriginalItemIdL +// -------------------------------------------------------------------------- +// +EXPORT_C TDesC8& CUpnpCdsLiteObject::OriginalItemIdL() + { + if( iType != EItemReference ) + { + User::Leave( KErrNotSupported ); + } + + return *iOriginalItemId; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObject::SetOriginalItemIdL +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpCdsLiteObject::SetOriginalItemIdL( + const TDesC8 &aOriginalItemId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObject::\ +SetOriginalItemIdL" ); + + // Check the parameter + if( aOriginalItemId == KNullDesC8 ) + { + User::Leave( KErrArgument ); + } + + // Delete the previously set value (if set) + if( iOriginalItemId ) + { + delete iOriginalItemId; + iOriginalItemId = NULL; + } + + iOriginalItemId = aOriginalItemId.AllocL(); + } + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/src/upnpcdsliteobjectarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/src/upnpcdsliteobjectarray.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,494 @@ +/* +* 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: Implementation of CUpnpCdsLiteObjectArray +* +*/ + +// INCLUDE FILES, SYSTEM +#include // TParse +#include // const_cast +#include // ConvertFromUnicodeToUtf8L +#include +#include +#include +#include +#include "upnpconstantdefs.h" + +// INCLUDE FILES, USER +#include "upnpcdsliteobject.h" +#include "upnpcdsliteobjectarray.h" +#include "upnpsharingalgorithmconstants.h" +#include "upnplog.h" + +// CONSTANTS +_LIT8( KSpace, " "); + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::NewL +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpCdsLiteObjectArray* CUpnpCdsLiteObjectArray::NewL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::NewL" ); + + CUpnpCdsLiteObjectArray* self = new ( ELeave ) CUpnpCdsLiteObjectArray(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::~CUpnpCdsLiteObjectArray +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpCdsLiteObjectArray::~CUpnpCdsLiteObjectArray() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ +~CUpnpCdsLiteObjectArray" ); + + // Empty and close the array + iArray.ResetAndDestroy(); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::AppendL +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpCdsLiteObjectArray::AppendL( CUpnpCdsLiteObject *aObject ) + { + // Validate the parameter + if( !aObject || + aObject->Name() == KNullDesC8 || + aObject->ObjectId() == KNullDesC8 || + aObject->ParentId() == KNullDesC8 || + aObject->ObjectClass() == KNullDesC8 || + ( aObject->Type() != CUpnpCdsLiteObject::EContainer && + aObject->Type() != CUpnpCdsLiteObject::EItem && + aObject->Type() != CUpnpCdsLiteObject::EItemReference ) || + ( aObject->Type() == CUpnpCdsLiteObject::EItemReference && + aObject->OriginalItemIdL() == KNullDesC8 ) ) + { + User::Leave( KErrArgument ); + } + + // Append the item into the array. Leave if there is a problem. + TInt appendError = iArray.Append( aObject ); + if( appendError != KErrNone ) + { + User::Leave( appendError ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::FindByName +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByName( TDesC8& aName ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::FindByName" ); + TInt returnvalue = KErrNotFound; + + // Continue only if the given parameter is valid + if( aName != KNullDesC8 ) + { + // Go through the array + for( TInt index=0; indexName() ) >= 0 ) + { + returnvalue = index; + index = iArray.Count() + 1; + } + } + } + return returnvalue; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::FindByNameAndParentId +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByNameAndParentId( + const TDesC8& aName, + const TDesC8& aParentId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ +FindByNameAndParentId" ); + + TInt returnvalue = KErrNotFound; + + // Continue only if the given parameter is valid + if( aName != KNullDesC8 && aParentId != KNullDesC8 ) + { + // Go through the array + for( TInt index=0; indexName() ) >= 0 && + aParentId.Match( iArray[index]->ParentId() ) >= 0 ) + { + returnvalue = index; + index = iArray.Count() + 1; + } + } + } + return returnvalue; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::FindByMediaClassAndParentId +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByMediaClassAndParentId( + const TDesC8& aMediaClass, + const TDesC8& aParentId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ +FindByMediaClassAndParentId" ); + + TInt returnvalue = KErrNotFound; + + // Continue only if the given parameter is valid + if( aMediaClass != KNullDesC8 && + aParentId != KNullDesC8 ) + { + // Go through the array + for( TInt index=0; indexObjectClass() ) >= 0 && + aParentId.Match( iArray[index]->ParentId() ) >= 0 ) + { + returnvalue = index; + index = iArray.Count() + 1; + } + } + } + return returnvalue; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::FindByObjectId +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByObjectId( + const TDesC8& aObjectId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ +FindByObjectId" ); + + TInt returnvalue = KErrNotFound; + + // Continue only if the given parameter is valid + if( aObjectId != KNullDesC8 ) + { + // Go through the array + for( TInt index=0; indexObjectId() ) >= 0 ) + { + returnvalue = index; + index = iArray.Count() + 1; + } + } + } + return returnvalue; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::FindRefItemIdByOriginalIdL +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpCdsLiteObjectArray::FindRefItemIdByOriginalIdL( + const TDesC8& aOriginalId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ +FindRefItemIdByOriginalIdL" ); + + TInt returnvalue = KErrNotFound; + + // Continue only if the given parameter is valid + if( aOriginalId != KNullDesC8 ) + { + // Go through the array + for( TInt index=0; indexType() == + CUpnpCdsLiteObject::EItemReference && + aOriginalId.Match( iArray[index]->OriginalItemIdL() ) >= 0 ) + { + returnvalue = index; + index = iArray.Count() + 1; + } + } + } + return returnvalue; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::ChildCount +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpCdsLiteObjectArray::ChildCount( const TDesC8& aObjectId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::ChildCount" ); + + TInt returnvalue ( 0 ); + + // Continue only if the given parameter is valid + if( aObjectId != KNullDesC8 ) + { + // Go through the array + for( TInt index=0; indexParentId() ) >= 0 ) + { + returnvalue++; + } + } + } + return returnvalue; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::Count +// -------------------------------------------------------------------------- +// +EXPORT_C TInt CUpnpCdsLiteObjectArray::Count( ) + { + return iArray.Count(); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::ObjectAtL +// -------------------------------------------------------------------------- +// +EXPORT_C CUpnpCdsLiteObject& CUpnpCdsLiteObjectArray::ObjectAtL( + TUint aIndex ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::ObjectAtL" ); + + // Validate the parameter + if( aIndex > iArray.Count() ) + { + User::Leave( KErrArgument ); + } + + // Return a reference to the object + CUpnpCdsLiteObject* object = iArray[aIndex]; + return *object; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::RemoveObjectAtL +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpCdsLiteObjectArray::RemoveObjectAtL( TUint aIndex ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ +RemoveObjectAtL" ); + + // Validate the parameter + if( aIndex > iArray.Count() ) + { + User::Leave( KErrArgument ); + } + + // Get the pointer from the array + CUpnpCdsLiteObject* object = iArray[aIndex]; + + // Remove the object and compress the array + iArray.Remove( aIndex ); + iArray.Compress(); + + // Delete the object + delete object; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::AppendL +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpCdsLiteObjectArray::AppendL( const CUpnpObject *aObject ) + { + // First, create a new CreateUpnpCdsLiteObject + CUpnpCdsLiteObject* object = CreateUpnpCdsLiteObjectL( aObject ); + CleanupStack::PushL( object ); + + // Append the item to the array + AppendL( object ); + CleanupStack::Pop( object ); // ownership transfered + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::RemoveL +// -------------------------------------------------------------------------- +// +EXPORT_C void CUpnpCdsLiteObjectArray::RemoveL( const CUpnpObject *aObject ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::RemoveL" ); + + // First, create a new CreateUpnpCdsLiteObject + CUpnpCdsLiteObject* object = CreateUpnpCdsLiteObjectL( aObject ); + CleanupStack::PushL( object ); + + // Search the array and remove the object if found + TInt index = FindByObjectId( object->ObjectId() ); + if( index >= 0 ) + { + RemoveObjectAtL( index ); + } + + // Clean up + CleanupStack::PopAndDestroy( object ); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::CreateUpnpCdsLiteObjectL +// -------------------------------------------------------------------------- +// +CUpnpCdsLiteObject* CUpnpCdsLiteObjectArray::CreateUpnpCdsLiteObjectL( + const CUpnpObject *aObject ) + { + // Check the param + if( !aObject ) + { + User::Leave( KErrArgument ); + } + + CUpnpCdsLiteObject* object = NULL; + + // Object is a container + if( aObject->ObjectClass().Find( KContainerClass() ) >= 0 ) + { + // Cast to container object + CUpnpContainer* container = (CUpnpContainer*)aObject; + + // Create the object accordingly + object = CUpnpCdsLiteObject::NewL( container->Title(), + CUpnpCdsLiteObject::EContainer, + container->Id(), + container->ParentId(), + container->ObjectClass() ); + CleanupStack::PushL( object ); + } + + // Object is an item / reference item + else if( aObject->ObjectClass().Find( KItemClass() ) >= 0 ) + { + // Cast to container object + CUpnpItem* item = (CUpnpItem*)aObject; + + HBufC8* fileName = NULL; + // Resolve the type + CUpnpCdsLiteObject::TCdsLiteObjectType type = + CUpnpCdsLiteObject::EUnknown; + if( item->RefId() == KNullDesC8 ) + { + type = CUpnpCdsLiteObject::EItem; + fileName = ResolveFileNameL( aObject ); + CleanupStack::PushL( fileName ); + } + else + { + type = CUpnpCdsLiteObject::EItemReference; + // Set space for reference filename. + // Item validation requires that CDS lite object's name field must + // be different that KNullDesC8. + // Mediaserver doesn't store this field for reference item and it + // is KNullDesC8 when structrure is read from server. + fileName = KSpace().AllocLC(); + } + + // Create the object accordingly + object = CUpnpCdsLiteObject::NewL( *fileName, + type, + item->Id(), + item->ParentId(), + item->ObjectClass() ); + + if ( fileName ) + { + CleanupStack::PopAndDestroy( fileName ); + } + + CleanupStack::PushL( object ); + + // Set the reference ID, if necessary + if( type == CUpnpCdsLiteObject::EItemReference ) + { + object->SetOriginalItemIdL( item->RefId() ); + } + } + + // Object is neither a container nor an item, leave + else + { + User::Leave( KErrArgument ); + } + + CleanupStack::Pop( object ); + + return object; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsLiteObjectArray::ResolveFileNameL +// -------------------------------------------------------------------------- +// +HBufC8* CUpnpCdsLiteObjectArray::ResolveFileNameL( + const CUpnpObject *aObject ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ +ResolveFileNameL" ); + + // Check parameter + if( !aObject ) + { + User::Leave( KErrArgument ); + } + + HBufC8* returnValue = NULL; + + // Get all the elements + const RUPnPElementsArray& elements = + ( const_cast(aObject) )->GetElements(); + + // Find the "res" element + for( TInt index=0; indexName() == KElementRes ) + { + // Parse the filename + TParse fp; + fp.Set( elements[index]->FilePath(), 0, 0 ); + + // Full filename (path and drive letter included) + returnValue = + EscapeUtils::ConvertFromUnicodeToUtf8L( fp.FullName() ); + + // Exit the loop + index = elements.Count() + 1; + } + } + + return returnValue; + } + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/src/upnpcdsreaderao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/src/upnpcdsreaderao.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,330 @@ +/** + * 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: CUpnpCdsReaderAO class implementation + * + */ + +// INCLUDES +#include +#include + +#include "upnpcdsreaderao.h" +#include "upnpsharingalgorithmconstants.h" +#include "upnplog.h" +#include "upnpcommonutils.h" +#include "upnpcdsliteobjectarray.h" +#include "upnpbrowsecriteria.h" +#include "upnpcontainerlist.h" +#include "upnpitemlist.h" + +const TInt KDefaultBrowseReqCount( 50 ); +const TInt KLoopLimit( 3 ); + +// -------------------------------------------------------------------------- +// CUpnpSecAccessController::NewL +// -------------------------------------------------------------------------- +// +CUpnpCdsReaderAO* CUpnpCdsReaderAO::NewL( + CUpnpCdsLiteObjectArray& aUpnpCdsLiteObjects ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::NewL" ); + + CUpnpCdsReaderAO* self = new ( ELeave ) CUpnpCdsReaderAO( + aUpnpCdsLiteObjects ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::ConstructL +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::ConstructL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::ConstructL" ); + + if ( !CActiveScheduler::Current() ) + { + iScheduler = new ( ELeave ) CActiveScheduler; + CActiveScheduler::Install( iScheduler ); + } + // Add this active object to the active scheduler. + CActiveScheduler::Add( this ); + + iFileSharing = CUpnpFileSharing::NewL(); + iWaitRequest = new ( ELeave ) CActiveSchedulerWait(); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::~CUpnpCdsReaderAO +// -------------------------------------------------------------------------- +// +CUpnpCdsReaderAO::~CUpnpCdsReaderAO() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::~CUpnpCdsReaderAO" ); + + delete iFileSharing; + delete iWaitRequest; + + if ( CActiveScheduler::Current() == iScheduler ) + { + CActiveScheduler::Install( NULL ); + } + delete iScheduler; + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::ReadCdsStructureL +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::ReadCdsStructureL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::ReadCdsStructureL" ); + + // Start reading from root container + GetContainersL( KRootContainer ); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::GetContainersL +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::GetContainersL( const TDesC8& aContainerId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::GetContainersL" ); + + // Get all items of container with id aContainerId + GetItemsL( aContainerId ); + + // Number of found items. Count is initialized as KDefaultBrowseReqCount + // to get into the while loop. Loop ends, when GetSharedItemListL + // request does not get new objects + TInt count( KDefaultBrowseReqCount ); + TInt startingIndex( 0 ); + TInt loopCounter( 0 ); + + while ( startingIndex < count ) + { + count = 0; + + CUpnpContainerList* containerList = CUpnpContainerList::NewL(); + CleanupStack::PushL( containerList ); + + CUpnpBrowseCriteria* browseCriteria = CUpnpBrowseCriteria::NewLC(); + browseCriteria->SetRequestedCount( KDefaultBrowseReqCount ); + browseCriteria->SetStartingIndex( startingIndex ); + browseCriteria->SetFilterL( KBrowseCriteriaFilter ); + + // Query all items and containers with container id aContainerId + iFileSharing->GetSharedContainerListL( + UPnPCommonUtils::DesC8ToInt( aContainerId ), + *browseCriteria, + *containerList, + count, + iStatus ); + + CleanupStack::PopAndDestroy( browseCriteria ); + + // Wait for the request to complete + CompleteRequestL(); + + // Leave, if GetSharedContainerListL gives continuously zero items + if ( !containerList->ObjectCount() ) + { + loopCounter += 1; + if ( loopCounter >= KLoopLimit ) + { + User::Leave( KErrGeneral ); + } + } + else + { + loopCounter = 0; + } + + for ( TInt index( 0 ); index < containerList->ObjectCount(); index++ ) + { + // Append container to the objects array + iUpnpCdsLiteObjects.AppendL( ( *containerList )[ index ] ); + // Call object search recursively for each found container + GetContainersL( ( *containerList )[ index ]->Id() ); + } + + startingIndex += containerList->ObjectCount(); + + CleanupStack::PopAndDestroy( containerList ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::GetItemsL +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::GetItemsL( const TDesC8& aContainerId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::GetItemsL" ); + + // Number of found items. Count is initialized as KDefaultBrowseReqCount + // to get into the while loop. Loop ends, when GetSharedItemListL + // request does not get new objects + TInt count( KDefaultBrowseReqCount ); + TInt startingIndex( 0 ); + TInt loopCounter( 0 ); + + while ( startingIndex < count ) + { + count = 0; + + CUpnpItemList* itemList = CUpnpItemList::NewL(); + CleanupStack::PushL( itemList ); + + CUpnpBrowseCriteria* browseCriteria = CUpnpBrowseCriteria::NewLC(); + browseCriteria->SetRequestedCount( KDefaultBrowseReqCount ); + browseCriteria->SetStartingIndex( startingIndex ); + browseCriteria->SetFilterL( KBrowseCriteriaFilter ); + + // Query all items of container with container id aContainerId + iFileSharing->GetSharedItemListL( + UPnPCommonUtils::DesC8ToInt( aContainerId ), + *browseCriteria, + *itemList, + count, + iStatus ); + + CleanupStack::PopAndDestroy( browseCriteria ); + + // Wait for the request to complete + CompleteRequestL(); + + // Leave, if GetSharedContainerListL gives continuously zero items + if ( !itemList->ObjectCount() ) + { + loopCounter += 1; + if ( loopCounter >= KLoopLimit ) + { + User::Leave( KErrGeneral ); + } + } + else + { + loopCounter = 0; + } + + // Append files to the objects array + for ( TInt index( 0 ); index < itemList->ObjectCount(); index++ ) + { + // Local media applications store temporary items under + // root container. Therefore items whose parent container + // is root, are not appended to the objects array. + if ( ( *itemList )[ index ]->ParentId().Match( KRootContainer ) + == KErrNotFound ) + { + iUpnpCdsLiteObjects.AppendL( ( *itemList )[ index ] ); + } + } + + startingIndex += itemList->ObjectCount(); + + CleanupStack::PopAndDestroy( itemList ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::RunL +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::RunL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::RunL" ); + + // Request completed - no need to wait anymore + // Let ao caller to continue + StopWaitingRequestComplete(); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::DoCancel +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::DoCancel() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::DoCancel" ); + + Cancel(); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::WaitRequestToComplete +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::WaitRequestToComplete() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::\ +WaitRequestToComplete" ); + + // Wait for a request to complete + if ( iWaitRequest && !iWaitRequest->IsStarted() ) + { + iWaitRequest->Start(); + } + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::StopWaitingRequestComplete +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::StopWaitingRequestComplete() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::\ +StopWaitingRequestComplete" ); + + // Stop waiting process after query has been completed + if ( iWaitRequest && iWaitRequest->IsStarted() ) + { + iWaitRequest->AsyncStop(); + } + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::CompleteRequestL +// -------------------------------------------------------------------------- +// +void CUpnpCdsReaderAO::CompleteRequestL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsReaderAO::\ +CompleteRequestL" ); + + if ( !IsActive() ) + { + SetActive(); + } + else + { + User::Leave( KErrInUse ); + } + + // Wait for request to complete + WaitRequestToComplete(); + + // Leave if error happens + if ( iStatus.Int() != KErrNone && + iStatus.Int() != KErrNotFound ) + { + User::Leave( iStatus.Int() ); + } + } + +// End of File diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/src/upnpcontainerresolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/src/upnpcontainerresolver.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,819 @@ +/* +* 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: Implementation of the class CUpnpContainerResolver. +* +*/ + +#include "upnpconstantdefs.h" // upnpobject class types +#include // for CnvUtfConverter +#include // for BaflUtils +#include // for PathInfo +#include // for CUpnpItem +#include // for CUpnpElement +#include "upnpitemutility.h" // for CUpnpItemUtility +#include +#include // for array cleanup + +#include "upnpcontainerresolver.h" +#include "upnpsharingalgorithmconstants.h" +#include "upnplog.h" +#include "upnpcdsliteobject.h" + +const TInt KDateStringLength = 10; +const TInt KMaxDateStringLength = 30; +const TInt KMonthAndDayLength = 2; +const TInt KMonthAndDayDigitLimit = 10; +const TInt KSeparatorLength = 1; +const TInt KDateYearLength = 4; +const TInt KSecondSeparatorPosition = 7; + +_LIT( KZero, "0" ); + +// Year, e.g. "2008" +_LIT( KDateTimeYear,"%Y%3" ); + +// Month, e.g. "October" +_LIT( KDateTimeMonth,"%N%2" ); + +// Day, e.g. "4th Mon" +_LIT( KDateTimeDay,"%X%*D%1 %*E" ); + + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::NewL +// -------------------------------------------------------------------------- +// +CUpnpContainerResolver* CUpnpContainerResolver::NewL( + CUpnpCdsLiteObjectArray& aCdsLiteObjectArray ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::NewL" ); + + CUpnpContainerResolver* self = + new ( ELeave ) CUpnpContainerResolver( aCdsLiteObjectArray ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::ResolveContainerStructureL +// -------------------------------------------------------------------------- +// +RPointerArray + CUpnpContainerResolver::ResolveContainerStructureL( CUpnpItem& aItem ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +ResolveContainerStructureL" ); + + // List of needed containers + RPointerArray containers; + CleanupResetAndDestroyPushL( containers ); + + RPointerArray containerNames; + CleanupResetAndDestroyPushL( containerNames ); + + HBufC8* itemParent = NULL; + + if ( aItem.ObjectClass() == KClassAudioMusicTrack ) + { + // Fill container name array, containers must be in + // hierarchical order staring from root + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_MUSIC_TEXT ); + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_ALL_TEXT ); + + // Create non-existing containers + itemParent = CreateContainersL( containerNames, + containers, + KMusicClassContainer ); + CleanupStack::PushL( itemParent ); + } + else if ( aItem.ObjectClass() == KClassImage ) + { + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_IMAGE_TEXT ); + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_ALL_TEXT ); + + itemParent = CreateContainersL( containerNames, + containers, + KImageClassContainer ); + CleanupStack::PushL( itemParent ); + } + else if ( aItem.ObjectClass() == KClassVideo ) + { + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_VIDEO_TEXT ); + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_ALL_TEXT ); + + itemParent = CreateContainersL( containerNames, + containers, + KVideoClassContainer ); + CleanupStack::PushL( itemParent ); + } + + // If new containers are not needed, set item parent id here, + // because caller does not know the item parent container + if ( !containers.Count() ) + { + aItem.SetParentIdL( *itemParent ); + } + if ( itemParent ) + { + CleanupStack::PopAndDestroy( itemParent ); + } + + // Cleanup + CleanupStack::PopAndDestroy( &containerNames ); + CleanupStack::Pop( &containers ); + + return containers; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::ResolveReferenceContainersL +// -------------------------------------------------------------------------- +// +RPointerArray + CUpnpContainerResolver::ResolveReferenceContainersL( TInt aType, + CUpnpItem& aItem ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +ResolveReferenceContainersL" ); + + // List of needed containers + RPointerArray containers; + CleanupResetAndDestroyPushL( containers ); + + RPointerArray containerNames; + CleanupResetAndDestroyPushL( containerNames ); + + HBufC8* itemParent = NULL; + TInt error( KErrNone ); + + // Get object elements from where metadata is fetched + const RUPnPElementsArray& elements = aItem.GetElements(); + + switch( aType ) + { + case EGenreType : + { + // Fill container name array, containers must be in + // hierarchical order starting from root + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_MUSIC_TEXT ); + // Append "By Genre" container + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_BY_GENRE_TEXT ); + + // Modify "Genre" element and append it to the array + TRAP( error, ModifyAndAppendElementL( containerNames, + elements, + KElementGenre )); + + // If metadata is missing, containers are not created + if ( error == KErrNone ) + { + // Create non-existing containers + itemParent = CreateContainersL( containerNames, + containers, + KMusicClassContainer ); + CleanupStack::PushL( itemParent ); + } + break; + } + case EAlbumType : + { + // Fill container name array, containers must be in + // hierarchical order staring from root + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_MUSIC_TEXT ); + // Append "By Album" container + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_BY_ALBUM_TEXT ); + + // Modify "Album" element and append it to the array + TRAP( error, ModifyAndAppendElementL( containerNames, + elements, + KElementAlbum )); + + // If metadata is missing, containers are not created + if ( error == KErrNone ) + { + // Create non-existing containers + itemParent = CreateContainersL( containerNames, + containers, + KMusicClassContainer ); + CleanupStack::PushL( itemParent ); + } + break; + } + case EArtistType : + { + // Fill container name array, containers must be in + // hierarchical order staring from root + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_MUSIC_TEXT ); + // Append "By Artist" container + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_BY_ARTIST_TEXT ); + + // Modify "Artist" element and append it to the array + TRAP( error, ModifyAndAppendElementL( containerNames, + elements, + KElementArtist )); + + // If metadata is missing, containers are not created + if ( error == KErrNone ) + { + // Create non-existing containers + itemParent = CreateContainersL( containerNames, + containers, + KMusicClassContainer ); + CleanupStack::PushL( itemParent ); + } + break; + } + case EMusicByDateType : + { + // Fill container name array, containers must be in + // hierarchical order staring from root + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_MUSIC_TEXT ); + // Append "By Date" container + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_BY_DATE_TEXT ); + + TTime time; + HBufC8* elementValue = GetElementL( elements, KElementDate ); + if ( elementValue ) + { + CleanupStack::PushL( elementValue ); + HBufC8* adjustedDate = AdjustDateL( *elementValue ); + CleanupStack::PopAndDestroy( elementValue ); + CleanupStack::PushL( adjustedDate ); + + error = UPnPItemUtility::UPnPDateAsTTime( *adjustedDate, + time ); + + CleanupStack::PopAndDestroy( adjustedDate ); + + if ( error == KErrNone && + adjustedDate->Length() > 0 ) + { + TBuf finalTime; + + // Append Year container + time.FormatL( finalTime, KDateTimeYear ); + HBufC8* timeStr = + CnvUtfConverter::ConvertFromUnicodeToUtf8L( + finalTime ); + CleanupStack::PushL( timeStr ); + containerNames.Append( timeStr ); + CleanupStack::Pop( timeStr ); + + // Create non-existing containers + itemParent = CreateContainersL( containerNames, + containers, + KMusicClassContainer ); + CleanupStack::PushL( itemParent ); + } + } + else + { + error = KErrNotFound; + } + + break; + } + case EImageByDateType : + { + // Fill container name array, containers must be in + // hierarchical order staring from root + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_IMAGE_TEXT ); + + error = AddByDateContainersL( containerNames, elements ); + + // If metadata is missing, containers are not created + if ( error == KErrNone ) + { + // Create non-existing containers + itemParent = CreateContainersL( containerNames, + containers, + KImageClassContainer ); + CleanupStack::PushL( itemParent ); + } + break; + } + case EVideoByDateType : + { + // Fill container name array, containers must be in + // hierarchical order staring from root + AppendContainerNameToArrayL( containerNames, + R_UPNP_SHARE_VIDEO_TEXT ); + + error = AddByDateContainersL( containerNames, elements ); + + // If metadata is missing, containers are not created + if ( error == KErrNone ) + { + // Create non-existing containers + itemParent = CreateContainersL( containerNames, + containers, + KVideoClassContainer ); + CleanupStack::PushL( itemParent ); + } + break; + } + default: + { + User::Leave( KErrNotSupported ); + break; + } + } + + // If new containers are not needed, set item parent id here, + // because caller does not know the item parent container. + // If metadata is not found, item is left untouched. + if ( !containers.Count() && + error == KErrNone ) + { + aItem.SetParentIdL( *itemParent ); + } + + if ( itemParent ) + { + CleanupStack::PopAndDestroy( itemParent ); + } + + // Cleanup + CleanupStack::PopAndDestroy( &containerNames ); + CleanupStack::Pop( &containers ); + + return containers; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::ResolveEmptyContainersL +// -------------------------------------------------------------------------- +// +RPointerArray + CUpnpContainerResolver::ResolveEmptyContainersL( TDesC8& aContainerId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +ResolveEmptyContainersL" ); + + RPointerArray emptyContainers; + TBool empty( ETrue ); + const TDesC8* parentId = &aContainerId; + + // Search empty containers from the array + while ( empty && + parentId->Match( KRootContainer ) == KErrNotFound ) + { + TInt count = iCdsLiteObjectArray.ChildCount( aContainerId ); + if ( iCdsLiteObjectArray.ChildCount( *parentId ) > 1 ) + { + // There is more than one item inside container + // Current container must not be removed, exit loop + empty = EFalse; + } + else + { + // Get object index from CDS object array + TInt objectIndex = + iCdsLiteObjectArray.FindByObjectId( *parentId ); + + // Append correct container from CDS object array + emptyContainers.Append( + &iCdsLiteObjectArray.ObjectAtL( objectIndex ) ); + + // Get parent container id of the current container + parentId = + &iCdsLiteObjectArray.ObjectAtL( objectIndex ).ParentId(); + } + } + return emptyContainers; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::ConstructL +// -------------------------------------------------------------------------- +// +void CUpnpContainerResolver::ConstructL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +ConstructL" ); + + // Open file server session + User::LeaveIfError( iFs.Connect() ); + + TFileName resourceFileName( KSharingAlgorithmRscFile ); + + // Get the exact filename of the resource file + BaflUtils::NearestLanguageFile( iFs, resourceFileName ); + + TInt err( KErrNone ); + // Open resource file + TRAP( err, iResourceFile.OpenL( iFs, resourceFileName ) ); + + if ( err != KErrNone ) + { + // If not found, try to read resource file from memory card + resourceFileName.Copy( PathInfo::MemoryCardRootPath() ); + resourceFileName.Delete( 2, 2 ); // remove // + resourceFileName.Append( KSharingAlgorithmRscFile ); + iResourceFile.OpenL( iFs, resourceFileName ); + } + } + +// -------------------------------------------------------------------------- +// CCUpnpContainerResolver::~CUpnpContainerResolver +// -------------------------------------------------------------------------- +// +CUpnpContainerResolver::~CUpnpContainerResolver() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +~CUpnpContainerResolver" ); + + // Close resource file + iResourceFile.Close(); + + // Close file server session + iFs.Close(); + } + +// -------------------------------------------------------------------------- +// CCUpnpContainerResolver::CreateContainerL +// -------------------------------------------------------------------------- +// +CUpnpContainer* CUpnpContainerResolver::CreateContainerL( + const TDesC8& aTitle, + const TDesC8& aClass ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +CreateContainerL" ); + + CUpnpContainer* container = CUpnpContainer::NewL(); + CleanupStack::PushL( container ); + + // Set container info + container->SetTitleL( aTitle ); + container->SetObjectClassL( aClass ); + + CleanupStack::Pop( container ); + + return container; + } + +// -------------------------------------------------------------------------- +// CCUpnpContainerResolver::CreateContainersL +// -------------------------------------------------------------------------- +// +HBufC8* CUpnpContainerResolver::CreateContainersL( + RPointerArray& aContainerNames, + RPointerArray& aContainers, + const TDesC8& aMediaClass ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +CreateContainersL" ); + + HBufC8* parentId = NULL; + TInt index( 1 ); + + // Find first media container, e.g. "Music" + TInt objectIndex ( iCdsLiteObjectArray.FindByMediaClassAndParentId( + aMediaClass, KRootContainer ) ); + + if ( objectIndex == KErrNotFound ) + { + // Create media root container and append it to the container array. + // Parent container is root container ("0") + if ( aContainerNames.Count() ) + { + CUpnpContainer* container = CreateContainerL( + *aContainerNames[0], aMediaClass ); + CleanupStack::PushL( container ); + aContainers.Append( container ); + CleanupStack::Pop( container ); + } + parentId = KRootContainer().AllocL(); + } + else + { + // Remember media root container id + parentId = iCdsLiteObjectArray.ObjectAtL( + objectIndex ).ObjectId().AllocL(); + } + + // Find the first container that does not exist + for ( ; index < aContainerNames.Count(); index++ ) + { + // Container is found by container name and parent id. + // If search cannot find the container, it needs to be created. + objectIndex = iCdsLiteObjectArray.FindByNameAndParentId( + *aContainerNames[index], *parentId ); + + if ( objectIndex == KErrNotFound ) + { + break; + } + else + { + // Remember last found container id + parentId = iCdsLiteObjectArray.ObjectAtL( + objectIndex ).ObjectId().AllocL(); + } + } + + // Create needed containers + for ( TInt index2( index ); index2 < aContainerNames.Count(); index2++ ) + { + CUpnpContainer* container = CreateContainerL( + *aContainerNames[index2], aMediaClass ); + CleanupStack::PushL( container ); + aContainers.Append( container ); + CleanupStack::Pop( container ); + } + + // Use the last found object id as parent id of the first new container + if ( aContainers.Count() ) + { + aContainers[0]->SetParentIdL( *parentId ); + } + + return parentId; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::ReadResourceTextL +// -------------------------------------------------------------------------- +// +HBufC8* CUpnpContainerResolver::ReadResourceTextL( TInt aResourceId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +ReadResourceTextL" ); + + // Load resource text + HBufC8* resourceString8 = iResourceFile.AllocReadLC( aResourceId ); + + TResourceReader theReader; + theReader.SetBuffer( resourceString8 ); + HBufC16* resourceString16 = theReader.ReadHBufC16L(); + CleanupStack::PushL( resourceString16 ); + + HBufC8* returnString8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( + resourceString16->Des() ); + + CleanupStack::PopAndDestroy( resourceString16 ); + CleanupStack::PopAndDestroy( resourceString8 ); + + return returnString8; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::GetElementL +// -------------------------------------------------------------------------- +// +HBufC8* CUpnpContainerResolver::GetElementL( + const RUPnPElementsArray& aElements, + const TDesC8& aElement ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +GetElementL" ); + + HBufC8* elementValue = NULL; + + // Find the element + for( TInt index = 0; index < aElements.Count(); index++ ) + { + if( aElements[index]->Name().Match( aElement ) == KErrNone ) + { + elementValue = aElements[index]->Value().AllocL(); + index = aElements.Count(); + } + } + + return elementValue; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::AdjustDateL +// -------------------------------------------------------------------------- +// +HBufC8* CUpnpContainerResolver::AdjustDateL( const TDesC8& aDate ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +AdjustDateL" ); + + HBufC* date = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aDate ); + CleanupStack::PushL( date ); + TBuf modifiedDate; + + TBuf month; + TBuf day; + + if( aDate.Length() >= KDateStringLength ) + { + // Month and day are decreased by 1, because + // both are started from zero in TTime::Set() + // Formats date e.g. 2008-10-30 --> 2008-09-29 + + // Add year and separator e.g. "2008-" + modifiedDate.Copy( date->Des().Left( + ( KDateYearLength + KSeparatorLength ) ) ); + + // Adjust month "10" --> "9" + month.Append( date->Des().Mid( + ( KDateYearLength + KSeparatorLength ), + KMonthAndDayLength) ); + TLex monthLex( month ); + TInt monthInt( 0 ); + monthLex.Val( monthInt ); + monthInt--; + TBuf adjustedMonth; + adjustedMonth.Num( monthInt ); + + // Month and day values need to contain + // two digits. Append extra zero, if needed, + // e.g. "9" --> "09" + if ( monthInt < KMonthAndDayDigitLimit ) + { + modifiedDate.Append( KZero ); + } + + // Add modified month string + modifiedDate.Append( adjustedMonth ); + + // Add separator "-" that is between month and day + modifiedDate.Append( date->Des().Mid( + KSecondSeparatorPosition, + KSeparatorLength ) ); + + // Adjust day e.g. "30" --> "29" + day.Append( date->Des().Mid( + ( KSecondSeparatorPosition + KSeparatorLength ), + KMonthAndDayLength) ); + TLex dayLex( day ); + TInt dayInt( 0 ); + dayLex.Val( dayInt ); + dayInt--; + TBuf adjustedDay; + adjustedDay.Num( dayInt ); + + if ( dayInt < KMonthAndDayDigitLimit ) + { + modifiedDate.Append( KZero ); + } + + // Add modified day string + modifiedDate.Append( adjustedDay ); + } + + CleanupStack::PopAndDestroy( date ); + + HBufC8* adjustedDate = + CnvUtfConverter::ConvertFromUnicodeToUtf8L( modifiedDate ); + + return adjustedDate; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::AddByDateContainersL +// -------------------------------------------------------------------------- +// +TInt CUpnpContainerResolver::AddByDateContainersL( + RPointerArray& aContainerNames, + const RUPnPElementsArray& aElements ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +AddByDateContainersL" ); + + TInt metadataError( KErrNone ); + TTime time; + + // Append "By Date" container + aContainerNames.AppendL( + ReadResourceTextL( R_UPNP_SHARE_BY_DATE_TEXT ) ); + + HBufC8* elementValue = GetElementL( aElements, KElementDate ); + if ( elementValue ) + { + CleanupStack::PushL( elementValue ); + // Get date element and adjust it to match TTime::Set() time + HBufC8* adjustedDate = AdjustDateL( *elementValue ); + CleanupStack::PopAndDestroy( elementValue ); + CleanupStack::PushL( adjustedDate ); + + if ( adjustedDate->Length() <= 0 ) + { + metadataError = KErrNotFound; + } + + // Convert date to TTime + TInt adjustError ( UPnPItemUtility::UPnPDateAsTTime( + *adjustedDate, time ) ); + + CleanupStack::PopAndDestroy( adjustedDate ); + + if ( adjustError == KErrNone && + metadataError == KErrNone ) + { + TBuf finalTime; + + // Append Year container + time.FormatL( finalTime, KDateTimeYear ); + aContainerNames.Append( + CnvUtfConverter::ConvertFromUnicodeToUtf8L( + finalTime ) ); + + // Append Month container + time.FormatL( finalTime, KDateTimeMonth ); + aContainerNames.Append( + CnvUtfConverter::ConvertFromUnicodeToUtf8L( + finalTime ) ); + + // Append Day container + time.FormatL( finalTime, KDateTimeDay ); + aContainerNames.Append( + CnvUtfConverter::ConvertFromUnicodeToUtf8L( + finalTime ) ); + } + } + else + { + metadataError = KErrNotFound; + } + + return metadataError; + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::ModifyAndAppendElementL +// -------------------------------------------------------------------------- +// +void CUpnpContainerResolver::ModifyAndAppendElementL( + RPointerArray& aContainerNames, + const RUPnPElementsArray& aElements, + const TDesC8& aElementType ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +ModifyAndAppendElementL" ); + + // Find correct element + HBufC8* elementValue = GetElementL( aElements, aElementType ); + CleanupStack::PushL( elementValue ); + if ( !elementValue || + elementValue->Length() <= 0 ) + { + User::Leave( KErrNotFound ); + } + + // Set all letters to lower case + elementValue->Des().LowerCase(); + + // Capitalize the first letter of the string + elementValue->Des().Capitalize(); + + // Append modified element value to container names array. + // aContainerNames array is responsible for deleteting objects in it. + // Transfer ownership. + aContainerNames.AppendL( elementValue ); + + CleanupStack::Pop( elementValue ); + } + +// -------------------------------------------------------------------------- +// CUpnpContainerResolver::AppendContainerNameToArrayL +// -------------------------------------------------------------------------- +// +void CUpnpContainerResolver::AppendContainerNameToArrayL( + RPointerArray& aArray, + TInt aResourceTextId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpContainerResolver::\ +AppendContainerNameToArrayL" ); + + HBufC8* name = ReadResourceTextL( aResourceTextId ); + CleanupStack::PushL( name ); + aArray.AppendL( name ); + CleanupStack::Pop( name ); + } + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/src/upnpsharingalgorithmfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/src/upnpsharingalgorithmfactory.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: Factory for UPnPSharingAlgorithm +* +*/ + + +#include "upnpsharingalgorithmfactory.h" +#include "upnpsharingalgorithm.h" +#include "upnpsharingalgorithmimpl.h" + + +// ======== MEMBER FUNCTIONS ======== + +// -------------------------------------------------------------------------- +// CUPnPSharingAlgorithmFactory::NewSharingApiL +// -------------------------------------------------------------------------- +// +EXPORT_C MUpnpSharingAlgorithm* + CUPnPSharingAlgorithmFactory::NewSharingApiL( ) + { + return (MUpnpSharingAlgorithm*) CUpnpSharingAlgorithmImpl::NewL(); + } + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/src/upnpsharingalgorithmimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/src/upnpsharingalgorithmimpl.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,714 @@ +/* +* 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: Implementation of the class CUpnpSharingAlgorithmImpl. +* +*/ + +// INCLUDE FILES, SYSTEM +#include +#include +#include "upnpcommonutils.h" +#include "upnpmetadatafetcher.h" +#include "upnpfileutility.h" +#include // ConvertFromUnicodeToUtf8L +#include // File existence check +#include "upnpconstantdefs.h" +#include // for array cleanup + +// INCLUDE FILES, USER +#include "upnpcontainerresolver.h" +#include "upnpsharingao.h" +#include "upnpcdsreaderao.h" +#include "upnpsharingalgorithmimpl.h" +#include "upnpsharingalgorithmconstants.h" +#include "upnplog.h" +#include "upnpcdsliteobject.h" +#include "upnpcdsliteobjectarray.h" + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithm::NewL +// -------------------------------------------------------------------------- +// +CUpnpSharingAlgorithmImpl* CUpnpSharingAlgorithmImpl::NewL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithmImpl::NewL" ); + + CUpnpSharingAlgorithmImpl* self = CUpnpSharingAlgorithmImpl::NewLC(); + CleanupStack::Pop( self ); + + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::NewLC +// Two-phased constructor +// -------------------------------------------------------------------------- +// +CUpnpSharingAlgorithmImpl* CUpnpSharingAlgorithmImpl::NewLC() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithmImpl::NewLC" ); + + CUpnpSharingAlgorithmImpl* self = + new ( ELeave ) CUpnpSharingAlgorithmImpl(); + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::~CUpnpSharingAlgorithmImpl +// -------------------------------------------------------------------------- +// +CUpnpSharingAlgorithmImpl::~CUpnpSharingAlgorithmImpl() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithmImpl::\ +~CUpnpSharingAlgorithmImpl" ); + + delete iContainerResolver; + delete iSharingAO; + delete iSharedContentArray; + + iMediaServer.Close(); + } + +// -------------------------------------------------------------------------- +// CCUpnpSharingAlgorithmImpl::ConstructL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::ConstructL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithmImpl::\ +ConstructL" ); + + // connect to server + User::LeaveIfError( iMediaServer.Connect() ); + // Start server if not yet started + StartServer(); + + // An array to list all the shared files on the CDS + iSharedContentArray = CUpnpCdsLiteObjectArray::NewL(); + // container structure resolver + // contentarray is always up-to-date + iContainerResolver = + CUpnpContainerResolver::NewL( *iSharedContentArray ); + + CUpnpCdsReaderAO* cdsReader = + CUpnpCdsReaderAO::NewL( *iSharedContentArray ); + CleanupStack::PushL( cdsReader ); + cdsReader->ReadCdsStructureL(); + CleanupStack::PopAndDestroy( cdsReader ); + + // Active object for sharing and unsharing the items + iSharingAO = CUpnpSharingAO::NewL(); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::ShareFileL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::ShareFileL( + const TFileName & aFileName ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ + ShareFileL" ); + + // Check that file exists. Leaves with KErrArgument if not exist. + CheckFileExistenceL( aFileName ); + + // Check that file is not protected. Leaves with KAccessDenied if yes. + CheckFileProtectionL( aFileName ); + + if ( !IsFileSharedL( aFileName ) ) + { + // Start server if not yet started + StartServer(); + + // create upnpitem... + CUpnpItem* upnpItem = + UPnPMetadataFetcher::CreateItemFromFileLC( aFileName ); + + // Resolve container structure + RPointerArray containerArray = + iContainerResolver->ResolveContainerStructureL( *upnpItem ); + CleanupResetAndDestroyPushL( containerArray ); + + if ( containerArray.Count() ) + { + // Share containers + ShareContainersL( containerArray ); + + // parent container id for item is the last shared container id + TPtrC8 itemParentContainerId = + containerArray[ containerArray.Count()-1 ]->Id(); + // ... and share it + iSharingAO->ShareFileL( itemParentContainerId, upnpItem ); + + // Add the file to the shared content array + iSharedContentArray->AppendL( upnpItem ); + } + else + { + // All containers exists already. + // Resolver put parentid to item + iSharingAO->ShareFileL( upnpItem->ParentId(), upnpItem ); + + // Add the file to the shared content array + iSharedContentArray->AppendL( upnpItem ); + } + + // SHARE reference containers and items + ShareReferenceObjectsL( upnpItem ); + + // Cleanup + CleanupStack::PopAndDestroy( &containerArray ); + CleanupStack::PopAndDestroy( upnpItem ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::UnshareFileL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::UnshareFileL( + const TFileName& aFileName ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::UnshareFileL" ); + + // Convert the filename to 8bit + HBufC8* filename = EscapeUtils::ConvertFromUnicodeToUtf8L( aFileName ); + CleanupStack::PushL( filename ); + + // Search the array for the item + TInt arrayindex = iSharedContentArray->FindByName( *filename ); + + // Continue only if the file was found + if ( arrayindex >= 0 ) + { + // Start server if not yet started + StartServer(); + + // Get the object reference + CUpnpCdsLiteObject& object = + iSharedContentArray->ObjectAtL( arrayindex ); + + // unshare references first + UnshareReferenceObjectsL( object ); + + // Checks the container tree and unshares if needed + // First container id to be checked is item's parentid + TBool containerUnshared = + UnshareEmptyContainersL( object.ParentId() ); + + // if container is not unshared the item needs to be unshared + if ( !containerUnshared ) + { + // Leave if ObjectId not found + if( object.ObjectId() == KNullDesC8 ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ + UnshareFileL, ObjectId not found!" ); + User::Leave( KErrCorrupt ); + } + + TInt objectIdInt( KErrNotFound ); + User::LeaveIfError( + objectIdInt = UPnPCommonUtils::DesC8ToInt( object.ObjectId() )); + + // Unshare the item + iSharingAO->UnshareFileL( objectIdInt ); + + // index must be retrieved again because reference item removal + // changes indexes + arrayindex = + iSharedContentArray->FindByObjectId(object.ObjectId()); + // Remove the file from the shared content array + iSharedContentArray->RemoveObjectAtL( arrayindex ); + } + else + { + // index must be retrieved again because removal of containers + // change indexes + arrayindex = iSharedContentArray->FindByName( *filename ); + // item was also unshared when container was unshared + // it's enough to remove item from contentarray + iSharedContentArray->RemoveObjectAtL( arrayindex ); + } + } + // Cleanup + CleanupStack::PopAndDestroy( filename ); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::IsFileSharedL +// -------------------------------------------------------------------------- +// +TBool CUpnpSharingAlgorithmImpl::IsFileSharedL( + const TFileName& aFileName ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithmImpl::\ + IsFileSharedL" ); + + TBool returnValue = EFalse; + + // Convert the filename to 8bit + HBufC8* tempFilename = + EscapeUtils::ConvertFromUnicodeToUtf8L( aFileName ); + CleanupStack::PushL( tempFilename ); + + // Search the file from the array + TInt index = iSharedContentArray->FindByName( *tempFilename ); + if( index >= 0 ) + { + returnValue = ETrue; + } + + // Clean up + CleanupStack::PopAndDestroy( tempFilename ); + + return returnValue; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::CheckFileExistenceL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::CheckFileExistenceL( + const TFileName& aFileName ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithmImpl::\ +CheckFileExistenceL" ); + + TBool fileExists( EFalse ); + + RFs fsSession; + User::LeaveIfError( fsSession.Connect() ); // connect session + CleanupClosePushL( fsSession ); + + // check that file exists + fileExists = BaflUtils::FileExists( fsSession, aFileName ); + + CleanupStack::PopAndDestroy( &fsSession ); + + if ( !fileExists ) + { + User::Leave( KErrArgument ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::UnshareEmptyContainersL +// -------------------------------------------------------------------------- +// +TBool CUpnpSharingAlgorithmImpl::UnshareEmptyContainersL( TDesC8& aParentId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithmImpl::\ +UnshareEmptyContainersL" ); + + TBool containerUnshared( EFalse ); + + // get top container id that does not contain item + // starting from container where item is. + RPointerArray containerList = + iContainerResolver->ResolveEmptyContainersL( aParentId ); + CleanupClosePushL( containerList ); + + TInt containerCount = containerList.Count(); + if ( containerCount ) + { + // Get top containerId which needs to be unshared. + TPtrC8 containerIdStr = containerList[containerCount-1]->ObjectId(); + TInt objectIdInt( KErrNotFound ); + User::LeaveIfError( + objectIdInt = UPnPCommonUtils::DesC8ToInt( containerIdStr )); + // unshares all objecs under this container with single call + TRAPD( error, iSharingAO->UnshareContainerL( objectIdInt )); + if ( !error ) + { + for ( TInt i = 0; i < containerCount; i++ ) + { + // get container's array index + TInt arrayIndex = + iSharedContentArray->FindByObjectId( + containerList[i]->ObjectId() ); + + // Remove the container from the shared content array + iSharedContentArray->RemoveObjectAtL( arrayIndex ); + } + } + containerUnshared = ETrue; + } + + CleanupStack::PopAndDestroy( &containerList ); + + return containerUnshared; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::ShareContainersL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::ShareContainersL( + RPointerArray& aContainerArray ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ +ShareContainersL" ); + + TPtrC8 previousContainerId( KNullDesC8 ); + + // Share containers + for ( TInt i = 0; i < aContainerArray.Count(); i++ ) + { + CUpnpContainer* container = aContainerArray[i]; + + // first container ( index = 0 ) have parent id ready + if ( container->ParentId() == KNullDesC8 ) + { + // parentid is previously shared container id + container->SetParentIdL( previousContainerId ); + } + + TInt error( KErrNone ); + TRAP( error, iSharingAO->ShareContainerL( container )); + if ( error ) + { + // remove shared objects from server because of error + RemoveSharedObjectsL( aContainerArray ); + User::LeaveIfError( error ); + } + // container got id on sharing - keep it safe for next container + // because it it used as parent container id + previousContainerId.Set( container->Id()); + + // no errors - append containers to cdsliteobjectarray + TRAP( error, iSharedContentArray->AppendL( container )); + if ( error ) + { + // remove shared objects from array because of error + RemoveSharedObjectsL( aContainerArray ); + User::LeaveIfError( error ); + } + } + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::ShareReferenceObjectsL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::ShareReferenceObjectsL( CUpnpItem* aItem ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ +ShareReferenceObjectsL" ); + + // Get cds object from array. Reference item ids will be + // added to this item + TInt index = iSharedContentArray->FindByObjectId( aItem->Id() ); + CUpnpCdsLiteObject& object = iSharedContentArray->ObjectAtL( index ); + + // reset id because a new one will be given when reference is shared + aItem->SetIdL( KNullDesC8 ); + // reset refid field because item is reference + aItem->SetRefIdL( KNullDesC8 ); + // reset title + aItem->SetTitleL( KNullDesC8 ); + // reset parentId + aItem->SetParentIdL( KNullDesC8 ); + + if ( aItem->ObjectClass() == KClassAudioMusicTrack ) + { + // Resolve genre containers + RPointerArray refContainers = + iContainerResolver->ResolveReferenceContainersL( EGenreType, + *aItem ); + CleanupResetAndDestroyPushL( refContainers ); + if ( refContainers.Count() || + aItem->ParentId() != KNullDesC8 ) + { + // share container(s) and item + ShareReferenceObjectL( refContainers, object, *aItem ); + } + CleanupStack::PopAndDestroy( &refContainers ); + + // reset parentId + aItem->SetParentIdL( KNullDesC8 ); + // Resolve album containers + refContainers = + iContainerResolver->ResolveReferenceContainersL( EAlbumType, + *aItem ); + CleanupResetAndDestroyPushL( refContainers ); + if ( refContainers.Count() || + aItem->ParentId() != KNullDesC8 ) + { + // share container(s) and item + ShareReferenceObjectL( refContainers, object, *aItem ); + } + CleanupStack::PopAndDestroy( &refContainers ); + + // reset parentId + aItem->SetParentIdL( KNullDesC8 ); + // Resolve artist containers + refContainers = + iContainerResolver->ResolveReferenceContainersL( EArtistType, + *aItem ); + CleanupResetAndDestroyPushL( refContainers ); + if ( refContainers.Count() || + aItem->ParentId() != KNullDesC8 ) + { + // share container(s) and item + ShareReferenceObjectL( refContainers, object, *aItem ); + } + CleanupStack::PopAndDestroy( &refContainers ); + + // reset parentId + aItem->SetParentIdL( KNullDesC8 ); + // Resolve artist containers + refContainers = + iContainerResolver->ResolveReferenceContainersL( EMusicByDateType, + *aItem ); + CleanupResetAndDestroyPushL( refContainers ); + if ( refContainers.Count() || + aItem->ParentId() != KNullDesC8 ) + { + // share container(s) and item + ShareReferenceObjectL( refContainers, object, *aItem ); + } + CleanupStack::PopAndDestroy( &refContainers ); + } + + + else if ( aItem->ObjectClass() == KClassImage ) + { + // reset parentId + aItem->SetParentIdL( KNullDesC8 ); + // resolve date container + RPointerArray refContainers = + iContainerResolver->ResolveReferenceContainersL( EImageByDateType, + *aItem ); + CleanupResetAndDestroyPushL( refContainers ); + if ( refContainers.Count() || + aItem->ParentId() != KNullDesC8 ) + { + // share container(s) and item + ShareReferenceObjectL( refContainers, object, *aItem ); + } + CleanupStack::PopAndDestroy( &refContainers ); + } + + else if ( aItem->ObjectClass() == KClassVideo ) + { + // reset parentId + aItem->SetParentIdL( KNullDesC8 ); + // resolve date container + RPointerArray refContainers = + iContainerResolver->ResolveReferenceContainersL( EVideoByDateType, + *aItem ); + CleanupResetAndDestroyPushL( refContainers ); + if ( refContainers.Count() ) + { + // share container(s) and item + ShareReferenceObjectL( refContainers, object, *aItem ); + } + CleanupStack::PopAndDestroy( &refContainers ); + } + else + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ + ShareReferenceObjectsL object class not defined" ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::UnshareReferenceObjectsL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::UnshareReferenceObjectsL( + CUpnpCdsLiteObject& aOriginalObject ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ +UnshareReferenceObjectsL" ); + + TInt refIndex( KErrNotFound ); + + do + { + // find reference items created from original item + refIndex = iSharedContentArray->FindRefItemIdByOriginalIdL( + aOriginalObject.ObjectId() ); + + if ( refIndex != KErrNotFound ) + { + CUpnpCdsLiteObject& refObject = + iSharedContentArray->ObjectAtL( refIndex ); + + // Checks the container tree and unshares if needed + // First container id to be checked is item's parentid + TBool containerUnshared = + UnshareEmptyContainersL( refObject.ParentId() ); + + // if container is not unshared the item needs to be unshared + if ( !containerUnshared ) + { + // Leave if ObjectId not found + if( refObject.ObjectId() == KNullDesC8 ) + { + __LOG( "[CUpnpSharingAlgorithm]\t \ +CUpnpSharingAlgorithm::UnshareFileL, ObjectId not found!" ); + User::Leave( KErrCorrupt ); + } + + TInt objectIdInt( KErrNotFound ); + User::LeaveIfError( objectIdInt = + UPnPCommonUtils::DesC8ToInt( refObject.ObjectId() )); + + // Unshare the item + iSharingAO->UnshareFileL( objectIdInt ); + + // Remove the file from the shared content array + iSharedContentArray->RemoveObjectAtL( refIndex ); + } + else + { + // index has changed because container(s) was unshared + refIndex = iSharedContentArray->FindByObjectId( + refObject.ObjectId() ); + // item was also unshared when container was unshared + // it's enough to remove item from contentarray + iSharedContentArray->RemoveObjectAtL( refIndex ); + } + } + } while ( refIndex != KErrNotFound ); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::ShareReferenceObjectL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::ShareReferenceObjectL( + RPointerArray& aContainerArray, + CUpnpCdsLiteObject& aOriginalObject, + CUpnpItem& aItem ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ +ShareReferenceObjectL" ); + + TPtrC8 refParentId( KNullDesC8 ); + TInt parentContainerId( KErrNotFound ); + + TInt count = aContainerArray.Count(); + + if ( count ) + { + // reference container must be non-restricted + aContainerArray[count-1]->SetRestricted(EFalse); + // share containers + ShareContainersL( aContainerArray ); + + refParentId.Set( aContainerArray[count-1]->Id() ); + User::LeaveIfError( + parentContainerId = UPnPCommonUtils::DesC8ToInt( refParentId )); + } + else // share just item + { + refParentId.Set( aItem.ParentId() ); + User::LeaveIfError( + parentContainerId = UPnPCommonUtils::DesC8ToInt( refParentId )); + } + + TInt originalItemId( KErrNotFound ); + User::LeaveIfError( originalItemId = UPnPCommonUtils::DesC8ToInt( + aOriginalObject.ObjectId() )); + + iSharingAO->ShareReferenceL( parentContainerId, originalItemId, &aItem ); + // Add the file to the shared content array + iSharedContentArray->AppendL( &aItem ); + + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::RemoveSharedObjectsL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::RemoveSharedObjectsL( + RPointerArray& aContainerArray ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ +RemoveSharedObjectsL" ); + + // Unshare starting from first container + TPtrC8 containerIdStr = aContainerArray[0]->Id(); + TInt objectIdInt( KErrNotFound ); + User::LeaveIfError( + objectIdInt= UPnPCommonUtils::DesC8ToInt( containerIdStr )); + // unshares all objecs under this container with single call + iSharingAO->UnshareContainerL( objectIdInt ); + + for ( TInt i = 0; i < aContainerArray.Count(); i++) + { + // Remove object from the shared content array + iSharedContentArray->RemoveL( aContainerArray[i] ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::ReadSharedContent +// -------------------------------------------------------------------------- +// +CUpnpCdsLiteObjectArray& CUpnpSharingAlgorithmImpl::ReadSharedContent() + { + return *iSharedContentArray; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::StartServer +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::StartServer() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ +StartServer" ); + + // start offline if not started + TInt status( RUpnpMediaServerClient::EStopped ); + iMediaServer.Status( status ); + if ( status == RUpnpMediaServerClient::EStopped ) + { + iMediaServer.StartOffline(); + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAlgorithm::\ +StartServer started offline" ); + } + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::Close +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::Close() + { + delete this; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAlgorithmImpl::CheckFileProtectionL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAlgorithmImpl::CheckFileProtectionL( + const TFileName& aFileName ) + { + if ( UPnPFileUtility::IsFileProtectedL( aFileName ) ) + { + User::Leave( KErrAccessDenied ); + } + } + +// End of file diff -r 6369bfd1b60d -r 08b5eae9f9ff upnpsharing/upnpsharingalgorithm/src/upnpsharingao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upnpsharing/upnpsharingalgorithm/src/upnpsharingao.cpp Wed Nov 03 11:45:09 2010 +0200 @@ -0,0 +1,238 @@ +/** + * 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: CUpnpSharingAO class implementation + * + */ + +// INCLUDES +#include +#include +#include "upnpsharingao.h" +#include "upnpsharingalgorithmconstants.h" +#include "upnplog.h" + +// -------------------------------------------------------------------------- +// CUpnpSecAccessController::NewL +// -------------------------------------------------------------------------- +// +CUpnpSharingAO* CUpnpSharingAO::NewL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::NewL" ); + + CUpnpSharingAO* self = new (ELeave) CUpnpSharingAO; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::ConstructL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::ConstructL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::\ +ConstructL" ); + + if ( !CActiveScheduler::Current() ) + { + iScheduler = new( ELeave ) CActiveScheduler; + CActiveScheduler::Install( iScheduler ); + } + + // Add this active object to the active scheduler. + CActiveScheduler::Add( this ); + + iFileSharing = CUpnpFileSharing::NewL(); + iWaitRequest = new ( ELeave ) CActiveSchedulerWait(); + + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::~CUpnpSharingAO +// -------------------------------------------------------------------------- +// +CUpnpSharingAO::~CUpnpSharingAO() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::\ +~CUpnpSharingAO" ); + + delete iFileSharing; + delete iWaitRequest; + + if ( CActiveScheduler::Current() == iScheduler ) + { + CActiveScheduler::Install( NULL ); + } + delete iScheduler; + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::ShareFileL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::ShareFileL( const TDesC8& aParentContainerId, + CUpnpItem* aItem ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::ShareFileL" ); + + iFileSharing->ShareItemL( aParentContainerId, *aItem, iStatus ); + + CompleteRequestL(); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::ShareReferenceL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::ShareReferenceL( const TInt aParentContainerId, + const TInt aOriginalItemId, + CUpnpItem* aItem ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::ShareReferenceL" ); + + iFileSharing->ShareReferenceL( aParentContainerId, + aOriginalItemId, + *aItem, + iStatus ); + + CompleteRequestL(); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::ShareContainerL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::ShareContainerL( CUpnpContainer* aContainer ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::ShareContainerL" ); + + iFileSharing->ShareContainerL( aContainer->ParentId(), + *aContainer, + iStatus ); + + CompleteRequestL(); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::UnShareFileL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::UnshareFileL( const TInt aItemId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::\ +UnShareFileL" ); + + iFileSharing->UnshareItemL( aItemId, iStatus ); + + CompleteRequestL(); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::UnShareContainerL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::UnshareContainerL( const TInt aContainerId ) + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::\ +UnShareContainerL" ); + + iFileSharing->UnshareContainerL( aContainerId, iStatus ); + + CompleteRequestL(); + } + +// -------------------------------------------------------------------------- +// CUpnpCdsReaderAO::CompleteRequestL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::CompleteRequestL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::\ +CompleteRequestL" ); + + if ( !IsActive() ) + { + SetActive(); + } + else + { + User::Leave( KErrInUse ); + } + + // ...and then wait request to complete + // RunL releases wait + WaitRequestToComplete(); + // Leave if error happens on file unsharing + User::LeaveIfError( iStatus.Int() ); + } + +// -------------------------------------------------------------------------- +// CUpnpSharingAO::RunL +// -------------------------------------------------------------------------- +// +void CUpnpSharingAO::CUpnpSharingAO::RunL() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::RunL" ); + + // Request completed - no need to wait anymore + // Let ao caller to continue + StopWaitingRequestComplete(); + } + +// --------------------------------------------------------------------------- +// CUpnpSharingAO::DoCancel +// --------------------------------------------------------------------------- +// +void CUpnpSharingAO::CUpnpSharingAO::DoCancel() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::DoCancel" ); + + Cancel(); + } + +// --------------------------------------------------------------------------- +// CUpnpSharingAO::WaitRequestToComplete +// --------------------------------------------------------------------------- +// +void CUpnpSharingAO::WaitRequestToComplete() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::\ +WaitRequestToComplete" ); + + if ( iWaitRequest && + !iWaitRequest->IsStarted() ) + { + iWaitRequest->Start(); + } + } + +// --------------------------------------------------------------------------- +// CUpnpSharingAO::StopWaitingRequestComplete +// --------------------------------------------------------------------------- +// +void CUpnpSharingAO::StopWaitingRequestComplete() + { + __LOG( "[CUpnpSharingAlgorithm]\t CUpnpSharingAO::\ +StopWaitingRequestComplete" ); + + if ( iWaitRequest && + iWaitRequest->IsStarted() ) + { + iWaitRequest->AsyncStop(); + } + } + +// End of File