×
Namespaces

Variants
Actions

KAccessoryModeChanged API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: ltomuta (17 Jun 2007)
Last edited: hamishwillee (02 Feb 2012)


Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.

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

File:DosServExam.zip

Known Issues

Note.pngNote: :While the API is include in the S60 3rd Edition FP1 version of the SDK API Plug-in it is a known issue that it will not work with S60 3rd Edition FP1 phones.

This page was last modified on 2 February 2012, at 08:25.
108 page views in the last 30 days.
×