×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,765

    Re: Can't force CActive to run.

    Code:
    void TimerExpired(TAny* aTimer,TInt aError);
    is necessary in your class too. The virtual is optional (there is a saying: "once virtual, always virtual", so whenever you override a virtual method you inherited from somewhere else, that is going to be virtual regardless of specifying that again or not), the =0 must not be there (it says that there will be no implementation for the method, while in your case the point is that you want to implement it).
    Chances are that the timer already does something, and maybe that is why you get the panic. Consider debugging the code. If you enable Just In Time debugging in the preferences of the emulator (Tools menu or something like that), and debug the code from Carbide.c++, it will show you the exact location of the panic. If you encounter some ECMT error when trying, you may have to indicate your Java version in the config file as described here: http://developer.nokia.com/Community..._(Known_Issue).

  2. #17
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Can't force CActive to run.

    Yeah funny thing, but the worst thing is it still does not work
    i initialize it in container constructL

    PC_EYE = CTMobEyeTh::NewL();
    PC_EYE->StartL(1000000);
    where
    Code:
    void CTMobEyeTh::StartL(TTimeIntervalMicroSeconds32 aDelay)
    	{
    	Cancel(); // Cancel any request, just to be sure
    	iState = EUninitialized;
    	iTimer.After(iStatus, aDelay); // Set for later
    	SetActive(); // Tell scheduler a request is active
    	}
    RunL() does not execute.

    i still miss something.



    ======

    Wizard_hu i replied to prevorious post, lets not care about kern 3 now because it does not occur with this auto-gen code

  3. #18
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Gurgaon,India
    Posts
    4,103

    Re: Can't force CActive to run.

    Are you sure about the fact that RunL() does not get called, what code did you wrote in RunL() to be sure that its not getting called.

    Also can you paste the container code also.

  4. #19
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Can't force CActive to run.

    I just checked it i hit the options button menu and when i exit it the p is being updated. So this timer works but i can't get the values in realtime. I must select a menu from options menu and click it in order to see any changes.


    also if (p >= 5) iTimer.Cancel(); is not executeh since i have p = 107 now


    i choosed active object becvause i read
    As a consequence, data shared by threads must be protected with access synchronization primitives such as mutexes or semaphores, as opposed to active objects where no synchronization is needed.


    Old post:
    Container
    global var (public)
    CTMobEyeTh* PC_EYE;



    the code in drawing routine:
    Code:
    AnsiString question;
    question = IntToStr(PC_EYE->p);
    question = question + " :)";
    gc.DrawText(*question.AnsiStringToHBufLC(),TPoint(30,90));
    CleanupStack::PopAndDestroy();

    the CActive
    Code:
    public:
    	int p;

    code:

    Code:
    void CTMobEyeTh::ConstructL()
    	{
    	p = 1;
    	User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
    	CActiveScheduler::Add(this); // Add to scheduler
    	}
    
    
    
    void CTMobEyeTh::RunL()
    	{
    	if (iState == EUninitialized)
    		{
    		// Do something the first time RunL() is called
    		iState = EInitialized;
    		}
    	else if (iState != EError)
    		{
    	if (p >= 5) iTimer.Cancel();
    		// Do something
    		}
    	p = p + 1;
    	iTimer.After(iStatus, 1000000); // Set for 1 sec later
    	SetActive(); // Tell scheduler a request is active
    	}

    I always get p = 1

    update

    even
    Code:
    int s = PC_EYE->p;
    // question = IntToStr(PC_EYE->p);
    
     if (s < 6) question = "less than 6";
     if (s >= 6) question = "more than 6";
    gc.DrawText(*question.AnsiStringToHBufLC(),TPoint(30,90));
    CleanupStack::PopAndDestroy();
    needs to be refreshed by hitting menu item...
    Last edited by melepeta; 2013-10-16 at 14:30.

  5. #20
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,765

    Re: Can't force CActive to run.

    iTimer.Cancel would shut down the ongoing timer activity. However RunL was invoked explicitly because the timer has finished. And at the end you initialize it again (iTimer.After+SetActive). It works fine.
    If your problem is that the value of p does not appear automatically on the screen, you should invoke DrawNow or DrawDeferred (redraw-requesting methods of CCoeControl, so the AppView class) from RunL. Just modify the NewL and constructor to accept a reference/pointer of your AppView object.

  6. #21
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Can't force CActive to run.

    I did what you have told me i think i did it wrong because it does not work for me, however now i faced strange problem that did not occur before:
    when i add to my container class a var
    int lolu;

    i cant compile
    lolu = lolu + 1;
    inside Draw function of my container (yeah ccoecontrol)
    [but when i define int lolu; inside Draw funcxtion everything works]

    But that shouldn't be the problem if i find the loop that is responsible for calling Draw method.
    I am unable to find it so it must be system dependent then i could check if i the data from CActive is properly displayed.

    It would be better if i could handle main application loop by myslef and call draw when i want. Well actually it should stop my stupid problems with this application and then i could get work done.



    Maybe this could help: I am trying to make an application that processes images on realtime, in example my cat wants to go back home, but i dont hear her and i am far away from the door, but i could use my old nokia that could inform me that my cat sits near door, actually i want to do some more serious things with RT image processing.
    I have made such thing on my PC (notebook) but i damaged cable that connects touchpad to the mainboard (when chanigng keybioard) and i cant run it since, i have no money for such things, so i decided to use other computer and develop same application on mobile then i will just simply port it onto pc) I use a thread in a thread that gets images from camera, adds them into an array and processes them(second thread), i want to do similar thing here.
    Last edited by melepeta; 2013-10-16 at 18:57.

  7. #22
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Re: Can't force CActive to run.

    Quote Originally Posted by melepeta View Post
    I did what you have told me i think i did it wrong because it does not work for me, however now i faced strange problem that did not occur before:
    when i add to my container class a var
    int lolu;

    i cant compile
    inside Draw function of my container (yeah ccoecontrol)
    [but when i define int lolu; inside Draw funcxtion everything works]
    Hi,

    Draw is a const function, so it's not possible to modify normal member variables there. You can either make the member variable mutable (so it can be modified in const functions), or cast the this (const) pointer in Draw function to a normal non-const pointer and modify the variable through that pointer - that would be a bit hacky though.

    Btw, take a look at CPeriodic, it's probably the easiest way to use timers on Symbian. No need to subclass anything or implement an interface, just create a CPeriodic instance and request callback(s) after specified delay(s) to the function of your choosing.

  8. #23
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Can't force CActive to run.

    Well that coudl be good if not i will use Threads instead, but i don;'t know if CPeriodic is async or sync if its sync it is useless

  9. #24
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,573

    Re: Can't force CActive to run.

    Quote Originally Posted by melepeta View Post
    Well that coudl be good if not i will use Threads instead, but i don;'t know if CPeriodic is async or sync if its sync it is useless
    You can check usage in http://developer.nokia.com/Community...tream_of_ticks

    Ofcourse you have SDK documentation which tells it all

  10. #25
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: Can't force CActive to run.

    thanks i will search for it in sdk / that i didin't figured it out myslef that this descr could be in sdk ;x

  11. #26
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,573

    Re: Can't force CActive to run.

    Quote Originally Posted by melepeta View Post
    i didin't figured it out myslef that this descr could be in sdk ;x
    Just in case you havent figured it out, the SDK folder also has a lot of examples..covering quite a lot of stuff actually.

Similar Threads

  1. Help with CActive
    By wagonli in forum Symbian
    Replies: 13
    Last Post: 2008-02-29, 08:10
  2. CActive in an exe
    By ceehira in forum Symbian
    Replies: 6
    Last Post: 2006-07-19, 14:29
  3. CActive
    By shadow-2005 in forum Symbian
    Replies: 1
    Last Post: 2006-03-20, 10:06

Posting Permissions

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