×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  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
    Registered User
    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.

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

    Re: Question for experts


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

    Re: Question for experts

    Possible I found where is my problem.
    I read about function RApaLsSession::StartApp in sdk documentation and found this:

    "This is only recommended for non document based applications."
    "This should NOT be used for view based applications"

    As I wrote earlier, my Helloworld is view based. And I think it is my problem.
    Am I right?

    And now I have new question : how can I start my view based application
    from recogniser?

    If anybody know, please help me.

    Thanks.

  9. #9
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: Question for experts

    The autostart code on this link works great for me
    for my applications.

    http://mikie.iki.fi/symbian/autostart.html

    Regards.

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

    Re: Question for experts

    I have modified my code, but no success again.
    It is compiled well, but application not starts.

    Here is my new code:
    Code:
    void CMyRecognizer::StartAppThreadFunctionL()
    {
     TFileName fnAppPath = _L("\\system\\apps\\NIMobile\\NIMobile.app");
       	RFs fsSession; //file server session
    	User::LeaveIfError(fsSession.Connect());
    	CleanupClosePushL(fsSession);
    	TFindFile findFile( fsSession );
    
    	User::LeaveIfError( findFile.FindByDir(fnAppPath, KNullDesC) );
    
    	RProcess server;
    
    	CleanupClosePushL(server);
    	User::LeaveIfError(server.Create(findFile.File(), _L("")));
    	server.Resume();
    
    	CleanupStack::PopAndDestroy();
    }

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

    Re: Question for experts

    Quote Originally Posted by Svat_
    And now I have new question : how can I start my view based application
    from recogniser?
    I dont know where the exactly the problem is, but I use RApaLsSession::StartDocument to satrt (not boot start) my multiview based application in my recognizer and it work on the device(nokia 6600).

    TUid id( TUid::Uid( KReaderBrowserUid ) );
    RApaLsSession appArcSession;
    User::LeaveIfError(appArcSession.Connect());
    TThreadId threadId;
    TBuf<256> param;
    param = _L("sample recog");
    appArcSession.StartDocument(param , TUid::Uid( KReaderBrowserUid ), threadId );
    appArcSession.Close();

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

    Re: Question for experts

    Hi guys,
    I add logs to my code and now I have next results:
    If i use "RProcess" for starting of my application, then "server.Create" returns me KErrNotSupported.
    If I use "RApaLsSession", in both casses (StartDocument and StartApp) it is returns me KErrNone. But I see only short splash of screen. I think application was started and immediately closed. I don't understand why...

    If .mdl file exist in \system\recogs, I can't even start my application manually.
    It is closed immediately. But if I remove file from here, application starts manually well. I think recognizer works fine (I can run another application), and my application works fine too (it is simple view based Hello world).
    But I can't understand where is problem... It is don't wants to work together.
    I am lost
    Guys,please help...
    Thanks.

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

    Re: Question for experts

    u can also add log to your helloworld application, then u are able to find whether the application have been launched.

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

    Re: Question for experts

    ok, I add log to "::CreateDocumentL()" and to "NewApplication()" and got next results:
    If I start application manually ( .mdl file not exists in "recogs" folder),
    I see my logs. But if I put .mdl file to "recogs" folder and reboot device,
    I see logs only from my recognizer and no logs from my application.
    And if I try to start now my application manually, I don't see logs from application too.

    Any ideas?

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

    Re: Question for experts

    Have no ideas and hope someone else could help.

Page 1 of 2 12 LastLast

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. Strange question on 6230
    By DanAvni1 in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2005-04-18, 06:05
  3. Replies: 2
    Last Post: 2004-01-08, 18:36
  4. Replies: 0
    Last Post: 2003-12-07, 16:06
  5. 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
  •