os/mm/mmtestenv/mmtestfw/recog/TestFrameworkRecog.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __TESTFRAMEWORKRECOG_H__
    17 #define __TESTFRAMEWORKRECOG_H__
    18 
    19 #include <apmrec.h>
    20 
    21 _LIT(KRecogSemaphoreName, "TFR_SEM");				// Semaphore of the current test thread
    22 _LIT(KRecogParentSemaphoreName, "TFR_PARENT_SEM");	// Semaphore of the main recognizer thread
    23 const TInt KUidTestFrameworkRecognizerValue = 0x101F7C0E;
    24 const TUid KUidTestFrameworkRecognizer = { KUidTestFrameworkRecognizerValue };
    25 
    26 class TTestScriptInfo
    27 	{
    28 public:
    29 	TInt iThreadStartupDelay;
    30 	TFileName iScriptPath;
    31 	TBuf<32> iParams;
    32 	};
    33 typedef CArrayFixFlat<TTestScriptInfo> CTestScriptArray;
    34 
    35 // CTestFrameworkRecogActive
    36 class CTestFrameworkRecogActive : public CActive
    37 	{
    38 public:
    39 	CTestFrameworkRecogActive(CTestScriptArray* aTestScriptArray);
    40 	~CTestFrameworkRecogActive();
    41 public:
    42 	TInt CreateNextTestThread();
    43 protected:
    44 	static TInt ThreadFunc(TAny* aPtr);
    45 	void DoThreadFuncL();
    46 	static TInt StartTestThreadFn(TAny* aPtr);
    47 	void DoStartTestThreadL();
    48 	// from CActive
    49 protected:
    50 	void RunL();
    51 	void DoCancel();
    52 protected:
    53 	CTestScriptArray* iTestScriptArray;
    54 	TInt iCurrentScript;
    55 	};
    56 
    57 // CTestFrameworkRecognizer
    58 class CTestFrameworkRecognizer : public CApaDataRecognizerType
    59 	{
    60 public:
    61 	CTestFrameworkRecognizer();
    62 	~CTestFrameworkRecognizer();
    63 	// New functions
    64 public:
    65 	void DoCreateL();
    66 protected:
    67 	void LoadConfigFileL(const TDesC& aFileName);
    68 	void ProcessLineL(const TDesC8& aLine);
    69 	// from CApaDataRecognizerType
    70 protected:
    71 	TUint PreferredBufSize();
    72 	TDataType SupportedDataTypeL(TInt aIndex) const;
    73 	void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
    74 protected:
    75 	CTestScriptArray* iTestScriptArray;
    76 	CTestFrameworkRecogActive* iTestActive;
    77 	TBool iRunScript;
    78 	};
    79 
    80 #endif // __TESTFRAMEWORKRECOG_H__