This page was last modified 13:15, 24 June 2008.
KAccessoryModeChanged API
From Forum Nokia Wiki
| Note! |
|---|
|
Purpose
The services offered by DOS(Domestic OS) server can be accessed through DOS Client API. The services offered by DOS Client API are – Registering for listening and receiving DOS events, accessory related services, bluetooth audio related services etc.
Use cases
1. We can get notification when an accessory like wired headset, Bluetooth headset is connected or disconnected. We can listen to accessory mode change events using CDosEventListenerBase.
2. We can also listen to wired headset button events with CDosEventListenerBase
Example code
Header
#include <dossvrservices.h>// To access dos services
Link against
LIBRARY dsclient.lib
1. Derive from CDosEventListenerBase.
2. Connect to dos server session
RDosServer session; session.Connect();
Usecase1: Get notification when an accessory is connected or disconnected
3. Start listening to accessory mode changed events.
StartListeningL(KAccessoryModeChanged,sizeof(TDosAccessoryMode),EOnlyLast);
4. Callback function AccessoryModeChangedL will be called whenever it detects an accessory.
void CDosServExampleAppUi::AccessoryModeChangedL(TDosAccessoryMode aAccessoryState) { switch(aAccessoryState) { case EDosAccNotConnected: { CEikonEnv::InfoWinL(_L("Accessory not connected"),_L("")); break; } case EDosAccUnsupportedConnected: { CEikonEnv::InfoWinL(_L("Unsupported accessory"),_L("")); break; } case EDosAccModeHeadset: { CEikonEnv::InfoWinL(_L("Wired Headset detected"),_L("")); break; } }; }
Usecase2 :To listen to wired headset button events
3. Start listening to wired headset button change events
StartListeningL(KHeadsetButtonChanged,sizeof(EPSButtonState),EOnlyLast);
4. Callback function HeadsetButtonChangedL will be called whenever there is headset buttonpress.
void CDosServExampleAppUi::HeadsetButtonChangedL(EPSButtonState aState) { switch(aState) { case EPSButtonUp: { CEikonEnv::InfoWinL(_L("Button up event"),_L("")); break; } case EPSButtonDown: { CEikonEnv::InfoWinL(_L("Button down event"),_L("")); break; } case EPSButtonDownLongPress: { CEikonEnv::InfoWinL(_L("Long press "),_L("")); break; } }; }
Example project
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| API Nokia12 and Jars | thales-coutinho | Nokia M2M | 1 | 2004-04-19 04:20 |
| Wireless Messaging API? If no? | SilentVOX | Mobile Java General | 1 | 2006-04-11 06:40 |
| PC Connectivity SDK | palandia | Tools and SDK Feedback | 3 | 2008-02-16 08:26 |
| Location API | shuaiying | Mobile Java General | 0 | 2004-04-12 04:17 |
| [Moved] How cani get incoming number of mobile in ringing state? | Prexa | General Symbian C++ | 15 | 2008-06-21 07:48 |
