# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282119517 -10800 # Node ID 169364e7e4b400032a4eb2b6e824e86cccb449ac # Parent 7259cf1302ad130cff7b3c55155477963d5a5f6d Revision: 201033 Kit: 201033 diff -r 7259cf1302ad -r 169364e7e4b4 group/bld.inf --- a/group/bld.inf Tue Jul 06 16:05:13 2010 +0300 +++ b/group/bld.inf Wed Aug 18 11:18:37 2010 +0300 @@ -19,8 +19,6 @@ */ #include "../osrndtools_plat/group/bld.inf" -#include "../stif/group/bld.inf" #include "../memspy/group/bld.inf" -#include "../hti/group/bld.inf" #include "../piprofiler/group/bld.inf" #include "../analyzetool/group/bld.inf" \ No newline at end of file diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiAutoStart/data/10210CC4.rss --- a/hti/HtiAutoStart/data/10210CC4.rss Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for the HtiAutoStart. -* -*/ - - -// INCLUDES -#include - -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x10210CC4; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x101F7D87; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10210CC5; - version_no = 1; - display_name = "Hti autostart"; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } - - -// End of File diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiAutoStart/group/HtiAutoStart.mmp --- a/hti/HtiAutoStart/group/HtiAutoStart.mmp Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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: Recognizer for starting HTI automatically on device start-up. -* -*/ - - -#include - -TARGET HtiAutoStart.dll -TARGETTYPE PLUGIN - -UID 0x10009D8D 0x10210CC4 - -VENDORID 0x101FB657 - -CAPABILITY ALL -TCB - -SOURCEPATH ../src -SOURCE HtiAutoStart.cpp - -LANG SC - -USERINCLUDE ../inc -OS_LAYER_SYSTEMINCLUDE - -START RESOURCE ../data/10210CC4.rss -TARGET HtiAutoStart.rsc -END - -LIBRARY euser.lib -LIBRARY apmime.lib -LIBRARY ecom.lib - -LIBRARY flogger.lib - -SMPSAFE - -// End of File diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiAutoStart/group/bld.inf --- a/hti/HtiAutoStart/group/bld.inf Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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: Build information file for HtiAutoStart -* -*/ - - -PRJ_PLATFORMS - -PRJ_EXPORTS - -PRJ_MMPFILES -HtiAutoStart.mmp - - -// End of File diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiAutoStart/inc/HtiAutoStart.h --- a/hti/HtiAutoStart/inc/HtiAutoStart.h Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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: Implementation of recognizer that automatically starts HTI -* on device start-up if the device is configured to load -* data recognizers during start-up. -* -*/ - - -#ifndef __HTIAUTOSTART_H -#define __HTIAUTOSTART_H - - -// INCLUDES -#include -#include - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** -* Implements CHtiAutostart -*/ -class CHtiAutostart : public CApaDataRecognizerType - { - public: // new functions - static CApaDataRecognizerType* CreateRecognizerL(); - CHtiAutostart(); - static void StartThread(); - static TInt StartAppThreadFunction( TAny* aParam ); - static void StartAppThreadFunctionL(); - - public: // from CApaDataRecognizerType - - TUint PreferredBufSize(); - TDataType SupportedDataTypeL( TInt aIndex ) const; - - private: // from CApaDataRecognizerType - - void DoRecognizeL( const TDesC& aName, const TDesC8& aBuffer ); - }; - -#endif // __HTIAUTOSTART_H - -// End of File diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiAutoStart/src/HtiAutoStart.cpp --- a/hti/HtiAutoStart/src/HtiAutoStart.cpp Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +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: HtiAutoStart implementation -* -*/ - - -// INCLUDE FILES -#include "HtiAutoStart.h" -#include -#include - -// CONSTANTS -const static TUint KHtiAutoStartImplUid = 0x10210CC5; -const static TUid KHtiAutoStartUid = {0x10210CC4}; -_LIT( KHtiFrameworkExe, "HtiFramework.exe" ); -_LIT( KHtiMatchPattern, "HtiFramework*" ); - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( KHtiAutoStartImplUid, - CHtiAutostart::CreateRecognizerL ) - }; - -// MACROS -#ifdef __ENABLE_LOGGING__ - -#include -_LIT( KLogFolder, "hti" ); -_LIT( KLogFile, "htiautostart.txt" ); - -#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);} -#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, a1);} -#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));} - -#else // !__ENABLE_LOGGING__ - -#define HTI_LOG_TEXT(a1) -#define HTI_LOG_DES(a1) -#define HTI_LOG_FORMAT(a1,a2) - -#endif // __ENABLE_LOGGING__ - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================ MEMBER FUNCTIONS =============================== - -// ---------------------------------------------------------------------------- -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - HTI_LOG_TEXT( "ImplementationGroupProxy" ); - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// ---------------------------------------------------------------------------- -CApaDataRecognizerType* CHtiAutostart::CreateRecognizerL() - { - HTI_LOG_TEXT( "CreateRecognizerL" ); - CApaDataRecognizerType* recognizer = new CHtiAutostart(); - CHtiAutostart::StartThread(); - return recognizer; - } - -// ---------------------------------------------------------------------------- -CHtiAutostart::CHtiAutostart() - :CApaDataRecognizerType( KHtiAutoStartUid, CApaDataRecognizerType::ENormal ) - { - HTI_LOG_TEXT( "CHtiAutostart constructor" ); - iCountDataTypes = 1; - } - -// ---------------------------------------------------------------------------- -TUint CHtiAutostart::PreferredBufSize() - { - HTI_LOG_TEXT( "PreferredBufSize" ); - return 0; - } - -// ---------------------------------------------------------------------------- -TDataType CHtiAutostart::SupportedDataTypeL( TInt /*aIndex*/ ) const - { - HTI_LOG_TEXT( "SupportedDataTypeL" ); - return TDataType(); - } - -// ---------------------------------------------------------------------------- -void CHtiAutostart::DoRecognizeL( const TDesC& /*aName*/, - const TDesC8& /*aBuffer*/ ) - { - HTI_LOG_TEXT( "DoRecognizeL" ); - } - -// ---------------------------------------------------------------------------- -void CHtiAutostart::StartThread() - { - HTI_LOG_TEXT( "StartThread" ); - //create a new thread for starting our application - RThread* startAppThread = new RThread(); - - User::LeaveIfError( startAppThread->Create( - _L( "HtiAutostart" ), - CHtiAutostart::StartAppThreadFunction, - KDefaultStackSize, - KMinHeapSize, - KMinHeapSize, - NULL, - EOwnerThread ) ); - - startAppThread->SetPriority( EPriorityNormal ); - startAppThread->Resume(); - startAppThread->Close(); - delete startAppThread; - } - -// ---------------------------------------------------------------------------- -TInt CHtiAutostart::StartAppThreadFunction( TAny* /*aParam*/ ) - { - HTI_LOG_TEXT( "StartAppThreadFunction" ); - // create a TRAP cleanup - CTrapCleanup * cleanup = CTrapCleanup::New(); - TInt err; - if ( cleanup == NULL ) - { - err = KErrNoMemory; - } - else - { - TRAP( err, StartAppThreadFunctionL() ); - } - delete cleanup; - - if ( err != KErrNone ) - { - HTI_LOG_FORMAT( "StartAppThreadFunctionL leave %d", err ); - User::Panic( _L( "HtiAutostart" ), err ); - } - - return err; - } - -// ---------------------------------------------------------------------------- -void CHtiAutostart::StartAppThreadFunctionL() - { - HTI_LOG_TEXT( "StartAppThreadFunctionL" ); - // Check if HtiFramework is already running - TFullName processName; - TFindProcess finder( KHtiMatchPattern ); - TInt err = finder.Next( processName ); - if ( err == KErrNone ) - { - HTI_LOG_TEXT( "HtiFramework.exe already running, nothing to do" ); - return; - } - - RProcess prs; - err = prs.Create( KHtiFrameworkExe, KNullDesC ); - if ( err == KErrNone ) - { - prs.Resume(); - prs.Close(); - HTI_LOG_TEXT( "HtiFramework.exe process created" ); - } - else - { - HTI_LOG_FORMAT( "HtiFramework.exe process creation failed %d", err ); - User::Leave( err ); - } - } - -// End of File diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCfg/bwins/HtiCfgu.def --- a/hti/HtiCfg/bwins/HtiCfgu.def Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - ?SetParameterL@CHtiCfg@@QAEHABVTDesC8@@0@Z @ 1 NONAME ; int CHtiCfg::SetParameterL(class TDesC8 const &, class TDesC8 const &) - ?NewLC@CHtiCfg@@SAPAV1@XZ @ 2 NONAME ; class CHtiCfg * CHtiCfg::NewLC(void) - ?LoadCfgL@CHtiCfg@@QAEXABVTDesC16@@0@Z @ 3 NONAME ; void CHtiCfg::LoadCfgL(class TDesC16 const &, class TDesC16 const &) - ??1CHtiCfg@@UAE@XZ @ 4 NONAME ; CHtiCfg::~CHtiCfg(void) - ?GetParameterL@CHtiCfg@@QAE?AVTPtrC8@@ABVTDesC8@@@Z @ 5 NONAME ; class TPtrC8 CHtiCfg::GetParameterL(class TDesC8 const &) - ?GetParameterIntL@CHtiCfg@@QAEHABVTDesC8@@@Z @ 6 NONAME ; int CHtiCfg::GetParameterIntL(class TDesC8 const &) - ?SaveCfgL@CHtiCfg@@QAEXABVTDesC16@@0@Z @ 7 NONAME ; void CHtiCfg::SaveCfgL(class TDesC16 const &, class TDesC16 const &) - ?RemoveParameterL@CHtiCfg@@QAEHABVTDesC8@@@Z @ 8 NONAME ; int CHtiCfg::RemoveParameterL(class TDesC8 const &) - ?NewL@CHtiCfg@@SAPAV1@XZ @ 9 NONAME ; class CHtiCfg * CHtiCfg::NewL(void) - diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCfg/eabi/HtiCfgu.def --- a/hti/HtiCfg/eabi/HtiCfgu.def Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -EXPORTS - _ZN7CHtiCfg13GetParameterLERK6TDesC8 @ 1 NONAME - _ZN7CHtiCfg13SetParameterLERK6TDesC8S2_ @ 2 NONAME - _ZN7CHtiCfg16GetParameterIntLERK6TDesC8 @ 3 NONAME - _ZN7CHtiCfg16RemoveParameterLERK6TDesC8 @ 4 NONAME - _ZN7CHtiCfg4NewLEv @ 5 NONAME - _ZN7CHtiCfg5NewLCEv @ 6 NONAME - _ZN7CHtiCfg8LoadCfgLERK7TDesC16S2_ @ 7 NONAME - _ZN7CHtiCfg8SaveCfgLERK7TDesC16S2_ @ 8 NONAME - _ZN7CHtiCfgD0Ev @ 9 NONAME - _ZN7CHtiCfgD1Ev @ 10 NONAME - _ZN7CHtiCfgD2Ev @ 11 NONAME - _ZTI7CHtiCfg @ 12 NONAME ; ## - _ZTV7CHtiCfg @ 13 NONAME ; ## - diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCfg/group/HtiCfg.mmp --- a/hti/HtiCfg/group/HtiCfg.mmp Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: HtiCfg project definition. -* -*/ - - -#include - -TARGET HtiCfg.dll -TARGETTYPE DLL - -UID 0x1000008d 0x200212DD - -VENDORID 0x101FB657 - -CAPABILITY ALL -TCB - -SOURCEPATH ../src -SOURCE HtiCfg.cpp - -USERINCLUDE ../inc -OS_LAYER_SYSTEMINCLUDE - -LIBRARY bafl.lib -LIBRARY efsrv.lib -LIBRARY euser.lib -LIBRARY flogger.lib - -SMPSAFE - -// End of file diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCfg/group/bld.inf --- a/hti/HtiCfg/group/bld.inf Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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: HtiCfg build info -* -*/ - - -PRJ_PLATFORMS - -PRJ_EXPORTS - -PRJ_MMPFILES -HtiCfg.mmp - - -// End of file diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCfg/src/HtiCfg.cpp --- a/hti/HtiCfg/src/HtiCfg.cpp Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,331 +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: CHtiCfg implementation -* -*/ - -// INCLUDE FILES -#include "HtiCfg.h" -#include -#include - -// CONSTANTS -const static TInt KCfgArrayGranularity = 5; - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CHtiCfg::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -EXPORT_C CHtiCfg* CHtiCfg::NewL() - { - CHtiCfg* self = NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -EXPORT_C CHtiCfg* CHtiCfg::NewLC() - { - CHtiCfg* self = new ( ELeave ) CHtiCfg(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::CHtiCfg -// Constructor -// ----------------------------------------------------------------------------- -CHtiCfg::CHtiCfg():iCfgParameters( NULL ) - { - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::CHtiCfg -// Destructor -// ----------------------------------------------------------------------------- -EXPORT_C CHtiCfg::~CHtiCfg() - { - if ( iCfgParameters ) - { - iCfgParameters->Reset(); - delete iCfgParameters; - iCfgParameters = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::ConstructL -// Second phase constructor. Private. -// ----------------------------------------------------------------------------- -void CHtiCfg::ConstructL() - { - iCfgParameters = new ( ELeave ) CDesC8ArrayFlat( KCfgArrayGranularity ); - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::LoadCfgL -// Searches the file in all drives and if found reads all parameter lines to the -// iCfgParameters array. -// ----------------------------------------------------------------------------- -EXPORT_C void CHtiCfg::LoadCfgL( const TDesC& aCfgFilePath, - const TDesC& aCfgFileName ) - { - // Reset parameters - if ( iCfgParameters ) - { - iCfgParameters->Reset(); - delete iCfgParameters; - iCfgParameters = NULL; - } - iCfgParameters = new ( ELeave ) CDesC8ArrayFlat( KCfgArrayGranularity ); - - // Open & read file - RFs fsSession; - User::LeaveIfError( fsSession.Connect() ); - CleanupClosePushL( fsSession ); - - TFindFile finder( fsSession ); - TFileName path( aCfgFilePath ); - TInt err = finder.FindByPath( aCfgFileName, &path ); - if ( err != KErrNone ) - { - User::Leave( err ); - } - - TFileName cfgFile = finder.File(); - - RFile file; - User::LeaveIfError( file.Open( fsSession, cfgFile, EFileRead ) ); - CleanupClosePushL( file ); - - TInt fileLength; - User::LeaveIfError( file.Size( fileLength ) ); - - HBufC8* fileData = HBufC8::NewLC( fileLength ); - TPtr8 fileDes = fileData->Des(); - User::LeaveIfError( file.Read( fileDes ) ); - - // Get parameters - TBool eof = EFalse; - while ( !eof ) - { - TInt strEndIndex = fileDes.Locate( KCfgNewLine ); - if ( strEndIndex == KErrNotFound ) - { - strEndIndex = fileDes.Length(); - eof = ETrue; - } - - TPtrC8 line = fileDes.Left( strEndIndex ); - - if ( line.Locate( KCfgComment ) != 0 ) - { - if ( line.Locate( KCfgSeparator ) > 0 ) - { - TBuf8 parameter; - parameter.Copy( line ); - parameter.Trim(); - iCfgParameters->AppendL( parameter ); - } - } - - if ( !eof ) - fileDes = fileDes.Right( fileDes.Length() - ( strEndIndex + 1 ) ); - - } - - CleanupStack::PopAndDestroy( 3 ); // fsSession, fileData, file - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::SaveCfgL -// Writes all parameter lines from iCfgParameters array to the file. -// Existing file is searched from all drives and if found file will be replaced. -// If existing file is not found file will be created to c-drive. -// ----------------------------------------------------------------------------- -EXPORT_C void CHtiCfg::SaveCfgL( const TDesC& aCfgFilePath, - const TDesC& aCfgFileName ) - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - - RFile file; - CleanupClosePushL( file ); - - // Find the file - TFindFile finder( fs ); - TFileName path( aCfgFilePath ); - TFileName cfgFile; - TInt err = finder.FindByPath( aCfgFileName, &path ); - if ( err != KErrNone ) - { - cfgFile.Append( _L ( "c:" ) ); - cfgFile.Append( path ); - cfgFile.Append( aCfgFileName ); - } - else - { - cfgFile = finder.File(); - // If the file was found from ROM, we must save to C-drive. - if ( cfgFile[0] == 'z' || cfgFile[0] == 'Z' ) - { - cfgFile[0] = 'c'; - } - } - - // Replace or create the file - User::LeaveIfError( file.Replace( fs, cfgFile, EFileWrite | EFileShareAny ) ); - - // Write the file - for ( TInt i = 0; i < iCfgParameters->Count(); i++ ) - { - file.Write( iCfgParameters->MdcaPoint( i ) ); - file.Write( _L8( "\n" ) ); - } - - // Close - CleanupStack::PopAndDestroy( 2 ); // fs, file - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::SetParameterL -// ----------------------------------------------------------------------------- -EXPORT_C TInt CHtiCfg::SetParameterL( const TDesC8& aName, - const TDesC8& aValue ) - { - // Does the parameter exist? - for ( TInt i = 0; i < iCfgParameters->Count(); i++ ) - { - TInt sepIndex = - ( iCfgParameters->MdcaPoint( i ) ).Locate( KCfgSeparator ); - if ( sepIndex <= 0 ) - User::Leave( KErrGeneral ); // should not happen - - TPtrC8 name = ( iCfgParameters->MdcaPoint( i ) ).Left( sepIndex ); - if ( name.Compare( aName ) == 0 ) - { - iCfgParameters->Delete( i ); - TBuf8 parameter; - parameter.Append( aName ); - parameter.Append( KCfgSeparator ); - parameter.Append( aValue ); - iCfgParameters->AppendL( parameter ); - return KErrNone; - } - } - - // Apparently not.. add it - TBuf8 parameter; - parameter.Append( aName ); - parameter.Append( KCfgSeparator ); - parameter.Append( aValue ); - iCfgParameters->AppendL( parameter ); - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::RemoveParameterL -// ----------------------------------------------------------------------------- -EXPORT_C TInt CHtiCfg::RemoveParameterL( const TDesC8& aName ) - { - for ( TInt i = 0; i < iCfgParameters->Count(); i++ ) - { - TInt sepIndex = - ( iCfgParameters->MdcaPoint( i ) ).Locate( KCfgSeparator ); - if ( sepIndex <= 0 ) - User::Leave( KErrGeneral ); // should not happen - - TPtrC8 name = ( iCfgParameters->MdcaPoint( i ) ).Left( sepIndex ); - if ( name.Compare( aName ) == 0 ) - { - iCfgParameters->Delete( i ); - return KErrNone; - } - } - - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::GetParameterL -// ----------------------------------------------------------------------------- -EXPORT_C TPtrC8 CHtiCfg::GetParameterL( const TDesC8& aName ) - { - for ( TInt i = 0; i < iCfgParameters->Count(); i++ ) - { - TInt sepIndex = - ( iCfgParameters->MdcaPoint( i ) ).Locate( KCfgSeparator ); - if ( sepIndex <= 0 ) - User::Leave( KErrGeneral ); // should not happen - - TPtrC8 name = ( iCfgParameters->MdcaPoint( i ) ).Left( sepIndex ); - if ( name.Compare( aName ) == 0 ) - { - TPtrC8 value = ( iCfgParameters->MdcaPoint( i ) ).Right( - ( iCfgParameters->MdcaPoint( i ) ).Length() - ( sepIndex + 1 ) ); - return value; - } - } - User::Leave( KErrNotFound ); - return 0; - } - -// ----------------------------------------------------------------------------- -// CHtiCfg::GetParameterIntL -// ----------------------------------------------------------------------------- -EXPORT_C TInt CHtiCfg::GetParameterIntL( const TDesC8& aName ) - { - for ( TInt i = 0; i < iCfgParameters->Count(); i++ ) - { - TInt sepIndex = - ( iCfgParameters->MdcaPoint( i ) ).Locate( KCfgSeparator ); - if ( sepIndex <= 0 ) - User::Leave( KErrGeneral ); // should not happen - - TPtrC8 name = ( iCfgParameters->MdcaPoint( i ) ).Left( sepIndex ); - if ( name.Compare( aName ) == 0 ) - { - TPtrC8 value = ( iCfgParameters->MdcaPoint( i ) ).Right( - ( iCfgParameters->MdcaPoint( i ) ).Length() - ( sepIndex + 1 ) ); - - TLex8 lex( value ); - TInt result; - User::LeaveIfError( lex.Val( result ) ); - return result; - } - } - User::Leave( KErrNotFound ); - return 0; - } - - -// End of file diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommInterfaceu.def --- a/hti/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommInterfaceu.def Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -EXPORTS - ??0RHtiBtCommInterface@@QAE@XZ @ 1 NONAME ; RHtiBtCommInterface::RHtiBtCommInterface(void) - ?CancelReceive@RHtiBtCommInterface@@QAEXXZ @ 2 NONAME ; void RHtiBtCommInterface::CancelReceive(void) - ?CancelSend@RHtiBtCommInterface@@QAEXXZ @ 3 NONAME ; void RHtiBtCommInterface::CancelSend(void) - ?Close@RHtiBtCommInterface@@QAEXXZ @ 4 NONAME ; void RHtiBtCommInterface::Close(void) - ?Connect@RHtiBtCommInterface@@QAEHAAVTDesC8@@H@Z @ 5 NONAME ; int RHtiBtCommInterface::Connect(class TDesC8 &, int) - ?GetPortNumber@RHtiBtCommInterface@@QBEHXZ @ 6 NONAME ; int RHtiBtCommInterface::GetPortNumber(void) const - ?GetReceiveBufferSize@RHtiBtCommInterface@@QBEHXZ @ 7 NONAME ; int RHtiBtCommInterface::GetReceiveBufferSize(void) const - ?GetSendBufferSize@RHtiBtCommInterface@@QBEHXZ @ 8 NONAME ; int RHtiBtCommInterface::GetSendBufferSize(void) const - ?Receive@RHtiBtCommInterface@@QAEXAAVTDes8@@AAVTRequestStatus@@@Z @ 9 NONAME ; void RHtiBtCommInterface::Receive(class TDes8 &, class TRequestStatus &) - ?Send@RHtiBtCommInterface@@QAEXABVTDesC8@@AAVTRequestStatus@@@Z @ 10 NONAME ; void RHtiBtCommInterface::Send(class TDesC8 const &, class TRequestStatus &) - ?Version@RHtiBtCommInterface@@QBE?AVTVersion@@XZ @ 11 NONAME ; class TVersion RHtiBtCommInterface::Version(void) const - diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommServeru.def --- a/hti/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommServeru.def Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?StartThread@@YAHXZ @ 1 NONAME ; int StartThread(void) - diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtSerialComHelperu.def --- a/hti/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtSerialComHelperu.def Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -EXPORTS - ??1CBtSerialClient@@UAE@XZ @ 1 NONAME ; CBtSerialClient::~CBtSerialClient(void) - ?ConnectL@CBtSerialClient@@QAEXABVTDesC16@@H@Z @ 2 NONAME ; void CBtSerialClient::ConnectL(class TDesC16 const &, int) - ?ConnectL@CBtSerialClient@@QAEXVTBTDevAddr@@H@Z @ 3 NONAME ; void CBtSerialClient::ConnectL(class TBTDevAddr, int) - ?ConnectL@CBtSerialClient@@QAEXXZ @ 4 NONAME ; void CBtSerialClient::ConnectL(void) - ?Connected@CBtSerialClient@@QAEHXZ @ 5 NONAME ; int CBtSerialClient::Connected(void) - ?Connecting@CBtSerialClient@@QAEHXZ @ 6 NONAME ; int CBtSerialClient::Connecting(void) - ?Disconnect@CBtSerialClient@@QAEXXZ @ 7 NONAME ; void CBtSerialClient::Disconnect(void) - ?FreeSpaceInSendBuffer@CBtSerialClient@@QAEHXZ @ 8 NONAME ; int CBtSerialClient::FreeSpaceInSendBuffer(void) - ?NewL@CBtSerialClient@@SAPAV1@AAVMBtSerialClientObserver@@@Z @ 9 NONAME ; class CBtSerialClient * CBtSerialClient::NewL(class MBtSerialClientObserver &) - ?ReadAsyncL@CBtSerialClient@@QAEXXZ @ 10 NONAME ; void CBtSerialClient::ReadAsyncL(void) - ?SendBufferMaxSize@CBtSerialClient@@QAEHXZ @ 11 NONAME ; int CBtSerialClient::SendBufferMaxSize(void) - ?SendL@CBtSerialClient@@QAEXABVTDesC8@@@Z @ 12 NONAME ; void CBtSerialClient::SendL(class TDesC8 const &) - ?ServerAddressL@CBtSerialClient@@QAE?AVTBTDevAddr@@XZ @ 13 NONAME ; class TBTDevAddr CBtSerialClient::ServerAddressL(void) - ?ServicePort@CBtSerialClient@@QAEHXZ @ 14 NONAME ; int CBtSerialClient::ServicePort(void) - diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialClient.h --- a/hti/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialClient.h Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +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: Bluetooth serial client. -* -*/ - - -#ifndef __BTSERIALCLIENT_H__ -#define __BTSERIALCLIENT_H__ - -// INCLUDES -#include -#include -#include -#include -#include -#include - -#include "SocketObserver.h" - -// FORWARD DECLARATIONS -class CMessageServiceSearcher; -class CSocketsReader; -class CSocketsWriter; - -class MBtSerialClientObserver - { -public: - virtual void ConnectedToServer(TInt aError) = 0; - virtual void DisconnectedFromServer() = 0; - virtual void DataFromServer(const TDesC8& aData) = 0; - virtual void AllBufferedDataSent() = 0; - }; - -/** -* CBtSerialClient -* Connects and sends messages to a remote machine using bluetooth -*/ -class CBtSerialClient : public CActive, - public MSocketObserver - { - public: // Constructors and destructor - - /** - * NewL() - * Construct a CBtSerialClient - * @param aObserver the observer for this BT serial client - * @return a pointer to the created instance of CBtSerialClient - */ - IMPORT_C static CBtSerialClient* NewL( MBtSerialClientObserver& aObserver ); - - /** - * ~CBtSerialClient() - * Destroy the object and release all memory objects. - * Close any open sockets. - */ - IMPORT_C virtual ~CBtSerialClient(); - - public: // New functions - - /** - * ConnectL() - * Connect to remote device. Query user for a device. - */ - IMPORT_C void ConnectL(); - - /** - * ConnectL() - * Connect to remote device. - */ - IMPORT_C void ConnectL(const TBTDevAddr aBTServerDevice, const TInt aPort ); - - /** - * ConnectL() - * Connect to remote device by device name. - */ - IMPORT_C void ConnectL( const TDesC& aBTServerDeviceName, const TInt aPort ); - - /** - * DisconnectL() - * Disconnect from remote machine - */ - IMPORT_C void Disconnect(); - - /** - * IsConnecting() - * @return ETrue if the client is establishing a - * connection to the server. - */ - IMPORT_C TBool Connecting(); - - /** - * Connected() - * @return ETrue if the client is fully connected to the server. - */ - IMPORT_C TBool Connected(); - - /** - * ServerAddressL() - * @return address of connected server. Leaves with KErrNotReady, if - * not connected. - */ - TBTDevAddr ServerAddressL(); - - /** - * Add data to outgoing buffer and start sending it to client. - * - * Leaves with KErrOverflow, if the outgoing buffer cannot - * be added all of the aData. - * Leaves with KErrNotReady, if client is not connected. - * When all data in internal buffer has been sent, observer - * is notified (AllBufferedDataSent) - */ - IMPORT_C void SendL(const TDesC8& aData); - - /** - * Issue read operation. Will complete asyncronously. - * - * Leaves with KErrNotReady, if client is not connected. - * Notifies observer, when some data has been read. Caller - * is responsible for calling this method again to receive - * more data. - */ - IMPORT_C void ReadAsyncL(); - - /** - * Query free size of outgoing buffer. - */ - IMPORT_C TInt FreeSpaceInSendBuffer(); - - /** - * Query max size of outgoing buffer. - */ - IMPORT_C TInt SendBufferMaxSize(); - - /** - * Query the port of the service we are connected with - * @return Port number or KErrDisconnected if not connected to a service - */ - IMPORT_C TInt ServicePort(); - - protected: // from CActive - - /** - * DoCancel() - * Cancel any outstanding requests - */ - void DoCancel(); - - /** - * RunL() - * Respond to an event - */ - void RunL(); - - protected: // from MSocketObserver - - void ReportError( TErrorType aErrorType, TInt aErrorCode ); - void NewData( const TDesC8& aData ); - void AllBufferedDataSent(); - - private: - - /** - * ConnectToServerL - * Connects to the service - */ - void ConnectToServerL(); - - /** - * DisconnectFromServer() - * Disconnects from the service - */ - void DisconnectFromServer(); - - /** - * CBtSerialClient() - * Constructs this object - */ - CBtSerialClient( MBtSerialClientObserver& aObserver ); - - /** - * ConstructL() - * Performs second phase construction of this object - */ - void ConstructL(); - - private: // data - - /** - * TState - * The state of the active object, determines behaviour within - * the RunL method. - * EWaitingToGetDevice waiting for the user to select a device - * EGettingDevice searching for a device - * EGettingService searching for a service - * EGettingConnection connecting to a service on a remote machine - * EConnected connected to a service on a remote machine - */ - enum TState - { - EWaitingToGetDevice, // phase 1 of Connect - EGettingDevice, // phase 2 of Connect - EGettingService, // phase 3 of Connect - EGettingConnection, // phase 4 of Connect - EConnected, // sending and receiving data - EDisconnecting - }; - - MBtSerialClientObserver& iObserver; - - /** iState the current state of the client */ - TState iState; - - /** - * iServiceSearcher searches for service this - * client can connect to. - * Owned by CBtSerialClient - */ - CMessageServiceSearcher* iServiceSearcher; - - /** - * iCurrentServiceIndex the index number of the service we are - * currently connecting/connected to - */ - TInt iCurrentServiceIndex; - - /** iSocketServer a connection to the socket server */ - RSocketServ iSocketServer; - - /** iSocket a socket to connect with */ - RSocket iSocket; - - /** iServiceClass the service class UUID to search for */ - TUUID iServiceClass; - - TBTDevAddr iBTServerDevice; - - CSocketsReader* iSocketReader; - CSocketsWriter* iSocketWriter; - - RBTPowerControl iPowerControl; - }; - -#endif // __BTSERIALCLIENT_H__ - -// End of File diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialEngine.pan --- a/hti/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialEngine.pan Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Bluetooth serial engine panic codes. -* -*/ - - -#ifndef __BTSERIALENGINE_PAN__ -#define __BTSERIALENGINE_PAN__ - -#include -#include - -/** Panic Categories */ -_LIT( KPanicSerialEngine, "BTSerialEngine" ); // All engine classes -_LIT( KPanicBTServiceAdvertiser, "BTServiceAdvertiser" ); // only service advertiser - - -enum TBTSerialEnginePanics - { - EBTPointToPointReceiverInvalidState = 1, - EBTPointToPointSenderExists = 2, - EBTPointToPointReceiverExists = 3, - EBTPointToPointSenderInvalidState = 4, - EBTPointToPointNoSender = 5, - EBTPointToPointAddMessage = 6, - EBTPointToPointNextRecordRequestComplete = 7, - EBTPointToPointAttributeRequestResult = 8, - EBTPointToPointAttributeRequestComplete = 9, - EBTPointToPointProtocolRead = 10, - EBTPointToPointAttributeRequest = 11, - EBTPointToPointSdpRecordDelete = 12, - EBTPointToPointServerStop = 13, - EBTPointToPointInvalidLogicState = 14, - EBTPointToPointUnableToDisconnect = 15, - - EBTSerialEngineReadSocketBadState = 16, - EBTSerialEngineWriteSocketBadState = 17 - }; - -inline void Panic( TBTSerialEnginePanics aReason ) - { - User::Panic( KPanicSerialEngine, aReason ); - } - - -#endif // __BTSERIALENGINE_PAN__ - -// End of File diff -r 7259cf1302ad -r 169364e7e4b4 hti/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/HtiBtEngineLogging.h --- a/hti/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/HtiBtEngineLogging.h Tue Jul 06 16:05:13 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +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: Logging for Bluetooth engine. -* -*/ - - -#ifndef __HTIBTENGINELOGGING_H__ -#define __HTIBTENGINELOGGING_H__ - -// INCLUDES -#include - -/******************************************************/ -/** LOG SETUP **/ -/******************************************************/ -_LIT(KLogFolder, "Hti"); -_LIT(KLogFile, "BtSerialEngine.log"); - -#ifdef __ENABLE_LOGGING__ -// Comment out the levels which are marked supported in the build -// (and which are used runtime). -// -#define LOG_LEVEL_ERROR_SUPPORTED -#define LOG_LEVEL_WARN_SUPPORTED -#define LOG_LEVEL_INFO_SUPPORTED -//#define LOG_LEVEL_DEBUG_SUPPORTED -#endif - -/******************************************************/ -/** MACRO DEFINITIONS **/ -/******************************************************/ - -// Macros: Example: Result: -// LOGFMT_E(formatstring, parameter) LOGFMT_E("Leave in RunL: %d", -6)