LinuxDevices.com Archive Index (1999-2012) | 2013-current at LinuxGizmos.com | About  

Tutorial sounds alarm for Nokia tablets

Aug 27, 2008 — by Eric Brown — from the LinuxDevices Archive
Please share:    Tweet about this on TwitterGoogle+Share on FacebookShare on LinkedInShare on RedditPin on PinterestEmail to someone

IBM's DeveloperWorks has published another tutorial by author Peter Seebach on developing for Linux-based Nokia Internet Tablets. The latest tutorial offers a command line program and related tips to ease the process of setting alarms on the Nokia N810 (pictured at left).

Seebach's article, “Linux on board: Developing for the Nokia N810; Put the alarm API to work,” follows up on his previous Nokia Internet Tablet tutorials, including his January post on setting up a webcam application for the N800. The alarm tutorial examines the C-language API to the alarm interface, and offers an interface to make the API available to shell scripts or programs in other languages.


Peter Seebach

Introduced for the N800 in Maemo 3.0, the alarm API presents a set of calls to interact with the alarm daemon, thereby configuring the behavior of a scheduled notification. The three main types of alarm tasks include displaying messages, running programs, and sending messages over the D-Bus to other applications. This tutorial, however, skips over the more complex D-Bus part of the interface.

Alarms are stored as XML in the “moderately human-readable” /var/lib/alarmd/alarm_queue.xml files, writes Seebach. “You can get a lot of insight into the components of alarm event structures by creating events using other applications, then reading the XML stored in this file,” he adds.

Each alarm has an initial time, a setting for how often it should recur, and a number of times to recur, he explains. Alarms are reported as sounds, pictures, or text messages. Although he finds the API “very flexible,” it cannot handle complex tasks such as factoring in Daylight Savings Time shifts for a weekly meeting.

Seebach then shows how to control alarm behavior with simple boolean flags, and also supplies code for letting users time their wakeup alarms prior to an event. He shows how to use the getopt() function for handling most command-line arguments, and then describes how to parse both the time specifier and an optional message, which includes any remaining arguments. After the event structure is filled in, a few lines of code are supplied to hand the structure off to the alarm API.

Working around the “quirks”

Seebach then goes into the API's various quirks, offering workarounds for each. For example, he shows how to avoid problems with using the default title, as well as another one involving a flag “to not display a dialog for the event.” He also provides workarounds for sound file and command execution quirks.

Seebach concludes with a strong recommendation that developers make use of the API and not try to reinvent the wheel. “Some applications for the N810 (and N800) do their own alarm management; this seems like a poor choice,” he writes. “Take the few minutes to learn the alarm API and use it. It will save you time, and integrate better with other programs that need to set alarms.”

Peter Seebach's full IBM DeveloperWorks tutorial, “Linux on board: Developing for the Nokia N810; Put the alarm API to work,” should be available here.


 
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.



Comments are closed.