Francis Devereux

November 6, 2008

S60 Remote Control API Weirdness

Filed under: Software Development, Symbian — frankoid @ 10:24 pm

I have been using Symbian OggPlay (a music player for mobile phones) for quite a while, first on a Nokia N70 and now on an N95. It doesn’t have support for the volume buttons on the N95, so I decided to add it. The N95 has a volume control on the side of the phone, and another one on the remote control in the headphone chord.

I used the remote control API to handle the volume controls, and noticed something strange: the actions reported to my code when the volume control on the headphone remote is used are different to the actions reported when the volume control on the phone is used. Here’s what is sent to my code’s MrccatoCommand method:

Volume control on headphone remote

When the volume up (or down) button is pressed, an ERemConCoreApiVolumeUp (or ERemConCoreApiVolumeDown) command is immediately sent with a button action of ERemConCoreApiButtonPress. When the button is released, another ERemConCoreApiVolumeUp (or ERemConCoreApiVolumeDown) command is sent with an action of ERemConCoreApiButtonRelease.

The headphone remote never generates commands with action set to ERemConCoreApiButtonClick.

Volume control on the side of phone

When this volume control is used, a different sequence of commands is reported depending on whether the button is held down for a short or a long time.

When the button is held down for a short time, only one command is sent and its action is set to ERemConCoreApiButtonClick.

When the button is held down for a long time, first a command with action ERemConCoreApiButtonClick is sent as soon as the button is pressed, then there is a short delay and a command with action ERemConCoreApiButtonPress is sent. When the button is released a command with action ERemConCoreApiButtonRelease is sent.

If you would like to look at my code, the patch to OggPlay is at http://www.devrx.org/software/symbian/oggplay/symbianoggplay-mediakeys.diff.

Create a free website or blog at WordPress.com.