×

Discussion Board

Results 1 to 15 of 22

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    122

    Exclamation Question for experts

    Hi guys,
    I have a problem. I have posted about it in topic little bit earlier,
    but I take decision to create new topic.
    Here is my question:
    I have created recognizer and tested it on device
    (Nokia 6630) and it work fine. I check it with "Yucca Browser".
    This browser was successfully started after rebooting of device.
    But recognizer can't starts my application
    I tried create simple (view based) Helloworld application, which manually I
    can start well. But I got same problem, recognizer can't starts my application
    on device after rebooting.
    Why? What I forget?
    May be exists any security problem... or anything yet....?
    Please help.
    Thanks in advance.

  2. #2
    Super Contributor
    Join Date
    Aug 2005
    Location
    india
    Posts
    2,078

    Re: Question for experts

    hi,

    can u paste ur recongniser code so that we can check where exactly ur making mistake..

    Regards,
    Mateen Maldar M
    "Whatever the mind can conceive and believe, the mind can achieve"

  3. #3
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    122

    Re: Question for experts

    Hi Mateen Maldar
    here is my code :

    Code:
    #include "..\inc\auto.h"
    #include <apmstd.h>
    
    //const TUid KUidemAMRec={0x10005B91};
    const TUid KUidemAMRec={0x100012FB};
    
    CMyRecognizer::CMyRecognizer()
    :CApaDataRecognizerType(KUidemAMRec, CApaDataRecognizerType::ENormal)
    {
    	iCountDataTypes = 1;
    }
    
    TUint CMyRecognizer::PreferredBufSize()
    {
    	// no buffer recognition yet
    	return 0;
    }
    
    TDataType CMyRecognizer::SupportedDataTypeL(TInt /*aIndex*/) const
    {
    	return TDataType();
    }
    
    void CMyRecognizer::DoRecognizeL(const TDesC& /*aName*/, const TDesC8&
    								 /*aBuffer*/)
    {
    	// this function is never called
    }
    
    void CMyRecognizer::StartThread()
    {
    	TInt res = KErrNone;
    
    	//create a new thread for starting our application
    	RThread * startAppThread;
    	startAppThread = new RThread();
    
    	User::LeaveIfError( res = startAppThread->Create(
    		_L("NIMobile"),
    		CMyRecognizer::StartAppThreadFunction,
    		KDefaultStackSize,
    		KMinHeapSize,
    		KMinHeapSize,
    		NULL,
    		EOwnerThread) );
    
    	startAppThread->SetPriority(EPriorityNormal/*EPriorityLess*/);
    
    	startAppThread->Resume();
    
    	startAppThread->Close();
    }
    
    
    TInt CMyRecognizer::StartAppThreadFunction(TAny* /*aParam*/)
    {
    
    	//wait 5 seconds...
    	RTimer timer; // The asynchronous timer and ...
    	TRequestStatus timerStatus; // ... its associated request status
    	timer.CreateLocal(); // Always created for this thread.
    	// get current time (microseconds since 0AD nominal Gregorian)
    	TTime time;
    	time.HomeTime();
    	// add ten seconds to the time
    	TTimeIntervalSeconds timeIntervalSeconds(65);
    	time += timeIntervalSeconds;
    	// issue and wait
    	timer.At(timerStatus,time);
    	User::WaitForRequest(timerStatus);
    
    
    	CActiveScheduler * scheduler = new CActiveScheduler();
    	if( scheduler == NULL )
    		return KErrNoMemory;
    
    	CActiveScheduler::Install(scheduler);
    	// create a TRAP cleanup
    	CTrapCleanup * cleanup = CTrapCleanup::New();
    	TInt err;
    	if( cleanup == NULL )
    	{
    		err = KErrNoMemory;
    	}
    	else
    	{
    		TRAP( err, StartAppThreadFunctionL() );
    	}
    	delete cleanup;
    	delete CActiveScheduler::Current();
    
    	return err;
    }
    
    void CMyRecognizer::StartAppThreadFunctionL()
    {
    	TFileName fnAppPath = _L("\\system\\apps\\Hello\\Hello.app");
    	RFs fsSession; //file server session
    	User::LeaveIfError(fsSession.Connect());
    	CleanupClosePushL(fsSession);
    	TFindFile findFile( fsSession );
    
    	User::LeaveIfError( findFile.FindByDir(fnAppPath, KNullDesC) );
    
    	CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    	cmdLine->SetLibraryNameL( findFile.File() );
    	cmdLine->SetCommandL( EApaCommandOpen );
    
    	RApaLsSession ls;
    	User::LeaveIfError(ls.Connect());
    	CleanupClosePushL(ls);
    
    	User::LeaveIfError( ls.StartApp(*cmdLine) );
    	CleanupStack::PopAndDestroy(3); // Destroy fsSession, ls and cmdLine
    }
    
    EXPORT_C CApaDataRecognizerType* CreateRecognizer()
    {
    	CApaDataRecognizerType* thing = new CMyRecognizer();
    
    	//start thread for our application
    	CMyRecognizer::StartThread();
    	return thing;
    }
    
    // DLL entry point
    GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
    {
    	return KErrNone;
    }
    here is header:

    Code:
    #ifndef __AUTO_H__
    #define __AUTO_H__
    
    #include <apgcli.h>
    #include <f32file.h> 
    #include <apacmdln.h>
    #include <e32std.h>
    #include <apmstd.h>
    
    
    
    class CMyRecognizer : public CApaDataRecognizerType
    	                 
    {
    public: // from CApaDataRecognizerType
    	CMyRecognizer();
    	TUint PreferredBufSize();
    	TDataType SupportedDataTypeL(TInt aIndex) const;
    	static void StartThread();
    	static TInt StartAppThreadFunction(TAny* aParam);
    	static void StartAppThreadFunctionL();
    
    private: // from CApaDataRecognizerType
    	void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
    };
    
    #endif
    and here is mmp file:

    Code:
    target                                  HELLO.MDL 
    targettype                              MDL 
    targetpath                              \system\recogs 
    UID                                     0x10003A19 0x100012FB 
    unicodeuid                              0x10003A19 0x100012FB 
    project                                 EMIME 
    systeminclude                           \EPOC32\INCLUDE 
    library                                 EUSER.LIB 
    library                                 APMIME.LIB 
    library                                 apparc.lib 
    library                                 apgrfx.lib 
    library                                 efsrv.lib 
    SOURCEPATH                        src 
    SOURCE                               auto.cpp
    PS: I use Cardbide & VC2003 and S60_2.2

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    50

    Re: Question for experts

    Maybe u should install CActiveScheduler before making an asynchronous call in your custom thread.
    (use User::After instead of Rtimer which makes an asynchronous calling.)
    Last edited by acclivity; 2006-12-13 at 09:24.

  5. #5
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    122

    Re: Question for experts

    But this code worked fine for another application (Yucca file browser).
    After rebooting , I had wait some seconds (65 in my code), and browser was launched.

  6. #6
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    122

    Re: Question for experts

    I have tried as you say. The problem still exist. I see only short splash of the screen and application not starts.

Similar Threads

  1. a question about command and a question about s60
    By t4kesting in forum Mobile Java General
    Replies: 0
    Last Post: 2006-01-24, 08:21
  2. Replies: 2
    Last Post: 2004-01-08, 18:36
  3. Replies: 0
    Last Post: 2003-12-07, 16:06
  4. Sending data using iAcceptedSocket (Urgent question)
    By okegame in forum Bluetooth Technology
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×