Symbian Developer Network

   
 

Need help using the forums?
Click here

Home » Symbian Developer Network Forums » Discussion Groups » Symbian C++

Thread: Which API to go for

Legend
  • Five stars: 251 - 10000 pts
  • Four stars: 101 - 250 pts
  • Three stars: 51 - 100 pts
  • Two stars: 11 - 50 pts
  • One star: 1 - 10 pts
  • No stars: 0 - 0 pts
Helpful Answer (1 pts)
Correct Answer (2 pts)

Permlink Replies: 15 - Pages: 2 [ 1 2 | Next ] - Last Post: 21-Jun-2008 16:31 Last Post By: tampstaffs
renuka

Posts: 38
Registered: 02/11/07
Which API to go for
Posted: 29-May-2008 07:41
Click to report abuse...   Click to reply to this thread Reply
Hi to all,

My requirement is to Launch a feature of my application at Scheduled Time.(This is set by the user).I used RTImer,but after some research I found that it doesnot work properly for long durations( On phones).Can I use any one of ther two apis i.e ALarm server or Calender. Which one would be a better choice. If i use Aalarm server, can I notify the alarm( within the application, which handles the launch of the feature) with out displaying any Alarm dialog.

Regards,
Renuka.
Jevgenij V. Gag...
Re: Which API to go for
Posted: 29-May-2008 08:21   in response to: renuka in response to: renuka
Click to report abuse...   Click to reply to this thread Reply
Just an idea...
What about having a RTimer ticking, let's say, every 100ms. Then in RunL()
(or whatever callback) you would have something like:

//is it time to launch a feature:
TTime currTime;
currTime.HomeTime();
int currTimeInt = CalcSeconds (currTime);
int startTimeInt = CalcSeconds (iStartTime);
int diff = (currTimeInt - startTimeInt);

//init
iStartTime.HomeTime();

"renuka" wrote in message news:75366@developer.symbian.com...
Hi to all, My requirement is to Launch a feature of my application at
Scheduled Time.(This is set by the user).I used RTImer,but after some
research I found that it doesnot work properly for long durations( On
phones).Can I use any one of ther two apis i.e ALarm server or Calender.
Which one would be a better choice. If i use Aalarm server, can I notify the
alarm( within the application, which handles the launch of the feature) with
out displaying any Alarm dialog. Regards, Renuka.

renuka

Posts: 38
Registered: 02/11/07
Re: Which API to go for
Posted: 29-May-2008 09:07   in response to: Jevgenij V. Gag... in response to: Jevgenij V. Gag...
Click to report abuse...   Click to reply to this thread Reply
HI,

I tried even keeping a check in RunL, where i confirm that home time is same as Scheduler time and then if yes Launch it. But when i had that it never launched.When i remove that check, If i set the scheduled time for 1 hr,it launches for 30 min.
alie

Posts: 110
Registered: 26/11/06
Re: Which API to go for
Posted: 29-May-2008 09:08   in response to: renuka in response to: renuka
Click to report abuse...   Click to reply to this thread Reply
u can use RScheduler for this :)

  • Alie
Jevgenij V. Gag...
Re: Which API to go for
Posted: 29-May-2008 09:25   in response to: renuka in response to: renuka
Click to report abuse...   Click to reply to this thread Reply

I mean, that you make the RTimer complete every
100ms or every 50ms or every 1s "in a loop" and in RunL you calculate the
difference between start time and current time (at RTimer each tick).
void RunL() {
    calculate time
difference,
    if not yet expired,
then
       
RTimer->After(100000); //wait for the imprecise 100ms more and check
difference again.
    else
        launch
feature, exit
}
But maybe it's worth going a simpler way and using
RScheduler as is suggested in the other reply to your post
 
"renuka" wrote in message news:75373@developer.symbian.com...
HI,
I tried even keeping a check in RunL, where i confirm that home time is same
as Scheduler time and then if yes Launch it. But when i had that it never
launched.When i remove that check, If i set the scheduled time for 1 hr,it
launches for 30 min.
alie

Posts: 110
Registered: 26/11/06
Re: Which API to go for
Posted: 29-May-2008 09:29   in response to: renuka in response to: renuka
Click to report abuse...   Click to reply to this thread Reply
dont use RTimer, it consumes battery

  • Alie
renuka

Posts: 38
Registered: 02/11/07
Re: Which API to go for
Posted: 29-May-2008 09:32   in response to: alie in response to: alie
Click to report abuse...   Click to reply to this thread Reply
hi ,

Thank you for the reply. I will try to find more about it.Is there any working example u can point me too??
alie

Posts: 110
Registered: 26/11/06
Re: Which API to go for
Posted: 29-May-2008 09:43   in response to: renuka in response to: renuka
Click to report abuse...   Click to reply to this thread Reply
renuka

Posts: 38
Registered: 02/11/07
Re: Which API to go for
Posted: 29-May-2008 09:48   in response to: alie in response to: alie
Click to report abuse...   Click to reply to this thread Reply
Hi Alie,

Thanks,I was just going through the same.In that example it says, we give the path of Exe, but my client is dll.Server is exe. I have this code in server, do i need to call the exe or dll. hmm if this is a silly doubt excuse me,as this is the first time I am dealing with this sort.
alie

Posts: 110
Registered: 26/11/06
Re: Which API to go for
Posted: 29-May-2008 09:52   in response to: renuka in response to: renuka
Click to report abuse...   Click to reply to this thread Reply
Hi,

of course ur exe... u can send ur data/message to dll thru exe

  • Alie
renuka

Posts: 38
Registered: 02/11/07
Re: Which API to go for
Posted: 29-May-2008 10:16   in response to: alie in response to: alie
Click to report abuse...   Click to reply to this thread Reply
HI Alie,

I tried to run the RSchedule example in emulator it says, execution not allowed for security reasons -46???

Edited by: renuka on 29-May-2008 11:17
tanzimhusain

Posts: 270
Registered: 23/11/07
Re: Which API to go for
Posted: 29-May-2008 11:48   in response to: renuka in response to: renuka
Click to report abuse...   Click to reply to this thread Reply
Hi renuka,

If you try reading the documentation on RScheduler, you'd see that you need WriteDeviceData capability for your application. I'd guess the -46 (KErrPermissionDenied) is coming from the lack of appropriate platsec capability.

Cheers.
renuka

Posts: 38
Registered: 02/11/07
Re: Which API to go for
Posted: 29-May-2008 12:13   in response to: tanzimhusain in response to: tanzimhusain
Click to report abuse...   Click to reply to this thread Reply
HI MaxPayne,

That worked.Hm,I think i was reading the wrong doc were it said capabailities required were none. i was trying this example http://wiki.forum.nokia.com/index.php/Image:RScheduler_Example.zip. But it does not auto Launch itslef after the timer expires.

Edited by: renuka on 29-May-2008 12:17
majuemcc

Posts: 1
Registered: 09/04/08
Re: Which API to go for
Posted: 30-May-2008 08:59   in response to: alie in response to: alie
Click to report abuse...   Click to reply to this thread Reply
Alie,

On what basis are you saying
"dont use RTimer, it consumes battery"?

What is the alternative then if I need to do things from time to time in my thread?
tanzimhusain

Posts: 270
Registered: 23/11/07
Re: Which API to go for
Posted: 30-May-2008 12:29   in response to: majuemcc in response to: majuemcc
Click to report abuse...   Click to reply to this thread Reply
Hi majuemcc,

There's no reason why you can't use timers, its just you need to carefully consider their usage in your code, speciallly if its going to be part of a long running process.

Timers basically prevents the phone to go into standby mode, hence effectively keeping the phone up and drain battery for nothing, hence the issue.

Have a look at this thread for a related discussion https://developer.symbian.com/forum/thread.jspa?threadID=25659&tstart=0

You might also want to read this.

Hope that helps.

Point your RSS reader here for a feed of the latest messages in all forums