# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1283260816 -10800 # Node ID 5b153be919d4fd94f76167d513a6b86af267488f # Parent 786b94c6f0a4bf145262b324af30745cf8c30390 Revision: 201031 Kit: 201035 diff -r 786b94c6f0a4 -r 5b153be919d4 atext/client/src/atextclient.cpp --- a/atext/client/src/atextclient.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/atext/client/src/atextclient.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -274,7 +274,6 @@ EXPORT_C TInt RATExt::CancelReceiveEcomPluginChange() { TRACE_FUNC_ENTRY - TRACE_INFO((_L("CancelReceiveEcomPluginChange, Thread ID %Lu"), RThread().Id().Id())) if ( !Handle() ) { TRACE_FUNC_EXIT diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/group/bld.inf --- a/atext/plugins/group/bld.inf Thu Aug 19 11:01:00 2010 +0300 +++ b/atext/plugins/group/bld.inf Tue Aug 31 16:20:16 2010 +0300 @@ -24,6 +24,5 @@ PRJ_MMPFILES #include "../legacymodemplugin/group/bld.inf" -#include "../limitedpdpplugin/group/bld.inf" PRJ_TESTMMPFILES diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/group/bld.inf --- a/atext/plugins/limitedpdpplugin/group/bld.inf Thu Aug 19 11:01:00 2010 +0300 +++ /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: This file provides the information required for building the -* whole of limitedpdpplugin -* -*/ - -#include - -PRJ_PLATFORMS - -PRJ_EXPORTS -../rom/limitedpdpplugin.iby CORE_OS_LAYER_IBY_EXPORT_PATH(limitedpdpplugin.iby) - -PRJ_MMPFILES -limitedpdpplugin.mmp - -PRJ_TESTMMPFILES diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/group/limitedpdpplugin.mmp --- a/atext/plugins/limitedpdpplugin/group/limitedpdpplugin.mmp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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: Project definition file for project limitedpdpplugin -* -*/ - - -#include - -TARGET limitedpdpplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x20031617 - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE proxy.cpp -SOURCE limitedpdpplugin.cpp - -START RESOURCE ../src/20031617.rss -TARGET limitedpdpplugin.rsc -END - -USERINCLUDE ../inc - -OS_LAYER_SYSTEMINCLUDE - -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -SYSTEMINCLUDE /epoc32/include/ecom - -LIBRARY ecom.lib -LIBRARY euser.lib -LIBRARY atextpluginbase.lib -LIBRARY centralrepository.lib - -DEBUGLIBRARY flogger.lib diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/inc/debug.h --- a/atext/plugins/limitedpdpplugin/inc/debug.h Thu Aug 19 11:01:00 2010 +0300 +++ /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: Logging definitions -* -*/ - - -#ifndef PRJ_LOGGING_H -#define PRJ_LOGGING_H - -#include -#include "debugconfig.h" - -#ifdef PRJ_ENABLE_TRACE - -#ifdef PRJ_FILE_TRACE -#include -#else -#include -#endif - -NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow - { -public: - void Overflow(TDes16& /*aDes*/) {} - }; - -NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow - { -public: - void Overflow(TDes8& /*aDes*/) {} - }; - -inline void Trace(TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list,aFmt); -#ifdef PRJ_FILE_TRACE - RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); -#else - TBuf16 theFinalString; - theFinalString.Append(KTracePrefix16); - TOverflowTruncate16 overflow; - theFinalString.AppendFormatList(aFmt,list,&overflow); - RDebug::Print(theFinalString); -#endif - } - -inline void Trace(TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list, aFmt); -#ifdef PRJ_FILE_TRACE - RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); -#else - TOverflowTruncate8 overflow; - TBuf8 buf8; - buf8.Append(KTracePrefix8); - buf8.AppendFormatList(aFmt, list, &overflow); - TBuf16 buf16(buf8.Length()); - buf16.Copy(buf8); - TRefByValue tmpFmt(_L("%S")); - RDebug::Print(tmpFmt, &buf16); -#endif - } - -inline void TracePanic( - char* aFile, - TInt aLine, - TInt aPanicCode, - const TDesC& aPanicCategory) - { - TPtrC8 fullFileName((const TUint8*)aFile); - TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); - TBuf8 buf; - buf.Append(KPanicPrefix8); - buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName); - Trace(buf); - User::Panic(aPanicCategory, aPanicCode); - } - -inline void TraceLeave(char* aFile, TInt aLine, TInt aReason) - { - TPtrC8 fullFileName((const TUint8*)aFile); - TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); - TBuf8 buf; - buf.Append(KLeavePrefix8); - buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName); - Trace(buf); - User::Leave(aReason); - } - -#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;} - -#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;} - -#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;} - -#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;} - -#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;} - -#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);} - -#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory) - -#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);} - -#define LEAVE_IF_NULL(PTR) {if (!PTR) TraceLeave(__FILE__, __LINE__, PTR);} - -#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);} - -#define TRACE_STATIC_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}} - -#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}} - -#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}} - -#define TRACE_STATIC_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}} - -#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}} - -#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}} - -#else // PRJ_ENABLE_TRACE not defined - -#define TRACE_INFO(p) - -#define TRACE_ERROR(p) - -#define TRACE_STATE(p) - -#define TRACE_WARNING(p) - -#define TRACE_INFO_SEG(p) - -#define TRACE_ASSERT(GUARD, CODE) - -#define PANIC(CODE) {User::Panic(KPanicCategory, CODE);} - -#define LEAVE_IF_ERROR(REASON) {static_cast(User::LeaveIfError(REASON));} - -#define LEAVE_IF_NULL(PTR) {static_cast(User::LeaveIfNull(PTR));} - -#define LEAVE(REASON) {static_cast(User::Leave(REASON));} - -#define TRACE_STATIC_FUNC_ENTRY - -#define TRACE_FUNC_ENTRY - -#define TRACE_FUNC_EXIT - -#define TRACE_STATIC_FUNC - -#define TRACE_FUNC - -#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;} -#endif // PRJ_ENABLE_TRACE - -#endif // PRJ_LOGGING_H diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/inc/debugconfig.h --- a/atext/plugins/limitedpdpplugin/inc/debugconfig.h Thu Aug 19 11:01:00 2010 +0300 +++ /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: Logging configure file -* -*/ - - -#ifndef LIMITEDPDPPLUGIN_DEBUGCONFIG_H -#define LIMITEDPDPPLUGIN_DEBUGCONFIG_H - -#include "prjconfig.h" - -/** - * Custom logging variations. - */ -#ifdef PRJ_FILE_TRACE -_LIT(KLogFile,"limitedpdpplugin.txt"); -_LIT(KLogDir,"LIMITEDPDPPLUGIN"); -#endif - -#ifdef PRJ_ENABLE_TRACE -_LIT(KTracePrefix16, "[LIMITEDPDPPLUGIN] "); -_LIT8(KTracePrefix8, "[LIMITEDPDPPLUGIN] "); -_LIT8(KFuncFormat8, "><%S"); -_LIT8(KFuncThisFormat8, "><%S, [0x%08X]"); -_LIT8(KFuncEntryFormat8, ">%S"); -_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]"); -_LIT8(KFuncExitFormat8, "<%S"); - -_LIT(KPanicCategory, "limitedpdpplugin"); -_LIT8(KPanicPrefix8, "PANIC code "); -_LIT8(KLeavePrefix8, "LEAVE code "); -#endif - -const TInt KMaxLogLineLength = 512; - -#define KPRINTERROR 0x00000001 // Tracing level: error -#define KPRINTINFO 0x00000002 // Tracing level: function trace -#define KPRINTSTATE 0x00000004 // Tracing level: state machine info -#define KPRINTWARNING 0x00000008 // Tracing level: warning - -const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE | KPRINTWARNING; - -#endif // LIMITEDPDPPLUGIN_DEBUGCONFIG_H diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/inc/limitedpdpplugin.h --- a/atext/plugins/limitedpdpplugin/inc/limitedpdpplugin.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +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: Main handler for incoming requests - * - */ - -#ifndef C_LIMITEDPDPPLUGIN_H -#define C_LIMITEDPDPPLUGIN_H - -#include -#include -#include - -/** - * Class for selecting handlers for different AT commands - * - * @since TB9.2 - */ -NONSHARABLE_CLASS( CLimitedPdpPlugin ) : public CATExtPluginBase - { - -public: - - /** - * Two-phased constructor. - * @return Instance of self - */ - static CLimitedPdpPlugin* NewL(); - - /** - * Destructor. - */ - virtual ~CLimitedPdpPlugin(); - -private: - - CLimitedPdpPlugin(); - - void ConstructL(); - - /** - * Reports connection identifier name to the extension plugin. - * - * @since TB9.2 - * @param aName Connection identifier name - * @return None - */ - void ReportConnectionName( const TDesC8& aName ); - - /** - * Reports the support status of an AT command. This is synchronous API. - * - * @since TB9.2 - * @param aCmd The AT command. Its format may vary depending on the - * specification. - * a character carriage return () in the end. - * @return ETrue if the command is supported; EFalse otherwise. - */ - TBool IsCommandSupported( const TDesC8& aCmd ); - - /** - * Handles an AT command. Cancelling of the pending request is done by - * HandleCommandCancel(). The implementation in the extension plugin - * should be asynchronous. However, in this case, WE MUST IMPLEMENT THE - * PLUGIN synchronously and BLOCK ATEXT THREAD WHILE EXISTING CONNECTIONS - * ARE BEING CLOSED. This is due to the fact that this plugin is an - * observer and the modem AT command handler is issued immediately after - * this command returns. This has a couple of drawbacks: - * 1. ATEXT thread is blocked, which is against the requirements - * 2. Cancelling of this operation is not supported. - * - * The extension plugin which accepts this command is responsible to - * supply result codes and response and to format result codes properly. - * - * After an extension plugin has handled or decided to reject given AT - * command, it must inform ATEXT by HandleCommandCompleted() with proper - * error code. - * - * @since TB9.2 - * @param aCmd The AT command to be handled. - * @param aReply When passed in, contains the built in answer filled by - * ATEXT if it is not empty; when command handling - * completes successfully, contains the result codes and - * responses to this command - * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. - * @return None - */ - void - HandleCommand( const TDesC8& aCmd, - RBuf8& aReply, - TBool aReplyNeeded ); - - /** - * Cancels a pending HandleCommand request. - * - * @since TB9.2 - * @return None - */ - void HandleCommandCancel(); - - /** - * Next reply part's length. - * The value must be equal or less than KDefaultCmdBufLength. - * When the reply from this method is zero, ATEXT stops calling - * GetNextPartOfReply(). - * - * @since TB9.2 - * @return Next reply part's length if zero or positive - */ - TInt NextReplyPartLength(); - - /** - * Gets the next part of reply initially set by HandleCommandComplete(). - * Length of aNextReply must be equal or less than KDefaultCmdBufLength. - * - * @since TB9.2 - * @param aNextReply Next reply - * @return Symbian error code on error, KErrNone otherwise - */ - TInt GetNextPartOfReply( RBuf8& aNextReply ); - - /** - * Receives unsolicited results. Cancelling of pending request is done - * by ReceiveUnsolicitedResultCancel(). The implementation in extension - * plugin should be asynchronous. - * - * @since TB9.2 - * @return None - */ - void ReceiveUnsolicitedResult(); - - /** - * Cancels a pending ReceiveUnsolicitedResult request. - * - * @since TB9.2 - * @return None - */ - void ReceiveUnsolicitedResultCancel(); - - /** - * Reports NVRAM status change to the plugins. - * - * @since TB9.2 - * @param aNvram New NVRAM status. Each call of this function is a result - * of DUN extracting the form notified by - * CATExtCommonBase::SendNvramStatusChange(). Each of the - * settings from SendNvramStatusChange() is separated to - * one call of ReportNvramStatusChange(). - * @return None - */ - void ReportNvramStatusChange( const TDesC8& aNvram ); - - /** - * Reports about external handle command error condition. - * This is for cases when for example DUN decided the reply contained an - * error condition but plugin is still handling the command internally. - * This solution keeps the pointer to the last AT command handling plugin - * inside ATEXT and calls this function there to report the error. - * It is to be noted that HandleCommandCancel() is not sufficient to stop - * the processing as the command handling has already finished. - * - * @since TB9.2 - * @return None - */ - void ReportExternalHandleCommandError(); - - /** - * Checks whether this feature is on or off. Reads the value from CenRep - * and stores it to the internal variable. - * - * @since TB9.2 - * @return ETrue if enabled, EFalse otherwise - */ - TBool CheckFeatureEnablement(); - - /** - * Closes existing connections by setting PS key to ConnMon - * - * @since TB9.2 - * @return KErrNone if successful, otherwise Symbian error code - */ - TInt CloseExistingConnections(); - - /** - * Blocks thread until ConnMon indicates that existing packet data - * connections are closed. Operation is guarded by a timeout. - * - * @since TB9.2 - * @return KErrNone if successful, otherwise Symbian error code - */ - TInt BlockThreadUntilConnectionsClosed(); - -private: - // data - - /** - * Property handle used for communication with Connection monitor - */ - RProperty iProperty; - - /** - * Timer handle used for timeouting the ongoinging operation. Used for - * cancelling the closing of existing PDP contexts in case the operation - * takes too long. - */ - RTimer iCancelTimer; - - /** - * Value indicating whether this feature is enabled - */ - TBool iFeatureSupported; - - }; - -#endif // C_LIMITEDPDPPLUGIN_H diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/inc/limitedpdpplugincopiedkeys.h --- a/atext/plugins/limitedpdpplugin/inc/limitedpdpplugincopiedkeys.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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: Redefinition of used CenRep and PS keys. - * - */ - -#ifndef LIMITEDPDPPLUGINCOPYKEYS_H -#define LIMITEDPDPPLUGINCOPYKEYS_H - -/** - * NOTE: THIS FILE CONTAINS COPIES OF CENREP AND PS KEYS DEFINED - * IN IPCONNMGMT PACKAGE. DO NOT CHANGE!!! - * - * These needs to be copied to avoid dependency from OS layer (this module) - * to middleware layer (ipconnmgmt). Bad design choices... - */ - -/** - * UID of CmManager repository - */ -const TUid KCopyOfCRUidCmManager = - { - 0x10207376 - }; - -/** - * Dial-up override setting. - */ -const TUint32 KCopyOfDialUpOverride = 0x00000002; - -/** - * Connection Monitor RProperty category. - */ -const TUid KCopyOfConnectionMonitorPS = - { - 0x101F6CF0 - }; - -/** - * Dial-Up override key. - */ -const TUint KCopyOfDialUpConnection = 0x00000001; - -/** - * Values for KDialUpConnection key. - */ -enum TCopyOfDialUpStates - { - EConnMonDialUpClosed, - EConnMonDialUpInit, - EConnMonReady - }; - -#endif // LIMITEDPDPPLUGINCOPYKEYS_H diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/inc/prjconfig.h --- a/atext/plugins/limitedpdpplugin/inc/prjconfig.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project configure file -* -*/ - - -#ifndef ATEXT_PRJCONFIG_H -#define ATEXT_PRJCONFIG_H - -/** - * Traces are enabled in _DEBUG build, by default. - */ -#ifdef _DEBUG -#define PRJ_ENABLE_TRACE -#endif - -/** - * traces to file if this is defined. - */ -//#define PRJ_FILE_TRACE - - -/** - * build the project for module test purpose if this is defined - */ -//#define PRJ_MODULETEST_BUILD - -/** - * build the project using stubs to replace the dependencies if this is defined - */ -//#define PRJ_USE_STUB - - -#endif // ATEXT_PRJCONFIG_H diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/rom/limitedpdpplugin.iby --- a/atext/plugins/limitedpdpplugin/rom/limitedpdpplugin.iby Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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: Image description file for project limitedpdpplugin -* -*/ - - -#ifndef __LIMITEDPDPPLUGIN_IBY__ -#define __LIMITEDPDPPLUGIN_IBY__ - -ECOM_PLUGIN( limitedpdpplugin.dll, limitedpdpplugin.rsc ) - -#endif diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/src/20031617.rss --- a/atext/plugins/limitedpdpplugin/src/20031617.rss Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +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: Resource definitions for project limitedpdpplugin -* -*/ - - -#include -#include - -// Declares info for two implementations -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x20031617; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = ATEXT_INTERFACE_DUN_UID; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x20031618; - version_no = 1; - display_name = "Limited PDP Plugin"; - default_data= "OATD*"; - opaque_data = ""; - } - }; - } - }; - } diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/src/limitedpdpplugin.cpp --- a/atext/plugins/limitedpdpplugin/src/limitedpdpplugin.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,420 +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: Main handler for incoming requests - * - */ - -#include "limitedpdpplugin.h" -#include -#include "limitedpdpplugincopiedkeys.h" -#include "debug.h" - -// Internal constants -const TInt KDialupOverrideEnabled = 1; -const TInt KCloseTimeoutInterval = 15000000; // 15 secs -const TInt KCleanUpWaitTimeout = 300000; // 300 ms -#ifdef _DEBUG -const TInt KUsecToMSecDivider = 1000; -#endif - -// --------------------------------------------------------------------------- -// Two-phased constructor. -// --------------------------------------------------------------------------- -// -CLimitedPdpPlugin* CLimitedPdpPlugin::NewL() - { - CLimitedPdpPlugin* self = new ( ELeave ) CLimitedPdpPlugin(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -// -CLimitedPdpPlugin::~CLimitedPdpPlugin() - { - TRACE_FUNC_ENTRY - - // Check validity of handles so that Cancel functions can be called - if ( iProperty.Handle() != NULL ) - { - // Cancel just in case in spite of the fact that with current - // architecture cancelling of the operation is not possible - iProperty.Cancel(); - iProperty.Close(); - } - if ( iCancelTimer.Handle() != NULL ) - { - iCancelTimer.Cancel(); - iCancelTimer.Close(); - } - - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// CLimitedPdpPlugin::CLimitedPdpPlugin -// --------------------------------------------------------------------------- -// -CLimitedPdpPlugin::CLimitedPdpPlugin() : - CATExtPluginBase() - { - // Nothing to do here, resources are initialized in ConstructL - } - -// --------------------------------------------------------------------------- -// CLimitedPdpPlugin::ConstructL -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::ConstructL() - { - TRACE_FUNC_ENTRY - - // No need to use cleanup stack here, since these will be closed in - // destructor anyway. - User::LeaveIfError( iCancelTimer.CreateLocal() ); - User::LeaveIfError( iProperty.Attach( KCopyOfConnectionMonitorPS, - KCopyOfDialUpConnection ) ); - iFeatureSupported = EFalse; - iFeatureSupported = CheckFeatureEnablement(); - - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Reports connection identifier name to the extension plugin. -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::ReportConnectionName( const TDesC8& /*aName*/) - { - } - -// --------------------------------------------------------------------------- -// Reports the support status of an AT command. This is a synchronous API. -// --------------------------------------------------------------------------- -// -TBool CLimitedPdpPlugin::IsCommandSupported( const TDesC8& /*aCmd*/) - { - TRACE_FUNC_ENTRY - // Set the return value according to feature support - TRACE_INFO(( _L("Returning feature support value %d"), - static_cast(iFeatureSupported))); - TRACE_FUNC_EXIT - return iFeatureSupported; - } - -// --------------------------------------------------------------------------- -// Handles an AT command. Cancelling of the pending request is done by -// HandleCommandCancel(). The implementation in the extension plugin should -// be asynchronous, but in this case we must use blocking behavior. This has -// a couple of drawbacks. First, the ATEXT thread is blocked and possible, -// which is against the requirements, and secondly and more importantly, the -// cancelling of this operation is not supported. -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::HandleCommand( const TDesC8& /*aCmd*/, - RBuf8& /*aReply*/, - TBool /*aReplyNeeded*/) - { - TRACE_FUNC_ENTRY - - // Double check that we are actually supporting the feature - if ( iFeatureSupported ) - { - // Request ConnMon to close existing packet data connections - TInt retTemp = CloseExistingConnections(); - if ( retTemp == KErrNone ) - { - retTemp = BlockThreadUntilConnectionsClosed(); - if ( retTemp == KErrNone ) - { - // Internal connections closed. We need to wait for a while - // to make sure that lower layer resources are properly - // cleaned in order to avoid conflicts in resource - // allocation. Again thread needs to be blocked, therefore - // User::After. - // NOTE: This is definitely a bad workaround and unreliable - // approach, but there aren't too many options... - TRACE_INFO(( _L("Block for %d ms for resource cleanup"), - ( KCleanUpWaitTimeout / KUsecToMSecDivider ))); - User::After( KCleanUpWaitTimeout ); - TRACE_INFO(( _L("Cleanup wait completed, exit"))); - } - } - } - - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Cancels a pending HandleCommand request. -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::HandleCommandCancel() - { - TRACE_FUNC_ENTRY - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Next reply part's length. -// The value must be equal or less than KDefaultCmdBufLength. -// When the reply from this method is zero, ATEXT stops calling -// GetNextPartOfReply(). -// --------------------------------------------------------------------------- -// -TInt CLimitedPdpPlugin::NextReplyPartLength() - { - TRACE_FUNC_ENTRY - TRACE_FUNC_EXIT - return KErrNotSupported; - } - -// --------------------------------------------------------------------------- -// Gets the next part of reply initially set by HandleCommandComplete(). -// Length of aNextReply must be equal or less than KDefaultCmdBufLength. -// --------------------------------------------------------------------------- -// -TInt CLimitedPdpPlugin::GetNextPartOfReply( RBuf8& /*aNextReply*/) - { - TRACE_FUNC_ENTRY - TRACE_FUNC_EXIT - return KErrNotSupported; - } - -// --------------------------------------------------------------------------- -// Receives unsolicited results. Cancelling of the pending request is done by -// by ReceiveUnsolicitedResultCancel(). The implementation in the extension -// plugin should be asynchronous. -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::ReceiveUnsolicitedResult() - { - TRACE_FUNC_ENTRY - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Cancels a pending ReceiveUnsolicitedResult request. -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::ReceiveUnsolicitedResultCancel() - { - TRACE_FUNC_ENTRY - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Reports NVRAM status change to the plugins. -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::ReportNvramStatusChange( const TDesC8& /*aNvram*/) - { - TRACE_FUNC_ENTRY - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Reports about external handle command error condition. -// This is for cases when for example DUN decided the reply contained an -// error condition but the plugin is still handling the command internally. -// Example: "AT+TEST;+TEST2" was given in command line; "AT+TEST" returns -// non-EReplyTypeError condition and "AT+TEST2" returns EReplyTypeError. -// As the plugin(s) returning the non-EReplyTypeError may still have some -// ongoing operation then these plugins are notified about the external -// EReplyTypeError in command line processing. It is to be noted that -// HandleCommandCancel() is not sufficient to stop the processing as the -// command handling has already finished. -// --------------------------------------------------------------------------- -// -void CLimitedPdpPlugin::ReportExternalHandleCommandError() - { - TRACE_FUNC_ENTRY - TRACE_FUNC_EXIT - } - -// --------------------------------------------------------------------------- -// Reads CenRep key to check whether requested functionality is active. -// --------------------------------------------------------------------------- -// -TBool CLimitedPdpPlugin::CheckFeatureEnablement() - { - TRACE_FUNC_ENTRY - TBool enabled( EFalse ); - CRepository* cmRepository = NULL; - TRAP_IGNORE( cmRepository = CRepository::NewL ( KCopyOfCRUidCmManager ) ); - if ( cmRepository ) - { - TInt overrideValue = KErrNotFound; - TInt retTemp = cmRepository->Get( KCopyOfDialUpOverride, - overrideValue ); - - if ( ( retTemp == KErrNone ) && ( overrideValue - == KDialupOverrideEnabled ) ) - { - enabled = ETrue; - TRACE_INFO(( _L("Dialup override feature enabled"))); - } - } - delete cmRepository; - TRACE_FUNC_EXIT - return enabled; - } - -// --------------------------------------------------------------------------- -// Ask ConnMon to close all existing packet data connections -// --------------------------------------------------------------------------- -// -TInt CLimitedPdpPlugin::CloseExistingConnections() - { - TRACE_FUNC_ENTRY - - TInt dialupState( EConnMonReady ); - TInt retVal( KErrNone ); - - retVal = iProperty.Get( dialupState ); - if ( retVal == KErrNone ) - { - TRACE_INFO(( _L("Current dialup connection PS key value %d"), - dialupState )); - if ( dialupState != EConnMonDialUpInit ) - { - TRACE_INFO(( _L("Setting dialup connection PS key to value %d"), - EConnMonDialUpInit )); - retVal = iProperty.Set( EConnMonDialUpInit ); - } - else - { - // Error situation, we should not end up to this function if - // the connection closing is already in init state. - retVal = KErrNotReady; - } - } - TRACE_INFO(( _L("Closing existing connections done with status %d"), - retVal )); - TRACE_FUNC_EXIT - return retVal; - } - -// --------------------------------------------------------------------------- -// Synchronously block thread until ConnMon indicates that connections are -// closed or operation timeouts. -// --------------------------------------------------------------------------- -// -TInt CLimitedPdpPlugin::BlockThreadUntilConnectionsClosed() - { - TRACE_FUNC_ENTRY - - TInt dialupState( EConnMonDialUpInit ); - TInt retVal( KErrNone ); - - // Read the dialup value just to check if ConnMon has been able to update - // it already to reflect correct state. - retVal = iProperty.Get( dialupState ); - - if ( retVal == KErrNone ) - { - TRACE_INFO(( _L("Dialup connection PS key value before wait: %d"), - dialupState )); - if ( dialupState == EConnMonDialUpInit ) - { - // Block thread until value changes - TRequestStatus propertyStatus; - TRequestStatus timeoutStatus; - // Set operation to timeout if closing internal contexts fails. - // If timeout expires before PS key is updated, this plugin - // will pass the ATD*99# command to modem. Most probably - // that will fail due to lack of resources. However, if - // internal connections are not closed within this timeframe - // there will be problems anyway. So this is only to hasten - // end user feedback on error situation. - iCancelTimer.After( timeoutStatus, KCloseTimeoutInterval ); - - // Loop for property subscription just in case the ConnMon does - // not set correct value in first attempt. The loop exiting is - // done separately below, but this condition is better than using - // while ( ETrue ) - while ( dialupState != EConnMonReady ) - { - iProperty.Subscribe( propertyStatus ); - - TRACE_INFO(( _L("Blocking thread to wait connection closing") )); - User::WaitForRequest( propertyStatus, timeoutStatus ); - - // Wait completed, check which condition was valid - if ( propertyStatus != KRequestPending ) - { - if ( propertyStatus == KErrNone ) - { - // ConnMon changed the value, check if it is valid - TInt retVal = iProperty.Get( dialupState ); - if ( retVal == KErrNone ) - { - if ( dialupState == EConnMonReady ) - { - TRACE_INFO(( _L("Existing connections closed successfully") )); - } - else - { - // Otherwise retry - TRACE_INFO(( _L("Wrong internal connection state (%d), retry"), - dialupState )); - continue; - } - } - } - else - { - retVal = propertyStatus.Int(); - } - // We should exit the loop, either due success of error - // Cancel and wait for timeout request to complete - TRACE_INFO((_L("Existing connections closed (status: %d), cancel timer"), - retVal )); - iCancelTimer.Cancel(); - // Wait... If the completion of Cancel() is not waited - // here, CActiveScheduler will panic due to stray signal - // (E32USER-CBase panic code 46) - User::WaitForRequest( timeoutStatus ); - TRACE_INFO(( _L("Timeout cancelled (timeoutStatus: %d), exit wait"), - timeoutStatus.Int() )); - break; - } - else if ( timeoutStatus != KRequestPending ) - { - // Timeout or error, exit - TRACE_INFO(( _L("Wait for existing connections timeouted (status: %d)"), - timeoutStatus.Int() )); - // Cancel PS subscription and wait for its completion - iProperty.Cancel(); - User::WaitForRequest( propertyStatus ); - retVal = iProperty.Set( EConnMonDialUpClosed ); - TRACE_INFO(( _L("Subscription cancelled (status: %d) and state reset, exit"), - propertyStatus.Int() )); - retVal = KErrTimedOut; - break; - } - } - } - } - // All done, exit - TRACE_INFO(( _L("Exiting from wait with status %d"), retVal )); - - TRACE_FUNC_EXIT - return retVal; - } - diff -r 786b94c6f0a4 -r 5b153be919d4 atext/plugins/limitedpdpplugin/src/proxy.cpp --- a/atext/plugins/limitedpdpplugin/src/proxy.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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 ECom interface implementations -* -*/ - - -#ifndef LIMITEDPDPPLUGIN_H -#define LIMITEDPDPPLUGIN_H - -#include -#include -#include "limitedpdpplugin.h" - -// --------------------------------------------------------------------------- -// An array of TImplementationProxy objects which onnect each -// implemeation with its instantiation function -// --------------------------------------------------------------------------- -// -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x20031618, CLimitedPdpPlugin::NewL), // DUN - }; - -// --------------------------------------------------------------------------- -// Exported proxy function to resolve instantiation methods for an Ecom -// plug-in DLL -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -#endif // LIMITEDPDPPLUGIN_H diff -r 786b94c6f0a4 -r 5b153be919d4 atext/server/inc/atextmetadata.h --- a/atext/server/inc/atextmetadata.h Thu Aug 19 11:01:00 2010 +0300 +++ b/atext/server/inc/atextmetadata.h Tue Aug 31 16:20:16 2010 +0300 @@ -324,7 +324,7 @@ public: TATExtEntrySupport( TDesC8& aAtCmdFull, - RMessage2& aMessage, + const RMessage2& aMessage, CArrayFixFlat* aSupport ) : iAtCmdFull( aAtCmdFull ), iMessage( aMessage ), @@ -333,8 +333,6 @@ iStartIndex( KErrNotFound ), iSupportFound( EFalse ){} - TATExtEntrySupport& operator=( TATExtEntrySupport& aEntrySupport ); - /** * Full AT command for which to check the support * (base part + parameters) @@ -344,7 +342,7 @@ /** * Client request message for reading */ - RMessage2& iMessage; + const RMessage2& iMessage; /** * AT command's plugin entry support data. @@ -367,7 +365,7 @@ * Found plugin support for HandlePartialAndMasterPluginSupportL(). */ TBool iSupportFound; - + }; /** diff -r 786b94c6f0a4 -r 5b153be919d4 atext/server/src/atextmetadata.cpp --- a/atext/server/src/atextmetadata.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/atext/server/src/atextmetadata.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -2049,9 +2049,7 @@ TRACE_FUNC_EXIT return; } - TATExtEntrySupport entrySupport( aAtCmdFull, - const_cast(aMessage), - support ); + TATExtEntrySupport entrySupport( aAtCmdFull, aMessage, support ); TInt i; aComplInfo.iProcessed = EFalse; TInt count = support->Count(); @@ -2143,14 +2141,11 @@ HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() ); TPtr8 atCmdFullPtr = atCmdFull->Des(); atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull ); - // First send the entry to the observers - TATExtEntrySupport handleCommandEntry = aEntrySupport; - aEntrySupport.iStartIndex = aStartIndex; - SendToMultipleObserverL( aEntrySupport, atCmdFull ); - aEntrySupport = handleCommandEntry; // Now execute the HandleCommand() iCmdData.iReplyExpected = ETrue; // Set before HandleCommandL() HandleCommandL( aEntrySupport, ETrue ); + aEntrySupport.iStartIndex = aStartIndex; + SendToMultipleObserverL( aEntrySupport, atCmdFull ); CleanupStack::PopAndDestroy( atCmdFull ); aReplyExpected = ETrue; TRACE_FUNC_EXIT @@ -2192,8 +2187,8 @@ TPtr8 atCmdFullPtr = atCmdFull->Des(); atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull ); // Now execute the HandleCommand() + HandleCommandL( aEntrySupport, EFalse ); SendToMultipleObserverL( nextSupport, atCmdFull ); - HandleCommandL( aEntrySupport, EFalse ); CleanupStack::PopAndDestroy( atCmdFull ); } else @@ -2732,22 +2727,3 @@ TRACE_FUNC_EXIT return KErrNone; } - -// --------------------------------------------------------------------------- -// Assignment operator for ease of usage -// --------------------------------------------------------------------------- -// -TATExtEntrySupport& TATExtEntrySupport::operator=( TATExtEntrySupport& aEntrySupport ) - { - if ( &aEntrySupport == this ) - { - return aEntrySupport; - } - iAtCmdFull = aEntrySupport.iAtCmdFull; - iMessage = aEntrySupport.iMessage; - iSupport = aEntrySupport.iSupport; - iEntry = aEntrySupport.iEntry; - iStartIndex = aEntrySupport.iStartIndex; - iSupportFound = aEntrySupport.iSupportFound; - return *this; - } diff -r 786b94c6f0a4 -r 5b153be919d4 atext/server/src/atextsession.cpp --- a/atext/server/src/atextsession.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/atext/server/src/atextsession.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -898,7 +898,6 @@ if ( iEComSession ) { iEComSession->Close(); - iEComSession = NULL; } if ( !aSyncClose ) { diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_CIT_P581_BtExcluded.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_CIT_P581_BtExcluded.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_CIT_P581_BtExcluded.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -14,7 +14,7 @@ // // Run all the BT_ROMCONFIG_* tests -// Expects a ROM to be built without BT i.e. SYMBIAN_EXCLUDE_BLUETOOTH has been specified +// Expects a ROM to be built without BT i.e. __BT has NOT been specified RUN_SCRIPT c:\scripts\btromconfig\BT_ROMCONFIG_MANAGER_001.script diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_CIT_P581_BtIncluded.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_CIT_P581_BtIncluded.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_CIT_P581_BtIncluded.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -14,7 +14,7 @@ // // Run all the BT_INC_ROMCONFIG_* tests -// Expects a ROM to be built with BT i.e. SYMBIAN_EXCLUDE_BLUETOOTH has NOT been specified +// Expects a ROM to be built with BT i.e. __BT has been specified RUN_SCRIPT c:\scripts\btromconfig\BT_INC_ROMCONFIG_MANAGER_001.script diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_INC_ROMCONFIG_RSOCKETSERV_002.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_INC_ROMCONFIG_RSOCKETSERV_002.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_INC_ROMCONFIG_RSOCKETSERV_002.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-INC-ROMCONFIG-RSocketServ-002 //! @SYMTestCaseID BT-INC-ROMCONFIG-RSocketServ-002 //! @SYMTestCaseDesc RSocketServ::StartProtocol should succeed for Bluetooth protocols -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a __BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 3 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_MANAGER_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_MANAGER_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_MANAGER_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-MANAGER-001 //! @SYMTestCaseID BT-ROMCONFIG-MANAGER-001 //! @SYMTestCaseDesc Cannot conenct to RBTMan -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_MANAGER_002.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_MANAGER_002.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_MANAGER_002.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-MANAGER-002 //! @SYMTestCaseID BT-ROMCONFIG-MANAGER-002 //! @SYMTestCaseDesc Cannot connect to RBTRegServ -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_PAN_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_PAN_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_PAN_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -24,7 +24,7 @@ START_TESTCASE BT-ROMCONFIG-PAN-001 //! @SYMTestCaseID BT-ROMCONFIG-PAN-001 //! @SYMTestCaseDesc Cannot start a BT PAN RConnection -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RBTPHYLNKADAPT_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RBTPHYLNKADAPT_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RBTPHYLNKADAPT_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-RBTPHYLNKADAPT-001 //! @SYMTestCaseID BT-ROMCONFIG-RBTPHYLNKADAPT-001 //! @SYMTestCaseDesc Cannot open RBTPhysicalLinkAdapter -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RCOMMSERV_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RCOMMSERV_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RCOMMSERV_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-RCommServ-001 //! @SYMTestCaseID BT-ROMCONFIG-RCommServ-001 //! @SYMTestCaseDesc RCommServ::LoadCommModule should fail for Bluetooth -//! on a SYMBIAN_EXCLUDE_INFRARED ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_REMCON_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_REMCON_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_REMCON_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-REMCON-001 //! @SYMTestCaseID BT-ROMCONFIG-REMCON-001 //! @SYMTestCaseDesc Cannot open CRemConInterfaceSelector as Controller -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_REMCON_002.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_REMCON_002.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_REMCON_002.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-REMCON-002 //! @SYMTestCaseID BT-ROMCONFIG-REMCON-002 //! @SYMTestCaseDesc Cannot open CRemConInterfaceSelector as Target -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RHOSTRESOLVER_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RHOSTRESOLVER_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RHOSTRESOLVER_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-RHostResolver-001 //! @SYMTestCaseID BT-ROMCONFIG-RHostResolver-001 //! @SYMTestCaseDesc RHostResolver::Open should fail for Bluetooth protocols -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-RSocketServ-001 //! @SYMTestCaseID BT-ROMCONFIG-RSocketServ-001 //! @SYMTestCaseDesc RSocketServ::FindProtocol should fail for Bluetooth protocols -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_002.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_002.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_002.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-RSocketServ-002 //! @SYMTestCaseID BT-ROMCONFIG-RSocketServ-002 //! @SYMTestCaseDesc RSocketServ::StartProtocol should fail for Bluetooth protocols -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_003.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_003.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKETSERV_003.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-RSocketServ-003 //! @SYMTestCaseID BT-ROMCONFIG-RSocketServ-003 //! @SYMTestCaseDesc RSocketServ::GetProtocolInfo should not find Bluetooth protocols -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKET_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKET_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_RSOCKET_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-RSocket-001 //! @SYMTestCaseID BT-ROMCONFIG-RSocket-0001 //! @SYMTestCaseDesc RSocket::Open should fail for Infra-Red protocols -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_SDPAGENT_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_SDPAGENT_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_SDPAGENT_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-SDPAGENT-001 //! @SYMTestCaseID BT-ROMCONFIG-SDPAGENT-001 //! @SYMTestCaseDesc Cannot use SdpAgent -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_SDP_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_SDP_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_SDP_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-SDP-001 //! @SYMTestCaseID BT-ROMCONFIG-SDP-001 //! @SYMTestCaseDesc Cannot connect to RSdp -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_001.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_001.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_001.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-USER-001 //! @SYMTestCaseID BT-ROMCONFIG-USER-001 //! @SYMTestCaseDesc CBluetoothPhysicalLinks cannot be constructed -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_002.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_002.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_002.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-USER-002 //! @SYMTestCaseID BT-ROMCONFIG-USER-002 //! @SYMTestCaseDesc CBluetoothSocket cannot be constructed -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_003.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_003.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_003.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-USER-003 //! @SYMTestCaseID BT-ROMCONFIG-USER-003 //! @SYMTestCaseDesc CBluetoothSynchronousLink cannot be used -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_004.script --- a/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_004.script Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btexample/test/cit/ROMConfig/scripts/BT_ROMCONFIG_USER_004.script Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -18,7 +18,7 @@ START_TESTCASE BT-ROMCONFIG-USER-004 //! @SYMTestCaseID BT-ROMCONFIG-USER-004 //! @SYMTestCaseDesc RHCIDirectAccess cannot be opened -//! on a SYMBIAN_EXCLUDE_BLUETOOTH ROM +//! on a !__BT ROM //! @SYMREQ 5413 //! @SYMTestType CIT //! @SYMTestPriority 1 diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btextnotifiers/inc/BTExtNotifiersPartner.h --- a/bluetooth/btextnotifiers/inc/BTExtNotifiersPartner.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btextnotifiers/inc/BTExtNotifiersPartner.h Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2001-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" @@ -19,6 +19,7 @@ #include #include #include +#include /** @publishedPartner diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btsdp/server/epocsvr.cpp --- a/bluetooth/btsdp/server/epocsvr.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btsdp/server/epocsvr.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -967,12 +967,7 @@ // we wouldn't want to remove the record if an error did occur, // which is very unlikely as typically only 1 or 2 records are // added per session. - err = iSessionRecords.Append(newRecord); - if(err != KErrNone) - { - //if append fails delete the service record created above and return the error code - Server().DeleteServiceRecord(newRecord); - } + (void)iSessionRecords.Append(newRecord); } aMessage.Complete(err); } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/avctp/avctpPacketMgr.cpp --- a/bluetooth/btstack/avctp/avctpPacketMgr.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/avctp/avctpPacketMgr.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -31,10 +31,6 @@ _LIT8(KLogComponent, LOG_COMPONENT_AVCTP); #endif -#ifdef _DEBUG -PANICCATEGORY("pktmgr"); -#endif - using namespace SymbianAvctp; /** diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/avctp/avctpmuxer.cpp --- a/bluetooth/btstack/avctp/avctpmuxer.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/avctp/avctpmuxer.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -37,10 +37,6 @@ _LIT8(KLogComponent, LOG_COMPONENT_AVCTP); #endif -#ifdef _DEBUG -PANICCATEGORY("avctpmux"); -#endif - using namespace SymbianAvctp; #ifdef __FLOG_ACTIVE diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/l2cap/l2capSigStates.cpp --- a/bluetooth/btstack/l2cap/l2capSigStates.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/l2cap/l2capSigStates.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -898,9 +898,6 @@ void TL2CAPSigStateWaitConfig::Enter(CL2CapSAPSignalHandler& aSignalHandler) const { LOG_FUNC - // Cancel the Config timer if it's running - aSignalHandler.CancelTimer(); - // First start the ConfigReq sending delay timer (see DelayConfigRequest() for why). // It's short lived, we'll start the proper L2CAP config timer when it expires. aSignalHandler.StartConfigRequestDelayTimer(); diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/linkmgr/AclDataQController.cpp --- a/bluetooth/btstack/linkmgr/AclDataQController.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/linkmgr/AclDataQController.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -20,6 +20,7 @@ // #include +#include #include "AclDataQController.h" #include "linkmgr.h" #include "AclDataQ.h" diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/linkmgr/ProxySAP.cpp --- a/bluetooth/btstack/linkmgr/ProxySAP.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/linkmgr/ProxySAP.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2003-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" @@ -26,6 +26,7 @@ #include "linkmgr.h" #include +#include #ifdef __FLOG_ACTIVE _LIT8(KLogComponent, LOG_COMPONENT_LINKMGR); diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/linkmgr/Subscribers.cpp --- a/bluetooth/btstack/linkmgr/Subscribers.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/linkmgr/Subscribers.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -18,6 +18,7 @@ #include #include #include +#include #include "Subscribers.h" #include "linkmgr.h" #include "physicallinksmanager.h" diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/linkmgr/SyncSap.cpp --- a/bluetooth/btstack/linkmgr/SyncSap.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/linkmgr/SyncSap.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2003-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" @@ -17,6 +17,7 @@ #include #include +#include #include "SCOSAP.h" #include "physicallinksmanager.h" #include "physicallinks.h" diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/linkmgr/basebandsap.cpp --- a/bluetooth/btstack/linkmgr/basebandsap.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/linkmgr/basebandsap.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -16,6 +16,7 @@ // #include +#include #include "basebandsap.h" #include "physicallinksmanager.h" #include "physicallinks.h" diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/linkmgr/hostresolver.h --- a/bluetooth/btstack/linkmgr/hostresolver.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/linkmgr/hostresolver.h Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1999-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" @@ -24,6 +24,8 @@ #include #include #include +#include +#include // BT1.1: Could make these runtime configurable. diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/secman/SecManNotifiers.h --- a/bluetooth/btstack/secman/SecManNotifiers.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/secman/SecManNotifiers.h Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2005-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" @@ -17,6 +17,7 @@ #define _SECMANNOTIFIERS_H #include +#include class TBTDevAddr; diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/secman/pairingserver.cpp --- a/bluetooth/btstack/secman/pairingserver.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/secman/pairingserver.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -639,6 +639,7 @@ } } + void COobDataSession::XoldoLocalOobDataRetrieved(TInt aResult, const TBluetoothSimplePairingHash& aHash, const TBluetoothSimplePairingRandomizer& aRandomizer) { LOG_FUNC @@ -701,8 +702,8 @@ { LOG_FUNC iPhysicalLinksManager.SecMan().CancelRequest(*this); - delete iProxySap; // cannot do an immediate shutdown as the semantics for that kill the phy - if(!iStartBondingMsg.IsNull()) + delete iProxySap; + if(iStartBondingMsg.Handle()) { iStartBondingMsg.Complete(KErrCancel); } @@ -717,7 +718,6 @@ case EPairingServerStartDedicatedBond: StartBondingL(aMessage); break; - default: CPairingSubSession::DispatchSubSessMessageL(aMessage); break; @@ -727,18 +727,9 @@ void CDedicatedBondingSession::Complete(TInt aError) { LOG_FUNC - if(!iStartBondingMsg.IsNull()) - { - __ASSERT_DEBUG(!ShuttingDown(), PANIC(KPairingServerFaultCat, EPairingServerBadShutdownState)); - iState = EShutdownRequested; - iAsyncShutdown->CallBack(); - iPhysicalLinksManager.SecMan().CancelRequest(*this); // we don't want the result anymore (if it's still pending). - iStartBondingMsg.Complete(aError); - } - else - { - __ASSERT_DEBUG(ShuttingDown(), PANIC(KPairingServerFaultCat, EPairingServerBadShutdownState)); - } + iState = EShutdown; + iAsyncShutdown->CallBack(); + iStartBondingMsg.Complete(aError); } TInt CDedicatedBondingSession::StaticShutdown(TAny* aDedBond) @@ -751,49 +742,42 @@ void CDedicatedBondingSession::Shutdown() { LOG_FUNC - __ASSERT_DEBUG(iState == EShutdownRequested, PANIC(KPairingServerFaultCat, EPairingServerBadShutdownState)); - __ASSERT_DEBUG(iStartBondingMsg.IsNull(), PANIC(KPairingServerFaultCat, EPairingServerMessageShouldBeNull)); - iState = EShutdownPending; + __ASSERT_DEBUG(iState == EShutdown, PANIC(KPairingServerFaultCat, EPairingServerBadShutdownState)); + iState = EInvalid; iProxySap->Shutdown(CServProviderBase::ENormal); } - -TBool CDedicatedBondingSession::ShuttingDown() const - { - return iState == EShutdownRequested || iState == EShutdownPending; - } void CDedicatedBondingSession::StartBondingL(const RMessage2& aMessage) { LOG_FUNC - if(iState != EMintCondition) + if(!iStartBondingMsg.IsNull() || iState != EInvalid) { aMessage.Panic(KPairingServerPanicCat, EPairingServerDedicatedBondAlreadyInProgress); return; } - __ASSERT_DEBUG(iStartBondingMsg.IsNull(), PANIC(KPairingServerFaultCat, EPairingServerMessageShouldBeNull)); - - // Now we've been initiated, no turning back for this object. - iState = EInitiated; - + TPckgBuf addrBuf; TInt addrLen = aMessage.GetDesLengthL(0); if(addrLen != sizeof(TBTDevAddr)) { - // If the length is incorrect then the address has been packaged incorrectly for the + // If the length is correct then the address has been packaged incorrect for the // IPC operation. LEAVEL(KErrBadDescriptor); } aMessage.ReadL(0, addrBuf); + iStartBondingMsg = aMessage; + CleanupStack::PushL(TCleanupItem(CleanupStartMessage, this)); + TBTSockAddr addr; addr.SetBTAddr(addrBuf()); iProxySap = CBTProxySAP::NewL(iPhysicalLinksManager, NULL); + + CleanupStack::Pop(this); // the start message cleaner - iStartBondingMsg = aMessage; // Now we've entered the realm of not leaving with an error, since the connection // process has started. Errors from now on must be via the Error() function call. - iState = EInitialConnectionPending; iProxySap->SetNotify(this); iProxySap->SetRemName(addr); @@ -805,6 +789,13 @@ } } +void CDedicatedBondingSession::CleanupStartMessage(TAny* aPtr) + { + LOG_STATIC_FUNC + CDedicatedBondingSession* session = reinterpret_cast(aPtr); + session->iStartBondingMsg = RMessage2(); // blat the old one + } + void CDedicatedBondingSession::DoAccessRequestL() { LOG_FUNC @@ -842,7 +833,7 @@ // fall-through... case EInitialConnection: ASSERT_DEBUG(aResult != EBTSecManAccessDeferred); // Should have been disconnected if we receive - // this - I don't expect this to happen. + // this - I don't expect this to happen. // fall-through... case EFinalConnection: completed = ETrue; // in the final connection any complete is errored. @@ -851,15 +842,12 @@ err = KErrAccessDenied; } break; - case EInitialConnectionPending: - // fall-through deliberate case EFinalConnectionPending: // Access request shouldn't successfully complete if the connection is still pending __ASSERT_DEBUG(aResult != EBTSecManAccessGranted, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedAccessCallback)); // We should get the MSocketNotify::Error callback, so don't do anything else break; - default: LOG1(_L("Unexpected Access Request Complete in state %d"), iState); __ASSERT_DEBUG(EFalse, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedAccessCallback)); @@ -897,21 +885,15 @@ case EFinalConnectionPending: iState = EFinalConnection; break; - case EInitialConnection: - // fall-through deliberate case EFinalConnection: // Apparently multiple connect completes are allowed by CSocket break; - - case EShutdownRequested: - // fall-through deliberate - case EShutdownPending: + case EShutdown: // If an error occurred just after the connection request then we // might receive a connection complete before the async shutdown request - // has been executed or completed. + // has been executed. break; - default: LOG1(_L("Unexpected Connect Complete in state %d"), iState); __ASSERT_DEBUG(EFalse, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedSocketCallback)); @@ -942,9 +924,6 @@ void CDedicatedBondingSession::CanClose(TDelete aDelete) { LOG_FUNC - __ASSERT_DEBUG(iState == EShutdownPending, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedSocketCallback)); - __ASSERT_DEBUG(iStartBondingMsg.IsNull(), PANIC(KPairingServerFaultCat, EPairingServerMessageShouldBeNull)); - iState = EShutdown; if (aDelete == EDelete) { delete iProxySap; iProxySap = NULL; @@ -972,17 +951,12 @@ // enter the zombie state and wait for the access requester to complete. iState = EZombie; break; - case EFinalConnection: Error(KErrDisconnected); break; - - case EShutdownRequested: - // fall-through deliberate - case EShutdownPending: + case EShutdown: // Already closing down. break; - default: LOG1(_L("Unexpected Disconnect in state %d"), iState); __ASSERT_DEBUG(EFalse, PANIC(KPairingServerFaultCat, EPairingServerUnexpectedSocketCallback)); diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/secman/pairingserver.h --- a/bluetooth/btstack/secman/pairingserver.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/secman/pairingserver.h Tue Aug 31 16:20:16 2010 +0300 @@ -218,8 +218,8 @@ void Complete(TInt aError); + static void CleanupStartMessage(TAny* aPtr); static TInt StaticShutdown(TAny* aPtr); - TBool ShuttingDown() const; private: // from CPairingSubSession void DispatchSubSessMessageL(const RMessage2& aMessage); @@ -246,15 +246,12 @@ private: enum TState { - EMintCondition, - EInitiated, + EInvalid, EInitialConnectionPending, EInitialConnection, EZombie, EFinalConnectionPending, EFinalConnection, - EShutdownRequested, - EShutdownPending, EShutdown, }; diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/btstack/secman/public/pairingservershared.h --- a/bluetooth/btstack/secman/public/pairingservershared.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/btstack/secman/public/pairingservershared.h Tue Aug 31 16:20:16 2010 +0300 @@ -71,7 +71,6 @@ EPairingServerUnexpectedSocketCallback, EPairingServerUnexpectedAccessCallback, EPairingServerBadShutdownState, - EPairingServerMessageShouldBeNull, }; #endif // PAIRINGSERVERSHARED_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/group/bld.inf --- a/bluetooth/gavdp/group/bld.inf Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetooth/gavdp/group/bld.inf Tue Aug 31 16:20:16 2010 +0300 @@ -14,7 +14,6 @@ // BLD.INF for GAVDP user library // -#include "../test/bld.inf" PRJ_EXPORTS ../public/gavdp.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(gavdp.h) diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/activecallbackconsole.cpp --- a/bluetooth/gavdp/test/activecallbackconsole.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include "activecallbackconsole.h" - -CActiveCallBackConsole::CActiveCallBackConsole(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr) - : CActive(EPriorityStandard), iFunction(aFunction), iPtr(aPtr) - { - CActiveScheduler::Add(this); - } - - -CActiveCallBackConsole::~CActiveCallBackConsole() - { - Cancel(); - delete iConsole; - } - -CActiveCallBackConsole* CActiveCallBackConsole::NewL(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr, const TDesC& aTitle,const TSize& aSize) - { - CActiveCallBackConsole* console = new (ELeave) CActiveCallBackConsole(aFunction, aPtr); - CleanupStack::PushL(console); - console->ConstructL(aTitle,aSize); - CleanupStack::Pop(); - return console; - } - -void CActiveCallBackConsole::ConstructL(const TDesC& aTitle,const TSize& aSize) - { - iConsole = Console::NewL(aTitle,aSize); - } - -void CActiveCallBackConsole::DoCancel() - { - iConsole->ReadCancel(); - } - -void CActiveCallBackConsole::RequestKey() - { - DrawCursor(); - iConsole->Read(iStatus); - SetActive(); - } - -void CActiveCallBackConsole::DrawCursor() - { - iConsole->Printf(_L(">>")); - } - -void CActiveCallBackConsole::RunL() - { - // key has been pressed - TChar ch = iConsole->KeyCode(); - (*iFunction)(iPtr, ch); - } - -TInt CActiveCallBackConsole::RunError(TInt aError) - { - iConsole->Printf(_L("Console error %d\nTrying again...\n"), aError); - RequestKey(); - return KErrNone; - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/activecallbackconsole.h --- a/bluetooth/gavdp/test/activecallbackconsole.h Thu Aug 19 11:01:00 2010 +0300 +++ /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: -// - -#ifndef ACTIVECALLBACKCONSOLE_H -#define ACTIVECALLBACKCONSOLE_H - -#include -#include - - - -class CActiveCallBackConsole : public CActive - { -public: - static CActiveCallBackConsole* NewL(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr, const TDesC& aTitle,const TSize& aSize); - void RequestKey(); - - inline CConsoleBase& Console() const - { - return *iConsole; - }; - - ~CActiveCallBackConsole(); - -private: - void RunL(); - TInt RunError(TInt aError); - void DoCancel(); - void DrawCursor(); - CActiveCallBackConsole(TInt(*aFunction)(TAny *aPtr, TChar aKey), TAny* aPtr); - void ConstructL(const TDesC& aTitle,const TSize& aSize); - -private: - CConsoleBase* iConsole; - TInt(*iFunction)(TAny *aPtr, TChar aKey); - TAny* iPtr; - }; - -#endif //ACTIVECALLBACKCONSOLE_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/bld.inf --- a/bluetooth/gavdp/test/bld.inf Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +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: -// - -PRJ_TESTMMPFILES - -tavsrc.mmp diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrc.cpp --- a/bluetooth/gavdp/test/tavsrc.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2678 +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: -// - -#include "tavsrc.h" -#include "tavsrcUtils.h" -#include "tavsrcSock.h" -#include "tavsrcController.h" -#include "tavsrcStreamer.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef DBAWARE -#include "tavsrcmtupdaterdatabaseaware.h" -#else -#include "tavsrcmtupdaterdatabaseunaware.h" -#endif -#include "tavsrcAbsoluteVolume.h" - -#ifdef __WINS__ -static const TSize KMainConsole(75,30); -static const TSize KLogConsole(75,30); -#else -static const TSize KMainConsole(KConsFullScreen,KConsFullScreen); -static const TSize KLogConsole(KConsFullScreen,KConsFullScreen); -#endif - -using namespace SymbianBluetoothAV; -using namespace SymbianSBC; - -void CAVTestApp::PreventLowPowerModes() - { - // Prevent any other application from setting to low power mode - TInt err = iPhy.PreventLowPowerModes(EAnyLowPowerMode); - __LOG(_L("Low power mode prevented, result %d\n"), err); - } - -void CAVTestApp::AllowLowPowerModes() - { - // Allow any other application to set to low power mode - TInt err = iPhy.AllowLowPowerModes(EAnyLowPowerMode); - __LOG(_L("Low power mode allowed, result %d\n"), err); - } - -void CAVTestApp::EchoStorm() - { - //UPF test - //connect phy - CBluetoothPhysicalLinks* phys = NULL; - TRAP_IGNORE(phys = CBluetoothPhysicalLinks::NewL(*this, iSockServ)); - if (phys) - { - phys->CreateConnection(iDevAddr); - } - } - - void CAVTestApp::HandleCreateConnectionCompleteL(TInt /*aErr*/) - { - TBuf8<32> echo; - RSocket sock; - - sock.Open(iSockServ, _L("L2CAP")); - TL2CAPSockAddr addr; - addr.SetBTAddr(iDevAddr); - addr.SetPort(1); - - TRequestStatus status; - - __LOG(_L("Connecting l2cap")); - sock.Connect(addr, status); - User::WaitForRequest(status); - - echo.SetMax(); - echo.Fill('!'); - __LOG(_L("Echooing")); - FOREVER - { - sock.Ioctl(KL2CAPEchoRequestIoctl, status, &echo, KSolBtL2CAP); - User::WaitForRequest(status); - } - } - -void CAVTestApp::HandleDisconnectCompleteL(TInt /*aErr*/) - { - } - -void CAVTestApp::HandleDisconnectAllCompleteL(TInt /*aErr*/) - { - } - -void CAVTestApp::CreateStreamerL(RSocketArray aSockets) - { - __LOG(_L("Creating new streamer\n")); - iStreamer = CActiveStreamer::NewL(aSockets,iLogConsole->Console(), *this, iDisplayMode, iPreloadFile); - __LOG(_L("OK\n")); - } - -void CAVTestApp::Abort() - { - __PRINT(_L("\n (!ABORT!) Enter remote SEID to ABORT")); - TInt seid = TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()); - __PRINT(_L("\n")); - __LOG(_L("Aborting SEID &d...\n"),seid); - iGavdp.AbortStream(TSEID(seid, EFalse)); - } - -void CAVTestApp::SendSecurityControl() - { - __PRINT(_L("\n Enter remote SEID to Send Security Control")); - TInt seid = TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()); - __PRINT(_L("\n")); - __LOG(_L("Sending security control to SEID %d...\n"),seid); - - TBuf8<20> secBuf(_L8("Danger!\n")); - - iGavdp.SendSecurityControl(TSEID(seid, EFalse), secBuf); - } - -void CAVTestApp::GetCapabilities() - { - if (!iLocalReconfigure) // Don't change the remote SEID if we're reconfiguring - { - if (iAutoStream) - { - // start at first in shortlisted sep array - iCurrentSEID = iShortlistedSEIDs[0]; - iShortlistedSEIDs.Remove(0); // so next time around, take head again - } - else - { - __PRINT(_L("\n Enter remote SEID to get caps for")); - iCurrentSEID = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()), EFalse); - } - } - - __PRINT(_L("\n")); - __LOG(_L("Getting Capabilities for SEID %d...\n"),iCurrentSEID.Value()); - - iSEPCapabilities.ResetAndDestroy(); //clear what's already there - - // we're interested in all caps as we are *TEST CODE* - // some GCs should only register interest in the capabilities they might select - TAvdtpServiceCategories caps; - caps.SetCapability(EAllServiceCategories); - - iGavdp.GetRemoteSEPCapabilities(iCurrentSEID, caps); - } - - -void CAVTestApp::GAVDP_SEPCapability(TAvdtpServiceCapability* aCapability) - { - TInt err; - PrettyPrint(*aCapability); - - // we own cap, stash it in our RPointerArray for owning and later use - err = iSEPCapabilities.Append(aCapability); - - if(err == KErrNone) - { - // check if remote does SBC - if (aCapability->Category() == EServiceCategoryMediaCodec) - { - if (static_cast(aCapability)->MediaCodecType() == EAudioCodecSBC) - { - iChosenSEP = ETrue; - __LOG(_L("Found remote suitable SEP with SEID %d\n"), iCurrentSEID.SEID()); - } - } - } - else - { - delete aCapability; - } - } - - -void CAVTestApp::GAVDP_SEPDiscoveryComplete() - { - // complete the operation - iOperations->EndOperation(KTavsrcOpDiscoverSEPs, KErrNone); - - __LOG(_L("GAVDP:SEP Discovery complete.\n")); - - if (iAutoStream) - { - // go through all the shortlisted SEPs to find the SBC one - GetCapabilities(); - } - TestMenu(); - } - -void CAVTestApp::GAVDP_SEPCapabilityComplete() - { - // complete the operation - iOperations->EndOperation(KTavsrcOpGetCapabilities, KErrNone); - - __LOG(_L("GAVDP:SEP has no more capabilities.\n")); - - if ((iAutoStream && iChosenSEP) || iLocalReconfigure) - { - // configure iCurrentSEID - TRAPD(err, ConfigureSEPL()); - if (err != KErrNone) - { - __LOG(_L("Error configuring remote SEP: %d\n"), err); - } - } - else if (iAutoStream && !iShortlistedSEIDs.Count()) - { - __LOG(_L("Error: Remote does not have SBC codec available\n")); - } - else if (iAutoStream) - { - //try next sep - GetCapabilities(); - } - TestMenu(); - } - -void CAVTestApp::GAVDP_ConnectConfirm(const TBTDevAddr& aAddr) - { - // complete the operation - iOperations->EndOperation(KTavsrcOpConnect, KErrNone); - - // update our tiny state... - iGavdpState = ESigConnected; - - // hack :o) - iDevAddr = aAddr; - __LOG(_L("Signalling channel connected = GAVDP ready\n")); - - // Open RBTPhysicalLinkAdapter for prevention of low power modes during streaming - TInt err = iPhy.Open(iSockServ, iDevAddr); - __LOG(_L("Opened iPhy, result %d\n"), err); - - TestMenu(); - } - -void CAVTestApp::GAVDP_SEPDiscovered(const TAvdtpSEPInfo& aSEPInfo) - { - // this test code at present doesnt "remember" the SEPs - switch (aSEPInfo.MediaType()) - { - case EAvdtpMediaTypeAudio: - __LOG(_L("Audio")); - break; - case EAvdtpMediaTypeVideo: - __LOG(_L("Video")); - break; - case EAvdtpMediaTypeMultimedia: - __LOG(_L("Multimedia")); - break; - } - - if (aSEPInfo.IsSink()) - { - __LOG(_L(" Sink")); - } - else - { - __LOG(_L(" Source")); - } - - __LOG(_L(" SEP (SEID %d)"), aSEPInfo.SEID().Value()); - - if (aSEPInfo.InUse()) - { - __LOG(_L("[In use]")); - } - - // as we intend streaming audio, we need a free audio sink sep - if (aSEPInfo.MediaType()==EAvdtpMediaTypeAudio && aSEPInfo.IsSink() && !aSEPInfo.InUse()) - { - __LOG(_L("<-- Shortlisted SEP")); - (void)iShortlistedSEIDs.Append(aSEPInfo.SEID()); - } - - __LOG(_L("\n")); - TestMenu(); - } - - -void CAVTestApp::GAVDP_AbortStreamConfirm() - { - // complete the operation - iOperations->EndOperation(KTavsrcOpAbort, KErrNone); - - __LOG(_L("GAVDP:Aborted\n")); - delete iStreamer; - iStreamer = NULL; - - AllowLowPowerModes(); - - TestMenu(); - } - -void CAVTestApp::GAVDP_SecurityControlConfirm(const TDesC8& aResponseData) - { - // complete the operation - iOperations->EndOperation(KTavsrcOpContentProtection, KErrNone); - - __LOG(_L("GAVDP:Security control complete\n")); - __LOG(_L("GAVDP:Security control rsp=%S\n"), &aResponseData); - - TestMenu(); - } - -void CAVTestApp::GAVDP_StartStreamsConfirm() - { - // complete the operation - iOperations->EndOperation(KTavsrcOpStartStreams, KErrNone); - - __LOG(_L("GAVDP: StartStreamConfirm: now ready for use\n")); - - RThread().SetPriority(EPriorityRealTime); - - if (iLocalReconfigure) - { - iStreamer->ReStream(); - iStreamState = EStreaming; - - iOperations->EndOperation(KTavsrcOpStream, KErrNone); - iLocalReconfigure = EFalse; - } - else if (iAutoStream) - { - //this maynot be true as SNK can be INT (but tavsrc only looks for remote SNKs) - iStreamer->Stream(CurrentSEIDIsSink()); - iStreamState = EStreaming; - - iOperations->EndOperation(KTavsrcOpStream, KErrNone); - } - - iAutoStream = EFalse; // done - iLocalReconfigure = EFalse; - - PreventLowPowerModes(); - - TestMenu(); - } - -void CAVTestApp::GAVDP_SuspendStreamsConfirm() - { - // complete the operation - iOperations->EndOperation(KTavsrcOpSuspendStreams, KErrNone); - - iGavdpState = ESuspended; - - __LOG(_L("Suspending stream!\n")); - iStreamer->Suspend(); - iStreamState = EPaused; - - // we might be doing a reconfigure due to a request from the streamer - if (iLocalReconfigure) - { - GetCapabilities(); - } - - AllowLowPowerModes(); - - TestMenu(); - } - -void CAVTestApp::GAVDP_ConfigurationConfirm() - { - // complete the operation - if (iRegisteringLocalSEP) - { - __LOG(_L("SEP [SEID %d]: Local Configuration complete\n"), iCurrentSEID.SEID()); - iOperations->EndOperation(KTavsrcOpRegisterSEP, KErrNone); - - iRegisteringLocalSEP = EFalse; - - // time to listen now SEP registered, ignore error, logged in Listen() - Listen(); - } - else - { - __LOG(_L("SEP [SEID %d]: Remote Configuration complete\n"), iCurrentSEID.SEID()); - iOperations->EndOperation(KTavsrcOpConfigureSEP, KErrNone); - - // we might be doing a reconfigure due to a request from the streamer - if (iLocalReconfigure) - { - StartStreams(); - } - // if we;re doing autoCSR stuff we choose to go straight to open - else if (iAutoStream) - { - CreateBearers(); - } - } - - TestMenu(); - } - -void CAVTestApp::GAVDP_Error(TInt aError, const TDesC8& /*aErrorData*/) - { - __LOG(_L("GAVDP: **Error**: %d:\n"), aError); - - // complete the outstanding operation with an error - iOperations->EndOperation(0, aError); - - switch (aError) - { - case KErrAvdtpBaseError-KErrAvdtpRequestTimeout: - { - __LOG(_L("AVDTP Request timed out\n")); - break; - } - case -6305: - case KErrDisconnected: - { - iPhy.Close(); - __LOG(_L("Closed iPhy\n")); - - __LOG(_L("Signalling disconnected\nTest code is going to Re-listen...\n")); - aError = Listen(); - - iAutoStream = EFalse; - if (iStreamer) - { - iStreamer->Stop(); - } - iStreamState = EStopped; - - // reset the state - iOperations->EndOperation(KTavsrcOpDisconnectSrc, aError); - break; - } - - // Errors we can't match to a specific command - case EAvdtpBadHeaderFormat: - case EAvdtpBadLength: - case EAvdtpBadACPSEID: - case EAvdtpBadPayloadFormat: - case EAvdtpNotSupportedCommand: - case EAvdtpBadState: - { - __LOG(_L("Couldn't determine operation that caused error\n")); - break; - } - - // Errors on SetConfig/Reconfig - case EAvdtpSEPInUse: - case EAvdtpSepNotInUse: - case EAvdtpBadServCategory: - case EAvdtpInvalidCapabilities: - case EAvdtpBadRecoveryType: - case EAvdtpBadMediaTransportFormat: - case EAvdtpBadReportingFormat: - case EAvdtpBadRecoveryFormat: - case EAvdtpBadRohcFormat: - case EAvdtpBadCpFormat: - case EAvdtpBadMultiplexingFormat: - case EAvdtpUnsupportedConfiguration: - case EGavdpBadService: - case EGavdpInsufficientResource: - case EA2dpInvalidCodec: - case EA2dpNotSupportedCodec: - case EA2dpInvalidSamplingFrequency: - case EA2dpNotSupportedSamplingFrequency: - case EA2dpInvalidChannelMode: - case EA2dpNotSupportedChannelMode: - case EA2dpInvalidSubbands: - case EA2dpNotSupportedSubbands: - case EA2dpInvalidAllocationMethod: - case EA2dpNotSupportedAllocationMethod: - case EA2dpInvalidMinimumBitPoolValue: - case EA2dpNotSupportedMinimumBitPoolValue: - case EA2dpInvalidMaximumBitPoolValue: - case EA2dpNotSupportedMaximumBitPoolValue: - case EA2dpInvalidLayer: - case EA2dpNotSupportedLayer: - case EA2dpNotSupportedCRC: - case EA2dpNotSupportedMPF: - case EA2dpNotSupportedVBR: - case EA2dpInvalidBitRate: - case EA2dpNotSupportedBitRate: - case EA2dpInvalidObjectType: - case EA2dpNotSupportedObjectType: - case EA2dpInvalidChannels: - case EA2dpNotSupportedChannels: - case EA2dpInvalidVersion: - case EA2dpNotSupportedVersion: - case EA2dpNotSupportedSUL: - case EA2dpInvalidBlockLength: - case EA2dpInvalidCPType: - case EA2dpInvalidCPFormat: - { - __LOG(_L("Error setting configuration\n")); - break; - }; - } - - TestMenu(); - } - -// passive gubbins -void CAVTestApp::GAVDP_ConfigurationStartIndication(TSEID aLocalSEID, TSEID aRemoteSEID) - { - // ah - remote is attempting to confuigure us - // we need to set our state - __LOG(_L("Remote SEP [SEID %d] is configuring Local SEP [SEID %d]\n"), aRemoteSEID.Value(), aLocalSEID.Value()); - - - // the seid has already been checked, but we could see which of our endpoints this refers to - iGavdpState = ERemoteReconfiguring; - iCurrentSEID = aRemoteSEID; - iCurrentLocalSEID = aLocalSEID; - } - -TInt CAVTestApp::GAVDP_ConfigurationIndication(TAvdtpServiceCapability* aCapability) - { - // the new capability proposed by remote - __LOG(_L("Configuration proposed: category %d\n"), aCapability->Category()); - - // for this test code we currently accept everything - //** A REAL GC SHOULD THINK ABOUT WHAT THE REMOTE IS PROPOSING - PrettyPrint(*aCapability); - - TInt ret = KErrNone; - if (aCapability->Category() == EServiceCategoryRecovery) - { - TAvdtpRecoveryCapabilities* recCap = static_cast(aCapability); - if (static_cast(recCap->RecoveryType()) == 0xff) - { - ret = ConvertToSymbianError::AvdtpError(EAvdtpBadRecoveryType); - } - - } - - - if (ret == KErrNone) - { - delete aCapability; - } - - return ret; - } - - -TInt CAVTestApp::GAVDP_ConfigurationEndIndication() - { - // just accept all we saw - __LOG(_L("GAVDP: Remote configuration proposals now finished")); - __LOG(_L(" - we are replying that all is OK\n")); - - // real GC should think about what remote has said!! - - return KErrNone; - } - -TInt CAVTestApp::GAVDP_StartIndication(TSEID aLocalSEID) - { - __LOG(_L("Start indication for Local SEID %d\n"), aLocalSEID.SEID()); - TInt err = KErrNone; - - if(iStreamer) - { - __LOG(_L("Starting streamer (passively!)\n")); - - TBool sink = EFalse; - - for (TInt i=0; iStream(sink); - iStreamState = EStreaming; - - iOperations->EndOperation(KTavsrcOpStream, KErrNone); - - PreventLowPowerModes(); - } - else - { - __LOG(_L("No streamer! Rejecting start\n")); - err = KErrNotReady; - } - TestMenu(); - return err; - } - -void CAVTestApp::GAVDP_AbortIndication(TSEID aSEID) - { - __LOG(_L("GAVDP:Stream %d ABORTED by peer\n"), aSEID.SEID()); - - iOperations->EndOperation(KTavsrcOpAbort, KErrNone); - - delete iStreamer; - iStreamer = NULL; - - iPhy.Close(); - __LOG(_L("Closed iPhy\n")); - - TestMenu(); - } - -void CAVTestApp::GAVDP_ReleaseIndication(TSEID aSEID) - { - __LOG(_L("GAVDP:Stream %d RELEASED by peer\n"), aSEID.SEID()); - - AllowLowPowerModes(); - } - - -TInt CAVTestApp::GAVDP_SuspendIndication(TSEID aSEID) - { - __LOG(_L("GAVDP:Stream %d SUSPENDED by peer\n"), aSEID.SEID()); - - iStreamer->Suspend(); - // should ask the streamer object what SEID it is streaming really - - // as test code we always consume this for now - iOperations->EndOperation(KTavsrcOpSuspendStreams, KErrNone); - - AllowLowPowerModes(); - - TestMenu(); - return KErrNone; - } - -TInt CAVTestApp::GAVDP_SecurityControlIndication(TSEID aSEID, TDes8& aSecurityData) - { - __LOG(_L("GAVDP:Got security control data length %d for SEID %d\n"), aSecurityData.Length(), aSEID.Value()); - - TBool identical = TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("Security control data: respond identically?")); - if (!identical) - { - aSecurityData[0]^='!'; - } - - return KErrNone; - } - -void CAVTestApp::GAVDP_BearerReady(RSocket aNewSocket, const TAvdtpSockAddr& aAddr) - { - // wrap socket with active wrapper... - __LOG(_L("Got a bearer, for session %d\n"), aAddr.Session()); - - // we'll make a streamer now (easy way to keep this socket) - // set the PHY to be AV friendly! - switch(aAddr.Session()) - { - case EMedia: - { - iPendingSockets[0] = aNewSocket; - - // complete the operation - iOperations->EndOperation(KTavsrcOpCreateBearers, KErrNone); - - iGavdpState = EOpen; - - // all bearers ready! - __LOG(_L("Got all bearers, can now start\n")); - - RBTPhysicalLinkAdapter phy; - - // AV sockets don't foward opts yet so use addr version - TInt err = phy.Open(iSockServ, iDevAddr); - TUint16 packets = EPacketsDH1|EPacketsDH3|EPacketsDH5; - err = phy.RequestChangeSupportedPacketTypes(packets); - __LOG(_L("Modified PHY, result %d\n"), err); - TRAP(err, CreateStreamerL(iPendingSockets)); //FIXME arrange array better for different #bearers - if(err) - { - __LOG(_L("Creating streamer failed with err %d, closing socket\n"), err); - aNewSocket.Close(); - } - - if (iAutoStream) - { - StartStreams(); - } - // but not start streaming until manually started - - TestMenu(); - break; - } - case EReporting: - { - iPendingSockets[1] = aNewSocket; -#ifdef CHANNEL_BINDING_DEBUG_CHECK - TInt err(KErrNone); - // Create the active socket reader - TRAP(err,iRepReader = CActiveSockReader::NewL(iPendingSockets[1], EReporting)); - if (err != KErrNone) - { - __LOG(_L("Creating active socket reader failed with error %d"),err); - } - else - { - iRepReader->Start(); - } - // Create the active socket writer - TRAP(err,iRepWriter = CActiveSockWriter::NewL(iPendingSockets[1], EReporting)); - if (err != KErrNone) - { - __LOG(_L("Creating active socket writer failed with error %d"),err); - } - else - { - iRepWriter->Send(); - } -#endif - } - break; - - case ERecovery: - { - iPendingSockets[2] = aNewSocket; -#ifdef CHANNEL_BINDING_DEBUG_CHECK - TInt err(KErrNone); - // Create the active socket reader - TRAP(err,iRecvReader = CActiveSockReader::NewL(iPendingSockets[2], ERecovery)); - if (err != KErrNone) - { - __LOG(_L("Creating active socket reader failed with error %d"),err); - } - else - { - iRecvReader->Start(); - } - // Create the active socket writer - TRAP(err,iRecvWriter = CActiveSockWriter::NewL(iPendingSockets[2], ERecovery)); - if (err != KErrNone) - { - __LOG(_L("Creating active socket writer failed with error %d"),err); - } - else - { - iRecvWriter->Send(); - } -#endif - } - break; - default: - __DEBUGGER(); - break; - } - } - -void CAVTestApp::PrettyPrint(TAvdtpServiceCapability& aCapability) - { - __LOG(_L("Capability = ")); - - switch (aCapability.Category()) - { - case EServiceCategoryMediaTransport: - __LOG(_L("Media Transport\n")); - break; - - case EServiceCategoryReporting: - __LOG(_L("Reporting\n")); - break; - - case EServiceCategoryRecovery: - __LOG(_L("Recovery\n")); - break; - - case EServiceCategoryContentProtection: - __LOG(_L("Content Protection: Type %d\n"), static_cast(aCapability).ContentProtectionType()); - break; - - case EServiceCategoryHeaderCompression: - __LOG(_L("Header Compression\n")); - break; - - case EServiceCategoryMultiplexing: - __LOG(_L("Multiplexing\n")); - break; - - case EServiceCategoryMediaCodec: - __LOG(_L("Media Codec\n-----------\n")); - // print name of codec - TAvdtpMediaCodecCapabilities& codecCaps = static_cast(aCapability); - switch (codecCaps.MediaType()) - { - case EAvdtpMediaTypeAudio: - __LOG(_L("Audio:")); - break; - case EAvdtpMediaTypeVideo: - __LOG(_L("Video:")); - break; - case EAvdtpMediaTypeMultimedia: - __LOG(_L("Multimedia:")); - break; - } - - if (codecCaps.MediaCodecType() == EAudioCodecSBC) - { - __LOG(_L("SBC\n")); - - TSBCCodecCapabilities& sbcCaps = static_cast(aCapability); - __LOG(_L("Sampling frequencies: ")); - if (sbcCaps.SamplingFrequencies() & E48kHz) __LOG(_L("48kHz ")); - if (sbcCaps.SamplingFrequencies() & E44100Hz) __LOG(_L("44.1kHz ")); - if (sbcCaps.SamplingFrequencies() & E32kHz) __LOG(_L("32kHz ")); - if (sbcCaps.SamplingFrequencies() & E16kHz) __LOG(_L("16kHz")); - __LOG(_L("\nChannel modes: ")); - if (sbcCaps.ChannelModes() & EMono) __LOG(_L("Mono ")); - if (sbcCaps.ChannelModes() & EStereo) __LOG(_L("Stereo ")); - if (sbcCaps.ChannelModes() & EJointStereo) __LOG(_L("JointStereo ")); - if (sbcCaps.ChannelModes() & EDualChannel) __LOG(_L("DualChannel")); - __LOG(_L("\nBlockLengths: ")); - if (sbcCaps.BlockLengths() & EBlockLenFour) __LOG(_L("4 ")); - if (sbcCaps.BlockLengths() & EBlockLenEight) __LOG(_L("8 ")); - if (sbcCaps.BlockLengths() & EBlockLenTwelve) __LOG(_L("12 ")); - if (sbcCaps.BlockLengths() & EBlockLenSixteen) __LOG(_L("16")); - __LOG(_L("\nSubbands: ")); - if (sbcCaps.Subbands() & EFourSubbands) __LOG(_L("4 ")); - if (sbcCaps.Subbands() & EEightSubbands) __LOG(_L("8")); - __LOG(_L("\nAllocation: ")); - if (sbcCaps.AllocationMethods() & ELoudness) __LOG(_L("Loudness ")); - if (sbcCaps.AllocationMethods() & ESNR) __LOG(_L("SNR")); - __LOG(_L("\nMinBitpool: %d"), sbcCaps.MinBitpoolValue()); - __LOG(_L("\nMaxBitpool: %d\n"), sbcCaps.MaxBitpoolValue()); - } - else - { - TNonSBCCodecCapabilities& nonSbcCaps = static_cast(aCapability); - TPtrC8 codecData = nonSbcCaps.CodecData(); - - switch (codecCaps.MediaCodecType()) - { - case EAudioCodecMPEG12Audio: - __LOG(_L("MPEG1,2 Audio\n")); - __LOG(_L("Manually parsing caps of length %d\n"), codecData.Length()); - __LOG(_L("Layers: ")); - if (codecData[0] & 0x80) __LOG(_L("mp1")); - if (codecData[0] & 0x40) __LOG(_L("mp2")); - if (codecData[0] & 0x20) __LOG(_L("mp3")); - __LOG(_L("\nCRC protection: ")); - codecData[0] & 0x10 ? __LOG(_L("yes")) : __LOG(_L("no")); - __LOG(_L("\nChannel modes: ")); - if (codecData[0] & 0x08) __LOG(_L("Mono ")); - if (codecData[0] & 0x04) __LOG(_L("DualChannel ")); - if (codecData[0] & 0x02) __LOG(_L("Stereo ")); - if (codecData[0] & 0x01) __LOG(_L("JointStereo")); - __LOG(_L("\nMPF: %d"), codecData[1] & 0x40 ? 1 : 0); - __LOG(_L("\nSampling frequencies: ")); - if (codecData[1] & 0x20) __LOG(_L("16kHz ")); - if (codecData[1] & 0x10) __LOG(_L("22.05kHz ")); - if (codecData[1] & 0x08) __LOG(_L("24kHz ")); - if (codecData[1] & 0x04) __LOG(_L("32kHz ")); - if (codecData[1] & 0x02) __LOG(_L("44.1kHz ")); - if (codecData[1] & 0x01) __LOG(_L("48kHz")); - __LOG(_L("\nVBR: ")); - codecData[2] & 0x80 ? __LOG(_L("yes")) : __LOG(_L("no")); - __LOG(_L("\nBit rate index: %b\n"), codecData[3]+((codecData[2] & 0x7f)<<8)); - break; - case EAudioCodecMPEG24AAC: - __LOG(_L("MPEG 2,4 AAC\n")); - __LOG(_L("Not parsing caps of length %d\n"), nonSbcCaps.CodecData().Length()); - break; - case EAudioCodecATRAC: - __LOG(_L("ATRAC\n")); - __LOG(_L("Not parsing caps of length %d\n"), nonSbcCaps.CodecData().Length()); - break; - - default: - __LOG(_L("Unknown codec, Type %d\n"), codecCaps.MediaCodecType()); - } - } - } - } - -TInt CAVTestApp::Listen() - { - TInt err = iGavdp.Listen(); - __LOG(_L("Listening (result %d)\n"), err); - return err; - } - -void CAVTestApp::StartStreams() - { - iGavdpState = EOpen; - TSEID seid; - - if (iAutoStream) - { - seid = iCurrentSEID; - } - else - { - __PRINT(_L("\n Enter remote SEID to start streaming")); - seid = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()),EFalse); - } - - __PRINT(_L("\n")); - __LOG(_L("Starting remoteSEP %d streaming...\n"),seid.SEID()); - - iGavdp.StartStream(seid); - } - -void CAVTestApp::SuspendStreams() - { - TSEID seid; - - if (iAutoStream) - { - seid = iCurrentSEID; - } - else - { - __PRINT(_L("\n Enter remote SEID to suspend streaming")); - seid = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()),EFalse); - } - - __PRINT(_L("\n")); - __LOG(_L("Suspending remoteSEP %d streaming...\n"),seid.SEID()); - - iGavdp.SuspendStream(seid); - iGavdpState = EOpen; - } - -TSBCCodecCapabilities CAVTestApp::InteractiveSBCMediaCodecConfig(TSBCCodecCapabilities& caps) - { - TSBCCodecCapabilities res; - - TSBCSamplingFrequencyBitmask freqs = caps.SamplingFrequencies(); - TBool resp = EFalse; - - if (freqs) - { - __PRINT(_L("\nFreqs: Remote Supports: ")); - if (freqs & E48kHz && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("48kHz Use")); - if (resp) - { - res.SetSamplingFrequencies(E48kHz); - } - } - if (freqs & E44100Hz && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n44.1kHz Use")); - if (resp) - { - res.SetSamplingFrequencies(E44100Hz); - } - } - if (freqs & E32kHz && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n32kHz Use")); - if (resp) - { - res.SetSamplingFrequencies(E32kHz); - } - } - if (freqs & E16kHz && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n16kHz Use")); - if (resp) - { - res.SetSamplingFrequencies(E16kHz); - } - } - } - - resp = EFalse; - TSBCChannelModeBitmask chmodes = caps.ChannelModes(); - if (chmodes) - { - __PRINT(_L("\nChModes: remote supports:")); - if (chmodes & EJointStereo && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nJointStereo Use")); - if (resp) - { - res.SetChannelModes(EJointStereo); - } - } - if (chmodes & EStereo && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nStereo Use")); - if (resp) - { - res.SetChannelModes(EStereo); - } - } - if (chmodes & EDualChannel && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nDual Ch Use")); - if (resp) - { - res.SetChannelModes(EDualChannel); - } - } - if (chmodes & EMono && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nMono Use")); - if (resp) - { - res.SetChannelModes(EMono); - } - } - } - - TSBCBlockLengthBitmask blockLens = caps.BlockLengths(); - resp = EFalse; - - if (blockLens) - { - __PRINT(_L("\nBlockLens: remote supports:")); - if (blockLens & EBlockLenFour && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n4 Use")); - if (resp) - { - res.SetBlockLengths(EBlockLenFour); - } - } - if (blockLens & EBlockLenEight && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n8 Use")); - if (resp) - { - res.SetBlockLengths(EBlockLenEight); - } - } - if (blockLens & EBlockLenTwelve && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n12 Use")); - if (resp) - { - res.SetBlockLengths(EBlockLenTwelve); - } - } - if (blockLens & EBlockLenSixteen && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n16 Use")); - if (resp) - { - res.SetBlockLengths(EBlockLenSixteen); - } - } - } - - resp = EFalse; - TSBCSubbandsBitmask subbands = caps.Subbands(); - if (subbands) - { - __PRINT(_L("\nSubbands: remote supports:")); - if (subbands & EFourSubbands && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n4 Use")); - if (resp) - { - res.SetSubbands(EFourSubbands); - } - } - if (subbands & EEightSubbands && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\n8 Use")); - if (resp) - { - res.SetSubbands(EEightSubbands); - } - } - } - - - resp = EFalse; - TSBCAllocationMethodBitmask allocs = caps.AllocationMethods(); - if (allocs) - { - __PRINT(_L("\nAllocation methods: remote supports:")); - if (allocs & ESNR && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSNR Use")); - if (resp) - { - res.SetAllocationMethods(ESNR); - } - } - if (allocs & ELoudness && !resp) - { - resp=TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nLoudness Use")); - if (resp) - { - res.SetAllocationMethods(ELoudness); - } - } - } - - // cat2 test - //res.SetSamplingFrequencies(freqs); - //res.SetBlockLengths(4); - //res.SetSubbands(1); - //res.SetAllocMethods(1); - - // set bitpool to whatever they said - ok to set range - see 4.3.2.6 A2DP - res.SetMaxBitpoolValue(caps.MaxBitpoolValue()); - res.SetMinBitpoolValue(caps.MinBitpoolValue()); - - //dodgy iWish needs to select one - //res.SetMinBitpoolValue(42); - //res.SetMaxBitpoolValue(42); - - return res; - } - -TBool CAVTestApp::CurrentSEIDIsSink() - { - TBool sink = EFalse; - TUint localSEPIndex = iCurrentLocalSEID.Value(); - - //Get the current local SEP index in iLocallyRegisteredSEPs, by screening out flags - localSEPIndex &= 0x3f; - - sink = iLocallyRegisteredSEPs[localSEPIndex-1].IsSink(); - - return sink; - } - -void CAVTestApp::ConfigureSEPL() - { - TInt res; - - // user for test code gets to choose "right" local sep to connect to remote sep - TSEID localSEPtoUse(1, ETrue); // settings for iAutoStream - if (!iAutoStream) - { - __PRINT(_L("Choose local SEP to use for Stream")); - localSEPtoUse.Set(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console())); // it *is* local - } - //Record the SEID of chosen local SEP - iCurrentLocalSEID = localSEPtoUse; - - TSEID remoteSEPtoUse = iCurrentSEID; // settings for iAutoStream - if (!iAutoStream) - { - __PRINT(_L("\nChoose remote SEP to use for Stream")); - remoteSEPtoUse.Set(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console())); - - if (remoteSEPtoUse != iCurrentSEID) - { - __PRINT(_L("\nWARNING: Do not have the capabilities of the selected remote SEP, ")); - __PRINT(_L("\nthis may lead to sending incorrect configuration information. To")); - __PRINT(_L("\nfix this Get Capabilities for selected remote SEP first and then")); - if (!TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), - _L("\nconfigure. \nDo you still wish to continue this configuration?"))) - { - User::Leave(KErrAbort); - } - } - } - - // we have to choose which of our seps to bind with the remote - // this test code assumes the local SEP to use has SEID 1. - // real code would have better code to fathom a good binding based on caps etc - res = iGavdp.BeginConfiguringRemoteSEP(remoteSEPtoUse, localSEPtoUse); - - __LOG(_L("Begin configuring remote SEP returned %d\n"), res); - User::LeaveIfError(res); - - for (TInt index=0; indexCategory(); - - TBool use = EFalse; - - if (cat==EServiceCategoryMediaTransport) - { - if (iAutoStream) - { - use = ETrue; - } - else - { - use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Media Transport - use?"))); - } - if (use) - { - res = iGavdp.AddSEPCapability(*cap); - __LOG(_L("completed: %d"),res); - } - } - if (cat==EServiceCategoryReporting) - { - if (iAutoStream) - { - use = /*ETrue*/EFalse; - } - else - { - use = TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Reporting - use?")); - } - if (use) - { - res = iGavdp.AddSEPCapability(*cap); - __LOG(_L("completed: %d"),res); - } - } - if (cat==EServiceCategoryRecovery) - { - if (iAutoStream) - { - use = /*ETrue*/EFalse; - } - else - { - use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Recovery - use?"))); - } - if (use) - { - res = iGavdp.AddSEPCapability(*cap); - __LOG(_L("completed: %d"),res); - } - } - - if (cat==EServiceCategoryContentProtection) - { - if (iAutoStream) - { - use = EFalse; - } - else - { - use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nSEP Does Content Protection - use?"))); - } - - if (use) - { - res = iGavdp.AddSEPCapability(*cap); - __LOG(_L("completed: %d"),res); - } - } - - if (cat==EServiceCategoryMediaCodec) - { - if (iAutoStream) - { - use = ETrue; - } - else - { - use = (TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nConfigure Media Codec?"))); - } - - if (use) - { - if (static_cast(static_cast(cap)->MediaCodecType())==EAudioCodecSBC) - { - const TSBCCodecCapabilities& available = *static_cast(cap); - TSBCCodecCapabilities cfg; - - if (iAutoStream || TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(),_L("\nAutomatically Configure Media Codec?"))) - { - // we might be doing a reconfigure due to a request from the streamer - if (iLocalReconfigure) - { - cfg = iReconfigInfo; - } - else - { - // CSR board ignores the configuration - // which makes playlisting quite easy - // will need to fix this to playlist to boards that do care - TInt err, numChannels, chMode, numSubbands, blkLen, bitPool, freq, allocMethod; - err = TTavsrcUtils::GetCodecSettingsFromSBCFile(iFilename, chMode, numChannels, numSubbands, blkLen, bitPool, freq, allocMethod); - - if (err != KErrNone) - { - __LOG(_L("Problem accessing SBC file: %d\n"), err); - __LOG(_L("Warning - Codec settings not obtained\n")); - } - else - { - TSBCSubbandsBitmask subbands = numSubbands == 8 ? EEightSubbands : EFourSubbands; - TSBCAllocationMethodBitmask alloc = allocMethod == 0 ? ELoudness : ESNR; - - TSBCSamplingFrequencyBitmask freqs(0); - if (freq == 48000) freqs = E48kHz; - else if (freq == 44100) freqs = E44100Hz; // note else if now as only select one - else if (freq == 32000) freqs = E32kHz; - else if (freq == 16000) freqs = E16kHz; - - TSBCChannelModeBitmask chs(0); // set it to anything to prevent warning - if (chMode == 0) chs=EMono; - else if (chMode == 1) chs=EDualChannel; - else if (chMode == 2) chs=EStereo; - else if (chMode == 3) chs=EJointStereo; - - TSBCBlockLengthBitmask blkLens(0); // set it to anything to prevent warning - if (blkLen == 4) blkLens = EBlockLenFour; - else if (blkLen == 8) blkLens = EBlockLenEight; - else if (blkLen == 12) blkLens = EBlockLenTwelve; - else if (blkLen == 16) blkLens = EBlockLenSixteen; - - cfg.SetSamplingFrequencies(freqs); - cfg.SetChannelModes(chs); - cfg.SetBlockLengths(blkLens); - cfg.SetSubbands(subbands); - cfg.SetAllocationMethods(alloc); - - } - } - - // use the available bitpool - cfg.SetMaxBitpoolValue(available.MaxBitpoolValue()); - cfg.SetMinBitpoolValue(available.MinBitpoolValue()); - } - else if (use && !iAutoStream) - { - cfg = InteractiveSBCMediaCodecConfig(*static_cast(cap)); - } - - - res = iGavdp.AddSEPCapability(cfg); - __LOG(_L("Add SEP Capability completed: %d"),res); - } - else - { - __LOG(_L("MP3 codec, choosing fixed configuration...\n")); - // assume mp3 for now - // testing with blueant, just choose stereo, 44.1khz - TBuf8<4> mp3Cfg; - mp3Cfg.SetLength(4); - mp3Cfg[0]=0x32; - mp3Cfg[1]=0x02; - mp3Cfg[2]=0x00; - mp3Cfg[3]=0x02; - - TNonSBCCodecCapabilities mp3codecCaps(EAvdtpMediaTypeAudio,EAudioCodecMPEG12Audio); - mp3codecCaps.SetCodecData(mp3Cfg); - res = iGavdp.AddSEPCapability(mp3codecCaps); - } - } - } - }// for - - __LOG(_L("\nCommiting configuration...\n")); - iGavdp.CommitSEPConfiguration(); - } - - -TInt CAVTestApp::StartSrc() - { - TBool failed = EFalse; - - // register source/sink records in sdp - __LOG(_L("Registering A2DP Sink SDP Record")); - TRAPD(err, TTavsrcUtils::RegisterSinkSDPRecordL(iSdpDB, iSnkHandle, ETrue, ETrue, ETrue, ETrue)); - if (err != KErrNone) - { - __LOG(_L("Failed to Register A2DP Sink SDP Record: %d"), err); - __DEBUGGER(); - failed = ETrue; - } - - __LOG(_L("Registering A2DP Source SDP Record")); - TRAP(err, TTavsrcUtils::RegisterSourceSDPRecordL(iSdpDB, iSrcHandle, ETrue, ETrue, ETrue, ETrue)); - if (err != KErrNone) - { - __LOG(_L("Failed to Register A2DP Source SDP Record: %d"), err); - __DEBUGGER(); - failed = ETrue; - } - - __LOG(_L("Opening GAVDP Session")); - err = iGavdp.Open(*this, iSockServ); - if (err == KErrNone) - { - RHostResolver hostResolver; - err = hostResolver.Open( iSockServ, KBTAddrFamily, KBTLinkManager); - if (err == KErrNone) - { - err = hostResolver.SetHostName(_L("Boom Box!")); - hostResolver.Close(); - } - iActiveConsole->Console().Printf(_L("Set Host Name (ret:%d)\r\n"),err); - - iGavdpState = EIdle; - } - else - { - __LOG(_L("Failed to Open GAVDP Session: %d"), err); - __DEBUGGER(); - failed = ETrue; - } - err = RegisterSEP(); - if (err != KErrNone) - { - __LOG(_L("Failed to Register SEP: %d"), err); - __DEBUGGER(); - failed = ETrue; - } - - TRAP(err, CreateRemConInterfacesL()); - if (err != KErrNone) - { - __LOG(_L("Failed to Register RemCon interfaces: %d"), err); - __DEBUGGER(); - failed = ETrue; - } - - if(failed) - { - return KErrGeneral; - } - return KErrNone; - } - -void CAVTestApp::StopSrc() - { - // Close RBTPhysicalLinkAdapter - iPhy.Close(); - __LOG(_L("Closed iPhy\n")); - - iSdpDB.DeleteRecord(iSrcHandle); - iSdpDB.DeleteRecord(iSnkHandle); - delete iStreamer; - iStreamer = NULL; - iGavdp.Close(); - iAutoStream = EFalse; - - iGavdpState = ENoClientOpen; - - } - -void CAVTestApp::DisconnectSrc() - { - // Close RBTPhysicalLinkAdapter - iPhy.Close(); - __LOG(_L("Closed iPhy\n")); - - delete iStreamer; - iStreamer = NULL; - iGavdp.Shutdown(); - iAutoStream = EFalse; - - iGavdpState = EIdle; - Listen(); - } - -void CAVTestApp::Connect() - { - __LOG(_L("Connecting...\n")); - iGavdp.Connect(iDevAddr); - } - -void CAVTestApp::CreateBearers() - { - TInt ret = KErrNone; - TSEID seid; - - if (iAutoStream) - { - seid = iCurrentSEID; - } - else - { - __PRINT(_L("\n-> Create bearers for remote SEID")); - seid = TSEID(TTavsrcUtils::GetIntFromUser(iActiveConsole->Console()), EFalse); - } - - ret = iGavdp.CreateBearerSockets(seid); - __LOG(_L("Asking for Bearers..(sync_result) %d.\n"), ret); - } - -void CAVTestApp::CloseBearers() - { - __LOG(_L("Closing Bearer 0 (via Streamer dtor)...\n\r")); - - delete iStreamer; - iStreamer = NULL; - - __LOG(_L("Bearer closed (via Streamer dtor)...\n\r")); - - AllowLowPowerModes(); - } - -void CAVTestApp::DiscoverSEPs() - { - __LOG(_L("Sending SEP Discovery...\n\r")); - - iGavdp.DiscoverRemoteSEPs(); - } - -CAVTestApp::CAVTestApp() - { - } - -CAVTestApp::~CAVTestApp() - { - StopSrc(); - delete iActiveConsole; - delete iLogConsole; - delete iMtUpdater; - delete iTavsrcAbsoluteVolume; - delete iStreamer; - delete iRemConInterfaceSelector; - delete iController; - delete iPacketDropIoctl; - delete iOperations; - -#ifdef CHANNEL_BINDING_DEBUG_CHECK - delete iRepReader; - delete iRepWriter; - delete iRecvReader; - delete iRecvWriter; -#endif - - iFilename.Close(); - iLocallyRegisteredSEPs.Close(); - iSockServ.Close(); - iSdpDB.Close(); - iSdp.Close(); - iSEPCapabilities.ResetAndDestroy(); - iShortlistedSEIDs.Close(); - } - -CAVTestApp* CAVTestApp::NewL() - { - CAVTestApp* thisapp = new (ELeave) CAVTestApp; - CleanupStack::PushL(thisapp); - thisapp->ConstructL(); - CleanupStack::Pop(); - return thisapp; - } - -void CAVTestApp::ConstructL() - { - iLogConsole = CActiveConsole::NewL(*this,_L("Event Log"),KLogConsole); - iActiveConsole = CActiveConsole::NewL(*this,_L(" Boom Box "),KMainConsole); - - User::LeaveIfError(iSockServ.Connect()); - } - -void CAVTestApp::CreateRemConInterfacesL() - { - iRemConInterfaceSelector = CRemConInterfaceSelector::NewL(); - - RArray coreFeatures; - for(TInt i = 0; i<0x76; i++) - { - coreFeatures.Append(static_cast(i)); - } - - if(iRemConInterfaces & ECoreApiTarget) - { - iRemConTarget = CRemConCoreApiTarget::NewL(*iRemConInterfaceSelector, *this, coreFeatures); - } - coreFeatures.Close(); - - if(iRemConInterfaces & EGroupNavigation) - { - iGroupNavigation = CRemConGroupNavigationApiTarget::NewL(*iRemConInterfaceSelector, *this, ETrue, ETrue); - } - - if(iRemConInterfaces & EMediaInformation) - { - iMediaInformation = CRemConMediaInformationTarget::NewL(*iRemConInterfaceSelector, *this); - } - - if(iRemConInterfaces & EBatteryStatus) - { - iBatteryStatus = CRemConBatteryApiTarget::NewL(*iRemConInterfaceSelector, *this); - } - - if(iRemConInterfaces & (EAbsoluteVolumeTarget | EAbsoluteVolumeController)) - { - iTavsrcAbsoluteVolume = CTavsrcAbsoluteVolume::NewL(*iRemConInterfaceSelector); - } - - if(iRemConInterfaces & EVendorTrackInfoTarget) - { - iTrackInfo = CRemConTrackInfoTarget::NewL(*iRemConInterfaceSelector, *this); - } - - if(iRemConInterfaces & (EPlayerInformation | ENowPlaying | EMediaBrowse )) - { - iMtUpdater = CTavsrcMtUpdater::NewL(*iRemConInterfaceSelector, iRemConInterfaces); - } - - if(iRemConInterfaces & EVendorAbsoluteVolumeTarget) - { - iAbsoluteVolume = CRemConAbsVolTarget::NewL(*iRemConInterfaceSelector, *this); - } - - iController = CTavsrcController::NewL(*iRemConInterfaceSelector, *iLogConsole); - - _LIT8(KTavsrcName, "Tavsrc"); - iRemConInterfaceSelector->OpenTargetL(ERemConAudioPlayer, ERemConNoSubType, KTavsrcName); - - iRemConInterfaceSelector->OpenControllerL(); - iOperations = CTavsrcOperations::NewL(); - } - -void CAVTestApp::DisplayHelp() - { - __LOG(_L("\nUsage: tavsrc [-A ] [-D ] [-P] [-H]\n")); - __LOG(_L("\n-A : Optional argument to specify remote\n")); - __LOG(_L("Bluetooth address. If not specified then you will be prompted\n")); - __LOG(_L("using notifiers.\n")); - __LOG(_L("\n-D : Optional argument to specify the display mode\n")); - __LOG(_L("to use. The possible values are a logical AND of the following:\n")); - __LOG(_L(" 0x00: Status and Command windows only\n")); - __LOG(_L(" 0x01: Streamer Info window\n")); - __LOG(_L(" 0x02: Progress Bar window\n")); - __LOG(_L(" 0x04: Playlist window\n")); - __LOG(_L(" 0x08: Chunky Icon window\n")); - __LOG(_L("For example, for all the windows except the Progress Bar: -D d\n")); - __LOG(_L("Default value is 1 - Status, Command and Streamer Info windows\n")); - __LOG(_L("\n-P: Preload SBC file before streaming.\n")); - __LOG(_L("\n-H: Display this help information.\n")); - __LOG(_L("\n-R : Optional argument to specify what interfaces to use:\n")); - __LOG(_L(" ECoreApiTarget = 1 << 0\n")); - __LOG(_L(" ECoreApiController = 1 << 1\n")); - __LOG(_L(" EGroupNavigation = 1 << 2\n")); - __LOG(_L(" EMediaInformation = 1 << 3\n")); - __LOG(_L(" EBatteryStatus = 1 << 4\n")); - __LOG(_L(" EAbsoluteVolumeTarget = 1 << 5\n")); - __LOG(_L(" EAbsoluteVolumeController = 1 << 6\n")); - __LOG(_L(" EPlayerInformation = 1 << 7\n")); - __LOG(_L(" ENowPlaying = 1 << 8\n")); - __LOG(_L(" EMediaBrowse = 1 << 9\n")); - __LOG(_L(" EDatabaseAware = 1 << 10\n")); - __LOG(_L(" ESeparateThreadForBrowse = 1 << 11\n")); - __LOG(_L(" EVendorTrackInfoTarget = 1 << 12\n")); - __LOG(_L(" EVendorAbsoluteVolumeTarget = 1 << 13\n")); - } - -void CAVTestApp::ParseCommandLineL() - { - CCommandLineArguments *cmdLine = CCommandLineArguments::NewL(); - CleanupStack::PushL(cmdLine); - - // set defaults - iDisplayMode = 0x01; - iPreloadFile = EFalse; - - TBool btAddrFound = EFalse; - TBool remConInterfacesFound = EFalse; - TBuf<20> arg; - for (TInt argIndex = 1; argIndex < cmdLine->Count(); argIndex++) - { - arg = cmdLine->Arg(argIndex); - arg.UpperCase(); - - // look for help - if (arg.FindF(_L("-H")) != KErrNotFound) - { - DisplayHelp(); - User::Leave(KErrArgument); - } - - // look for preload file - if (arg.FindF(_L("-P")) != KErrNotFound) - { - iPreloadFile = ETrue; - continue; - } - - // look for remote device address - if (arg.FindF(_L("-A")) != KErrNotFound) - { - if (argIndex != cmdLine->Count() - 1) - { - btAddrFound = ETrue; - iDevAddr.SetReadable(cmdLine->Arg(++argIndex)); - continue; - } - else - { - __LOG(_L("No address found for -A option\n")); - DisplayHelp(); - User::Leave(KErrArgument); - } - } - - // look for display mode - if (arg.FindF(_L("-D")) != KErrNotFound) - { - if(argIndex != cmdLine->Count() - 1) - { - TLex lex(cmdLine->Arg(++argIndex)); - lex.Val(iDisplayMode, EHex); - continue; - } - else - { - __LOG(_L("No display mode found for -D option\n")); - DisplayHelp(); - User::Leave(KErrArgument); - } - } - - // look for remcon interfaces - if (arg.FindF(_L("-R")) != KErrNotFound) - { - if(argIndex != cmdLine->Count() - 1) - { - TLex lex(cmdLine->Arg(++argIndex)); - TInt err = lex.Val(iRemConInterfaces, EHex); - if(!err) - { - remConInterfacesFound = ETrue; - } - else - { - __LOG(_L("Badly formatted interface bitmask\n")); - } - continue; - } - else - { - __LOG(_L("No remconinterfaces found for -R option\n")); - DisplayHelp(); - User::Leave(KErrArgument); - } - } - - // if we got here it means that we have an unhandled argument - __LOG(_L("Unrecognised argument\n")); - DisplayHelp(); - User::Leave(KErrArgument); - } - CleanupStack::PopAndDestroy(); // cmdLine - - if (!btAddrFound) - { - __LOG(_L("No address found on command line - please enter an address\n")); - TTavsrcUtils::GetDeviceAddressL(iDevAddr); - } - - if(!remConInterfacesFound) - { - __LOG(_L("No interfaces found on command line, defaulting to all interfaces\n")); - iRemConInterfaces = 0xFFFFFFFF; - } - } - -void CAVTestApp::StartL() - { - // connect to sdp - __LOG(_L("Connecting to ESOCK\n")); - User::LeaveIfError(iSockServ.Connect()); - __LOG(_L("Connecting to SDP Server\n")); - - __LOG(_L("Connecting to SDP Server\n")); - User::LeaveIfError(iSdp.Connect()); - __LOG(_L("Opening subsession on SDP Server\n")); - - __LOG(_L("Opening subsession on SDP Server\n")); - User::LeaveIfError(iSdpDB.Open(iSdp)); - TBuf<512> cmdline; - - // ensure that we have something to stream - RFs fs; - CDir* files; - User::LeaveIfError(fs.Connect()); - - TInt err = fs.GetDir(KSBCFiles, KEntryAttNormal, ESortByName, files); - - fs.Close(); - - if (err != KErrNone) - { - __LOG(_L("Error getting files %S: %d \n"), &KSBCFiles, err); - User::Leave(err); - } - - if (files->Count() > 0) - { - // store the filename for registering the SEP later - iFilename.Create(KMaxFileName); - iFilename.Append(KSBCFileRoot); - iFilename.Append(files->operator[](0).iName); - delete files; - } - else - { - __LOG(_L("\nNo files matching %S found, at least one is required,\n"), &KSBCFiles); - __LOG(_L("please add files and restart the application\n")); - delete files; - User::Leave(KErrNotFound); - } - - TRAP(err, ParseCommandLineL()); - if (err != KErrNone) - { - iActiveConsole->Console().ClearScreen(); - iActiveConsole->Console().Printf(_L("\nProblem with Command Line arguments, see status window for")); - iActiveConsole->Console().Printf(_L("\nmore information or press ESC to exit.\n")); - iActiveConsole->RequestKey(); - } - else - { - err = StartSrc(); - if(err == KErrNone) - { - TestMenu(); - } - else - { - iActiveConsole->Console().ClearScreen(); - iActiveConsole->Console().Printf(_L("\nProblem starting source, see status window for")); - iActiveConsole->Console().Printf(_L("\nmore information or press ESC to exit.\n")); - iActiveConsole->RequestKey(); - } - } - CActiveScheduler::Start(); - } - -void CAVTestApp::Stop() - { - CActiveScheduler::Stop(); - } - -//remcon - void CAVTestApp::MrccatoCommand(TRemConCoreApiOperationId aOperationId, - TRemConCoreApiButtonAction aButtonAct) - { - __LOG(_L("RemCon::Command received 0x%02x\t Button Act %d\n"), aOperationId, aButtonAct); - if((aOperationId == ERemConCoreApiStop) && - (aButtonAct == ERemConCoreApiButtonClick || aButtonAct == ERemConCoreApiButtonPress) ) - { - __LOG(_L("RemCon::Stop received\n")); - iAutoStream = EFalse; - if (iStreamer) - { - iStreamer->Stop(); - } - iStreamState = EStopped; - iOperations->EndOperation(KTavsrcOpStopStream, KErrNone); - } - else if (((aOperationId == ERemConCoreApiBackward) || (aOperationId == ERemConCoreApiRewind)) && iStreamer) - { - if (aButtonAct == ERemConCoreApiButtonClick) - { - iStreamer->PrevTrack(); - } - else if ((aButtonAct == ERemConCoreApiButtonPress) && (iStreamState == EStreaming)) - { - iStreamer->Backward(); - iStreamer->Faster(); - } - else if ((aButtonAct == ERemConCoreApiButtonRelease) && (iStreamState == EStreaming)) - { - iStreamer->Forward(); - iStreamer->Slower(); - } - } - else if (((aOperationId == ERemConCoreApiForward) || (aOperationId == ERemConCoreApiFastForward)) && iStreamer) - { - if (aButtonAct == ERemConCoreApiButtonClick) - { - iStreamer->NextTrack(); - } - else if ((aButtonAct == ERemConCoreApiButtonPress) && (iStreamState == EStreaming)) - { - iStreamer->Faster(); - } - else if ((aButtonAct == ERemConCoreApiButtonRelease) && (iStreamState == EStreaming)) - { - iStreamer->Slower(); - } - } - else if ((aOperationId == ERemConCoreApiPause) && (aButtonAct != ERemConCoreApiButtonRelease)) - { - TInt operation = KTavsrcOpStream; - - if (iStreamState == EStreaming) - { - // this demo app doesn't suspend GAVDP, just the streamer - if (iStreamer) - { - iStreamer->Suspend(); - } - iStreamState = EPaused; - operation = KTavsrcOpStopStream; - } - iOperations->EndOperation(operation, KErrNone); - } - - if (iStreamState == EStreaming) - { - PreventLowPowerModes(); - } - - TestMenu(); - } - - void CAVTestApp::MrccatoPlay(TRemConCoreApiPlaybackSpeed /*aSpeed*/, - TRemConCoreApiButtonAction aButtonAct) - { - __LOG(_L("RemCon::Play received\t Button Act %d\n"), aButtonAct); - if((aButtonAct == ERemConCoreApiButtonClick || aButtonAct == ERemConCoreApiButtonPress)) - { - TInt operation = KTavsrcOpStream; - - // kick everything off - if (iGavdpState == ESigConnected) - { - // auto - iAutoStream = ETrue; - // kick off - DiscoverSEPs(); - } - else if (iGavdpState == ESuspended) - { - if (iStreamer) - iStreamer->ReStream(); - iStreamState = EStreaming; - } - else if (iGavdpState == EOpen) - { - if (iStreamState == EPaused) - { - // this demo app doesn't unsuspend GAVDP, just the streamer - if (iStreamer) - iStreamer->ReStream(); - iStreamState = EStreaming; - } - else if (iStreamState == EStopped) - { - // this demo app doesn't unsuspend GAVDP, just the streamer - if (iStreamer) - iStreamer->Stream(CurrentSEIDIsSink()); //could be source or sink - iStreamState = EStreaming; - } - else if (iStreamState == EClosed) - { - if (iStreamer) - iStreamer->Stream(CurrentSEIDIsSink()); - iStreamState = EStreaming; - } - } - iOperations->EndOperation(operation, KErrNone); - - if (iStreamState == EStreaming) - { - PreventLowPowerModes(); - } - - TestMenu(); - } - } - -void CAVTestApp::MediaCodecConfigurationRequired(TSBCCodecCapabilities& aConfig) - { - if (!iLocalReconfigure) - { - // set the reconfigure information - iReconfigInfo = aConfig; - iLocalReconfigure = ETrue; - - // start streaming automatically after the reconfigure - iAutoStream = ETrue; - - SuspendStreams(); - } - } - -void CAVTestApp::PrintCommandOption(TChar aOperation, TPtrC aDesc) - { - if (iOperations->IsOperationAllowed(aOperation)) - { - iActiveConsole->Console().Printf(_L("%c%s"), aOperation.IsUpper() ? aOperation.GetUpperCase() : aOperation.GetLowerCase(), aDesc.Ptr()); - } - else - { - iActiveConsole->Console().Printf(_L(" %s"), aDesc.Ptr()); - } - } - -// from MRemConMediaInformationTargetObserver -void CAVTestApp::MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter ) - { - iActiveConsole->Console().Printf(_L("Got MrcpitoGetElementAttributes \n") ); - - // Make sure total of these defines is greater than KAVCMaxFrame (512 bytes) - // to ensure that fragmentation is performed on this response - _LIT8(KMediaTitle, "Frederic Chopin (1810-1849): Ballade for Piano #1 in A flat major, Opus 23, CT 2 - Largo allegretto, Moderato con brio vivace, Presto con fuoco"); - _LIT8(KArtistName, "Maurizio Pollini and the London Philharmonic Orchestra, conducted by Sir Colin Davis, recorded live at the Royal Albert Hall at the 1987 Proms season"); - _LIT8(KAlbumName, "Frederic Chopin (1810-1849): Four Ballades, Two Preludes, the Valse in D-flat major - Op. 64 No. 1 and the Andante Spianato & Grand Polonaise Brillante Op. 22"); - _LIT8(KTrackNumber, "10345"); - _LIT8(KNumberOfTracks, "6876436456"); - _LIT8(KGenre, "Alternative super cool Classical Music with a lemon twist and a hint of progressive rock"); - _LIT8(KPlayingTime, "150000"); - - TBuf8<255> buffer; - - // for each element requested - TMediaAttributeId id; - while (aAttributeIter.Next(id)) - { - switch(id) - { - case ETitleOfMedia: - buffer.Copy(KMediaTitle); - break; - case ENameOfArtist: - buffer.Copy(KArtistName); - break; - case ENameOfAlbum: - buffer.Copy(KAlbumName); - break; - case ETrackNumber: - buffer.Copy(KTrackNumber); - break; - case ENumberOfTracks: - buffer.Copy(KNumberOfTracks); - break; - case EGenre: - buffer.Copy(KGenre); - break; - case EPlayingTime: - buffer.Copy(KPlayingTime); - break; - default: - __DEBUGGER(); - break; - } - - // return the element value - iMediaInformation->AttributeValue( id, buffer ); - - // convert the element value to unicode for display - TBuf16<255> buf16; - buf16.Copy(buffer); - buf16.ZeroTerminate(); - iActiveConsole->Console().Printf(_L("Element:%d value:%s \n"), id, buf16.Ptr() ); - } - - // send response complete - iMediaInformation->Completed(); - - } - - -TInt CAVTestApp::MrcmtcGetElementAttributes(TUint64 /* aElement */, TUint32 aAttribute, HBufC8*& aOutValueOwnershipTransferred) - { -// -// __DEBUGGER(); //try this out - iActiveConsole->Console().Printf(_L("Got GEA, attrib %d!\n"), aAttribute); - - aOutValueOwnershipTransferred = HBufC8::New(20); - if (aOutValueOwnershipTransferred) - { - aOutValueOwnershipTransferred->Des() = _L8("Hello"); - } - - return KErrNone; - } - -void CAVTestApp::MrcncRegisterPlaybackStatusChangedNotification() - { - iActiveConsole->Console().Printf(_L("Queued notify: PlayStatusChanged!\n")); - } - -void CAVTestApp::MrcncRegisterTrackChangedNotification() - { - iActiveConsole->Console().Printf(_L("Queued notify: TrackChanged!\n")); - } - -void CAVTestApp::MrcncRegisterTrackReachedEndNotification() - { - iActiveConsole->Console().Printf(_L("Queued notify: TrackReachedEnd!\n")); - } - -void CAVTestApp::MrcncRegisterTrackReachedStartNotification() - { - iActiveConsole->Console().Printf(_L("Queued notify: TrackReachedStart!\n")); - } - -void CAVTestApp::MrcncRegisterPositionChangedNotification(TUint32 aInterval) - { - iActiveConsole->Console().Printf(_L("Queued notify: PositionChanged (0x%08x)!\n"), aInterval); - } - -void CAVTestApp::MrcncRegisterBatteryStatusChangedNotification() - { - iActiveConsole->Console().Printf(_L("Queued notify: BatteryStatusChanged!\n")); - } - -void CAVTestApp::MrcncRegisterSystemStatusChangedNotification() - { - iActiveConsole->Console().Printf(_L("Queued notify: SystemStatusChanged!\n")); - } - -void CAVTestApp::MrcncRegisterPlayerApplicationStatusChangedNotification() - { - iActiveConsole->Console().Printf(_L("Queued notify: PlayerAppStatusChanged!\n")); - } - -void CAVTestApp::MrcbstoBatteryStatus(TControllerBatteryStatus& aBatteryStatus ) - { - switch(aBatteryStatus) - { - case ENormal: - iActiveConsole->Console().Printf(_L("Battery status: Normal \n")); - break; - case EWarning: - iActiveConsole->Console().Printf(_L("Battery status: Warning \n")); - break; - case ECritical: - iActiveConsole->Console().Printf(_L("Battery status: Critical \n")); - break; - case EExternal: - iActiveConsole->Console().Printf(_L("Battery status: External \n")); - break; - case EFullCharge: - iActiveConsole->Console().Printf(_L("Battery status: FullCharge \n")); - break; - default: - iActiveConsole->Console().Printf(_L("Battery status: %d \n"), aBatteryStatus); - break; - } - } - -void CAVTestApp::MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct ) - { - switch(aButtonAct) - { - case ERemConCoreApiButtonPress: - iActiveConsole->Console().Printf(_L("Got NextGroup! Button Press \n")); - break; - case ERemConCoreApiButtonRelease: - iActiveConsole->Console().Printf(_L("Got NextGroup! Button Release \n")); - break; - case ERemConCoreApiButtonClick: - iActiveConsole->Console().Printf(_L("Got NextGroup! Button Click \n")); - break; - default: - iActiveConsole->Console().Printf(_L("Got NextGroup! Button ??? \n")); - break; - } - - // for testing return an error - TRequestStatus status; - TRequestStatus* ptrStatus = &status; - iGroupNavigation->NextGroupResponse( ptrStatus, KErrNone); - User::WaitForRequest(status); - - } - -void CAVTestApp::MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct ) - { - switch(aButtonAct) - { - case ERemConCoreApiButtonPress: - iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button Press \n")); - break; - case ERemConCoreApiButtonRelease: - iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button Release \n")); - break; - case ERemConCoreApiButtonClick: - iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button Click \n")); - break; - default: - iActiveConsole->Console().Printf(_L("Got PreviousGroup! Button ??? \n")); - break; - } - - // return success - TRequestStatus status; - TRequestStatus* ptrStatus = &status; - iGroupNavigation->PreviousGroupResponse( ptrStatus, KErrNone ); - User::WaitForRequest(status); - } - -void CAVTestApp::MrcavtoGetAbsoluteVolume() - { - TRequestStatus status; - iAbsoluteVolume->GetAbsoluteVolumeResponse(status, 1, 2, KErrNone); - User::WaitForRequest(status); - } - -void CAVTestApp::MrcavtoSetAbsoluteVolume(TUint /*aAbsVol*/, TUint /*aMaxVol*/) - { - TRequestStatus status; - iAbsoluteVolume->SetAbsoluteVolumeResponse(status, KErrNone); - User::WaitForRequest(status); - } - -void CAVTestApp::MrctitoGetTrackName() - { - TRequestStatus status; - _LIT(KTrackName, "trackname"); - iTrackInfo->GetTrackNameResponse(status, KTrackName, KErrNone); - User::WaitForRequest(status); - } - -void CAVTestApp::MrctitoGetArtist() - { - TRequestStatus status; - _LIT(KArtist, "artist"); - iTrackInfo->GetArtistResponse(status, KArtist, KErrNone); - User::WaitForRequest(status); - } - -void CAVTestApp::MrctitoGetTrackDuration() - { - TRequestStatus status; - _LIT(KTrackDuration, "0.2.56"); - TTime trackDuration(KTrackDuration); - iTrackInfo->GetTrackDurationResponse(status, trackDuration, KErrNone); - User::WaitForRequest(status); - } - -_LIT(KOn, "On"); -_LIT(KOff, "Off"); - -void CAVTestApp::TestMenu() - { - iActiveConsole->Console().ClearScreen(); - - iActiveConsole->Console().Printf(_L("Safe Mode: %S\n"), iOperations->SafeMode() ? &KOn() : &KOff()); - - if (iGavdpState!=EIdle) - { - iActiveConsole->Console().Printf(_L("Connected \n\r")); - } - else - { - iActiveConsole->Console().Printf(_L(" \n\r")); - } - - RProperty property; - TBuf8<6> addr; - - TInt err = property.Get(KPropertyUidBluetoothCategory, - KPropertyKeyBluetoothGetLocalDeviceAddress, addr); - - if ((err) || (addr.Length()!=6)) - { - iActiveConsole->Console().Printf(_L("P&S: ERROR retrieving local address\n")); - } - else - { - TBTDevAddr localAddress(addr); - TBuf<20> dispBuf; - localAddress.GetReadable(dispBuf); - TBuf<20> rBuf; - iDevAddr.GetReadable(rBuf); - iActiveConsole->Console().Printf(_L("Local address = 0x%S; Using Remote Addr = 0x%S\n"),&dispBuf,&rBuf); - } - - iActiveConsole->Console().Printf(_L("\n")); - - switch (iGavdpState) - { - case ENoClientOpen: - PrintCommandOption(KTavsrcOpStartSrc, _L(". Open GAVDP for Src\n")); - break; - case EIdle: - PrintCommandOption(KTavsrcOpConnect, _L(". Connect\n")); - PrintCommandOption(KTavsrcOpCancel, _L(". Cancel\n")); - PrintCommandOption(KTavsrcOpRegisterSEP, _L(". Register SEP\n")); - break; - case ESigConnected: - case EOpen: - case ESuspended: - case ERemoteReconfiguring: - PrintCommandOption(KTavsrcOpAutoStream, _L(". Auto Stream\n")); - PrintCommandOption(KTavsrcOpDiscoverSEPs, _L(". Discover remote SEPs ")); - PrintCommandOption(KTavsrcOpCreateBearers, _L(". Create Bearers\n")); - - PrintCommandOption(KTavsrcOpGetCapabilities, _L(". Get Remote SEP Capabilites ")); - PrintCommandOption(KTavsrcOpCloseBearers, _L(". Close Bearers\n")); - - PrintCommandOption(KTavsrcOpStartStreams, _L(". Start Stream ")); - PrintCommandOption(KTavsrcOpSuspendStreams, _L(". Suspend Stream\n")); - - PrintCommandOption(KTavsrcOpContentProtection, _L(". Content Protection ")); - PrintCommandOption(KTavsrcOpAbort, _L(". Abort Stream\n")); - - PrintCommandOption(KTavsrcOpConfigureSEP, _L(". Select Remote SEP (configure the doofer)\n")); - - PrintCommandOption(KTavsrcOpStream, _L(". Start Streamer ")); - PrintCommandOption(KTavsrcOpStopStream, _L(". Stop Streamer\n\n")); - - PrintCommandOption(KTavsrcOpPacketDropIoctl, _L(". Send \"Notify Media Packet Dropped\" IOCTL\n\n")); - - PrintCommandOption(KTavsrcOpDisconnectSrc, _L(". Disconnect GAVDP - don't close\n")); - PrintCommandOption(KTavsrcOpStopSrc, _L(". Close GAVDP\n")); - break; - } - - iActiveConsole->Console().Printf(_L("\n")); - - PrintCommandOption(KTavsrcOpPlay, _L(". AVRCP Play ")); - PrintCommandOption(KTavsrcOpStop, _L(". AVRCP Stop\n")); - - iActiveConsole->Console().Printf(_L("Up. AVRCP Volume Up ")); - iActiveConsole->Console().Printf(_L("Down. AVRCP Volume Down\n")); - - iActiveConsole->Console().Printf(_L("Left. AVRCP Backwards ")); - iActiveConsole->Console().Printf(_L("Right. AVRCP Forwards\n")); - - iActiveConsole->Console().Printf(_L("\n")); - - PrintCommandOption(KTavsrcOpToggleSafeMode, _L(".\tToggle Safe Mode\n")); - iActiveConsole->Console().Printf(_L("Esc.\tStop\n")); - - if (!iActiveConsole->IsActive()) - { - iActiveConsole->RequestKey(); - } - } - -void CAVTestApp::KeyPressed(TChar aKey) - { - TInt beginOperation = iOperations->BeginOperation(aKey); - - if (beginOperation == KErrNone) - { - switch (aKey) - { - case KTavsrcOpConnect: - { - Connect(); - break; - } - case KTavsrcOpCancel: - { - iOperations->EndOperation(KTavsrcOpCancel, KErrCancel); - - iGavdp.Cancel(); - __LOG(_L("Current Request Cancelled \n")); - break; - } - case KTavsrcOpDiscoverSEPs: - { - DiscoverSEPs(); - break; - } - case KTavsrcOpCreateBearers: - { - CreateBearers(); - break; - } - case KTavsrcOpCloseBearers: - { - iOperations->EndOperation(KTavsrcOpCloseBearers, KErrNone); - - CloseBearers(); - break; - } - case KTavsrcOpContentProtection: - { - SendSecurityControl(); - break; - } - case KTavsrcOpGetCapabilities: - { - GetCapabilities(); - break; - } - case KTavsrcOpStartStreams: - { - StartStreams(); - break; - } - case KTavsrcOpSuspendStreams: - { - SuspendStreams(); - break; - } - case KTavsrcOpEchoStorm: - { - iOperations->EndOperation(KTavsrcOpEchoStorm, KErrNone); - - EchoStorm(); - break; - } - case KTavsrcOpAbort: - { - Abort(); - break; - } - case KTavsrcOpStream: - { - iOperations->EndOperation(KTavsrcOpStream, KErrNone); - - iStreamer->Stream(CurrentSEIDIsSink()); - iStreamState = EStreaming; - } - break; - case KTavsrcOpStreamFaster: - { - iOperations->EndOperation(KTavsrcOpStreamFaster, KErrNone); - - iStreamer->Faster(); - break; - } - - case KTavsrcOpStreamSlower: - { - iOperations->EndOperation(KTavsrcOpStreamSlower, KErrNone); - - iStreamer->Slower(); - break; - } - - case KTavsrcOpAutoStream: - { - // auto - iAutoStream = ETrue; - // kick off - DiscoverSEPs(); - } - break; - - case KTavsrcOpStopStream: - { - iOperations->EndOperation(KTavsrcOpStopStream, KErrNone); - - __LOG(_L("Stopping streaming... \n")); - iStreamState = EPaused; - iStreamer->Suspend(); - } - break; - case KTavsrcOpRegisterSEP: - { - iOperations->EndOperation(KTavsrcOpRegisterSEP, KErrNone); - - RegisterSEP(); - break; - } - case KTavsrcOpRegisterMultipleSEPs: - { - iOperations->EndOperation(KTavsrcOpRegisterMultipleSEPs, KErrNone); - - for (TInt i=0; i<=40; i++) - { - TAvdtpSEPInfo info; iGavdp.RegisterSEP(info); - } - break; - } - case KTavsrcOpStartSrc: - { - iOperations->EndOperation(KTavsrcOpStartSrc, KErrNone); - - //reopen GAVDP - StartSrc(); - break; - } - - case KTavsrcOpStopSrc: - { - iOperations->EndOperation(KTavsrcOpStopSrc, KErrNone); - - StopSrc(); - break; - } - case KTavsrcOpDisconnectSrc: - { - iOperations->EndOperation(KTavsrcOpDisconnectSrc, KErrNone); - - DisconnectSrc(); - break; - } - case KTavsrcOpConfigureSEP: - { - TRAPD(err, ConfigureSEPL()); - if (err != KErrNone) - { - iOperations->EndOperation(KTavsrcOpConfigureSEP, err); - } - break; - } - - case KTavsrcOpPacketDropIoctl: - { - iOperations->EndOperation(KTavsrcOpPacketDropIoctl, KErrNone); - - __LOG(_L("Sending packet drop IOCTL\n")); - iPacketDropIoctl = CActivePacketDropIoctl::NewL(iLogConsole, iPendingSockets);//Qualified - iPacketDropIoctl->Start(); - break; - } - - case KTavsrcOpVolumeUp: - { - iOperations->EndOperation(KTavsrcOpVolumeUp, KErrNone); - - iController->Command(ERemConCoreApiVolumeUp); - break; - } - - case KTavsrcOpVolumeDown: - { - iOperations->EndOperation(KTavsrcOpVolumeDown, KErrNone); - - iController->Command(ERemConCoreApiVolumeDown); - break; - } - - case KTavsrcOpBackwards: - { - iOperations->EndOperation(KTavsrcOpBackwards, KErrNone); - - iController->Command(ERemConCoreApiBackward); - break; - } - - case KTavsrcOpForwards: - { - iOperations->EndOperation(KTavsrcOpForwards, KErrNone); - - iController->Command(ERemConCoreApiForward); - break; - } - - case KTavsrcOpPlay: - { - iOperations->EndOperation(KTavsrcOpPlay, KErrNone); - - iController->Command(ERemConCoreApiPlay); - break; - } - - case KTavsrcOpStop: - { - iOperations->EndOperation(KTavsrcOpStop, KErrNone); - - iController->Command(ERemConCoreApiStop); - break; - } - - case KTavsrcOpExit: - { - iOperations->EndOperation(KTavsrcOpExit, KErrNone); - - Stop(); - return; - } - - case KTavsrcOpToggleSafeMode: - { - iOperations->EndOperation(KTavsrcOpToggleSafeMode, KErrNone); - - iOperations->SetSafeMode(!iOperations->SafeMode()); - break; - } - - default: - iActiveConsole->Console().Printf(_L("Unknown command\r\n")); - } - } - else - { - __LOG(_L("Operation not allowed: %d\r\n"), beginOperation); - } - - TestMenu(); - - } - -TInt CAVTestApp::RegisterSEP() - { - TInt err; - - TAvdtpSEPInfo info; - info.SetIsSink(TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("Sink "))); - info.SetMediaType(TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("Audio ")) ? - EAvdtpMediaTypeAudio : - EAvdtpMediaTypeVideo); - err = iGavdp.RegisterSEP(info); - - if (err==KErrNone) - { - iLocallyRegisteredSEPs.Append(info); - } - __LOG(_L("Registering SEP [SEID %d] - completed with error %d\n"), info.SEID().SEID(), err); - - if (err==KErrNone) - { - iCurrentLocalSEID = info.SEID(); - - // add some caps, not to all though for testing! - err = iGavdp.BeginConfiguringLocalSEP(info.SEID()); - - __LOG(_L("Begin config Local SEP [SEID %d] - completed with error %d\n"), info.SEID().SEID(), err); - - TAvdtpMediaTransportCapabilities media; - err = iGavdp.AddSEPCapability(media); - __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), media.Category(), err); -/* - TAvdtpReportingCapabilities rep; - err = iGavdp.AddSEPCapability(rep); - __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), rep.Category(), err); - - TAvdtpRecoveryCapabilities rec; - rec.SetRecoveryType(ERFC2733Recovery); - rec.SetMaxWindowSize(5); - rec.SetMinWindowSize(1); - err = iGavdp.AddSEPCapability(rec); - __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), rec.Category(), err); - - TAvdtpContentProtectionCapabilities cp; - cp.SetContentProtectionType(0x1234); - cp.SetContentProtectionData(_L8("A test content protection method")); - err = iGavdp.AddSEPCapability(cp); - */ - if(TTavsrcUtils::GetYNFromUser(iActiveConsole->Console(), _L("SBC "))) - { - TSBCCodecCapabilities sbc; - sbc.SetSamplingFrequencies(E48kHz|E44100Hz|E32kHz|E16kHz); - sbc.SetBlockLengths(EBlockLenFour | EBlockLenEight | EBlockLenTwelve | EBlockLenSixteen); - sbc.SetMinBitpoolValue(2); - sbc.SetMaxBitpoolValue(250); - sbc.SetChannelModes(EJointStereo | EStereo | EMono | EDualChannel); - sbc.SetSubbands(EFourSubbands|EEightSubbands); - sbc.SetAllocationMethods(ELoudness | ESNR); - - // crazy stuff testing - /* - sbc.SetSamplingFrequencies(E16kHz); - sbc.SetBlockLengths(EBlockLenTwelve); - sbc.SetChannelModes(EJointStereo); - sbc.SetSubbands(EFourSubbands); - */ - err = iGavdp.AddSEPCapability(sbc); - - __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), sbc.Category(), err); - } - else - { - TNonSBCCodecCapabilities codec(SymbianBluetoothAV::EAvdtpMediaTypeAudio, SymbianBluetoothAV::EAudioCodecMPEG24AAC); - TBuf8<18> mpeg2aacData; - mpeg2aacData.Append(0x80); // MPEG2 AAC LC - mpeg2aacData.Append(0x01); // 44.1 kHz - mpeg2aacData.Append(0x80); // 48.0 kHz, Channels 1 & 2 - mpeg2aacData.Append(0x80); // VBR, unknown bitrate - mpeg2aacData.Append(0x00); // unknown bitrate - mpeg2aacData.Append(0x00); // unknown bitrate - - codec.SetCodecData(mpeg2aacData); - - err = iGavdp.AddSEPCapability(codec); - - __LOG(_L("Add configuration [Category %d] - completed with error %d\n"), codec.Category(), err); - } - - iRegisteringLocalSEP = ETrue; - iGavdp.CommitSEPConfiguration(); - - __LOG(_L("Commit configuration [SEID %d]\n"), info.SEID().SEID()); - } - return err; - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrc.h --- a/bluetooth/gavdp/test/tavsrc.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,305 +0,0 @@ -// 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: -// - -#ifndef TAVSRC_H -#define TAVSRC_H - -//only use define CHANNEL_BINDING_DEBUG_CHECK when checking channel binding -//#define CHANNEL_BINDING_DEBUG_CHECK - -#define __PRINT iActiveConsole->Console().Printf -#define __LOG iLogConsole->Console().Printf /*RDebug::Print*/ - -#include "tavsrcConsole.h" -#include "tavsrcStreamerUser.h" -#include "tavsrcOperations.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -enum TRemConInterfaces - { - ECoreApiTarget = 1 << 0, - ECoreApiController = 1 << 1, - EGroupNavigation = 1 << 2, - EMediaInformation = 1 << 3, - EBatteryStatus = 1 << 4, - EAbsoluteVolumeTarget = 1 << 5, - EAbsoluteVolumeController = 1 << 6, - EPlayerInformation = 1 << 7, - ENowPlaying = 1 << 8, - EMediaBrowse = 1 << 9, - EDatabaseAware = 1 << 10, - ESeparateThreadForBrowse = 1 << 11, - EVendorTrackInfoTarget = 1 << 12, - EVendorAbsoluteVolumeTarget = 1 << 13, - }; - - -typedef TFixedArray RSocketArray; - -class CActivePacketDropIoctl; -class CActiveSockReader; -class CActiveSockWriter; -class CRemMetadataTransferTarget; -class CAVTestApp; -class CActiveStreamer; -class CTavsrcController; -class CRemConInterfaceSelector; -class CRemConCoreApiTarget; -class CRemConTrackInfoTarget; -class CRemConAbsVolTarget; -class CTavsrcMtUpdater; -class CTavsrcAbsoluteVolume; -class CAVTestApp : public CBase, public MActiveConsoleNotify, - public MGavdpUser, public MBluetoothPhysicalLinksNotifier, - public MRemConCoreApiTargetObserver, - public MActiveStreamerUser, - public MRemConMediaInformationTargetObserver, - public MRemConGroupNavigationTargetObserver, - public MRemConBatteryTargetObserver, - public MRemConTrackInfoTargetObserver, - public MRemConAbsVolTargetObserver - { -private: - enum TTavsrcServiceCategory - { - ETavsrcServiceCategoryNull =0x00, - ETavsrcServiceCategoryMediaTransport =0x01, - ETavsrcServiceCategoryReporting =0x02, - ETavsrcServiceCategoryRecovery =0x04, - ETavsrcServiceCategoryContentProtection =0x08, - ETavsrcServiceCategoryHeaderCompression =0x10, - ETavsrcServiceCategoryMultiplexing =0x20, - ETavsrcServiceCategoryMediaCodec =0x40, - }; -public: - static CAVTestApp* NewL(); - void EchoStorm(); - - void StartL(); - void Stop(); - ~CAVTestApp(); - void TestMenu(); - - void KeyPressed(TChar aKey); - - TInt StartSrc(); - void StopSrc(); - void DisconnectSrc(); - - // echo test - virtual void HandleCreateConnectionCompleteL(TInt aErr); - virtual void HandleDisconnectCompleteL(TInt aErr); - virtual void HandleDisconnectAllCompleteL(TInt aErr); - -private: - void PreventLowPowerModes(); - void AllowLowPowerModes(); - void CreateBearers(); - void CloseBearers(); - void ConfigureSEPL(); - void Abort(); - void DiscoverSEPs(); - void StartStreams(); - void SuspendStreams(); - void GetCapabilities(); - void SendSecurityControl(); - TSBCCodecCapabilities InteractiveSBCMediaCodecConfig(TSBCCodecCapabilities& caps); - - void PrintCommandOption(TChar aOperation, TPtrC aDesc); - - void CreateStreamerL(RSocketArray aSockets); - void CreateRemConInterfacesL(); - - void Connect(); - TInt Listen(); - TInt RegisterSEP(); - - CAVTestApp(); - void ConstructL(); - - //return ETrue if current SEP is sink, EFalse otherwise - TBool CurrentSEIDIsSink(); - - void DisplayHelp(); - void ParseCommandLineL(); - -private: - // GAVDP callbacks - virtual void GAVDP_SEPDiscovered(const TAvdtpSEPInfo& aSEP); - virtual void GAVDP_SEPDiscoveryComplete(); - virtual void GAVDP_SEPCapability(TAvdtpServiceCapability* aCapability); - virtual void GAVDP_SEPCapabilityComplete(); - virtual void GAVDP_AbortStreamConfirm(); - virtual void GAVDP_StartStreamsConfirm(); - virtual void GAVDP_SuspendStreamsConfirm(); - virtual void GAVDP_SecurityControlConfirm(const TDesC8& aResponseData); - virtual void GAVDP_ConfigurationConfirm(); // configuration complete and SEP selected *AND* reconfigure confirm - virtual void GAVDP_Error(TInt aError, const TDesC8& aErrorData); - virtual void GAVDP_ConnectConfirm(const TBTDevAddr& aAddr); - - virtual void GAVDP_ConfigurationStartIndication(TSEID aLocalSEID, TSEID aRemoteSEID); - virtual TInt GAVDP_ConfigurationIndication(TAvdtpServiceCapability* aCapability); - virtual TInt GAVDP_ConfigurationEndIndication(); - - virtual TInt GAVDP_StartIndication(TSEID aSEID); - virtual TInt GAVDP_SuspendIndication(TSEID aSEID); - virtual TInt GAVDP_SecurityControlIndication(TSEID aSEID, TDes8& aSecurityData); - virtual void GAVDP_AbortIndication(TSEID aSEID); - virtual void GAVDP_ReleaseIndication(TSEID aSEID); - virtual void GAVDP_BearerReady(RSocket aNewSocket, const TAvdtpSockAddr& aAddr); - - void PrettyPrint(TAvdtpServiceCapability& aCapability); - -private: - // RemConCoreApiTarget callbacks - virtual void MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct); - virtual void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed, TRemConCoreApiButtonAction aButtonAct); - -private: - // from MActiveStreamerUser - virtual void MediaCodecConfigurationRequired(TSBCCodecCapabilities& aConfig); - - virtual TInt MrcmtcGetElementAttributes(TUint64 aElement, TUint32 aAttribute, HBufC8*& aOutValueOwnershipTransferred); - - // from MRemConGroupNavigationTargetObserver - virtual void MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct); - virtual void MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct); - virtual void MrcbstoBatteryStatus(TControllerBatteryStatus& aBatteryStatus); - - // from MRemConMediaInformationTargetObserver - virtual void MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter ); - - virtual void MrcncRegisterPlaybackStatusChangedNotification(); - virtual void MrcncRegisterTrackChangedNotification(); - virtual void MrcncRegisterTrackReachedEndNotification(); - virtual void MrcncRegisterTrackReachedStartNotification(); - virtual void MrcncRegisterPositionChangedNotification(TUint32 aInterval); - virtual void MrcncRegisterBatteryStatusChangedNotification(); - virtual void MrcncRegisterSystemStatusChangedNotification(); - virtual void MrcncRegisterPlayerApplicationStatusChangedNotification(); - - virtual void MrcavtoGetAbsoluteVolume(); - virtual void MrcavtoSetAbsoluteVolume(TUint /*aAbsVol*/, TUint /*aMaxVol*/); - - virtual void MrctitoGetTrackName(); - virtual void MrctitoGetArtist(); - virtual void MrctitoGetTrackDuration(); - -private: - CActiveConsole* iActiveConsole; - CActiveConsole* iLogConsole; - CTavsrcMtUpdater* iMtUpdater; - - RSocketServ iSockServ; - -#ifdef CHANNEL_BINDING_DEBUG_CHECK - CActiveSockReader* iRepReader; - CActiveSockWriter* iRepWriter; - CActiveSockReader* iRecvReader; - CActiveSockWriter* iRecvWriter; -#endif - - CActivePacketDropIoctl* iPacketDropIoctl; - - RGavdp iGavdp; - - TSEID iCurrentSEID; // Current Remote SEID - TSEID iCurrentLocalSEID; // Current Local SEID - - RPointerArray iSEPCapabilities; // only held for one SEP at a time in this test code - - RArray iShortlistedSEIDs; // for finding good remote SEP - TBool iChosenSEP; - - RArray iLocallyRegisteredSEPs; - TBool iRegisteringLocalSEP; - - CActiveStreamer* iStreamer; - RSocketArray iPendingSockets; - - CRemConInterfaceSelector* iRemConInterfaceSelector; - CRemConCoreApiTarget* iRemConTarget; - CRemConGroupNavigationApiTarget* iGroupNavigation; - CRemConMediaInformationTarget* iMediaInformation; - CRemConBatteryApiTarget* iBatteryStatus; - CRemConTrackInfoTarget* iTrackInfo; - CRemConAbsVolTarget* iAbsoluteVolume; - CTavsrcAbsoluteVolume* iTavsrcAbsoluteVolume; - - RSdp iSdp; - RSdpDatabase iSdpDB; - TSdpServRecordHandle iSrcHandle; - TSdpServRecordHandle iSnkHandle; - - TBool iAutoStream; - - enum TGavdpState - { - ENoClientOpen, - EIdle, - ESigConnected, - EOpen, - ESuspended, - ERemoteReconfiguring, - }; - - enum TStreamState - { - EClosed, - EStreaming, - EPaused, - EStopped, - }; - - TGavdpState iGavdpState; - TStreamState iStreamState; - - TSBCCodecCapabilities iReconfigInfo; - TBool iLocalReconfigure; - - TUint iDisplayMode; - TBool iPreloadFile; - - CTavsrcController* iController; - TBTDevAddr iDevAddr; - - CTavsrcOperations* iOperations; - - RBuf iFilename; - RBTPhysicalLinkAdapter iPhy; - - TUint iRemConInterfaces; - }; - -#endif // TAVSRC_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrc.mmp --- a/bluetooth/gavdp/test/tavsrc.mmp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -// Copyright (c) 2008-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: -// tavrsc.mmp -// -// - -#define DBAWARE -MACRO DBAWARE - - -TARGET tavsrc.exe -TARGETTYPE exe -UID 0 - -SOURCEPATH . -SOURCE tavsrc.cpp -SOURCE tavsrcUI.cpp -SOURCE tavsrcConsole.cpp -SOURCE tavsrcController.cpp -SOURCE tavsrcSock.cpp -SOURCE tavsrcStreamer.cpp -SOURCE tavsrcTimer.cpp -SOURCE tavsrcUtils.cpp -SOURCE tavsrcOperations.cpp -SOURCE tavsrcAbsoluteVolume.cpp -SOURCE activecallbackconsole.cpp - -#ifdef DBAWARE -SOURCE tavsrcmtupdaterdatabaseaware.cpp -#else -SOURCE tavsrcmtupdaterdatabaseunaware.cpp -#endif - -OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE_SYMBIAN - -USERINCLUDE ../../../../../mw/btservices/bluetoothappprofiles/avrcp/common - -LIBRARY euser.lib esock.lib bluetooth.lib bluetoothav.lib gavdp.lib -LIBRARY sdpdatabase.lib -LIBRARY flogger.lib efsrv.lib rtp.lib -LIBRARY remconcoreapi.lib -LIBRARY remconclient.lib -LIBRARY remcontypes.lib -LIBRARY remconinterfacebase.lib -LIBRARY econs.lib -LIBRARY c32.lib -LIBRARY hal.lib -LIBRARY btextnotifiers.lib -LIBRARY bafl.lib - -LIBRARY remcongroupnavigationapi.lib -LIBRARY remconmediainformationapi.lib -LIBRARY remconbatterystatusapi.lib -LIBRARY remconplayerinformation.lib -LIBRARY remconextapi1.lib -LIBRARY remconnowplayingapi.lib -LIBRARY remconmediabrowseapi.lib -LIBRARY remconabsolutevolume.lib - -#include - -EPOCHEAPSIZE 1024000 4096000 -CAPABILITY ALL -TCB -VENDORID 0x70000001 - -SMPSAFE diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcAbsoluteVolume.cpp --- a/bluetooth/gavdp/test/tavsrcAbsoluteVolume.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -// 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: -// - -#include "tavsrcAbsoluteVolume.h" -#include -#include - -#ifdef __WINS__ -GLDEF_D TSize gAbsoluteVolumeConsole(75,30); -#else -GLDEF_D TSize gAbsoluteVolumeConsole(KConsFullScreen,KConsFullScreen); -#endif - - -CTavsrcAbsoluteVolume* CTavsrcAbsoluteVolume::NewL(CRemConInterfaceSelector& aIfSel) - { - CTavsrcAbsoluteVolume* self = new (ELeave) CTavsrcAbsoluteVolume(); - CleanupStack::PushL(self); - self->ConstructL(aIfSel); - CleanupStack::Pop(); - return self; - } - -CTavsrcAbsoluteVolume::~CTavsrcAbsoluteVolume() - { - Cancel(); - delete iMtAbsoluteVolumeConsole; - } - -CTavsrcAbsoluteVolume::CTavsrcAbsoluteVolume() - : CActive(EPriorityStandard) - { - CActiveScheduler::Add(this); - } - -void CTavsrcAbsoluteVolume::ConstructL(CRemConInterfaceSelector& aIfSel) - { - iAbsoluteVolumeTarget = CRemConAbsoluteVolumeTarget::NewL(aIfSel, *this, KInitialVolume, KMaxTgVolume); - iAbsoluteVolumeController = CRemConAbsoluteVolumeController::NewL(aIfSel, *this, KMaxCtVolume); - iMtAbsoluteVolumeConsole = CActiveConsole::NewL(*this,_L("AbsoluteVolume"),gAbsoluteVolumeConsole); - MtMenu(); - } - -void CTavsrcAbsoluteVolume::MtMenu() - { - iMtAbsoluteVolumeConsole->Console().Printf(_L("1.\tCT SetAbsoluteVolume \n")); - iMtAbsoluteVolumeConsole->Console().Printf(_L("2.\tCT Cancel SetAbsoluteVolume \n")); - iMtAbsoluteVolumeConsole->Console().Printf(_L("3.\tCT RegisterAbsoluteVolumeNotification \n")); - iMtAbsoluteVolumeConsole->Console().Printf(_L("4.\tCT CancelAbsoluteVolumeNotification\n")); - iMtAbsoluteVolumeConsole->Console().Printf(_L("5.\tTG SetAbsoluteVolumeResponse\n")); - iMtAbsoluteVolumeConsole->Console().Printf(_L("6.\tTG AbsoluteVolumeChanged\n")); - iMtAbsoluteVolumeConsole->Console().Printf(_L("\n")); - - iMtAbsoluteVolumeConsole->RequestKey(); - } - -void CTavsrcAbsoluteVolume::KeyPressed(TChar aKey) - { - switch(aKey) - { - case '1': - { - TRequestStatus status; - iAbsoluteVolumeController->SetAbsoluteVolume(iStatus, GetVolume(), iNumRemotes); - SetActive(); - break; - } - case '2': - { - iAbsoluteVolumeController->CancelSetAbsoluteVolume(); - iMtAbsoluteVolumeConsole->Console().Printf(_L("CT Cancelled Set Absolute Volume\n")); - break; - } - - case '3': - { - TRequestStatus status; - iAbsoluteVolumeController->RegisterAbsoluteVolumeNotification(); - iMtAbsoluteVolumeConsole->Console().Printf(_L("CT Registered Absolute Volume Notification \n")); - break; - } - case '4': - { - iAbsoluteVolumeController->CancelAbsoluteVolumeNotification(); - iMtAbsoluteVolumeConsole->Console().Printf(_L("CT Cancelled Absolute Volume Notification \n")); - break; - } - case '5': - { - iAbsoluteVolumeTarget->SetAbsoluteVolumeResponse(GetVolume(), KErrNone); - iMtAbsoluteVolumeConsole->Console().Printf(_L("TG SetAbsoluteVolumeResponse \n")); - break; - } - case '6': - { - iAbsoluteVolumeTarget->AbsoluteVolumeChanged(GetVolume()); - iMtAbsoluteVolumeConsole->Console().Printf(_L("TG AbsoluteVolumeChanged \n")); - break; - } - default: - iMtAbsoluteVolumeConsole->Console().Printf(_L("No such command\n")); - break; - }; - - MtMenu(); - } - -void CTavsrcAbsoluteVolume::MrcavtoSetAbsoluteVolumeRequest(TUint32 aVolume, - TUint32 aMaxVolume) - { - TUint32 scaledVolume = (aVolume * 10)/(aMaxVolume); - iMtAbsoluteVolumeConsole->Console().Printf(_L("MrcavtoSetAbsoluteVolumeRequest vol= %d, maxVol= %d, setting volume = %d\n"), aVolume, aMaxVolume, scaledVolume); - iMtAbsoluteVolumeConsole->Console().Printf(_L("Provide volume for response relative to local max volume (%d)\n"), KMaxTgVolume); - iAbsoluteVolumeTarget->SetAbsoluteVolumeResponse(GetVolume(), KErrNone); - } - -void CTavsrcAbsoluteVolume::MrcavcoCurrentVolume(TUint32 aVolume, - TUint32 aMaxVolume, - TInt aError) - { - iMtAbsoluteVolumeConsole->Console().Printf( - _L("MrcavcoCurrentVolume vol= %d, maxVol= %d, err= %d\n"), - aVolume, aMaxVolume, aError); - } - -void CTavsrcAbsoluteVolume::MrcavcoAbsoluteVolumeNotificationError() - { - iMtAbsoluteVolumeConsole->Console().Printf(_L("MrcavcoAbsoluteVolumeNotificationError\n")); - } - -void CTavsrcAbsoluteVolume::MrcavcoSetAbsoluteVolumeResponse(TUint32 aVolume, - TUint32 aMaxVolume, - TInt aError) - { - iMtAbsoluteVolumeConsole->Console().Printf( - _L("MrcavcoSetAbsoluteVolumeResponse vol= %d, maxVol= %d, err= %d\n"), - aVolume, aMaxVolume, aError); - } - -void CTavsrcAbsoluteVolume::RunL() - { - iMtAbsoluteVolumeConsole->Console().Printf(_L("CT SetAbsoluteVolume Sent %d to %u remotes\n"), iStatus.Int(), iNumRemotes); - } - -void CTavsrcAbsoluteVolume::DoCancel() - { - iAbsoluteVolumeController->CancelSetAbsoluteVolume(); - } - -TUint32 CTavsrcAbsoluteVolume::GetVolume() - { - iMtAbsoluteVolumeConsole->Console().Printf(_L("Enter volume: ")); - TUint32 volume = iMtAbsoluteVolumeConsole->GetIntFromUser(); - iMtAbsoluteVolumeConsole->Console().Printf(_L("\n")); - - return volume; - } - - diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcAbsoluteVolume.h --- a/bluetooth/gavdp/test/tavsrcAbsoluteVolume.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -// 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: -// - -#ifndef TAVSRCABSOLUTEVOLUME_H_ -#define TAVSRCABSOLUTEVOLUME_H_ -#include -#include -#include "tavsrcConsole.h" - -static const TUint32 KInitialVolume = 1; -static const TUint32 KMaxTgVolume = 10; - -static const TUint32 KMaxCtVolume = 100; - -class CActiveConsole; -class CRemConInterfaceSelector; -class CRemConAbsoluteVolumeTarget; -class CRemConAbsoluteVolumeController; -class CTavsrcAbsoluteVolume: public CActive, - public MActiveConsoleNotify, - public MRemConAbsoluteVolumeTargetObserver, - public MRemConAbsoluteVolumeControllerObserver - { -public: - static CTavsrcAbsoluteVolume* NewL(CRemConInterfaceSelector& aIfSel); - ~CTavsrcAbsoluteVolume(); - -private: - CTavsrcAbsoluteVolume(); - void ConstructL(CRemConInterfaceSelector& aIfSel); - -private://from MActiveConsoleNotify - void KeyPressed(TChar aKey); - -private: - //from MRemConAbsoluteVolumeTargetObserver - void MrcavtoSetAbsoluteVolumeRequest(TUint32 aVolume, TUint32 aMaxVolume); - - //from MRemConAbsoluteVolumeControllerObserver - void MrcavcoCurrentVolume(TUint32 aVolume, TUint32 aMaxVolume, TInt aError); - void MrcavcoSetAbsoluteVolumeResponse(TUint32 aVolume, TUint32 aMaxVolume, TInt aError); - void MrcavcoAbsoluteVolumeNotificationError(); - -private: - // from CActive - void RunL(); - void DoCancel(); - -private: - void MtMenu(); - TUint32 GetVolume(); - -private: - CActiveConsole* iMtAbsoluteVolumeConsole; - CRemConAbsoluteVolumeTarget* iAbsoluteVolumeTarget; - CRemConAbsoluteVolumeController* iAbsoluteVolumeController; - TUint iNumRemotes; - }; - -#endif /*TAVSRCABSOLUTEVOLUME_H_*/ diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcConsole.cpp --- a/bluetooth/gavdp/test/tavsrcConsole.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -// 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: -// - -#include "tavsrcConsole.h" -#include "tavsrc.h" - -#include - -#if defined (__WINS__) -#define PDD_NAME _L("ECDRV") -#define LDD_NAME _L("ECOMM") -#else // __GCC32__ -#define PDD_NAME _L("EUART1") -#define LDD_NAME _L("ECOMM") -#endif - -static RTest testOutcome(_L("Test results")); - -CActiveConsole::CActiveConsole(MActiveConsoleNotify& aNotify) - : CActive(EPriorityStandard), iNotify(aNotify) - { - CActiveScheduler::Add(this); - } - - -CActiveConsole::~CActiveConsole() - { - Cancel(); - delete iConsole; - } - -CActiveConsole* CActiveConsole::NewL(MActiveConsoleNotify& aNotify,const TDesC& aTitle,const TSize& aSize) - { - CActiveConsole* console = new (ELeave) CActiveConsole(aNotify); - CleanupStack::PushL(console); - console->ConstructL(aTitle,aSize); - CleanupStack::Pop(); - return console; - } - -void CActiveConsole::ConstructL(const TDesC& aTitle,const TSize& aSize) - { - iConsole = Console::NewL(aTitle,aSize); - } - -void CActiveConsole::DoCancel() - { - iConsole->ReadCancel(); - } - -void CActiveConsole::RequestKey() - { - DrawCursor(); - iConsole->Read(iStatus); - SetActive(); - } - -void CActiveConsole::DrawCursor() - { - iConsole->Printf(_L(">>")); - } - -void CActiveConsole::RunL() - { - // key has been pressed - TChar ch = iConsole->KeyCode(); - iNotify.KeyPressed(ch); - } - -TInt CActiveConsole::RunError(TInt aError) - { - iConsole->Printf(_L("Console error %d\nTrying again...\n"), aError); - RequestKey(); - return KErrNone; - } - -TInt CActiveConsole::GetIntFromUser() - { - TBool requeRead = EFalse; - if(IsActive()) - { - Cancel(); - requeRead = ETrue; - } - - TKeyCode key; - - TBuf<10> intBuf; - - while((key = iConsole->Getch())!=EKeyEnter) - { - if(key == EKeyBackspace&&intBuf.Length()!=0) - { - intBuf.SetLength(intBuf.Length()-1); - iConsole->Printf(_L("%c"), key); - } - else if ( intBuf.Length() < intBuf.MaxLength()) - { - intBuf.Append(key); - iConsole->Printf(_L("%c"), key); - } - } - - iConsole->Printf(_L("\n")); - - TLex lex(intBuf); - TInt value = 0; - - TInt err = lex.Val(value); - if(err) - { - iConsole->Printf(_L("Error %d reading value from console\n"), err); - } - - if(requeRead) - { - RequestKey(); - } - return value; - } - -void LoadLDD_PDDL() - { - TInt err = KErrNone; - testOutcome.Printf(_L("Loading PDD... ")); - err = User::LoadPhysicalDevice(PDD_NAME); - if(err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - testOutcome.Printf(_L("Loading LDD... ")); - err = User::LoadLogicalDevice(LDD_NAME); - if(err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - } - -void StartL() - { - LoadLDD_PDDL(); - - CAVTestApp* app = CAVTestApp::NewL(); - app->StartL(); - - delete app; - } - - -TInt E32Main() - { - __UHEAP_MARK; - - CTrapCleanup* cleanupStack=CTrapCleanup::New(); // Get CleanupStack - - CActiveScheduler* activescheduler=new CActiveScheduler; - CActiveScheduler::Install(activescheduler); - - testOutcome.Printf(_L("Starting tests... ")); - - TRAPD(err, StartL()); - - delete activescheduler; - delete cleanupStack; - - testOutcome.Printf(_L("Test completed result %d"), err); - if(err != KErrNone) - { - testOutcome.Getch(); - } - testOutcome.Close(); - - - __UHEAP_MARKEND; - - return err ; - } - - diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcConsole.h --- a/bluetooth/gavdp/test/tavsrcConsole.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -// 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: -// - -#ifndef TAVSRCCONSOLE_H -#define TAVSRCCONSOLE_H - -#include -#include - -class MActiveConsoleNotify - { -public: - virtual void KeyPressed(TChar aKey) =0; - }; - -class CActiveConsole : public CActive - { -public: - static CActiveConsole* NewL(MActiveConsoleNotify& aNotify,const TDesC& aTitle,const TSize& aSize); - void RequestKey(); - TInt GetIntFromUser(); - - inline CConsoleBase& Console() const - { - return *iConsole; - }; - - ~CActiveConsole(); - -private: - void RunL(); - TInt RunError(TInt aError); - void DoCancel(); - void DrawCursor(); - CActiveConsole(MActiveConsoleNotify& aNotify); - void ConstructL(const TDesC& aTitle,const TSize& aSize); - -private: - CConsoleBase* iConsole; - MActiveConsoleNotify& iNotify; - }; - -#endif // TAVSRCCONSOLE_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcController.cpp --- a/bluetooth/gavdp/test/tavsrcController.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -// 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: -// - -#include "tavsrcController.h" - -#include -#include -#include - -CTavsrcController* CTavsrcController::NewL(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole) - { - CTavsrcController* controller = new(ELeave) CTavsrcController(aIfSel, aConsole); - CleanupStack::PushL(controller); - controller->ConstructL(); - CleanupStack::Pop(controller); - return controller; - } - -CTavsrcController::CTavsrcController(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole) - : CActive(EPriorityStandard), iState(EControllerNotConnected), iSelector(&aIfSel), iConsole(aConsole) - { - CActiveScheduler::Add(this); - } - -void CTavsrcController::ConstructL() - { - iCoreController = CRemConCoreApiController::NewL(*iSelector, *this); - iGoConnectionOrientedSent = EFalse; - } - -CTavsrcController::~CTavsrcController() - { - Cancel(); - } - -TInt CTavsrcController::Command(TRemConCoreApiOperationId aOpId) - { - TInt err = KErrNotReady; - - if(!IsActive()) - { - err = KErrNone; - - if(iState == EControllerConnected) - { - IssueCommand(aOpId); - } - else - { - // Need to connect first - TRAP(err, ConnectL()); - } - } - - return err; - } - - -void CTavsrcController::MrccacoResponse(TRemConCoreApiOperationId aOperationId, TInt aError) - { - iConsole.Console().Printf(_L("Received Response for Operation %d, Result %d\n"), aOperationId, aError); - } - -void CTavsrcController::IssueCommand(TRemConCoreApiOperationId aOpId) - { - switch(aOpId) - { - case ERemConCoreApiVolumeDown: - iCoreController->VolumeDown(iStatus, iNumRemotes, ERemConCoreApiButtonClick); - break; - case ERemConCoreApiVolumeUp: - iCoreController->VolumeUp(iStatus, iNumRemotes, ERemConCoreApiButtonPress); - break; - case ERemConCoreApiForward: - iCoreController->Forward(iStatus, iNumRemotes, ERemConCoreApiButtonClick); - break; - case ERemConCoreApiBackward: - iCoreController->Backward(iStatus, iNumRemotes, ERemConCoreApiButtonClick); - break; - case ERemConCoreApiPlay: - iCoreController->Play(iStatus, iNumRemotes, ERemConCoreApiButtonClick); - break; - case ERemConCoreApiStop: - iCoreController->Stop(iStatus, iNumRemotes, ERemConCoreApiButtonClick); - break; - default: - // Cos we don't want to SetActive(), alright? - return; - } - - iConsole.Console().Printf(_L("Sending Command Operation %d\n"), aOpId); - SetActive(); - } - -void CTavsrcController::ConnectL() - { - //Ask user which device address we should connect to... - iState = ESearchingForDevice; - User::LeaveIfError(iNotify.Connect()); - iNotify.StartNotifierAndGetResponse(iStatus, KDeviceSelectionNotifierUid, iPckg, iResPckg); - SetActive(); - } - -void CTavsrcController::RunL() - { - switch(iState) - { - case EControllerConnected: - { - // We don't care what the result was really - // Ask Tim about the display logging and - // log it - break; - } - case EControllerNotConnected: - { - iConsole.Console().Printf(_L("AVRCP connection completed, result = %d\n"), iStatus.Int()); - - if(iStatus.Int() == KErrNone) - { - // Connected ok, now issue command - iState = EControllerConnected; - IssueCommand(iOutstandingOperation); - } - break; - } - case ESearchingForDevice: - { - if (iStatus.Int() == KErrNone) - { - iState = EControllerNotConnected; - - iNotify.CancelNotifier(KDeviceSelectionNotifierUid); - iNotify.Close(); - - iConsole.Console().Printf(_L("Opening AVRCP connection...\n")); - - TBTDevAddr btAddr = iResPckg().BDAddr(); - // Store as 8 bit machine readable - RBuf8 bearerData; - bearerData.CreateL(btAddr.Des()); - - // Form the RemCon Addr from the AVRCP Uid and the - // bluetooth address - TRemConAddress addr; - addr.BearerUid() = TUid::Uid(KRemConBearerAvrcpImplementationUid); - addr.Addr() = bearerData; - - if (iGoConnectionOrientedSent) - { - // Only allowed to call GoConnectionOrientedL() once on pain of RemCon panic, - // ERemConClientPanicAlreadyConnectionOriented. Solution is to call GoConnectionlessL() - // before recalling GoConnectionOrientedL() - iSelector->GoConnectionlessL(); - } - iSelector->GoConnectionOrientedL(addr); - iSelector->ConnectBearer(iStatus); - iGoConnectionOrientedSent = ETrue; - - SetActive(); - break; - } - } - default: - { - // hmm shouldn't be here - __DEBUGGER(); - break; - } - } - } - -void CTavsrcController::DoCancel() - { - iCoreController->Cancel(); - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcController.h --- a/bluetooth/gavdp/test/tavsrcController.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -// 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: -// - -#ifndef TAVSRCCONTROLLER_H -#define TAVSRCCONTROLLER_H - -#include "tavsrcConsole.h" - -#include -#include -#include - -class CRemConInterfaceSelector; -class CRemConCoreApiController; - -class CTavsrcController : public CActive, public MRemConCoreApiControllerObserver - { -public: - static CTavsrcController* NewL(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole); - ~CTavsrcController(); - - TInt Command(TRemConCoreApiOperationId aOpId); - void MrccacoResponse(TRemConCoreApiOperationId aOperationId, TInt aError); - -private: - CTavsrcController(CRemConInterfaceSelector& aIfSel, CActiveConsole& aConsole); - void ConstructL(); - - void RunL(); - void DoCancel(); - - void ConnectL(); - void IssueCommand(TRemConCoreApiOperationId aOpId); - -private: - enum TTavsrcControllerState - { - EControllerConnected, - EControllerNotConnected, - ESearchingForDevice, - }; - -private: - TTavsrcControllerState iState; - CRemConInterfaceSelector* iSelector; - TBool iGoConnectionOrientedSent; - CRemConCoreApiController* iCoreController; - TUint iNumRemotes; - TRemConCoreApiOperationId iOutstandingOperation; - CActiveConsole& iConsole; - RNotifier iNotify; - TBTDeviceSelectionParamsPckg iPckg; - TBTDeviceResponseParamsPckg iResPckg; - }; - -#endif // TAVSRCCONTROLLER_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcOperations.cpp --- a/bluetooth/gavdp/test/tavsrcOperations.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ -// 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: -// - -#include "tavsrcOperations.h" - -// The opcodes used internally to CTavsrcOperations -static const TInt KTavsrcOpCodeConnect = 0x00000001; -static const TInt KTavsrcOpCodeCancel = 0x00000002; -static const TInt KTavsrcOpCodeDiscoverSEPs = 0x00000004; -static const TInt KTavsrcOpCodeCreateBearers = 0x00000008; -static const TInt KTavsrcOpCodeCloseBearers = 0x00000010; -static const TInt KTavsrcOpCodeContentProtection = 0x00000020; -static const TInt KTavsrcOpCodeGetCapabilities = 0x00000040; -static const TInt KTavsrcOpCodeStartStreams = 0x00000080; -static const TInt KTavsrcOpCodeSuspendStreams = 0x00000100; -static const TInt KTavsrcOpCodeEchoStorm = 0x00000200; -static const TInt KTavsrcOpCodeAbort = 0x00000400; -static const TInt KTavsrcOpCodeStream = 0x00000800; -static const TInt KTavsrcOpCodeStreamFaster = 0x00001000; -static const TInt KTavsrcOpCodeStreamSlower = 0x00002000; -static const TInt KTavsrcOpCodeAutoStream = 0x00004000; -static const TInt KTavsrcOpCodeStopStream = 0x00008000; -static const TInt KTavsrcOpCodeRegisterSEP = 0x00010000; -static const TInt KTavsrcOpCodeRegisterMultipleSEPs = 0x00020000; -static const TInt KTavsrcOpCodeStartSrc = 0x00040000; -static const TInt KTavsrcOpCodeStopSrc = 0x00080000; -static const TInt KTavsrcOpCodeDisconnectSrc = 0x00100000; -static const TInt KTavsrcOpCodeConfigureSEP = 0x00200000; -static const TInt KTavsrcOpCodeReconfigureSEP = 0x00400000; -static const TInt KTavsrcOpCodePacketDropIoctl = 0x00800000; -static const TInt KTavsrcOpCodeVolumeUp = 0x01000000; -static const TInt KTavsrcOpCodeVolumeDown = 0x02000000; -static const TInt KTavsrcOpCodeBackwards = 0x04000000; -static const TInt KTavsrcOpCodeForwards = 0x08000000; -static const TInt KTavsrcOpCodePlay = 0x10000000; -static const TInt KTavsrcOpCodeStop = 0x20000000; -static const TInt KTavsrcOpCodeExit = 0x40000000; -static const TInt KTavsrcOpCodeToggleSafeMode = 0x80000000; - -// all the AVRCP opcodes -static const TInt KTavsrcOpCodeAvrcp = KTavsrcOpCodeVolumeUp | KTavsrcOpCodeVolumeDown | KTavsrcOpCodeBackwards | KTavsrcOpCodeForwards | KTavsrcOpCodePlay | KTavsrcOpCodeStop; - -// all always available opcodes -static const TInt KTavsrcOpCodeAlwaysAvailable = KTavsrcOpCodeAvrcp | KTavsrcOpCodeToggleSafeMode | KTavsrcOpCodeCancel | KTavsrcOpCodeExit | KTavsrcOpCodeStopSrc | KTavsrcOpCodeRegisterSEP | KTavsrcOpCodeRegisterMultipleSEPs; - -// all possible opcodes -static const TInt KTavsrcOpCodeAll = 0xffffffff; - -// The next opcodes for every command, 0 means to not change state -static const TInt KTavsrcOpConnectNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeDiscoverSEPs | KTavsrcOpCodeAutoStream; -static const TInt KTavsrcOpCancelNextOperations = 0; -static const TInt KTavsrcOpDiscoverSEPsNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeGetCapabilities; -static const TInt KTavsrcOpCreateBearersNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeCloseBearers; -static const TInt KTavsrcOpCloseBearersNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeCreateBearers; -static const TInt KTavsrcOpContentProtectionNextOperations = 0; -static const TInt KTavsrcOpGetCapabilitiesNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeConfigureSEP; -static const TInt KTavsrcOpStartStreamsNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeStream | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeSuspendStreams | KTavsrcOpCodeAbort; -static const TInt KTavsrcOpSuspendStreamsNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeAbort | KTavsrcOpCodeReconfigureSEP; -static const TInt KTavsrcOpEchoStormNextOperations = 0; -static const TInt KTavsrcOpAbortNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeCloseBearers; -static const TInt KTavsrcOpStreamNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeStopStream | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeSuspendStreams | KTavsrcOpCodeAbort | KTavsrcOpCodeStreamFaster | KTavsrcOpCodeStreamSlower; -static const TInt KTavsrcOpStreamFasterNextOperations = 0; -static const TInt KTavsrcOpStreamSlowerNextOperations = 0; -static const TInt KTavsrcOpAutoStreamNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeStopStream | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeSuspendStreams; -static const TInt KTavsrcOpStopStreamNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeCloseBearers | KTavsrcOpCodeStream | KTavsrcOpCodeSuspendStreams | KTavsrcOpCodeAbort; -static const TInt KTavsrcOpRegisterSEPNextOperations = 0; -static const TInt KTavsrcOpRegisterMultipleSEPsNextOperations = 0; -static const TInt KTavsrcOpStartSrcNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeConnect; -static const TInt KTavsrcOpStopSrcNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartSrc; -static const TInt KTavsrcOpDisconnectSrcNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeConnect; -static const TInt KTavsrcOpConfigureSEPNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeCreateBearers; -static const TInt KTavsrcOpReconfigureSEPNextOperations = KTavsrcOpCodeAlwaysAvailable | KTavsrcOpCodeDisconnectSrc | KTavsrcOpCodeStartStreams | KTavsrcOpCodeAbort | KTavsrcOpCodeReconfigureSEP; -static const TInt KTavsrcOpPacketDropIoctlNextOperations = 0; -static const TInt KTavsrcOpVolumeUpNextOperations = 0; -static const TInt KTavsrcOpVolumeDownNextOperations = 0; -static const TInt KTavsrcOpBackwardsNextOperations = 0; -static const TInt KTavsrcOpForwardsNextOperations = 0; -static const TInt KTavsrcOpPlayNextOperations = 0; -static const TInt KTavsrcOpStopNextOperations = 0; -static const TInt KTavsrcOpExitNextOperations = 0; -static const TInt KTavsrcOpToggleSafeModeNextOperations = 0; - -// TTavsrcOperation -TTavsrcOperation::TTavsrcOperation(TInt aOpCode, TChar aOperation, TInt aNextOpCodes) - : iOpCode(aOpCode), iOperation(aOperation), iNextOpCodes(aNextOpCodes) - { - } - -/*static*/ TBool TTavsrcOperation::OperationMatchesAndAllowed(const TTavsrcOperation& aOpA, const TTavsrcOperation& aOpB) - { - return ((aOpA.iOperation == aOpB.iOperation) && (aOpA.iNextOpCodes & aOpB.iOpCode)); - } - -TInt TTavsrcOperation::GetNextOpCodes() const - { - return iNextOpCodes; - } - -// CTavsrcOperations -CTavsrcOperations* CTavsrcOperations::NewL() - { - CTavsrcOperations* operations = new (ELeave) CTavsrcOperations; - CleanupStack::PushL(operations); - operations->ConstructL(); - CleanupStack::Pop(operations); - return operations; - } - -void CTavsrcOperations::ConstructL() - { - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeConnect, KTavsrcOpConnect, KTavsrcOpConnectNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeCancel, KTavsrcOpCancel, KTavsrcOpCancelNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeDiscoverSEPs, KTavsrcOpDiscoverSEPs, KTavsrcOpDiscoverSEPsNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeCreateBearers, KTavsrcOpCreateBearers, KTavsrcOpCreateBearersNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeCloseBearers, KTavsrcOpCloseBearers, KTavsrcOpCloseBearersNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeContentProtection, KTavsrcOpContentProtection, KTavsrcOpContentProtectionNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeGetCapabilities, KTavsrcOpGetCapabilities, KTavsrcOpGetCapabilitiesNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStartStreams, KTavsrcOpStartStreams, KTavsrcOpStartStreamsNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeSuspendStreams, KTavsrcOpSuspendStreams, KTavsrcOpSuspendStreamsNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeEchoStorm, KTavsrcOpEchoStorm, KTavsrcOpEchoStormNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeAbort, KTavsrcOpAbort, KTavsrcOpAbortNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStream, KTavsrcOpStream, KTavsrcOpStreamNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStreamFaster, KTavsrcOpStreamFaster, KTavsrcOpStreamFasterNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStreamSlower, KTavsrcOpStreamSlower, KTavsrcOpStreamSlowerNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeAutoStream, KTavsrcOpAutoStream, KTavsrcOpAutoStreamNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStopStream, KTavsrcOpStopStream, KTavsrcOpStopStreamNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeRegisterSEP, KTavsrcOpRegisterSEP, KTavsrcOpRegisterSEPNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeRegisterMultipleSEPs, KTavsrcOpRegisterMultipleSEPs, KTavsrcOpRegisterMultipleSEPsNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStartSrc, KTavsrcOpStartSrc, KTavsrcOpStartSrcNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStopSrc, KTavsrcOpStopSrc, KTavsrcOpStopSrcNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeDisconnectSrc, KTavsrcOpDisconnectSrc, KTavsrcOpDisconnectSrcNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeConfigureSEP, KTavsrcOpConfigureSEP, KTavsrcOpConfigureSEPNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeReconfigureSEP, KTavsrcOpReconfigureSEP, KTavsrcOpReconfigureSEPNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodePacketDropIoctl, KTavsrcOpPacketDropIoctl, KTavsrcOpPacketDropIoctlNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeVolumeUp, KTavsrcOpVolumeUp, KTavsrcOpVolumeUpNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeVolumeDown, KTavsrcOpVolumeDown, KTavsrcOpVolumeDownNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeBackwards, KTavsrcOpBackwards, KTavsrcOpBackwardsNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeForwards, KTavsrcOpForwards, KTavsrcOpForwardsNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodePlay, KTavsrcOpPlay, KTavsrcOpPlayNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeStop, KTavsrcOpStop, KTavsrcOpStopNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeExit, KTavsrcOpExit, KTavsrcOpExitNextOperations)); - iOperations.AppendL(TTavsrcOperation(KTavsrcOpCodeToggleSafeMode, KTavsrcOpToggleSafeMode, KTavsrcOpToggleSafeModeNextOperations)); - - // tavsrc always starts the src initially - iLastOperationIndex = GetAllowedOperationIndex(KTavsrcOpStartSrc, KTavsrcOpCodeAll); - User::LeaveIfError(iLastOperationIndex); - } - -CTavsrcOperations::CTavsrcOperations() - : iPendingOperationIndex(KErrNotFound), iSafeMode(ETrue) - { - } - -CTavsrcOperations::~CTavsrcOperations() - { - iOperations.Close(); - } - -// Returns the index into iOperations array if aOperation is allowed as the next operation -// according to aAllowedNextOpcodes or an error -TInt CTavsrcOperations::GetAllowedOperationIndex(TChar aOperation, TInt aAllowedNextOpcodes) - { - TIdentityRelation matchFunc(TTavsrcOperation::OperationMatchesAndAllowed); - return (iOperations.Find(TTavsrcOperation(0, aOperation, aAllowedNextOpcodes), matchFunc)); - } - -TBool CTavsrcOperations::IsOperationAllowed(TChar aOperation) - { - TBool ret = EFalse; - - if (!SafeMode()) - { - // if we are not in safe mode then any operation is allowed - ret = ETrue; - } - else - { - ret = (GetAllowedOperationIndex(aOperation, iOperations[iLastOperationIndex].GetNextOpCodes()) >= 0); - } - return ret; - } - -TInt CTavsrcOperations::BeginOperation(TChar aOperation) - { - TInt rerr = KErrNone; - - if ((iPendingOperationIndex >= 0) && (aOperation != KTavsrcOpCancel)) - { - // an operation is in progress, block until it has completed - rerr = KErrNotReady; - } - else - { - TInt allowedNextOpCodes = iOperations[iLastOperationIndex].GetNextOpCodes(); - - if (!SafeMode()) - { - // not in safe mode so any operation should be allowed - allowedNextOpCodes = KTavsrcOpCodeAll; - } - - TInt index = GetAllowedOperationIndex(aOperation, allowedNextOpCodes); - - if (index >= 0) - { - // we have a valid operation - iPendingOperationIndex = index; - } - else - { - // aOperation is not a supported command, return error - rerr = index; - } - } - return rerr; - } - -void CTavsrcOperations::EndOperation(TChar aOperation, TInt aError) - { - // if an error has occured the state hasn't moved on - if (!aError) - { - // check to see if there is an outstanding operation - if (iPendingOperationIndex < 0) - { - // we have no pending operation, this means that the remote has moved our state on, - // to keep the allowed operations in step pretend that we moved the state on ourselves - iPendingOperationIndex = GetAllowedOperationIndex(aOperation, KTavsrcOpCodeAll); - } - - // update current state if there is any valid operations in the pending operation - if (iOperations[iPendingOperationIndex].GetNextOpCodes() != 0) - { - iLastOperationIndex = iPendingOperationIndex; - } - } - iPendingOperationIndex = KErrNotFound; - } - -TBool CTavsrcOperations::SafeMode() - { - return iSafeMode; - } - -void CTavsrcOperations::SetSafeMode(TBool aSafeMode) - { - iSafeMode = aSafeMode; - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcOperations.h --- a/bluetooth/gavdp/test/tavsrcOperations.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ - -// 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: -// - -#ifndef TAVSRCOPERATIONS_H -#define TAVSRCOPERATIONS_H - -#include -#include -#include -#include - -// all key operations available for user input -static const TInt KTavsrcOpConnect = ']'; -static const TInt KTavsrcOpCancel = '['; -static const TInt KTavsrcOpDiscoverSEPs = 'd'; -static const TInt KTavsrcOpCreateBearers = '1'; -static const TInt KTavsrcOpCloseBearers = '!'; -static const TInt KTavsrcOpContentProtection = 'p'; -static const TInt KTavsrcOpGetCapabilities = 'g'; -static const TInt KTavsrcOpStartStreams = 's'; -static const TInt KTavsrcOpSuspendStreams = 'e'; -static const TInt KTavsrcOpEchoStorm = 'E'; -static const TInt KTavsrcOpAbort = 'a'; -static const TInt KTavsrcOpStream = '@'; -static const TInt KTavsrcOpStreamFaster = '+'; -static const TInt KTavsrcOpStreamSlower = '-'; -static const TInt KTavsrcOpAutoStream = 'A'; -static const TInt KTavsrcOpStopStream = '\''; -static const TInt KTavsrcOpRegisterSEP = 't'; -static const TInt KTavsrcOpRegisterMultipleSEPs = 'T'; -static const TInt KTavsrcOpStartSrc = 'o'; -static const TInt KTavsrcOpStopSrc = 'c'; -static const TInt KTavsrcOpDisconnectSrc = 'f'; -static const TInt KTavsrcOpConfigureSEP = 'x'; -static const TInt KTavsrcOpReconfigureSEP = 'x'; -static const TInt KTavsrcOpPacketDropIoctl = 'i'; -static const TInt KTavsrcOpVolumeUp = EKeyUpArrow; -static const TInt KTavsrcOpVolumeDown = EKeyDownArrow; -static const TInt KTavsrcOpBackwards = EKeyLeftArrow; -static const TInt KTavsrcOpForwards = EKeyRightArrow; -static const TInt KTavsrcOpPlay = '}'; -static const TInt KTavsrcOpStop = '{'; -static const TInt KTavsrcOpExit = EKeyEscape; -static const TInt KTavsrcOpToggleSafeMode = 'W'; - -// describes one operation including key to press and next possible operations -class TTavsrcOperation - { -public: - TTavsrcOperation(TInt aOpCode, TChar aOperation, TInt aNextOpCodes); - - static TBool OperationMatchesAndAllowed(const TTavsrcOperation& aOpA, const TTavsrcOperation& aOpB); - TInt GetNextOpCodes() const; - -private: - // iOpCode is the internal representation of the operation and can be used in a bitmask to define - // all possible next operations - TInt iOpCode; - - // iOperation is the external representation of the operation, i.e. the key pressed by the user defined - // above - TChar iOperation; - - // iNextOpCodes is a bitmask of all the next possible operations after this operation - TInt iNextOpCodes; - }; - -// describes all operations and is used to only allow acceptable, as defined by GAVDP, operations -// to be selected by the user. All checking of whether an operation is allowed can be disabled -// by turning off safe mode. -class CTavsrcOperations : public CBase - { -public: - static CTavsrcOperations* NewL(); - ~CTavsrcOperations(); - - TBool IsOperationAllowed(TChar aOperation); - TInt BeginOperation(TChar aOperation); - void EndOperation(TChar aOperation, TInt aError); - - TBool SafeMode(); - void SetSafeMode(TBool aSafeMode); - -private: - CTavsrcOperations(); - void ConstructL(); - - TInt GetAllowedOperationIndex(TChar aOperation, TInt aAllowedNextOpcodes); - TBool IsOperationAllowed(TInt aIndex); - -private: - TInt iLastOperationIndex; - TInt iPendingOperationIndex; - - TBool iSafeMode; - - RArray iOperations; - }; - -#endif // TAVSRCOPERATIONS_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcSDP.cpp --- a/bluetooth/gavdp/test/tavsrcSDP.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +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: -// - -#include "tavsrc.h" - -void CAVTestApp::RegisterSinkSDPRecordL(RSdpDatabase& aDB, TBool aHeadphone, - TBool aSpeaker,TBool aRecorder,TBool aAmp) - { - CSdpAttrValue* attrVal = 0; - CSdpAttrValueDES* attrValDES = 0; - - // Set Attr 1 (service class list) to list with UUID = Audio Sink - aDB.CreateServiceRecordL(TUUID(KAudioSinkUUID), iSnkHandle); - - // Protocol Descriptor List - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP - ->BuildUintL(TSdpIntBuf(KAVDTP)) // PSM = AVDTP - ->EndListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID - ->BuildUintL(TSdpIntBuf(0x0100)) // Version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - //BrowseGroupList - /* - This has been added in order to be interoperable with remote devices which only look for the - service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature. - */ - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root) - ->EndListL(); - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5 - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = NULL; - - // Language - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUintL(TSdpIntBuf(KLanguageEnglish)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdCharacterEncodingUTF8)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdBasePrimaryLanguage)) - ->EndListL(); - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - // BT Profile Description - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(KAdvancedAudioDistributionUUID) - ->BuildUintL(TSdpIntBuf(0x0100)) // version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES); - - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - - // provider name - attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service name - attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution sink")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service description - attrVal = CSdpAttrValueString::NewStringL(_L8("kick back and listen to some fine tunes with this neat service")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // supported features - TUint16 supportedFeatures = aHeadphone ? 1:0; - supportedFeatures|=aSpeaker ? 2:0; - supportedFeatures|=aRecorder ? 4:0; - supportedFeatures|=aAmp ? 8:0; - attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf(supportedFeatures)); - CleanupStack::PushL(attrVal); - - aDB.UpdateAttributeL(iSnkHandle, KSdpAttrIdSupportedFeatures, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - } - - -void CAVTestApp::RegisterSourceSDPRecordL(RSdpDatabase& aDB, TBool aPlayer, - TBool aMic,TBool aTuner,TBool aMixer) - { - CSdpAttrValue* attrVal = 0; - CSdpAttrValueDES* attrValDES = 0; - - // Set Attr 1 (service class list) to list with UUID = Audio Sink - aDB.CreateServiceRecordL(TUUID(KAudioSourceUUID), iSrcHandle); - - // Protocol Descriptor List - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP - ->BuildUintL(TSdpIntBuf(KAVDTP)) // PSM = AVDTP - ->EndListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID - ->BuildUintL(TSdpIntBuf(0x0100)) // Version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - //BrowseGroupList - /* - This has been added in order to be interoperable with remote devices which only look for the - service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature. - */ - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root) - ->EndListL(); - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5 - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = NULL; - - // Language - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUintL(TSdpIntBuf(KLanguageEnglish)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdCharacterEncodingUTF8)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdBasePrimaryLanguage)) - ->EndListL(); - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - // BT Profile Description - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(KAdvancedAudioDistributionUUID) - ->BuildUintL(TSdpIntBuf(0x0100)) // version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES); - - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - - // provider name - attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service name - attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution source")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service description - attrVal = CSdpAttrValueString::NewStringL(_L8("plug your wireless cans into me!")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // supported features - - TUint16 supportedFeatures = aPlayer ? 1:0; - supportedFeatures|=aMic ? 2:0; - supportedFeatures|=aTuner ? 4:0; - supportedFeatures|=aMixer ? 8:0; - attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf(supportedFeatures)); - CleanupStack::PushL(attrVal); - - aDB.UpdateAttributeL(iSrcHandle, KSdpAttrIdSupportedFeatures, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - } - diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcSock.cpp --- a/bluetooth/gavdp/test/tavsrcSock.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ -// 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: -// - -#include "tavsrcSock.h" -#include "tavsrc.h" - -#ifdef __WINS__ -static const TSize KReaderConsole(55,10); -static const TSize KWriterConsole(55,12); -#else -static const TSize KReaderConsole(KConsFullScreen,KConsFullScreen); -static const TSize KWriterConsole(KConsFullScreen,KConsFullScreen); -#endif - -// -// class CActivePacketDropIoctl -// -CActivePacketDropIoctl* CActivePacketDropIoctl::NewL(CActiveConsole* aLogConsole, RSocketArray aPendingSockets) - { - CActivePacketDropIoctl* self = new (ELeave) CActivePacketDropIoctl(aLogConsole, aPendingSockets); - return self; - } - -CActivePacketDropIoctl::CActivePacketDropIoctl(CActiveConsole* aLogConsole, RSocketArray aPendingSockets) : CActive(0) - { - iPendingSockets = aPendingSockets; - iLogConsole = aLogConsole; - CActiveScheduler::Add(this); - } - -CActivePacketDropIoctl::~CActivePacketDropIoctl() - { - } - -void CActivePacketDropIoctl::DoCancel() - { - Cancel(); - } - -void CActivePacketDropIoctl::Start() - { - iPendingSockets[0].Ioctl(ENotifyAvdtpMediaPacketDropped, iStatus, &iPacketsLostPkgBuf, KSolBtAVDTPMedia); - SetActive(); - } - -void CActivePacketDropIoctl::RunL() - { - __LOG(_L("\n**Packets Dropped Notification! %d packets lost.\n"), iPacketsLostPkgBuf()); - } - -// -// class CActiveSockReader -// -CActiveSockReader* CActiveSockReader::NewL(RSocket aSock, TAvdtpTransportSessionType aType) - { - CActiveSockReader* self = new (ELeave) CActiveSockReader(aSock); - CleanupStack::PushL(self); - self->ConstructL(aType); - CleanupStack::Pop(self); - return self; - } - -CActiveSockReader::CActiveSockReader(RSocket aSock) -: CActive(0), iSock(aSock), iBufferDes(NULL, NULL) - { - CActiveScheduler::Add(this); - } - -void CActiveSockReader::Start() - { - iSock.Read(iBufferDes,iStatus); - SetActive(); - } - -void CActiveSockReader::ConstructL(TAvdtpTransportSessionType aType) - { - iType = aType; - switch (aType) - { - case EMedia: - iConsole = Console::NewL(_L("Incoming Sink Data"),KReaderConsole); - break; - case EReporting: - iConsole = Console::NewL(_L("Incoming Reporting Channel Data"),KReaderConsole); - break; - case ERecovery: - iConsole = Console::NewL(_L("Incoming Recovery Channel Data"),KReaderConsole); - break; - } - - iBuffer = HBufC8::NewL(40); - iBuffer->Des().SetMax(); - iBufferDes.Set(iBuffer->Des()); - } - -CActiveSockReader::~CActiveSockReader() - { - Cancel(); - delete iConsole; - iSock.Close(); - } - -void CActiveSockReader::DoCancel() - { - iSock.CancelAll(); - } - -void CActiveSockReader::RunL() - { - if (iStatus.Int()==KErrNone) - { - iConsole->Printf(_L("length: [%04d]\n"),iBufferDes.Length()); - for (TInt i=0;i<=iBufferDes.Length()-1;i++) - { - iConsole->Printf(_L("%c"),iBufferDes[i]); - } - iConsole->Printf(_L("\n\n")); - iBuffer->Des().SetMax(); - iBufferDes.Set(iBuffer->Des()); - iSock.Read(iBufferDes,iStatus); - SetActive(); - } - else - { - iConsole->Printf(_L("SOCKET ERROR: %d"),iStatus.Int()); - } - - } - -// -// class CActiveSockWriter -// -CActiveSockWriter* CActiveSockWriter::NewL(RSocket aSock, - TAvdtpTransportSessionType aType) - { - CActiveSockWriter* writer = new (ELeave) CActiveSockWriter(aSock); - CleanupStack::PushL(writer); - writer->ConstructL(aType); - CleanupStack::Pop(); - return writer; - } - -CActiveSockWriter::~CActiveSockWriter() - { - delete iSendBuffer; - delete iConsole; - // test for normal shutdown on media socket - TRequestStatus stat; - iSock.Shutdown(RSocket::ENormal, stat); - User::WaitForRequest(stat); - iSock.Close(); - } - -void CActiveSockWriter::Send() - { - // periodic callback to send from app - if (IsActive()) - { - iConsole->Printf(_L("Info: Transport session %d tried to send, but active\n"), iType); - } - else - { - iSock.Write(*iSendBuffer, iStatus); - SetActive(); - } - } - -CActiveSockWriter::CActiveSockWriter(RSocket aSock) -: CActive(-1), iSock(aSock) - { - CActiveScheduler::Add(this); - } - -void CActiveSockWriter::ConstructL(TAvdtpTransportSessionType aType) - { - // Writer console to be used in the future if necessary for debugging - // iConsole = Console::NewL(_L("Writer"), KWriterConsole); - - iSendBuffer = HBufC8::NewL(512); - TPtr8 des = iSendBuffer->Des(); - iType = aType; - switch (aType) - { - case EMedia: - des.Copy(_L("Media channel connected!")); - break; - case EReporting: - des.Copy(_L("Reporting channel connected!")); - break; - case ERecovery: - des.Copy(_L("Recovery channel connected!")); - break; - default: - des.Copy(_L("Unknown channel ")); - des.AppendNum(aType); - des.Append(_L(" connected!")); - break; - } - } - -void CActiveSockWriter::DoCancel() - { - iSock.CancelWrite(); - } - -void CActiveSockWriter::RunL() - { - // iConsole->Printf(_L("Info: Transport session %d SENT, result %d"), iType, iStatus.Int()); - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcSock.h --- a/bluetooth/gavdp/test/tavsrcSock.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -// 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: -// - -#ifndef TAVSRCSOCK_H -#define TAVSRCSOCK_H - -#include "tavsrc.h" -#include "tavsrcConsole.h" - -#include - -class CActivePacketDropIoctl : public CActive - { -public: - static CActivePacketDropIoctl* NewL(CActiveConsole* aLogConsole, RSocketArray aPendingSockets); - ~CActivePacketDropIoctl(); - void DoCancel(); - void RunL(); - void Start(); - -private: - CActivePacketDropIoctl(CActiveConsole* aLogConsole, RSocketArray aPendingSockets); - -private: - CActiveConsole* iLogConsole; - RSocketArray iPendingSockets; - TPckgBuf iPacketsLostPkgBuf; - }; - -class CActiveSockWriter : public CActive - { -public: - static CActiveSockWriter* NewL(RSocket aSock, TAvdtpTransportSessionType aType); - ~CActiveSockWriter(); - void Send(); - void DoCancel(); - void RunL(); - -private: - CActiveSockWriter(RSocket aSock); - void ConstructL(TAvdtpTransportSessionType aType); - -private: - RSocket iSock; - CConsoleBase* iConsole; - HBufC8* iSendBuffer; - TAvdtpTransportSessionType iType; - }; - -class CActiveSockReader : public CActive - { -public: - static CActiveSockReader* NewL(RSocket aSock, TAvdtpTransportSessionType aType); - ~CActiveSockReader(); - void Start(); - -private: - CActiveSockReader(RSocket aSock); - void ConstructL(TAvdtpTransportSessionType aType); - void DoCancel(); - void RunL(); - -private: - RSocket iSock; - CConsoleBase* iConsole; - HBufC8* iBuffer; - TPtr8 iBufferDes; - TSockXfrLength iLen; - TAvdtpTransportSessionType iType; - }; - -#endif // TAVSRCSOCK_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcStreamer.cpp --- a/bluetooth/gavdp/test/tavsrcStreamer.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,830 +0,0 @@ -// 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: -// - -#include "tavsrcStreamer.h" -#include "tavsrcUI.h" -#include "tavsrcUtils.h" - -#include - -static const TSize KStreamerConsole(55,12); - -using namespace SymbianBluetoothAV; -using namespace SymbianSBC; - -// -// class CSbcTrackInfo -// -CSbcTrackInfo::~CSbcTrackInfo() - { - iFrameInfo.Close(); - } - -TInt CSbcTrackInfo::GetLastFrameSize() - { - TInt frameSize = KErrNotFound; - TInt count = iFrameInfo.Count(); - - if (count > 0) - { - frameSize = iFrameInfo[count - 1].iFrameSize; - } - return frameSize; - } - -TInt CSbcTrackInfo::AddNewFrame(TInt aFrameSize) - { - TInt rerr = KErrNone; - TInt count = iFrameInfo.Count(); - - if ((count > 0) && (iFrameInfo[count - 1].iFrameSize == aFrameSize)) - { - // another frame of the same size - iFrameInfo[count - 1].iFrameCount++; - } - else - { - // add new frame info - rerr = iFrameInfo.Append(TSbcTrackFrameInfo()); - if (rerr == KErrNone) - { - iFrameInfo[count].iFrameSize = aFrameSize; - iFrameInfo[count].iFrameCount = 1; - } - } - return rerr; - } - -TInt CSbcTrackInfo::RemoveLastFrame() - { - TInt rerr = KErrNotFound; - TInt count = iFrameInfo.Count(); - - if (count > 0) - { - if (iFrameInfo[count - 1].iFrameCount > 1) - { - // remove one of the instances of the last frame size - iFrameInfo[count - 1].iFrameCount--; - } - else - { - // remove the last frame info - iFrameInfo.Remove(count - 1); - } - rerr = KErrNone; - } - return rerr; - } - -void CSbcTrackInfo::Reset() - { - iFrameInfo.Reset(); - } - -// -// class CActiveStreamer -// -CActiveStreamer* CActiveStreamer::NewL(RSocketArray aSockets, - CConsoleBase& aConsole, - MActiveStreamerUser& aUser, - TUint aDisplayMode, - TBool aPreloadFile) - { - CActiveStreamer* self = new (ELeave) CActiveStreamer (aConsole, aUser, aDisplayMode, aPreloadFile); - CleanupStack::PushL(self); - self->ConstructL(aSockets); - CleanupStack::Pop(); - return self; - } - -CActiveStreamer::CActiveStreamer(CConsoleBase& aConsole, MActiveStreamerUser& aUser, TUint aDisplayMode, TBool aPreloadFile) -: iConsole(aConsole), iUser(aUser), iDisplayMode(aDisplayMode), iPreloadFile(aPreloadFile), iSbcFrameRate(1), iDirectionForward(ETrue) - { - iRTPCanSend = ETrue; - } - -CActiveStreamer::~CActiveStreamer() - { - delete iTimer; - - iSendSource.Close(); - iSession.Close(); - iSockets[0].Close(); - delete iFiles; - iFile.Close(); - iRFs.Close(); - - delete iProgressBar; - DestroyBucket(); - delete iStreamingInfoConsole; - - delete iFileBuf; - iFileBuf = NULL; - - delete iStreamerUI; - iStreamerUI = NULL; - } - -void CActiveStreamer::Stream(TBool aIsSink) - { - - if (!aIsSink) - { - iStartedTime.UniversalTime(); - iTimer->Start(iNominalSendClockInterval); - Drip(); - } - else - { - //as sink, we do want to start up rtp and await its notification of a NewSource - //Nothing to do at the moment, because when INT is a SNK, - //it just needs to get the RTP packets running and wait for notification. - //This has already been done in constructor of the class. - } - iStreamerUI->Play(); - } - -void CActiveStreamer::Suspend() - { - iTimer->Cancel(); // stop callbacks to send - iStreamerUI->Pause(); - } - -void CActiveStreamer::ReStream() - { - - - iTimer->Start(iNominalSendClockInterval); - Drip(); - iStreamerUI->Play(); - } - - -void CActiveStreamer::Stop() - { - iTimer->Cancel(); - iStreamerUI->Stop(); - - iFillLevel = 0; - iPos = 0; - } - -void CActiveStreamer::Pause() - { - iTimer->Cancel(); - iStreamerUI->Pause(); - } - - -void CActiveStreamer::NextTrack() - { - iPos=0; - if (iCurrentFile < iFiles->Count() - 1) - { - iCurrentFile++; - iStreamerUI->Next(); - } - else - { - iCurrentFile = 0; - iStreamerUI->First(); - } - TRAPD(err, InitL()); - if (err) - { - iConsole.Printf(_L("InitL failed with error: %d"),err); - } - } - -void CActiveStreamer::PrevTrack() - { - iPos=0; - if (iCurrentFile>0) - { - iCurrentFile--; - iStreamerUI->Prev(); - } - TRAPD(err, InitL()); - if (err) - { - iConsole.Printf(_L("InitL failed with error: %d"),err); - } - } - -void CActiveStreamer::InitL() - { - // close current file - iFile.Close(); - delete iProgressBar; - iProgressBar = NULL; - - // get file details - RBuf filename; - filename.Create(100); - filename.Append(KSBCFileRoot); - filename.Append(iFiles->operator[](iCurrentFile).iName); - - User::LeaveIfError(iFile.Open(iRFs,filename,EFileRead | EFileShareReadersOnly)); - - TInt numChannels, chMode, numSubbands, blkLen, bitPool, freq, allocMethod; - User::LeaveIfError(TTavsrcUtils::GetCodecSettingsFromSBCFile(filename, chMode, numChannels, numSubbands, blkLen, bitPool, freq, allocMethod)); - - if (iStreamingInfoConsole) - { - iStreamingInfoConsole->Printf(_L("\nFirst SBC frame info for: %S...\n"), &filename); - } - - filename.Close(); - - // determine if a re-configuration is required - if ((iNumChannels != numChannels) || (iFreq != freq) || - (iChMode != chMode) || (iBitPool != bitPool) || - (iBlkLen != blkLen) || (iNumSubbands != numSubbands) || - (iAllocMethod != allocMethod)) - { - iNumChannels = numChannels; - iChMode = chMode; - iNumSubbands = numSubbands; - iBlkLen = blkLen; - iBitPool = bitPool; - iFreq = freq; - iAllocMethod = allocMethod; - - // configuration is set first time around - if (iSBCFrameSize != 0) - { - TSBCCodecCapabilities cfg; - - TSBCSubbandsBitmask subbands = numSubbands == 8 ? EEightSubbands : EFourSubbands; - TSBCAllocationMethodBitmask alloc = allocMethod == 0 ? ELoudness : ESNR; - - TSBCSamplingFrequencyBitmask freqs(0); - if (freq == 48000) freqs = E48kHz; - else if (freq == 44100) freqs = E44100Hz; // note else if now as only select one - else if (freq == 32000) freqs = E32kHz; - else if (freq == 16000) freqs = E16kHz; - - TSBCChannelModeBitmask chs(0); // set it to anything to prevent warning - if (chMode == 0) chs=EMono; - else if (chMode == 1) chs=EDualChannel; - else if (chMode == 2) chs=EStereo; - else if (chMode == 3) chs=EJointStereo; - - TSBCBlockLengthBitmask blkLens(0); // set it to anything to prevent warning - if (blkLen == 4) blkLens = EBlockLenFour; - else if (blkLen == 8) blkLens = EBlockLenEight; - else if (blkLen == 12) blkLens = EBlockLenTwelve; - else if (blkLen == 16) blkLens = EBlockLenSixteen; - - cfg.SetSamplingFrequencies(freqs); - cfg.SetChannelModes(chs); - cfg.SetBlockLengths(blkLens); - cfg.SetSubbands(subbands); - cfg.SetAllocationMethods(alloc); - - // reconfig required - iUser.MediaCodecConfigurationRequired(cfg); - - // ensure no more timer events until we have finished reconfiguring - iTimer->Cancel(); - } - - if (chMode == 0 || chMode == 1) - { - iSBCFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal(blkLen*numChannels*bitPool)/8); - } - else - { - TBool join = chMode == 0x03; - - iSBCFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal((join*numSubbands+blkLen*bitPool))/8); - } - - iSBCBitrate = 8*iSBCFrameSize*freq/(numSubbands*blkLen); - TUint64 numerator = TUint64(8000000)*iSBCFrameSize; - iSBCFrameInterval = (numerator)/iSBCBitrate; //microsecs - } - - iSbcTrackInfo.Reset(); - iSbcTrackInfo.AddNewFrame(iSBCFrameSize); - - iDirectionForward = ETrue; - iSbcFrameRate = 1; - - User::LeaveIfError(iFile.Size(iFileSize)); - - if (iStreamingInfoConsole) - { - iStreamingInfoConsole->Printf(_L("Sampling Frequency: %d Hz\n"), iFreq); - iStreamingInfoConsole->Printf(_L("Subbands: %d\n"), iNumSubbands); - iStreamingInfoConsole->Printf(_L("BlkLen: %d\n"), iBlkLen); - iStreamingInfoConsole->Printf(_L("ChannelMode: %d\n"), iChMode); - iStreamingInfoConsole->Printf(_L("AllocMethod: %d\n"), iAllocMethod); - iStreamingInfoConsole->Printf(_L("Bitpool: %d\n"), iBitPool); - iStreamingInfoConsole->Printf(_L("SBC Frame size: %d bytes\n"), iSBCFrameSize); - iStreamingInfoConsole->Printf(_L("Bitrate: %d bps\n"), iSBCBitrate); - } - - TInt err = LoadFile(); - if(err==KErrNone) - { - if (iDisplayMode & EProgressBarWindow) - { - iProgressBar = CProgressBar::NewL(iFileSize); - } - FillBucket(); - } - else - { - User::Leave(err); - } - // start the timer for this file - iStartTime.UniversalTime(); - } - -void CActiveStreamer::UpdateFrameInfo() - { - TInt numChannels, chMode, numSubbands, blkLen, bitPool, freq, allocMethod; - User::LeaveIfError(TTavsrcUtils::GetCodecSettingsFromSBCFile(iFile, iPos, chMode, numChannels, numSubbands, blkLen, bitPool, freq, allocMethod)); - - // determine if a re-configuration is required - if ((iNumChannels != numChannels)|| (iFreq != freq) || - (iChMode != chMode) || (iBitPool != bitPool) || - (iBlkLen != blkLen) || (iNumSubbands != numSubbands) || - (iAllocMethod != allocMethod)) - { - iNumChannels = numChannels; - iChMode = chMode; - iNumSubbands = numSubbands; - iBlkLen = blkLen; - iBitPool = bitPool; - iFreq = freq; - iAllocMethod = allocMethod; - - TInt newFrameSize = 0; - if (chMode == 0 || chMode == 1) - { - newFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal(blkLen*numChannels*bitPool)/8); - } - else - { - TBool join = chMode == 0x03; - - newFrameSize = 4+TReal((4*numSubbands*numChannels))/8+TTavsrcUtils::CEIL(TReal((join*numSubbands+blkLen*bitPool))/8); - } - - if (newFrameSize != iSBCFrameSize) - { - // work out timer for SBC frame - iSBCBitrate = 8*newFrameSize*freq/(numSubbands*blkLen); - - TUint64 numerator = TUint64(8000000)*iSBCFrameSize; - iSBCFrameInterval = (numerator)/iSBCBitrate; //microsecs - } - iSBCFrameSize = newFrameSize; - } - } - -void CActiveStreamer::TimerEvent(CAdaptiveHighResPeriodic& /*aTimer*/) - { - if (iRTPCanSend) - { - iSent++; - } - else - { - // move iPos on anyway? - iFailedSend++; - } - DoTimerEvent(); - } - -void CActiveStreamer::TimerError(CAdaptiveHighResPeriodic& /*aTimer*/, TInt aError) - { - iConsole.Printf(_L("*ERROR %d*\n"), aError); - __DEBUGGER(); - } - - -void CActiveStreamer::DoTimerEvent() - { - FillBucket(); - Drip(); - CheckJammed(); - } - -void CActiveStreamer::FillBucket() - { - // fill up bucket - it may be fully empty or partially full, but top it up in all cases - if (iFillLevel < KLowTidemark) - { - for (/*iFillLevel*/; iFillLevel < KSendBucketSize; iFillLevel++) - { - // get the next RTP packet to send - RRtpSendPacket& sendPacket = iSendPackets[iFillLevel]; - TDes8& payload = sendPacket.WritePayload(); - payload.Zero(); - payload.Append(0); // update this later with number of frames in packet. - - TInt spaceInRtpPacket = iSBCFrameBytesPerRTP; - TInt framesAdded = 0; - TInt packetInterval = 0; - - TInt nextFrameSize = iDirectionForward ? iSBCFrameSize : iSbcTrackInfo.GetLastFrameSize(); - - TBool moreFrames = ETrue; - while ((nextFrameSize > 0) && (nextFrameSize <= spaceInRtpPacket) && (framesAdded <= 15) && moreFrames) - { - // add frame - if (iPreloadFile) - { - TPtrC8 ptr(iFileBuf->Des().Ptr()+iPos, nextFrameSize); - payload.Append(ptr); - } - else - { - TPtr8 ptr(const_cast(iFileBuf->Des().Ptr()), 0, nextFrameSize); - iFile.Read(iPos, ptr); - payload.Append(ptr); - } - framesAdded++; - packetInterval+=iSBCFrameInterval; - spaceInRtpPacket-=nextFrameSize; - - // get next frame information - for (TInt count = 0; (count != iSbcFrameRate) && moreFrames; count++) - { - iPos = iDirectionForward ? iPos + nextFrameSize : iPos - nextFrameSize; - - // determine if we are done with the current file - if ((iPos >= iFileSize) || (iPos < 0)) - { - moreFrames = EFalse; - } - else - { - TInt err = KErrNone; - if (iDirectionForward) - { - // keep track of the frame sizes as we go, this is used to rewind, - // i.e. iDirectionForward = EFalse - if ((err = iSbcTrackInfo.AddNewFrame(iSBCFrameSize)) != KErrNone) - { - iConsole.Printf(_L("Error adding SBC frame information: %d\n"), err); - __DEBUGGER(); - } - } - else - { - if ((err = iSbcTrackInfo.RemoveLastFrame()) != KErrNone) - { - // this should never happen as we always check the length first - iConsole.Printf(_L("Error removing SBC frame information: %d\n"), err); - __DEBUGGER(); - } - } - UpdateFrameInfo(); - nextFrameSize = iDirectionForward ? iSBCFrameSize : iSbcTrackInfo.GetLastFrameSize(); - } - } - } - - // has the interval changed since last time we set the timer - if ((iNominalSendClockInterval != packetInterval) && moreFrames) - { - // adjust timer - if (iStreamingInfoConsole) - { - iStreamingInfoConsole->Printf(_L("Interval change from: %d to %d\n"), iNominalSendClockInterval, packetInterval); - } - iNominalSendClockInterval = packetInterval; - iTimer->SetInterval(iNominalSendClockInterval); - } - - // write number of SBC frames into packet - payload[0] = TChar(framesAdded); - - //DrawBucket(); //<--- to animate the display - - if (iPos > iFileSize) - { - // time to do some metrics, and loop back to beginning - TTime finTime; - finTime.UniversalTime(); - - TInt64 secs; - secs = (finTime.MicroSecondsFrom(iStartTime)).Int64(); - - TInt bps = (iFileSize*8LL*1000000LL)/secs; - iConsole.Printf(_L("Looping. fail=%d, sent=%d, bytes=%d, secs=%Ld"), iFailedSend, iSent, iFileSize, secs); - iConsole.Printf(_L(" bps=%d\n"), bps); - - iFailedSend=0; - iSent=0; - iPos=0; // loop - - RDebug::Printf("Looping"); - NextTrack(); - - // restart the timer - iTimer->Start(iNominalSendClockInterval); - } - else if (iPos <= 0) - { - PrevTrack(); - } - else if (iProgressBar) - { - iProgressBar->Increment(iPos-iProgressBarPos); - iProgressBarPos = iPos; - } - } - iPreviousFillLevel = iFillLevel; - } - } - -void CActiveStreamer::DrawBucket() - { - if (iStreamingInfoConsole) - { - iStreamingInfoConsole->SetPos(1,1); - - TBuf bar; - bar.AppendFill('#',iFillLevel); - bar.AppendFill('.',KSendBucketSize-iFillLevel); - - iStreamingInfoConsole->Printf(bar); - } - } - -void CActiveStreamer::Drip() - { - // take head packet - RRtpSendPacket& packet = iSendPackets[0]; //packet=oldpacket - - // move previous packet to back - it is reusable, so we don't close - // instead just move to back so that the packet to send is at head - iSendPackets.Remove(0); - iSendPackets.Append(packet); - - if (iRTPCanSend && iFillLevel > 0) - { - // take oldest packet and give to RTP - packet.Send(); - iRTPCanSend = EFalse; - iFillLevel--; - //DrawBucket(); //<--- to animate the display - } - else - { - // not ready to send yet but when we are send straight away - iBonusDrip = ETrue; - - // remember this as a fail to measure - // let code beneath recycle packet - iFailedSend++; - } - } - -void CActiveStreamer::ConstructL(RSocketArray aSockets) - { - iTimer = CAdaptiveHighResPeriodic::NewL(*this); - - if (iDisplayMode & EStreamerInfoWindow) - { - iStreamingInfoConsole = Console::NewL(_L("Streamer"), KStreamerConsole); - } - - User::LeaveIfError(iRFs.Connect()); - - iSockets = aSockets; - - TPckgBuf mruBuf; - iSockets[0].GetOpt(EAvdtpMediaGetMaximumReceivePacketSize, KSolBtAVDTPMedia, mruBuf); - - // donate media socket to rtp - iSession.OpenL(iSockets[0], mruBuf()); - - // we get all RTP events in one place (could have them separately) - iSession.RegisterEventCallbackL(ERtpAnyEvent, - RTPCallbackL, - this); - - iSendSource = iSession.NewSendSourceL(); - - iSendSource.RegisterEventCallbackL(ERtpAnyEvent, - RTPCallbackL, - this); - - iStreamerUI = CStreamerUI::NewL((iDisplayMode & EPlaylistWindow), (iDisplayMode & EChunkyIconWindow)); - - TInt err = iRFs.GetDir(KSBCFiles, KEntryAttNormal, ESortByName, iFiles); - - // set playlist - for (TInt i=0; iCount(); i++) - { - iStreamerUI->AddTitle(iFiles->operator[](i).iName); - } - - err = aSockets[0].GetOpt(EAvdtpMediaGetMaximumPacketSize, KSolBtAVDTPMedia, iMTU); - - iSBCFrameBytesPerRTP = iMTU - 12 - 1; - iSendSource.SetDefaultPayloadSize(iSBCFrameBytesPerRTP+1); - - CreateBucketL(); - InitL(); - } - -void CActiveStreamer::CreateBucketL() - { - if (iSendPackets.Count() == KSendBucketSize) - { - RDebug::Printf("Bucket already created"); - } - else - { - RDebug::Printf("Creating bucket"); - // create all the RTP send packets now - for (TInt i=0; iiStreamingInfoConsole) - { - aStreamer->iStreamingInfoConsole->Printf(_L("\n**RTP SEND FAILURE**")); - } - break; - - case ERtpSendSucceeded: - aStreamer->iRTPCanSend = ETrue; - if (aStreamer->iBonusDrip) - { - aStreamer->Drip(); - aStreamer->iBonusDrip = EFalse; - } - break; - - case ERtpSourceFail: - if (aStreamer->iStreamingInfoConsole) - { - aStreamer->iStreamingInfoConsole->Printf(_L("\n**RTP SOURCE FAILURE**")); - } - break; - - - case ERtpNewSource: - if (aStreamer->iStreamingInfoConsole) - { - aStreamer->iStreamingInfoConsole->Printf(_L("\n**NEW SOURCE!\n")); - } - aStreamer->StartSinkL(); - break; - - case ERtpPacketReceived: - RRtpPacket packet = aStreamer->iReceiveSource.Packet(); - if (aStreamer->iStreamingInfoConsole) - { - aStreamer->iStreamingInfoConsole->Printf(_L("SNK Rxd packet ")); - aStreamer->iStreamingInfoConsole->Printf(_L("SeqNo %d\n"),packet.SequenceNumber()); - } - break; - } - } - -void CActiveStreamer::StartSinkL() - { - iReceiveSource = iSession.NewReceiveSourceL(); - iReceiveSource.RegisterEventCallbackL(ERtpAnyEvent, - RTPCallbackL, - this); - } - -TInt CActiveStreamer::LoadFile() - { - RDebug::Printf("Loading file"); - delete iFileBuf; - iFileBuf = NULL; - - TInt err = KErrNone; - - if (iPreloadFile) - { - if (iStreamingInfoConsole) - { - iStreamingInfoConsole->Printf(_L("Preloading SBC file\n")); - } - - // max heap is something or other - const TInt KMaxHeap = 4000000; - TInt size = iFileSize; - size = Min(iFileSize, KMaxHeap); - TRAP(err, iFileBuf = HBufC8::NewL(size)); - if (err) - { - return err; - } - iFileSize = Min(KMaxHeap, iFileSize); - - TPtr8 ptr(const_cast(iFileBuf->Des().Ptr()), 0, iFileSize); - - const TEntry& entry = iFiles->operator[](iCurrentFile); - RFile test; - test.Open(iRFs, entry.iName, EFileRead); - - ptr.Zero(); - err=iFile.Read(ptr); - } - else - { - if (iStreamingInfoConsole) - { - iStreamingInfoConsole->Printf(_L("Streaming from file\n")); - } - - // read from file to be more "streaming"-like - TRAP(err, iFileBuf = HBufC8::NewL(Min(iFileSize, iSBCFrameBytesPerRTP))); - } - return err; - } - -void CActiveStreamer::Faster() - { - // limit the speed - if (iSbcFrameRate < 5) - { - iSbcFrameRate++; - } - } - -void CActiveStreamer::Slower() - { - if (iSbcFrameRate > 1) - { - iSbcFrameRate--; - } - } - -void CActiveStreamer::Backward() - { - iDirectionForward=EFalse; - } - -void CActiveStreamer::Forward() - { - iDirectionForward=ETrue; - } - -void CActiveStreamer::CheckJammed() - { - if (iFillLevel==iPreviousFillLevel) - { - if ((iBucketAppearsJammed++ > 500) && iStreamingInfoConsole) - { - iStreamingInfoConsole->Printf(_L("BUCKET JAMMED\n")); - iStreamingInfoConsole->Printf(_L("iFillLevel %d "),iFillLevel); - iStreamingInfoConsole->Printf(_L("iRTPCanSend %d "),iRTPCanSend); - iStreamingInfoConsole->Printf(_L("iFailedSend %d "),iFailedSend); - iStreamingInfoConsole->Printf(_L("iPos %d "),iPos); - - TTime now; - now.UniversalTime(); - - TInt millisecs = now.MicroSecondsFrom(iLastPacketSentTime).Int64()/1000; - iStreamingInfoConsole->Printf(_L("time since last send %d ms "),millisecs); - } - } - else - { - iBucketAppearsJammed = 0; - } - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcStreamer.h --- a/bluetooth/gavdp/test/tavsrcStreamer.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,193 +0,0 @@ -// 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: -// - -#ifndef TAVSRCSTREAMER_H -#define TAVSRCSTREAMER_H - -#include "tavsrc.h" -#include "tavsrcTimer.h" -#include "tavsrcStreamerUser.h" - -#include -#include - -static const TInt KLowTidemark = 2; -static const TInt KSendBucketSize = 2; - -#ifdef __WINS__ -_LIT(KSBCFileRoot, "c:\\"); -_LIT(KSBCFiles, "c:\\*.sbc"); -#else -//For reference boards, use the MMC drive, because C: is formatted every reboot -_LIT(KSBCFileRoot, "e:\\"); -_LIT(KSBCFiles, "e:\\*.sbc"); -#endif - -class CProgressBar; -class CStreamerUI; -class CActiveSockWriter; -class CActiveSockReader; - -class TSbcTrackFrameInfo - { -public: - TInt iFrameSize; - TUint iFrameCount; - }; - -// used to keep track of the sizes of the SBC frames to allow going backwards through -// an SBC file on a frame by frame basis. This is require to support VBR where the -// frame sizes can change for a single track. -class CSbcTrackInfo : public CBase - { -public: - ~CSbcTrackInfo(); - - TInt GetLastFrameSize(); - TInt AddNewFrame(TInt aFrameSize); - TInt RemoveLastFrame(); - void Reset(); - -private: - RArray iFrameInfo; - }; - -class CActiveStreamer : public CBase, private MAdaptiveHighResPeriodicClient - { -public: - static CActiveStreamer* NewL(RSocketArray aSockets, - CConsoleBase& aConsole, - MActiveStreamerUser& aUser, - TUint aDisplayMode, - TBool aPreloadFile); - - ~CActiveStreamer(); - - static void RTPCallbackL(CActiveStreamer* aStreamer, const TRtpEvent& aEvent); - - // streamer operations - void Stream(TBool aIsSink); - void Suspend(); - void ReStream(); - void Stop(); - void Pause(); - void Faster(); - void Slower(); - void Backward(); - void Forward(); - void NextTrack(); - void PrevTrack(); - -private: - enum TDisplayMode - { - EStatusCommandWindows = 0x00, - EStreamerInfoWindow = 0x01, - EProgressBarWindow = 0x02, - EPlaylistWindow = 0x04, - EChunkyIconWindow = 0x08, - }; - -private: - CActiveStreamer(CConsoleBase& aConsole, MActiveStreamerUser& aUser, TUint aDisplayMode, TBool aPreloadFile); - - void TimerEvent(CAdaptiveHighResPeriodic& aTimer); - void TimerError(CAdaptiveHighResPeriodic& aTimer, TInt aError); - void StartSinkL(); - - void ConstructL(RSocketArray aSockets); - TInt LoadFile(); - void DoTimerEvent(); - void DestroyBucket(); - void InitL(); - - void CreateBucketL(); - void FillBucket(); - void Drip(); - void DrawBucket(); - void CheckJammed(); - - void UpdateFrameInfo(); - -private: - CConsoleBase& iConsole; - TInt iProgressBarPos; - CProgressBar* iProgressBar; - CStreamerUI* iStreamerUI; - CConsoleBase* iStreamingInfoConsole; - CAdaptiveHighResPeriodic* iTimer; - - RFile iFile; - RFs iRFs; - CDir* iFiles; - TInt iCurrentFile; - RSocketArray iSockets; - TInt iMTU; - TInt iFileSize; - TTime iStartTime; - - RRtpSession iSession; - RRtpSendSource iSendSource; - RRtpReceiveSource iReceiveSource; - - RArray iSendPackets; // used like a queue sometimes - TRtpEventType iEventType; - TBool iRTPCanSend; - - TInt iSBCFrameBytesPerRTP; - TInt iSBCFrameSize; - TInt iSBCFrameInterval; - TInt iNumSBCFramesInRTP; - TInt iSBCBitrate; - TInt iSendClockInterval; // microsecs - TInt iNominalSendClockInterval;// microsecs - TBool iBonusDrip; - TTime iStartedTime; // for "absolute" timing style - - // checking for jammed streamer, and leaky mbufs - TInt iBucketAppearsJammed; - TBool iBucketJammed; - TTime iLastPacketSentTime; - TInt iPreviousFillLevel; - - TInt iPos; - TInt iFailedSend; - TInt iSent; - TInt iFillLevel; - - HBufC8* iFileBuf; - - // current SEP configuration - TInt iNumChannels; - TInt iChMode; - TInt iNumSubbands; - TInt iBlkLen; - TInt iBitPool; - TInt iFreq; - TInt iAllocMethod; - - MActiveStreamerUser& iUser; - - TUint iDisplayMode; - TBool iPreloadFile; - - CSbcTrackInfo iSbcTrackInfo; - - TInt iSbcFrameRate; - - TBool iDirectionForward; - }; - -#endif // TAVSRCSTREAMER_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcStreamerUser.h --- a/bluetooth/gavdp/test/tavsrcStreamerUser.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -// 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: -// - -#ifndef TAVSRCSTREAMERUSER_H -#define TAVSRCSTREAMERUSER_H - -#include - -// used to notify changes to the configuration of the media being streamed -class MActiveStreamerUser - { -public: - virtual void MediaCodecConfigurationRequired(TSBCCodecCapabilities& aConfig)=0; - }; - -#endif // TAVSRCSTREAMERUSER_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcTimer.cpp --- a/bluetooth/gavdp/test/tavsrcTimer.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -// 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: -// - -#include -#include - -#include "tavsrcTimer.h" -#include "tavsrc.h" - -static const TUint KMillion = 1000000; - -CAdaptiveHighResPeriodic* CAdaptiveHighResPeriodic::NewL(MAdaptiveHighResPeriodicClient& aClient) - { - CAdaptiveHighResPeriodic* p = new (ELeave) CAdaptiveHighResPeriodic(aClient); - CleanupStack::PushL(p); - p->ConstructL(); - CleanupStack::Pop(p); - return p; - } - -CAdaptiveHighResPeriodic::~CAdaptiveHighResPeriodic() - { - Cancel(); - } - -CAdaptiveHighResPeriodic::CAdaptiveHighResPeriodic(MAdaptiveHighResPeriodicClient& aClient) -: CTimer(EPriorityStandard+1), iClient(aClient) - { - CActiveScheduler::Add(this); - } - -void CAdaptiveHighResPeriodic::ConstructL() - { - CTimer::ConstructL(); - - HAL::Get(HALData::EFastCounterFrequency, iFastCounterFreq); - HAL::Get(HALData::EFastCounterCountsUp, iFastCounterIncreases); - - RDebug::Printf("Timer HAL: FC Freq %d", iFastCounterFreq); - - if (iFastCounterIncreases) - { - RDebug::Printf("Timer HAL: FC increases"); - } - else - { - RDebug::Printf("Timer HAL: FC decreases"); - } - - iFastCounterFreqUs = (TReal)iFastCounterFreq / KMillion; - } - - -void CAdaptiveHighResPeriodic::Start(TTimeIntervalMicroSeconds32 aInterval) - { - RDebug::Printf("*** Start Timer"); - iInterval = aInterval; - - // calculate the number of fast counter ticks for the interval - TReal intervalInCounts = iInterval.Int()*iFastCounterFreqUs; - TInt countChangeExpected = (TInt) intervalInCounts; - - // store any extra fractions of fast counter ticks - iExtraCounts = intervalInCounts - countChangeExpected; - - iIntendedCountOnCallback = iFastCounterIncreases - ? User::FastCounter() + countChangeExpected - : User::FastCounter() - countChangeExpected; - - StartTimer(aInterval); - } - -void CAdaptiveHighResPeriodic::RunL() - { - User::LeaveIfError(iStatus.Int()); - iClient.TimerEvent(*this); - - if (!IsActive()) - { - TUint endCount = User::FastCounter(); - - // are we fast or slow? positive = late, negative = early - TInt varianceCount = iFastCounterIncreases - ? (TInt)((endCount - iIntendedCountOnCallback)) - : (TInt)((iIntendedCountOnCallback - endCount)); - - // convert count to microsecs - TInt varianceUs = varianceCount/iFastCounterFreqUs; - - TInt nextInterval = iInterval.Int() - varianceUs; // in musecs - - if (nextInterval < 0) - { - nextInterval = 0; - } - - // calculate the number of fast counter ticks for the interval - TReal intervalInCounts = nextInterval*iFastCounterFreqUs; - TInt countChangeExpected = (TInt) intervalInCounts; - - // update extra fractions of fast counter ticks - iExtraCounts += intervalInCounts - countChangeExpected; - - if (iExtraCounts >= 1) - { - // we have more than a whole tick, do the adjustment - countChangeExpected++; - iExtraCounts--; - nextInterval = countChangeExpected/iFastCounterFreqUs; - } - - iIntendedCountOnCallback = iFastCounterIncreases - ? User::FastCounter() + countChangeExpected - : User::FastCounter() - countChangeExpected; - - StartTimer(nextInterval); - } - } - -TInt CAdaptiveHighResPeriodic::RunError(TInt aError) - { - iClient.TimerError(*this, aError); - return KErrNone; - } - -void CAdaptiveHighResPeriodic::SetInterval(TTimeIntervalMicroSeconds32 aInterval) - { - iInterval = aInterval; - } - -void CAdaptiveHighResPeriodic::StartTimer(TTimeIntervalMicroSeconds32 aInterval) - { - HighRes(aInterval); - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcTimer.h --- a/bluetooth/gavdp/test/tavsrcTimer.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -// 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: -// - -#ifndef TAVSRCTIMER_H -#define TAVSRCTIMER_H - -#include - -class CAdaptiveHighResPeriodic; - -class MAdaptiveHighResPeriodicClient - { -public: - virtual void TimerEvent(CAdaptiveHighResPeriodic& aTimer)=0; - virtual void TimerError(CAdaptiveHighResPeriodic& aTimer, TInt aError)=0; - }; - -//adapts the callback to counter drift -class CAdaptiveHighResPeriodic : public CTimer - { -public: - static CAdaptiveHighResPeriodic* NewL(MAdaptiveHighResPeriodicClient& aClient); - ~CAdaptiveHighResPeriodic(); - void Start(TTimeIntervalMicroSeconds32 aPeriod); - - void SetInterval(TTimeIntervalMicroSeconds32 aInterval); - -private: - CAdaptiveHighResPeriodic(MAdaptiveHighResPeriodicClient& aClient); - void ConstructL(); - void RunL(); - TInt RunError(TInt aError); - void StartTimer(TTimeIntervalMicroSeconds32 aInterval); - -private: - MAdaptiveHighResPeriodicClient& iClient; - - // HAL stuff - TBool iFastCounterIncreases; - TInt iFastCounterFreq; - TReal iFastCounterFreqUs; - TReal iExtraCounts; - - // what the client asked for in musecs - TTimeIntervalMicroSeconds32 iInterval; - - TUint iIntendedCountOnCallback ; // the hoped for fast counter reading on callback - }; - -#endif // TAVSRCTIMER_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcUI.cpp --- a/bluetooth/gavdp/test/tavsrcUI.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -// 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: -// - -#include "tavsrcUI.h" - -// -// class CStreamerUI -// -CStreamerUI* CStreamerUI::NewL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon) - { - CStreamerUI* ui = new (ELeave) CStreamerUI (); - CleanupStack::PushL(ui); - ui->ConstructL(aDisplayPlaylist, aDisplayChunkyIcon); - CleanupStack::Pop(ui); - return ui; - } - -CStreamerUI::CStreamerUI() - { - } - -void CStreamerUI::ConstructL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon) - { - if (aDisplayChunkyIcon) - { - iIconConsole = Console::NewL(_L("Icon"), TSize(-1,-1)); - } - - if (aDisplayPlaylist) - { - iPlayListConsole = Console::NewL(_L("Play List"), TSize(-1,-1)); - } - } - -CStreamerUI::~CStreamerUI() - { - delete iIconConsole; - iIconConsole = NULL; - delete iPlayListConsole; - iPlayListConsole = NULL; - } - -void CStreamerUI::Play() - { - if (iIconConsole) - { - TBuf line; - - iIconConsole->ClearScreen(); - - for (TInt len=1; len<=KIconSize/2; len++) - { - line.AppendFill('*',len*2); - iIconConsole->SetPos(KIconIndent,len); - iIconConsole->Printf(line); - iIconConsole->SetPos(KIconIndent,KIconSize-len); - iIconConsole->Printf(line); - line.Zero(); - } - } - DrawPointer(); - } - -void CStreamerUI::Pause() - { - if (iIconConsole) - { - TBuf line; - - iIconConsole->ClearScreen(); - line.AppendFill('*',KIconSize/3); - line.AppendFill(' ',KIconSize/3); - line.AppendFill('*',KIconSize/3); - - for (TInt len=1; len<=KIconSize; len++) - { - iIconConsole->SetPos(KIconIndent,len); - iIconConsole->Printf(line); - } - } - } - -void CStreamerUI::Stop() - { - if (iIconConsole) - { - TBuf line; - - iIconConsole->ClearScreen(); - line.AppendFill('*',KIconSize); - - for (TInt len=1; len<=KIconSize; len++) - { - iIconConsole->SetPos(KIconIndent,len); - iIconConsole->Printf(line); - } - } - } - -void CStreamerUI::AddTitle(const TDesC& aTitle) - { - if (iPlayListConsole) - { - iPlayListConsole->SetPos(KPlayListX+2); - iPlayListConsole->Printf(_L("%S\n"), &aTitle); - } - } - -void CStreamerUI::Next() - { - ClearPointer(); - ++iPlayListY; - DrawPointer(); - } - -void CStreamerUI::Prev() - { - ClearPointer(); - --iPlayListY; - DrawPointer(); - } - -void CStreamerUI::First() - { - ClearPointer(); - iPlayListY = 0; - DrawPointer(); - } - -void CStreamerUI::ClearPointer() - { - if (iPlayListConsole) - { - iPlayListConsole->SetPos(KPlayListX, iPlayListY); - iPlayListConsole->Printf(_L(" ")); - } - } - -void CStreamerUI::DrawPointer() - { - if (iPlayListConsole) - { - iPlayListConsole->SetPos(KPlayListX, iPlayListY); - iPlayListConsole->Printf(_L(">")); - } - } - -static const TInt KProgressBarSize = 70; - -// -// class CProgressBar -// -CProgressBar::CProgressBar(TInt aMaximum) : iMax(aMaximum) - { - } - -CProgressBar::~CProgressBar() - { - delete iConsole; - } - -CProgressBar* CProgressBar::NewL(TInt aMaximum) - { - CProgressBar* p = new (ELeave) CProgressBar(aMaximum); - CleanupStack::PushL(p); - p->ConstructL(); - CleanupStack::Pop(p); - return p; - } - -void CProgressBar::Increment(TInt aStep) - { - iValue+=aStep; - if (iValue < 0) - { - iValue = 0; - } -#ifdef __WINS__ - Redraw(); -#endif - } - -void CProgressBar::ConstructL() - { -#ifdef __WINS__ - iConsole = Console::NewL(_L("Progress"), TSize(KProgressBarSize+5,1)); - Redraw(); -#endif - } - -void CProgressBar::Redraw() - { - iConsole->SetPos(0); - - TBuf bar; - TInt numDone = ((iValue*KProgressBarSize) /iMax); - TInt numToDo = 0; - - if (numDonePrintf(bar); - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcUI.h --- a/bluetooth/gavdp/test/tavsrcUI.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -// 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: -// - -#ifndef TAVSRCUI_H -#define TAVSRCUI_H - -#include -#include - -static const TUint KIconSize = 36; -static const TUint KIconIndent = 36; -static const TUint KPlayListX = 2; - -class CStreamerUI : public CBase - { -public: - static CStreamerUI* NewL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon); - ~CStreamerUI(); - void Play(); - void Pause(); - void Stop(); - void AddTitle(const TDesC& aTitle); - void Next(); - void Prev(); - void First(); - -private: - CStreamerUI(); - void ConstructL(TBool aDisplayPlaylist, TBool aDisplayChunkyIcon); - void ClearPointer(); - void DrawPointer(); - -private: - CConsoleBase* iIconConsole; - CConsoleBase* iPlayListConsole; - TInt iPlayListY; - }; - -class CProgressBar : public CBase - { -public: - static CProgressBar* NewL(TInt aMaximum); - void Increment(TInt aStep); - ~CProgressBar(); - -private: - CProgressBar(TInt aMaximum); - void ConstructL(); - void Redraw(); - -private: - TInt iMax; - TInt iValue; - CConsoleBase* iConsole; - }; - -#endif // TAVSRCUI_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcUtils.cpp --- a/bluetooth/gavdp/test/tavsrcUtils.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,394 +0,0 @@ -// 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: -// - -#include "tavsrcUtils.h" -#include "tavsrcConsole.h" - -#include -#include - -#include -#include - -void TTavsrcUtils::RegisterSinkSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle, - TBool aHeadphone, TBool aSpeaker, TBool aRecorder, - TBool aAmp) - { - CSdpAttrValue* attrVal = 0; - CSdpAttrValueDES* attrValDES = 0; - - // Set Attr 1 (service class list) to list with UUID = Audio Sink - aDB.CreateServiceRecordL(TUUID(KAudioSinkUUID), aRecHandle); - - // Protocol Descriptor List - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP - ->BuildUintL(TSdpIntBuf(KAVDTP)) // PSM = AVDTP - ->EndListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID - ->BuildUintL(TSdpIntBuf(0x0100)) // Version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - //BrowseGroupList - /* - This has been added in order to be interoperable with remote devices which only look for the - service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature. - */ - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root) - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5 - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = NULL; - - // Language - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUintL(TSdpIntBuf(KLanguageEnglish)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdCharacterEncodingUTF8)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdBasePrimaryLanguage)) - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - // BT Profile Description - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(KAdvancedAudioDistributionUUID) - ->BuildUintL(TSdpIntBuf(0x0100)) // version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES); - - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - // provider name - attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service name - attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution sink")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service description - attrVal = CSdpAttrValueString::NewStringL(_L8("kick back and listen to some fine tunes with this neat service")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // supported features - TUint16 supportedFeatures = aHeadphone ? 1:0; - supportedFeatures|=aSpeaker ? 2:0; - supportedFeatures|=aRecorder ? 4:0; - supportedFeatures|=aAmp ? 8:0; - attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf(supportedFeatures)); - CleanupStack::PushL(attrVal); - - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdSupportedFeatures, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - } - -void TTavsrcUtils::RegisterSourceSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle, - TBool aPlayer, TBool aMic, TBool aTuner, TBool aMixer) - { - CSdpAttrValue* attrVal = 0; - CSdpAttrValueDES* attrValDES = 0; - - // Set Attr 1 (service class list) to list with UUID = Audio Sink - aDB.CreateServiceRecordL(TUUID(KAudioSourceUUID), aRecHandle); - - // Protocol Descriptor List - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KL2CAPUUID))) // L2CAP - ->BuildUintL(TSdpIntBuf(KAVDTP)) // PSM = AVDTP - ->EndListL() - ->BuildDESL() - ->StartListL() - ->BuildUUIDL(TUUID(TUint16(KAvdtpUUID))) // Avdtp UUID - ->BuildUintL(TSdpIntBuf(0x0100)) // Version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - //BrowseGroupList - /* - This has been added in order to be interoperable with remote devices which only look for the - service in the PublicBrowseGroup (the root of the browse hierarchy). This is not a mandatory feature. - */ - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUUIDL(TUUID(TUint16(KPublicBrowseGroupUUID))) // Public browse group (the root) - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBrowseGroupList, *attrValDES); //attribute 5 - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = NULL; - - // Language - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildUintL(TSdpIntBuf(KLanguageEnglish)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdCharacterEncodingUTF8)) - ->BuildUintL(TSdpIntBuf(KSdpAttrIdBasePrimaryLanguage)) - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdLanguageBaseAttributeIDList, *attrValDES); - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - // BT Profile Description - attrValDES = CSdpAttrValueDES::NewDESL(0); - CleanupStack::PushL(attrValDES); - - attrValDES->StartListL() - ->BuildDESL()->StartListL() - ->BuildUUIDL(KAdvancedAudioDistributionUUID) - ->BuildUintL(TSdpIntBuf(0x0100)) // version - ->EndListL() - ->EndListL(); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBluetoothProfileDescriptorList, *attrValDES); - - CleanupStack::PopAndDestroy(attrValDES); - attrValDES = 0; - - // provider name - attrVal = CSdpAttrValueString::NewStringL(_L8("Symbian Software Ltd")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetProviderName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service name - attrVal = CSdpAttrValueString::NewStringL(_L8("Advanced audio distribution source")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceName, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // service description - attrVal = CSdpAttrValueString::NewStringL(_L8("plug your wireless cans into me!")); - CleanupStack::PushL(attrVal); - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdBasePrimaryLanguage + KSdpAttrIdOffsetServiceDescription, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - - // supported features - TUint16 supportedFeatures = aPlayer ? 1:0; - supportedFeatures|=aMic ? 2:0; - supportedFeatures|=aTuner ? 4:0; - supportedFeatures|=aMixer ? 8:0; - attrVal = CSdpAttrValueUint::NewUintL(TSdpIntBuf(supportedFeatures)); - CleanupStack::PushL(attrVal); - - aDB.UpdateAttributeL(aRecHandle, KSdpAttrIdSupportedFeatures, *attrVal); - CleanupStack::PopAndDestroy(attrVal); - attrVal = 0; - } - -TInt TTavsrcUtils::GetIntFromUser(CConsoleBase& aConsole) - { - TBuf<4> inpb; - aConsole.Printf(_L(":")); - TInt x = aConsole.WhereX(); - TInt y = aConsole.WhereY(); - TRequestStatus stat; - - TChar ch(0); // set it to anything to prevent warning - while ((ch!='\n')&&(ch!='\r') && inpb.Length()==0) - { - aConsole.Read(stat); - User::WaitForRequest(stat); - ch = aConsole.KeyCode(); - - if ((ch=='\b') && (inpb.Length()>0)) - { - inpb.Delete(inpb.Length()-1,1); - } - - if ((inpb.Length()<4)&&((ch>='0')&&(ch<='9'))) - { - inpb.Append(ch); - } - - aConsole.SetPos(x,y); - aConsole.Printf(_L("%S"),&inpb); - } - - TLex lex(inpb); - TInt res; - return (lex.Val(res)==KErrNone) ? res : 0; - } - -TBool TTavsrcUtils::GetYNFromUser(CConsoleBase& aConsole, const TDesC& aDes) - { - TBuf<4> inpb; - aConsole.Printf(_L("%S (y/n):"),&aDes); - TRequestStatus stat; - - TChar ch(0); // set it to anything to prevent warning - while ((ch!='n')&&(ch!='y')) - { - aConsole.Read(stat); - User::WaitForRequest(stat); - ch = aConsole.KeyCode(); - } - aConsole.Printf(_L("%c"), static_cast(ch)); - return (ch=='y') ? ETrue : EFalse; - } - -void TTavsrcUtils::GetDeviceAddressL(TBTDevAddr& aAddr) - { - //Ask user which device address we should connect to... - RNotifier notify; - User::LeaveIfError(notify.Connect()); - TBTDeviceSelectionParamsPckg pckg; - TBTDeviceResponseParamsPckg resPckg; - TRequestStatus stat; - notify.StartNotifierAndGetResponse(stat, KDeviceSelectionNotifierUid, pckg, resPckg); - User::WaitForRequest(stat); - notify.CancelNotifier(KDeviceSelectionNotifierUid); - notify.Close(); - User::LeaveIfError(stat.Int()); - - aAddr = resPckg().BDAddr(); - } - -TInt TTavsrcUtils::GetCodecSettingsFromSBCFile(RFile& aFile, TInt aPos, TInt& aChannelMode, - TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen, - TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod) - { - TInt err = KErrNone; - - TBuf8<4> header; - aFile.Read(aPos, header); - TInt syncWord = header[0]; - __ASSERT_ALWAYS(syncWord==0x9C, User::Invariant()); - - TInt sampleFreq = (header[1]&0xC0)>>6; - TInt blockLen = (header[1]&0x30)>>4; - aChannelMode = (header[1]&0x0C)>>2; - aAllocMethod = (header[1]&0x02)>>1; - TInt subBands = (header[1]&0x01); - aBitPool = header[2]; - - aNumChannels = (aChannelMode==0) ? 1 : 2; - aNumSubbands = (subBands==1) ? 8 : 4; - - switch (sampleFreq) - { - case 0x00: - aFreq = 16000; - break; - case 0x01: - aFreq = 32000; - break; - case 0x02: - aFreq = 44100; - break; - case 0x03: - aFreq = 48000; - break; - } - - switch (blockLen) - { - case 0x00: - aBlkLen = 4; - break; - case 0x01: - aBlkLen = 8; - break; - case 0x02: - aBlkLen = 12; - break; - case 0x03: - aBlkLen = 16; - break; - } - - return err; - } - -TInt TTavsrcUtils::GetCodecSettingsFromSBCFile(const TDesC& aFileName, TInt& aChannelMode, - TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen, - TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod) - { - TInt err = KErrNone; - - RFs fileserver; - RFile file; - - err = fileserver.Connect(); - if (!err) - { - err = file.Open(fileserver,aFileName,EFileRead | EFileShareReadersOnly); - } - if (err) - { - return err; - } - - err = GetCodecSettingsFromSBCFile(file, 0, aChannelMode, aNumChannels, aNumSubbands, - aBlkLen, aBitPool, aFreq, aAllocMethod); - file.Close(); - fileserver.Close(); - - return err; - } - -TInt TTavsrcUtils::CEIL(TReal aX) - { - TReal frac; - Math::Frac(frac,aX); - return (frac < 0.5) ? aX :aX+1; - } diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcUtils.h --- a/bluetooth/gavdp/test/tavsrcUtils.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -// 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: -// - -#ifndef TAVSRCUTILS_H -#define TAVSRCUTILS_H - -#include -#include -#include - -class TTavsrcUtils - { -public: - // SDP helper functions - static void RegisterSinkSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle, - TBool aHeadphone, TBool aSpeaker,TBool aRecorder,TBool aAmp); - static void RegisterSourceSDPRecordL(RSdpDatabase& aDB, TSdpServRecordHandle& aRecHandle, - TBool aPlayer, TBool aMic, TBool aTuner, TBool aMixer); - - // User input helper functions - static TInt GetIntFromUser(CConsoleBase& aConsole); - static TBool GetYNFromUser(CConsoleBase& aConsole, const TDesC& aDes); - - static void GetDeviceAddressL(TBTDevAddr& aAddr); - - static TInt GetCodecSettingsFromSBCFile(RFile& aFile, TInt aPos, TInt& aChannelMode, - TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen, - TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod); - - static TInt GetCodecSettingsFromSBCFile(const TDesC& aFileName, TInt& aChannelMode, - TInt& aNumChannels, TInt& aNumSubbands, TInt& aBlkLen, - TInt& aBitPool, TInt& aFreq, TInt& aAllocMethod); - - static TInt CEIL(TReal aX); - }; - -#endif // TAVSRCUTILS_H - diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcmtupdaterdatabaseaware.cpp --- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseaware.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,981 +0,0 @@ -// 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: -// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "browsingframe.h" - -#include "tavsrc.h" -#include "tavsrcmtupdaterdatabaseaware.h" -#include "activecallbackconsole.h" - -#ifdef __WINS__ -GLDEF_D TSize gUpdaterConsole(75,30); -GLDEF_D TSize gBrowseConsole(75,30); -#else -GLDEF_D TSize gUpdaterConsole(KConsFullScreen,KConsFullScreen); -GLDEF_D TSize gBrowseConsole(KConsFullScreen,KConsFullScreen); -#endif - - -#define BROWSE_CONSOLE iMtBrowseConsole - -const TRemConItemUid KUidMarker = 0xc0ffeeee00000000ull; -const TRemConItemUid KFolderMarker = 0x0000000100000000ull; -const TInt KNumberFolderItemsInFolder = 1; -const TInt KNumberMediaItemsInFolder = 1502; -const TInt KNumberItemsInFolder = KNumberMediaItemsInFolder + KNumberFolderItemsInFolder; -const TInt KMaxFolderDepth = 10; - -_LIT8(KFolderName, "Folder%08x"); - -CTavsrcMtUpdater* CTavsrcMtUpdater::NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces) - { - CTavsrcMtUpdater* mt = new(ELeave)CTavsrcMtUpdater(); - CleanupStack::PushL(mt); - mt->ConstructL(aIfSel, aRemConInterfaces); - CleanupStack::Pop(); - return mt; - } - -struct TMediaBrowseThreadParams - { - CRemConInterfaceSelector* iIfSel; - CTavsrcMtUpdater* iUpdater; - }; - -TInt CTavsrcMtUpdater::MediaBrowseThread(TAny* aPtr) - { - TMediaBrowseThreadParams* params = reinterpret_cast(aPtr); - - CTrapCleanup* cleanupStack = CTrapCleanup::New(); - CActiveScheduler* activescheduler = new CActiveScheduler; - CActiveScheduler::Install(activescheduler); - - TInt err = KErrNoMemory; - if(cleanupStack && activescheduler) - { - CTavsrcMtUpdater* self = params->iUpdater; - TRAP(err, self->BrowseSetupL(*(params->iIfSel))) - RThread().Rendezvous(err); - if(err == KErrNone) - { - CActiveScheduler::Start(); - } - self->BrowseCleanup(); - } - - delete activescheduler; - delete cleanupStack; - - return err; - } - -void CTavsrcMtUpdater::BrowseSetupL(CRemConInterfaceSelector& aIfSel) - { - iMtBrowseConsole = CActiveCallBackConsole::NewL(BrowseKeyPressed, this, _L("MtBrowse"),gBrowseConsole); - BrowseMenu(); - - iMtBrowseStopper = CStopBrowseWatcher::NewL(); - iMediaBrowse = CRemConDatabaseAwareMediaBrowseTarget::NewL(aIfSel, - *this, *this, EFalse, iMediaBrowseInterface, - iNowPlayingBrowseInterface, - iUidCounter); - iMtBrowseStopper->Start(); - } - -void CTavsrcMtUpdater::BrowseCleanup() - { - delete iMtBrowseStopper; iMtBrowseStopper = NULL; - delete iMtBrowseConsole; iMtBrowseConsole = NULL; - } - - -void CTavsrcMtUpdater::ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces) - { - if (aRemConInterfaces & EPlayerInformation) - { - iPlayerInformation = CPlayerInfoTarget::NewL(aIfSel, - iPlayerCapabilitiesObserver, - iPlayerApplicationSettingsObserver, - iPlayerEventsObserver, - *this); - } - - if (aRemConInterfaces & ENowPlaying) - { - iNowPlaying = CRemConDatabaseAwareNowPlayingTarget::NewL(aIfSel, *this); - } - - if (aRemConInterfaces & EMediaBrowse) - { - // Create media browse thread (and wait until it is running)... - TMediaBrowseThreadParams params; - params.iIfSel = &aIfSel; - params.iUpdater = this; - TRequestStatus status; - User::LeaveIfError(iMediaBrowseThread.Create(KNullDesC, CTavsrcMtUpdater::MediaBrowseThread, KDefaultStackSize, NULL, ¶ms)); - iMediaBrowseThread.Rendezvous(status); - iMediaBrowseThread.Resume(); - User::WaitForRequest(status); - User::LeaveIfError(status.Int()); - iMediaBrowseThreadOpen = ETrue; - } - - iMtUpdaterConsole = CActiveConsole::NewL(*this,_L("MtUpdater"),gUpdaterConsole); - - - // configure the PlayerInformation from resource file - ReadAVRCPSettingsFile(KAVRCPSettingsResourceFilename); - - // We don't need to call AddEvent() for PlaybackStatusChanged or TrackChanged - // since these are mandatory events which must be supported. A KErrAlreadyExists - // error is returned if these are called from here. - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackStatusChanged); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackChanged); - - // configure the interface with the events supported by tavsrc - // This cannot fail as we constructed the iNotificationEvents array to have a granularity sufficient to - // contain all events without having to grow - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedEnd)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedEnd); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedStart)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedStart); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlaybackPosChanged)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationBatteryStatusChanged)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationBatteryStatusChanged); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlayerApplicationSettingChanged)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlayerApplicationSettingChanged); - - // save a Company ID - iPlayerCapabilitiesObserver->AddCompanyId(0x4321); - iCompanyIds.InsertInOrderL(0x4321); - - // set the player events to some test values - iPlayerEventsObserver->TrackReachedEnd(); - - // playing 12, which is 2:30 long with a low battery - iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EStopped); - iPlaybackStatus = MPlayerEventsObserver::EStopped; - - iPlayerEventsObserver->TrackChanged(12, 150*1000); - iLength = 150*1000; - - iPlayerEventsObserver->SetBatteryStatus(MPlayerEventsObserver::ECritical); - iBatteryStatus = MPlayerEventsObserver::ECritical; - - // current position is 1 minute 10 secs though track 12 - iPlayerEventsObserver->SetPlaybackPosition(70000); - iPosition = 70000; - - _LIT_SECURITY_POLICY_PASS(KPassPolicy); - TInt err = RProperty::Define(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProperty::EInt, KPassPolicy, KPassPolicy); - if(err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - - MtMenu(); - } - -CTavsrcMtUpdater::CTavsrcMtUpdater() - : iNotificationEvents(ERegisterNotificationReservedLast), - iUidCounter(1) - { - } - -CTavsrcMtUpdater::~CTavsrcMtUpdater() - { - delete iMtUpdaterConsole; - iNotificationEvents.Close(); - iCompanyIds.Close(); - if(iMediaBrowseThreadOpen) - { - TRequestStatus status; - iMediaBrowseThread.Logon(status); - iMtBrowseStopper->Complete(); - User::WaitForRequest(status); - // the browse thread should not be running now. - } - iMediaBrowseThread.Close(); - } - -void CTavsrcMtUpdater::ReadAVRCPSettingsFile(const TDesC& aResourceFileName) -/** - - Creates the resource reader. - - Reads the default policy evaluator and dialog creator UIDs. - - Reads the number of policies in the resource file. - -@param aRFs The file server session used by the resource parser. -@param aResourceFileName The name of the AVRCP settings file to read. -*/ - { - RFs rfs; - rfs.Connect(); - RFile r; - User::LeaveIfError(r.Open(rfs, aResourceFileName, EFileRead | EFileShareReadersOnly)); - CleanupClosePushL(r); - TInt size; - User::LeaveIfError(r.Size(size)); - CleanupStack::PopAndDestroy(&r); - - CResourceFile* resourceFile = CResourceFile::NewLC(rfs, aResourceFileName, 0, size); - PlayerApplicationSettingsResourceInit::DefineAttributesL(*iPlayerApplicationSettingsObserver, *resourceFile); - CleanupStack::PopAndDestroy(resourceFile); - } - -void CTavsrcMtUpdater::KeyPressed(TChar aKey) - { - - switch(aKey) - { - case 'e': - { - AddEvent(ERegisterNotificationPlaybackPosChanged); - iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged); - iMtUpdaterConsole->Console().Printf(_L("Add event EPlaybackPosChanged\n")); - break; - } - case 'c': - { - AddCompanyId(0x5678); - (void)iCompanyIds.InsertInOrder(0x5678); - iMtUpdaterConsole->Console().Printf(_L("Add CompanyId 0x5678\n")); - break; - } - case '1': - { - PlackbackStatusChanged(NextPlaybackStatus()); - iMtUpdaterConsole->Console().Printf(_L("Playback status changed %d\n"),iPlaybackStatus); - break; - } - case '2': - { - TrackChanged(++iIndex, KDefaultLength); - iMtUpdaterConsole->Console().Printf(_L("Track changed\n")); - break; - } - case '3': - { - TrackReachedEnd(); - iMtUpdaterConsole->Console().Printf(_L("Track reached end\n")); - break; - } - case '4': - { - TrackReachedStart(); - iMtUpdaterConsole->Console().Printf(_L("Track reached end\n")); - break; - } - case '5': - { - iPosition += KPositionIncrement; - SetPlaybackPosition(iPosition); - iMtUpdaterConsole->Console().Printf(_L("Position %d\n"),iPosition ); - break; - case '6': - { - SetBatteryStatus(NextBatteryStatus()); - iMtUpdaterConsole->Console().Printf(_L("BatteryStatus %d\n"),iBatteryStatus ); - break; - } - } - case '8': - { - // change an application setting, - // increment the value if attribute ID no 1 for example - // CPlayerInfoTarget - iPlayerApplicationSettingsObserver->SetAttributeL(1, 2); - iMtUpdaterConsole->Console().Printf(_L("Increment the value if attribute ID no 1\n") ); - break; - } - case '9': - { - // Update NowPlayingList - iNowPlaying->NowPlayingContentChanged(); - - iMtUpdaterConsole->Console().Printf(_L("Now Playing List updated\n") ); - break; - } - case '0': - { - User::SafeInc(*reinterpret_cast(&iUidCounter)); // Might get dodgy when reaching 0x80000000 - iMediaBrowseInterface->MrcdamlbMediaLibraryStateChange(iUidCounter); - iMtUpdaterConsole->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter); - break; - } - case 'a': - { - SetAsActivePlayer(); - break; - } - default: - iMtUpdaterConsole->Console().Printf(_L("No such command\n")); - break; - }; - - MtMenu(); - } - -void CTavsrcMtUpdater::MtMenu() - { - DisplayCurrentState(); - - iMtUpdaterConsole->Console().Printf(_L("e.\tAddEvent\n")); - iMtUpdaterConsole->Console().Printf(_L("c.\tAddCompanyId\n")); - iMtUpdaterConsole->Console().Printf(_L("1.\tPlaybackStatusChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("2.\tTrackChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("3.\tTrackReachedEnd\n")); - iMtUpdaterConsole->Console().Printf(_L("4.\tTrackReachedStart\n")); - iMtUpdaterConsole->Console().Printf(_L("5.\tPlaybackPositionChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("6.\tSetBatteryStatus\n")); - iMtUpdaterConsole->Console().Printf(_L("8.\tAttributeChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("9.\tNowPlayingContentChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("0.\tUIDsChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("\n")); - - iMtUpdaterConsole->RequestKey(); - } - -TInt CTavsrcMtUpdater::BrowseKeyPressed(TAny* aPtr, TChar aKey) - { - TRAPD(err, static_cast(aPtr)->BrowseKeyPressedL(aKey)); - return err; - } - -void CTavsrcMtUpdater::BrowseKeyPressedL(TChar aKey) - { - switch(aKey) - { - case '0': - { - User::SafeInc(*reinterpret_cast(&iUidCounter)); // Might get dodgy when reaching 0x80000000 - iMediaBrowseInterface->MrcdamlbMediaLibraryStateChange(iUidCounter); - BROWSE_CONSOLE->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter); - break; - } - default: - BROWSE_CONSOLE->Console().Printf(_L("No such command\n")); - break; - }; - - BrowseMenu(); - } - -void CTavsrcMtUpdater::BrowseMenu() - { - BROWSE_CONSOLE->Console().Printf(_L("0.\tUIDsChanged\n")); - BROWSE_CONSOLE->Console().Printf(_L("\n")); - - BROWSE_CONSOLE->RequestKey(); - } - -void CTavsrcMtUpdater::AddEvent(TRegisterNotificationEvent aEvent) - { - iPlayerCapabilitiesObserver->AddEvent(aEvent); - } - -void CTavsrcMtUpdater::AddCompanyId(TInt aCompanyId) - { - // save a Company ID - iPlayerCapabilitiesObserver->AddCompanyId(aCompanyId); - } - -void CTavsrcMtUpdater::TrackReachedEnd() - { - iPlayerEventsObserver->TrackReachedEnd(); - } - -void CTavsrcMtUpdater::TrackReachedStart() - { - iPlayerEventsObserver->TrackReachedStart(); - } - -void CTavsrcMtUpdater::PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus) - { - iPlayerEventsObserver->PlaybackStatusChanged(aPlaybackStatus); - } - -void CTavsrcMtUpdater::TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds) - { - iPlayerEventsObserver->TrackChanged(aIndex, aLengthInMilliseconds); - } - -void CTavsrcMtUpdater::SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus) - { - iPlayerEventsObserver->SetBatteryStatus(aStatus); - } - -void CTavsrcMtUpdater::SetPlaybackPosition(TUint32 aPosition) - { - iPlayerEventsObserver->SetPlaybackPosition(aPosition); - } - -void CTavsrcMtUpdater::SetAsActivePlayer() - { - TInt err = RProperty::Set(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProcess().Id()); - iMtUpdaterConsole->Console().Printf(_L("Set as active player %d\n"), err); - } - -MPlayerEventsObserver::TPlaybackStatus CTavsrcMtUpdater::NextPlaybackStatus() - { - if(iPlaybackStatus == MPlayerEventsObserver::EStopped) - { - iPlaybackStatus = MPlayerEventsObserver::EPlaying; - } - else if(iPlaybackStatus == MPlayerEventsObserver::EPlaying) - { - iPlaybackStatus = MPlayerEventsObserver::EPaused; - } - else if(iPlaybackStatus == MPlayerEventsObserver::EPaused) - { - iPlaybackStatus = MPlayerEventsObserver::EFwdSeek; - } - else if(iPlaybackStatus == MPlayerEventsObserver::EFwdSeek) - { - iPlaybackStatus = MPlayerEventsObserver::ERevSeek; - } - else if(iPlaybackStatus == MPlayerEventsObserver::ERevSeek) - { - iPlaybackStatus = MPlayerEventsObserver::EStopped; - } - - return iPlaybackStatus; - } - -MPlayerEventsObserver::TTargetBatteryStatus CTavsrcMtUpdater::NextBatteryStatus() - { - if(iBatteryStatus == MPlayerEventsObserver::ENormal) - { - iBatteryStatus = MPlayerEventsObserver::EWarning; - } - else if(iBatteryStatus == MPlayerEventsObserver::EWarning) - { - iBatteryStatus = MPlayerEventsObserver::ECritical; - } - else if(iBatteryStatus == MPlayerEventsObserver::ECritical) - { - iBatteryStatus = MPlayerEventsObserver::EExternal; - } - else if(iBatteryStatus == MPlayerEventsObserver::EExternal) - { - iBatteryStatus = MPlayerEventsObserver::EFullCharge; - } - else if(iBatteryStatus == MPlayerEventsObserver::EFullCharge) - { - iBatteryStatus = MPlayerEventsObserver::ENormal; - } - - return iBatteryStatus; - } - -// from MPlayerApplicationSettingsNotify -void CTavsrcMtUpdater::MpasnSetPlayerApplicationValueL(const RArray& aAttributeID, const RArray& aAttributeValue) - - { - for (TInt i=0; i < aAttributeID.Count(); i++) - { - iMtUpdaterConsole->Console().Printf(_L("SetPlayerApplication attribute:%d value:%d \n"),aAttributeID[i], aAttributeValue[i]); - } - } - -void CTavsrcMtUpdater::MrcdanptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter) - { - iMtUpdaterConsole->Console().Printf(_L("* PlayItem %08x %08x\t scope %d remote uidcounter %d\n"), aItem>>32, aItem & 0xffffffff, aScope, aUidCounter); - - if(iUidCounter != aUidCounter) - { - iMtUpdaterConsole->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter); - iNowPlaying->PlayItemResponse(KErrInvalidMediaLibraryStateCookie); - } - else - { - iNowPlaying->PlayItemResponse(KErrNone); - } - } - -void CTavsrcMtUpdater::MrcdanptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter) - { - iMtUpdaterConsole->Console().Printf(_L("* AddToNowPlaying %08x%08x\t scope %d uidcounter %d\n"), aItem>>32, aItem, aScope, aUidCounter); - - if(iUidCounter != aUidCounter) - { - iMtUpdaterConsole->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter); - iNowPlaying->AddToNowPlayingResponse(KErrInvalidMediaLibraryStateCookie); - } - else - { - iNowPlaying->AddToNowPlayingResponse(KErrNone); - } - } - -void CTavsrcMtUpdater::MrcdamlboGetFolderListing(TRemConFolderScope aScope, TUint aStartItem, TUint aEndItem) - { - BROWSE_CONSOLE->Console().Printf(_L("* GetFolderItems scope %d, start item %d, end item %d\n"), aScope, aStartItem, aEndItem); - // FIXME handle scopes - TInt err = aStartItem < KNumberItemsInFolder ? KErrNone : KErrMediaBrowseInvalidOffset; - - TInt numberItems = (iFolderDepth == KMaxFolderDepth) ? KNumberMediaItemsInFolder : KNumberItemsInFolder; - TInt numberFolderItems = (iFolderDepth == KMaxFolderDepth) ? 0 : KNumberFolderItemsInFolder; - - RArray folderListing; - if(!err) - { - for(TInt i = aStartItem; (i <= aEndItem) && (i < numberItems) && !err; i++) - { - // FIXME handle erro - TRemConItem item; - item.iUid = static_cast(i) | KUidMarker; - item.iType = ERemConMediaItem; - if(i < numberFolderItems) - { - item.iUid = static_cast(i) | KFolderMarker; - item.iType = ERemConFolderItem; - } - - err = folderListing.Append(item); - } - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing")); - } - iMediaBrowseInterface->MrcdamlbFolderListing(folderListing.Array(), iUidCounter, err); - - folderListing.Close(); - } - -void CTavsrcMtUpdater::SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid) - { - _LIT8(KTestTitle, "Test Title 0x%08x%08x"); - aAttribute.iCharset = KUtf8MibEnum; - - switch(aAttribute.iAttributeId) - { - case ETitleOfMedia: - { - //buffer.Copy(KMediaTitle); - aAttribute.iString = HBufC8::NewL(29); - TPtr8 namePtr = aAttribute.iString->Des(); - namePtr.AppendFormat(KTestTitle, (aUid >> 32), aUid); - aAttribute.iStringLen = namePtr.Length(); - break; - } - /* - case ENameOfArtist: - buffer.Copy(KArtistName); - break; - case ENameOfAlbum: - buffer.Copy(KAlbumName); - break; - case ETrackNumber: - buffer.Copy(KTrackNumber); - break; - case ENumberOfTracks: - buffer.Copy(KNumberOfTracks); - break; - case EGenre: - buffer.Copy(KGenre); - break; - case EPlayingTime: - buffer.Copy(KPlayingTime); - break; - */ - default: - // __DEBUGGER(); - User::Leave(KErrNotFound); - break; - } - } - -void CTavsrcMtUpdater::MrcdamlboFolderUp(TUint16 aMediaLibraryStateCookie) - { - TInt err = (aMediaLibraryStateCookie == iUidCounter) ? KErrNone : KErrInvalidMediaLibraryStateCookie; - - if(!err && --iFolderDepth < 0) - { - iFolderDepth = 0; - err = KErrMediaBrowseNotADirectory; - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L("* Folder Up\n")); - } - else if(err == KErrInvalidMediaLibraryStateCookie) - { - BROWSE_CONSOLE->Console().Printf(_L(" Error: remote uidcounter (%d) does not match local(%d)\n"), aMediaLibraryStateCookie, iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err); - } - iMediaBrowseInterface->MrcdamlbFolderUpResult(KNumberItemsInFolder, err); - } - -void CTavsrcMtUpdater::MrcdamlboFolderDown(const TRemConItemUid& aFolder, TUint16 aMediaLibraryStateCookie) - { - TInt err = (aMediaLibraryStateCookie == iUidCounter) ? KErrNone : KErrInvalidMediaLibraryStateCookie; - - if(!(aFolder & KFolderMarker)) - { - err = KErrMediaBrowseNotADirectory; - } - else if(!err && ++iFolderDepth > KMaxFolderDepth) - { - iFolderDepth = KMaxFolderDepth; - err = KErrNotSupported; - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L("* Folder down %08x %08x\n"), aFolder >> 32, aFolder); - } - else if(err == KErrInvalidMediaLibraryStateCookie) - { - BROWSE_CONSOLE->Console().Printf(_L(" Error: remote uidcounter (%d) does not match local(%d)\n"), aMediaLibraryStateCookie, iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err); - } - iMediaBrowseInterface->MrcdamlbFolderDownResult(KNumberItemsInFolder, err); - } - -void CTavsrcMtUpdater::MrcdamlboGetPath(RPointerArray& aPath) - { - TInt err = KErrNone; - for(TInt i = 0; (i < iFolderDepth) && (err == KErrNone); i++) - { - HBufC8* name = HBufC8::NewL(14); - name->Des().AppendFormat(KFolderName, iFolderDepth); - err = aPath.Append(name); - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L("* Player set as browsed: folder items = %d, uid counter = %d\n"), KNumberItemsInFolder, iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L("* Error %d setting as browsed player"), err); - } - iMediaBrowseInterface->MrcdamlbGetPathResult(KNumberItemsInFolder, iUidCounter, err); - } - -void CTavsrcMtUpdater::MrcdamlboSearch(const TDesC8& /*aSearch*/) - { - BROWSE_CONSOLE->Console().Printf(_L("* Search (returning not supported)")); - - iMediaBrowseInterface->MrcdamlbSearchResult(0, iUidCounter, KErrAvrcpAirSearchNotSupported); - } - -void CTavsrcMtUpdater::DisplayCurrentState() - { - iMtUpdaterConsole->Console().Printf(_L("**************************************************\n")); - iMtUpdaterConsole->Console().Printf(_L("* CURRENT STATE\n*\n")); - - iMtUpdaterConsole->Console().Printf(_L("* Supported Events:\t")); - for(TInt i=0; iConsole().Printf(_L("0x%.8x\t"), iNotificationEvents[i]); - } - iMtUpdaterConsole->Console().Printf(_L("\n")); - - iMtUpdaterConsole->Console().Printf(_L("* Supported Company Ids:\t")); - for(TInt i=0; iConsole().Printf(_L("0x%.8x\t"), iCompanyIds[i]); - } - iMtUpdaterConsole->Console().Printf(_L("\n")); - - iMtUpdaterConsole->Console().Printf(_L("* Playback Status: ")); - switch(iPlaybackStatus) - { - case MPlayerEventsObserver::EStopped: - iMtUpdaterConsole->Console().Printf(_L("STOPPED\n")); - break; - case MPlayerEventsObserver::EPlaying: - iMtUpdaterConsole->Console().Printf(_L("PLAYING\n")); - break; - case MPlayerEventsObserver::EPaused: - iMtUpdaterConsole->Console().Printf(_L("PAUSED\n")); - break; - case MPlayerEventsObserver::EFwdSeek: - iMtUpdaterConsole->Console().Printf(_L("FWD_SEEK\n")); - break; - case MPlayerEventsObserver::ERevSeek: - iMtUpdaterConsole->Console().Printf(_L("REV_SEEK\n")); - break; - default: - ASSERT(EFalse); - break; - } - - iMtUpdaterConsole->Console().Printf(_L("* Position: %d\n"), iPosition); - iMtUpdaterConsole->Console().Printf(_L("* Length: %d\n"), iLength); - - iMtUpdaterConsole->Console().Printf(_L("* Battery Status: "), iBatteryStatus); - switch(iBatteryStatus) - { - case MPlayerEventsObserver::ENormal: - iMtUpdaterConsole->Console().Printf(_L("NORMAL \n")); - break; - case MPlayerEventsObserver::EWarning: - iMtUpdaterConsole->Console().Printf(_L("WARNING \n")); - break; - case MPlayerEventsObserver::ECritical: - iMtUpdaterConsole->Console().Printf(_L("CRITICAL \n")); - break; - case MPlayerEventsObserver::EExternal: - iMtUpdaterConsole->Console().Printf(_L("EXTERNAL \n")); - break; - case MPlayerEventsObserver::EFullCharge: - iMtUpdaterConsole->Console().Printf(_L("FULL CHARGE \n")); - break; - case MPlayerEventsObserver::EUnknown: - iMtUpdaterConsole->Console().Printf(_L("Unknown\n")); - default: - ASSERT(EFalse); - break; - } - - iMtUpdaterConsole->Console().Printf(_L("**************************************************\n\n")); - } - -void CTavsrcMtUpdater::MrcdanpboGetFolderListing(TUint aStartItem, TUint aEndItem) - { - BROWSE_CONSOLE->Console().Printf(_L("* GetFolderItems NowPlaying start item %d, end item %d\n"), aStartItem, aEndItem); - - TInt err = aStartItem < KNumberItemsInFolder ? KErrNone : KErrMediaBrowseInvalidOffset; - - RArray folderListing; - if(!err) - { - for(TInt i = aStartItem; (i <= aEndItem) && (i < KNumberItemsInFolder) && !err; i++) - { - // FIXME handle erro - TRemConItem item; - item.iUid = static_cast(i) | KUidMarker; - item.iType = ERemConMediaItem; - err = folderListing.Append(item); - } - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing")); - } - - iNowPlayingBrowseInterface->MrcdanpbFolderListing(folderListing.Array(), iUidCounter, err); - } - -TInt CTavsrcMtUpdater::PrepareItemDataL( - TMediaAttributeIter& aIter, - const TRemConItemUid& aItemId, - HBufC8* &aItemName, - RArray& aItemAttributes) - { - /** - First, construct the name of the media item. - */ - _LIT8(KMediaItemName, "MediaItem 0x%08x%08x"); - _LIT8(KFolderItemName, "FolderItem 0x%08x%08x"); - HBufC8* itemName = HBufC8::NewL(30); - TPtr8 namePtr = itemName->Des(); - TUint upper = aItemId >> 32; - TUint lower = aItemId & 0xffffffff; - if (aItemId & KUidMarker) - { - namePtr.AppendFormat(KMediaItemName, upper, lower); - } - else if(aItemId & KFolderMarker) - { - namePtr.AppendFormat(KFolderItemName, upper, lower); - } - else - { - ASSERT(NULL); - } - aItemName = itemName; - /** - Second, construct attributes of the item. - */ - _LIT8(KAttributeName, "Attibute 0x%02x"); - TMediaElementAttribute attribute; - TMediaAttributeId id; - aIter.Start(); - while(aIter.Next(id)) - { - //API takes the ownership. - HBufC8* attributeName = HBufC8::NewL(30); - TPtr8 attributeNamePtr = attributeName->Des(); - attributeNamePtr.AppendFormat(KAttributeName, id); - - attribute.iAttributeId = id; - attribute.iString = attributeName; - aItemAttributes.Append(attribute); - } - - return KErrNone; - } - -TInt CTavsrcMtUpdater::MrcdamlboGetItem(TRemConFolderScope /*aScope*/, - const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter, - TUint16 aMediaLibraryStateCookie) - { - if(iUidCounter != aMediaLibraryStateCookie) - { - BROWSE_CONSOLE->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter); - return KErrInvalidMediaLibraryStateCookie; - } - - TInt error = KErrNone; - RArray itemAttributes; - HBufC8* itemName = NULL; - if (aItemId & KUidMarker) - { - PrepareItemDataL(aIter, aItemId, itemName, itemAttributes); - iMediaBrowseInterface->MrcdamlbMediaElementItemResult(aItemId, - *itemName, - AvrcpBrowsing::KAudio, - itemAttributes.Array(), - KErrNone); - } - else if(aItemId & KFolderMarker) - { - PrepareItemDataL(aIter, aItemId, itemName, itemAttributes); - iMediaBrowseInterface->MrcdamlbFolderItemResult(aItemId, - *itemName, - EFolderPlaylists, - KFolderNotPlayable, - itemAttributes.Array(), - KErrNone); - } - else - { - error = KErrInvalidUid; - } - - delete itemName; - return error; - } - - -TInt CTavsrcMtUpdater::MrcdanpboGetItem(const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter, - TUint16 aMediaLibraryStateCookie) - { - if(iUidCounter != aMediaLibraryStateCookie) - { - BROWSE_CONSOLE->Console().Printf(_L("remote uidcounter does not match local(%d)\n"), iUidCounter); - return KErrInvalidMediaLibraryStateCookie; - } - - TInt error = KErrNone; - RArray itemAttributes; - if (aItemId & KUidMarker) - { - HBufC8* itemName; - PrepareItemDataL(aIter, aItemId, itemName, itemAttributes); - iNowPlayingBrowseInterface->MrcdanpbMediaElementItemResult(aItemId, - *itemName, - AvrcpBrowsing::KAudio, - itemAttributes.Array(), - KErrNone); - delete itemName; - } - else - { - error = KErrInvalidUid; - } - - return error; - } - -CStopBrowseWatcher* CStopBrowseWatcher::NewL() - { - CStopBrowseWatcher* self = new(ELeave) CStopBrowseWatcher; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CStopBrowseWatcher::CStopBrowseWatcher() - : CActive(EPriorityStandard) - { - CActiveScheduler::Add(this); - } - -void CStopBrowseWatcher::ConstructL() - { - User::LeaveIfError(iThread.Open(RThread().Id())); - } - -CStopBrowseWatcher::~CStopBrowseWatcher() - { - Cancel(); - iThread.Close(); - } - -void CStopBrowseWatcher::Start() - { - iStatus = KRequestPending; - SetActive(); - } - -void CStopBrowseWatcher::Complete() - { - TRequestStatus* status = &iStatus; - iThread.RequestComplete(status, KErrNone); - } - -void CStopBrowseWatcher::RunL() - { - CActiveScheduler::Stop(); - } - -void CStopBrowseWatcher::DoCancel() - { - TRequestStatus* status = &iStatus; - iThread.RequestComplete(status, KErrCancel); - } - - diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcmtupdaterdatabaseaware.h --- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseaware.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -// 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: -// tavsrcmtupdater.h -// - -#ifndef TAVSRCMTUPDATER_H -#define TAVSRCMTUPDATER_H - -#include -#include -#include -#include -#include -#include -#include "mediainformation.h" - -_LIT(KAVRCPSettingsResourceFilename, "z:\\bluetooth\\avrcp\\avrcp-settings.rsc"); -const TInt KDefaultLength = 120000; -const TInt KPositionIncrement = 5000; - -class CStopBrowseWatcher - : public CActive - { -public: - static CStopBrowseWatcher* NewL(); - ~CStopBrowseWatcher(); - - void Start(); - void Complete(); - -private: - CStopBrowseWatcher(); - void ConstructL(); - -private: // from CActive - void RunL(); - void DoCancel(); - -private: - RThread iThread; - }; - -class CActiveCallBackConsole; -class CRemConDatabaseAwareNowPlayingTarget; -class CRemConDatabaseAwareMediaBrowseTarget; -class MRemConDatabaseAwareMediaLibraryBrowse; -class MRemConDatabaseAwareNowPlayingBrowse; -class CTavsrcMtUpdater : public CBase, public MActiveConsoleNotify, - public MPlayerApplicationSettingsNotify, - public MRemConDatabaseAwareMediaLibraryBrowseObserver, - public MRemConDatabaseAwareNowPlayingBrowseObserver, - public MRemConDatabaseAwareNowPlayingTargetObserver - { -public: - static CTavsrcMtUpdater* NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces); - ~CTavsrcMtUpdater(); - -private: - CTavsrcMtUpdater(); - void ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces); - - void KeyPressed(TChar aKey); - void MtMenu(); - - void ReadAVRCPSettingsFile(const TDesC& aResourceFileName); - - void AddEvent(TRegisterNotificationEvent aEvent); - void AddCompanyId(TInt aCompanyId); - void TrackReachedEnd(); - void TrackReachedStart(); - void PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus); - void TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds); - void SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus); - void SetPlaybackPosition(TUint32 aPosition); - void SetAsActivePlayer(); - - MPlayerEventsObserver::TPlaybackStatus NextPlaybackStatus(); - MPlayerEventsObserver::TTargetBatteryStatus NextBatteryStatus(); - -private: - // from MPlayerApplicationSettingsNotify - void MpasnSetPlayerApplicationValueL(const RArray& aAttributeID, const RArray& aAttributeValue); - - // from MRemConDatabaseAwareNowPlayingTargetObserver - void MrcdanptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter); - void MrcdanptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope, TUint16 aUidCounter); - - // from MRemConDatabaseAwareMediaLibraryBrowseTargetObserver - void MrcdamlboGetFolderListing(TRemConFolderScope aScope, TUint aStartItem, TUint aEndItem); - void MrcdamlboFolderUp(TUint16 aMediaLibraryStateCookie); - void MrcdamlboFolderDown(const TRemConItemUid& aFolder, TUint16 aMediaLibraryStateCookie); - void MrcdamlboGetPath(RPointerArray& aPath); - void MrcdamlboSearch(const TDesC8& aSearch); - TInt MrcdamlboGetItem(TRemConFolderScope aScope, - const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter, - TUint16 aMediaLibraryStateCookie); - - // from MRemConDatabaseAwareNowPlayingBrowseObserver - void MrcdanpboGetFolderListing(TUint aStartItem, TUint aEndItem); - TInt MrcdanpboGetItem(const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter, - TUint16 aMediaLibraryStateCookie); - - void DisplayCurrentState(); - void SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid); - -private: // Utility functions - TInt PrepareItemDataL(TMediaAttributeIter& aIter, - const TRemConItemUid& aItemId, - HBufC8* &aItemName, - RArray& aItemAttributes); - -private: // second thread functions - static TInt MediaBrowseThread(TAny* aPtr); - void BrowseSetupL(CRemConInterfaceSelector& aIfSel); - void BrowseCleanup(); - - static TInt BrowseKeyPressed(TAny* aPtr, TChar aKey); - void BrowseKeyPressedL(TChar aKey); - void BrowseMenu(); - -private: - CPlayerInfoTarget* iPlayerInformation; - MPlayerCapabilitiesObserver* iPlayerCapabilitiesObserver; - MPlayerApplicationSettingsObserver* iPlayerApplicationSettingsObserver; - MPlayerEventsObserver* iPlayerEventsObserver; - - CRemConDatabaseAwareMediaBrowseTarget* iMediaBrowse; - MRemConDatabaseAwareMediaLibraryBrowse* iMediaBrowseInterface; - MRemConDatabaseAwareNowPlayingBrowse* iNowPlayingBrowseInterface; - CRemConDatabaseAwareNowPlayingTarget* iNowPlaying; - - CActiveConsole* iMtUpdaterConsole; - - CActiveCallBackConsole* iMtBrowseConsole; - - TInt iIndex; - MPlayerEventsObserver::TPlaybackStatus iPlaybackStatus; - MPlayerEventsObserver::TTargetBatteryStatus iBatteryStatus; - TUint32 iPosition; - TUint32 iLength; - - - RArray iNotificationEvents; - RArray iCompanyIds; - - TInt iFolderDepth; - - TUint iUidCounter; - - TBool iMediaBrowseThreadOpen; - RThread iMediaBrowseThread; - CStopBrowseWatcher* iMtBrowseStopper; - }; - -#endif //TAVSRCMTUPDATER_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcmtupdaterdatabaseunaware.cpp --- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseunaware.cpp Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,929 +0,0 @@ -// 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: -// tavsrcmtupdater.cpp -// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tavsrc.h" -#include "tavsrcmtupdaterdatabaseunaware.h" -#include "activecallbackconsole.h" - -#ifdef __WINS__ -GLDEF_D TSize gUpdaterConsole(75,30); -GLDEF_D TSize gBrowseConsole(75,30); -#else -GLDEF_D TSize gUpdaterConsole(KConsFullScreen,KConsFullScreen); -GLDEF_D TSize gBrowseConsole(KConsFullScreen,KConsFullScreen); -#endif - - -#define BROWSE_CONSOLE iMtBrowseConsole - -const TRemConItemUid KUidMarker = 0xc0ffeeee00000000ull; -const TRemConItemUid KFolderMarker = 0x0000000100000000ull; -const TInt KNumberFolderItemsInFolder = 1; -const TInt KNumberMediaItemsInFolder = 1501; -const TInt KNumberItemsInFolder = KNumberMediaItemsInFolder + KNumberFolderItemsInFolder; - -_LIT8(KFolderName, "Folder%08x"); - -CTavsrcMtUpdater* CTavsrcMtUpdater::NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces) - { - CTavsrcMtUpdater* mt = new(ELeave)CTavsrcMtUpdater(); - CleanupStack::PushL(mt); - mt->ConstructL(aIfSel, aRemConInterfaces); - CleanupStack::Pop(); - return mt; - } - -struct TMediaBrowseThreadParams - { - CRemConInterfaceSelector* iIfSel; - CTavsrcMtUpdater* iUpdater; - }; - -TInt CTavsrcMtUpdater::MediaBrowseThread(TAny* aPtr) - { - TMediaBrowseThreadParams* params = reinterpret_cast(aPtr); - - CTrapCleanup* cleanupStack = CTrapCleanup::New(); - CActiveScheduler* activescheduler = new CActiveScheduler; - CActiveScheduler::Install(activescheduler); - - TInt err = KErrNoMemory; - if(cleanupStack && activescheduler) - { - CTavsrcMtUpdater* self = params->iUpdater; - TRAP(err, self->BrowseSetupL(*(params->iIfSel))) - RThread().Rendezvous(err); - if(err == KErrNone) - { - CActiveScheduler::Start(); - } - self->BrowseCleanup(); - } - - delete activescheduler; - delete cleanupStack; - - return err; - } - -void CTavsrcMtUpdater::BrowseSetupL(CRemConInterfaceSelector& aIfSel) - { - iMtBrowseConsole = CActiveCallBackConsole::NewL(BrowseKeyPressed, this, _L("MtBrowse"),gBrowseConsole); - BrowseMenu(); - - iMtBrowseStopper = CStopBrowseWatcher::NewL(); - iMediaBrowse = CRemConDatabaseUnawareMediaBrowseTarget::NewL(aIfSel, - *this, *this, ETrue, iMediaBrowseInterface, - iNowPlayingBrowseInterface); - iMtBrowseStopper->Start(); - } - -void CTavsrcMtUpdater::BrowseCleanup() - { - delete iMtBrowseStopper; iMtBrowseStopper = NULL; - delete iMtBrowseConsole; iMtBrowseConsole = NULL; - } - - -void CTavsrcMtUpdater::ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces) - { - if (aRemConInterfaces & EPlayerInformation) - { - iPlayerInformation = CPlayerInfoTarget::NewL(aIfSel, - iPlayerCapabilitiesObserver, - iPlayerApplicationSettingsObserver, - iPlayerEventsObserver, - *this); - } - - if (aRemConInterfaces & ENowPlaying) - { - iNowPlaying = CRemConDatabaseUnawareNowPlayingTarget::NewL(aIfSel, *this); - } - - if (aRemConInterfaces & EMediaBrowse) - { - // Create media browse thread (and wait until it is running)... - TMediaBrowseThreadParams params; - params.iIfSel = &aIfSel; - params.iUpdater = this; - TRequestStatus status; - User::LeaveIfError(iMediaBrowseThread.Create(KNullDesC, CTavsrcMtUpdater::MediaBrowseThread, KDefaultStackSize, NULL, ¶ms)); - iMediaBrowseThread.Rendezvous(status); - iMediaBrowseThread.Resume(); - User::WaitForRequest(status); - User::LeaveIfError(status.Int()); - iMediaBrowseThreadOpen = ETrue; - } - - iMtUpdaterConsole = CActiveConsole::NewL(*this,_L("MtUpdater"),gUpdaterConsole); - - // configure the PlayerInformation from resource file - ReadAVRCPSettingsFile(KAVRCPSettingsResourceFilename); - - // We don't need to call AddEvent() for PlaybackStatusChanged or TrackChanged - // since these are mandatory events which must be supported. A KErrAlreadyExists - // error is returned if these are called from here. - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackStatusChanged); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackChanged); - - // configure the interface with the events supported by tavsrc - // This cannot fail as we constructed the iNotificationEvents array to have a granularity sufficient to - // contain all events without having to grow - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedEnd)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedEnd); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationTrackReachedStart)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationTrackReachedStart); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlaybackPosChanged)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationBatteryStatusChanged)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationBatteryStatusChanged); - - User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlayerApplicationSettingChanged)); - (void)iNotificationEvents.InsertInOrder(ERegisterNotificationPlayerApplicationSettingChanged); - - // save a Company ID - iPlayerCapabilitiesObserver->AddCompanyId(0x4321); - iCompanyIds.InsertInOrderL(0x4321); - - // set the player events to some test values - iPlayerEventsObserver->TrackReachedEnd(); - - // playing 12, which is 2:30 long with a low battery - iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EStopped); - iPlaybackStatus = MPlayerEventsObserver::EStopped; - - iPlayerEventsObserver->TrackChanged(12, 150*1000); - iLength = 150*1000; - - iPlayerEventsObserver->SetBatteryStatus(MPlayerEventsObserver::ECritical); - iBatteryStatus = MPlayerEventsObserver::ECritical; - - // current position is 1 minute 10 secs though track 12 - iPlayerEventsObserver->SetPlaybackPosition(70000); - iPosition = 70000; - - _LIT_SECURITY_POLICY_PASS(KPassPolicy); - TInt err = RProperty::Define(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProperty::EInt, KPassPolicy, KPassPolicy); - if(err != KErrNone && err != KErrAlreadyExists) - { - User::Leave(err); - } - - MtMenu(); - } - -CTavsrcMtUpdater::CTavsrcMtUpdater() - : iNotificationEvents(ERegisterNotificationReservedLast), - iUidCounter(0) - { - } - -CTavsrcMtUpdater::~CTavsrcMtUpdater() - { - delete iMtUpdaterConsole; - iNotificationEvents.Close(); - iCompanyIds.Close(); - if(iMediaBrowseThreadOpen) - { - TRequestStatus status; - iMediaBrowseThread.Logon(status); - iMtBrowseStopper->Complete(); - User::WaitForRequest(status); - // the browse thread should not be running now. - } - iMediaBrowseThread.Close(); - } - -void CTavsrcMtUpdater::ReadAVRCPSettingsFile(const TDesC& aResourceFileName) -/** - - Creates the resource reader. - - Reads the default policy evaluator and dialog creator UIDs. - - Reads the number of policies in the resource file. - -@param aRFs The file server session used by the resource parser. -@param aResourceFileName The name of the AVRCP settings file to read. -*/ - { - RFs rfs; - rfs.Connect(); - RFile r; - User::LeaveIfError(r.Open(rfs, aResourceFileName, EFileRead | EFileShareReadersOnly)); - CleanupClosePushL(r); - TInt size; - User::LeaveIfError(r.Size(size)); - CleanupStack::PopAndDestroy(&r); - - CResourceFile* resourceFile = CResourceFile::NewLC(rfs, aResourceFileName, 0, size); - PlayerApplicationSettingsResourceInit::DefineAttributesL(*iPlayerApplicationSettingsObserver, *resourceFile); - CleanupStack::PopAndDestroy(resourceFile); - } - -void CTavsrcMtUpdater::KeyPressed(TChar aKey) - { - - switch(aKey) - { - case 'e': - { - AddEvent(ERegisterNotificationPlaybackPosChanged); - iNotificationEvents.InsertInOrder(ERegisterNotificationPlaybackPosChanged); - iMtUpdaterConsole->Console().Printf(_L("Add event EPlaybackPosChanged\n")); - break; - } - case 'c': - { - AddCompanyId(0x5678); - (void)iCompanyIds.InsertInOrder(0x5678); - iMtUpdaterConsole->Console().Printf(_L("Add CompanyId 0x5678\n")); - break; - } - case '1': - { - PlackbackStatusChanged(NextPlaybackStatus()); - iMtUpdaterConsole->Console().Printf(_L("Playback status changed %d\n"),iPlaybackStatus); - break; - } - case '2': - { - TrackChanged(++iIndex, KDefaultLength); - iMtUpdaterConsole->Console().Printf(_L("Track changed\n")); - break; - } - case '3': - { - TrackReachedEnd(); - iMtUpdaterConsole->Console().Printf(_L("Track reached end\n")); - break; - } - case '4': - { - TrackReachedStart(); - iMtUpdaterConsole->Console().Printf(_L("Track reached end\n")); - break; - } - case '5': - { - iPosition += KPositionIncrement; - SetPlaybackPosition(iPosition); - iMtUpdaterConsole->Console().Printf(_L("Position %d\n"),iPosition ); - break; - case '6': - { - SetBatteryStatus(NextBatteryStatus()); - iMtUpdaterConsole->Console().Printf(_L("BatteryStatus %d\n"),iBatteryStatus ); - break; - } - } - case '8': - { - // change an application setting, - // increment the value if attribute ID no 1 for example - // CPlayerInfoTarget - iPlayerApplicationSettingsObserver->SetAttributeL(1, 2); - iMtUpdaterConsole->Console().Printf(_L("Increment the value if attribute ID no 1\n") ); - break; - } - case '9': - { - // Update NowPlayingList - iNowPlaying->NowPlayingContentChanged(); - - iMtUpdaterConsole->Console().Printf(_L("Now Playing List updated\n") ); - break; - } - case '0': - { - iMediaBrowseInterface->MrcdumlbMediaLibraryStateChange(); - - iMtUpdaterConsole->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter); - break; - } - case 'a': - { - SetAsActivePlayer(); - break; - } - default: - iMtUpdaterConsole->Console().Printf(_L("No such command\n")); - break; - }; - - MtMenu(); - } - -void CTavsrcMtUpdater::MtMenu() - { - DisplayCurrentState(); - - iMtUpdaterConsole->Console().Printf(_L("e.\tAddEvent\n")); - iMtUpdaterConsole->Console().Printf(_L("c.\tAddCompanyId\n")); - iMtUpdaterConsole->Console().Printf(_L("1.\tPlaybackStatusChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("2.\tTrackChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("3.\tTrackReachedEnd\n")); - iMtUpdaterConsole->Console().Printf(_L("4.\tTrackReachedStart\n")); - iMtUpdaterConsole->Console().Printf(_L("5.\tPlaybackPositionChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("6.\tSetBatteryStatus\n")); - iMtUpdaterConsole->Console().Printf(_L("8.\tAttributeChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("9.\tNowPlayingContentChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("0.\tUIDsChanged\n")); - iMtUpdaterConsole->Console().Printf(_L("\n")); - - iMtUpdaterConsole->RequestKey(); - } - -TInt CTavsrcMtUpdater::BrowseKeyPressed(TAny* aPtr, TChar aKey) - { - TRAPD(err, static_cast(aPtr)->BrowseKeyPressedL(aKey)); - return err; - } - -void CTavsrcMtUpdater::BrowseKeyPressedL(TChar aKey) - { - switch(aKey) - { - case '0': - { - iMediaBrowseInterface->MrcdumlbMediaLibraryStateChange(); - BROWSE_CONSOLE->Console().Printf(_L("UIDs changed: %d \n"), iUidCounter); - break; - } - default: - BROWSE_CONSOLE->Console().Printf(_L("No such command\n")); - break; - }; - - BrowseMenu(); - } - -void CTavsrcMtUpdater::BrowseMenu() - { - BROWSE_CONSOLE->Console().Printf(_L("0.\tUIDsChanged\n")); - BROWSE_CONSOLE->Console().Printf(_L("\n")); - - BROWSE_CONSOLE->RequestKey(); - } - -void CTavsrcMtUpdater::AddEvent(TRegisterNotificationEvent aEvent) - { - iPlayerCapabilitiesObserver->AddEvent(aEvent); - } - -void CTavsrcMtUpdater::AddCompanyId(TInt aCompanyId) - { - // save a Company ID - iPlayerCapabilitiesObserver->AddCompanyId(aCompanyId); - } - -void CTavsrcMtUpdater::TrackReachedEnd() - { - iPlayerEventsObserver->TrackReachedEnd(); - } - -void CTavsrcMtUpdater::TrackReachedStart() - { - iPlayerEventsObserver->TrackReachedStart(); - } - -void CTavsrcMtUpdater::PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus) - { - iPlayerEventsObserver->PlaybackStatusChanged(aPlaybackStatus); - } - -void CTavsrcMtUpdater::TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds) - { - iPlayerEventsObserver->TrackChanged(aIndex, aLengthInMilliseconds); - } - -void CTavsrcMtUpdater::SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus) - { - iPlayerEventsObserver->SetBatteryStatus(aStatus); - } - -void CTavsrcMtUpdater::SetPlaybackPosition(TUint32 aPosition) - { - iPlayerEventsObserver->SetPlaybackPosition(aPosition); - } - -void CTavsrcMtUpdater::SetAsActivePlayer() - { - TInt err = RProperty::Set(TUid::Uid(KRefTspProperty), KRefTspActivePlayer, RProcess().Id()); - iMtUpdaterConsole->Console().Printf(_L("Set as active player %d\n"), err); - } - -MPlayerEventsObserver::TPlaybackStatus CTavsrcMtUpdater::NextPlaybackStatus() - { - if(iPlaybackStatus == MPlayerEventsObserver::EStopped) - { - iPlaybackStatus = MPlayerEventsObserver::EPlaying; - } - else if(iPlaybackStatus == MPlayerEventsObserver::EPlaying) - { - iPlaybackStatus = MPlayerEventsObserver::EPaused; - } - else if(iPlaybackStatus == MPlayerEventsObserver::EPaused) - { - iPlaybackStatus = MPlayerEventsObserver::EFwdSeek; - } - else if(iPlaybackStatus == MPlayerEventsObserver::EFwdSeek) - { - iPlaybackStatus = MPlayerEventsObserver::ERevSeek; - } - else if(iPlaybackStatus == MPlayerEventsObserver::ERevSeek) - { - iPlaybackStatus = MPlayerEventsObserver::EStopped; - } - - return iPlaybackStatus; - } - -MPlayerEventsObserver::TTargetBatteryStatus CTavsrcMtUpdater::NextBatteryStatus() - { - if(iBatteryStatus == MPlayerEventsObserver::ENormal) - { - iBatteryStatus = MPlayerEventsObserver::EWarning; - } - else if(iBatteryStatus == MPlayerEventsObserver::EWarning) - { - iBatteryStatus = MPlayerEventsObserver::ECritical; - } - else if(iBatteryStatus == MPlayerEventsObserver::ECritical) - { - iBatteryStatus = MPlayerEventsObserver::EExternal; - } - else if(iBatteryStatus == MPlayerEventsObserver::EExternal) - { - iBatteryStatus = MPlayerEventsObserver::EFullCharge; - } - else if(iBatteryStatus == MPlayerEventsObserver::EFullCharge) - { - iBatteryStatus = MPlayerEventsObserver::ENormal; - } - - return iBatteryStatus; - } - -// from MPlayerApplicationSettingsNotify -void CTavsrcMtUpdater::MpasnSetPlayerApplicationValueL(const RArray& aAttributeID, const RArray& aAttributeValue) - - { - for (TInt i=0; i < aAttributeID.Count(); i++) - { - iMtUpdaterConsole->Console().Printf(_L("SetPlayerApplication attribute:%d value:%d \n"),aAttributeID[i], aAttributeValue[i]); - } - } - -void CTavsrcMtUpdater::MrcdunptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope) - { - iMtUpdaterConsole->Console().Printf(_L("* PlayItem 0x%08x%08x\t scope %d \n"), aItem>>32, aItem, aScope); - iNowPlaying->PlayItemResponse(0x11); - } - -void CTavsrcMtUpdater::MrcdunptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope) - { - iMtUpdaterConsole->Console().Printf(_L("* AddToNowPlaying 0x%08x%08x\t scope %d\n"), aItem>>32, aItem, aScope); - iNowPlaying->AddToNowPlayingResponse(KErrNone); - } - -void CTavsrcMtUpdater::MrcdumlboGetFolderListing(TRemConFolderScope /*aScope*/, TUint aStartItem, TUint aEndItem) - { - // FIXME handle scopes - TInt err = KErrNone; - - RArray folderListing; - for(TInt i = aStartItem; (i <= aEndItem) && (i < KNumberItemsInFolder) && !err; i++) - { - // FIXME handle erro - TRemConItem item; - item.iUid = static_cast(i) | KUidMarker; - item.iType = ERemConMediaItem; - if(i < KNumberFolderItemsInFolder) - { - item.iUid = static_cast(i) | KFolderMarker; - item.iType = ERemConFolderItem; - } - - err = folderListing.Append(item); - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing")); - } - iMediaBrowseInterface->MrcdumlbFolderListing(folderListing.Array(), err); - - folderListing.Close(); - } - -void CTavsrcMtUpdater::SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid) - { - _LIT8(KTestTitle, "Test Title 0x%08x%08x"); - aAttribute.iCharset = KUtf8MibEnum; - - switch(aAttribute.iAttributeId) - { - case ETitleOfMedia: - { - //buffer.Copy(KMediaTitle); - aAttribute.iString = HBufC8::NewL(29); - TPtr8 namePtr = aAttribute.iString->Des(); - namePtr.AppendFormat(KTestTitle, (aUid >> 32), aUid); - aAttribute.iStringLen = namePtr.Length(); - break; - } - /* - case ENameOfArtist: - buffer.Copy(KArtistName); - break; - case ENameOfAlbum: - buffer.Copy(KAlbumName); - break; - case ETrackNumber: - buffer.Copy(KTrackNumber); - break; - case ENumberOfTracks: - buffer.Copy(KNumberOfTracks); - break; - case EGenre: - buffer.Copy(KGenre); - break; - case EPlayingTime: - buffer.Copy(KPlayingTime); - break; - */ - default: - // __DEBUGGER(); - User::Leave(KErrNotFound); - break; - } - } - -void CTavsrcMtUpdater::MrcdumlboFolderUp() - { - TInt err = KErrNone; - - if(!err && --iFolderDepth < 0) - { - iFolderDepth = 0; - err = KErrNotSupported; - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L("* Folder Up\n")); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err); - } - iMediaBrowseInterface->MrcdumlbFolderUpResult(KNumberItemsInFolder, err); - } - -void CTavsrcMtUpdater::MrcdumlboFolderDown(const TRemConItemUid& aFolder) - { - TInt err = KErrNone; - - if(!(aFolder & KFolderMarker)) - { - err = KErrNotFound; - } - else if(!err && ++iFolderDepth > 10) - { - iFolderDepth = 10; - err = KErrNotSupported; - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L("* Folder down %08x %08x\n"), aFolder >> 32, aFolder); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error: %d\n"), err); - } - iMediaBrowseInterface->MrcdumlbFolderDownResult(KNumberItemsInFolder, err); - } - -void CTavsrcMtUpdater::MrcdumlboGetPath(RPointerArray& aPath) - { - TInt err = KErrNone; - for(TInt i = 0; (i < iFolderDepth) && (err == KErrNone); i++) - { - HBufC8* name = HBufC8::NewL(14); - name->Des().AppendFormat(KFolderName, iFolderDepth); - err = aPath.Append(name); - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L("* Player set as browsed: folder items = %d, uid counter = %d\n"), KNumberItemsInFolder, iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L("* Error %d setting as browsed player"), err); - } - iMediaBrowseInterface->MrcdumlbGetPathResult(KNumberItemsInFolder, err); - } - -void CTavsrcMtUpdater::MrcdumlboSearch(const TDesC8& /*aSearch*/) - { - BROWSE_CONSOLE->Console().Printf(_L("* Search (returning not supported)")); - - iMediaBrowseInterface->MrcdumlbSearchResult(0, KErrNotSupported); - } - -void CTavsrcMtUpdater::DisplayCurrentState() - { - iMtUpdaterConsole->Console().Printf(_L("**************************************************\n")); - iMtUpdaterConsole->Console().Printf(_L("* CURRENT STATE\n*\n")); - - iMtUpdaterConsole->Console().Printf(_L("* Supported Events:\t")); - for(TInt i=0; iConsole().Printf(_L("0x%.8x\t"), iNotificationEvents[i]); - } - iMtUpdaterConsole->Console().Printf(_L("\n")); - - iMtUpdaterConsole->Console().Printf(_L("* Supported Company Ids:\t")); - for(TInt i=0; iConsole().Printf(_L("0x%.8x\t"), iCompanyIds[i]); - } - iMtUpdaterConsole->Console().Printf(_L("\n")); - - iMtUpdaterConsole->Console().Printf(_L("* Playback Status: ")); - switch(iPlaybackStatus) - { - case MPlayerEventsObserver::EStopped: - iMtUpdaterConsole->Console().Printf(_L("STOPPED\n")); - break; - case MPlayerEventsObserver::EPlaying: - iMtUpdaterConsole->Console().Printf(_L("PLAYING\n")); - break; - case MPlayerEventsObserver::EPaused: - iMtUpdaterConsole->Console().Printf(_L("PAUSED\n")); - break; - case MPlayerEventsObserver::EFwdSeek: - iMtUpdaterConsole->Console().Printf(_L("FWD_SEEK\n")); - break; - case MPlayerEventsObserver::ERevSeek: - iMtUpdaterConsole->Console().Printf(_L("REV_SEEK\n")); - break; - default: - ASSERT(EFalse); - break; - } - - iMtUpdaterConsole->Console().Printf(_L("* Position: %d\n"), iPosition); - iMtUpdaterConsole->Console().Printf(_L("* Length: %d\n"), iLength); - - iMtUpdaterConsole->Console().Printf(_L("* Battery Status: "), iBatteryStatus); - switch(iBatteryStatus) - { - case MPlayerEventsObserver::ENormal: - iMtUpdaterConsole->Console().Printf(_L("NORMAL \n")); - break; - case MPlayerEventsObserver::EWarning: - iMtUpdaterConsole->Console().Printf(_L("WARNING \n")); - break; - case MPlayerEventsObserver::ECritical: - iMtUpdaterConsole->Console().Printf(_L("CRITICAL \n")); - break; - case MPlayerEventsObserver::EExternal: - iMtUpdaterConsole->Console().Printf(_L("EXTERNAL \n")); - break; - case MPlayerEventsObserver::EFullCharge: - iMtUpdaterConsole->Console().Printf(_L("FULL CHARGE \n")); - break; - case MPlayerEventsObserver::EUnknown: - iMtUpdaterConsole->Console().Printf(_L("Unknown\n")); - default: - ASSERT(EFalse); - break; - } - - iMtUpdaterConsole->Console().Printf(_L("**************************************************\n\n")); - } - -void CTavsrcMtUpdater::MrcdunpboGetFolderListing(TUint aStartItem, TUint aEndItem) - { - BROWSE_CONSOLE->Console().Printf(_L("* GetFolderItems NowPlaying start item %d, end item %d\n"), aStartItem, aEndItem); - - TInt err = KErrNone; - - RArray folderListing; - for(TInt i = aStartItem; (i <= aEndItem) && (i < KNumberItemsInFolder) && !err; i++) - { - // FIXME handle erro - TRemConItem item; - item.iUid = static_cast(i) | KUidMarker; - item.iType = ERemConMediaItem; - err = folderListing.Append(item); - } - - if(!err) - { - BROWSE_CONSOLE->Console().Printf(_L(" Returning listing of %d items, current uid counter %d\n"), folderListing.Array().Count(), iUidCounter); - } - else - { - BROWSE_CONSOLE->Console().Printf(_L(" Error %d getting folder listing")); - } - - iNowPlayingBrowseInterface->MrcdunpbFolderListing(folderListing.Array(), err); - } - -TInt CTavsrcMtUpdater::PrepareItemDataL( - TMediaAttributeIter& aIter, - const TRemConItemUid& aItemId, - HBufC8* &aItemName, - RArray& aItemAttributes) - { - /** - First, construct the name of the media item. - */ - _LIT8(KMediaItemName, "MediaItem 0x%08x%08x"); - _LIT8(KFolderItemName, "FolderItem 0x%08x%08x"); - HBufC8* itemName = HBufC8::NewL(30); - TPtr8 namePtr = itemName->Des(); - TUint upper = aItemId >> 32; - TUint lower = aItemId & 0xffffffff; - if (aItemId & KUidMarker) - { - namePtr.AppendFormat(KMediaItemName, upper, lower); - } - else if(aItemId & KFolderMarker) - { - namePtr.AppendFormat(KFolderItemName, upper, lower); - } - else - { - ASSERT(NULL); - } - aItemName = itemName; - /** - Second, construct attributes of the item. - */ - _LIT8(KAttributeName, "Attibute 0x%02x"); - TMediaElementAttribute attribute; - TMediaAttributeId id; - aIter.Start(); - while(aIter.Next(id)) - { - //API takes the ownership. - HBufC8* attributeName = HBufC8::NewL(30); - TPtr8 attributeNamePtr = attributeName->Des(); - attributeNamePtr.AppendFormat(KAttributeName, id); - - attribute.iAttributeId = id; - attribute.iString = attributeName; - aItemAttributes.Append(attribute); - } - - return KErrNone; - } - -TInt CTavsrcMtUpdater::MrcdumlboGetItem(TRemConFolderScope aScope, - const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter) - { - //FIXME handle the error: uidcounter doesn't match - - TInt error = KErrNone; - RArray itemAttributes; - HBufC8* itemName; - if (aItemId & KUidMarker) - { - PrepareItemDataL(aIter, aItemId, itemName, itemAttributes); - iMediaBrowseInterface->MrcdumlbMediaElementItemResult(aItemId, - *itemName, - AvrcpBrowsing::KAudio, - itemAttributes.Array(), - KErrNone); - } - else if(aItemId & KFolderMarker) - { - PrepareItemDataL(aIter, aItemId, itemName, itemAttributes); - iMediaBrowseInterface->MrcdumlbFolderItemResult(aItemId, - *itemName, - EFolderPlaylists, - KFolderNotPlayable, - itemAttributes.Array(), - KErrNone); - } - else - { - error = KErrInvalidUid; - } - - delete itemName; - return error; - } - -TInt CTavsrcMtUpdater::MrcdunpboGetItem(const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter) - { - //FIXME handle the error: uidcounter doesn't match. - - TInt error = KErrNone; - RArray itemAttributes; - HBufC8* itemName; - if (aItemId & KUidMarker) - { - PrepareItemDataL(aIter, aItemId, itemName, itemAttributes); - iNowPlayingBrowseInterface->MrcdunpbMediaElementItemResult(aItemId, - *itemName, - AvrcpBrowsing::KAudio, - itemAttributes.Array(), - KErrNone); - } - else - { - error = KErrInvalidUid; - } - - delete itemName; - return error; - } - -CStopBrowseWatcher* CStopBrowseWatcher::NewL() - { - CStopBrowseWatcher* self = new(ELeave) CStopBrowseWatcher; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CStopBrowseWatcher::CStopBrowseWatcher() - : CActive(EPriorityStandard) - { - CActiveScheduler::Add(this); - } - -void CStopBrowseWatcher::ConstructL() - { - User::LeaveIfError(iThread.Open(RThread().Id())); - } - -CStopBrowseWatcher::~CStopBrowseWatcher() - { - Cancel(); - iThread.Close(); - } - -void CStopBrowseWatcher::Start() - { - iStatus = KRequestPending; - SetActive(); - } - -void CStopBrowseWatcher::Complete() - { - TRequestStatus* status = &iStatus; - iThread.RequestComplete(status, KErrNone); - } - -void CStopBrowseWatcher::RunL() - { - CActiveScheduler::Stop(); - } - -void CStopBrowseWatcher::DoCancel() - { - TRequestStatus* status = &iStatus; - iThread.RequestComplete(status, KErrCancel); - } - - diff -r 786b94c6f0a4 -r 5b153be919d4 bluetooth/gavdp/test/tavsrcmtupdaterdatabaseunaware.h --- a/bluetooth/gavdp/test/tavsrcmtupdaterdatabaseunaware.h Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -// 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: -// tavsrcmtupdater.h -// - -#ifndef TAVSRCMTUPDATER_H -#define TAVSRCMTUPDATER_H - -#include -#include -#include -#include -#include -#include -#include "mediainformation.h" - -_LIT(KAVRCPSettingsResourceFilename, "z:\\bluetooth\\avrcp\\avrcp-settings.rsc"); -const TInt KDefaultLength = 120000; -const TInt KPositionIncrement = 5000; - -class CStopBrowseWatcher - : public CActive - { -public: - static CStopBrowseWatcher* NewL(); - ~CStopBrowseWatcher(); - - void Start(); - void Complete(); - -private: - CStopBrowseWatcher(); - void ConstructL(); - -private: // from CActive - void RunL(); - void DoCancel(); - -private: - RThread iThread; - }; - -class CActiveCallBackConsole; -class CRemConDatabaseUnawareMediaBrowseTarget; -class MRemConDatabaseUnawareMediaLibraryBrowse; -class MRemConDatabaseUnawareNowPlayingBrowse; -class CRemConDatabaseUnawareNowPlayingTarget; -class CTavsrcMtUpdater : public CBase, public MActiveConsoleNotify, - public MPlayerApplicationSettingsNotify, - public MRemConDatabaseUnawareMediaLibraryBrowseObserver, - public MRemConDatabaseUnawareNowPlayingBrowseObserver, - public MRemConDatabaseUnawareNowPlayingTargetObserver - { -public: - static CTavsrcMtUpdater* NewL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces); - ~CTavsrcMtUpdater(); - -private: - CTavsrcMtUpdater(); - void ConstructL(CRemConInterfaceSelector& aIfSel, TUint aRemConInterfaces); - - void KeyPressed(TChar aKey); - void MtMenu(); - - void ReadAVRCPSettingsFile(const TDesC& aResourceFileName); - - void AddEvent(TRegisterNotificationEvent aEvent); - void AddCompanyId(TInt aCompanyId); - void TrackReachedEnd(); - void TrackReachedStart(); - void PlackbackStatusChanged(MPlayerEventsObserver::TPlaybackStatus aPlaybackStatus); - void TrackChanged(TUint64 aIndex, TUint32 aLengthInMilliseconds); - void SetBatteryStatus(MPlayerEventsObserver::TTargetBatteryStatus aStatus); - void SetPlaybackPosition(TUint32 aPosition); - void SetAsActivePlayer(); - - MPlayerEventsObserver::TPlaybackStatus NextPlaybackStatus(); - MPlayerEventsObserver::TTargetBatteryStatus NextBatteryStatus(); - -private: - // from MPlayerApplicationSettingsNotify - void MpasnSetPlayerApplicationValueL(const RArray& aAttributeID, const RArray& aAttributeValue); - - // from MRemConDatabaseUnawareNowPlayingTargetObserver - void MrcdunptoPlayItem(const TRemConItemUid& aItem, TRemConFolderScope aScope); - void MrcdunptoAddToNowPlaying(const TRemConItemUid& aItem, TRemConFolderScope aScope); - - // from MRemConDatabaseUnawareMediaLibraryBrowseObserver - void MrcdumlboGetFolderListing(TRemConFolderScope aScope, TUint aStartItem, TUint aEndItem); - void MrcdumlboFolderUp(); - void MrcdumlboFolderDown(const TRemConItemUid& aFolder); - void MrcdumlboGetPath(RPointerArray& aPath); - void MrcdumlboSearch(const TDesC8& aSearch); - TInt MrcdumlboGetItem(TRemConFolderScope aScope, - const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter); - - // from MRemConDatabaseUnawareNowPlayingBrowseObserver - void MrcdunpboGetFolderListing(TUint aStartItem, TUint aEndItem); - TInt MrcdunpboGetItem(const TRemConItemUid& aItemId, - TMediaAttributeIter& aIter); - - void DisplayCurrentState(); - void SetAttributeL(REAResponse& aAttribute, TRemConItemUid& aUid); - -private: // Utility functions - TInt PrepareItemDataL(TMediaAttributeIter& aIter, - const TRemConItemUid& aItemId, - HBufC8* &aItemName, - RArray& aItemAttributes); - -private: // second thread functions - static TInt MediaBrowseThread(TAny* aPtr); - void BrowseSetupL(CRemConInterfaceSelector& aIfSel); - void BrowseCleanup(); - - static TInt BrowseKeyPressed(TAny* aPtr, TChar aKey); - void BrowseKeyPressedL(TChar aKey); - void BrowseMenu(); - -private: - CPlayerInfoTarget* iPlayerInformation; - MPlayerCapabilitiesObserver* iPlayerCapabilitiesObserver; - MPlayerApplicationSettingsObserver* iPlayerApplicationSettingsObserver; - MPlayerEventsObserver* iPlayerEventsObserver; - - CRemConDatabaseUnawareMediaBrowseTarget* iMediaBrowse; - MRemConDatabaseUnawareMediaLibraryBrowse* iMediaBrowseInterface; - MRemConDatabaseUnawareNowPlayingBrowse* iNowPlayingBrowseInterface; - CRemConDatabaseUnawareNowPlayingTarget* iNowPlaying; - - CActiveConsole* iMtUpdaterConsole; - CActiveCallBackConsole* iMtBrowseConsole; - - TInt iIndex; - MPlayerEventsObserver::TPlaybackStatus iPlaybackStatus; - MPlayerEventsObserver::TTargetBatteryStatus iBatteryStatus; - TUint32 iPosition; - TUint32 iLength; - - - RArray iNotificationEvents; - RArray iCompanyIds; - - TInt iFolderDepth; - - TUint iUidCounter; - - TBool iMediaBrowseThreadOpen; - RThread iMediaBrowseThread; - CStopBrowseWatcher* iMtBrowseStopper; - }; - -#endif //TAVSRCMTUPDATER_H diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothcommsprofiles/btpan/group/btpan.iby --- a/bluetoothcommsprofiles/btpan/group/btpan.iby Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothcommsprofiles/btpan/group/btpan.iby Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -34,11 +34,11 @@ REM *** Now for things which should only be included if the device REM *** supports bluetooth, to save ROM space... -#ifdef SYMBIAN_EXCLUDE_BLUETOOTH +#ifndef __BT REM Feature BLUETOOTH is not in this ROM (btpan.iby) #else -// !SYMBIAN_EXCLUDE_BLUETOOTH +// __BT file=ABI_DIR\BT_DIR\panagt.agt System\Libs\panagt.agt file=ABI_DIR\BT_DIR\panhelper.dll System\Libs\panhelper.dll @@ -50,7 +50,7 @@ #endif #endif -// SYMBIAN_EXCLUDE_BLUETOOTH +// __BT #endif // __BTPAN_IBY__ diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothmgmt/bluetoothclientlib/avlib/avdtpTypes.cpp --- a/bluetoothmgmt/bluetoothclientlib/avlib/avdtpTypes.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/avlib/avdtpTypes.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -37,7 +37,7 @@ // const TInt KMinMediaCodecLOSC = 2; // mediatype, codectype - see figure8-50 AVDTP // const TInt KMinContentProtectionLOSC = 2; // protectiontype -static const TUint KAvdtpSockAddrLocalMask = static_cast(1<<31); +static const TUint KAvdtpSockAddrLocalMask = static_cast(1U<<31U); /** Default constructor using 0 as the parameter for setPort() diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothmgmt/bluetoothclientlib/btlib/btbaseband.cpp --- a/bluetoothmgmt/bluetoothclientlib/btlib/btbaseband.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/btlib/btbaseband.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2003-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" @@ -18,6 +18,7 @@ #include #include #include +#include #include "btsocketpanic.h" //................................. diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothmgmt/bluetoothclientlib/inc/bttypes.h --- a/bluetoothmgmt/bluetoothclientlib/inc/bttypes.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/inc/bttypes.h Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1999-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" @@ -745,6 +745,20 @@ const TUint KLIAC=0x9e8b00; /** +@publishedAll +@released + +HCI Scan enable mask +*/ +enum THCIScanEnable + { + ENoScansEnabled = 0x00, /*!< No scans enabled */ + EInquiryScanOnly = 0x01, /*!< Inquiry scan enabled */ + EPageScanOnly = 0x02, /*!< Page scan enabled */ + EInquiryAndPageScan = 0x03 /*!< Inquiry and page scan enabled */ + }; + +/** L2CAP channel modes @publishedAll @released diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothmgmt/bluetoothclientlib/inc/pairing.h --- a/bluetoothmgmt/bluetoothclientlib/inc/pairing.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothmgmt/bluetoothclientlib/inc/pairing.h Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -24,6 +24,7 @@ #include #include +#include /** The UID indicating the dedicated bonding service request. diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothmgmt/btmgr/BTManServer/btmanserverburmgr.cpp --- a/bluetoothmgmt/btmgr/BTManServer/btmanserverburmgr.cpp Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothmgmt/btmgr/BTManServer/btmanserverburmgr.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -19,6 +19,7 @@ #include #include #include +#include #include "btmanserverutil.h" #include "btmanserverburmgr.h" #include "BTManServer.h" diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothmgmt/btrom/bluetooth.iby --- a/bluetoothmgmt/btrom/bluetooth.iby Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothmgmt/btrom/bluetooth.iby Tue Aug 31 16:20:16 2010 +0300 @@ -58,7 +58,7 @@ file=ABI_DIR\BT_DIR\sdpagent.dll System\Libs\sdpagent.dll REM Bluetooth AV user libraries -file=ABI_DIR\BT_DIR\bluetoothav.dll System\Libs\bluetoothAV.dll +file=ABI_DIR\BT_DIR\bluetoothAV.dll System\Libs\bluetoothAV.dll file=ABI_DIR\BT_DIR\gavdp.dll System\Libs\gavdp.dll REM Generic Remote Control Framework @@ -80,7 +80,7 @@ REM *** Now for things which should only be included if the device REM *** supports bluetooth, to save ROM space... -#ifdef SYMBIAN_EXCLUDE_BLUETOOTH +#ifndef __BT REM Feature BLUETOOTH is not in this ROM (bluetooth.iby) #else @@ -88,7 +88,7 @@ data=ZPRIVATE\100069cc\backup_registration.xml Private\100069cc\backup_registration.xml REM default is to run Esock_BT thread in DealerPlayer role -data=ZPRIVATE\101f7988\esock_bt.cmi private\101F7988\esock_bt.cmi +data=ZPRIVATE\101F7988\esock_bt.cmi private\101F7988\esock_bt.cmi file=ABI_DIR\BT_DIR\btcomm.csy System\Libs\btcomm.csy @@ -102,8 +102,8 @@ REM Bluetooth using HCI API Version 2 file=ABI_DIR\BT_DIR\bt_v2.prt System\Libs\bt_v2.prt REM Stack configuration files -data=ZPRIVATE\101f7989\esock\bt.bt_v2.esk Private\101f7989\ESock\bt.bt_v2.esk -data=ZPRIVATE\101f7989\bluetooth\bluetooth_stack.ini Private\101F7989\Bluetooth\bluetooth_stack.ini +data=ZPRIVATE\101f7989\ESock\bt.bt_v2.esk Private\101f7989\ESock\bt.bt_v2.esk +data=ZPRIVATE\101F7989\Bluetooth\bluetooth_stack.ini Private\101F7989\Bluetooth\bluetooth_stack.ini REM HCI Shared binary file=ABI_DIR\BT_DIR\hcishared.dll System\Libs\hcishared.dll @@ -133,7 +133,7 @@ #endif // BLUETOOTH_NO_AV -#endif // SYMBIAN_EXCLUDE_BLUETOOTH +#endif // __BT #endif diff -r 786b94c6f0a4 -r 5b153be919d4 bluetoothmgmt/btrom/hci.iby --- a/bluetoothmgmt/btrom/hci.iby Thu Aug 19 11:01:00 2010 +0300 +++ b/bluetoothmgmt/btrom/hci.iby Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -32,8 +32,12 @@ REM Symbian HCIv2 Framework DLLs - must be included #include -REM Reference HCIv2 DLLs - this will be branched/overwritten by the licensee to include the relevant files +REM hci_implementation.iby is provided elsewhere (platform-specific). +REM Use reference HCI implementation for H4, H6 and Naviengine. +#if ( defined __MOMAP24XX_H4HRP__ || defined __MOMAP34XX_SDP__ || defined __NE1_TB__ ) +#include +#else #include +#endif #endif // __HCI_IBY__ - diff -r 786b94c6f0a4 -r 5b153be919d4 bthci/bthci2/corehci/interface/hcitypes.h --- a/bthci/bthci2/corehci/interface/hcitypes.h Thu Aug 19 11:01:00 2010 +0300 +++ b/bthci/bthci2/corehci/interface/hcitypes.h Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2006-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" @@ -181,17 +181,6 @@ EPointToPointAndBroadcastEncryption = 0x02, /*!< Point to point and broadcast encryption enabled */ }; -enum THCIScanEnable -/** -HCI Scan enable mask -*/ - { - ENoScansEnabled = 0x00, /*!< No HCI scans enabled */ - EInquiryScanOnly = 0x01, /*!< HCI inquiry scan enabled */ - EPageScanOnly = 0x02, /*!< HCI page scan enabled */ - EInquiryAndPageScan = 0x03 /*!< HCI inquiry and page scan enabled */ - }; - enum THCIInquiryMode /** HCI Inquiry mode flag diff -r 786b94c6f0a4 -r 5b153be919d4 bthci/bthci2/group/hci_framework.iby --- a/bthci/bthci2/group/hci_framework.iby Thu Aug 19 11:01:00 2010 +0300 +++ b/bthci/bthci2/group/hci_framework.iby Tue Aug 31 16:20:16 2010 +0300 @@ -32,6 +32,6 @@ file=ABI_DIR\HCIF_DIR\hcicmdq.dll System\Libs\hcicmdq.dll REM Command Queue configuration file -data=ZPRIVATE\101f7989\bluetooth\cmdq.ini Private\101F7989\Bluetooth\cmdq.ini +data=ZPRIVATE\101F7989\Bluetooth\cmdq.ini Private\101F7989\Bluetooth\cmdq.ini #endif // HCI_FRAMEWORK_IBY diff -r 786b94c6f0a4 -r 5b153be919d4 bthci/hci2implementations/group/bld.inf --- a/bthci/hci2implementations/group/bld.inf Thu Aug 19 11:01:00 2010 +0300 +++ b/bthci/hci2implementations/group/bld.inf Tue Aug 31 16:20:16 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2006-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" @@ -27,4 +27,4 @@ #include "../CommandsEvents/symbian/group/bld.inf" PRJ_EXPORTS -hci_implementation.iby /epoc32/rom/include/hci_implementation.iby +hci_implementation_reference.iby /epoc32/rom/include/hci_implementation_reference.iby diff -r 786b94c6f0a4 -r 5b153be919d4 bthci/hci2implementations/group/hci_implementation.iby --- a/bthci/hci2implementations/group/hci_implementation.iby Thu Aug 19 11:01:00 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: -// - -#ifndef HCI_IMPLMENTATION_IBY -#define HCI_IMPLMENTATION_IBY - -// If __HCI_DEBUG__ is defined pull in debug versions of the -// HCI DLLs and Plugins regardless of the ROM type -#ifdef __HCI_DEBUG__ -define HCI_DIR UDEB -#define HCI_PLUGIN ECOM_PLUGIN_UDEB -#else -define HCI_DIR BUILD_DIR -#define HCI_PLUGIN ECOM_PLUGIN -#endif - -#include -#include -#include - -#ifdef HCI_TI - -#include -#include - -#else // CSR + Default - -#include -#include - -#endif - -#endif // HCI_IMPLMENTATION_IBY diff -r 786b94c6f0a4 -r 5b153be919d4 bthci/hci2implementations/group/hci_implementation_reference.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bthci/hci2implementations/group/hci_implementation_reference.iby Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-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 HCI_IMPLEMENTATION_REFERENCE_IBY +#define HCI_IMPLEMENTATION_REFERENCE_IBY + +// If __HCI_DEBUG__ is defined pull in debug versions of the +// HCI DLLs and Plugins regardless of the ROM type +#ifdef __HCI_DEBUG__ +define HCI_DIR UDEB +#define HCI_PLUGIN ECOM_PLUGIN_UDEB +#else +define HCI_DIR BUILD_DIR +#define HCI_PLUGIN ECOM_PLUGIN +#endif + +#include +#include +#include + +#ifdef HCI_TI + +#include +#include + +#else // CSR + Default + +#include +#include + +#endif + +#endif // HCI_IMPLEMENTATION_REFERENCE_IBY diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/EABI/btaudioadaptationU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/EABI/btaudioadaptationU.DEF Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,10 @@ +EXPORTS + _ZN23CBTAudioStreamInputBase4NewLER22MBTAudioStreamObserverR21MBTAudioErrorObserver @ 1 NONAME + _ZN29CBTAudioStreamInputAdaptation10DisconnectEv @ 2 NONAME + _ZN29CBTAudioStreamInputAdaptation13BufferEmptiedERK6TDesC8 @ 3 NONAME + _ZN29CBTAudioStreamInputAdaptation16EncoderInterfaceE4TUid @ 4 NONAME + _ZN29CBTAudioStreamInputAdaptation4StopEv @ 5 NONAME + _ZN29CBTAudioStreamInputAdaptation5StartEv @ 6 NONAME + _ZN29CBTAudioStreamInputAdaptation7ConnectEv @ 7 NONAME + _ZN29CBTAudioStreamInputAdaptation9SetFormatE7TFourCC @ 8 NONAME + diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/bwins/btaudioadaptationU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/bwins/btaudioadaptationU.DEF Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,10 @@ +EXPORTS + ?NewL@CBTAudioStreamInputBase@@SAPAV1@AAVMBTAudioStreamObserver@@AAVMBTAudioErrorObserver@@@Z @ 1 NONAME ; class CBTAudioStreamInputBase * CBTAudioStreamInputBase::NewL(class MBTAudioStreamObserver &, class MBTAudioErrorObserver &) + ?BufferEmptied@CBTAudioStreamInputAdaptation@@UAEXABVTDesC8@@@Z @ 2 NONAME ; void CBTAudioStreamInputAdaptation::BufferEmptied(class TDesC8 const &) + ?Connect@CBTAudioStreamInputAdaptation@@UAEHXZ @ 3 NONAME ; int CBTAudioStreamInputAdaptation::Connect(void) + ?Disconnect@CBTAudioStreamInputAdaptation@@UAEXXZ @ 4 NONAME ; void CBTAudioStreamInputAdaptation::Disconnect(void) + ?EncoderInterface@CBTAudioStreamInputAdaptation@@UAEPAXVTUid@@@Z @ 5 NONAME ; void * CBTAudioStreamInputAdaptation::EncoderInterface(class TUid) + ?SetFormat@CBTAudioStreamInputAdaptation@@UAEHVTFourCC@@@Z @ 6 NONAME ; int CBTAudioStreamInputAdaptation::SetFormat(class TFourCC) + ?Start@CBTAudioStreamInputAdaptation@@UAEHXZ @ 7 NONAME ; int CBTAudioStreamInputAdaptation::Start(void) + ?Stop@CBTAudioStreamInputAdaptation@@UAEXXZ @ 8 NONAME ; void CBTAudioStreamInputAdaptation::Stop(void) + diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/group/bld.inf Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,27 @@ +/* +* 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 information file for project btaudioadaptation_stub +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +#if defined __BT_STEREO_AUDIO + +PRJ_MMPFILES +../group/btaudiostreaminputadaptation.mmp + +#endif // __BT_STEREO_AUDIO diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/group/btaudiostreaminputadaptation.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/group/btaudiostreaminputadaptation.mmp Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,45 @@ +/* +* 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: Project definition file for project btaudioadaptation_stub +* +*/ + + +#include + +#if defined(WINS) || defined(WINSCW) +TARGET btaudioadaptation.dll +#else +TARGET btaudioadaptation_stub.dll +#endif + +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008d 0x10208977 + +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE btaudiostreaminputadaptation.cpp + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib // user library + +DEBUGLIBRARY flogger.lib // file logging services + +EXPORTLIBRARY btaudioadaptation.lib +LINKAS btaudioadaptation.dll diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/inc/btaudioadaptationdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/inc/btaudioadaptationdebug.h Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,150 @@ +/* +* 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: Debug definitions for BT Audio Adaptation +* +*/ + + +#ifndef BT_AUDIO_ADAPTATION_DEBUG_H +#define BT_AUDIO_ADAPTATION_DEBUG_H + +#include + + +#ifdef _DEBUG + +// Print options + +#define KPRINTERROR 0x00000001 // Print error +#define KPRINTFTRACE 0x00000002 // Print function trace +#define KPRINTSTATE 0x00000004 // Print state machine infos + +const TInt KDebugMask = KPRINTERROR | KPRINTFTRACE | KPRINTSTATE ; + + +// Un-comment/comment this definition to enable/disable memory tracing +//#define MEMTRACE + +#ifdef __WINS__ + +// File logging for WINS +#define __FLOGGING__ + +#else + +// Logging with RDebug for target HW +#define __CLOGGING__ + +#endif //__WINS__ + +#endif // _DEBUG + + +// ================================================================== +// File logging +// ================================================================== +// +#if defined(__FLOGGING__) + +#include + +_LIT(KLogFile,"BTAudioAdaptationLog.txt"); +_LIT(KLogDirFullName,"c:\\logs\\bt\\"); +_LIT(KLogDir,"BT"); + +#include +#include + +#define FLOG(a) { FPrint(a); } + +#define FTRACE(a) { a; } + +#define BT_AUDIO_ADAPTATION_TRACE_OPT(a,p) {if((KDebugMask)&(a))p;} + + + + +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list); +#ifdef MEMTRACE + TInt size; + User::Heap().AllocSize(size); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, _L("[BTAudioAdaptation]\t MEM\tAllocated from heap: %d B. Total heap size: %d B"), size, User::Heap().Size()); +#endif + } + + +inline void FHex(const TUint8* aPtr, TInt aLen) + { + RFileLogger::HexDump(KLogDir, KLogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); + } + + +inline void FHex(const TDesC8& aDes) + { + FHex(aDes.Ptr(), aDes.Length()); + } + + +// ================================================================== +// RDebug logging +// ================================================================== +// +#elif defined(__CLOGGING__) + +#include + +#define FLOG(a) { RDebug::Print(a); } + +#define FHex(a) + +#define FTRACE(a) { a; } + +#define BT_AUDIO_ADAPTATION_TRACE_OPT(a,p) {if((KDebugMask)&(a))p;} + + +inline void FPrint(const TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); + } + + +// ================================================================== +// No loggings --> Reduced binary size +// ================================================================== +// +#else // if no __FLOGGING__ and no __CLOGGING__ + +#define FLOG(a) + +#define FTRACE(a) + +#define FHex(a) + +#define BT_AUDIO_ADAPTATION_TRACE_OPT(a,p) + +#endif // ...loggings + +#endif // BTAUDIOADAPTATION_DEBUG_H + +// End of File diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/inc/btaudiostreaminputadaptation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/inc/btaudiostreaminputadaptation.h Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,146 @@ +/* +* 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: This header specifies the implementation of BT Audio Adaptation API. +* +*/ + + +#ifndef __BTAUDIOSTREAMINPUTADAPTATION_H__ +#define __BTAUDIOSTREAMINPUTADAPTATION_H__ + +#include +#include +#include "btaudiostreaminputbase.h" + +/** + * This class implements the interface specified by CBTAudioStreamInputBase. + * + * This class contains the stub implementation of the CAudioStreamInputAdaptation, + * that inherits from CBTAudioStreamInputBase. + * + * To the user it seems as if he's operating with the base class, because he calls, + * but in practice the class he uses is an instance of this class. + * + * @lib btaudioadaptation.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS(CBTAudioStreamInputAdaptation) : public CBTAudioStreamInputBase + { + public: + static CBTAudioStreamInputAdaptation* NewL( MBTAudioStreamObserver& aStreamObserver, MBTAudioErrorObserver& aErrorObserver ); + virtual ~CBTAudioStreamInputAdaptation(); + + public: + /** + * From CBTAudioStreamInputBase. + * This method is called when the client has processed the buffer it got + * from the Receive method. + * + * See BT Audio Adaptation API and BT Audio Adaptation Design specifications + * for detailed explanation. + * + * @since S60 v3.1 + * @param aBuffer refers to the buffer that was received earlier in the Receive method. + * @return void + */ + IMPORT_C void BufferEmptied( const TDesC8& aBuffer ); + + /** + * From CBTAudioStreamInputBase. + * This method is for connecting to the audio subsystem. + * + * See BT Audio Adaptation API and BT Audio Adaptation Design specifications + * for detailed explanation. + * + * @since S60 v3.1 + * @param void. + * @return a Symbian OS wide error code. + */ + IMPORT_C TInt Connect(); + + /** + * From CBTAudioStreamInputBase. + * This method is for disconnecting from the audio subsystem. + * + * See BT Audio Adaptation API and BT Audio Adaptation Design specifications + * for detailed explanation. + * + * @since S60 v3.1 + * @param void. + * @return void + */ + IMPORT_C void Disconnect(); + + /** + * From CBTAudioStreamInputBase. + * This method is for passing the custom interfaces that are + * needed sometimes for configuring the hardware encoder. + * + * See BT Audio Adaptation API and BT Audio Adaptation Design specifications + * for detailed explanation. + * + * @since S60 v3.1 + * @param aInterfaceId specifies the id of custom interface that the client + * wants to get. + * @return A pointer to the requested interface. Client must cast it into a correct class. + */ + IMPORT_C TAny* EncoderInterface(TUid aInterfaceId); + + /** + * From CBTAudioStreamInputBase. + * This method is for choosing the encoder for the audio data. + * + * See BT Audio Adaptation API and BT Audio Adaptation Design specifications + * for detailed explanation. + * + * @since S60 v3.1 + * @param aDesiredFourCC specifies the encoder that the client wants to use. + * @return a Symbian OS wide error code. + */ + IMPORT_C TInt SetFormat(TFourCC aDesiredFourCC); + + /** + * From CBTAudioStreamInputBase. + * This method is for starting the recording from the audio subsystem. + * + * See BT Audio Adaptation API and BT Audio Adaptation Design specifications + * for detailed explanation. + * + * @since S60 v3.1 + * @param void. + * @return a Symbian OS wide error code. + */ + IMPORT_C TInt Start(); + + /** + * From CBTAudioStreamInputBase. + * This method is for stopping the recording from the audio subsystem. + * + * See BT Audio Adaptation API and BT Audio Adaptation Design specifications + * for detailed explanation. + * + * @since S60 v3.1 + * @param void. + * @return a Symbian OS wide error code. + */ + IMPORT_C void Stop(); + + private: + CBTAudioStreamInputAdaptation(MBTAudioStreamObserver& aStreamObserver, MBTAudioErrorObserver& aErrorObserver); + void ConstructL(); + void RunL(); + void DoCancel(); + }; + +#endif diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/layers.sysdef.xml Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,15 @@ + + +]> + + + + + + + + + + + diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/rom/btaudioadaptation.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/rom/btaudioadaptation.iby Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,23 @@ +/* +* 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 __BTAUDIOADAPTATION_IBY__ +#define __BTAUDIOADAPTATION_IBY__ + +file=ABI_DIR\BUILD_DIR\btaudioadaptation_stub.dll SHARED_LIB_DIR\btaudioadaptation.dll + +#endif diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/src/btaudiostreaminputadaptation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/src/btaudiostreaminputadaptation.cpp Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,150 @@ +/* +* 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: Contains stub implementation of CBTAudioStreamInputAdaptation class, +* which implements BT Audio Adaptation API. +* +*/ + + +#include + +#include "btaudiostreaminputadaptation.h" +#include "btaudioadaptationdebug.h" + +CBTAudioStreamInputAdaptation::CBTAudioStreamInputAdaptation(MBTAudioStreamObserver& /*aStreamObserver*/, MBTAudioErrorObserver& /*aErrorObserver*/) + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::CBTAudioStreamInputAdaptation() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::CBTAudioStreamInputAdaptation() <-"))); + } + +void CBTAudioStreamInputAdaptation::ConstructL() + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::ConstructL() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::ConstructL() <-"))); + } + +// --------------------------------------------------------------------------- +// Static factory method for the abstract base class. +// This just calls the factory method of the concrete implementation class. +// --------------------------------------------------------------------------- +// +EXPORT_C CBTAudioStreamInputBase* CBTAudioStreamInputBase::NewL(MBTAudioStreamObserver& aStreamObserver, MBTAudioErrorObserver& aErrorObserver) + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioInput::NewL() ->"))); + CBTAudioStreamInputBase* audioInput = (CBTAudioStreamInputAdaptation::NewL(aStreamObserver, aErrorObserver)); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioInput::NewL() <-"))); + return audioInput; + } + +// --------------------------------------------------------------------------- +// Static factory method. +// --------------------------------------------------------------------------- +// +CBTAudioStreamInputAdaptation* CBTAudioStreamInputAdaptation::NewL(MBTAudioStreamObserver& aStreamObserver, MBTAudioErrorObserver& aErrorObserver) + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::NewL() ->"))); + CBTAudioStreamInputAdaptation* self = new (ELeave) CBTAudioStreamInputAdaptation(aStreamObserver, aErrorObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::NewL() <-"))); + return self; + } + +CBTAudioStreamInputAdaptation::~CBTAudioStreamInputAdaptation() + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::~CBTAudioStreamInputAdaptation() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::~CBTAudioStreamInputAdaptation() <-"))); + } + +// --------------------------------------------------------------------------- +// From class CBTAudioStreamInputBase. +// Returns KErrNotSupported always - this is the stub implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CBTAudioStreamInputAdaptation::Start() + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Start() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Start() <-"))); + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// From class CBTAudioStreamInputBase. +// Returns a NULL pointer always - this is the stub implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C TAny* CBTAudioStreamInputAdaptation::EncoderInterface(TUid /*aInterfaceId*/) + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::EncoderInterface() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::EncoderInterface() <-"))); + return (TAny *) 0; + } + +// --------------------------------------------------------------------------- +// From class CBTAudioStreamInputBase. +// Doesn't do anything - this is the stub implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C void CBTAudioStreamInputAdaptation::BufferEmptied( const TDesC8& /*aBuffer*/ ) + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::BufferEmptied() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::BufferEmptied() <-"))); + } + +// --------------------------------------------------------------------------- +// From class CBTAudioStreamInputBase. +// Doesn't do anything - this is the stub implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C void CBTAudioStreamInputAdaptation::Stop() + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Stop() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Stop() <-"))); + } + +// --------------------------------------------------------------------------- +// From class CBTAudioStreamInputBase. +// Returns KErrNotSupported always - this is the stub implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CBTAudioStreamInputAdaptation::SetFormat(TFourCC /*aDesiredFourCC*/) + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::SetFormat() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::SetFormat() <-"))); + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// From class CBTAudioStreamInputBase. +// Returns KErrNotSupported always - this is the stub implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CBTAudioStreamInputAdaptation::Connect() + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Connect() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Connect() <-"))); + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// From class CBTAudioStreamInputBase. +// Doesn't do anything - this is the stub implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C void CBTAudioStreamInputAdaptation::Disconnect() + { + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Disconnect() ->"))); + BT_AUDIO_ADAPTATION_TRACE_OPT( KPRINTFTRACE, FLOG(_L("[BTAudioAdaptation]\t CBTAudioStreamInputAdaptation::Disconnect() <-"))); + } diff -r 786b94c6f0a4 -r 5b153be919d4 btsimulator/btaudioadaptation_stub/sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/btsimulator/btaudioadaptation_stub/sysdef_1_4_0.dtd Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 786b94c6f0a4 -r 5b153be919d4 package_definition.xml --- a/package_definition.xml Thu Aug 19 11:01:00 2010 +0300 +++ b/package_definition.xml Tue Aug 31 16:20:16 2010 +0300 @@ -1,87 +1,104 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 786b94c6f0a4 -r 5b153be919d4 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Tue Aug 31 16:20:16 2010 +0300 @@ -0,0 +1,2 @@ + + \ No newline at end of file