Programming to enable automatic boot for s60 mobile phones
You can set an alarm for the s60 cell phone clock. An alarm will be triggered automatically when the time is reached.
I tested it with "alarm server", so the idea is to write a "clock alarm" to "alarm server" by myself, which is equivalent to programming the alarm clock. The defect is that if the user chooses "no", there is no way.
The following code can be found:
Http://db.cs.helsinki.fi /~ Mraento/lxr/source/contextsensors/src/log_alarm.cpp
It has passed the test on the s60 SDK 2.1 simulator.
//. MMP
//...
Library ealwl. Lib
//. Cpp
# Include <t32alm. h> // For ralarmserver
//...
Ralarmserver ialarmserver; // forgive me
Tint err = ialarmserver. Connect ();
If (ERR = kerrnone)
{
Cleanupclosepushl (ialarmserver );
Talarminfo Info;
Talarmsetstate state;
Tint I, err =-1;
/* When this annotation is enabled, an alarm is set.
TTime t; // target time
Tfilename F; // sound file name
Ialarmserver. setclockalarm (0, T, F, F, ealarmclockonce );
*/
// The following code retrieves the preset alert clock.
Calarmidarray * IDs = new (eleave) calarmidarray (8 );
Cleanupstack: pushl (IDS );
Ialarmserver. alarmarraypopulatel (* IDS), ralarmserver: earraynext, 8 );
For (I = 0; I <IDS-> count (); I ++)
{
Tint id = IDS-> at (I );
Err = ialarmserver. alarminfo (Info, ralarmserver: einfobyid, ID );
If (ERR = kerrnone)
{// Query the clock alarm info
State = ialarmserver. alarmstate (info. ialarmid );
If (State! = Ealarmnotset & state! = Ealarmdisabled)
Break;
}
}
Cleanupstack: popanddestroy (); // IDS
Cleanupstack: popanddestroy (); // ialarmserver
}