×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    72

    Active Objects problem!!

    Hi im Harish,
    I have made this video player in which im using an active object to read from the file.....
    But a strange thing happens only sometimes the RunL function is executed....
    Mostly wat happens is that when i call the function SetActive it makes the boolean var true but after that when i Start the Scheduler it makes it false again.........
    wat cud be the problem does anyone have any idea??????

    activeObject->ReadFromFile(activeObject->iStatus); //inside this function i call SetActive()
    CActiveScheduler::Start();

  2. #2
    Regular Contributor
    Join Date
    Mar 2006
    Location
    Bangalore
    Posts
    148

    Re: Active Objects problem!!

    Hi harish

    If its a video player then i guess you would be using a UI right. If so then you need not call the CActiveScheduler::Start() but however if you have a seperate data handler component which is not using the UI framework then what you are doing is right. But please check if you have created a new scheduler and calling start properly.. Also could you post more code so your issue is more clear.

    Regards,
    Pavan

  3. #3
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: Active Objects problem!!

    Quote Originally Posted by harish13_ks

    activeObject->ReadFromFile(activeObject->iStatus);

    Your code is probably wrong judging from what you have done with this line. I'm not saying this line is the cause, I'm saying somebody who would write code such as this probably has done something wrong elsewhere.

    1) Why pass a member variable like this as a parameter
    2) Is that a lically declared iStatus in the active object?
    Last edited by hotcheese; 2006-12-23 at 21:10.

  4. #4
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    72

    Re: Active Objects problem!!

    Hi,
    actually the object activeObject has all the inherited contents of the class CActive..... ReadFromFile is the request made by me for service.... im new to active object so may be my code is little naive.....
    Maybe u ppl can help me more by providing some clear code snippets.....
    If i dnt call the Start method of the scheduler the application panics... so i had to call that method....
    Thanks to all those who replied
    Plz keep the opinions cming i need to know a lot abt active object
    and ya my problem still is not solved...

  5. #5
    Regular Contributor
    Join Date
    Mar 2006
    Location
    Bangalore
    Posts
    148

    Re: Active Objects problem!!

    Hi harish

    Why dont you paste your entitre AO implenentation code here so we can track the mistake n correct it..

    Regards,
    Pavan

  6. #6
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    72

    Thumbs up Re: Active Objects problem!!

    This is the part where i create the active object........... and this code is inside an if loop so when certain condition is met i execute the active object.....

    MyActiveObject* activeObject = MyActiveObject::NewL();
    activeObject->ReadFromFile(activeObject->iStatus); //SetActive called
    CActiveScheduler::Start();

    this is the NewL function which creates the object.........

    MyActiveObject* MyActiveObject::NewL()
    {
    MyActiveObject* activeObj = new (ELeave) MyActiveObject;
    CleanupStack::PushL(activeObj);
    return activeObj;
    }

    this is the constructor......

    MyActiveObject::MyActiveObject()
    :CActive(EPriorityHigh)
    {
    CActiveScheduler::Add(this);
    }


    i have one more doubt........... i want to call this execute this active object periodically as it is reading from a file.......... so how can i call it again......... i heard that there is a method called WaitForAnyRequest() ............... will this method be called automatically or i shud call it explicitly..........
    Thanks for the reply so far
    Plz help me further

    Regards
    Harish

  7. #7
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: Active Objects problem!!

    whats the defination of ReadFromFile. i thing might be there is proble in ReadFromFile function.
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  8. #8
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    72

    Re: Active Objects problem!!

    i have called the SetActive method inside ReadFromFile.......... i dont think that function has a problem....... the problem is that when i set the prority of the active object to High then only that active object is executed(the video is still) and when i set it to standard it is not at all executed(some part of the video is shown but after the data is over it panics as it hasnt read frm the file again)..............

  9. #9
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: Active Objects problem!!

    did you call Cancel() before setactive may be there is already a Achn request and you are trying to make again a achn request.
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  10. #10
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    72

    Re: Active Objects problem!!

    yes i did try that.......... im totally confused..... i dont even know if is it the implementation of active object that is faulty or does execution of active object take so much time.......

  11. #11
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: Active Objects problem!!

    You didn't post the important parts of the code, the ReadFromFile and RunL functions.

    And I repeat, why doing this:
    activeObject->ReadFromFile(activeObject->iStatus); //SetActive called
    i.e. why not activeObject->ReadFromFile()

    Its not wrong as such, but its obviously pointless.

  12. #12
    Registered User
    Join Date
    Jul 2005
    Location
    Bengaluru, India
    Posts
    747

    Re: Active Objects problem!!

    Quote Originally Posted by harish13_ks
    ...
    i have one more doubt........... i want to call this execute this active object periodically as it is reading from a file.......... so how can i call it again......... i heard that there is a method called WaitForAnyRequest() ............... will this method be called automatically or i shud call it explicitly..........
    Thanks for the reply so far
    Plz help me further
    ...
    I would suggest you to go through some good articles for AO (Active Objects) before starting the coding! This thread from NewLC may clear most of the mis-understanding about AO: Common mis-use and abuse of Symbian OS. More over you can find some good article for AO in NewLC Tutorials section, just search there.

  13. #13
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: Active Objects problem!!

    you can go through with the example of active object. here is the link

    http://forum.nokia.com/info/sw.nokia...0b_en.zip.html
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  14. #14
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    72

    Smile Re: Active Objects problem!!

    ok ill do that......
    Thanks ppl for helping me out.....

  15. #15
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    72

    Re: Active Objects problem!!

    Ya actually i did figure that out.......... i did remove the parameter from the method now its just like this
    void ReadFromFIle()
    {
    Cancel(); //cancel if the AO is already active
    SetActive(); //issue a request
    }
    RunL method just has a file read.... to fill the buffer thats it.....

    the code worked as of now but i had to use the method RunIfReady() of the CActiveScheduler...... bcos wat was happening was that RunL was executed only when the priority was high when i kept it standard it wasnt executed...... so i had to add that method so that it is executed when ready hope that doesnt cause any issues......
    PS: doest active object execute in parallel or is it a serial execution????????
    Regards
    Harish

Similar Threads

  1. Replies: 2
    Last Post: 2007-10-05, 20:40
  2. Help me solve an active object problem!!!
    By hoy_cpe in forum Symbian
    Replies: 4
    Last Post: 2006-06-30, 22:26
  3. Replies: 0
    Last Post: 2005-10-28, 18:27
  4. active objects and program scheduling
    By morri53 in forum Symbian
    Replies: 1
    Last Post: 2005-10-11, 05:30
  5. Active Objects
    By Sukrit in forum Symbian
    Replies: 2
    Last Post: 2004-09-03, 07:29

Posting Permissions

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